Defines the cw.animation library, which assigns player models to animation classes and picks the animation for each activity and weapon hold type.

It holds the animation tables for the Combine Overwatch, Civil Protection, male and female human and vortigaunt classes, and lets schemas assign models to a class or override single animations. It also decides which viewmodel hands a model uses.

Summary

Methods

Makes models whose path contains a string use the black skin on citizen and refugee hands.
Assigns a model to the Civil Protection animation class.
Makes models whose path contains a string use the Combine viewmodel hands.
Assigns a model to the Combine Overwatch animation class.
Makes models whose path contains a string use the Counter-Strike: Source viewmodel hands.
Assigns a model to the female Civil Protection animation class.
Assigns a model to the female human animation class.
Sets the viewmodel hands used for models whose path contains a string.
Makes models whose path contains a string use the HEV suit viewmodel hands.
Assigns a model to the male human animation class.
Assigns a model to an animation class.
Overrides a model's animations for one hold type.
Makes models whose path contains a string use the refugee viewmodel hands.
Assigns a model to the vortigaunt animation class.
Makes models whose path contains a string use the citizen hands with the zombie skin.
Makes models whose path contains a string use the refugee hands with the zombie skin.
Adjusts hands info for a model in place.
Returns the viewmodel hands info for a model.
Returns the animation a model uses for an activity and hold type.
Returns the viewmodel hands a model should use.
Returns the sequence a model plays in the character menu.
Returns the animation class a model was assigned with cw.animation:AddModel.
Returns the animation table for a model.
Returns the hold type used to animate a weapon.
Sets the sequence a model plays in the character menu.

Methods

cw.animation:AddBlackModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:707

Makes models whose path contains a string use the black skin on citizen and refugee hands.

Parameters

  • model String Part of the model path, such as '/male_01.mdl'

cw.animation:AddCivilProtectionModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:534

Assigns a model to the Civil Protection animation class.

Parameters

  • model String Model path

Returns

  • String The lowercased model path

