Main file of the Factories plugin, which adds start, stop and eject options to the entity menu of factory entities
and saves the garbage recyclers with the map; exposes the plugin as cwFactories.
On the server, cwFactories:SaveFactories and cwFactories:LoadFactories keep the cw_factory_garbage_metal,
cw_factory_garbage_plastic and cw_factory_garbage_paper entities and their contents in the schema data under
plugins/factories/, and EntityHandleMenuOption runs the chosen option on any entity with IsFactory set. On the
client, GetEntityMenuOptions adds the options.
Summary
Hooks
Hooks
cwFactories:ClockworkInitPostEntity()
server gamemodes/cwhl2rp/plugins/factories/plugin/sh_plugin.lua:103Implements hook ClockworkInitPostEntity
Called after Catwork has loaded all map entities; spawns the saved factories.
cwFactories:EntityHandleMenuOption(player, entity, option, arguments)
server gamemodes/cwhl2rp/plugins/factories/plugin/sh_plugin.lua:20Implements hook EntityHandleMenuOption
Called when a player picks an entity menu option; starts, stops or ejects a factory.
Only acts on entities with IsFactory set. Starting is ignored while the factory works and
stopping while it is idle.
Parameters
- player Player The player who picked the option
- entity Entity The entity the menu was opened on
- option String The option's display name
- arguments String
cwFactoriesStart,cwFactoriesStoporcwFactoriesEject
cwFactories:GetEntityMenuOptions(entity, options)
client gamemodes/cwhl2rp/plugins/factories/plugin/sh_plugin.lua:115Implements hook GetEntityMenuOptions
Called when the client builds an entity's menu; adds start, stop and eject options to factories.
Parameters
- entity Entity The entity the menu is for
- options Map Menu options, mapping display names to the arguments sent to the server
Spawns the garbage recyclers saved for the current map, frozen in place, and restores their contents.
See also
Implements hook PostSaveData
Called after data has been saved; saves the factories.
Saves every metal, plastic and paper garbage recycler on the map to the schema data.
Each factory's angles, position, product position, garbage count, eject storage and stored
garbage are written to plugins/factories/<type>/<map>.