Scripting API

Author: Behemoth Programmer

Text Download Document https://turoksanctum.com/wp-content/uploads/2017/05/5_9_17_ScriptAPI.txt

Original Source Dropbox: https://www.dropbox.com/sh/yj01yv4rsl4u6xd/AABbxi7fznHiAB0C-zzHWxlfa?dl=0&preview=ScriptAPI.txt

 

//------------------------------------------------------------------------------------------------------------------------
| Globals
//------------------------------------------------------------------------------------------------------------------------
const bool IsMultiplayer(void) //in a multiplayer match online or offline
void DoPlayerWarp(const int, const int warpTID, const int mapID = -1, const bool playWarpAnimation = false)
		//Example: DoPlayerWarp(0, 17401, kLevel_BlindOneBoss, true);
void SpawnShake(const kVec3& in directionPower, const kVec3& in origin, const float radius, bool bounceSmooth)
	//SpawnShake(kVec3(0, 0, fShake), self.Owner().Actor().Origin(), 10000, true);
void DefineMode(const kStr& in, const uint32, const kStr& in, const kStr& in, const uint32, const uint32, const kStr& in, const float, const float, const uint32, const uint32)
	//Example: DefineMode("ActionObjectModeTable", ACTIONOBJECT_MODE_TRIGGER,  "void MODE_TriggerSetup(void)", "void MODE_TriggerTick(void)",  CF_STATIC, 0, "int MODE_TriggerAnim(void)", 0, 0, 0, MF_NOROOTMOTION);
const float GAME_DELTA_TIME
const float GAME_SCALE = 10.240000
const float GAME_FRAME_TIME = 0.250000
const float GAME_FRAME_UNIT = 4.000000
const float GAME_SECONDS = 0.066667 (1 / 15th of a second)

//------------------------------------------------------------------------------------------------------------------------
| kNetwork Network
//------------------------------------------------------------------------------------------------------------------------
bool IsNetgame(void)
kActor@ GetNetActor(int16 netID)
kParticle@ GetNetParticle(int16 netID)
bool IsServer(void)
bool IsClient(void)
void TransmitToAll(void) //from server to clients. Call after NetSend writes

//------------------------------------------------------------------------------------------------------------------------
| NetRecv ///should only be called for client players (Network.IsNetgame() && Network.IsClient()) and read in the same order as was writen
//------------------------------------------------------------------------------------------------------------------------
int16 ReadInt16(void) //call in sent func
int32 ReadInt32(void) //call in sent func

//------------------------------------------------------------------------------------------------------------------------
| NetSend //only do these calls for the server player (Network.IsNetgame() && Network.IsServer())
//------------------------------------------------------------------------------------------------------------------------
void Clear(void); //call before WriteScriptHeader 
void WriteScriptHeader(const kStr&in funcHeader) //call after Clear (only clients will recieve the ScriptHeader)
	//Example: NetSend::WriteScriptHeader("void NetworkRecvSpawnBoreController(void)");
void WriteInt16(int16) //call after WriteScriptHeader
void WriteInt32(int32) //call after WriteScriptHeader

//------------------------------------------------------------------------------------------------------------------------
| kSys Sys
//------------------------------------------------------------------------------------------------------------------------
void Print(const kStr &in message)
void Warning(const kStr &in message)
int VideoWidth(void)
int VideoHeight(void)
int Mouse_X(void)
int Mouse_Y(void)
const bool GetCvarValue(const kStr &in name, kStr &out result) //returns true if found cVar name

//------------------------------------------------------------------------------------------------------------------------
| Event Functions to ScriptObject
//------------------------------------------------------------------------------------------------------------------------
void OnBeginLevel(void) //never gets called?
void OnTick(void)
void OnEndLevel(void) //never gets called?
void OnSpawn(void) //not called for actors created with ActorFactory
void OnPreDamage(kDamageInfo& in dmgInfo) //called before OnDamage and OnDeath
void OnDamage(kDamageInfo& in dmgInfo)
	//called after OnDeath and OnPreDamage.
	//Health is reduced after this is called which means after an OnDeath call the remaining Health will always be negative of the damage taken.
	//This is never called if an actor of the same Type() ID damages another actor of the same Type() ID. But PreDamage is still called.
void OnLevelLoad(kDictMem@ pDict) //called when actor is placed on the map in the editor and the map is loaded. Not called when Loading a save game.
void OnDeath(kDamageInfo& in dmgInfo) //called after OnPreDamage and before OnDamage.
void OnTouch(kActor@ pInstigator)
void OnTrigger(kActor@ pInstigator, const int msg)
void UserEvent(const float x, const float y, const float z, const float f1, const float f2, const float f3, const float f4) //4 flag values for various uses?
void OnCollide(kActor@ pCollider)
void OnSerialize(kDict& out dict)
void OnDeserialize(kDict& in dict)

//------------------------------------------------------------------------------------------------------------------------
| Execution Order of Event Startup Functions:
//------------------------------------------------------------------------------------------------------------------------
.ctor
OnLevelLoad <-- when actor was placed in editor. Not called on Deserialize. Not called for Player actor.
OnDeserialize <-- if loaded a saved game
OnSpawn <-- not called for actors created with ActorFactory.
OnTick

//------------------------------------------------------------------------------------------------------------------------
| Event Functions to ScriptObject (kWeapon)
//------------------------------------------------------------------------------------------------------------------------
void OnBeginFire()
void OnFire()
void OnEndFire()
void OnLower()
void OnRaise()
void OnHoldster()
void OnFiredParticleFromAnim(kParticle@ particle)