cw.animation:AddCombineHands(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:736

Makes models whose path contains a string use the Combine viewmodel hands.

Parameters

  • model String Part of the model path

cw.animation:AddCombineOverwatchModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:526

Assigns a model to the Combine Overwatch animation class.

Parameters

  • model String Model path

Returns

  • String The lowercased model path

Makes models whose path contains a string use the Counter-Strike: Source viewmodel hands.

Parameters

  • model String Part of the model path

cw.animation:AddFemaleCivilProtectionModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:542

Assigns a model to the female Civil Protection animation class.

Parameters

  • model String Model path

Returns

  • String The lowercased model path

cw.animation:AddFemaleHumanModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:550

Assigns a model to the female human animation class.

Parameters

  • model String Model path

Returns

  • String The lowercased model path

cw.animation:AddHandsModel(model, hands)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:700

Sets the viewmodel hands used for models whose path contains a string.

Parameters

  • model String Part of the model path; case is ignored
  • hands Map Hands info with model, skin and body keys

See also

Makes models whose path contains a string use the HEV suit viewmodel hands.

Parameters

  • model String Part of the model path

cw.animation:AddMaleHumanModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:558

Assigns a model to the male human animation class.

Parameters

  • model String Model path

Returns

  • String The lowercased model path

cw.animation:AddModel(class, model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:427

Assigns a model to an animation class.

Parameters

  • class String Animation class, a key of cw.animation.stored such as 'maleHuman' or 'civilProtection'
  • model String Model path; case is ignored

Returns

  • String The lowercased model path

cw.animation:AddOverride(model, key, value)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:440

Overrides a model's animations for one hold type.

Overrides are checked by cw.animation:GetForModel before the model's animation class.

Parameters

  • model String Model path; case is ignored
  • key String Hold type to override, such as 'pistol'
  • value Map Animations keyed by activity (ACT_MP_*) or by 'attack'/'reload'

cw.animation:AddRefugeeHands(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:758

Makes models whose path contains a string use the refugee viewmodel hands.

Parameters

  • model String Part of the model path, such as '/group03/'

cw.animation:AddVortigauntModel(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:518

Assigns a model to the vortigaunt animation class.

Parameters

  • model String Model path

Returns

  • String The lowercased model path

cw.animation:AddZombieHands(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:714

Makes models whose path contains a string use the citizen hands with the zombie skin.

Parameters

  • model String Part of the model path

cw.animation:AddZombieRefugeeHands(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:769

Makes models whose path contains a string use the refugee hands with the zombie skin.

Parameters

  • model String Part of the model path

cw.animation:AdjustHandsInfo(model, info)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:820

Adjusts hands info for a model in place.

Citizen and refugee hands get the black skin for models added with cw.animation:AddBlackModel. Then runs the AdjustCModelHandsInfo hook (via hook.Run) with the model and the info.

Parameters

  • model String Lowercased model path
  • info Map Hands info with model, skin and body keys; changed in place

cw.animation:CheckHands(model, animTable)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:785

Returns the viewmodel hands info for a model.

Starts from the citizen hands, then the animation table's hands, then the first matching entry added with cw.animation:AddHandsModel, and applies cw.animation:AdjustHandsInfo.

Parameters

  • model String Lowercased model path
  • animTable Map optional, defaults to nil The model's animation table

Returns

  • Map Hands info with model, skin and body keys

cw.animation:GetForModel(model, holdType, key, bNoFallbacks)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:466

Returns the animation a model uses for an activity and hold type.

Unknown hold types fall back to normal and unknown activities to ACT_MP_STAND_IDLE, unless bNoFallbacks is set. Overrides from cw.animation:AddOverride take precedence. Returns nothing for models without an animation table, and prints a stack trace when model is nil.

local attackAnimation = cw.animation:GetForModel(model, weaponHoldType, 'attack', true)

Parameters

  • model String Model path
  • holdType String Hold type, such as 'normal' or 'smg'
  • key Any Activity (ACT_MP_*), or 'attack', 'reload' or 'glide'
  • bNoFallbacks Boolean optional, defaults to nil Return nil instead of falling back

Returns

  • Any The animation: an activity Number, a sequence String, or a List of two of these for the lowered and raised states

cw.animation:GetHandsInfo(model)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:840

Returns the viewmodel hands a model should use.

Parameters

  • model String Model path

Returns

  • Map Hands info with model, skin and body keys

cw.animation:GetMenuSequence(model, bRandom)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:405

Returns the sequence a model plays in the character menu.

Parameters

  • model String Model path; case is ignored
  • bRandom Boolean optional, defaults to nil Pick one sequence at random when a list is stored

Returns

  • Any The sequence name, the stored List when bRandom is not set, or nil if none is set

See also

cw.animation:GetModelClass(model, alwaysReal)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:502

Returns the animation class a model was assigned with cw.animation:AddModel.

Parameters

  • model String Model path; case is ignored
  • alwaysReal Boolean optional, defaults to nil Return nil instead of 'maleHuman' for unassigned models

Returns

  • String The animation class

Returns the animation table for a model.

Models without an assigned class use the female human table when their path contains female and the male human table otherwise.

Parameters

  • model String Model path

Returns

  • Map Animations keyed by hold type, or nil for models in a /player/ folder

cw.animation:GetWeaponHoldType(player, weapon)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:637

Returns the hold type used to animate a weapon.

Known weapon classes have a fixed hold type. Otherwise the weapon's HoldType is used, mapped to one of the hold types Catwork animates (for example ar2 becomes smg).

Parameters

  • player Player The player holding the weapon, unused
  • weapon Weapon The weapon

Returns

  • String The lowercased hold type; 'normal' when the weapon has none

cw.animation:SetMenuSequence(model, sequence)

shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:394

Sets the sequence a model plays in the character menu.

Parameters

  • model String Model path; case is ignored
  • sequence Any Sequence name, or a List of sequence names to pick from at random

See also

Defined in