Defines the cw.entity library, helpers for entities in general and for doors, ragdolls, property and item entities in particular.

The shared part classifies entities and checks lines of sight. The server part manages doors (names, text, parents, ownability, opening and blasting them), tracks which character owns an entity, and spawns cw_item, cw_cash and cw_shipment entities. The client part fetches the item of an item entity over the FetchItemData message and works out where door text is drawn.

Summary

Methods

Bashes a closed door open, away from the entity bashing it.
Returns whether an entity belongs to another character of the same player.
Blasts a door off its hinges, replacing it with a physics prop that decays after five minutes.
Calculates where to draw the text on both faces of a door.
Returns whether the centre of an entity is visible from the centre of another.
Returns whether an NPC's shoot position is visible from the centre of an entity.
Returns whether a player and an entity can see each other.
Returns whether a position is visible from the centre of an entity.
Takes an entity away from its owner, whether the owner is online or not.
Gives an entity the same owner as another entity.
Spawns a cw_shipment entity holding a batch of items.
Fades an entity out over time and removes it.
Disintegrates an entity: makes it non-solid, freezes it, plays a removal effect and decays it.
Dissolves an entity with an env_entity_dissolver.
Returns whether a parent door shares its access with its children.
Returns whether a parent door shares its text with its children.
Spawns every item of an inventory and an amount of cash at a position.
Requests the item instance of an entity from the server over the FetchItemData Cable message.
Returns the item instance received for an entity with cw.entity:FetchItemData.
Runs an entity menu option on the server over the EntityMenuOption Cable message.
Returns the child doors of a door.
Returns the doors that existed on the map when the server started.
Returns a door's name.
Returns the parent of a door.
Returns a door and the doors next to it that form a double door.
Returns a door's state from its save table.
Returns the text displayed on a door.
Returns the position and angles of a weapon's muzzle attachment.
Returns the player that owns an entity.
Returns the position of an entity's pelvis bone, such as a ragdoll's.
Returns the player an entity belongs to, such as a player's ragdoll.
Returns the angles stored with cw.entity:SetStartAngles.
Returns the position stored with cw.entity:SetStartPosition.
Returns whether the item data of an item entity has been received from the server.
Returns whether an entity is owned by a character.
Returns whether an entity's model path contains chair or seat.
Returns whether an entity is fading out to be removed by cw.entity:Decay.
Returns whether an entity is a door.
Returns whether a door is a false door: unownable, named false and shown with no text.
Returns whether a door is hidden: unownable and named hidden.
Returns whether a door is locked.
Returns whether a door has child doors.
Returns whether a door cannot be bought.
Returns whether a door cannot be sold by its owner.
Returns whether an entity is inside an axis-aligned box.
Returns whether players can pick up and interact with an entity.
Returns whether an entity was created by the map.
Returns whether an entity is a prop_physics or prop_physics_multiplayer.
Returns whether an entity is the ragdoll of a ragdolled player.
Returns whether an entity's model path contains prisoner, as prisoner pod vehicles do.
Moves an entity so its nearest point rests on a surface.
Creates a ragdoll copying an entity's model, appearance, pose and velocity.
Protects an entity from the physics gun and tools and optionally freezes it.
Returns a field of an entity's property table.
Restores an entity's collision group once it no longer overlaps anything.
Gives a chair vehicle the key values and members of its vehicle list entry, so players sit in it correctly.
Sets whether a door is a false door, an unownable door named false.
Sets whether a door is hidden, an unownable door named hidden.
Sets a door's name.
Sets the parent of a door, or removes it.
Sets whether a parent door shares its access with its child doors.
Sets whether a parent door shares its text with its child doors.
Makes a door move three times faster for one second.
Sets the text displayed on a door, and on its children when it shares its text.
Sets whether a door can be bought.
Sets whether an entity was created by the map.
Sets the player an entity belongs to, through its Player networked entity.
Sets a field of an owned entity's property table.
Stores the angles an entity started with.
Stores the position an entity started at.
Welds every bone of a ragdoll together so it holds its pose like a statue.
Cancels a pending collision group restore started by cw.entity:ReturnCollisionGroup.

Methods

cw.entity:BashInDoor(entity, eBasher)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:694

Bashes a closed door open, away from the entity bashing it.

The door opens fast and becomes non-solid to players until it stops overlapping anything.

Parameters

  • entity Entity The door
  • eBasher Entity The entity bashing the door