//------------------------------------------------------------------------------------------------------------------------
| kDamageInfo
//------------------------------------------------------------------------------------------------------------------------
float hits //damage
kParticle@ particle //(when calling InflictDamage, setting this to null will have same effect as not null)
kActor@ inflictor //same as source? (when calling InflictDamage, setting this to null will have same effect as not null)
kActor@ source //attacker
kActor@ target //victim (when calling InflictDamage, setting this to null will have same effect as not null)
uint boneFlags //EnumDamageFlags? (how the bone was damaged? 0 means didn't hit a specfic bone and should check the flags variable for the damage flags instead)
int boneID //the bone that was hit (-1 means didn't hit a specfic bone) //Raptor Head BoneID = 17, Tail bones are 1-3 ... so on....
uint flags //EnumDamageFlags
float radius
bool opEquals(const ?&in)
const bool opEquals(const ref &in)

//------------------------------------------------------------------------------------------------------------------------
| kActorIterator
//------------------------------------------------------------------------------------------------------------------------
kActor@ GetNext(void)
	//Example to iterate through all actors in the map:
		//kActorIterator cIterator;
		//kActor@ pActor;
		//while(!((@pActor = cIterator.GetNext()) is null))
		//{
			//do something with pActor
		//}
		
//------------------------------------------------------------------------------------------------------------------------
| kAnimTrackComponent
//------------------------------------------------------------------------------------------------------------------------
kActor @Owner(void)
void Toggle(const bool isVisible)
const int NumFrames(void)
const int CurrentFrame(void)
void Set(const int animID, float animSpeed, int animStateFlags)
void Blend(const int animID, float animSpeed, float blendSpeed, int animStateFlags)
bool CheckAnimID(const int animID) //returns true if animID exists in the actors animations
bool IsPlaying(const int animID)
const float TrackTime(void)
const float PlayTime(void)
void Resume(void)
void Pause(void)
void Stop(void)
const int PlayingID(void)
const const bool CycleCompleted(void)
const bool Looping(void)
const bool Blending(void)
const bool Stopped(void)
uint &MovementClipFlags(void)
int &Flags(void) //EnumAnimStateFlags
void SetLastFrame(const bool = false)
void ChangeSpeed(const float speed)
const uint AnimCount(void)

//------------------------------------------------------------------------------------------------------------------------
| kRenderMeshComponent
//------------------------------------------------------------------------------------------------------------------------
void ToggleHotPoint(const int fxType, const bool showFx)
	//fx types:
	//1 = on fire (needs to be called ontick for continuous caught on fire effect)
	//6 = bore head blood gushing
	//??? = damage outline indicator (bosses)
void SetAttachedMeshVisibility(const uint meshID, const bool visible)
void SwapOutMesh(const int meshID)
int& AltTexture(void) //set to -1 = first texture, 0 = second ...
uint8& Flags(void) //EnumRenderMeshComponentFlags
kVec3& HeadTrackPos(void)
bool& CanFlinch(void)
uint32& FxFlags(void)
void SetScale(const int nodeID, const kVec3& in scale)
void SetRotationOffset(const int nodeID, const float angle, const float xMul, const float yMul, const float zMul)
//Example:
	//self.RenderMeshComponent().SetRotationOffset(m_gunNode, self.Pitch(), 1, 0, 0);
	//self.RenderMeshComponent().SetRotationOffset(1, Math::Deg2Rad(m_spinAngle), 0, 1, 0);
	
//------------------------------------------------------------------------------------------------------------------------
| kWorldComponent
//------------------------------------------------------------------------------------------------------------------------
float &WallRadius(void)
float &Radius(void)
int16 &Flags(void) //EnumWorldComponentFlags
float &DeadHeight(void)
float &HeightOffset(void)
float &Height(void)
float &TouchRadius(void)
void SetNearestPosition(const kVec3&in origin)
void SetRegion(const int, const bool = true)
bool HasCollision(void)
void LinkArea(void)
const bool FindRegionAtOrigin(const kVec3&in origin, const bool = true)
const int RegionIndex(void)
const int16 GetNearPositionAndRegionIndex(const kVec3&in pos, kVec3&out posResult, const uint enumClipFlags =34390119) //returns the regionIndex. enumClipFlags default is CF_NEARREGIONTEST
float& FloorHeight(void)
kActor@ Owner()
void HitScan(kClipInfo&out, const kVec3&in origin, const kVec3&in targetOrigin, const uint EnumClipFlags, const float=0)

//------------------------------------------------------------------------------------------------------------------------
| kModeStateComponent
//------------------------------------------------------------------------------------------------------------------------
void ForgetAnimState(void)
int32& PrevMode(void)
const int32 Mode(void)
float& ModeTime(void)
bool SetMode(const int modeID, const bool = false)
void AssignModeTable(const kStr&in modeTableName)

//------------------------------------------------------------------------------------------------------------------------
| kMovementComponent
//------------------------------------------------------------------------------------------------------------------------
float& AirFriction(void)
float& Friction(void)
float& Mass(void)
kVec3& Velocity(void)
uint& Flags(void) //EnumMovementComponentFlags
float& WaterGravity(void)
float& Gravity(void)
float& WaterFriction(void)
uint& ClipFlags(void) //EnumClipFlags

