Skip to content

meta/sh_entity

Source: gamemode/framework/meta/sh_entity.lua

Returns true if the entity's model is a chair from the Vehicles list.

Documented functions: 9

Functions


ENTITY:BlastDoor(velocity, lifeTime, bIgnorePartner)

Blasts a door open by creating a physics-enabled dummy and hiding the original.

Creates a prop_physics clone of the door at the same position and angle, inheriting model, color, material, skin, and bodygroups. The original door entity is hidden (SetNoDraw, SetNotSolid) and fired open, while the dummy receives the specified velocity. After lifeTime seconds the dummy fades out (alpha reduced 1 per 0.1s) and is removed, restoring the original door's draw and solid state via a CallOnRemove callback. If the door has a partner (via GetDoorPartner), it is blasted recursively unless bIgnorePartner is true. Returns immediately for non-door entities.

Realm: server

Parameters

Name Type Description
velocity Vector\|nil The initial velocity applied to the dummy prop. Defaults to a random vector scaled by 100.
lifeTime number\|nil Seconds before the dummy fades out and the original door is restored. Defaults to 120.
bIgnorePartner boolean\|nil When true, the partner door is not blasted.

Returns

  • Entity|nil: The created dummy prop entity, or nil on failure.

ENTITY:EmitQueuedSound(soundNames, soundLevel, pitchPercent, volume, channel, soundFlags, dsp, filter)

Emits a sequence of sounds one after another, timed by their durations.

Iterates soundNames and schedules each sound with timer.Simple, accumulating delays based on SoundDuration plus a 100 ms buffer to prevent clipping between back-to-back clips. All sounds share the same level, pitch, volume, channel, flags, DSP, and filter settings. Returns the total playback duration in seconds. The entity is validity-checked inside each timer callback — sounds that fire after the entity has been removed are silently skipped.

Realm: shared

Parameters

Name Type Description
soundNames table An ordered array of sound file paths to play.
soundLevel number\|nil Sound propagation level in dB. Default: 75.
pitchPercent number\|nil Pitch as a percentage. Default: 100.
volume number\|nil Volume scalar (0–1). Default: 1.
channel number\|nil Sound channel constant (CHAN_*). Default: CHAN_AUTO.
soundFlags number\|nil EmitSound flags bitmask. Default: 0.
dsp number\|nil DSP preset index. Default: 0.
filter CRecipientFilter\|nil Optional recipient filter to limit who hears the sounds.

Returns

  • number: The total duration of the queued sound sequence in seconds.

Usage

ent:EmitQueuedSound({ "vo/line1.wav", "vo/line2.wav" }, 75, 100, 1)

ENTITY:GetDoorPartner()

Returns the paired partner door for a rotating door entity.

Only meaningful for prop_door_rotating entities. Caches the result in selfTable.m_hPartner after the first lookup. The search inspects m_hMaster on all doors of the same class to find the one that references this door as its master. Returns NULL when the entity is not a rotating door or no partner is found.

Realm: server

Returns

  • Entity: The partner door entity, or nil if none.

ENTITY:IsChair()

Returns true if the entity's model is a chair from the Vehicles list.

The check is performed against a pre-built lookup table (MODEL_CHAIRS) populated at file load time from list.Get("Vehicles"), filtered to the "Chairs" category. Comparison is case-insensitive.

Realm: shared

Returns

  • boolean: True if the entity's model matches a registered chair model.

ENTITY:IsDoor()

Checks if an entity is a door.

Realm: shared

Returns

  • boolean: True if the entity is a door or it passes the IsEntityDoor hook.

ENTITY:IsFemale()

Returns true if the entity's model class contains the substring "female".

The model class is retrieved via ax.animations:GetModelClass(model). If the model class is not a valid non-empty string, the function returns false. Otherwise, it performs a case-insensitive substring search for "female" within the model class name.

Realm: shared

Returns

  • boolean: True if the model class contains "female", false otherwise.

ENTITY:IsLocked()

Returns whether the entity is in a locked state.

Reads the internal engine variable that tracks lock state: VehicleLocked for vehicle entities, m_bLocked for doors and other lockable props.

Realm: server

Returns

  • boolean: True if the entity is locked.

ENTITY:RateLimit(name, delay)

Enforces a named rate limit on this entity.

Stores timestamps in entity.axRateLimits[name]. On each call:

  • If a limit was previously set and has not yet expired, returns false plus the remaining cooldown time in seconds.
  • Otherwise, records the new expiry time (CurTime() + delay) and returns true.

When delay is 0 or omitted, no timestamp is recorded and the call always returns true (one-shot check with no cooldown).

The rate limit state persists on the entity table across calls.

Prints an error and returns false when name is invalid.

Realm: shared

Parameters

Name Type Description
name string A unique identifier for this rate limit (e.g. "player.interact").
delay number The cooldown duration in seconds. Pass 0 or omit to perform a pass-through check with no cooldown.

Returns

  • boolean: True if the action is allowed, false if rate-limited.
  • number|nil: The remaining cooldown in seconds when rate-limited.

ENTITY:ResetRateLimit(name)

Clears a named rate limit so the next call to RateLimit passes immediately.

Removes the stored expiry timestamp for name from entity.axRateLimits.

Safe to call even if the limit is not set or has already expired. Returns true on success, false on invalid input.

Realm: shared

Parameters

Name Type Description
name string The rate limit identifier to clear (must match the name used when the limit was set via RateLimit).

Returns

  • boolean: True on success, false when name is invalid.