Factory Dispenser entity
Entity defined in plugin/entities/entities/cw_bigfactorydispenser
Part of Ration Factory
Shared definition of the cw_bigfactorydispenser entity of the Ration Factory plugin, with the networked spawn type
and GetSpawnType.
Also sets the global TYPE_WATERCAN (0) and TYPE_SUPPLIES (1) constants, which for this entity stand for empty
ration packets and empty crates.
Originally written for the Iron Wall community.
Summary
Methods
cw_emptyration (8 second cooldown) or a cw_emptycrate (60 seconds) at the pipe.Methods
ENT:CanTool(player, trace, tool)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:150Blocks every toolgun action on the dispenser.
Parameters
- player
- trace
- tool
ENT:CountProducts()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:63Returns how many of the containers the dispenser made still exist, forgetting the ones that are gone.
Returns
- Number The container count
ENT:Draw()
client gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/cl_init.lua:8Draws the dispenser's model.
ENT:EmitRandomSound()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:91Plays one of the dispenser's machine sounds at random.
ENT:GetSpawnType()
shared gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/shared.lua:29Returns what the dispenser spawns.
Returns
- Number
TYPE_WATERCAN(0) orTYPE_SUPPLIES(1)
ENT:Initialize()
shared gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:19On the server
Sets up the button model, attaches two pipes and defaults to producing supply crates.
On the client
Does nothing on the client.
Defined in
ENT:PhysicsUpdate(physicsObject)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:101Keeps the dispenser still unless a player holds it or it is constrained.
Parameters
- physicsObject
ENT:SetSpawnType(entType)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:79Sets what the dispenser produces; other values are ignored.
Parameters
- entType Number
TYPE_WATERCAN(0) for empty ration packets,TYPE_SUPPLIES(1) for empty crates
ENT:SetupDataTables()
shared gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/shared.lua:22Sets up the dispenser's networked index and spawn type.
ENT:SpawnItem(activator)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:129Spawns a cw_emptyration (8 second cooldown) or a cw_emptycrate (60 seconds) at the pipe.
Parameters
- activator Player The player who pressed the button; unused
ENT:Think()
client gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/cl_init.lua:17Does nothing on the client.
ENT:UpdateTransmitState()
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:86Makes the dispenser always transmit to clients.
ENT:Use(activator, caller)
server gamemodes/cwhl2rp/plugins/rationfactory/plugin/entities/entities/cw_bigfactorydispenser/init.lua:111Produces an item when a player presses the button, then waits out the item's cooldown.
Pressing it during the cooldown, or while 20 of its containers still exist, plays a denial sound.
Parameters
- activator
- caller