//------------------------------------------------------------------------------------------------------------------------
| kEnemyAIComponent
//------------------------------------------------------------------------------------------------------------------------
const uint32 CommonFlags(void) //EnumEnemyAICommonFlags
uint32& SpawnFlags(void) //EnumEnemyAIGeneralFlags
const float GetAvoidanceAngle(const kVec3&in, const float)
void Turn(const float turnSpeed, const float deltaAngle)
const bool HasOverrideTarget(void) //returns true if a different actor(enemy or player) becomes a higher priority target (from taking damage from this override target)
void GetMovementInfo(void)
kAITargetInfo& SightTarget(void) //target to attack
kAITargetInfo& PathTarget(void) //target to move to
void SetNoUpdateTarget(const bool ignorePlayerPath, const bool ignorePlayerSight)
	//if ignorePlayerPath is true ignores pathing to player (goes to default behaviour - go back and stand at spawn position and if has path(set in editor with pathpoints) then start the path over again
	//if ignorePlayerSight is true ignores sight/attacking to player (goes to default behaviour - can attack other targets that are set with SetTarget() or the OverrideTarget that gets set internally. OverrideTarget takes priority.)
void GetTargetInfo(const bool getPathInfo, const bool getSightInfo)
	//if getPathInfo is true PathTarget() will return updated info
	//if getSightInfo is true SightTarget() will return updated info
	
//------------------------------------------------------------------------------------------------------------------------
| kAITargetInfo
//------------------------------------------------------------------------------------------------------------------------
void Reset(void) //clears all data in this kAITargetInfo
kActor@ Target(void)
void SetTarget(kActor@)
int m_eType //0 is sees target/is not pathing to target ? | 3 is looking for target/is pathing to target ? | 7 is ???
float m_fDist
kVec3 m_vDeltaTargetPos
kVec3 m_vTargetPos
float m_fDeltaAngle
float m_fDistXY

//------------------------------------------------------------------------------------------------------------------------
| kClipInfo
//------------------------------------------------------------------------------------------------------------------------
float fraction //returns the 0.0 - 1.0 range of the point of intersection from start to end trace. (If fraction is == 1.0 then no intersection occured.)
int contactRegion
int impactType
kVec3 vInterceptVector //Returns the vector that intersected the collided geometry
kVec3 vContactNormal //Returns the normalized vector of the collided surface
uint clipResult //EnumClipFlags - specifies the type of intersection
bool bHitWater
int16 wBoneType
int16 wBoneID
kWorldComponent@ pContactCollider //handle pointer to colliders WorldComponent (null if none was collided)

//------------------------------------------------------------------------------------------------------------------------
| Enums
//------------------------------------------------------------------------------------------------------------------------
EnumDamageFlags
DF_NORMAL = 1 << 0
DF_VIOLENT = 1 << 1
DF_EXPLOSIVE = 1 << 2
DF_EXTREME = 1 << 3
DF_LAVA = 1 << 4
DF_DROWN = 1 << 5

EnumPlayerFlags
PF_NOCLIP = 1 << 0
PF_FLY = 1 << 1
PF_DEAD = 1 << 2
PF_GOD = 1 << 3
PF_JUMPING = 1 << 4
PF_HASJUMPED = 1 << 5
PF_INWARPAREA = 1 << 6
PF_CLIMBTHRUST = 1 << 7
PF_NOAIRFRICTION = 1 << 8
PF_CRAWLING = 1 << 9
//PF_FLOATCAM = 1 << 11 (not defined)
//??? = 1 << 12 (not defined) - another CLIMBTHRUST?
//PF_LOCKWEAPON = 1 << 15 (not defined - can't change weapon)
//PF_THIRDPERSON = 1 << 18 (not defined - shows the players model and hides the weapon model)
//PF_SPECTATE = 1 << 19 (not defined)
//PF_NOWEAPON = 1 << 21 (not defined - hides weapon and disables weapon switching and firing)
//PF_DEMIGOD = 1 << 22 (not defined - When damaged health will not go below 1 - can still die by death pits)

EnumEnemyAICommonFlags (not defined)
//EAICF_HIDDEN = 1 << 12

EnumAnimStateFlags
ANF_BLEND = 1 << 0
ANF_LOOP = 1 << 1
ANF_STOPPED = 1 << 2
ANF_NOINTERRUPT = 1 << 3
ANF_ROOTMOTION = 1 << 4
ANF_PAUSED = 1 << 5
ANF_CYCLECOMPLETED = 1 << 6
ANF_LINEARBLEND = 1 << 7
ANF_NOACCUMULATION = 1 << 8

EnumActorFlags (undefined 4,7,10,11,12,13 flags?)
AF_NODAMAGE = 1 << 0
AF_HIDDEN = 1 << 1
AF_DEAD = 1 << 2
AF_TRIGGERED = 1 << 3
//??? = 1 << 4 (not defined)
AF_ALLOWTRACKING = 1 << 5
AF_NOINFLICTDAMAGE = 1 << 6
//AF_SHOWGIZMOS = 1 << 7 (not defined - shows origin and object radius debug gizmos on actor)
AF_CASTSHADOW = 1 << 8
AF_NOGENERATE = 1 << 9
//AF_EASY = 1 << 10 (not defined)
//AF_NORMAL = 1 << 11 (not defined)
//AF_HARD = 1 << 12 (not defined)
//AF_HARDCORE = 1 << 13 (not defined)
AF_IMPORTANT = 1 << 14
AF_DESERIALIZED = 1 << 15
AF_FULLSHADOWRESOLUTION = 1 << 16
AF_HIDEINCINEMATICS = 1 << 17
AF_EVENTSPAWNED = 1 << 18
AF_HASTRIGGERLISTENER = 1 << 19
AF_HASRESETRLISTENER = 1 << 20
AF_HASSHOTLISTENER = 1 << 21
AF_HASDEATHLISTENER = 1 << 22
AF_HASCOLLIDELISTENER = 1 << 23

