Document DNTs

This commit is contained in:
Aaron Suen 2020-06-28 17:05:53 -04:00
parent ed9002e519
commit 9b5db81149
2 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,7 @@ local math_random
--- itemnames: {"mod:itemname", "group:name"}
--- interval: integer,
--- chance: integer,
--- func: function(stack, data) end
--- action: function(stack, data) end
-- Data:
--- {pos, node}
--- {player, inv, list, slot}

View File

@ -7,6 +7,13 @@ local string_format
-- Active Block Modifiers, meet Delayed Node Triggers.
-- Definition:
--- mname: "modname:technicalname"
--- nodenames: {"mod:itemname", "group:name"}
--- time: float (optional),
--- loop: boolean,
--- action: function(pos, node) end
nodecore.registered_dnts = {}
local grouppref = "group:"
@ -38,7 +45,7 @@ end
function nodecore.register_dnt(def)
if not def.name then return error("dnt name required") end
if not def.name then return error("dnt action required") end
if not def.action then return error("dnt action required") end
if nodecore.registered_dnts[def.name] then
return error(string_format("dnt %q already registered", def.name))
end