Exports & Events
Server events for shredder integrations.
General Information
Machine arguments are the
idof a configured machine. Item names are inventory item names.identifieris the character identifier fromzyke_lib, andcoordsis a plain{x, y, z}table.
Types / Classes
All types / classes can be found in
types/types.luainsidezyke_shredder.
Shredder currently has no exports. Integrations listen to the server events below.
#Server Local Events
These events are local server integration notifications. They are not network event entry points. Listen with AddEventHandler on the server. Default Discord logging for these events lives in server/unlocked/hooks.lua.
#On Part Loaded
Fires when a part is placed on the belt. Its outputs are rolled at this point and land in the bin once it is shredded.
Example:
lua---@param data ShredderLoadedData AddEventHandler("zyke_shredder:OnPartLoaded", function(data) print(data.identifier, data.machine, data.item, data.loadId) end)
#On Part Unloaded
Fires when a part is taken back off the infeed. Its rolled outputs are removed from the bin.
owneris the character who loaded it; this differs from the player only whenbin.sharedis enabled.Example:
lua---@param data ShredderUnloadedData AddEventHandler("zyke_shredder:OnPartUnloaded", function(data) print(data.identifier, data.owner, data.item) end)
#On Shredder Jammed
Fires when a part jams the cutters and they reverse.
reversalis1the first time the part jams.Example:
lua---@param data ShredderJammedData AddEventHandler("zyke_shredder:OnShredderJammed", function(data) print(data.machine, data.item, data.reversal) end)
#On Item Shredded
Fires when a part has been shredded and its outputs are in the bin.
sourceis the player who loaded it, ornilwhen it was loaded before a restart. The player may have left since.Example:
lua---@param data ShredderShreddedData AddEventHandler("zyke_shredder:OnItemShredded", function(data) for _, output in ipairs(data.outputs) do print(output.item, output.amount) end end)
#On Bin Collected
Fires when a player takes scrap from the bin.
fromlists whose pieces were taken; other characters' pieces appear only whenbin.sharedis enabled.Example:
lua---@param data ShredderCollectedData AddEventHandler("zyke_shredder:OnBinCollected", function(data) print(data.identifier, data.machine, #data.items) end)
#On Shredder Toggled
Fires when a machine starts or stops.
sourceis absent when the machine started or stopped by itself;reasonis thenidle,fuel,overheat,restart, oradmin.Example:
lua---@param data ShredderToggledData AddEventHandler("zyke_shredder:OnShredderToggled", function(data) print(data.machine, data.running, data.reason) end)
#On Shredder Adjusted
Fires when an admin sets a machine's diesel or heat from the admin panel.
settingisfuelorheat.Example:
lua---@param data ShredderAdjustedData AddEventHandler("zyke_shredder:OnShredderAdjusted", function(data) print(data.machine, data.setting, data.previous, data.value) end)
#On Generator Refueled
Fires when a player pours fuel into a generator.
litresis the amount poured;fuelis the tank level afterward.Example:
lua---@param data ShredderRefuelledData AddEventHandler("zyke_shredder:OnGeneratorRefueled", function(data) print(data.machine, data.item, data.litres, data.fuel) end)
#On Recipe Changed
Fires when an admin saves, enables, disables, or deletes a recipe.
actionissave,setEnabled, ordelete.Example:
lua---@param data ShredderRecipeChangedData AddEventHandler("zyke_shredder:OnRecipeChanged", function(data) print(data.action, data.item, data.enabled) end)
#On Scrap Sold
Fires when a player sells scrap to the buyer. Each sale lists the amount, the pieces paid in full toward the order, and the money paid.
orderFilledistruewhen the sale completed every line of the character's order.Example:
lua---@param data ShredderScrapSoldData AddEventHandler("zyke_shredder:OnScrapSold", function(data) print(data.identifier, data.total, data.orderFilled) end)
#On Action Refused
Fires when the server turns down a player action.
attemptisload,unload,start,stop,collect,refuel, orsell.reasonis the locale key sent to the player.Example:
lua---@param data ShredderRefusedData AddEventHandler("zyke_shredder:OnActionRefused", function(data) print(data.attempt, data.reason, data.machine) end)
#On Shredder Activity
Fires for every action recorded in the activity log, whether or not
logs.enabledwrites it to the database.actionisloaded,unloaded,shredded,jammed,collected,refueled,started,stopped,refused,cooled,recipe,sold, oradmin.Example:
lua---@param data ShredderActivityData AddEventHandler("zyke_shredder:OnShredderActivity", function(data) print(data.action, data.machine, data.identifier) end)
For custom permission rules, use Can-Check Hooks.