EnumClipFlags
CF_CLIPEDGES = 1 << 0
CF_IGNOREBLOCKERS = 1 << 1
CF_DROPOFF = 1 << 2
CF_NOENTERWATER = 1 << 3
CF_NOEXITWATER = 1 << 4
CF_NOCLIPSTATICS = 1 << 5
CF_NOCLIPACTORS = 1 << 6
CF_ALLOWCLIMB = 1 << 7
CF_ALLOWCRAWL = 1 << 8
CF_COLLIDECORPSES = 1 << 9
CF_NOBACKFACECULLING = 1 << 10
CF_COLLIDEWATER = 1 << 11
CF_USEWALLRADIUS = 1 << 12
CF_GREASESLIDEOBJECTS = 1 << 13
CF_ALLOWRESTRICTEDAREAS = 1 << 14
CF_CHECKLINKEDBRIDGES = 1 << 15
CF_POLYCOLLISION = 1 << 16
CF_TRACKGROUND = 1 << 17
CF_WALKWALLS = 1 << 18
CF_TESTONLY = 1 << 19
CF_COLLIDECEILING = 1 << 20
CF_COLLIDEFLOOR = 1 << 21
CF_COLLIDEJOINTS = 1 << 22
CF_CANLANDONOBJECTS = 1 << 23
CF_NOEXITRESTRICTEDAREAS = 1 << 24
CF_ALLOWPLAYERRESTRICTED = 1 << 25
CF_NOEXITPLAYERRESTRICTED = 1 << 26
CF_NOENTERLAVA = 1 << 27
CF_NOEXITLAVA = 1 << 28
CF_NOENTERSWAMP = 1 << 29
CF_NOEXITSWAMP = 1 << 30
CF_DEAD_CHARACTER = CF_CLIPEDGES | CF_DROPOFF | CF_COLLIDECORPSES | CF_USEWALLRADIUS | CF_CHECKLINKEDBRIDGES | CF_TRACKGROUND | CF_COLLIDECEILING | CF_ALLOWPLAYERRESTRICTED //34771461
CF_CHARACTER_UNDERWATER = CF_CLIPEDGES | CF_DROPOFF | CF_USEWALLRADIUS | CF_CHECKLINKEDBRIDGES | CF_TRACKGROUND | CF_COLLIDECEILING | CF_ALLOWPLAYERRESTRICTED | CF_NOENTERSWAMP //705859589
CF_CHARACTER_FLYING = CF_CLIPEDGES | CF_DROPOFF | CF_NOENTERWATER | CF_USEWALLRADIUS | CF_CHECKLINKEDBRIDGES | CF_TRACKGROUND | CF_COLLIDECEILING | CF_ALLOWPLAYERRESTRICTED | CF_NOENTERSWAMP //705859597
CF_CHARACTER = CF_CLIPEDGES | CF_NOENTERWATER | CF_USEWALLRADIUS | CF_CHECKLINKEDBRIDGES | CF_TRACKGROUND | CF_ALLOWPLAYERRESTRICTED | CF_NOENTERSWAMP //704811017
CF_RAYCAST = CF_CLIPEDGES | CF_DROPOFF | CF_ALLOWCRAWL | CF_ALLOWRESTRICTEDAREAS | CF_CHECKLINKEDBRIDGES | CF_WALKWALLS | CF_TESTONLY | CF_ALLOWPLAYERRESTRICTED  //34390277
CF_STATIC = CF_CLIPEDGES | CF_DROPOFF | CF_NOCLIPSTATICS | CF_NOCLIPACTORS | CF_ALLOWCRAWL | CF_ALLOWRESTRICTEDAREAS | CF_ALLOWPLAYERRESTRICTED  //33571173
CF_NEARREGIONTEST = CF_CLIPEDGES | CF_IGNOREBLOCKERS | CF_DROPOFF | CF_NOCLIPSTATICS | CF_NOCLIPACTORS | CF_ALLOWRESTRICTEDAREAS | CF_CHECKLINKEDBRIDGES | CF_WALKWALLS | CF_TESTONLY | CF_ALLOWPLAYERRESTRICTED   //34390119
CF_PARTICLE = CF_CLIPEDGES | CF_IGNOREBLOCKERS | CF_DROPOFF | CF_ALLOWCRAWL | CF_COLLIDECORPSES | CF_COLLIDEWATER | CF_ALLOWRESTRICTEDAREAS | CF_CHECKLINKEDBRIDGES | CF_COLLIDECEILING | CF_COLLIDEFLOOR | CF_ALLOWPLAYERRESTRICTED  //36752135
CF_SIMPLE_OBJECT = CF_CLIPEDGES | CF_DROPOFF | CF_NOCLIPACTORS | CF_CHECKLINKEDBRIDGES | CF_COLLIDECEILING | CF_COLLIDEFLOOR | CF_NOENTERLAVA | CF_NOENTERSWAMP  //674267205

