Shared definition of the cw_factorydispenser 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 Breen's Water and citizen supplements.

Originally written for the Iron Wall community.

Summary

Methods

Blocks every toolgun action on the dispenser.
Returns how many of the items 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 the output pipe and defaults to dispensing supplies.
Keeps the dispenser still unless a player holds it or it is constrained.
Sets what the dispenser spawns; other values are ignored.
Sets up the dispenser's networked index and spawn type.
Spawns the dispenser's item: Breen's Water at the pipe, or citizen supplements at the button.
Think()client
Does nothing on the client.
Makes the dispenser always transmit to clients.
Dispenses an item when a player presses the button, with a five second cooldown.

Methods

Blocks every toolgun action on the dispenser.

Parameters

  • player
  • trace
  • tool

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

Returns

  • Number The item 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 the output pipe and defaults to dispensing supplies.

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 spawns; other values are ignored.

Parameters

  • entType Number TYPE_WATERCAN (0) for breens_water, TYPE_SUPPLIES (1) for citizen_supplements

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

Spawns the dispenser's item: Breen's Water at the pipe, or citizen supplements at the button.

Parameters

  • activator Player The player who pressed the button, passed on as the item's creator

Does nothing on the client.

Makes the dispenser always transmit to clients.

Dispenses an item when a player presses the button, with a five second cooldown.

Pressing it during the cooldown, or while 20 of its items still exist, plays a denial sound.

Parameters

  • activator
  • caller

Defined in