Turok
 
Loading...
Searching...
No Matches
kWeapon Class Reference
Inheritance diagram for kWeapon:
kActor

Public Member Functions

kVec3 TransformToOwnerPosition ()
 returns the OffsetPosition() * the players matrix.
 
kVec3 TransformToOwnerPosition (const kVec3 &in vector)
 returns the (OffsetPosition() + vector) * the players matrix.
 
void FireProjectile (const kStr &in fxPath, const float x, const float y, const float z, const bool adjustToPerspective=false)
 SpawnsFx at the players at the position passed in * players rotation, then adds the viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags. adjustToPerspective will change the position you pass in like this:
 
bool & PreventFire ()
 Use in OnBeginFire to internally prevent from entering its Fire state.
 
kVec3OffsetPosition ()
 Offset position of weapon.
 
int & State ()
 EnumWeaponStates.
 
kPlayerOwner ()
 
- Public Member Functions inherited from kActor
const bool IsStale () const
 Actor is marked as removed and is waiting to be freed from memory when it next checks if there are no more references to this actor.
 
kAngleYaw ()
 
kAnglePitch ()
 
kAngleRoll ()
 
kVec3Origin ()
 Position in world space.
 
kVec3Scale ()
 
kVec3PrevOrigin ()
 
void SetTarget (kActor@ actor)
 
kActor GetTarget ()
 
void SetSector (const uint sectorIndex)
 
void Remove ()
 Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
 
kVec3Velocity ()
 
kVec3Movement ()
 
kQuatRotation ()
 
int16 & Health ()
 
int & Type ()
 The actors Type ID.
 
int & ImpactType ()
 EnumImpactType.
 
bool & IgnoreSectorHeightChange (void)
 if true will not change position(or velocity and movement) when sector height changes.
 
int & ModelVariation ()
 
int & SpeciesMask ()
 
uint & Flags ()
 EnumActorFlags.
 
const uint SpawnFlags1 () const
 EnumActorSpawnFlags1.
 
const uint SpawnFlags2 () const
 EnumActorSpawnFlags2.
 
const uint SpawnFlags3 () const
 EnumActorSpawnFlags3.
 
const int TID () const
 
float & Radius ()
 
float & Height ()
 
float & StepHeight ()
 AKA Dead Height. Used for moving up steps, figuring out if in waterheight, and the height of the actor when they are dead so you can still shoot them.
 
float & WallRadius ()
 
float & Gravity ()
 
float & Friction ()
 
float & AnimSpeed ()
 
float & BounceDamp ()
 
float & FloorHeight ()
 
float & CeilingHeight ()
 
const int SectorIndex ()
 
const int AreaID () const
 
bool InstanceOf (const kStr &in className) const
 example: InstanceOf("kexPuppet")
 
void PlaySound (const kStr &in soundPath)
 
void PlaySoundWithLookupID (const int soundID)
 
void StopSound ()
 
void StopLoopingSounds ()
 
const int GameTicks () const
 
kAnimStateAnimState ()
 
kRenderModel RenderModel ()
 
const bool InWater () const
 
bool CheckPosition (const kVec3 &in origin)
 checks if the actor can move to this location
 
bool CheckPosition (const float angle, const float distance)
 calls CheckPosition(kVec3 origin) with location being: Actor.Origin() + (angle*distance*actor.Radius())
 
float GetTurnYaw (const kVec3 &in lookAtLocation) const
 
float GetAvoidanceAngle (const kVec3 &in lookAtLocation, const float distance)
 
const float GetWaterHeight () const
 
const bool CanSee (kActor@ actor, const uint excludeClipFlags=0)
 excludeClipFlags to ignore/disable (EnumClipFlags)
 
uint & ClipFlags ()
 EnumClipFlags.
 
kDictMem Definition ()
 get actors def data
 
bool OnGround () const
 
int GetWaterLevel () const
 EnumWaterLevel.
 
kActor CastToActor ()
 Casts to a kActor. Only used for kPuppet Actor().
 
kAI CastToAI ()
 Casts to kAI. returns null if isn't a kAI.
 
void SpawnProjectile (const kStr &in fxPath, const kVec3 &in pos, const kVec3 &in targetLocation, const float maxAngle)
 
void MeleeObject (const kStr &in damageType, const kVec3 &in offset, const float radius)
 
void SpawnFx (const kStr &in fxPath, const kVec3 &in pos)
 