EnumModeFlags
MF_INVINCIBLE = 1 << 0
MF_HEADTRACK = 1 << 1
MF_CLEARMOVEMENT = 1 << 2
MF_NO_BLEND = 1 << 3
MF_IDLE = 1 << 4
MF_CLEARLOOPSOUNDS = 1 << 5
MF_NOACCUMULATION = 1 << 6
MF_NOROOTMOTION = 1 << 7

EnumRenderMeshComponentFlags (undefined 6th flag?)
RMCF_RENDER_AS_WEAPON = 1 << 0
RMCF_CLOAKED = 1 << 1
RMCF_HEADTRACK = 1 << 2
RMCF_TINYMODE = 1 << 3
RMCF_WAGGLE = 1 << 4
RMCF_SHOCKED = 1 << 5
RMCF_NOEXPANDJOINTS = 1 << 7

EnumWorldComponentFlags
WCF_NONSOLID = 1 << 0
WCF_INVOKE_COLLIDE_CALLBACK = 1 << 1
WCF_ON_PLATFORM = 1 << 2
WCF_NO_CLAMP_TO_FLOOR = 1 << 3
WCF_ON_WATER = 1 << 4
WCF_UNDER_WATER = 1 << 5
WCF_ABOVE_WATER = 1 << 6
WCF_IN_SHALLOW_WATER = 1 << 7
WCF_IN_ANTIGRAVITY = 1 << 8
WCF_AT_CLIMBING_SURFACE = 1 << 9
WCF_ON_CROUCH_ENTEREXIT = 1 << 10
WCF_ON_CROUCH = 1 << 11
WCF_JUST_ENTERED_DEATH_REGION = 1 << 12
WCF_TRACK_GROUND = 1 << 13

EnumEnemyAIGeneralFlags
EAIGF_CLIMBUP = 1 << 0
EAIGF_DROPOFF = 1 << 1
EAIGF_ENTERWATER = 1 << 2
EAIGF_EXITWATER = 1 << 3
EAIGF_ENTERLAVA = 1 << 4
EAIGF_EXITLAVA = 1 << 5
EAIGF_PICKUP_ON_GROUND = 1 << 6
EAIGF_PICKUP_ON_AIR = 1 << 7
EAIGF_PICKUP_ON_WATER = 1 << 8
EAIGF_ENTERRESTRICTED = 1 << 9
EAIGF_EXITRESTRICTED = 1 << 10
EAIGF_ENTERSWAMP = 1 << 11
EAIGF_EXITSWAMP = 1 << 12
EAIGF_ENTERCROUCH = 1 << 13
EAIGF_EXITCROUCH = 1 << 14
EAIGF_ATTACK_LANDED = 1 << 15
EAIGF_STUN_LOCKED = 1 << 16

EnumMovementComponentFlags
MCF_NO_GRAVITY = 1 << 0
MCF_FALLING = 1 << 1
MCF_ALLOW_SLIDING = 1 << 2
MCF_SLIDING = 1 << 3
MCF_UNDERWATER = 1 << 4
MCF_DISABLE_AIR_FRICTION_UNTIL_LAND = 1 << 5
MCF_PROCESS_MOVEMENT = 1 << 6

ParticleFlags (undefined 0,1 flags?)
FXF_PERMANENT = 1 << 2
FXF_NOCOLLISION = 1 << 3
FXF_ONE_FRAME_ONLY = 1 << 4
FXF_NO_INBETWEENS = 1 << 5
FXF_STICK_CHAR = 1 << 6
FXF_STICK_STATIC = 1 << 7
FXF_NO_SOUND = 1 << 8
FXF_ATTACH_TO_PLAYER = 1 << 9
FXF_BLOOD = 1 << 10
FXF_UNDERWATER = 1 << 11
FXF_BECAME_PICKUP = 1 << 12
FXF_ALTERNATE_BLOOD = 1 << 13
FXF_DREW_BLOOD = 1 << 14
FXF_DREW_BLOOD_GREEN = 1 << 15
FXF_PASSON = FXF_NO_SOUND | FXF_UNDERWATER //2304

EnumPlayerButtons
BC_ATTACK = 1 << 0
BC_JUMP = 1 << 1
BC_FORWARD = 1 << 2
BC_BACKWARD = 1 << 3
BC_STRAFELEFT = 1 << 4
BC_STRAFERIGHT = 1 << 5
//BC_CROUCH = 1 << 6 (Not defined for some reason)
BC_ALTFIRE = 1 << 7
BC_SCOPEZOOMIN = 1 << 8
BC_SCOPEZOOMOUT = 1 << 9

EnumEnemyAITargetTypes
EAITT_ATTACKER = 0
EAITT_FLEE = 1
EAITT_LEADER = 2
EAITT_LEASH = 3
EAITT_PATH = 4
EAITT_OBJECT = 5
EAITT_DEATH = 6
EAITT_COVER = 7

EnumDifficulty
DIFFICULTY_EASY = 0
DIFFICULTY_NORMAL = 1
DIFFICULTY_HARD = 2
DIFFICULTY_HARDCORE = 3

EnumPlaneSide (unused?)
PSIDE_ON = 0
PSIDE_BACK = 0
PSIDE_FRONT = 0

