Shared definition of the cw_emptycrate entity of the Ration Factory plugin, with the networked ration count and
full flag and IsFull.
Originally written for the Iron Wall community.
Summary
Methods
cw_emptyration into the crate, at most one per second.Methods
ENT:CheckFull()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/init.lua:87Flags the crate full once it holds ten rations.
ENT:Draw()
client gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/cl_init.lua:15Draws the crate's model.
ENT:Explode()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/init.lua:39Plays the effect and sound of the crate breaking apart.
ENT:HUDPaintTargetID(x, y, alpha)
client gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/cl_init.lua:9Draws how many of the ten rations the crate holds when the player looks at it.
Parameters
- x
- y
- alpha
ENT:Initialize()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/init.lua:15Sets up the empty crate with 50 health and no rations inside.
ENT:IsFull()
shared gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/shared.lua:24Returns whether the crate has been flagged full.
Returns
- Boolean Whether the crate is full
ENT:OnTakeDamage(damageInfo)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/init.lua:57Takes damage off the crate's health and breaks it when the health runs out.
Parameters
- damageInfo
ENT:SetupDataTables()
shared gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/shared.lua:16Sets up the networked ration count and full flag.
ENT:Touch(ent)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/init.lua:69Packs a touching full cw_emptyration into the crate, at most one per second.
At ten rations the crate turns into a shipment of ten ration_standard items. The packet is flagged as it is
packed: it only disappears at the end of the tick, and a second crate that touches it could count it until then.
Parameters
- ent
ENT:UpdateTransmitState()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_emptycrate/init.lua:52Makes the crate always transmit to clients.