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

Blocks every toolgun action on the dispenser.
Returns how many of the containers the dispenser made still exist, forgetting the ones that are gone.
Draw()client
Draws the dispenser's model.
Plays one of the dispenser's machine sounds at random.
Returns what the dispenser spawns.
Sets up the button model, attaches two pipes and defaults to producing supply crates.
Keeps the dispenser still unless a player holds it or it is constrained.
Sets what the dispenser produces; other values are ignored.
Sets up the dispenser's networked index and spawn type.
Spawns a cw_emptyration (8 second cooldown) or a cw_emptycrate (60 seconds) at the pipe.
Think()client
Does nothing on the client.
Makes the dispenser always transmit to clients.
Produces an item when a player presses the button, then waits out the item's cooldown.

Methods

Blocks every toolgun action on the dispenser.

Parameters

  • player
  • trace
  • tool

Returns how many of the containers the dispenser made still exist, forgetting the ones that are gone.

Returns

  • Number The container count

Draws the dispenser's model.

Plays one of the dispenser's machine sounds at random.

Returns what the dispenser spawns.

Returns

  • Number TYPE_WATERCAN (0) or TYPE_SUPPLIES (1)

On 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

Keeps the dispenser still unless a player holds it or it is constrained.

Parameters

  • physicsObject

Sets what the dispenser produces; other values are ignored.

Parameters

  • entType Number TYPE_WATERCAN (0) for empty ration packets, TYPE_SUPPLIES (1) for empty crates

Sets up the dispenser's networked index and spawn type.

Spawns 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

Does nothing on the client.

Makes the dispenser always transmit to clients.

Produces 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

Defined in