//------------------------------------------------------------------------------------------------------------------------
| kDict, kDictMem
//------------------------------------------------------------------------------------------------------------------------
const bool HasKey(const kStr &in key)
void Add(const kStr &in key, const kStr &in value)
void SetValue(const kStr &in key, const kStr &in value)
void Empty(void) //removes all keys/values
bool GetFloat(const kStr &in key, float &out floatResult, const float defaultValue = 0) //returns true if successful
bool GetVector(const kStr &in key, kVec3 &out vectorResult) //returns true if successful
bool GetString(const kStr &in key, kStr &out stringResult) //returns true if successful
bool GetBool(const kStr &in key, bool &out boolResult, const bool defaultValue = false) //returns true if successful
bool GetInt(const kStr &in key, int &out intResult, const int defaultValue = 0) //returns true if successful

//------------------------------------------------------------------------------------------------------------------------
| kDefManager
//------------------------------------------------------------------------------------------------------------------------
kDictMem @GetEntry(const kStr &in key)
	//Returns the def data from the key name or null if key not found
void LoadFile(const kStr &in localFilePath, bool = false)
	//Example: LoadFile("Defs/MyDef.txt");
void LoadFilesInDirectory(const kStr &in localDirectoryPath, const kStr &in fileExtension, bool = false)
	//Loads all files in the directory and it's sub directories
	//Example: LoadFilesInDirectory("Defs/MyDefs/", "txt");

//------------------------------------------------------------------------------------------------------------------------
| kIndexDefManager
//------------------------------------------------------------------------------------------------------------------------
int FindHighestIndex(void) //returns the 0 if no entries
kDictMem @GetEntry(const int index)
	//Returns the def data using an index value or null if key not found
void LoadFile(const kStr &in localFilePath, bool = false)
void LoadFilesInDirectory(const kStr &in localDirectoryPath, const kStr &in fileExtension, bool = false)
	//Loads all files in the directory and it's sub directories
	//Example: LoadFilesInDirectory("Defs/MyDefs/", "txt");

//------------------------------------------------------------------------------------------------------------------------
| kSelectionListFloat
//------------------------------------------------------------------------------------------------------------------------
kSelectionListFloat &opAssign(const kSelectionListFloat &in)

//------------------------------------------------------------------------------------------------------------------------
| kSelectionListInt
//------------------------------------------------------------------------------------------------------------------------
kSelectionListInt &opAssign(const kSelectionListInt &in)
const uint EntryCount(void)
const uint GetNumEntries(void)
int& Select(const bool)
void AddItem(int, const int)

//------------------------------------------------------------------------------------------------------------------------
| kHud Hud (barIDs range from 0 to 1)
//------------------------------------------------------------------------------------------------------------------------
void DisableBar(const uint8 barID)
void UpdateBar(const uint8 barID, const uint32 value)
void SetBar(const uint8 barID, const uint8 red, const uint8 green, const uint8 blue, const uint8 alpha, const uint32 value) //alpha does nothing
void AddMessage(const int localizedTextID, const int visibleTime = 120) //visibleTime: (In frames) most likely to be 60 = 1 second
void AddMessage(const kStr&in message, const int visibleTime = 120)

//------------------------------------------------------------------------------------------------------------------------
| kGame Game
//------------------------------------------------------------------------------------------------------------------------
const int16 ActiveMapID(void)
void PlayMusic(const int musicID)

//------------------------------------------------------------------------------------------------------------------------
| kCinemaPlayer CinemaPlayer
//------------------------------------------------------------------------------------------------------------------------
void StartCinema(const kStr&in cinemaScriptPath)
void StopCinema(void)
const bool PathTrackPlaying(void)
const bool Playing(void)
const bool Enabled(void)
void PlayVoice(const int voiceID)

//------------------------------------------------------------------------------------------------------------------------
| kEvent Event
//------------------------------------------------------------------------------------------------------------------------
void RunAction(kActor@ source, kActor@ target, const int actionID, const kVec3&in origin, const float arg1 = 0, const float arg2 = 0, const float arg3 = 0, const float arg4 = 0, const float arg5 = 0, const float arg6 = 0, const float arg7 = 0, const float arg8 = 0)
	//Example from door script: Event.RunAction(self, null, ACTION_UNBLOCK, Math::vecZero);
	
//------------------------------------------------------------------------------------------------------------------------
| kActorFactory ActorFactory
//------------------------------------------------------------------------------------------------------------------------
kActor@ Spawn(const int32 actorID, const kVec3& in origin, const float yaw, const float pitch, const float roll, const bool = true, const int16 regionIndex = -1)

//------------------------------------------------------------------------------------------------------------------------
| kParticleFactory ParticleFactory
//------------------------------------------------------------------------------------------------------------------------
//IMPORTANT:
//Particles are not guaranteed to spawn and may return null. Even with 100 probability they may not spawn for unknown reasons (rare).
kParticle@ Spawn(const int particleID, kActor@ actor, const kVec3&in localPos, const kQuat&in rotation, const kVec3&in)
kParticle@ Spawn(const kStr&in, kActor@ owner, const kQuat&in rotation, const kVec3&in pos)
kParticle@ Spawn(const int particleID, kActor@ owner, const kQuat&in rotation, const kVec3&in pos)

//------------------------------------------------------------------------------------------------------------------------
| kWorld World
//------------------------------------------------------------------------------------------------------------------------
void SetGlobalAmbience(const int)

//------------------------------------------------------------------------------------------------------------------------
| kPuppet
//------------------------------------------------------------------------------------------------------------------------
kPlayer &PlayerOwner(void)
uint &PlayerFlags(void)

