Main file of the Emote Anims plugin, which lets characters perform stance and gesture animations through the /Anim
commands.
Aliases the plugin as cwEmoteAnims and defines cwEmoteAnims:IsPlayerInStance, the cwEmoteAnims.stanceList set
of animations that count as stances, and the shared Move and EntityFireBullets hooks that lock an emoting
player's angles and block their bullets.
Summary
Hooks
StanceAng net var while emoting and returns true to override the movement.false while the player is in a stance.false for a living player in a stance emote.false while the player is in a stance emote.Hooks
cwEmoteAnims:CalcViewAdjustTable(view)
client gamemodes/catwork/plugins/emoteanims/plugin/cl_hooks.lua:30Implements hook CalcViewAdjustTable
Called when the view table is adjusted; moves the camera out of the local player's head while they emote.
Idle stances place the camera just in front of the head, other emotes up to 128 units behind it.
Parameters
- view Map The view table;
originis changed in place
cwEmoteAnims:EntityFireBullets(entity, bulletInfo)
shared gamemodes/catwork/plugins/emoteanims/plugin/sh_plugin.lua:50Implements hook EntityFireBullets
Called when an entity fires bullets; blocks bullets fired by an emoting player or by an entity whose owner is emoting.
Parameters
- entity Entity The entity firing, or the weapon whose owner is checked
- bulletInfo Map The bullet data
Returns
- Boolean
falseto block the bullets
cwEmoteAnims:IsPlayerInStance(player)
shared gamemodes/catwork/plugins/emoteanims/plugin/sh_plugin.lua:24Returns whether a player is performing an emote.
A player is in a stance while the StancePos net var holds a position other than Vector(0, 0, 0).
Parameters
- player Player The player to check
Returns
- Boolean Whether the player is in a stance
cwEmoteAnims:MakePlayerExitStance(player, keepPosition)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_plugin.lua:11Ends a player's emote and clears the stance net vars.
Unless keepPosition is set, a player moved by the emote (such as AnimSitWall) is put back at the
position they had before it. If another player stands within 32 units of that position, the player
is notified and stays in the stance.
Parameters
- player Player The player to take out of the stance
- keepPosition Boolean optional, defaults to
nilWhether to leave the player where they are
cwEmoteAnims:Move(player, moveData)
shared gamemodes/catwork/plugins/emoteanims/plugin/sh_plugin.lua:35Called when a player's movement is processed; locks the player's angles to the StanceAng net var
while emoting and returns true to override the movement.
Parameters
- player Player The moving player
- moveData CMoveData The player's movement data
Returns
- Boolean
truewhile the player is in a stance
cwEmoteAnims:PlayerCanFireWeapon(player, bIsRaised, weapon, bIsSecondary)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:41Implements hook PlayerCanFireWeapon
Called when a player attempts to fire a weapon; returns false while the player is in a stance.
Parameters
- player Player The player firing
- bIsRaised Boolean Whether the weapon is raised
- weapon Weapon The weapon being fired
- bIsSecondary Boolean Whether this is a secondary attack
Returns
- Boolean
falseto block firing
cwEmoteAnims:PlayerCanRagdoll(player, state, delay, decay, ragdoll)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:104Implements hook PlayerCanRagdoll
Called when a player is about to be ragdolled; returns false for a living player in a stance emote.
Parameters
- player Player The player to be ragdolled
- state Number The requested ragdoll state, one of the
RAGDOLL_*enums - delay Number Seconds before the player gets up
- decay Number Seconds before the ragdoll is removed
- ragdoll Map optional, defaults to
nilThe player's current ragdoll info table, when they are already ragdolled
Returns
- Boolean
falseto block the ragdoll
cwEmoteAnims:PlayerNoClip(player)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:117Called when a player attempts to noclip; returns false while the player is in a stance emote.
Parameters
- player Player The player toggling noclip
Returns
- Boolean
falseto block noclip
cwEmoteAnims:PlayerRagdolled(player, state, ragdoll)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:31Implements hook PlayerRagdolled
Called when a player has been ragdolled; ends the player's emote in place.
Parameters
- player Player The ragdolled player
- state Number The new ragdoll state, one of the
RAGDOLL_*enums - ragdoll Map The player's ragdoll info table
cwEmoteAnims:PlayerThink(player, curTime, infoTable)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:56Implements hook PlayerThink
Called at an interval while a player is connected; ends a stance emote once the player moves.
The emote stops when the player strays more than 16 units from the stance position, leaves the ground, presses a movement key or stands on anything other than the world or a prop. When the player is still marked as in a stance but no stance animation plays (a short emote that ended, for example), the stance net vars are cleared a second later.
Parameters
- player Player The player being processed
- curTime Number The current time
- infoTable Map The player's think info
cwEmoteAnims:PostPlayerLightSpawn(player, weapons, ammo, special)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:23Implements hook PostPlayerLightSpawn
Called after a player spawns lightly; ends the player's emote and moves them back to where they stood before it, if the emote moved them.
Parameters
- player Player The player who spawned
- weapons Any The weapons argument passed to
cw.player:LightSpawn - ammo Any The ammo argument passed to
cw.player:LightSpawn - special Boolean Whether this was a special light spawn
cwEmoteAnims:PostPlayerSpawn(player, lightSpawn, changeClass, firstSpawn)
server gamemodes/catwork/plugins/emoteanims/plugin/sv_hooks.lua:11Implements hook PostPlayerSpawn
Called just after a player spawns; ends the player's emote in place unless it was a light spawn.
Parameters
- player Player The player who spawned
- lightSpawn Boolean Whether this was a light spawn
- changeClass Boolean Whether the player spawned because they changed class
- firstSpawn Boolean Whether this is the player's first spawn
cwEmoteAnims:ShouldDrawLocalPlayer()
client gamemodes/catwork/plugins/emoteanims/plugin/cl_hooks.lua:9Called to decide whether the local player is drawn; draws them while they are in a stance.
Returns
- Boolean
truewhile the local player is in a stance, otherwisenilto leave it to other hooks
cwEmoteAnims:UpdateAnimation(player)
client gamemodes/catwork/plugins/emoteanims/plugin/cl_hooks.lua:17Called when a player's animation is updated; renders an emoting player at their stance angles.
Parameters
- player Player The player being animated