Summary

Hooks

Moves a player's grab entity to where the held entity should be, in front of their aim.
Called when a player attempts to pick up an entity with the hands.
Called when a config value changes; takes the gravity gun from, or gives it back to, every player when take_physcannon changes.
Makes a player drop the entity they are holding.
Makes a player pick up an entity with the hands, dropping anything they already held.
Drops the entity a player is holding and throws it in the direction they aim.
Called to get whether an entity is being held; returns true for a non-player entity held with the hands.
Called to get the full-screen text; shows a "being dragged" notice while the local player's ragdoll is carried.
Called when a player presses a key; handles picking up, throwing and dropping with the hands.
Called every second for each player; pauses the unragdoll timer of a ragdoll that is being held and keeps the IsDragged net var up to date.
Called when a player attempts to get up; returns false while their ragdoll is dragged.
Called when a player attempts to punch; returns false while the player holds an entity or for a second after they dropped one.
Called when a player's character has unloaded; drops whatever the player was holding.
Called when a player enters a vehicle; drops the vehicle if the player was holding it.
Called to get the entity a player is holding; returns the entity picked up with the hands.
Called when a player's weapons are given; removes the gravity gun from the spawn weapons when the take_physcannon config is on.
Called when a player's ragdoll is about to take damage; protects dragged ragdolls.

Hooks

cwPickupObjects:CalculatePosition(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_plugin.lua:122

Moves a player's grab entity to where the held entity should be, in front of their aim.

The distance grows while the player walks forward, and sprinting backwards pulls the entity close.

Parameters

  • player Player The player holding the entity

Returns

  • Boolean true when the position was updated, nil when the player can no longer hold it

cwPickupObjects:CanHandsPickupEntity(player, entity, trace)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:188

Implements hook CanHandsPickupEntity

Called when a player attempts to pick up an entity with the hands.

Allows movable physics props that nobody else holds and that do not set noHandsPickup, up to a mass of 100 plus a strength bonus of up to 100; ragdolls are allowed at any mass. Plants and garbage are never allowed.

Parameters

  • player Player The player picking up
  • entity Entity The entity to pick up
  • trace Map The player's eye trace

Returns

  • Boolean true to allow the pickup, false to forbid it

cwPickupObjects:ClockworkConfigChanged(key, data, previousValue, newValue)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:59

Implements hook ClockworkConfigChanged

Called when a config value changes; takes the gravity gun from, or gives it back to, every player when take_physcannon changes.

Parameters

  • key String The config key
  • data Map The config's data table
  • previousValue Any The old value
  • newValue Any The new value

cwPickupObjects:ForceDropEntity(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_plugin.lua:33

Makes a player drop the entity they are holding.

Removes the grab entity and restores the entity's collision group when prop_kill_protection is on. With that config on, the dropped entity deals no damage for a minute; a dropped ragdoll also takes no damage for a second. The player cannot punch for a second afterwards.

Parameters

  • player Player The player dropping

Returns

  • Entity The entity that was held, or nil when the player held nothing

cwPickupObjects:ForcePickup(player, entity, trace)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_plugin.lua:78

Makes a player pick up an entity with the hands, dropping anything they already held.

Spawns an invisible cw_grab entity at the trace hit position and welds the entity to it; the grab then follows the player's aim. With prop_kill_protection on, the entity is switched to COLLISION_GROUP_WEAPON while held.

Parameters

  • player Player The player picking up
  • entity Entity The entity to pick up
  • trace Map The trace that hit the entity; HitPos and PhysicsBone are used

cwPickupObjects:ForceThrowEntity(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_plugin.lua:11

Drops the entity a player is holding and throws it in the direction they aim.

Parameters

  • player Player The player throwing

cwPickupObjects:GetEntityBeingHeld(entity)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:47

Implements hook GetEntityBeingHeld

Called to get whether an entity is being held; returns true for a non-player entity held with the hands.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean true when the entity is held, otherwise nil

cwPickupObjects:GetScreenTextInfo()

client gamemodes/catwork/plugins/pickupobjects/plugin/cl_hooks.lua:9

Implements hook GetScreenTextInfo

Called to get the full-screen text; shows a "being dragged" notice while the local player's ragdoll is carried.

Returns

  • Map Screen text info with alpha and title, or nil when the player is not dragged

cwPickupObjects:KeyPress(player, key)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:146

Called when a player presses a key; handles picking up, throwing and dropping with the hands.

With nothing held, secondary attack picks up the entity looked at within 96 units if the CanHandsPickupEntity hook allows it, or knocks on a door. While holding, primary attack throws and reload drops the entity.

Parameters

  • player Player The player pressing the key
  • key Number The key, one of the IN_* enums

cwPickupObjects:OnePlayerSecond(player, curTime)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:117

Implements hook OnePlayerSecond

Called every second for each player; pauses the unragdoll timer of a ragdoll that is being held and keeps the IsDragged net var up to date.

Parameters

  • player Player The player being processed
  • curTime Number The current time

cwPickupObjects:PlayerCanGetUp(player)

shared gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:107

Implements hook PlayerCanGetUp

On the server

Called when a player attempts to get up; returns false while their ragdoll is dragged.

Parameters

  • player Player The ragdolled player

Returns

  • Boolean false to stop the player getting up

On the client

Called when the local player attempts to get up; returns false while their ragdoll is dragged.

Parameters

  • player

Returns

  • Boolean false to stop the player getting up

Defined in

cwPickupObjects:PlayerCanThrowPunch(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:27

Implements hook PlayerCanThrowPunch

Called when a player attempts to punch; returns false while the player holds an entity or for a second after they dropped one.

Parameters

  • player Player The punching player

Returns

  • Boolean false to block the punch

cwPickupObjects:PlayerCharacterUnloaded(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:10

Implements hook PlayerCharacterUnloaded

Called when a player's character has unloaded; drops whatever the player was holding.

Parameters

  • player Player The player whose character unloaded

cwPickupObjects:PlayerEnteredVehicle(player, vehicle, class)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:98

Called when a player enters a vehicle; drops the vehicle if the player was holding it.

Parameters

  • player Player The player entering
  • vehicle Vehicle The vehicle
  • class Number The seat role

cwPickupObjects:PlayerGetHoldingEntity(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:17

Implements hook PlayerGetHoldingEntity

Called to get the entity a player is holding; returns the entity picked up with the hands.

Parameters

  • player Player The player to check

Returns

  • Entity The held entity, or nil when the player holds nothing

cwPickupObjects:PlayerGiveWeapons(player)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:37

Implements hook PlayerGiveWeapons

Called when a player's weapons are given; removes the gravity gun from the spawn weapons when the take_physcannon config is on.

Parameters

  • player Player The player receiving weapons

cwPickupObjects:PlayerRagdollCanTakeDamage(player, ragdoll, inflictor, attacker, hitGroup, damageInfo)

server gamemodes/catwork/plugins/pickupobjects/plugin/sv_hooks.lua:82

Implements hook PlayerRagdollCanTakeDamage

Called when a player's ragdoll is about to take damage; protects dragged ragdolls.

A ragdoll takes no damage for a second after it is dropped, and while held it only takes explosion, bullet, club and slash damage.

Parameters

  • player Player The ragdolled player
  • ragdoll Entity The player's ragdoll
  • inflictor Entity The entity that dealt the damage
  • attacker Entity The entity responsible for the damage
  • hitGroup Number The hit group, one of the HITGROUP_* enums
  • damageInfo CTakeDamageInfo The damage

Returns

  • Boolean false to block the damage

Defined in