Exports & Events
Server events for shredder integrations.
General Information
Machine arguments are the
idof a configured machine, or of a compact prop a player set up. Item names are inventory item names.identifieris the character identifier fromzyke_lib, andcoordsis a plain{x, y, z}table.Compact props have a
kind:compactfor the shredder,generator, orbox. Events for loading, shredding, jamming, collecting, and refueling fire for both the scrapyard shredder and the compact set.
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 or dropped into a compact shredder's hopper. Its outputs are rolled at this point and land in the bin or catch crate 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 or a catch crate.
fromlists whose pieces were taken; other characters' pieces appear only when the bin or crate is shared.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, including a portable generator.
kindislinefor a scrapyard shredder, or the compact prop's kind.sourceis absent when the machine started or stopped by itself;reasonis thenidle,fuel,overheat,restart,admin,power, orfumes.Example:
lua---@param data ShredderToggledData AddEventHandler("zyke_shredder:OnShredderToggled", function(data) print(data.machine, data.kind, data.running, data.reason) end)
#On Shredder Adjusted
Fires when an admin sets a machine's diesel or heat from the admin panel.
settingisfuelorheat. For a compact shredder,fuelsets the tank of the generator plugged into it.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 Compact Placed
Fires when a prop of the compact set is set up, from its item or by an admin.
bucketis the routing bucket key it stands in.dockedis the shredder a crate docked to as it was set up, andfuelis the diesel a generator's item carried.Example:
lua---@param data ShredderCompactData AddEventHandler("zyke_shredder:OnCompactPlaced", function(data) print(data.identifier, data.kind, data.machine, data.bucket, data.indoors) end)
#On Compact Picked Up
Fires when a prop is packed back into its item, or taken away with the admin command.
administruefor the latter.fuelis the diesel a generator's item kept.Example:
lua---@param data ShredderCompactData AddEventHandler("zyke_shredder:OnCompactPickedUp", function(data) print(data.identifier, data.kind, data.machine, data.admin) end)
#On Compact Linked
Fires when a generator's cable is plugged into a compact shredder, or a crate docks to one.
linkiscableorbox.itemis the cable item that plugging it in took.Example:
lua---@param data ShredderCompactLinkData AddEventHandler("zyke_shredder:OnCompactLinked", function(data) print(data.link, data.shredder, data.generator, data.item) end)
#On Compact Unlinked
Fires when a cable is pulled out or a docked crate is taken away.
itemis the cable item handed back.Example:
lua---@param data ShredderCompactLinkData AddEventHandler("zyke_shredder:OnCompactUnlinked", function(data) print(data.link, data.shredder, data.generator, data.item) end)
#On Generator Fumes Stalled
Fires when a portable generator running indoors chokes on its fumes and stalls.
machineis the generator, andshredderis the shredder it was powering.Example:
lua---@param data ShredderFumesStalledData AddEventHandler("zyke_shredder:OnGeneratorFumesStalled", function(data) print(data.machine, data.owner, data.bucket, data.level) end)
#On Action Refused
Fires when the server turns down a player action.
attemptisload,unload,start,stop,collect,refuel,sell,place,pickup,link, orunlink.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,admin,placed,packed,linked,unlinked, orfumes.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.