//------------------------------------------------------------------------------------------------------------------------
| kParticle
//------------------------------------------------------------------------------------------------------------------------
kPlayer &Owner(void)
kVec3 &Direction(void)
const bool IsSticking(void)
void Kill(void)
const float LifeFrames(void)
kVec3 &Velocity(void)
int16 &NetID(void)
const bool IsStale(void)
const int ParticleType(void)

//------------------------------------------------------------------------------------------------------------------------
| kWeapon : kActor
//------------------------------------------------------------------------------------------------------------------------
kPlayer &Owner(void)
void LockControls(const bool lock)
const bool ScopeReady(void)
kParticle @FireProjectile(const kStr &in particlePath, const kVec3 &in localOrigin)

//------------------------------------------------------------------------------------------------------------------------
| kPlayer LocalPlayer
//------------------------------------------------------------------------------------------------------------------------
kPlayerInventory @Inventory(void)
kWeapon @WeaponActor(void)
kPuppet @Actor(void)
const uint16 ButtonHeldTime(const int buttonID) //returns the number of frames the button has been held down
//Button IDs:
	//0 = fire
	//1 = jump
	//2 = Forward
	//3 = Backward
	//4 = STRAFELEFT
	//5 = STRAFERIGHT
	//6 = CROUCH
	//7 = AltFire (Doesn't return usable values! The one I wanted to use too yay! ... )
	//8 = BC_SCOPEZOOMIN
	//9 = BC_SCOPEZOOMOUT
const uint16 Buttons(void)
const int GetAltAmmo(const int weaponID)
const int GetAmmo(const int weaponID)
void ConsumeAltAmmo(const int amount) //reduces alt ammo by <amount> for the current equipped weapon
void ConsumeAmmo(const int amount) //reduces ammo by <amount> for the current equipped weapon
const int CurrentWeaponID(void)
bool GiveWeapon(const int weaponID, const int ammoAmount)
const bool HasWeapon(const int weaponID)
const bool HasAltAmmo(const int weaponID)
const bool HasAmmo(const int weaponID)

//------------------------------------------------------------------------------------------------------------------------
| kActor
//------------------------------------------------------------------------------------------------------------------------
kVec3 &Origin(void)
kAngle &Yaw(void)
kAngle &Pitch(void)
kAngle &Roll(void)
kParticle @CastToParticle(void)
kActor @CastToActor(void)
bool InstanceOf(const kStr &in actorDefName)
kVec3 &Scale(void)
kActor @GetTarget(void) //CastToParticle to return a kPartcile
void SetTarget(kParticle@)
void SetTarget(kActor@)
kPuppet @CastToPuppet(void)
int16 &NetID(void)
float GetDeltaFromPoint(const kVec3&in point) //returns deltaAngle to the point
kVec3 LocalVectorToWorldSpace(const kVec3&in localVector)
void Remove(void)
int &TriggerMessageID(void) //should return an id value - one of the message constants defined in actionObject.txt such as ACTIONOBJECT_MSG_START or create your own that don't override those constants.
int &TriggerData(void) //a value passed along with TriggerMessageID can be used for anything as well
void Trigger(kActor@ triggerer) //pass in the actor that will be received in OnTrigger
int32 &TID(void) //Tag ID
int &Type(void) //Actor ID
float &Health(void)
void PlaySound(const int soundID)
void PlaySound(const kStr &in soundPath)
uint32 &Flags(void) //EnumActorFlags
void StopLoopingSounds(void)
void StopSound(void)
void PlayLoopingSound(const int soundID)
void PlayLoopingSound(const kStr &in soundPath)
void Mark(const bool isPersistent) //MarkPersistentBit
const bool IsMarked(void)
void SignalOff(void)
void SignalOn(void)
void GenerateActors(const uint, const uint)
kDictMem @Definition(void)
const int GameTicks(void)
const bool Deserialized(void)
void RunFxEvent(const kStr &in fxEventName)
	//Example: RunFxEvent("Blink"). Sometimes this doesn't run the fx event (Rare). Don't rely on it working all the time.
void EnableComponent(const kStr &in, const bool)
void AddComponent(const kStr &in, const bool)
const bool HasComponent(const kStr &in)
kAnimTrackComponent @AnimTrackComponent(void)
kWorldComponent @WorldComponent(void)
kEnemyAIComponent @EnemyAIComponent(void)
kMovementComponent @MovementComponent(void)
kModeStateComponent @ModeStateComponent(void)
kRenderMeshComponent @RenderMeshComponent(void)
void InflictDamage(kDamageInfo &in dmgInfo)
const bool IsStale(void)

//------------------------------------------------------------------------------------------------------------------------
| kPlayerInventory
//------------------------------------------------------------------------------------------------------------------------
const int GetCount(const int itemID) //returns the amount of these items that are in the inventory
const bool HasBeenPickedUpBefore(const int itemID) //returns true when you have at least one of this item in your inventory
const int Take(const int itemID)
const bool Give(const int itemID)
void Reset(void) //clears all inventory items

