From 5c79cd9084c5e734a719c95c4d7fc1bb1a03775f Mon Sep 17 00:00:00 2001 From: uniboi <64006268+uniboi@users.noreply.github.com> Date: Wed, 8 Jun 2022 10:40:42 +0000 Subject: [PATCH 01/15] corrections (#33) --- docs/source/native/class.rst | 193 +++++++++++++++++++++++++++-------- 1 file changed, 153 insertions(+), 40 deletions(-) diff --git a/docs/source/native/class.rst b/docs/source/native/class.rst index 49104a51..719d40f5 100644 --- a/docs/source/native/class.rst +++ b/docs/source/native/class.rst @@ -10,18 +10,20 @@ Classes Declaring Classes ----------------- -To declare a class, first add the ``untyped`` keyword and the class as a global variable at file level. +To declare a class, first add the ``untyped`` keyword and the class as a variable at file level. .. code-block:: javascript untyped - global var ExampleClass + var ExampleClass The ``untyped`` declaration is required because instances have an unknown type and it's not possible to use classes as types. -``global var [classname]`` represents the class. After declaring the class inside of a function you can use it anywhere. It's not possible to declare classes on local variables. +``var [classname]`` represents the class. After declaring the class inside of a function you can use it in the script. You can use any type that can hold vars to store classes. Refer to `Namespaces`_ for more info. -You can then add the declaration inside of a function. +If needed, add the global keyword for the variable to make the class usable everywhere in the vm. + +It's not possible to declare classes on local variables. It's required to declare the class inside of a function. Most classes use a constructor. A constructor is a function of the instance that gets executed on object creation. @@ -70,26 +72,36 @@ Every object has a reference to itself called ``this``. You can change parameter You can't use the class name as a type. Use ``var`` instead. You can't ``expect`` them either. -Instantiating Objects ---------------------- +Declaring Functions of Classes +------------------------------ -To create an instance, do: +Functions of a class have to return a value of type ``var``. This may be ``null``. Define functions like this: .. code-block:: javascript - class ExampleClass { - property = null - constructor( var parameter ) { - this.property = expect int(parameter); + global var ExampleClass; + void function initClassF(){ + class ExampleClass { + variable = "default value" + + // Set field 'variable' of this instance to passed parameter + function setV( pV ){ + this.variable = pV + } + + // Return field 'variable' of this instance + function getV(){ + return this.variable; // return value can be of any type + } } + var inst = ExampleClass(); + print(inst.getV()); // -> default value + inst.setV("new value"); + print(inst.getV()); // -> new value } - var exampleObject = ExampleClass(1); - int n = exampleObject.property // n = 1 - exampleObject.property++; - n = exampleObject.property // n = 2 - -Like the example above shows you can manipulate properties of a class directly. There is no way to make a private property. +Inserting Properties Into Classes +--------------------------------- It's possible to insert more properties into a class at runtime. To achieve this, use the ``<-`` operator. @@ -115,6 +127,84 @@ It's possible to insert more properties into a class at runtime. To achieve this ExampleErrorClass.e <- "Class error value"; // Fails because an instance of class ExampleErrorClass has already been created. Asserts error: trying to modify a class that has already been instantiated } +Inserting functions is also possible using the ``::`` operator + +.. code-block:: javascript + + function ExampleClass::AddOne( var param /* parameters have to be var */ ){ return expect int( param ) + 1 } + var e = ExampleClass() + print( expect int( e.AddOne( 1 ) ) ) // prints 2 + +This allows mods to extend functionality of classes declared in the base game and other mods that have already been loaded. + +For example, extending functionality of the CPlayer class might look like this: + +.. code-block:: javascript + + global function InitCPlayerInsert + + void function InitCPlayerInsert() + { + CPlayer.afkCount <- 0 // Insert new property into the CPlayer class + CPlayer.maxAFKCount <- 3 + function CPlayer::AFK(){ // Kick a player when they are afk multiple times in a match + if ( this.afkCount >= this.maxAFKCount ) + ClientCommand( this, "disconnect You have been AFK too often in a match") + else + { + this.afkCount++ + SendHudMessage( this, format( "You are AFK!\nYou will get kicked after %i more violations", this.maxAFKCount - this.afkCount ), -1, 0.4, 255, 255, 255, 0, 0.5, 5, 0.9 ) + } + } + + // To trigger the method, do GetPlayerArray()[0].AFK() + } + + +This will allow scripts to run the ``AFK`` method on CPlayer entities, which will kick a player after 3 + +Make sure to load this script **after** the class has been declared and **before** it's instantiated! + +Note that any properties added to classes don't apply to other classes that are inherited from a modified class. + +Instantiating Objects +--------------------- + +To create an instance, do: + +.. code-block:: javascript + + class ExampleClass { + property = null + constructor( var parameter ) { + this.property = expect int(parameter); + } + } + + var exampleObject = ExampleClass(1); + int n = exampleObject.property // n = 1 + exampleObject.property++; + n = exampleObject.property // n = 2 + +It's also possible to create an instance without calling the constructor. + +.. code-block:: javascript + + // Using 'ExampleClass' from previous examples + var e = ExampleClass.instance() + e.constructor(1) // Constructor is a normal function so you can call it manually. + +Like the example above shows you can manipulate properties of a class directly. There is no way to make a private property. + +Methods from a class can be accessed without an instance. Note that the class itself doesn't have a reference to itself, meaning that the ``this`` keyword refers to the root table. + +.. code-block:: javascript + var class = ExampleClass + var instance = class.constructor() + +Cloning Instances +----------------- + Unlike other types, passing an object does not pass a copy of the object, but a reference to itself. This means that any modifications inside of a function are applied to the original object. .. code-block:: javascript @@ -151,38 +241,61 @@ You can avoid this by using cloned objects. Use the ``clone`` keyword to create con.content = "manipulated string"; } -It's also possible to create an instance without calling the constructor. +.. _Namespaces: + +Emulating Namespaces +-------------------- + +Instead of declaring classes as a global var, you can use other types such as tables to hold multiple class objects that emulate the behaviour of namespaces to a certain extend. .. code-block:: javascript - // Using 'ExampleClass' from previous examples - var e = ExampleClass.instance() - e.constructor(1) // Constructor is a normal function so you can call it manually. + global table fakeNamespace = { + class1 = null, + class2 = null + } -Functions of a class do not have a return type. Define them like this: +This allows you to group classes together in a single global variable. + +You can use the classes inside of the table like this: .. code-block:: javascript - global var ExampleClass; - void function initClassF(){ - class ExampleClass { - variable = "default value" + // Create a class object in field + class fakeNamespace.class1 { constructor(){ print("constructing instance of class1") } } + class fakeNamespace.class2 { constructor(){ print("constructing instance of class2") } } - // Set field 'variable' of this instance to passed parameter - function setV( pV ){ - this.variable = pV - } + // Access class object in field + var c1 = fakeNamespace.class1() + var c2 = fakeNamespace.class2() - // Return field 'variable' of this instance - function getV(){ - return this.variable; // return value can be of any type - } - } - var inst = ExampleClass(); - print(inst.getV()); // -> default value - inst.setV("new value"); - print(inst.getV()); // -> new value - } + // Insert functions into class object in field + fakeNamespace.class1.testfunc <- var function(){ print( "inserted function in class1" ) } + +You can also declare classes in an array: + +.. code-block:: javascript + + array classes // This has to be at file level + + // This has to be inside of a function: + classes.append( class { constructor(){ print( "inline constructor" ) } ) + var instance = classes[0]() + +And in a similar fashion in structs: + +.. code-block:: javascript + + struct { + var class1 = null + var class2 = null + } classes // This has to be at file level + + // This has to be inside of a function: + classes.class1 = class { constructor(){ print( "inline constructor" ) } ) + classes.class2 = class { constructor(){ print( "inline constructor" ) } ) + var c1 = classes.class1() + var c2 = classes.class2() .. warning:: From da99c5daf93faaa087ab6fec9b23e28f594034d3 Mon Sep 17 00:00:00 2001 From: TH3-S4LM0N <99826409+TH3-S4LM0N@users.noreply.github.com> Date: Thu, 9 Jun 2022 05:38:41 -0500 Subject: [PATCH 02/15] vtf.rst & index update (#29) --- docs/source/guides/VTFModding.rst | 72 +++++++++++++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 73 insertions(+) create mode 100644 docs/source/guides/VTFModding.rst diff --git a/docs/source/guides/VTFModding.rst b/docs/source/guides/VTFModding.rst new file mode 100644 index 00000000..8a3de9dd --- /dev/null +++ b/docs/source/guides/VTFModding.rst @@ -0,0 +1,72 @@ +VTF Modding +=========== + +VTF Overview +------------ + +VTF, short for "Valve Texture Format", is a texture type used by valve in the source engine and is semi-used in titanfall. it is used for some fx and other textures. Most things use .dds, but we can change this. The tool used to edit vtfs is `VTFEdit `__. + +VMT Overview +------------ + +VMT, short for "Valve Material Type", is a text `material ` system that dictates how the game percieves a vtf outside of how it looks. It uses `parameters ` and `proxies ` to dictate how `shaders ` will show the game. We will go into greater detail later. + +Editing FX that use VTFs +------------------------ + +A lot of fx in titanfall use vtfs as textures. Therefore, if the corresponding vtf can be found, we can do almost anything with the fx's appearence. +Example Mod: `Exrill's Blue L-Star ` +Since the L-Star has a physical bullet that is counted as fx, we can edit how it looks. + +VTF Skins +--------- + +Though it is more a skins thing, making vtf skins is somewhat complicated, and to do any vtf editing you need to understand it. To get started, extract the .mdl of what you want with the `Titanfall VPK Tool `. Open `englishclient_mp_common.bsp.pak000_dir.vpk` in the vpk folder. Go to `models\weapons` and find the weapon you want. Not all guns are named the same in files as they are in game. Here is `list of weapon names ` to help you out. Once you've found your gun, extract both the ptpov and w versions. ptpov is the viewmodel and w is the normal model. then extract it anywhere. To change the path to the texture we will need a hex editor. I will use `HxD `, but you can also use `ida ` or anything else, its just personal preference. Once you've got that, open your .mdl with it and search (ctrl+f) for skin_31. If that dosent bring anything up, try skn_31 or skin31 or something like that until you find it. The string of text around it should look something like `.models\Weapons_R2\weaponname\weaponname_skin_31`. Near it, there should be the same text, but without the `_skin_31`. This is the path to the default textures. Now, before you edit, you have to realize hex editors are just built different (cant help it). You cant add or delete text with a hex editor, only replace. Go to the start of the path for the default textures, and change the path to anything else, as long as it starts with `.models\weapons_r2`. For this example i will make a kraber skin, so i will change my path to `.models\weapons_r2\vtfkraber\vtfkraber`.once youve done that, save and do the same thing on the ptpov_ or w_ model. now in the same folder you extracted your mdls too, make a `materials` folder. inside that create the path you hex edited, but the last part is a .vmt file not a folder. the path i would make would be `models\weapons_r2\vtfkraber\vtfkraber.vmt`. once you have made your .vmt, open it and paste this in: +`` +"UnlitTwoTexture" +{ + + "$surfaceprop" "metal" + "$basetexture" "" + "$texture2" "" + "$bumpmap" "" + "$allowoverbright" "1" + "$vertexcolor" 1 + "$vertexalpha" 1 + "$decal" "1" + "$model" 1 + "$nocull" "1" +} +`` +When we use vtf textures, we can only use the albedo and normal `maps `. Fire up `VTFEdit ` and hit file, import, and grab your texture. then file, save as, and save it in the same folder as your .vmt. In your vmt, put the path to your texture in the parentheces after `"$basetexture"`, treating models as root. So i would put, `models\weapons_r2\vtfkraber\kraber_col`. Then do the same for your normal map, but when you import it, pick volume texture instead of animated texture. In `"$bumpmap"` put the path to your normal texture. Now create another vtf with literally any image. Put its path in `"$texture2"`. As far as i know, this is neccesary even though the texture isnt used. Your root folder should look somewhat like this: +`` +root + materials + models + weapons_r2 + vtfkraber + vtfkraber.vmt + models + weapons + at_rifle (name of kraber) + ptpov_at_rifle.mdl + w_at_rifle.mdl +`` +And you're done! You just need to pack it into a vpk with the vpk tool and put it in a mod. + +Making your Skin Animated +------------------------- + +To make an animated skin, all we need to do is add a proxie and change our albedo vtf. Once you've made the frames of your skin, import them all at once with ctrl+a and save your vtf. Put it as `"$basecolor"`. At the bottom of your vmt but before the }, add this: +`` +"Proxies" + { + AnimatedTexture + { + animatedTextureVar $basetexture + animatedTextureFrameNumVar $frame + animatedTextureFrameRate + } + } +`` +Put the fps you want your skin to play at in afet animatedTextureFrameRate, and you're done! diff --git a/docs/source/index.rst b/docs/source/index.rst index dbfaa01e..5813fb09 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -37,6 +37,7 @@ If you know anything about any function, object or concept please dont hesitate /guides/settingsmods /guides/gamemodemods /guides/soundmodding + /guides/VTFModding /guides/publishing .. toctree:: From fd519138e7d52cf6fe91bcb06c8cc557ba261ca3 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Thu, 9 Jun 2022 12:39:29 +0200 Subject: [PATCH 03/15] Add mention of screenshots and other media (#23) --- docs/source/guides/publishing.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/guides/publishing.rst b/docs/source/guides/publishing.rst index b7560ebe..cad67486 100644 --- a/docs/source/guides/publishing.rst +++ b/docs/source/guides/publishing.rst @@ -9,6 +9,8 @@ Note that the Northstar name (``Northstar.Xyz``) is reserved for mods that come It is recommended to upload the source code of your mod to a public repository like `Github `_ to give your users a place to suggest changes and leave feedback in an organised manner. +If the changes your mod makes can be represented in screenshots, gameplay recordings, or GIFs, consider adding those to your README. This way anyone coming across your mod can tell which aspects of the game it changes even before installing it. + Thunderstore ------------ @@ -42,4 +44,4 @@ After you have set up the folder structure, head to `https://northstar.thunderst When uploading, it will verify your package structure and you can publish after it's successfully checked. -To update a mod, change the version in ``mod.json`` and ``manifest.json``, and upload again. If the mod name is the same, it will update the previous version. \ No newline at end of file +To update a mod, change the version in ``mod.json`` and ``manifest.json``, and upload again. If the mod name is the same, it will update the previous version. From 22736cb3c2e58e15b4f0af23b142e85809dd1fb9 Mon Sep 17 00:00:00 2001 From: uniboi <64006268+uniboi@users.noreply.github.com> Date: Thu, 9 Jun 2022 10:40:14 +0000 Subject: [PATCH 04/15] Add entity class list (#30) * Add entity class list * Add more classes and function params * Add more classes and corrections --- docs/source/reference/index.rst | 3 +- docs/source/reference/respawn/entities.rst | 1954 ++++++++++++++++++++ docs/source/reference/respawn/player.rst | 326 ---- docs/source/reference/respawn/weapon.rst | 331 ---- 4 files changed, 1955 insertions(+), 659 deletions(-) create mode 100644 docs/source/reference/respawn/entities.rst delete mode 100644 docs/source/reference/respawn/player.rst delete mode 100644 docs/source/reference/respawn/weapon.rst diff --git a/docs/source/reference/index.rst b/docs/source/reference/index.rst index 66d318c2..a41241ec 100644 --- a/docs/source/reference/index.rst +++ b/docs/source/reference/index.rst @@ -17,8 +17,7 @@ Respawn API /reference/respawn/callbacks /reference/respawn/player - /reference/respawn/weapon - /reference/respawn/titan + /reference/respawn/entities /reference/respawn/rui /reference/respawn/topology /reference/respawn/clientcommands diff --git a/docs/source/reference/respawn/entities.rst b/docs/source/reference/respawn/entities.rst new file mode 100644 index 00000000..ab031433 --- /dev/null +++ b/docs/source/reference/respawn/entities.rst @@ -0,0 +1,1954 @@ +Entities +======== + +There are different Classes for Server and Client. Classes that start with ``C_`` are exclusive to the Client VM and classes that only have the ``C`` Prefix are only usable in the Server VM. + +Most entries have three sub entries: The class available to the SERVER, the CLIENT and methods that are available on both VMs. + +For a graphic reprasentation of the Server and Client class inheritance, refer to `this chart `_ + +.. note:: + + Pay attention to the ``extends`` keyword for each class! You can use every property of that the parent class has access to! + + This List of Classes and their Methods is incomplete! + + +CBaseEntity / C_BaseEntity +-------------------------- + +Basic enitity that most other entities inherit from. + +Shared +^^^^^^ + +.. cpp:class:: CBaseEntity / C_BaseEntity + + .. cpp:function:: void Hide() + + .. cpp:function:: void Destroy() + + .. cpp:function:: void Signal( string signal ) + + .. cpp:function:: vector GetOrigin() + + .. cpp:function:: entity GetBossPlayer() + + .. cpp:function:: string GetClassName() + + .. cpp:function:: bool IsNPC() + + .. cpp:function:: bool IsTitan() + + .. cpp:function:: bool IsHuman() + + .. cpp:function:: bool IsPhaseShifted() + + .. cpp:function:: bool IsPlayer() + + .. cpp:function:: bool IsProjectile() + + .. cpp:function:: asset GetModelName() + + .. cpp:function:: void SetParent( entity parent, ..., string type = "" ) + + .. cpp:function:: void SetValueForEffectNameKey( asset effect ) + + .. cpp:function:: table CreateTableFromModelKeyValues() + + .. cpp:function:: void EndSignal( string signal ) + + .. cpp:function:: int GetArmorType() + + .. cpp:function:: int GetMaxHealth() + + .. cpp:function:: bool HasGibModel() + + .. cpp:function:: bool HasKey( string key ) + + .. cpp:function:: bool IsMarkedForDeletion() + + .. cpp:function:: bool IsMechanical() + + .. cpp:function:: void SetOrigin( vector position ) + + .. cpp:function:: string GetTargetName() + + .. cpp:function:: int GetTeam() + + .. cpp:function:: vector GetAngles() + + .. cpp:function:: vector EyePosition() + + .. cpp:function:: var GetValueForKey( string key ) + + .. cpp:function:: void WaitSignal( string signal ) + + .. cpp:function:: vector GetVelocity() + + .. cpp:function:: void Kill_Deprecated_UseDestroyInstead() + + You should use Destroy instead. Both function do exactly the same. + + .. cpp:function:: vector GetBoundingMaxs() + + .. cpp:function:: vector GetBoundingMins() + + .. cpp:function:: vector SetAngles( vector angle) + + .. cpp:function:: void ClearParent( entity parent ) + + .. cpp:function:: void SetValueForModelKey( asset model ) + + .. cpp:function:: void Show() + + .. cpp:function:: bool IsInvulnerable() + + .. cpp:function:: entity GetParent() + + .. cpp:function:: vector GetWorldSpaceCenter() + + .. cpp:function:: int Highlight_GetCurrentContext() + + .. cpp:function:: float Highlight_GetCurrentInsideOpacity() + + .. cpp:function:: float Highlight_GetCurrentOutlineOpacity() + + .. cpp:function:: unknown Highlight_GetInheritHighlight() + + .. cpp:function:: int Highlight_GetInsideFunction( int contextID ) + + .. cpp:function:: int Highlight_GetOutlineFunction( int contextID ) + + .. cpp:function:: float Highlight_GetOutlineRadius() + + .. cpp:function:: unknown Highlight_GetParam( int contextID, int parameterNum ) + + .. cpp:function:: int Highlight_GetState( int contextID ) + + .. cpp:function:: void Highlight_HideInside( float duration ) + + .. cpp:function:: void Highlight_HideOutline( float duration ) + + .. cpp:function:: bool Highlight_IsAfterPostProcess( int contextID ) + + .. cpp:function:: bool Highlight_IsEntityVisible( int contextID ) + + .. cpp:function:: void Highlight_SetCurrentContext( int contextID ) + + .. cpp:function:: void Highlight_SetFunctions( int contextID, int hightlightFillID, bool entityVisible, int colorMode, float radius, int highlightID, bool afterPostProcess) + + .. cpp:function:: void Highlight_SetParam( int contextID, int parameterID, vector highlightColor ) + + .. cpp:function:: void Highlight_ShowInside( float duration ) + + .. cpp:function:: void Highlight_ShowOutline( float duration ) + + .. cpp:function:: int GetEntIndex() + + .. cpp:function:: entity GetOwner() + + .. cpp:function:: int GetShieldHealth() + + .. cpp:function:: int GetShieldHealthMax() + + .. cpp:function:: void SetScriptName( string name ) + + .. cpp:function:: array GetLinkEntArray() + + .. cpp:function:: entity GetLinkEnt() + + .. cpp:function:: void Code_SetTeam( int team ) + + .. cpp:function:: int GetHealth() + + .. cpp:function:: bool IsCloaked() + + .. cpp:function:: bool IsEntAlive() + + .. cpp:function:: bool IsValidInternal() + + .. cpp:function:: vector GetForwardVector() + + .. cpp:function:: vector GetRightVector() + + .. cpp:function:: vector GetUpVector() + + .. cpp:function:: void SetValueForKey( var key, var val ) + + .. cpp:function:: entity constructor( unknown ) + + Depends on the class. + + Returns a new instance of a class. + + You can invoke the constructor with brackets as well, for example like this: ``CBaseEntity()`` + + .. cpp:function:: void SetDoDestroyCallback( bool doCallBack ) + + .. cpp:function:: int GetLifeState() + + .. cpp:function:: void DisableDraw() + + .. cpp:function:: void EnableDraw() + + .. cpp:function:: void SetCanCloak( bool canCloak ) + + .. cpp:function:: bool GetCritsPrevented() + + .. cpp:function:: bool IsHologram() + + .. cpp:function:: bool IsOnGround() + + .. cpp:function:: void SetModel( asset model ) + + .. cpp:function:: void MarkAsNonMovingAttachment() + + .. cpp:function:: string GetScriptName() + + .. cpp:function:: vector EyeAngles() + + .. cpp:function:: bool IsBreakableGlass() + + .. cpp:function:: bool IsWorld() + + .. cpp:function:: void DispatchImpactEffects( entity ent, vector startPos, vector endPos, vector hitNormal, enitity prop, int propIndex, int damageType, int impactIndex, entity orig, int impactEffectFlags ) + + .. cpp:function:: void IsPlayerDecoy() + + .. cpp:function:: void SetPassThroughDirection( float dir ) + + .. cpp:function:: void SetPassThroughThickness( float thickness ) + + .. cpp:function:: void SetTakeDamageType( int takeDamageType ) + + ``DAMAGE_NO``, ``DAMAGE_YES``, ``DAMAGE_EVENTS_ONLY`` + + .. cpp:function:: void SetVelocity( vector vel ) + + .. cpp:function:: void EnableRenderAlways() + + .. cpp:function:: entity GetParentAttachment() + + .. cpp:function:: void SetFadeDistance( int distance ) + + .. cpp:function:: void Highlight_SetInheritHighlight( bool set ) + + .. cpp:function:: void DisableRenderAlways() + + .. cpp:function:: void SetLocalOrigin( vector origin ) + + .. cpp:function:: bool HasPusherRootParent() + + .. cpp:function:: void StopPhysics() + + .. cpp:function:: void SetPreventCrits( bool prevent ) + + .. cpp:function:: void HighlightDisableForTeam( int team ) + + .. cpp:function:: void HighlightEnableForTeam( int team ) + + .. cpp:function:: void HighlightSetTeamBitField( int bitField ) + + .. cpp:function:: void SetLocalAngles( vector angles ) + + .. cpp:function:: void SetParentWithHitbox( entity parent, int hitGroup, bool unknown ) + + .. cpp:function:: void RenderWithViewModels( bool renderWith ) + + .. cpp:function:: void SetValueForTextureKey( asset texture ) + + .. cpp:function:: asset GetValueForModelKey() + + .. cpp:function:: vector GetLocalAngles() + + .. cpp:function:: entity GetLinkParent() + + .. cpp:function:: bool GetNoTarget() + + .. cpp:function:: void SetForceVisibleInPhaseShift( bool visible ) + + .. cpp:function:: table GetScriptScope() + +CBaseEntity +^^^^^^^^^^^ + +.. cpp:class:: CBaseEntity + + .. cpp:function:: int SetHealth( int health ) + + .. cpp:function:: int SetMaxHealth( int health ) + + .. cpp:function:: void SetOwner( entity owner ) + + .. cpp:function:: entity GetSpawner() + + .. cpp:function:: void Die() + + .. cpp:function:: bool NotSolid() + + .. cpp:function:: void MoveTo( vector pos, float moveTime, int unknown1, int unknown2 ) + + .. cpp:function:: void RotateTo( vector pos, float moveTime, int unknown1, int unknown2 ) + + .. cpp:function:: void ClearInvulnerable() + + .. cpp:function:: void SetInvulnerable() + + .. cpp:function:: void SetNextThinkNow() + + .. cpp:function:: void SetNoTarget( bool noTarget ) + + .. cpp:function:: void SetNoTargetSmartAmmo( bool noTarget ) + + .. cpp:function:: void Minimap_SetClampToEdge( bool clamp ) + + .. cpp:function:: void Minimap_SetCustomState( int state ) + + .. cpp:function:: void Minimap_SetZOrder( int order ) + + .. cpp:function:: void Minimap_SetAlignUpright( bool align ) + + .. cpp:function:: void Minimap_SetObjectScale( float scale ) + + .. cpp:function:: void SetShieldHealth( int ) + + .. cpp:function:: void SetShieldHealthMax( int ) + + .. cpp:function:: int GetEncodedEHandle() + + .. cpp:function:: void SetUsable( bool usable ) + + .. cpp:function:: void SetUsableRadius( float distance ) + + .. cpp:function:: void Solid() + + .. cpp:function:: void Fire( string unknown, string unknown1 = "", int duration ) + + .. cpp:function:: void SetUsableByGroup( string group ) + + .. cpp:function:: void DisableHibernation() + + .. cpp:function:: void SetSize( float width, float height ) + + .. cpp:function:: void SetCloakFlicker( float intensity, float duration ) + + .. cpp:function:: void TakeDamage( int damageAmount, entity attacker_1, entity attacker_2, table { int scriptType, int damageType, int damageSourceId, vector origin, vector force } ) + + .. cpp:function:: vector GetCenter() + + .. cpp:function:: void TraceAttackToTriggers( int damageAmount, entity attacker_1, entity attacker_2, table { int scriptType, int damageType, int damageSourceId, vector force }, vector startPos, vector endPos, vector direction ) + + .. cpp:function:: void SetBlocksRadiusDamage( bool blocks ) + + .. cpp:function:: void SetDamageNotifications( bool getNotifs ) + + .. cpp:function:: entity NextMovePeer() + + .. cpp:function:: void SetNameVisibleToEnemy( bool visible ) + + .. cpp:function:: void SetNameVisibleToFriendly( bool visible ) + + .. cpp:function:: void SetNameVisibleToOwner( bool visible ) + + .. cpp:function:: entity FirstMoveChild() + + .. cpp:function:: entity GetRootMoveParent() + + .. cpp:function:: void RemoveFromSpatialPartition() + + .. cpp:function:: void SetUsePrompts( string pc_prompt, string console_prompt) + + .. cpp:function:: void SetAngularVelocity( float x, float y, float z ) + + .. cpp:function:: void MakeInvisible() + + .. cpp:function:: void MakeVisible() + + .. cpp:function:: entity GetGroundEntity() + + .. cpp:function:: vector GetGroundRelativePos() + + .. cpp:function:: int GetPhysicsSolidMask() + + .. cpp:function:: void SetBossPlayer( entity boss ) + + .. cpp:function:: void EnableAttackableByAI( int ai_priority_no_threat, int unknown, int ai_ap_flag ) + + .. cpp:function:: void SetDeathNotifications( bool notifs ) + + .. cpp:function:: void SetTitle( string title ) + + .. cpp:function:: void LinkToEnt( entity ent ) + + .. cpp:function:: void SetAbsAngles( vector angles ) + + .. cpp:function:: void SetAbsOrigin( void origin ) + + .. cpp:function:: void UnsetUsable() + + .. cpp:function:: void Minimap_AlwaysShow( int team, entity ent ) + + .. cpp:function:: void RoundOriginAndAnglesToNearestNetworkValue() + + .. cpp:function:: void ConnectOutput( string event, void functionref( entity self, entity activator, entity caller, var value ) ) + + .. cpp:function:: void ClearBossPlayer() + + .. cpp:function:: void SetUsableValue( int val ) + + .. cpp:function:: void Minimap_DisplayDefault( int team, entity ent ) + + .. cpp:function:: void FireNow( string s ) + + ``s`` is either ``"Enable"`` or ``Disable`` + +C_BaseEntity +^^^^^^^^^^^^ + +.. cpp:class:: C_BaseEntity + + .. cpp:function:: string GetSignifierName() + + .. cpp:function:: string GetBossPlayerName() + + .. cpp:function:: void ForceShadowVisible( bool visible ) + + .. cpp:function:: void clKill() + + .. cpp:function:: float Highlight_GetNearFadeDist() + + .. cpp:function:: void Highlight_ResetFlags() + + .. cpp:function:: void Highlight_SetFadeInTime( float time ) + + .. cpp:function:: void Highlight_SetFadeOutTime( float time ) + + .. cpp:function:: void Highlight_SetFarFadeDist( float dist ) + + .. cpp:function:: void Highlight_SetFlag( int highlightFlag, bool enable ) + + .. cpp:function:: void Highlight_SetLifeTime( float time ) + + .. cpp:function:: void Highlight_SetNearFadeDist( float dist ) + + .. cpp:function:: void Highlight_SetVisibilityType( int type ) + + .. cpp:function:: void Highlight_StartOn() + + Starts the highlight + + .. cpp:function:: void DisableRenderWithViewModelsNoZoom() + + .. cpp:function:: void EnableRenderWithCockpit() + + .. cpp:function:: void EnableRenderWithHud() + + .. cpp:function:: void SetAttachOffsetAngles( vector angles ) + + .. cpp:function:: void SetAttachOffsetOrigin( vector origin ) + + .. cpp:function:: void SetVisibleForLocalPlayer( int visible ) + + .. cpp:function:: void InitHudElem( var key ) + + .. cpp:function:: string GetTitleForUI() + + .. cpp:function:: float GetCloakFadeFactor() + + .. cpp:function:: int Dev_GetEncodedEHandle() + + .. cpp:function:: int Minimap_GetCustomState() + + .. cpp:function:: int Minimap_GetZOrder() + + .. cpp:function:: void DoDeathCallback( bool doCallback ) + + .. cpp:function:: void EnableHealthChangedCallback() + + .. cpp:function:: void HideHUD() + + .. cpp:function:: void ShowHUD() + + .. cpp:function:: bool IsHUDVisible() + +CDynamicProp / C_DynamicProp +---------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CDynamicProp / C_DynamicProp : extends CBaseAnimating / C_BaseAnimating + +CDynamicProp +^^^^^^^^^^^^ + +.. cpp:class:: CDynamicProp : extends CBaseAnimating + + .. cpp:function:: void SetFullBodygroup( int group ) + +C_DynamicProp +^^^^^^^^^^^^^ + +.. cpp:class:: C_DynamicProp : extends C_BaseAnimating + +CScriptProp / C_ScriptProp +----------- + +Shared +^^^^^^ + +.. cpp:class:: CScriptProp / C_ScriptProp : extends CDynamicProp / C_DynamicProp + + .. cpp:function:: unknown SetSmartAmmoLockType( unknown ) + + .. cpp:function:: unknown GetScriptPropFlags( unknown ) + +CScriptProp +^^^^^^^^^^^ + +.. cpp:class:: CScriptProp : extends CDynamicProp + + .. cpp:function:: unknown SetFootstepType( unknown ) + + .. cpp:function:: unknown SetArmorType( unknown ) + + .. cpp:function:: unknown SetScriptPropFlags( unknown ) + + +C_ScriptProp +^^^^^^^^^^^^ + +CBaseCombatWeapon / C_BaseCombatWeapon +-------------------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CBaseCombatWeapon / C_BaseCombatWeapon : extends CBaseAnimating / C_BaseAnimating + + .. cpp:function:: string GetWeaponDescription() + +CBaseCombatWeapon +^^^^^^^^^^^^^^^^^ + +.. cpp:class:: CBaseCombatWeapon : extends CBaseAnimating + +C_BaseCombatWeapon +^^^^^^^^^^^^^^^^^^ + +.. cpp:function:: C_BaseCombatWeapon : extends C_BaseAnimating + +CWeaponX / C_WeaponX +-------------------- + +Weapons hold by a player or that are lying on the ground are of this type. + +Shared +^^^^^^ + +.. cpp:class:: CWeaponX / C_WeaponX : extends CBaseCombatWeapon / C_BaseCombatWeapon + + .. cpp:function:: entity GetWeaponOwner() + + .. cpp:function:: bool GetAllowHeadShots() + + .. cpp:function:: float GetMaxDamageFarDist() + + .. cpp:function:: bool GetWeaponSettingBool( int setting ) + + .. cpp:function:: float GetWeaponSettingFloat( int setting ) + + .. cpp:function:: int GetWeaponSettingInt( int setting ) + + .. cpp:function:: vector GetAttackDirection() + + .. cpp:function:: vector GetAttackPosition() + + .. cpp:function:: int GetWeaponPrimaryAmmoCount() + + .. cpp:function:: int GetWeaponPrimaryClipCount() + + .. cpp:function:: int GetWeaponPrimaryClipCountMax() + + .. cpp:function:: bool IsChargeWeapon() + + .. cpp:function:: void SetNextAttackAllowedTime( float time ) + + You need to set a game time as time. + + .. cpp:function:: void SetWeaponChargeFractionForced( float frac ) + + .. cpp:function:: void SetWeaponPrimaryClipCount( int ) + + .. cpp:function:: string GetWeaponClassName() + + .. cpp:function:: var GetWeaponInfoFileKeyField( string key ) + + .. cpp:function:: float GetCoreDuration() + + .. cpp:function:: int GetWeaponType() + + .. cpp:function:: array GetMods() + + .. cpp:function:: bool IsWeaponOffhand() + + .. cpp:function:: float GetWeaponChargeFraction() + + .. cpp:function:: float GetWeaponChargeTime() + + .. cpp:function:: bool HasMod( string mod ) + + .. cpp:function:: int GetWeaponCurrentEnergyCost() + + .. cpp:function:: bool GetMeleeCanHitHumanSized() + + .. cpp:function:: bool GetMeleeCanHitTitans() + + .. cpp:function:: void DoMeleeHitConfirmation( float severityScale ) + + .. cpp:function:: void EmitWeaponNpcSound_DontUpdateLastFiredTime( int volume, float time ) + + .. cpp:function:: int GetDamageAmountForArmorType( int armor ) + + .. cpp:function:: float GetMeleeAttackRange() + + .. cpp:function:: float GetMeleeLungeTargetRange() + + .. cpp:function:: void SetMods( array mods ) + + .. cpp:function:: void EmitWeaponNpcSound( int volume, float duration ) + + .. cpp:function:: int GetWeaponDamageFlags() + + .. cpp:function:: bool SmartAmmo_IsEnabled( unknown ) + + .. cpp:function:: int SmartAmmo_GetNumTrackersOnEntity( entity target ) + + .. cpp:function:: array SmartAmmo_GetTrackedEntities() + + .. cpp:function:: bool SmartAmmo_IsVisibleTarget( entity trackedEnt ) + + .. cpp:function:: string GetWeaponClass() + + .. cpp:function:: void SetWeaponSkin( int skin ) + + .. cpp:function:: entity FireWeaponGrenade( vector attackPos, vector throwVelocity, vector angularVelocity, float fuseTime, int contactDamageType, int explosionDamageType, bool isPredicted, bool isLagCompensated, bool bounce? ) + + .. cpp:function:: int GetScriptFlags0() + + .. cpp:function:: bool ShouldPredictProjectiles() + + .. cpp:function:: float GetScriptTime0() + + .. cpp:function:: void SetScriptTime0( float gameTime ) + + ``gameTime`` needs to be game time. The current game time can be retrieved with ``Time()`` + + .. cpp:function:: bool IsReloading() + + .. cpp:function:: void SetForcedADS() + + .. cpp:function:: void EmitWeaponSound_1p3p(string sound1P, string sound3P) + + .. cpp:function:: int GetChargeAnimIndex() + + .. cpp:function:: void PlayWeaponEffectNoCull(asset effect1P, asset effect3P, string tagName) + + .. cpp:function:: void RegenerateAmmoReset() + + .. cpp:function:: void SetChargeAnimIndex( int index ) + + .. cpp:function:: void SetWeaponPrimaryAmmoCount( int count ) + + .. cpp:function:: void StopWeaponEffect(asset effect1P, asset effect3P) + + .. cpp:function:: void ClearForcedADS() + + .. cpp:function:: int GetReloadMilestoneIndex() + + Reload progress. Reloading continues from there. + + .. cpp:function:: int GetAmmoPerShot() + + .. cpp:function:: bool IsBurstFireInProgress() + + .. cpp:function:: void PlayWeaponEffect(asset effect1P, asset effect3P, string tagName) + + .. cpp:function:: void StopWeaponSound(string sound) + + .. cpp:function:: float GetSustainedDischargeDuration() + + .. cpp:function:: void SetSustainedDischargeFractionForced(float frac) + + .. cpp:function:: entity FireWeaponMissile(vector origin, vector dir, float missileSpeed, int contactDamageType, int explosionDamageType, bool doPopup, bool predict) + + .. cpp:function:: int GetBurstFireShotsPending() + + .. cpp:function:: bool AllowUse() + + .. cpp:function:: void RemoveMod( string mod ) + + .. cpp:function:: unknown SmartAmmo_GetTargets() + + .. cpp:function:: void SmartAmmo_TrackEntity(entity hitEnt, LMG_SMART_AMMO_TRACKER_TIME) + + .. cpp:function:: void EmitWeaponSound( string sound ) + + .. cpp:function:: float GetWeaponChargeLevel() + + .. cpp:function:: void SetWeaponBurstFireCount(int amount) + + .. cpp:function:: int GetCurrentAltFireIndex() + + .. cpp:function:: void ForceRelease() + + .. cpp:function:: float SetWeaponChargeFraction() + + .. cpp:function:: int GetProjectilesPerShot() + + .. cpp:function:: entity FireWeaponBolt(vector origin, vector dir, float projectileSpeed, int contactDamageType, int explosionDamageType, bool predict, int index) + + .. cpp:function:: bool IsWeaponInAds() + + .. cpp:function:: void ResetWeaponToDefaultEnergyCost() + + .. cpp:function:: void SetWeaponEnergyCost( int cost ) + + .. cpp:function:: entity FireWeaponBullet( vector origin, vector dir, int unknown_purpose, damageType ) + + .. cpp:function:: bool IsWeaponAdsButtonPressed() + + .. cpp:function:: float GetWeaponChargeLevelMax() + + .. cpp:function:: bool IsReadyToFire() + + .. cpp:function:: void SetAttackKickRollScale(float scale) + + .. cpp:function:: int GetShotCount() + + .. cpp:function:: void AddMod( string mod ) + + .. cpp:function:: void FireWeaponBullet_Special(vector origin, vector direction, int numShots, int damageType, bool unknownPurpose1, bool unknownPurpose2, bool unknownPurpose3, bool unknownPurpose4, bool unknownPurpose5, bool activeShot, bool doTraceBrushOnly) + + .. cpp:function:: string GetWeaponSettingString( string setting ) + + .. cpp:function:: void SmartAmmo_UntrackEntity(entity target) + + .. cpp:function:: string GetSmartAmmoWeaponType() + + Check if weaponType is valid: ``Assert( weaponType in VALID_WEAPON_TYPES )`` + + .. cpp:function:: int GetWeaponBurstFireCount() + + .. cpp:function:: void SmartAmmo_Clear( bool unknown_purpose1, bool unknown_purpose2 ) + + .. cpp:function:: vector SmartAmmo_GetFirePosition(entity target, int burstIndex) + + .. cpp:function:: array SmartAmmo_GetStoredTargets() + + .. cpp:function:: void SmartAmmo_StoreTargets() + + .. cpp:function:: bool IsSustainedDischargeWeapon() + + .. cpp:function:: int GetDamageSourceID() + + .. cpp:function:: float GetGrenadeFuseTime() + + Note that fuse time of 0 means the grenade won't explode on its own, instead it depends on OnProjectileCollision() functions to be defined and explode there. + + .. cpp:function:: void SetWeaponPrimaryClipCountAbsolute(int clipsize) + + .. cpp:function:: entity GetWeaponUtilityEntity() + + .. cpp:function:: bool IsForceRelease() + + .. cpp:function:: bool IsWeaponRegenDraining() + + .. cpp:function:: void SetWeaponPrimaryClipCountNoRegenReset(int clipsize) + +CWeaponX +^^^^^^^^ + +.. cpp:class:: CWeaponX : extends CBaseCombatWeapon + + .. cpp:function:: void SetWeaponUtilityEntity( entity ent ) + + .. cpp:function:: void ForceDryfireEvent() + + .. cpp:function:: void PlayWeaponEffectOnOwner( asset effect, int bodypart ) + + .. cpp:function:: void ForceReleaseFromServer() + + Will eventually result in ``Grenade_OnWeaponToss_()`` or equivalent function + + .. cpp:function:: bool IsForceReleaseFromServer() + +C_WeaponX +^^^^^^^^^ + +.. cpp:class:: C_WeaponX : extends C_BaseCombatWeapon + + .. cpp:function:: void PlayWeaponEffectReturnViewEffectHandle( asset fpEffect, asset unknown_purpose, string tag ) + + .. cpp:function:: void SetViewmodelAmmoModelIndex( int index ) + + ``index`` may be the number of rounds in the clip etc. + +CProjectile / C_Projectile +-------------------------- + +Projectiles. + +Shared +^^^^^^ + +.. cpp:class:: CProjectile / C_Projectile : extends CDynamicProp / C_DynamicProp + + .. cpp:function:: bool GetProjectileWeaponSettingBool( string setting ) + + .. cpp:function:: float GetProjectileWeaponSettingFloat( string setting ) + + .. cpp:function:: int GetProjectileWeaponSettingInt( string setting ) + + .. cpp:function:: string ProjectileGetWeaponClassName() + + .. cpp:function:: void SetImpactEffectTable( string fxTableHandle ) + + .. cpp:function:: array ProjectileGetMods() + + .. cpp:function:: void SetProjectilTrailEffectIndex( int index ) + + .. cpp:function:: void SetProjectileLifetime( float lifetime ) + + .. cpp:function:: string ProjectileGetWeaponInfoFileKeyField( string key ) + + .. cpp:function:: void SetReducedEffects() + + .. cpp:function:: asset GetProjectileWeaponSettingAsset( string setting ) + + .. cpp:function:: void SetVortexRefired( bool refired ) + + Tells the code that the projectile was refired from the vortex so that it uses "projectile_vortex_vscript" + + .. cpp:function:: float GetProjectileCreationTime() + + .. cpp:function:: asset ProjectileGetWeaponInfoFileKeyFieldAsset( string key ) + +CProjectile +^^^^^^^^^^^ + +.. cpp:class:: CProjectile : extends CDynamicProp + + .. cpp:function:: int ProjectileGetDamageSourceID() + + .. cpp:function:: void ProjectileSetDamageSourceID( int id ) + + .. cpp:function:: void SetWeaponClassName( string name ) + + .. cpp:function:: void SetProjectileImpactDamageOverride( int flag ) + +C_Projectile +^^^^^^^^^^^^ + +.. cpp:class:: C_Projectile : extends C_DynamicProp + +CBaseGrenade / C_BaseGrenade +---------------------------- + +Grenade entities in worldspace. Grenades that are equipped ("cooked") by players are instances from the CWeaponX class. + +Shared +^^^^^^ + +.. cpp:class:: CBaseGrenade / C_BaseGrenade : extends CProjectile / C_Projectile + + .. cpp:function:: float GetDamageRadius() + + .. cpp:function:: float GetExplosionRadius() + + .. cpp:function:: void GrenadeExplode( vector unknown_purpose ) + + .. cpp:function:: entity GetThrower() + + .. cpp:function:: bool GrenadeHasIgnited() + + .. cpp:function:: void GrenadeIgnite() + + .. cpp:function:: void SetDoesExplode( bool explodes ) + + .. cpp:function:: void InitMagnetic( float force, string attractKey ) + + .. cpp:function:: void ExplodeForCollisionCallback( vector unknown_purpose ) + + .. cpp:function:: void MarkAsAttached() + +CBaseGrenade +^^^^^^^^^^^^ + +.. cpp:class:: CBaseGrenade : extends CProjectile + + .. cpp:function:: void SetGrenadeTimer( float fuseTime ) + + .. cpp:function:: void SetGrenadeIgnitionDuration( float fuseTime ) + +C_BaseGrenade +^^^^^^^^^^^^^ + +.. cpp:class:: C_BaseGrenade : extends C_Projectile + +CMissile / C_Missile +-------------------- + +Shared +^^^^^^ + +.. cpp:class:: CMissile / C_Missile : extends CProjectile / C_Projectile + + .. cpp:function:: void MissileExplode() + + .. cpp:function:: void InitMissileForRandomDriftFromWeaponSettings( vector pos, vector dir ) + + .. cpp:function:: void SetHomingSpeeds( int speed, int speed_for_dodging_player ) + + .. cpp:function:: void SetMissileTarget( enity target, vector unknown_purpose ) + + .. cpp:function:: void SetMissileTargetPosition( vector pos ) + + .. cpp:function:: void InitMissileSpiral( vector pos, vector dir, int missileNumber, bool unknown_purpose1, bool unknown_purpose2 ) + + .. cpp:function:: void SetSpeed( float speed ) + + .. cpp:function:: entity GetMissileTarget() + + .. cpp:function:: void InitMissileExpandContract( vector outward, vector inward, float launchOutTime, float launchInLerpTime, float launchInTime, float launchStraightLerpTime, vector missileEndPos, bool applyRandSpread ) + + .. cpp:function:: void InitMissileForRandomDrift( vector pos, vector dir ) + +CMissile +^^^^^^^^ + +.. cpp:class:: CMissile : extends CProjectile + +C_Missile +^^^^^^^^^ + +.. cpp:class:: C_Missile : extends C_Projectile + + + +CPlayer / C_Player +------------------ + +Shared +^^^^^^ + +.. cpp:class:: CPlayer / C_Player : extends CBaseCombatCharacter / C_BaseCombatCharacter + + .. cpp:function:: int GetGen() + + .. cpp:function:: entity GetFirstPersonProxy() + + .. cpp:function:: string GetPlayerClass() + + .. cpp:function:: void Lunge_ClearTarget() + + .. cpp:function:: bool Lunge_IsActive() + + .. cpp:function:: bool GetForcedDialogueOnly() + + .. cpp:function:: float GetLastPingTime() + + .. cpp:function:: int GetNumPingsAvailable() + + .. cpp:function:: int GetPingGroupAccumulator() + + .. cpp:function:: float GetPingGroupStartTime() + + .. cpp:function:: void SetLastPingTime( float time) + + .. cpp:function:: void SetNumPingsAvailable( int num ) + + .. cpp:function:: void SetNumPingsUsed( int num ) + + .. cpp:function:: void SetPingGroupAccumulator( int acc ) + + .. cpp:function:: void SetPingGroupStartTime( float gametime ) + + .. cpp:function:: string GetPlayerName() + + .. cpp:function:: int GetPlayerGameStat( int PGS ) + + returns the score of the player in the provided category. some categories are: PGS_KILLS, PGS_DEATHS, PGS_SCORE etc. + + .. cpp:function:: entity GetPetTitan() + + .. cpp:function:: bool GetTitanDisembarkEnabled() + + .. cpp:function:: bool GetTitanEmbarkEnabled() + + .. cpp:function:: bool IsBot() + + .. cpp:function:: void SetTitanDisembarkEnabled( bool enabled ) + + .. cpp:function:: void SetTitanEmbarkEnabled( bool enabled ) + + .. cpp:function:: string GetPlayerSettings() + + .. cpp:function:: int GetActiveBurnCardIndex() + + Selected burn card + + .. cpp:function:: int Code_GetActiveBurnCardIndex() + + Use ``GetActiveBurnCardIndex`` instead + + .. cpp:function:: string GetPlayerSettingsField( string field ) + + .. cpp:function:: int GetCinematicEventFlags() + + .. cpp:function:: entity GetObserverTarget() + + .. cpp:function:: vector GetViewRight() + + .. cpp:function:: vector GetViewVector() + + .. cpp:function:: vector GetViewForward() + + .. cpp:function:: vector GetViewUp() + + .. cpp:function:: int GetPersistentVarAsInt( string key ) + + .. cpp:function:: entity GetViewModelEntity() + + .. cpp:function:: int GetOutOfBoundsDeadTime() + + .. cpp:function:: int GetLevel() + + .. cpp:function:: entity GetTitanSoulBeingRodeoed() + + .. cpp:function:: int GetXP() + + .. cpp:function:: vector CameraAngles() + + .. cpp:function:: float GetObjectiveEndTime() + + .. cpp:function:: entity GetObjectiveEntity() + + .. cpp:function:: int GetObjectiveIndex() + + .. cpp:function:: enitity GetPredictedFirstPersonProxy() + + .. cpp:function:: int GetPetTitanMode() + + .. cpp:function:: bool IsWallHanging() + + .. cpp:function:: float GetNextTitanRespawnAvailable() + + .. cpp:function:: var GetPersistentVar( string key ) + + .. cpp:function:: bool HasBadReputation() + + .. cpp:function:: int GetObserverMode() + + .. cpp:function:: float GetPlayerModHealth() + + .. cpp:function:: bool IsInputCommandHeld( int flag ) + + .. cpp:function:: int GetPlayerNetInt( string state ) + + .. cpp:function:: float GetPlayerNetFloat( string state ) + + .. cpp:function:: entity GetHardpointEntity() + + .. cpp:function:: bool GetPlayerNetBool( string key ) + + .. cpp:function:: bool IsCrouched() + + .. cpp:function:: void IsTraversing() + + .. cpp:function:: void IsWallRunning() + + .. cpp:function:: vector Lunge_GetStartPositionOffset() + + .. cpp:function:: void Lunge_SetTargetEntity( entity target, bool unknown_purpose ) + + .. cpp:function:: int PlayerMelee_GetState() + + .. cpp:function:: bool PlayerMelee_IsAttackActive() + + .. cpp:function:: void PlayerMelee_SetState( int state ) + + .. cpp:function:: void Lunge_EnableFlying() + + .. cpp:function:: vector Lunge_GetEndPositionOffset() + + .. cpp:function:: bool Lunge_IsGroundExecute() + + .. cpp:function:: bool Lunge_IsLungingToEntity() + + .. cpp:function:: void Lunge_LockPitch( bool lock ) + + .. cpp:function:: void Lunge_SetEndPositionOffset( vector offset ) + + .. cpp:function:: void Lunge_SetTargetPosition( vector pos ) + + .. cpp:function:: void PlayerMelee_EndAttack() + + .. cpp:function:: entity PlayerMelee_GetAttackHitEntity() + + .. cpp:function:: void PlayerMelee_SetAttackHitEntity( entity ent ) + + .. cpp:function:: void PlayerMelee_SetAttackRecoveryShouldBeQuick( bool beQuick ) + + .. cpp:function:: void PlayerMelee_StartAttack( int attackState ) + + .. cpp:function:: void SetSelectedOffhandToMelee() + + .. cpp:function:: void Weapon_StartCustomActivity( string animation, bool unknown_purpose ) + + .. cpp:function:: float GetPlayerNetTime( string key ) + + .. cpp:function:: vector CameraPosition() + + .. cpp:function:: entity GetPlayerNetEnt( string key ) + + .. cpp:function:: bool IsStanding() + + .. cpp:function:: bool HasPassive( int passive ) + + .. cpp:function:: void Lunge_SetSmoothTime( float time ) + + .. cpp:function:: float SmartAmmo_GetHighestLockOnMeFraction() + + .. cpp:function:: array SmartAmmo_GetHighestLocksOnMeEntities() + + .. cpp:function:: float SmartAmmo_GetPreviousHighestLockOnMeFraction() + + .. cpp:function:: void Grapple( vector direction ) + + .. cpp:function:: bool MayGrapple() + + .. cpp:function:: int GetSuitGrapplePower() + + .. cpp:function:: bool IsZiplining() + + .. cpp:function:: array GetPlayerSettingsMods() + + .. cpp:function:: void ClearMeleeDisabled() + + .. cpp:function:: void SetMeleeDisabled() + + .. cpp:function:: void RumbleEffect( int x, int y, int z ) + + .. cpp:function:: float GetInputAxisForward() + + Y Axis + + .. cpp:function:: float GetInputAxisRight() + + X Axis + + .. cpp:function:: int GetDodgePower() + + .. cpp:function:: void HolsterWeapon() + + .. cpp:function:: void DeployWeapon() + + May not work with ``DeployAndEnableWeapons()`` and ``HolsterAndDisableWeapons()`` + + .. cpp:function:: float GetZoomFrac() + + .. cpp:function:: entity GetRemoteTurret() + + +CPlayer +^^^^^^^ + +.. cpp:class:: CPlayer : extends CBaseCombatCharacter + + .. cpp:function:: void CockpitStartDisembark() + + .. cpp:function:: void NotifyDidDamage( entity damagedEnt, int hitbox, vector damagePosition, int customDamageType, float damage, int damageFlags, int hitGroup, enitity weapon, float distanceFromAttackOrigin ) + + .. cpp:function:: void Server_SetDodgePower( float dodgePower ) + + .. cpp:function:: void SetDodgePowerDelayScale( float delay ) + + .. cpp:function:: void SetPowerRegenRateScale( float scale ) + + .. cpp:function:: void SetPersistentVar( string key, var val ) + + .. cpp:function:: void ForceStand() + + .. cpp:function:: void SetPlayerNetBool( string key, bool val ) + + .. cpp:function:: void UnforceStand() + + .. cpp:function:: void Anim_StopGesture( int gesture ) + + .. cpp:function:: void PlayerCone_Disable() + + .. cpp:function:: void PlayerCone_FromAnim() + + .. cpp:function:: void PlayerCone_SetLerpTime( float time ) + + .. cpp:function:: void PlayerCone_SetMaxPitch( int maxPitch ) + + .. cpp:function:: void PlayerCone_SetMaxYaw( int maxYaw ) + + .. cpp:function:: void PlayerCone_SetMinPitch( int min ) + + .. cpp:function:: void PlayerCone_SetMinYaw( int min ) + + .. cpp:function:: entity CreateAnimatedPlayerDecoy( string decoyType ) + + Decoy Types: ``pt_mp_execution_attacker_hologram_01``, ``pt_mp_execution_attacker_hologram_02``, ``pt_mp_execution_attacker_hologram_03`` + + .. cpp:function:: void StopObserverMode() + + .. cpp:function:: void CockpitStartEject() + + .. cpp:function:: void FreezeControlsOnServer() + + .. cpp:function:: void UnfreezeControlsOnServer() + + .. cpp:function:: void CockpitStartBoot() + + .. cpp:function:: void SetStaggering() + + .. cpp:function:: void ForceCrouch() + + .. cpp:function:: void UnforceCrouch() + + .. cpp:function:: bool IsNoclipping() + + .. cpp:function:: void SetCinematicEventFlags( int flag ) + + .. cpp:function:: void SetSyncedEntity( entity synced ) + + .. cpp:function:: void SnapEyeAngles( vector angles ) + + .. cpp:function:: void SnapFeetToEyes() + + .. cpp:function:: void TouchGround() + + Allows the player to double jump again. + + .. cpp:function:: void ViewOffsetEntity_Clear() + + .. cpp:function:: entity CreatePlayerDecoy( float stickPercentToRun ) + + .. cpp:function:: void SetPlayerSettingsWithMods( string settings, array newMods ) + + .. cpp:function:: void Server_TurnOffhandWeaponsDisabledOff() + + .. cpp:function:: void Server_TurnOffhandWeaponsDisabledOn() + + .. cpp:function:: void SetPlayerNetInt( string key, int val ) + + .. cpp:function:: void Anim_PlayGesture( string anim3p, float unknown_purpose, float unknown_purpose1, float unknown_purpose2 ) + + .. cpp:function:: void Server_TurnDodgeDisabledOff() + + .. cpp:function:: void Server_TurnDodgeDisabledOn() + + .. cpp:function:: void SetGroundFrictionScale( int scale ) + + .. cpp:function:: void PlayerCone_SetSpecific( vector viewAngles ) + + .. cpp:function:: void SetSuitGrapplePower( float power ) + + .. cpp:function:: void GiveExtraWeaponMod( string mod ) + +C_Player +^^^^^^^^ + +.. cpp:class:: C_Player : extends C_BaseCombatCharacter + + .. cpp:function:: void ClientCommand( string command ) + + .. cpp:function:: entity GetCockpit() + + .. cpp:function:: string GetBodyType() + + .. cpp:function:: float GetAdsFraction() + + .. cpp:function:: bool IsInThirdPersonReplay() + + .. cpp:function:: float GetHotDropImpactTime( entity titan = this.titan, string animation = HOTDROP_TURBO_ANIM ) + + If called without paramets returns time for the player's titan drop. + + .. cpp:function:: string GetPlayerNameWithClanTag() + + .. cpp:function:: bool HasMic() + + .. cpp:function:: bool InPartyChat() + + .. cpp:function:: bool IsMuted() + + .. cpp:function:: bool IsPartyLeader() + + .. cpp:function:: bool IsTalking() + + .. cpp:function:: void CockpitJolt( vector joltDir, float severity ) + + .. cpp:function:: void SetScriptMenuOff() + + .. cpp:function:: void SetScriptMenuOn() + + .. cpp:function:: EntityScreenSpaceBounds GetEntScreenSpaceBounds( entity ent, int padding ) + + .. cpp:function:: void HideCrosshairNames() + + .. cpp:function:: void UnhideCrosshairNames() + + .. cpp:function:: void FreezeControlsOnClient() + + .. cpp:function:: void Rodeo_StartCameraSmoothing( float factor ) + + .. cpp:function:: void Rodeo_StopCameraSmoothing( float factor ) + + .. cpp:function:: void StartArcCannon() + + .. cpp:function:: void StopArcCannon() + +CTitanSoul / C_TitanSoul +------------------------ + +Shared +^^^^^^ + +.. cpp:class:: CTitanSoul / C_TitanSoul : extends CBaseEntity / C_BaseEntity + + .. cpp:function:: entity GetTitan() + + .. cpp:function:: bool HasValidTitan() + + .. cpp:function:: bool IsDoomed() + + .. cpp:function:: float GetTitanSoulNetFloat( string key ) + + .. cpp:function:: entity GetInvalidHealthBarEnt() + + Returns an instance of CNPC_Titan + + .. cpp:function:: int GetTitanSoulNetInt( string key ) + + .. cpp:function:: float GetLastRodeoHitTime() + + .. cpp:function:: bool IsEjecting() + + .. cpp:function:: int GetStance() + + .. cpp:function:: int GetPlayerSettingsNum() + + .. cpp:function:: float GetCoreChargeExpireTime() + + .. cpp:function:: float GetCoreChargeStartTime() + + .. cpp:function:: float GetNextCoreChargeAvailable() + +CTitanSoul +^^^^^^^^^^ + +.. cpp:class:: CTitanSoul : extends CBaseEntity + + .. cpp:function:: void SetEjecting( bool ejecting ) + + .. cpp:function:: void SetPlayerSettingsNum( int enum ) + + .. cpp:function:: void SetStance( int stance ) + + .. cpp:function:: void SoulDestroy() + + .. cpp:function:: void SetCoreChargeExpireTime( float gametime ) + + .. cpp:function:: void SetTitanSoulNetFloat( string key, float val ) + + .. cpp:function:: void SetTitanSoulNetFloatOverTime( string key, float unknown_purpose, float val ) + + .. cpp:function:: float GetCoreUseDuration() + + .. cpp:function:: void SetTitanSoulNetInt( string key, int val ) + + .. cpp:function:: void SetLastRodeoHitTime( float gametime ) + + .. cpp:function:: void SetCoreChargeStartTime( float gametime ) + + .. cpp:function:: void SetCoreUseDuration( float duration ) + + .. cpp:function:: void SetNextCoreChargeAvailable( float time ) + +C_TitanSoul +^^^^^^^^^^^ + +.. cpp:class:: C_TitanSoul : extends C_BaseEntity + +CBaseCombatCharacter / C_BaseCombatCharacter +-------------------------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CBaseCombatCharacter / C_BaseCombatCharacter : extends CBaseAnimating / C_BaseAnimating + + .. cpp:function:: entity GetTitanSoul() + + .. cpp:function:: void ContextAction_ClearBusy() + + .. cpp:function:: bool ContextAction_IsActive() + + .. cpp:function:: bool ContextAction_IsBusy() + + .. cpp:function:: void ContextAction_SetBusy() + + .. cpp:function:: vector Anim_GetStartForRefEntity_Old( string anim, vector reference, string optionalTag ) + + .. cpp:function:: array GetMainWeapons() + + .. cpp:function:: entity GetOffhandWeapon( int slot ) + + .. cpp:function:: enitity GetActiveWeapon() + + .. cpp:function:: entity GetLatestPrimaryWeapon() + + .. cpp:function:: int GetSkin() + + .. cpp:function:: int LookupSequence( string sequence ) + + .. cpp:function:: void SetSkin( int skin ) + + .. cpp:function:: entity GetAntiTitanWeapon() + + .. cpp:function:: AnimRefPoint Anim_GetStartForRefPoint( string anim, vector origin, vector angles ) + + .. cpp:function:: vector GetPlayerOrNPCViewVector() + + .. cpp:function:: vector Anim_GetStartForRefPoint_Old( animation, origin, angles ) + + .. cpp:function:: void Anim_PlayWithRefPoint( string animation, vector origin, vector angles, float blendTime ) + + .. cpp:function:: bool IsWeaponDisabled() + + .. cpp:function:: int GetActiveWeaponPrimaryAmmoLoaded() + + .. cpp:function:: bool ContextAction_IsMeleeExecution() + + .. cpp:function:: int GetWeaponAmmoStockpile( entity weapon ) + + .. cpp:function:: entity GetMeleeWeapon() + + .. cpp:function:: bool ContextAction_IsMeleeExecutionTarget() + + .. cpp:function:: enitity GetFirstRodeoRider() + + Returns the first rodeo rider found or null if there are none. + + .. cpp:function:: int GetNumRodeoSlots() + + Returns number of rodeo slots available on this entity. + + .. cpp:function:: entity GetRodeoRider() + + Returns rodeo rider (if there is one) at the given slot. + + .. cpp:function:: void PhaseShiftBegin( float warmUpTime, float duration ) + + .. cpp:function:: void PhaseShiftCancel() + + .. cpp:function:: vector OffsetPositionFromView( vector startPos, vector offset ) + + .. cpp:function:: int GetWeaponAmmoLoaded( entity weapon ) + + .. cpp:function:: int GetWeaponAmmoMaxLoaded( entity weapon ) + + .. cpp:function:: float GetAttackSpreadAngle() + + .. cpp:function:: array GetOffhandWeapons() + + .. cpp:function:: bool ContextAction_IsLeeching() + + .. cpp:function:: void DisablePhaseShiftFlags() + + .. cpp:function:: void EnablePhaseShiftFlags() + + .. cpp:function:: entity GetEntityAtPhaseShiftExitPosition() + + .. cpp:function:: float PhaseShiftTimeRemaining() + + .. cpp:function:: bool CanUseSharedEnergy( int curCost ) + + .. cpp:function:: bool CanUseSharedEnergy( int curCost ) + + .. cpp:function:: void AddSharedEnergy( int amount ) + + .. cpp:function:: int GetSharedEnergyTotal() + + .. cpp:function:: int GetSharedEnergyCount() + + .. cpp:function:: void SetSharedEnergyRegenDelay( float delay ) + + .. cpp:function:: void TakeSharedEnergy( int amount ) + +CBaseCombatCharacter +^^^^^^^^^^^^^^^^^^^^ + +.. cpp:class:: CBaseCombatCharacter : extends CBaseAnimating + + .. cpp:function:: void SetFullBodygroup( int group ) + + .. cpp:function:: void GetSettingsHeadshotFX() + + Looks for "headshotFX" in an AI settings file or a player set file + + .. cpp:function:: void GiveOffhandWeapon( string ordnanceName, int slot, array mods ) + + .. cpp:function:: void GiveWeapon( string weapon ) + + .. cpp:function:: void SetActiveWeaponByName( string weapon ) + + .. cpp:function:: void TakeOffhandWeapon( int slot ) + + .. cpp:function:: void TakeWeaponNow( string weapon ) + + .. cpp:function:: void TakeWeapon( string weapon ) + + .. cpp:function:: int GetOutOfBoundsDeadTime() + + .. cpp:function:: void SetNumRodeoSlots( int ) + + Sets the maximum number of rodeo slots available on this entity. + + .. cpp:function:: void SetRodeoRider( int slot, entity rider ) + + Sets the rodeo rider at the given slot + + .. cpp:function:: void SetNPCPriorityOverride_NoThreat() + + .. cpp:function:: void SetTitanSoul( entity soul ) + + .. cpp:function:: vector GetPlayerOrNPCViewRight() + + .. cpp:function:: void ResetHealthChangeRate() + +C_BaseCombatCharacter +^^^^^^^^^^^^^^^^^^^^^ + +.. cpp:class:: C_BaseCombatCharacter : extends C_BaseAnimating + + .. cpp:function:: TraceResults TraceToLocalPlayer() + + .. cpp:function:: float TraceToLocalPlayerSimple() + +CAI_BaseNPC / C_AI_BaseNPC +---------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CAI_BaseNPC / C_AI_BaseNPC : extends CBaseCombatCharacter + + .. cpp:function:: var Dev_GetAISettingByKeyField( string key ) + + Expect as string + + .. cpp:function:: bool IsInterruptable() + + .. cpp:function:: int GetAIClass() + + ``AIC_SMALL_TURRET``, ``AIC_MARVIN``, ``AIC_SPECTRE``, ``AIC_STALKER_CRAWLING``, ``AIC_FRAG_DRONE``, ``AIC_HUMAN`` + + .. cpp:function:: string GetBodyType() + + .. cpp:function:: string GetAISettingsName() + + .. cpp:function:: int GetMeleeDamageMaxForTarget( entity target ) + + .. cpp:function:: float AISetting_MaxFlyingSpeed( unknown ) + + .. cpp:function:: string AISetting_LeechAnimSet() + + .. cpp:function:: string AISetting_LeechDataKnifeTag() + +CAI_BaseNPC +^^^^^^^^^^^^ + +.. cpp:class:: CAI_BaseNPC : extends C_BaseCombatCharacter + + .. cpp:function:: void AssaultPoint( vector point ) + + .. cpp:function:: void EnableBehavior( string behaviour ) + + .. cpp:function:: void DisableBehavior( string behaviour ) + + Possible behaviours: ``Follow``, ``Assault`` + + .. cpp:function:: void SetThinkEveryFrame( bool think ) + + .. cpp:function:: void ClearEnemy( entity enemy ) + + .. cpp:function:: void SetEnemy( entity enemy ) + + .. cpp:function:: void Anim_ScriptedPlay( string anim ) + + .. cpp:function:: void ForceCheckGroundEntity() + + .. cpp:function:: string GetNPCState() + + .. cpp:function:: float GetMaxEnemyDist() + + Max pilot engagement distance + + .. cpp:function:: float GetMaxEnemyDistHeavyArmor() + + Max titan engagement distance + + .. cpp:function:: float GetMaxTurretYaw() + + .. cpp:function:: void SetSecondaryEnemy( entity enemy ) + + .. cpp:function:: void DisableNPCMoveFlag( int flag ) + + .. cpp:function:: void EnableNPCMoveFlag( int flag ) + + .. cpp:function:: void SetAISettings( string settings ) + + .. cpp:function:: void SetCapabilityFlag( int flag, bool unknown_purpose ) + + .. cpp:function:: void Anim_ScriptedPlayActivityByName( string activity, bool unknown_purpose1, float unknown_purpose2 ) + + .. cpp:function:: entity GetEnemy() + + .. cpp:function:: bool CanSee( entity ent ) + + .. cpp:function:: bool IsCrouching() + + .. cpp:function:: bool IsSecondaryAttack() + + .. cpp:function:: entity GetFollowTarget() + + .. cpp:function:: void InitFollowBehavior( entity followMe, string followBehaviour ) + + .. cpp:function:: void DisableNPCFlag( int flag ) + + .. cpp:function:: void EnableNPCFlag( int flag ) + + .. cpp:function:: void Freeze() + + .. cpp:function:: void Unfreeze() + +C_AI_BaseNPC +^^^^^^^^^^^^^ + +.. cpp:class:: C_AI_BaseNPC : extends C_BaseCombatCharacter + +CNPC_Titan / C_NPC_Titan +------------------------ + +Shared +^^^^^^ + +.. cpp:class:: CNPC_Titan / C_NPC_Titan : extends CAI_BaseNPC / C_AI_BaseNPC + + .. cpp:function:: bool GetCanStand() + +CNPC_Titan +^^^^^^^^^^ + +.. cpp:class:: CNPC_Titan : extends CAI_BaseNPC + + .. cpp:function:: void SetCanStand( bool canStand ) + + .. cpp:function:: void GrappleNPC( vector dir ) + +C_NPC_Titan +^^^^^^^^^^^ + +CNPC_Dropship / C_NPC_Dropship +------------------------------ + +Shared +^^^^^^ + +.. cpp:class:: CNPC_Dropship / C_NPC_Dropship : extends CAI_BaseNPC / C_AI_BaseNPC + + .. cpp:function:: bool IsJetWakeFXEnabled() + +CNPC_Dropship +^^^^^^^^^^^^^ + +.. cpp:class:: CNPC_Dropship : extends CAI_BaseNPC + +C_NPC_Dropship +^^^^^^^^^^^^^^ + +.. cpp:class:: C_NPC_Dropship : extends C_AI_BaseNPC + +CNPC_Drone +---------- + +.. cpp:class:: CNPC_Drone : extends CAI_BaseNPC + + .. cpp:function:: unknown SetAttackMode( unknown ) + +CNPC_SentryTurret / C_NPC_SentryTurret + +Shared +^^^^^^ + +.. cpp:class:: CNPC_SentryTurret / C_NPC_SentryTurret : extends CAI_BaseNPC / C_AI_BaseNPC + + .. cpp:function:: unknown GetTurretState( unknown ) + + .. cpp:function:: unknown GetControlPanel( unknown ) + +CNPC_SentryTurret +^^^^^^^^^^^^^^^^^ + +.. cpp:class:: CNPC_SentryTurret : extends CAI_BaseNPC + + .. cpp:function:: unknown StartDeployed( unknown ) + +C_NPC_SentryTurret +^^^^^^^^^^^^^^^^^^ + +.. cpp:class:: C_NPC_SentryTurret : extends C_AI_BaseNPC + + +CFirstPersonProxy / C_FirstPersonProxy +-------------------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CFirstPersonProxy / C_FirstPersonProxy : extends CBaseAnimating / C_BaseAnimating + +CFirstPersonProxy +^^^^^^^^^^^^^^^^^ + +.. cpp:class:: CFirstPersonProxy : extends CBaseAnimating + +C_FirstPersonProxy +^^^^^^^^^^^^^^^^^^ + +.. cpp:class:: C_FirstPersonProxy : extends C_BaseAnimating + +CBaseAnimating / C_BaseAnimating +-------------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CBaseAnimating / C_BaseAnimating : extends CBaseEntity / C_BaseEntity + + .. cpp:function:: vector GetAttachmentOrigin() + + .. cpp:function:: int LookupAttachment( string attachment ) + + .. cpp:function:: int FindBodyGroup( string group ) + + .. cpp:function:: int GetBodyGroupState( int bodyGroupIndex ) + + .. cpp:function:: int GetBodyGroupModelCount( int bodyGroupIndex ) + + .. cpp:function:: void SetBodygroup( int groupIndex, int newIndex ) + + .. cpp:function:: vector GetAttachmentAngles() + + .. cpp:function:: Attachment Anim_GetAttachmentAtTime( string animation, string attachmentName, float time ) + + .. cpp:function:: float GetScriptedAnimEventCycleFrac( string anim, string event ) + + .. cpp:function:: float GetSequenceDuration( string anim ) + + .. cpp:function:: bool Anim_IsActive() + + .. cpp:function:: void Anim_Play( string anim ) + + .. cpp:function:: void Anim_SetInitialTime( float time ) + + .. cpp:function:: void Anim_Stop() + + .. cpp:function:: vector Anim_GetStartForRefEntity_Old( string anim, vector reference, string optionalTag ) + + .. cpp:function:: int GetSkin() + + .. cpp:function:: int LookupSequence( string sequence ) + + .. cpp:function:: void SetSkin( int skin ) + + .. cpp:function:: AnimRefPoint Anim_GetStartForRefPoint( string anim, vector origin, vector angles ) + + .. cpp:function:: unknown Anim_GetStartForRefPoint_Old( animation, origin, angles ) + + .. cpp:function:: void Anim_PlayWithRefPoint( string animation, vector origin, vector angles, float blendTime ) + + .. cpp:function:: void Anim_NonScriptedPlay( string animation ) + + .. cpp:function:: bool Anim_HasSequence( string animation ) + + .. cpp:function:: void SetPlaybackRate( float rate ) + + .. cpp:function:: void Anim_SetStartTime( float time ) + + .. cpp:function:: void LerpSkyScale( float skyScale, float time ) + + .. cpp:function:: void SetPoseParameter( int pose, float offset ) + + .. cpp:function:: vector GetAttachmentForward( int attachID ) + + +CBaseAnimating +^^^^^^^^^^^^^^ + +.. cpp:class:: CBaseAnimating : extends CBaseEntity + + .. cpp:function:: int GetFullBodygroup() + + .. cpp:function:: void BecomeRagdoll( vector push, bool skipAnim ) + + .. cpp:function:: void Dissolve( int dissolveID, vector unknown_purpose1, int unknown_purpose2 ) + + .. cpp:function:: void Gib( vector forceVec ) + + .. cpp:function:: void SetContinueAnimatingAfterRagdoll( bool cont ) + + .. cpp:function:: void PlayRecordedAnimation( asset animation, vector unknown_purpose1, vecor unknown_purpose2 ) + + .. cpp:function:: void SetRecordedAnimationPlaybackRate( float rate ) + + .. cpp:function:: void Anim_EnablePlanting() + + .. cpp:function:: int LookupPoseParameterIndex( string poseParam ) + + .. cpp:function:: void Anim_DisableUpdatePosition() + +C_BaseAnimating +^^^^^^^^^^^^^^^ + +.. cpp:function:: C_BaseAnimatin : extends C_BaseEntity + + .. cpp:function:: void SetGroundEffectTable( string tableIdentifier ) + + .. cpp:function:: float GetAttachmentOrigin_ViewModelNoFOVAdjust( int index ) + + .. cpp:function:: void Anim_SetPaused( bool pause ) + + .. cpp:function:: void SetCycle( float cycle ) + + .. cpp:function:: void DoBodyGroupChangeScriptCallback( bool unknown_purpose, int bodygroup ) + +CPlayerDecoy / C_PlayerDecoy +---------------------------- + +Shared +^^^^^^ + +.. cpp:class:: CPlayerDecoy / C_PlayerDecoy : extends CBaseAnimating / C_BaseAnimating + +CPlayerDecoy +^^^^^^^^^^^^ + +.. cpp:class:: CPlayerDecoy : extends CBaseAnimating + + .. cpp:function:: void Decoy_Dissolve() + + .. cpp:function:: void SetTimeout( int duration ) + + .. cpp:function:: void SetDecoyRandomPulseRateMax( float pulse_amount_per_second ) + + .. cpp:function:: void SetFriendlyFire( bool ff ) + + .. cpp:function:: void SetKillOnCollision( bool kill ) + +C_PlayerDecoy +^^^^^^^^^^^^^ + +.. cpp:class:: CPlayerDecoy : extends CBaseAnimating + +CTurret +------- + +.. cpp:function:: CTurret : extends CBaseAnimating + + .. cpp:function:: void ClearDriver() + + .. cpp:function:: entity GetDriver() + + .. cpp:function:: voit SetDriver( enitity driver ) + +C_Titan_Cockpit +--------------- + +.. cpp:function:: C_Titan_Cockpit : extends C_BaseEntity + + .. cpp:function:: void AddToTitanHudDamageHistory( int panel, int damage ) + + .. cpp:function:: void SetCaptureScreenBeforeViewmodels( bool cap ) + + .. cpp:function:: float GetTimeInCockpit() + + Cockpit booting takes 1.3 seconds. + + .. cpp:function:: void SetOpenViewmodelOffset( float a, float b, float c ) + +CParticleSystem +--------------- + +.. cpp:class:: CParticleSystem : extends CBaseEntity + + .. cpp:function:: void FXEnableRenderAlways() + + .. cpp:function:: void SetStopType( string type ) + + .. cpp:function:: void SetControlPointEnt( int unknown_purpose, entity destEnt ) + +CVortexSphere / C_VortexSphere +------------------------------ + +Shared +^^^^^^ + +.. cpp:class:: CVortexSphere / C_VortexSphere : extends CBaseEntity / C_BaseEntity + + .. cpp:function:: int GetBulletAbsorbedCount() + + .. cpp:function:: int GetProjectileAbsorbedCount() + +CVortexSphere +^^^^^^^^^^^^^ + +.. cpp:class:: CVortexSphere : extends CBaseEntity + + .. cpp:function:: void SetGunVortexAngles( vector angles ) + + .. cpp:function:: void SetGunVortexAttachment( string attach ) + + .. cpp:function:: void SetOwnerWeapon( entity owner ) + + .. cpp:function:: void SetVortexEffect( entity fx ) + + .. cpp:function:: void DisableVortexBlockLOS() + + .. cpp:function:: enitity GetOwnerWeapon() + + .. cpp:function:: void AddBulletToSphere() + + .. cpp:function:: void AddProjectileToSphere() + + .. cpp:function:: void ClearAllBulletsFromSphere() + + .. cpp:function:: void RemoveBulletFromSphere() + + .. cpp:function:: void RemoveProjectileFromSphere() + +C_VortexSphere +^^^^^^^^^^^^^^ + +.. cpp:class:: C_VortexSphere : extends C_BaseEntity + +CEnvExplosion + +.. cpp:class:: CEnvExplosion : extends CBaseEntity diff --git a/docs/source/reference/respawn/player.rst b/docs/source/reference/respawn/player.rst deleted file mode 100644 index 5b0c8361..00000000 --- a/docs/source/reference/respawn/player.rst +++ /dev/null @@ -1,326 +0,0 @@ -Player ------- - -Functions related to the player entity and methods of the player object - -.. cpp:function:: bool IsAlive( entity ent ) - -.. cpp:function:: bool IsValid( entity ent ) - -.. cpp:function:: entity GetLocalViewPlayer() - - player you're watching (can be replay) - -.. cpp:function:: entity GetLocalClientPlayer() - -.. cpp:function:: array GetPlayerArray() - -.. cpp:function:: array GetPlayerArrayEx( string class, int team, vector origin, float radius ) - - returns a list of every player of the specified class in radius relative to origin. The parameter ``class`` must be one of these strings: ``titan``, ``pilot`` or ``any``. - -.. cpp:function:: array GetPlayerArrayOfTeam( int team ) - - array of players from team index - -.. cpp:function:: array GetPlayerArrayOfTeam_Alive( int team ) - - every player alive in team - -.. cpp:function:: array GetPlayerArrayOfEnemies_Alive( int team ) - -.. cpp:function:: array GetSortedPlayers( IntFromEntityCompare compareFunc, int team) - - returns list of every player in ``team`` sorted by ``compareFunc``. If ``team`` is 0 returns a sorted array of every player. - `squirrel compare function example `_ - - .. code-block:: javascript - - GetSortedPlayers(int function(entity player1, entity player2) { - if(player1.GetPlayerGameStat(PGS_PING)>player2.GetPlayerGameStat(PGS_PING)) - return 1 - - else if(player1.GetPlayerGameStat(PGS_PING) GetMainWeapons() - - .. cpp:function:: int GetMaxHealth() - - .. cpp:function:: asset GetModelName() - - .. cpp:function:: float GetNextTitanRespawnAvailable() - - .. cpp:function:: int GetNumPingsAvailable() - - .. cpp:function:: float GetObjectiveEndTime() - - .. cpp:function:: entity GetObjectiveEntity() - - .. cpp:function:: int GetObjectiveIndex() - - returns the index of the player objective. ObjIndex 0 means no objective - - .. cpp:function:: int GetObserverMode() - - returns either ``OBS_MODE_IN_EYE`` (first person) or ``OBS_MODE_CHASE`` (third person) - - .. cpp:function:: entity GetOffhandWeapon( int slot ) - - .. cpp:function:: array GetOffhandWeapons() - - .. cpp:function:: vector GetOrigin() - - entity position - - .. cpp:function:: entity GetParent() - - .. cpp:function:: entity GetPetTitan() - - auto titan of player - - .. cpp:function:: int GetPingGroupAccumulator() - - .. cpp:function:: float GetPingGroupStartTime() - - .. cpp:function:: string GetPlayerClass() - - "titan", "spectator" or "pilot" - - .. cpp:function:: int GetPlayerGameStat( int PGS ) - - returns the score of the player in the provided category. - some categories are: ``PGS_KILLS``, ``PGS_DEATHS``, ``PGS_SCORE`` etc. - - .. cpp:function:: string GetPlayerName() - - player (origin) username - - .. cpp:function:: string GetPlayerNameWithClanTag() - - .. cpp:function:: bool GetPlayerNetBool( string net_bool_name ) - - example - - .. code-block:: javascript - - GetPlayerNetBool( "shouldShowWeaponFlyout" ) - - .. cpp:function:: string GetPlayerSettings() - - .. cpp:function:: string GetPlayerSettingsField( string ) - - some settings: ``"weaponClass"`` ``"gravityscale"`` ``"airSpeed"`` ``"airAcceleration"`` - - .. cpp:function:: int GetShieldHealth() - - .. cpp:function:: int GetShieldHealthMax() - - .. cpp:function:: int GetTeam() - - .. cpp:function:: entity GetTitanSoul() - - .. code-block:: javascript - - if IsTitan() | player.GetPetTitan().GetTitanSoul() if !IsTitan() - - .. cpp:function:: vector GetVelocity() - - .. cpp:function:: vector GetViewForward() - - .. cpp:function:: entity GetViewModelEntity() - - .. cpp:function:: vector GetViewRight() - - .. cpp:function:: vector GetViewUp() - - .. cpp:function:: vector GetViewVector() - - .. cpp:function:: int GetWeaponAmmoStockpile() - - .. cpp:function:: int GetXP() - - .. cpp:function:: float GetZoomFrac() - - 0.0 (no zoom) - 1.0 (full zoom) - - .. cpp:function:: void GiveOffhandWeapon( string name, int slot ) - - .. cpp:function:: void GiveWeapon( string weapon ) - - .. cpp:function:: void TakeOffhandWeapon( int offhandIndex ) - - can be used for titans as well. - some constants are: ``OFFHAND_ORDNANCE`` ``OFFHAND_SPECIAL`` ``OFFHAND_LEFT`` ``OFFHAND_INVENTORY`` ``OFFHAND_MELEE`` ``OFFHAND_EQUIPMENT`` ``OFFHAND_ANTIRODEO`` - - .. cpp:function:: void TakeWeaponNow( string weaponToSwitch) - - .. cpp:function:: void SetActiveWeaponByName( string newWeapon ) - - .. cpp:function:: void SetBodygroup( int bodyGroupIndex, int stateIndex ) - - .. cpp:function:: void SetDodgePowerDelayScale( float delay ) - - .. cpp:function:: void SetHealth(int health) - - .. cpp:function:: void SetLastPingTime( float time) - - .. cpp:function:: void SetMaxHealth( int health ) - - .. cpp:function:: void SetNumPingsAvailable( int num ) - - .. cpp:function:: void SetNumPingsUsed( int num ) - - .. cpp:function:: void SetOrigin( vector origin ) - - .. cpp:function:: void SetPowerRegenRateScale( float scale ) - - .. cpp:function:: void SetShieldHealth( float health) - - .. cpp:function:: void SetShieldHealthMax( float health ) - - .. cpp:function:: void SetTitanDisembarkEnabled( bool enabled ) - - .. cpp:function:: vector CameraPosition() - - .. cpp:function:: void CockpitStartDisembark() - - .. cpp:function:: bool ContextAction_IsActive() - - .. cpp:function:: bool ContextAction_IsBusy() - - .. cpp:function:: vector EyeAngles() - - .. cpp:function:: vector EyePosition() - - .. cpp:function:: int FindBodyGroup( string bodyGroup ) - - .. cpp:function:: int LookupAttachment( string attachment = "" ) - - .. cpp:function:: void Lunge_ClearTarget() - - .. cpp:function:: int Minimap_GetZOrder() - - .. cpp:function:: bool HasBadReputation() - - .. cpp:function:: bool HasMic() - - .. cpp:function:: bool InPartyChat() - - .. cpp:function:: bool IsEjecting() - - .. cpp:function:: bool IsHologram() - - .. cpp:function:: bool IsHuman() - - .. cpp:function:: bool IsInThirdPersonReplay() - - .. cpp:function:: bool IsMuted() - - .. cpp:function:: bool IsPartyLeader() - - .. cpp:function:: bool IsPhaseShifted() - - .. cpp:function:: bool IsPlayer() - - .. cpp:function:: bool IsScriptMenuOn() - - .. cpp:function:: bool IsTalking() - - .. cpp:function:: bool IsTitan() - - .. cpp:function:: bool IsUsingOffhandWeapon() - - .. cpp:function:: bool IsWatchingKillReplay() - - .. cpp:function:: bool IsWatchingReplay() - - .. cpp:function:: bool IsWeaponDisabled() - - .. cpp:function:: bool Lunge_IsActive() - - .. cpp:function:: bool PlayerMelee_IsAttackActive() - - .. cpp:function:: entity GetMeleeWeapon() diff --git a/docs/source/reference/respawn/weapon.rst b/docs/source/reference/respawn/weapon.rst deleted file mode 100644 index a7bb9139..00000000 --- a/docs/source/reference/respawn/weapon.rst +++ /dev/null @@ -1,331 +0,0 @@ -Weapon ------- - -Methods of the weapon class - -.. cpp:class:: weapon - - .. cpp:function:: string GetWeaponClassName() - - The weapon identifier - - .. cpp:function:: entity GetWeaponOwner() - - The entity that has the gun equipped. - - .. cpp:function:: int GetXP() - - Gun XP points achieved by the player. - - .. cpp:function:: int GetWeaponType() - - Returns the type of the weapon ( Sidearm, antitanweapon, etc. ) - - .. cpp:function:: string GetWeaponDescription() - - .. cpp:function:: bool IsWeaponOffhand() - - Wether or not the given weapon is an offhand weaponn. - - .. cpp:function:: int GetDamageSourceID() - - .. cpp:function:: void FireWeaponBullet_Special( vector origin, vector direction, int numShots, int damageType, bool unknownPurpose1, bool unknownPurpose2, bool unknownPurpose3, bool unknownPurpose4, bool unknownPurpose5, bool activeShot, bool doTraceBrushOnly ) - - The bullet fired by this has "perfect antilag" and no spread. - An unknown parameter might control if this fires a fake bullet that doesn't do any damage. According to a comment, the fake bullet still triggers a damage callback with 0 damage, which is not supposed to happen. - - .. cpp:function:: void SetViewmodelAmmoModelIndex( int rounds ) - - Set the viewmodel for weapons that have multiple models depending on how many shots are in the clip. - - .. cpp:function:: int GetCurrentAltFireIndex() - - .. cpp:function:: int GetShotCount() - - .. cpp:function:: bool IsWeaponRegenDraining() - - .. cpp:function:: void RegenerateAmmoReset() - - .. cpp:function:: float GetCoreDuration() - - Titan core duration - - Retrieve Weapon Keyvalues - ------------------------- - - .. cpp:function:: var GetWeaponInfoFileKeyField( string field ) - - Returns the content of the passed keyvalue field. Use `expect` to specify the return type at compile time. - - .. cpp:function:: int GetWeaponDamageFlags() - - .. cpp:function:: bool GetAllowHeadShots() - - Wether or not the weapon is able to score critical headshot damage. - - .. cpp:function:: int GetAmmoPerShot() - - .. cpp:function:: int GetProjectilesPerShot() - - The Amount of individual projectiles that are fired by the weapon. - - .. cpp:function:: float GetMaxDamageFarDist() - - The maximal distance in which the weapon is able to deal damage. - - .. cpp:function:: bool ShouldPredictProjectiles() - - Weapon Settings - --------------- - - .. cpp:function:: bool GetWeaponSettingBool( unknown ) - - .. cpp:function:: int GetWeaponSettingInt( unknown ) - - .. cpp:function:: int GetWeaponSettingFloat( unknown ) - - .. cpp:function:: int GetWeaponSettingString( unknown ) - - Projectile Settings - ------------------- - - .. cpp:function:: float GetProjectileWeaponSettingFloat( unknown) - - .. cpp:function:: int GetProjectileWeaponSettingInt( unknown ) - - .. cpp:function:: float GetProjectileWeaponSettingFloat( unknown ) - - .. cpp:function:: int GetProjectileWeaponSettingString( unknown ) - - Clip Size - --------- - - .. cpp:function:: int GetWeaponPrimaryClipCount() - - .. cpp:function:: int GetWeaponPrimaryClipCountMax() - - .. cpp:function:: void SetWeaponPrimaryClipCount( int clipsize ) - - .. cpp:function:: void SetWeaponPrimaryClipCountAbsolute( int clipsize ) - - .. cpp:function:: void SetWeaponPrimaryClipCountNoRegenReset( int clipsize ) - - Reloading - --------- - - .. cpp:function:: bool IsReloading() - - .. cpp:function:: int GetReloadMilestoneIndex() - - Reload Progress. Only used on the LStar - - ADS - --- - - .. cpp:function:: bool IsWeaponInAds() - - Returns `true` if the gun is aimed down sights. - - .. cpp:function:: bool IsWeaponAdsButtonPressed() - - Returns `true` as long as the button set up for aiming is pressed. - - Forced ADS - ---------- - - .. cpp:function:: void SetForcedADS() - - .. cpp:function:: bool GetForcedADS() - - .. cpp:function:: void ClearForcedADS() - - Weapon Mods - ----------- - - .. cpp:function:: array GetMods() - - .. cpp:function:: void AddMod( string modname ) - - .. cpp:function:: void SetMods( array ) - - .. cpp:function:: bool HasMod( string modname ) - - .. cpp:function:: void SetModBitField( int mods ) - - .. cpp:function:: void SetProScreenOwner( entity player ) - - .. cpp:function:: void SetProScreenIntValForIndex( int index, int value ) - - consts for index: - `PRO_SCREEN_INT_LIFETIME_KILLS` & `PRO_SCREEN_INT_MATCH_KILLS` - - Smart Ammo - ---------- - - .. cpp:function:: bool SmartAmmo_IsEnabled() - - .. cpp:function:: unknown SmartAmmo_GetTargets() - - .. cpp:function:: void SmartAmmo_TrackEntity( entity hitEnt, LMG_SMART_AMMO_TRACKER_TIME ) - - .. cpp:function:: void SmartAmmo_UntrackEntity( entity target ) - - .. cpp:function:: array SmartAmmo_GetStoredTargets() - - .. cpp:function:: string GetSmartAmmoWeaponType() - - Check if weaponType is valid: `Assert( weaponType in VALID_WEAPON_TYPES )` - - .. cpp:function:: void SmartAmmo_Clear( true, false ) - - .. cpp:function:: vector SmartAmmo_GetFirePosition( entity target, int burstIndex ) - - .. cpp:function:: int SmartAmmo_GetNumTrackersOnEntity( entity target ) - - Burst Weapons - ------------- - - .. cpp:function:: int GetBurstFireShotsPending() - - .. cpp:function:: int GetWeaponBurstFireCount() - - .. cpp:function:: void SetWeaponBurstFireCount( int amount ) - - .. cpp:function:: bool IsBurstFireInProgress() - - Ion Energy Weapons - ------------------ - - .. cpp:function:: int GetWeaponCurrentEnergyCost() - - .. cpp:function:: void ResetWeaponToDefaultEnergyCost() - - .. cpp:function:: void SetWeaponEnergyCost() - - Charge Weapons - -------------- - - .. cpp:function:: float GetWeaponChargeLevel() - - .. cpp:function:: float GetWeaponChargeLevelMax() - - .. cpp:function:: float GetWeaponChargeFraction() - - .. cpp:function:: int GetChargeAnimIndex() - - .. cpp:function:: void SetChargeAnimIndex() - - .. cpp:function:: float SetWeaponChargeFraction() - - .. cpp:function:: float SetWeaponChargeFractionForced() - - .. cpp:function:: bool IsChargeWeapon() - - .. cpp:function:: float GetWeaponChargeTime() - - .. cpp:function:: void ForceRelease() - - .. cpp:function:: bool IsForceReleaseFromServer() - - Sustained Discharge Weapons - --------------------------- - - .. cpp:function:: void SetSustainedDischargeFractionForced( float frac ) - - .. cpp:function:: bool IsSustainedDischargeWeapon() - - .. cpp:function:: float GetSustainedDischargeDuration() - - Kickscale - --------- - - .. cpp:function:: void SetAttackKickScale( float scale ) - - .. cpp:function:: void SetAttackKickRollScale( float scale ) - - Weapon Firing - ------------- - - .. cpp:function:: entity FireWeaponBullet( vector origin, vector dir, 1, damageType ) - - .. cpp:function:: entity FireWeaponBolt( vector origin, vector dir, float projectileSpeed, int contactDamageType, int explosionDamageType, bool predict, int index ) - - .. cpp:function:: entity FireWeaponMissile( vector origin, vector dir, float missileSpeed, int contactDamageType, int explosionDamageType, bool doPopup, bool predict ) - - .. cpp:function:: entity FireWeaponGrenade( vector attackPos, vector throwVelocity, vector angularVelocity, float fuseTime, int contactDamageType, int explosionDamageType, bool isPredicted, bool isLagCompensated, bool bounce? ) - - Disabled Weapons - -------------- - - .. cpp:function:: bool AllowUse() - - Allows if the weapon can be used. Independent from `SetNextAttackAllowedTime`. - - .. cpp:function:: void SetNextAttackAllowedTime( int time ) - - The Weapon can't be used until the specified time is reached. - - .. code-block:: javascript - - weapon.SetNextAttackAllowedTime( Time() ) // Set the gun now usable - - .. cpp:function:: bool IsReadyToFire() - - .. cpp:function:: void ForceDryfireEvent() - - Weapon Positioning - ------------------ - - .. cpp:function:: vector GetAttackDirection() - - Barrel direction - - .. cpp:function:: vector GetAttackPosition() - - Barrel position - - Weapon Sounds / Effects - ----------------------- - - .. cpp:function:: void StopWeaponEffect( asset effect1P, asset effect3P ) - - .. cpp:function:: void StopWeaponSound( string sound ) - - .. cpp:function:: void EmitWeaponNpcSound( float soundRadius, float idk ) - - .. cpp:function:: void PlayWeaponEffect( asset effect1P, asset effect3P, string tagName ) - - .. cpp:function:: void PlayWeaponEffectNoCull( asset effect1P, asset effect3P, string tagName ) - - .. cpp:function:: void EmitWeaponSound( string sound ) - - .. cpp:function:: void EmitWeaponSound_1p3p( string sound1P, string sound3P ) - - .. cpp:function:: int PlayWeaponEffectReturnViewEffectHandle( asset fxAlias, asset asset, string tag ) - - Grenades - ----------- - - .. cpp:function:: float GetGrenadeFuseTime() - - Note that fuse time of 0 means the grenade won't explode on its own, instead it depends on OnProjectileCollision() functions to be defined and explode there. Arguably in this case grenade_fuse_time shouldn't be 0, but an arbitrarily large number instead. - - Weapon Skins and Camo - --------------------- - - .. cpp:function:: void SetWeaponSkin( int index ) - - .. cpp:function:: void SetSkin( int index ) - - .. cpp:function:: void SetWeaponCamo( int index ) - - .. cpp:function:: void SetCamo( int index ) - - Script - ------ - - .. cpp:function:: unknown GetScriptScope() - - .. cpp:function:: void SetScriptTime0( float time ) - - .. cpp:function:: void SetScriptFlags0( int flag ) \ No newline at end of file From b415baea46edb89d926ef0f8b14987b74a1f021e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Raes?= Date: Sun, 12 Jun 2022 22:45:24 +0200 Subject: [PATCH 05/15] docs: Async (#31) --- docs/source/native/async.rst | 100 +++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/docs/source/native/async.rst b/docs/source/native/async.rst index 85c598f0..4be31265 100644 --- a/docs/source/native/async.rst +++ b/docs/source/native/async.rst @@ -69,4 +69,104 @@ This function will now repeat endlessly, waiting 5 seconds before each repeat. m } } +You can also set up some code to be executed when a thread ends: + +.. code-block:: javascript + + void killPlayerAfterAfewMoments(entity player) { + OnThreadEnd( + // you have to explicitely capture all variables you want to use inside function + function() : ( player ) + { + if ( !IsValid( player )) + return + + SendHudMessage( player, "Time to sleep, fella!", -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 ) + player.Die() + } + ) + + // Do something time consuming + } + + thread killPlayerAfterAFewMoments( GetPlayerArray()[0] ) + + You have now created and threaded both functions. + +Signals and flags +---------------------- + +Signals +^^^^^^^^^^ + +Signals and flags allow threads to wait for events before running some code. + +For example, if we want to tell a player not to give up after being killed several times, we can write it this way: + +.. code-block:: javascript + + // First, we register signal we want to use + RegisterSignal("OnMultipleDeaths") + + + void function WatchForDeaths (entity player) + { + int deathsCount = 0 + + while( GamePlayingOrSuddenDeath() ) + { + if ( player.isDead() ) // This doesn't exist, don't try this at home + { + deathsCount += 1 + + if (deathsCount >= 42) + { + // This sends "OnMultipleDeaths" signal on player entity + player.Signal( "OnMultipleDeaths" ) + } + } + } + } + + + void function DontGiveUp (entity player) + { + // This is a blocking call + player.WaitSignal("OnMultipleDeaths"); + + // This will not run until entity received "OnMultipleDeaths" signal + SendHudMessage( player, "Don't give up!", -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 ) + } + + // Launch our methods in dedicated threads + entity player = GetPlayerArray()[0] + thread WatchForDeaths( player ) + thread DontGiveUp( player ) + +In this example, the ``DontGiveUp`` method is launched at the same time as ``WatchForDeaths``; but it will not +run until player died 42 times. + +When you want your thread to die on a given event, you can use ``entity.EndSignal( "OnMultipleDeaths" )``; when said signal +is set, thread will end (after calling any `OnThreadEnd` methods). + +Flags +^^^^^^^^^^ + +``Flags`` work pretty much the same way as ``Signals``, except they can be set up without target entity: + +.. code-block:: javascript + + // create flag + FlagInit( "BombHasExploded" ) + + // wait for it + FlagWait( "BombHasExploded" ) + + // update it + FlagSet( "BombHasExploded" ) + FlagClear( "BombHasExploded" ) + FlagToggle( "BombHasExploded" ) + + // get its current value (returns a boolean) + Flag( "BombHasExploded" ) \ No newline at end of file From bec0f797d2c1ff95d1bb26a1b6fcbf0020827297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Raes?= Date: Mon, 11 Jul 2022 19:57:54 +0200 Subject: [PATCH 06/15] mod.json architecture (#39) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [docs] add modjson guide structure * [feat] add mod.json to guides menu * [docs] add LoadPriority section * [docs] add ConVar section * [docs] add versioning section * [docs] add scripts section * [docs] add localisation section * [feat] add mod.json example * [fix] typos * [feat] add scripts section * [feat] add section to gettingstarted guide * Revert "[feat] add mod.json to guides menu" This reverts commit 8a8ca8e6b10972e1dcd9aa2f98f2de17e762a6c3. * Revert "[docs] add modjson guide structure" This reverts commit 3b3fcac903a9be0a85ee7fa3dc7df6dba364a625. * [feat] add convar flags list * [feat] add missing convar flags * [refactor] lower all titles types --- docs/source/guides/gettingstarted.rst | 288 ++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) diff --git a/docs/source/guides/gettingstarted.rst b/docs/source/guides/gettingstarted.rst index 54c5bd30..16dcdb59 100644 --- a/docs/source/guides/gettingstarted.rst +++ b/docs/source/guides/gettingstarted.rst @@ -71,6 +71,294 @@ An example for this might be: ``"Path"`` indicates where the script is, ``"RunOn"`` is the Squirrel VM context (see :doc:`../native/sqvm`) as an expression, and ``"ClientCallback"`` and ``"ServerCallback"`` specify a function call that can be ``"Before"`` and/or ``"After"`` map-spawn. + +Detailed ``mod.json`` architecture +---------------------------------- + +Located at your mod's root folder, the ``mod.json`` file is the entrypoint of your mod; +it contains human-readable information about it, which scripts to load, and a bunch +of interesting stuff. + +This guide will dig into each of the possible ``mod.json`` fields. Please note that +``mod.json`` keys must start with an uppercase letter. + +This is what a well-formatted ``mod.json`` looks like: + +.. code-block:: json + + { + "Name": "Northstar.CustomServers", + "Description": "Attempts to recreate the behaviour of vanilla Titanfall 2 servers, as well as changing some scripts to allow better support for mods", + "Version": "1.5.0", + "LoadPriority": 0, + "ConVars": [ + { + "Name": "ns_private_match_last_mode", + "DefaultValue": "tdm" + }, + { + "Name": "ns_private_match_last_map", + "DefaultValue": "mp_forwardbase_kodai" + } + ], + "Scripts": [ + { + "Path": "sh_northstar_utils.gnut", + "RunOn": "CLIENT || SERVER || UI" + }, + { + "Path": "mp/_classic_mp_dropship_intro.gnut", + "RunOn": "SERVER && MP" + } + ], + "Localisation": [ + "resource/northstar_custom_%language%.txt" + ] + } + +.. note:: + The real ``Northstar.CustomServers`` mod contains more convars and scripts, some + have been removed for the readability of the example. + +Name and description +^^^^^^^^^^^^^^^^^^^^ + +Those ones are pretty self-explanatory. Both fields are used by Northstar itself +to display in-game information about your mod in the main screen ``Mods`` menu. + +Best pratice for your mod's name is to use the ``Author.ModName`` convention. + +Version +^^^^^^^ + +This field specifies version of your mod using ``X.Y.Z`` scheme; this field must be +updated each time you release a new version of your mod. + +Common use is to increase *Z* when you publish a fix (*e.g.* ``1.5.0`` to ``1.5.1``), and +increase *Y* when you release new features (*e.g.* ``1.5.1`` to ``1.6.0``). + +Best practise is to follow semantic versioning (https://semver.org/). + +LoadPriority +^^^^^^^^^^^^ + +This field defines the order in which all mods will be loaded by Northstar. For example, +a mod with ``"LoadPriority": 1`` will be loaded after a mod with ``"LoadPriority": 0``. + +If your mod uses code from another mod, make sure to set a greater LoadPriority than the +mod you're using code from. + +ConVars +^^^^^^^ + +This field lists configuration variables, that can be set by servers owners to modify +behaviour of your mod. + +Each configuration variable must have a ``"Name"`` and a ``"DefaultValue"``; it can also +feature a ``"Flags"`` field (optional). + +You can access configuration variables from squirrel code using ``GetConVarInt``, +``GetConVarFloat``, ``GetConVarBool`` or ``GetConVarString`` calls. + +.. warning:: + + No matter the type of your variables, they have to be JSON strings, otherwise game won't start! + +Example +""""""" + +If I don't want to wait 15 seconds for matchs to start on my server, ``Northstar.CustomServers`` +mod exposes a ConVar named ``ns_private_match_countdown_length`` in its ``mod.json`` manifesto: + +.. code-block:: json + + "ConVars": [ + { + "Name": "ns_private_match_countdown_length", + "DefaultValue": "15" + }, + + ... + ] + +I can setup the ``ns_private_match_countdown_length`` variable in my +``R2Northstar/mods/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg`` configuration file. + +When starting a match, ``Northstar.CustomServers`` mod will retrieve the configuration variable +value, or its default value if it hasn't been specified in configuration file: + +.. code-block:: javascript + + // start countdown + SetUIVar( level, "gameStartTime", Time() + GetConVarFloat( "ns_private_match_countdown_length" ) ) + +.. note:: + + All ``Northstar.CustomServers`` ConVars are listed here: https://r2northstar.gitbook.io/r2northstar-wiki/hosting-a-server-with-northstar/basic-listen-server + +Flags +""""" + +You can assign flags to configuration variables; to use several flags at once, just add their values. + +.. list-table:: Configuration variable flags + :widths: 20 15 55 + :header-rows: 1 + + * - Name + - Value + - Description + * - FCVAR_UNREGISTERED + - 1 + - If this is set, don't add to linked list, etc. + * - FCVAR_DEVELOPMENTONLY + - 2 + - Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined. + * - FCVAR_GAMEDLL + - 4 + - Defined by the game DLL + * - FCVAR_CLIENTDLL + - 8 + - Defined by the client DLL + * - FCVAR_HIDDEN + - 16 + - Hidden. Doesn't appear in find or auto complete. Not deterred by ALLOW_DEVELOPMENT_CVARS. + * - FCVAR_PROTECTED + - 32 + - It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value. + * - FCVAR_SPONLY + - 64 + - This cvar cannot be changed by clients connected to a multiplayer server. + * - FCVAR_ARCHIVE + - 128 + - Save this ConVar's value to vars.rc - this works both server and client-side. + * - FCVAR_NOTIFY + - 256 + - Notifies players when this ConVar's value was changed. + * - FCVAR_USERINFO + - 512 + - Changes the client's info string + * - FCVAR_PRINTABLEONLY + - 1024 + - This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). + * - FCVAR_UNLOGGED + - 2048 + - If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log + * - FCVAR_NEVER_AS_STRING + - 4096 + - never try to print that cvar + * - FCVAR_REPLICATED (AKA FCVAR_SERVER) + - 8192 + - This value is set by server and replicated by clients. + * - FCVAR_CHEAT + - 16384 + - Do NOT allow changing of this convar by console, unless sv_cheats is 1. + * - FCVAR_SS + - 32768 + - causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated + * - FCVAR_DEMO + - 65536 + - Record this cvar in a demo. + * - FCVAR_DONTRECORD + - 131072 + - Don't record this. + * - FCVAR_SS_ADDED + - 262144 + - This is one of the "added" FCVAR_SS variables for the splitscreen players + * - FCVAR_RELEASE + - 524288 + - This value is available to the end user. + * - FCVAR_RELOAD_MATERIALS + - 1048576 + - If this cvar changes, it forces a material reload + * - FCVAR_RELOAD_TEXTURES + - 2097152 + - If this cvar changes, it forces a texture reload + * - FCVAR_NOT_CONNECTED + - 4194304 + - cvar cannot be changed by a client that is connected to a server + * - FCVAR_MATERIAL_SYSTEM_THREAD + - 8388608 + - Indicates this cvar is read from the material system thread + * - FCVAR_ARCHIVE_PLAYERPROFILE + - 16777216 + - Save this, but to profile.cfg instead - meaning this only works for clients. + * - FCVAR_ACCESSIBLE_FROM_THREADS + - 33554432 + - used as a debugging tool necessary to check material system thread convars + * - FCVAR_SERVER_CAN_EXECUTE + - 268435456 + - the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd + * - FCVAR_SERVER_CANNOT_QUERY + - 536870912 + - If this is set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue). + * - FCVAR_CLIENTCMD_CAN_EXECUTE + - 1073741824 + - IVEngineClient::ClientCmd is allowed to execute this command. Note: IVEngineClient::ClientCmd_Unrestricted can run any client command. + +.. note:: + + Some flags have been skipped due to them being generally useless unless you have very specific requirements. + +Scripts +^^^^^^^ + +The scripts field lets you declare an array of Squirrel files to import into your mod. + +Each script entry must have a "Path" value and a "RunOn" value. + +.. code-block:: json + + "Scripts": [ + { + "Path": "path/to/file.nut", + "RunOn": "( CLIENT || SERVER ) && MP" + }, + { + "Path": "path/to/another_file.nut", + "RunOn": "( CLIENT || SERVER ) && MP", + "ClientCallback": { + "Before": "ClientPreMapspawnThing", + "After": "AfterMapspawnClientThing" + }, + "ServerCallback": { + "Before": "ServerPreMapspawncrap", + "After": "ServerAfterMapspawnWoo" + } + } + ] + + +Path +"""" + +Path of the Squirrel file to import, without ``mod/scripts/vscripts`` prefix (that's +where your script files should go). + +RunOn +""""" + +Squirrel VM context in which this script should be run. + +Expression examples: + +* ``"SP"`` +* ``"SERVER && MP"`` +* ``"( CLIENT || SERVER ) && MP"`` + +ClientCallback / ServerCallback +""""""""""""""""""""""""""""""" + +Specify methods that will be called before/after map spawn. + + +Localisation +^^^^^^^^^^^^ + +This field is an array listing localisation files relative paths. + +For more info about localisation works on Northstar, read the :doc:`localisation` section. + .. note:: This project is under active development. \ No newline at end of file From 03245c074f0555c4261c8e76f40837c1065e2cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Raes?= Date: Mon, 11 Jul 2022 19:58:54 +0200 Subject: [PATCH 07/15] Localisation guide (#41) * [feat] add localisation guide sections architecture * [feat] add languages list * [feat] add translation file description section * [feat] add translations use section * [refactor] update Northstar translations section * [feat] specify traditional chinese lang code * [fix] replace tabs by spaces * [refactor] remove lang code indication from traditional Chinese entry Co-authored-by: Emma Miler <27428383+emma-miler@users.noreply.github.com> * [feat] mention utf-16 encoding is not for all files * [refactor] remove invite to PR message (too obvious) https://github.com/R2Northstar/ModdingDocs/pull/41#discussion_r912374201 * feat: mention how to change game language with Steam Co-authored-by: Emma Miler <27428383+emma-miler@users.noreply.github.com> --- docs/source/guides/localisation.rst | 101 ++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 7 deletions(-) diff --git a/docs/source/guides/localisation.rst b/docs/source/guides/localisation.rst index a5ac505e..7f404008 100644 --- a/docs/source/guides/localisation.rst +++ b/docs/source/guides/localisation.rst @@ -1,14 +1,101 @@ Localisation ============ -Northstar adds new strings to the game which can be localised to match the language you are using on your Titanfall 2 installation. +For your content to reach as many people as possible, it is important to have it translated in users' natural language. +This guide will help you do that! + +Languages list +-------------- + +Languages natively supported by Titanfall2 are: + +* English +* French +* German +* Italian +* Japanese +* Portuguese +* Russian +* Spanish +* Traditional Chinese (``"tchinese"``) + +Create translation files +------------------------ + +Here's what a translation file looks like: + +.. code-block:: json + + "lang" + { + "Language" "english" + "Tokens" + { + "MENU_LAUNCH_NORTHSTAR" "Launch Northstar" + "MENU_TITLE_MODS" "Mods" + "RELOAD_MODS" "Reload Mods" + "WARNING" "Warning" + "CORE_MOD_DISABLE_WARNING" "Disabling core mods can break your client!" + "DISABLE" "Disable" + } + } + +It begins with the ``"lang"`` instruction, contains a ``"Language"`` key indicating language of current file's translations, and +a ``"Token"`` key indexing all translations. + +.. warning :: + If the translation file contains any non-ASCII character, it must use ``"UTF-16 LE"`` encoding. + +You'll have to create one file per supported language, and all your files must be named in a similar fashion. + +For example, Northstar translation files are named ``"northstar_client_localisation_english.txt"``, ``"northstar_client_localisation_french.txt"``, +``"northstar_client_localisation_german.txt"`` etc. + +You can import them from your ``mod.json`` manifesto this way: + +.. code-block:: json -Files to translate ------------------- + { + "Localisation": [ + "resource/northstar_client_localisation_%language%.txt" + ] + } -There are the two files that need to be translated, use the English version as a base. After you finish make sure that the files are encoded in `UTF-16 LE` before opening a Pull Request. +.. note:: + The ``"%language%"`` syntax allows VM to load up translations matching game language (e.g. an English client will automatically use + ``"northstar_client_localisation_english.txt"`` file) + +Use translations in your code +----------------------------- + +To translate UI elements like menus, you have to insert strings containing your translation keys, preceded by a ``#``. + +For example, to translate the "Launch Northstar" button on main menu, instead of calling: + +.. code-block:: javascript + + AddComboButton( comboStruct, headerIndex, buttonIndex++, "Launch Northstar" ) + +We'll use: + +.. code-block:: javascript + + AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" ) + +You can also use the ``Localize`` method client-side: + +.. code-block:: javascript + + Localize( "#MENU_LAUNCH_NORTHSTAR" ) + +Northstar translations +---------------------- + +Northstar adds new strings to the game which can be localised to match the language you are using on your Titanfall 2 installation. -1. `Northstar.Client/mod/resource/northstar_client_localisation_english.txt `_ -2. `Northstar.Custom/mod/resource/northstar_custom_english.txt `_ +They're all located in ``"Northstar.Client"`` mod: `Northstar localisation files on GitHub `_ -To test your modifications go to `Origin (My games library) -> Titanfall 2 (right click) -> Game Properties -> Advanced Launch Options` and select the language you modified from the dropdown. \ No newline at end of file +.. note :: + + To test your modifications, change your game language: with Origin, go to `Origin (My games library) -> Titanfall 2 (right click) -> Game Properties -> Advanced Launch Options`; + with Steam, go to `Titanfall 2 page -> Manage (cog) -> Properties -> Language`. From 4ee19fd28752ce7286bb79bfe63498fc030718e4 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Mon, 11 Jul 2022 20:03:15 +0200 Subject: [PATCH 08/15] Add instructions on where to upload preview media (#46) and how to link to it. --- docs/source/guides/publishing.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/source/guides/publishing.rst b/docs/source/guides/publishing.rst index cad67486..0f9c0337 100644 --- a/docs/source/guides/publishing.rst +++ b/docs/source/guides/publishing.rst @@ -11,6 +11,13 @@ It is recommended to upload the source code of your mod to a public repository l If the changes your mod makes can be represented in screenshots, gameplay recordings, or GIFs, consider adding those to your README. This way anyone coming across your mod can tell which aspects of the game it changes even before installing it. +To do so, simply upload the image or gif to a host of your choice (Imgur, GitHub, and even Discord all work). To display the image directly on your page in Thunderstore, add the following line to your README: + +.. code:: markdown + + ![alt text, this text shows up when image cannot be loaded](https://example.com/image/to/link/to.gif) + + Thunderstore ------------ From 46ff56cce615137fcd8c97223d7ea80f126630f6 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Mon, 11 Jul 2022 20:03:30 +0200 Subject: [PATCH 09/15] Add link to Harmony VPK Tool (#45) --- docs/source/guides/tools.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/guides/tools.rst b/docs/source/guides/tools.rst index fe2e3927..9b700bea 100644 --- a/docs/source/guides/tools.rst +++ b/docs/source/guides/tools.rst @@ -7,6 +7,7 @@ Source engine Titanfall ^^^^^^^^^ * `Titanfall VPK Tool `_ +* `Harmony VPK Tool `_ * `Legion `_ From 191d6c29091398ad79d22914f452cccb8f618f41 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 13 Jul 2022 18:31:29 +0200 Subject: [PATCH 10/15] Add guide for contributing to ModdingDocs (#44) * Add guide for contributing to ModdingDocs Basic build instructions and useful tools * Move contributing to bottom of guide list in index --- docs/source/guides/contributing.rst | 62 +++++++++++++++++++++++++++++ docs/source/index.rst | 3 ++ 2 files changed, 65 insertions(+) create mode 100644 docs/source/guides/contributing.rst diff --git a/docs/source/guides/contributing.rst b/docs/source/guides/contributing.rst new file mode 100644 index 00000000..79446c97 --- /dev/null +++ b/docs/source/guides/contributing.rst @@ -0,0 +1,62 @@ +Contributing to ModdingDocs +=========================== + +All contributions to ModdingDocs are welcome. To add a change simply make a pull request to the `ModdingDocs repo `_. + +ModdingDocs uses `reStructuredText `_. + +A cheatsheet for reStructuredText syntax can be found here: https://docs.generic-mapping-tools.org/6.2/rst-cheatsheet.html + +Setting up the build environment for docs +----------------------------------------- + +You don't necessarily need to do this. You could just edit the files in an editor of your choice and then push the changes, wait for a GitHub actions to create a build and then check it out online. However, building the documentation locally allows you to quickly see whether the changes you made were correct or if there were any issues. + +To set up a build locally, do the following: + +Clone the `ModdingDocs repo `_, e.g. + + +.. code:: bash + + git clone https://github.com/R2Northstar/ModdingDocs/ + + +Opened the clone repo. + +Setup a `Python virtual environment `_ +(this is not strictly necessary but can help keep your Python install clean) + +.. code:: bash + + # Create virtual environment + python3 -m venv venv + + # Activate it + source venv/bin/activate + +Install the Python packages necessary to build the docs + +.. code:: bash + + pip install sphinx furo + +Finally to actually build the docs, go to the ``docs/`` directory and run `make html`, i.e. + +.. code:: bash + + cd docs/ + make html + +This will create a new folder inside ``docs/`` called ``build/`` where under ``html/`` you can find the rendered HTML files which you can open in the browser of your choice. + + +Tips and tricks +--------------- + +If you're using `Visual Studio Code `_, the following extensions might be of interest: + + +- `snekvik.simple-rst `_: for syntax highlighting +- `lextudio.restructuredtext `_: for previewing the rst files in VS Code +- `ms-vscode.live-server `_: for previewing HTML files in VS Code diff --git a/docs/source/index.rst b/docs/source/index.rst index 5813fb09..11a20c6d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,6 +7,8 @@ Welcome to the Northstar Modding Documentation! This project is under active development. Please PR everything you can! + Check :doc:`/guides/contributing` section for getting started with `readthedocs `_ and `reStructuredText `_. + Contents -------- @@ -39,6 +41,7 @@ If you know anything about any function, object or concept please dont hesitate /guides/soundmodding /guides/VTFModding /guides/publishing + /guides/contributing .. toctree:: :maxdepth: 3 From 1cdc1943f64152b3e9bd5f5848297071a39b0920 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Thu, 14 Jul 2022 02:31:49 +0200 Subject: [PATCH 11/15] Use requirements.txt to install Python dependency (#50) --- docs/source/guides/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/contributing.rst b/docs/source/guides/contributing.rst index 79446c97..23fd9b46 100644 --- a/docs/source/guides/contributing.rst +++ b/docs/source/guides/contributing.rst @@ -39,7 +39,7 @@ Install the Python packages necessary to build the docs .. code:: bash - pip install sphinx furo + pip install -r docs/requirements.txt Finally to actually build the docs, go to the ``docs/`` directory and run `make html`, i.e. From 10f5c0677ec4ade0c83cdcce770077469070acb6 Mon Sep 17 00:00:00 2001 From: AnActualEmerald Date: Fri, 15 Jul 2022 07:22:24 -0400 Subject: [PATCH 12/15] Fix broken formatting in VTF modding section (#51) * Fix VTFmodding.rst formatting * Update docs/source/guides/VTFModding.rst Co-authored-by: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Co-authored-by: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> --- docs/source/guides/VTFModding.rst | 84 +++++++++++++++---------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/source/guides/VTFModding.rst b/docs/source/guides/VTFModding.rst index 8a3de9dd..261c5555 100644 --- a/docs/source/guides/VTFModding.rst +++ b/docs/source/guides/VTFModding.rst @@ -9,64 +9,64 @@ VTF, short for "Valve Texture Format", is a texture type used by valve in the so VMT Overview ------------ -VMT, short for "Valve Material Type", is a text `material ` system that dictates how the game percieves a vtf outside of how it looks. It uses `parameters ` and `proxies ` to dictate how `shaders ` will show the game. We will go into greater detail later. +VMT, short for "Valve Material Type", is a text `material `__ system that dictates how the game percieves a vtf outside of how it looks. It uses `parameters `__ and `proxies `__ to dictate how `shaders `__ will show the game. We will go into greater detail later. Editing FX that use VTFs ------------------------ A lot of fx in titanfall use vtfs as textures. Therefore, if the corresponding vtf can be found, we can do almost anything with the fx's appearence. -Example Mod: `Exrill's Blue L-Star ` +Example Mod: `Exrill's Blue L-Star `__ Since the L-Star has a physical bullet that is counted as fx, we can edit how it looks. VTF Skins --------- -Though it is more a skins thing, making vtf skins is somewhat complicated, and to do any vtf editing you need to understand it. To get started, extract the .mdl of what you want with the `Titanfall VPK Tool `. Open `englishclient_mp_common.bsp.pak000_dir.vpk` in the vpk folder. Go to `models\weapons` and find the weapon you want. Not all guns are named the same in files as they are in game. Here is `list of weapon names ` to help you out. Once you've found your gun, extract both the ptpov and w versions. ptpov is the viewmodel and w is the normal model. then extract it anywhere. To change the path to the texture we will need a hex editor. I will use `HxD `, but you can also use `ida ` or anything else, its just personal preference. Once you've got that, open your .mdl with it and search (ctrl+f) for skin_31. If that dosent bring anything up, try skn_31 or skin31 or something like that until you find it. The string of text around it should look something like `.models\Weapons_R2\weaponname\weaponname_skin_31`. Near it, there should be the same text, but without the `_skin_31`. This is the path to the default textures. Now, before you edit, you have to realize hex editors are just built different (cant help it). You cant add or delete text with a hex editor, only replace. Go to the start of the path for the default textures, and change the path to anything else, as long as it starts with `.models\weapons_r2`. For this example i will make a kraber skin, so i will change my path to `.models\weapons_r2\vtfkraber\vtfkraber`.once youve done that, save and do the same thing on the ptpov_ or w_ model. now in the same folder you extracted your mdls too, make a `materials` folder. inside that create the path you hex edited, but the last part is a .vmt file not a folder. the path i would make would be `models\weapons_r2\vtfkraber\vtfkraber.vmt`. once you have made your .vmt, open it and paste this in: -`` -"UnlitTwoTexture" -{ - - "$surfaceprop" "metal" - "$basetexture" "" - "$texture2" "" - "$bumpmap" "" - "$allowoverbright" "1" - "$vertexcolor" 1 - "$vertexalpha" 1 - "$decal" "1" - "$model" 1 - "$nocull" "1" -} -`` -When we use vtf textures, we can only use the albedo and normal `maps `. Fire up `VTFEdit ` and hit file, import, and grab your texture. then file, save as, and save it in the same folder as your .vmt. In your vmt, put the path to your texture in the parentheces after `"$basetexture"`, treating models as root. So i would put, `models\weapons_r2\vtfkraber\kraber_col`. Then do the same for your normal map, but when you import it, pick volume texture instead of animated texture. In `"$bumpmap"` put the path to your normal texture. Now create another vtf with literally any image. Put its path in `"$texture2"`. As far as i know, this is neccesary even though the texture isnt used. Your root folder should look somewhat like this: -`` -root - materials - models - weapons_r2 - vtfkraber - vtfkraber.vmt - models - weapons - at_rifle (name of kraber) - ptpov_at_rifle.mdl - w_at_rifle.mdl -`` +Though it is more a skins thing, making vtf skins is somewhat complicated, and to do any vtf editing you need to understand it. To get started, extract the .mdl of what you want with the `Titanfall VPK Tool `__. Open `englishclient_mp_common.bsp.pak000_dir.vpk` in the vpk folder. Go to `models\weapons` and find the weapon you want. Not all guns are named the same in files as they are in game. Here is `list of weapon names `__ to help you out. Once you've found your gun, extract both the ptpov and w versions. ptpov is the viewmodel and w is the normal model. then extract it anywhere. To change the path to the texture we will need a hex editor. I will use `HxD `__, but you can also use `ida `__ or anything else, its just personal preference. Once you've got that, open your .mdl with it and search (ctrl+f) for skin_31. If that dosent bring anything up, try skn_31 or skin31 or something like that until you find it. The string of text around it should look something like `.models\Weapons_R2\weaponname\weaponname_skin_31`. Near it, there should be the same text, but without the `_skin_31`. This is the path to the default textures. Now, before you edit, you have to realize hex editors are just built different (cant help it). You cant add or delete text with a hex editor, only replace. Go to the start of the path for the default textures, and change the path to anything else, as long as it starts with `.models\weapons_r2`. For this example i will make a kraber skin, so i will change my path to `.models\weapons_r2\vtfkraber\vtfkraber`.once youve done that, save and do the same thing on the ptpov_ or w_ model. now in the same folder you extracted your mdls too, make a `materials` folder. inside that create the path you hex edited, but the last part is a .vmt file not a folder. the path i would make would be `models\weapons_r2\vtfkraber\vtfkraber.vmt`. once you have made your .vmt, open it and paste this in:: + + "UnlitTwoTexture" + { + + "$surfaceprop" "metal" + "$basetexture" "" + "$texture2" "" + "$bumpmap" "" + "$allowoverbright" "1" + "$vertexcolor" 1 + "$vertexalpha" 1 + "$decal" "1" + "$model" 1 + "$nocull" "1" + } + +When we use vtf textures, we can only use the albedo and normal `maps `__. Fire up `VTFEdit `__ and hit file, import, and grab your texture. then file, save as, and save it in the same folder as your .vmt. In your vmt, put the path to your texture in the parentheces after `"$basetexture"`, treating models as root. So i would put, `models\weapons_r2\vtfkraber\kraber_col`. Then do the same for your normal map, but when you import it, pick volume texture instead of animated texture. In `"$bumpmap"` put the path to your normal texture. Now create another vtf with literally any image. Put its path in `"$texture2"`. As far as i know, this is neccesary even though the texture isnt used. Your root folder should look somewhat like this:: + + root + ├─ materials + │ └─ models + │ └─ weapons_r2 + │ └─ vtfkraber + │ └─ vtfkraber.vmt + └─ models + └─ weapons + └─at_rifle (name of kraber) + ├─ ptpov_at_rifle.mdl + └─ w_at_rifle.mdl + And you're done! You just need to pack it into a vpk with the vpk tool and put it in a mod. Making your Skin Animated ------------------------- To make an animated skin, all we need to do is add a proxie and change our albedo vtf. Once you've made the frames of your skin, import them all at once with ctrl+a and save your vtf. Put it as `"$basecolor"`. At the bottom of your vmt but before the }, add this: -`` -"Proxies" +:: + "Proxies" { - AnimatedTexture - { - animatedTextureVar $basetexture - animatedTextureFrameNumVar $frame - animatedTextureFrameRate - } + AnimatedTexture + { + animatedTextureVar $basetexture + animatedTextureFrameNumVar $frame + animatedTextureFrameRate + } } -`` + Put the fps you want your skin to play at in afet animatedTextureFrameRate, and you're done! From 14526b9c6cb604de4a16d35638b58247ce6a3540 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Tue, 19 Jul 2022 15:42:44 +0200 Subject: [PATCH 13/15] Document dependency constants (#53) --- docs/source/reference/index.rst | 1 + .../northstar/dependencyconstants.rst | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 docs/source/reference/northstar/dependencyconstants.rst diff --git a/docs/source/reference/index.rst b/docs/source/reference/index.rst index a41241ec..b3cbf843 100644 --- a/docs/source/reference/index.rst +++ b/docs/source/reference/index.rst @@ -8,6 +8,7 @@ Northstar API /reference/northstar/callbacks /reference/northstar/chathooks /reference/northstar/clientcommandsnotifications + /reference/northstar/dependencyconstants.rst Respawn API ----------- diff --git a/docs/source/reference/northstar/dependencyconstants.rst b/docs/source/reference/northstar/dependencyconstants.rst new file mode 100644 index 00000000..57620f37 --- /dev/null +++ b/docs/source/reference/northstar/dependencyconstants.rst @@ -0,0 +1,35 @@ +Dependency Constants +==================== + +Dependency constants can be used to load constants from another mod. + +Inside your ``mod.json`` define a constant as: + +.. code:: javascript + + { + // mod.json stuff + "Dependencies": { + // sets the constant to 0 or 1, depending if the mod with the name "Mod Name" exists and is enabled + "CONSTANT_NAME": "Mod Name" + } + } + +For Example: + +.. code:: javascript + + "PLAYER_HAS_ROGUELIKE_MOD": "TF|Roguelike" + +Will define a constant ``PLAYER_HAS_ROGUELIKE_MOD`` that is set to ``0`` or ``1`` depending if the mod is enabled. It then can be used as a constant/compiler flag. + + +.. code:: csharp + + #if PLAYER_HAS_ROGUELIKE_MOD + print("player has roguelike mod") + Roguelike_Function(); + #else + print("Can't use the function because the mod is off :'(") + #endif + From d278d768c46e7031640fbfb726d4c3f83b1366a4 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 20 Jul 2022 16:49:19 +0200 Subject: [PATCH 14/15] Specifiy that second `venv` is folder name (#56) --- docs/source/guides/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/contributing.rst b/docs/source/guides/contributing.rst index 23fd9b46..ae4d1d71 100644 --- a/docs/source/guides/contributing.rst +++ b/docs/source/guides/contributing.rst @@ -29,7 +29,7 @@ Setup a `Python virtual environment Date: Wed, 20 Jul 2022 16:49:52 +0200 Subject: [PATCH 15/15] Add Windows instructions (#57) --- docs/source/guides/contributing.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/source/guides/contributing.rst b/docs/source/guides/contributing.rst index ae4d1d71..fe63ea64 100644 --- a/docs/source/guides/contributing.rst +++ b/docs/source/guides/contributing.rst @@ -32,7 +32,10 @@ Setup a `Python virtual environment