cw.entity:BelongsToAnotherCharacter(player, entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1465

Returns whether an entity belongs to another character of the same player.

Parameters

  • player Player The player
  • entity Entity The entity

Returns

  • Boolean Whether the player owns it with a character other than the current one

cw.entity:BlastDownDoor(entity, force, attacker)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:544

Blasts a door off its hinges, replacing it with a physics prop that decays after five minutes.

The door is unlocked and made invisible and non-solid, its Combine lock explodes and its breach entity is breached. The prop is pushed away from the attacker, or by force when there is no attacker. The door is restored after five minutes.

Parameters

  • entity Entity The door
  • force Vector optional, defaults to nil Force applied to the prop
  • attacker Entity optional, defaults to nil The entity that blasted the door

cw.entity:CalculateDoorTextPosition(door, reversed)

client gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1563

Calculates where to draw the text on both faces of a door.

Traces onto the door's thinnest side, and retries from the other side when the trace hits the world.

Parameters

  • door Entity The door
  • reversed Boolean optional, defaults to nil Whether this is the retry from the other side

Returns

  • Map The position, angles, positionBack, anglesBack, width and hitWorld of the text

cw.entity:CanSeeEntity(entity, target, iAllowance, tIgnoreEnts)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:242

Returns whether the centre of an entity is visible from the centre of another.

Parameters

  • entity Entity The entity looking
  • target Entity The entity to look at
  • iAllowance Number optional, defaults to 0.75 Fraction of the trace that must be clear, from 0 to 1
  • tIgnoreEnts List<Entity> optional, defaults to nil Extra entities the trace ignores; any other non-nil value ignores them all

Returns

  • Boolean true when visible, nil otherwise

See also

cw.entity:CanSeeNPC(entity, target, iAllowance, tIgnoreEnts)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:213

Returns whether an NPC's shoot position is visible from the centre of an entity.

Parameters

  • entity Entity The entity looking
  • target NPC The NPC to look at
  • iAllowance Number optional, defaults to 0.75 Fraction of the trace that must be clear, from 0 to 1
  • tIgnoreEnts List<Entity> optional, defaults to nil Extra entities the trace ignores; any other non-nil value ignores them all

Returns

  • Boolean true when visible, nil otherwise

See also

cw.entity:CanSeePlayer(entity, target, iAllowance, tIgnoreEnts)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:227

Returns whether a player and an entity can see each other.

Visible when the player is looking straight at the entity, or when the player's shoot position is visible from the centre of the entity.

Parameters

  • entity Entity The entity looking
  • target Player The player to look at
  • iAllowance Number optional, defaults to 0.75 Fraction of the trace that must be clear, from 0 to 1
  • tIgnoreEnts List<Entity> optional, defaults to nil Extra entities the trace ignores; any other non-nil value ignores them all

Returns

  • Boolean true when visible, nil otherwise

See also

cw.entity:CanSeePosition(entity, position, iAllowance, tIgnoreEnts)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:202

Returns whether a position is visible from the centre of an entity.

Traces against solid, opaque and moveable contents, hitboxes and monsters, and counts the position as visible when the trace gets far enough.

Parameters

  • entity Entity The entity looking
  • position Vector The position to look at
  • iAllowance Number optional, defaults to 0.75 Fraction of the trace that must be clear, from 0 to 1
  • tIgnoreEnts List<Entity> optional, defaults to nil Extra entities the trace ignores; any other non-nil value ignores them all

Returns

  • Boolean true when visible, nil otherwise

cw.entity:ClearProperty(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1507

Takes an entity away from its owner, whether the owner is online or not.

Parameters

  • entity Entity The entity

cw.entity:CopyOwner(entity, target)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1452

Gives an entity the same owner as another entity.

Parameters

  • entity Entity The entity to copy the owner from
  • target Entity The entity to give the owner to

cw.entity:CreateCash(ownerObj, cash, position, angles)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1326

Spawns a cw_cash entity.

Does nothing when cash is disabled in the config, or when the amount is not a finite number that rounds to at least one.

The owner is either a player or, for offline owners, a table with a character key and the player's uniqueID.

Parameters

  • ownerObj Player The owner, or a Map with key and uniqueID; no owner when nil
  • cash Number Amount of cash, rounded
  • position Vector Where to spawn it
  • angles Angle optional, defaults to nil Angles of the entity

Returns

  • Entity The cash entity, or nil when cash is disabled, the amount is invalid or it failed to spawn

cw.entity:CreateItem(ownerObj, itemTable, position, angles)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1404

Spawns an item as a cw_item entity.

Item definitions and unique IDs get a new instance. Calls the item's OnEntitySpawned and enables its bodyGroup on the entity.

cw.entity:CreateItem(player, 'ration', player:GetEyeTraceNoCursor().HitPos)

Parameters

  • ownerObj Player The owner, or a Map with key and uniqueID; no owner when nil
  • itemTable Item The item instance or definition, or a unique ID string
  • position Vector Where to spawn it
  • angles Angle optional, defaults to nil Angles of the entity

Returns

  • Entity The item entity, or nil when itemTable is nil or not an existing item

cw.entity:CreateShipment(ownerObj, uniqueID, batch, position, angles)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1367

Spawns a cw_shipment entity holding a batch of items.

Parameters

  • ownerObj Player The owner, or a Map with key and uniqueID; no owner when nil
  • uniqueID String Unique ID of the item
  • batch Number How many items the shipment holds
  • position Vector Where to spawn it
  • angles Angle optional, defaults to nil Angles of the entity

Returns

  • Entity The shipment entity

cw.entity:Decay(entity, seconds, Callback)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1308

On the server

Fades an entity out over time and removes it.

The entity is also detached from its player. Calling it again on a decaying entity restarts the fade from the current alpha.

cw.entity:Decay(ragdoll, 300, function()
  print('The ragdoll has decayed.')
end)

Parameters

  • entity Entity The entity
  • seconds Number Roughly how many seconds the fade takes
  • Callback Function optional, defaults to nil Called just before the entity is removed

On the client

Fades a clientside entity out over time and removes it.

Calling it again on a decaying entity restarts the fade from the current alpha.

Parameters

  • entity Entity The entity
  • seconds Number Roughly how many seconds the fade takes
  • Callback Function optional, defaults to nil Called just before the entity is removed

Defined in

cw.entity:Disintegrate(entity, delay, velocity, Callback)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1230

Disintegrates an entity: makes it non-solid, freezes it, plays a removal effect and decays it.

When a velocity is given, the entity is pushed first and frozen up to a second later.

Parameters

  • entity Entity The entity
  • delay Number Seconds the decay takes
  • velocity Vector optional, defaults to nil Velocity added to the entity or each ragdoll bone
  • Callback Function optional, defaults to nil Called just before the entity is removed

See also

cw.entity:Dissolve(entity, dissolveType, iRemoveDelay, attacker)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:476

Dissolves an entity with an env_entity_dissolver.

Parameters

  • entity Entity The entity to dissolve
  • dissolveType Number Dissolve effect, the dissolver's dissolvetype key value
  • iRemoveDelay Number optional, defaults to nil Seconds after which the entity is removed; it is not removed when nil
  • attacker Entity optional, defaults to nil Entity set as the dissolver's physics attacker

Returns

  • Entity The dissolver, already removed

cw.entity:DoorHasSharedAccess(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1041

Returns whether a parent door shares its access with its children.

Parameters

  • entity Entity The door

Returns

  • Boolean Whether access is shared

cw.entity:DoorHasSharedText(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1048

Returns whether a parent door shares its text with its children.

Parameters

  • entity Entity The door

Returns

  • Boolean Whether text is shared

cw.entity:DropItemsAndCash(inventory, cash, position, entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:801

Spawns every item of an inventory and an amount of cash at a position.

The items are removed from the inventory table as they are dropped.

Parameters

  • inventory Inventory The items to drop
  • cash Number Amount of cash to drop; none when nil or not positive
  • position Vector Where to drop them
  • entity Entity optional, defaults to nil Entity whose ownership the item entities get, copied with cw.entity:CopyOwner

cw.entity:FetchItemData(entity)

client gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:401

Requests the item instance of an entity from the server over the FetchItemData Cable message.

Requests are sent at most every four seconds per entity. The reply creates the instance, after which cw.entity:HasFetchedItemData returns true and cw.entity:FetchItemTable returns it.

Parameters

  • entity Entity The item entity or vehicle

cw.entity:FetchItemTable(entity)

client gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:392

Returns the item instance received for an entity with cw.entity:FetchItemData.

Parameters

  • entity Entity The item entity

Returns

  • Item The item instance, or nil when not fetched yet

cw.entity:ForceMenuOption(entity, option, arguments)

client gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1646

Runs an entity menu option on the server over the EntityMenuOption Cable message.

Parameters

  • entity Entity The entity
  • option String Name of the option
  • arguments Any Arguments of the option, such as the action to run

cw.entity:GetDoorChildren(door)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:953

Returns the child doors of a door.

Parameters

  • door Entity The door

Returns

  • Map<Entity> The children, indexed by themselves

Returns the doors that existed on the map when the server started.

Returns

  • Map<Entity> The doors indexed by entity index

Returns a door's name.

Parameters

  • entity Entity The door

Returns

  • String The name, or '' when not set

Returns the parent of a door.

Parameters

  • door Entity The door

Returns

  • Entity The parent door, or nil when it has none

cw.entity:GetDoorPartners(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:95

Returns a door and the doors next to it that form a double door.

Partners have the same class, model and skin, sit 90 to 100 units away at the same height and face another direction.

Parameters

  • entity Entity The door

Returns

  • List<Entity> The door followed by its partners

cw.entity:GetDoorState(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:599

Returns a door's state from its save table.

Parameters

  • entity Entity The door

Returns

  • Number A DOOR_STATE_* enum, DOOR_STATE_CLOSED when unknown

Returns the text displayed on a door.

Parameters

  • entity Entity The door

Returns

  • String The text, or '' when not set

cw.entity:GetMuzzlePos(weapon, attachment)

client gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:20

Returns the position and angles of a weapon's muzzle attachment.

When the weapon is carried by the local player and seen in first person, the attachment is read from the viewmodel instead of the world model.

Parameters

  • weapon Weapon The weapon
  • attachment Number optional, defaults to 1 Index of the attachment

Returns

  • Vector The muzzle position
  • Angle The muzzle angles; the weapon's own position and angles when it has no such attachment, the world origin when the weapon is invalid

cw.entity:GetOwner(entity, bAnyCharacter)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1531

On the server

Returns the player that owns an entity.

Parameters

  • entity Entity The entity
  • bAnyCharacter Boolean optional, defaults to nil Return the owner even when the entity belongs to another of their characters

Returns

  • Player The owner, or nil when it is not online or on the owning character

On the client

Returns the player that owns an entity, if its ownership is networked.

Parameters

  • entity Entity The entity
  • bAnyCharacter Boolean optional, defaults to nil Return the owner even when the entity belongs to another of their characters

Returns

  • Player The owner, or nil when unknown or not on the owning character

Defined in

cw.entity:GetPelvisPosition(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:147

Returns the position of an entity's pelvis bone, such as a ragdoll's.

Parameters

  • entity Entity The entity

Returns

  • Vector The pelvis position, or the entity's position when it has no pelvis bone

Returns the player an entity belongs to, such as a player's ragdoll.

Parameters

  • entity Entity The entity

Returns

cw.entity:GetStartAngles(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1154

Returns the angles stored with cw.entity:SetStartAngles.

Parameters

  • entity Entity The entity

Returns

  • Angle The start angles, or nil

cw.entity:GetStartPosition(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1168

Returns the position stored with cw.entity:SetStartPosition.

Parameters

  • entity Entity The entity

Returns

  • Vector The start position, or nil

cw.entity:HasFetchedItemData(entity)

client gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:385

Returns whether the item data of an item entity has been received from the server.

Parameters

  • entity Entity The item entity

Returns

  • Boolean Whether the item data has been fetched

See also

On the server

Returns whether an entity is owned by a character.

Parameters

  • entity Entity The entity

Returns

  • Boolean Whether the entity has an owner

On the client

Returns whether an entity is owned by a character, through its Owned networked boolean.

Parameters

  • entity Entity The entity

Returns

  • Boolean Whether the entity has an owner

Defined in

cw.entity:IsChairEntity(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:370

Returns whether an entity's model path contains chair or seat.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean true when it is a chair, nil otherwise

Returns whether an entity is fading out to be removed by cw.entity:Decay.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean Whether the entity is decaying; the decay timer's ID string when it is, nil otherwise

Returns whether an entity is a door.

Doors are func_door, func_door_rotating, prop_door_rotating and func_movelinear entities, and prop_dynamic entities whose model path contains door.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean true when the entity is a door, nil otherwise

Returns whether a door is a false door: unownable, named false and shown with no text.

Parameters

  • entity Entity The door

Returns

  • Boolean Whether the door is false

See also

cw.entity:IsDoorHidden(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:267

Returns whether a door is hidden: unownable and named hidden.

Parameters

  • entity Entity The door

Returns

  • Boolean Whether the door is hidden

See also

cw.entity:IsDoorLocked(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:606

Returns whether a door is locked.

Parameters

  • entity Entity The door

Returns

  • Boolean Whether the door's save table says it is locked

Returns whether a door has child doors.

Parameters

  • door Entity The door

Returns

  • Boolean Whether the door is a parent

cw.entity:IsDoorUnownable(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:251

Returns whether a door cannot be bought.

Parameters

  • entity Entity The door

Returns

  • Boolean The door's Unownable networked boolean

cw.entity:IsDoorUnsellable(door)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:892

Returns whether a door cannot be sold by its owner.

Parameters

  • door Entity The door

Returns

  • Boolean The door's unsellable field

cw.entity:IsInBox(entity, minimum, maximum)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:128

Returns whether an entity is inside an axis-aligned box.

The shoot position is used for players and NPCs, the entity position for anything else.

Parameters

  • entity Entity The entity to check
  • minimum Vector One corner of the box
  • maximum Vector The opposite corner of the box

Returns

  • Boolean Whether the entity is inside the box

cw.entity:IsInteractable(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:317

Returns whether players can pick up and interact with an entity.

Frozen or pickup-protected props, NPCs, players, dynamic props, frozen physboxes, other func_ brush entities and doors are not interactable.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean Whether the entity is interactable

Returns whether an entity was created by the map.

Parameters

  • entity Entity The entity

Returns

  • Boolean Whether it is a map entity

cw.entity:IsPhysicsEntity(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:348

Returns whether an entity is a prop_physics or prop_physics_multiplayer.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean true when it is a physics prop, nil otherwise

cw.entity:IsPlayerRagdoll(entity)

shared gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:288

Returns whether an entity is the ragdoll of a ragdolled player.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean true when the entity is its player's current ragdoll, nil otherwise

Returns whether an entity's model path contains prisoner, as prisoner pod vehicles do.

Parameters

  • entity Entity The entity to check

Returns

  • Boolean true when it is a pod, nil otherwise

cw.entity:MakeFlushToGround(entity, position, normal)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1218

Moves an entity so its nearest point rests on a surface.

Parameters

  • entity Entity The entity
  • position Vector Point on the surface
  • normal Vector Normal of the surface

cw.entity:MakeIntoRagdoll(entity, force, overrideVelocity, overrideAngles)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:831

Creates a ragdoll copying an entity's model, appearance, pose and velocity.

The ragdoll's angles are always set from the entity's angles, so overrideAngles has no effect. The head gets twice the velocity and force. Burning entities give a burning ragdoll.

Parameters

  • entity Entity The entity to copy
  • force Vector optional, defaults to nil Force applied to each bone
  • overrideVelocity Vector optional, defaults to nil Velocity given to the bones instead of 1.5 times the entity's
  • overrideAngles Angle optional, defaults to nil Angles to give the ragdoll

Returns

  • Entity The ragdoll

cw.entity:MakeSafe(entity, bPhysgunProtect, tToolProtect, bFreezeEntity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:728

Protects an entity from the physics gun and tools and optionally freezes it.

cw.entity:MakeSafe(entity, true, { 'remover', 'weld' }, true)

Parameters

  • entity Entity The entity
  • bPhysgunProtect Boolean optional, defaults to nil Prevent the physics gun from picking it up
  • tToolProtect List<String> optional, defaults to nil Tool modes that cannot be used on it; any other non-nil value blocks every tool
  • bFreezeEntity Boolean optional, defaults to nil Disable the entity's motion

cw.entity:OpenDoor(entity, delay, bUnlock, bSound, origin, fSpeed)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:657

Opens a door after a delay.

Dynamic prop doors play their open animation and close again after five seconds. Rotating prop doors open away from origin when it is given.

Parameters

  • entity Entity The door
  • delay Number Seconds before the door opens
  • bUnlock Boolean optional, defaults to nil Unlock the door first
  • bSound Boolean optional, defaults to nil Play an impact sound when unlocking
  • origin Vector optional, defaults to nil Position the door opens away from
  • fSpeed Number optional, defaults to nil Unused

cw.entity:QueryProperty(entity, key, default)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1497

Returns a field of an entity's property table.

The table is set by cw.player:GiveProperty and holds key, owner, owned, uniqueID, networked and removeDelay.

Parameters

  • entity Entity The entity
  • key String Name of the field
  • default Any optional, defaults to nil Value returned when the field or the table is not set

Returns

  • Any The field's value, or default

cw.entity:ReturnCollisionGroup(entity, collisionGroup)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1183

Restores an entity's collision group once it no longer overlaps anything.

Retries every second while the entity's physics object is penetrating something.

Parameters

  • entity Entity The entity
  • collisionGroup Number A COLLISION_GROUP_* enum

cw.entity:SetChairAnimations(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1095

Gives a chair vehicle the key values and members of its vehicle list entry, so players sit in it correctly.

Only acts on prop_vehicle_prisoner_pod entities without a vehicle table. Some stock chair models are first replaced by their models/nova equivalents.

Parameters

  • entity Entity The chair vehicle

Returns

  • Boolean true when a vehicle entry was applied, nil otherwise

cw.entity:SetDoorFalse(entity, isFalse)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:981

Sets whether a door is a false door, an unownable door named false.

Parameters

  • entity Entity The door
  • isFalse Boolean Whether the door should be false; false makes it ownable and clears its name

cw.entity:SetDoorHidden(entity, hidden)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:996

Sets whether a door is hidden, an unownable door named hidden.

Parameters

  • entity Entity The door
  • hidden Boolean Whether the door should be hidden; false makes it ownable and clears its name

cw.entity:SetDoorName(entity, name)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1082

Sets a door's name.

Parameters

  • entity Entity The door
  • name String The name; nil clears it

cw.entity:SetDoorParent(door, parent)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:903

Sets the parent of a door, or removes it.

Children of the door are unparented first, and the door's shared access and text are reset. Parents can share their access and text with their children.

Parameters

  • door Entity The door
  • parent Entity The parent door; anything that is not a valid door removes the parent

See also

cw.entity:SetDoorSharedAccess(entity, sharedAccess)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1013

Sets whether a parent door shares its access with its child doors.

Does nothing for doors without children.

Parameters

  • entity Entity The parent door
  • sharedAccess Boolean Whether access is shared

cw.entity:SetDoorSharedText(entity, sharedText)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1024

Sets whether a parent door shares its text with its child doors.

Enabling it copies the parent's text to every child. Does nothing for doors without children.

Parameters

  • entity Entity The parent door
  • sharedText Boolean Whether text is shared

cw.entity:SetDoorSpeedFast(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:518

Makes a door move three times faster for one second.

Does nothing for entities that are not doors or have no speed, or when used on the same door within two seconds.

Parameters

  • entity Entity The door

cw.entity:SetDoorText(entity, text)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1057

Sets the text displayed on a door, and on its children when it shares its text.

Text containing "this door can be purchased" (ignoring case and spaces) is rejected.

Parameters

  • entity Entity The door
  • text String The text; nil clears it

cw.entity:SetDoorUnownable(entity, unownable)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:962

Sets whether a door can be bought.

Making a door unownable takes it from its owner.

Parameters

  • entity Entity The door
  • unownable Boolean Whether the door should be unownable

cw.entity:SetMapEntity(entity, isMapEntity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1203

Sets whether an entity was created by the map.

Parameters

  • entity Entity The entity
  • isMapEntity Boolean Whether it is a map entity

cw.entity:SetPlayer(entity, player)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1290

Sets the player an entity belongs to, through its Player networked entity.

Parameters

  • entity Entity The entity
  • player Player The player, or NULL to clear it

See also

cw.entity:SetPropertyVar(entity, key, value)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1485

Sets a field of an owned entity's property table.

Does nothing for entities without an owner.

Parameters

  • entity Entity The entity
  • key String Name of the field
  • value Any The new value

cw.entity:SetStartAngles(entity, angles)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1147

Stores the angles an entity started with.

Parameters

  • entity Entity The entity
  • angles Angle The start angles

cw.entity:SetStartPosition(entity, position)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1161

Stores the position an entity started at.

Parameters

  • entity Entity The entity
  • position Vector The start position

cw.entity:StatueRagdoll(entity, forceLimit)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:755

Welds every bone of a ragdoll together so it holds its pose like a statue.

The welds are stored in entity.cwStatueInfo.Welds and a glass effect plays on each bone.

Parameters

  • entity Entity The ragdoll
  • forceLimit Number optional, defaults to 0 Force a weld takes before breaking; 0 never breaks

cw.entity:StopCollisionGroupRestore(entity)

server gamemodes/catwork/gamemode/core/libraries/sh_entity.lua:1174

Cancels a pending collision group restore started by cw.entity:ReturnCollisionGroup.

Parameters

  • entity Entity The entity

Defined in