//------------------------------------------------------------------------------------------------------------------------
| Math
//------------------------------------------------------------------------------------------------------------------------
float Tan(float)
float Cos(float)
float Sin(float)
float Sqrt(float)
float ACos(float)
float Fabs(float)
float ATan2(float, float)
float Log(float)
float Floor(float)
float Ceil(float)
int Abs(int)
float InvSqrt(float)
float Rad2Deg(float rads)
float Deg2Rad(float degs)
float Pow(float, float)
uint8 RandByte(void) //0..255
int Rand(void) //0..32767
int SysRand(void) //0..32767
float RandFloat(void) //0..1
float RandCFloat(void) //-1..1
int RandMax(const int) //exclusive
float RandRange(const float, const float)
float IncMax(const float, const float, const float)
float Accelerate(const float, const float, const float)
float NLerp(const float, const float, const float)
float Lerp(float start, const float end, const float time)
void Clamp(float &out, const float, const float)
float HermiteBlend(const float, const float, const float)
float SmoothStep(const float, const float, const float)
float CosArc(const float)
float CosTween(const float)
kVec3 vecZero
float pi
float Max(const float, const float)
float Min(const float, const float)

//------------------------------------------------------------------------------------------------------------------------
| kQuat (Same as Turok1)
//------------------------------------------------------------------------------------------------------------------------
void Contructor(float x, float y, float z, float w)
void Contructor(float w, kVec3 &in)
void Contructor(const kQuat &in)
kQuat opMul(const kQuat &in)
kQuat opSub(const kQuat &in)
kQuat opAdd(const kQuat &in)
kQuat &Normalize(void)
kQuat ToQuaternion(void)
const kVec3 &opMulAssign(const kQuat &in)
kVec3 opMul(const kQuat &in)
kQuat &opAssign(const kQuat &in)
float w

//------------------------------------------------------------------------------------------------------------------------
| kAngle (Same as Turok1)
//------------------------------------------------------------------------------------------------------------------------
void Contructor(float)
void Contructor(const kAngle &in)
kQuat ToQuat(void)
const float w
float Interpolate(const float, const float)
float Diff(const kAngle &in)
float Diff(const float)
kAngle &opSubAssign(const float)
kAngle opSub(const float)
const kAngle &opAddAssign(const float)
kAngle opAdd(const float)
const kAngle &opSubAssign(kAngle &in)
kAngle opSub(const kAngle &in)
kAngle &opAddAssign(const kAngle &in)
kAngle opAdd(const kAngle &in)
float opImplConv(void)
kAngle opNeg(void)
kAngle &opAssign(const kAngle &in)
kAngle &opAssign(const float)       

//------------------------------------------------------------------------------------------------------------------------
| kPlane
//------------------------------------------------------------------------------------------------------------------------
void Contructor(const kVec3&in, const kVec3&in)
void Contructor(const kVec3&in, const kVec3&in, const kVec3&in)
void Contructor(const float, const float, const float, const float)  
const float Dot(const kPlane&in)
const float Dot(const kVec3&in)
const kVec3 &Normal(void)
const int PointOnSide(const kVec3&in)
const bool IsFacing(const float)
const float ToYaw(void)
const float Distance(const kVec3&in)

//------------------------------------------------------------------------------------------------------------------------
| kVec3
//------------------------------------------------------------------------------------------------------------------------
void Contructor(const kVec3 &in)
void Contructor(float, float, float)
kVec3 &Normalize(void)
float UnitSq(void)
float Unit(void)
float Dot(const kVec3 &in)
kVec3 Cross(const kVec3 &in)
float ToYaw(void)
kStr ToString(void)
float DistanceSq(const kVec3 &in)
const float Distance(const kVec3 &in)
const kVec3 Lerp(const kVec3 &in, const float)
const void Set(const float, const float, const float)
void Clear(void)
float ToPitch(void)
kVec3 &Randomize(const float)
kVec3 &Reflect(const kVec3 &in, const float)
kVec3 &Project(const kVec3 &in, const float)
kVec3 &Lerp(const kVec3 &in, const float)
kVec3 &opAddAssign(const kVec3 &in)
kVec3 opAdd(const kVec3 &in)
kVec3 &QuadraticCurve(const kVec3 &in, const float, const kVec3 &in, const kVec3 &in)
kVec3 &CubicCurve(const kVec3 &in, const float, const kVec3 &in)
kVec3 opMul(const kVec3 &in)
kVec3 &opSubAssign(const kVec3 &in)
kVec3 opSub(const kVec3 &in)
kVec3 opNeg(void)
kVec3 opDiv(const kVec3 &in)
kVec3 &opMulAssign(const float)
kVec3 &opMulAssign(const kVec3 &in)
kVec3 opMul(const float val)
float opIndex(uint)
kVec3 &opAssign(const kVec3 &in)
kVec3 &opDivAssign(const kVec3 &in)
kVec3 opDiv(const float val)
float z
float y
float x
float opIndex(uint)

//------------------------------------------------------------------------------------------------------------------------
| kStr (Same as Turok1)
//------------------------------------------------------------------------------------------------------------------------
void Contructor(const kStr &in)
int IndexOf(const kStr &in)
uint Hash(void)
int Atoi(void)
float Atof(void)
kStr &ToUpper(void)
kStr &ToLower(void)
int8 opIndex(const int)
kStr &opAssign(const kStr &in)
kStr opAdd(const kStr &in)
kStr opAdd(bool)
kStr opAdd(int)
kStr opAdd(float)
kStr &opAddAssign(const kStr &in)
kStr &opAddAssign(bool)

//------------------------------------------------------------------------------------------------------------------------
| AngelScript Arrays
| http://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_arrays.html
//------------------------------------------------------------------------------------------------------------------------

Tags: , ,