ITEM.Spawnable
The spawnable item base. For items which produce an in-world entity.
- SharedITEM:canDestroy(ply, pos) → boolean, stringSource ☍
-
canDestroyhook/override for this item base.Parameters
- plyPlayer
- posunknown) return self:canReduce(ply any
Returns
- 1boolean
- 2string
- SharedITEM:canDrop(ply, pos) → boolean, stringSource ☍
-
canDrophook/override for this item base.Parameters
- plyPlayer
- posunknown) return self:canReduce(ply any
Returns
- 1boolean
- 2string
- SharedITEM:canGive(ply, to, amt) → boolean, stringSource ☍
-
canGivehook/override for this item base.Parameters
Returns
- 1boolean
- 2string
- SharedITEM:canReduce(ply, action, count) → boolean, string?Source ☍
-
Checks if a player can reduce the number of items in their inventory.
Parameters
- plyPlayerPlayer reducing.
- actionstringThe action they're taking (giving, dropping, etc)
- countnumber?The number of items being removed.
Returns
- 1booleanthe reduction was allowed.
- 2string?message if reduction failed.
- SharedITEM:canSpawn(ply) → boolean, string?Source ☍
-
Rank/access/skill eligibility gate for this item, independent of where or how it's being placed.
canUsealways defers to this first, so an override here covers both normal placement and an AdvDupe2 paste (which has no meaningful aim position to distance-check) from one place. Defaults to always allowed.Parameters
- plyPlayer
Returns
- 1boolean
- 2string?
- SharedITEM:canUse(ply) → boolean, string|unknown|nilSource ☍
-
canUsehook/override for this item base.Parameters
- plyPlayer
Returns
- 1boolean
- 2string|unknown|nil
- SharedITEM:getSpawnLimit(ply) → numberSource ☍
-
Resolves the max number of this item a player may have placed at once - reused by AdvDupe2 paste validation so the cap has one source of truth.
Parameters
- plyPlayer
Returns
- number
-1for unlimited.
- SharedITEM:onDestroy()Source ☍
-
onDestroyhook/override for this item base. - SharedITEM:onDrop()Source ☍
-
onDrophook/override for this item base. - SharedITEM:onGive()Source ☍
-
onGivehook/override for this item base. - SharedITEM:onSpawned(ply, ent, meta)Source ☍
-
onSpawnedhook/override for this item base. Runs after the entity has spawned and been assigned its owner/limiter count, before the single-use inventory removal, letting a spawnable item do post-spawn setup (e.g. contraband tracking) without overridingonUseentirely.Parameters
- SharedITEM:onUse(ply, pos, meta) → booleanSource ☍
-
onUsehook/override for this item base.Parameters
Returns
- boolean
- SharedITEM.SetAutoOwnerSource ☍
-
Sets if the spawned entity is automatically owned by the player for prop protection.
- SharedITEM.SetClassSource ☍
-
Sets the SENT ID which this item spawns.
- SharedITEM.SetInvLimitedSource ☍
-
Sets if this item is limited by the number of items currently available in the inventory. See fire alarms for example.
- SharedITEM.SetLimitSource ☍
-
Sets if a limited number of these items can be spawned. See fire alarms for example.
- SharedITEM.SetLimiterSource ☍
-
Sets the Limter class which limits the total count of this item. When set, spawning calls ply:GetCount(data). Could be more aptly defined as SetCounter.
- SharedITEM.SetMaxSpawnDistSource ☍
-
Set the maximum distance away that this item can be spawned.
- SharedITEM.SetSingleUseSource ☍
-
Sets if this item is single use (removed from the inventory after placing)