void SpawnFx (const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
 
kVec3 GetTransformedVector (const kVec3 &in vector)
 
float DistanceToPoint (const kVec3 &in point) const
 calls DistanceToPoint(x,y,z)
 
float DistanceToPoint (const float x, const float y, const float z) const
 actors point is in the center
 
void InflictGenericDamage (kActor@ inflictor, const int damage)
 
void InflictDamage (kActor@ inflictor, const kStr &in damageDef)
 
void InteractActorsAtPosition (const kVec3 &in pos, const kStr &in callbackFunc, const float arg1=0, const float arg2=0, const float arg3=0, const float arg4=0)
 
kScriptObject ScriptObject ()
 
void MoveToPosition (const float x, const float y)
 Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
 
bool RandomDecision (const int randomBit) const
 randomBit should be >= 2. if a random value has the bit set and actors GameTicks also has the bit set then returns true.
 
void SetPosition (const kVec3 &in pos)
 best way to set an actors position, will also set the sector and clearinterpolation
 
const int16 SpawnParams (const int paramID) const
 Get a map actors param value.
 
const float GetCeilingHeight () const
 calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
 
const float GetFloorHeight () const
 calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
 
void RunFxEvent (const kStr &in fxEventName)
 Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");.
 
const int GetSectorIndexAtLocation (const kVec3 &in pos, uint excludeClipFlags=0)
 excludeClipFlags to ignore/disable (EnumClipFlags)
 
void MarkPersistentBit (const bool clear)
 
const bool IsPersistentMarked ()
 
void SetHeadTrackTarget (kActor@ actor)
 
void ClearInterpolation ()
 
void AutomapToggle (const bool show)
 Use with Game.AutomapCustom(true);.
 
void SetAutomapColor (const int r, const int g, const int b)
 
void SetSpawnParams (const int param, const int16 value)
 Sets the actors param value. all params are int16.
 
void SetSpawnFlags1 (const uint flags)
 EnumActorSpawnFlags1.
 
void SetSpawnFlags2 (const uint flags)
 EnumActorSpawnFlags2.
 
void SetSpawnFlags3 (const uint flags)
 EnumActorSpawnFlags3.
 
void SetupSpawnParams ()
 call after setting your actors spawnflags for them to take effect on the kActor
 
void SetCustomDeadHeight (const bool bUse, const float height)
 Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
 
const float GetCustomDeadHeight ()
 
const bool GetUsingCustomDeadHeight ()
 
const bool OverridingKeyTouchTID ()
 used only for key pickups
 
const int16 GetOverrideKeyTouchTID ()
 used only for key pickups
 
void OverrideKeyTouchTID (const bool bOverride, const int16 tid)
 used only for key pickups to tell what key it is in the hub
 
bool & SkipKeyTouchCinema ()
 used only for key pickups
 
void SetModel (kStr &in modelFile, kStr &in animFile)
 a way to set the model/anim for actors that had no model set previously
 
bool & TriggerInvincibility ()
 Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
 
void GetBoundsMinMax (kVec3 &out min, kVec3 &out max) const
 actor must not be sleeping and have a model set and not be a pickup. otherwise will return default min/max values of (-128, -128, -128) (128, 128, 128)
 
const int MapActorIndex () const
 Returns -1 if not a map actor.
 
int & DifficultyMode ()
 The difficulty this actor is currently set to.
 
void OverrideOnDamageValue (const int damage, const bool bOverride=true)
 call in OnPreDamage
 
bool & NoKnockBack ()
 Will not receive knock back movement from things like the alien weapon for example.
 
const float BaseHeight () const
 height of actor when spawned or when kAI regenerated
 
void RunAction (const int funcID, const float w=0.0f, const float x=0.0f, const float y=0.0f, const float z=0.0f)
 run a function on the actor defined in defs/animActions.txt
 
float & AirFriction ()
 default = 1.0f
 
float & WaterFriction ()
 default = 0.5f (same as Friction)
 
float & Mass ()
 default = GAME_SCALE * 1.0f
 
const float GetSkyHeight () const
 
bool & ChildOfTarget (void)
 if this actors Target is an actor that belongs to the owner of the Fx, explosion or melee attack then won't collide/get damaged.
 
kVec3 DamageOrigin (void) const
 The Origin point of the attacker (Fx, Actor, or null (returns this actors origin in that case)) who damaged this actor last. Gets set before OnPreDamage.
 
kVec3 DamageVelocity (void) const
 The Velocity of the attacker (Fx, Actor, or null (returns this actors velocity in that case)) who damaged this actor last. Gets set before OnPreDamage.
 
const bool CanSee (kPuppet@ puppet, const uint excludeClipFlags=0)
 excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg is only available for kActor, not for kPuppet or kAI or kWeapon.
 

Detailed Description

Definition at line 1193 of file t1_scriptAPI.cpp.

Member Function Documentation

◆ FireProjectile()

void kWeapon::FireProjectile ( const kStr &in fxPath,
const float x,
const float y,
const float z,
const bool adjustToPerspective = false )

SpawnsFx at the players at the position passed in * players rotation, then adds the viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags. adjustToPerspective will change the position you pass in like this:

float d = kexMath::Pow(47.5f / fov, fov / 60.0f);
vOrigin.y *= d;
vOrigin.z += (1.0f - d) * 2.0f;

◆ OffsetPosition()

kVec3 & kWeapon::OffsetPosition ( )

Offset position of weapon.

◆ Owner()

kPlayer & kWeapon::Owner ( )

◆ PreventFire()

bool & kWeapon::PreventFire ( )

Use in OnBeginFire to internally prevent from entering its Fire state.

◆ State()

int & kWeapon::State ( )

◆ TransformToOwnerPosition() [1/2]

kVec3 kWeapon::TransformToOwnerPosition ( )

returns the OffsetPosition() * the players matrix.

◆ TransformToOwnerPosition() [2/2]

kVec3 kWeapon::TransformToOwnerPosition ( const kVec3 &in vector)

returns the (OffsetPosition() + vector) * the players matrix.