2012-04-01 11:37:41 +02:00
|
|
|
-- Minetest: builtin/misc_register.lua
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Make raw registration functions inaccessible to anyone except this file
|
|
|
|
--
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
local register_item_raw = core.register_item_raw
|
|
|
|
core.register_item_raw = nil
|
2012-04-01 11:37:41 +02:00
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
local register_alias_raw = core.register_alias_raw
|
2014-05-20 16:21:09 +02:00
|
|
|
core.register_alias_raw = nil
|
2012-04-01 11:37:41 +02:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Item / entity / ABM registration functions
|
|
|
|
--
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.registered_abms = {}
|
|
|
|
core.registered_entities = {}
|
|
|
|
core.registered_items = {}
|
|
|
|
core.registered_nodes = {}
|
|
|
|
core.registered_craftitems = {}
|
|
|
|
core.registered_tools = {}
|
|
|
|
core.registered_aliases = {}
|
2012-04-01 11:37:41 +02:00
|
|
|
|
|
|
|
-- For tables that are indexed by item name:
|
2014-04-28 03:02:48 +02:00
|
|
|
-- If table[X] does not exist, default to table[core.registered_aliases[X]]
|
2013-12-04 19:39:57 +01:00
|
|
|
local alias_metatable = {
|
|
|
|
__index = function(t, name)
|
2014-04-28 03:02:48 +02:00
|
|
|
return rawget(t, core.registered_aliases[name])
|
2013-12-04 19:39:57 +01:00
|
|
|
end
|
|
|
|
}
|
2014-04-28 03:02:48 +02:00
|
|
|
setmetatable(core.registered_items, alias_metatable)
|
|
|
|
setmetatable(core.registered_nodes, alias_metatable)
|
|
|
|
setmetatable(core.registered_craftitems, alias_metatable)
|
|
|
|
setmetatable(core.registered_tools, alias_metatable)
|
2012-04-01 11:37:41 +02:00
|
|
|
|
|
|
|
-- These item names may not be used because they would interfere
|
|
|
|
-- with legacy itemstrings
|
|
|
|
local forbidden_item_names = {
|
|
|
|
MaterialItem = true,
|
|
|
|
MaterialItem2 = true,
|
|
|
|
MaterialItem3 = true,
|
|
|
|
NodeItem = true,
|
|
|
|
node = true,
|
|
|
|
CraftItem = true,
|
|
|
|
craft = true,
|
|
|
|
MBOItem = true,
|
|
|
|
ToolItem = true,
|
|
|
|
tool = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
local function check_modname_prefix(name)
|
|
|
|
if name:sub(1,1) == ":" then
|
|
|
|
-- Escape the modname prefix enforcement mechanism
|
|
|
|
return name:sub(2)
|
|
|
|
else
|
|
|
|
-- Modname prefix enforcement
|
2014-04-28 03:02:48 +02:00
|
|
|
local expected_prefix = core.get_current_modname() .. ":"
|
2012-04-01 11:37:41 +02:00
|
|
|
if name:sub(1, #expected_prefix) ~= expected_prefix then
|
|
|
|
error("Name " .. name .. " does not follow naming conventions: " ..
|
|
|
|
"\"modname:\" or \":\" prefix required")
|
|
|
|
end
|
|
|
|
local subname = name:sub(#expected_prefix+1)
|
|
|
|
if subname:find("[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]") then
|
|
|
|
error("Name " .. name .. " does not follow naming conventions: " ..
|
|
|
|
"contains unallowed characters")
|
|
|
|
end
|
|
|
|
return name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_abm(spec)
|
|
|
|
-- Add to core.registered_abms
|
|
|
|
core.registered_abms[#core.registered_abms+1] = spec
|
2012-04-01 11:37:41 +02:00
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_entity(name, prototype)
|
2012-04-01 11:37:41 +02:00
|
|
|
-- Check name
|
|
|
|
if name == nil then
|
|
|
|
error("Unable to register entity: Name is nil")
|
|
|
|
end
|
|
|
|
name = check_modname_prefix(tostring(name))
|
|
|
|
|
|
|
|
prototype.name = name
|
|
|
|
prototype.__index = prototype -- so that it can be used as a metatable
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
-- Add to core.registered_entities
|
|
|
|
core.registered_entities[name] = prototype
|
2012-04-01 11:37:41 +02:00
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_item(name, itemdef)
|
2012-04-01 11:37:41 +02:00
|
|
|
-- Check name
|
|
|
|
if name == nil then
|
|
|
|
error("Unable to register item: Name is nil")
|
|
|
|
end
|
|
|
|
name = check_modname_prefix(tostring(name))
|
|
|
|
if forbidden_item_names[name] then
|
|
|
|
error("Unable to register item: Name is forbidden: " .. name)
|
|
|
|
end
|
|
|
|
itemdef.name = name
|
|
|
|
|
|
|
|
-- Apply defaults and add to registered_* table
|
|
|
|
if itemdef.type == "node" then
|
2013-04-05 07:51:31 +02:00
|
|
|
-- Use the nodebox as selection box if it's not set manually
|
|
|
|
if itemdef.drawtype == "nodebox" and not itemdef.selection_box then
|
|
|
|
itemdef.selection_box = itemdef.node_box
|
2013-10-16 07:17:06 +02:00
|
|
|
elseif itemdef.drawtype == "fencelike" and not itemdef.selection_box then
|
|
|
|
itemdef.selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
|
|
|
|
}
|
2013-04-05 07:51:31 +02:00
|
|
|
end
|
2014-04-28 03:02:48 +02:00
|
|
|
setmetatable(itemdef, {__index = core.nodedef_default})
|
|
|
|
core.registered_nodes[itemdef.name] = itemdef
|
2012-04-01 11:37:41 +02:00
|
|
|
elseif itemdef.type == "craft" then
|
2014-04-28 03:02:48 +02:00
|
|
|
setmetatable(itemdef, {__index = core.craftitemdef_default})
|
|
|
|
core.registered_craftitems[itemdef.name] = itemdef
|
2012-04-01 11:37:41 +02:00
|
|
|
elseif itemdef.type == "tool" then
|
2014-04-28 03:02:48 +02:00
|
|
|
setmetatable(itemdef, {__index = core.tooldef_default})
|
|
|
|
core.registered_tools[itemdef.name] = itemdef
|
2012-04-01 11:37:41 +02:00
|
|
|
elseif itemdef.type == "none" then
|
2014-04-28 03:02:48 +02:00
|
|
|
setmetatable(itemdef, {__index = core.noneitemdef_default})
|
2012-04-01 11:37:41 +02:00
|
|
|
else
|
|
|
|
error("Unable to register item: Type is invalid: " .. dump(itemdef))
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Flowing liquid uses param2
|
|
|
|
if itemdef.type == "node" and itemdef.liquidtype == "flowing" then
|
|
|
|
itemdef.paramtype2 = "flowingliquid"
|
|
|
|
end
|
|
|
|
|
|
|
|
-- BEGIN Legacy stuff
|
|
|
|
if itemdef.cookresult_itemstring ~= nil and itemdef.cookresult_itemstring ~= "" then
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_craft({
|
2012-04-01 11:37:41 +02:00
|
|
|
type="cooking",
|
|
|
|
output=itemdef.cookresult_itemstring,
|
|
|
|
recipe=itemdef.name,
|
|
|
|
cooktime=itemdef.furnace_cooktime
|
|
|
|
})
|
|
|
|
end
|
|
|
|
if itemdef.furnace_burntime ~= nil and itemdef.furnace_burntime >= 0 then
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_craft({
|
2012-04-01 11:37:41 +02:00
|
|
|
type="fuel",
|
|
|
|
recipe=itemdef.name,
|
|
|
|
burntime=itemdef.furnace_burntime
|
|
|
|
})
|
|
|
|
end
|
|
|
|
-- END Legacy stuff
|
|
|
|
|
|
|
|
-- Disable all further modifications
|
|
|
|
getmetatable(itemdef).__newindex = {}
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
--core.log("Registering item: " .. itemdef.name)
|
|
|
|
core.registered_items[itemdef.name] = itemdef
|
|
|
|
core.registered_aliases[itemdef.name] = nil
|
2012-04-01 11:37:41 +02:00
|
|
|
register_item_raw(itemdef)
|
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_node(name, nodedef)
|
2012-04-01 11:37:41 +02:00
|
|
|
nodedef.type = "node"
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_item(name, nodedef)
|
2012-04-01 11:37:41 +02:00
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_craftitem(name, craftitemdef)
|
2012-04-01 11:37:41 +02:00
|
|
|
craftitemdef.type = "craft"
|
|
|
|
|
|
|
|
-- BEGIN Legacy stuff
|
|
|
|
if craftitemdef.inventory_image == nil and craftitemdef.image ~= nil then
|
|
|
|
craftitemdef.inventory_image = craftitemdef.image
|
|
|
|
end
|
|
|
|
-- END Legacy stuff
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_item(name, craftitemdef)
|
2012-04-01 11:37:41 +02:00
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_tool(name, tooldef)
|
2012-04-01 11:37:41 +02:00
|
|
|
tooldef.type = "tool"
|
|
|
|
tooldef.stack_max = 1
|
|
|
|
|
|
|
|
-- BEGIN Legacy stuff
|
|
|
|
if tooldef.inventory_image == nil and tooldef.image ~= nil then
|
|
|
|
tooldef.inventory_image = tooldef.image
|
|
|
|
end
|
|
|
|
if tooldef.tool_capabilities == nil and
|
|
|
|
(tooldef.full_punch_interval ~= nil or
|
|
|
|
tooldef.basetime ~= nil or
|
|
|
|
tooldef.dt_weight ~= nil or
|
|
|
|
tooldef.dt_crackiness ~= nil or
|
|
|
|
tooldef.dt_crumbliness ~= nil or
|
|
|
|
tooldef.dt_cuttability ~= nil or
|
|
|
|
tooldef.basedurability ~= nil or
|
|
|
|
tooldef.dd_weight ~= nil or
|
|
|
|
tooldef.dd_crackiness ~= nil or
|
|
|
|
tooldef.dd_crumbliness ~= nil or
|
|
|
|
tooldef.dd_cuttability ~= nil) then
|
|
|
|
tooldef.tool_capabilities = {
|
|
|
|
full_punch_interval = tooldef.full_punch_interval,
|
|
|
|
basetime = tooldef.basetime,
|
|
|
|
dt_weight = tooldef.dt_weight,
|
|
|
|
dt_crackiness = tooldef.dt_crackiness,
|
|
|
|
dt_crumbliness = tooldef.dt_crumbliness,
|
|
|
|
dt_cuttability = tooldef.dt_cuttability,
|
|
|
|
basedurability = tooldef.basedurability,
|
|
|
|
dd_weight = tooldef.dd_weight,
|
|
|
|
dd_crackiness = tooldef.dd_crackiness,
|
|
|
|
dd_crumbliness = tooldef.dd_crumbliness,
|
|
|
|
dd_cuttability = tooldef.dd_cuttability,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
-- END Legacy stuff
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_item(name, tooldef)
|
2012-04-01 11:37:41 +02:00
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.register_alias(name, convert_to)
|
2012-04-01 11:37:41 +02:00
|
|
|
if forbidden_item_names[name] then
|
|
|
|
error("Unable to register alias: Name is forbidden: " .. name)
|
|
|
|
end
|
2014-04-28 03:02:48 +02:00
|
|
|
if core.registered_items[name] ~= nil then
|
|
|
|
core.log("WARNING: Not registering alias, item with same name" ..
|
2012-04-01 11:37:41 +02:00
|
|
|
" is already defined: " .. name .. " -> " .. convert_to)
|
|
|
|
else
|
2014-04-28 03:02:48 +02:00
|
|
|
--core.log("Registering alias: " .. name .. " -> " .. convert_to)
|
|
|
|
core.registered_aliases[name] = convert_to
|
2012-04-01 11:37:41 +02:00
|
|
|
register_alias_raw(name, convert_to)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.on_craft(itemstack, player, old_craft_list, craft_inv)
|
|
|
|
for _, func in ipairs(core.registered_on_crafts) do
|
2013-10-26 11:25:28 +02:00
|
|
|
itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.craft_predict(itemstack, player, old_craft_list, craft_inv)
|
|
|
|
for _, func in ipairs(core.registered_craft_predicts) do
|
2013-10-26 11:25:28 +02:00
|
|
|
itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
2012-04-01 11:37:41 +02:00
|
|
|
-- Alias the forbidden item names to "" so they can't be
|
|
|
|
-- created via itemstrings (e.g. /give)
|
|
|
|
local name
|
|
|
|
for name in pairs(forbidden_item_names) do
|
2014-04-28 03:02:48 +02:00
|
|
|
core.registered_aliases[name] = ""
|
2012-04-01 11:37:41 +02:00
|
|
|
register_alias_raw(name, "")
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Deprecated:
|
2014-04-28 03:02:48 +02:00
|
|
|
-- Aliases for core.register_alias (how ironic...)
|
|
|
|
--core.alias_node = core.register_alias
|
|
|
|
--core.alias_tool = core.register_alias
|
|
|
|
--core.alias_craftitem = core.register_alias
|
2012-04-01 11:37:41 +02:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Built-in node definitions. Also defined in C.
|
|
|
|
--
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_item(":unknown", {
|
2012-04-01 11:37:41 +02:00
|
|
|
type = "none",
|
|
|
|
description = "Unknown Item",
|
|
|
|
inventory_image = "unknown_item.png",
|
2014-04-28 03:02:48 +02:00
|
|
|
on_place = core.item_place,
|
|
|
|
on_drop = core.item_drop,
|
2012-07-25 16:59:37 +02:00
|
|
|
groups = {not_in_creative_inventory=1},
|
2013-10-29 01:25:10 +01:00
|
|
|
diggable = true,
|
2012-04-01 11:37:41 +02:00
|
|
|
})
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_node(":air", {
|
2012-04-01 11:37:41 +02:00
|
|
|
description = "Air (you hacker you!)",
|
2013-03-19 19:05:32 +01:00
|
|
|
inventory_image = "unknown_node.png",
|
|
|
|
wield_image = "unknown_node.png",
|
2012-04-01 11:37:41 +02:00
|
|
|
drawtype = "airlike",
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
pointable = false,
|
|
|
|
diggable = false,
|
|
|
|
buildable_to = true,
|
|
|
|
air_equivalent = true,
|
2012-11-03 18:29:01 +01:00
|
|
|
drop = "",
|
2012-07-25 16:59:37 +02:00
|
|
|
groups = {not_in_creative_inventory=1},
|
2012-04-01 11:37:41 +02:00
|
|
|
})
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_node(":ignore", {
|
2012-04-01 11:37:41 +02:00
|
|
|
description = "Ignore (you hacker you!)",
|
2013-03-19 19:05:32 +01:00
|
|
|
inventory_image = "unknown_node.png",
|
|
|
|
wield_image = "unknown_node.png",
|
2012-04-01 11:37:41 +02:00
|
|
|
drawtype = "airlike",
|
|
|
|
paramtype = "none",
|
|
|
|
sunlight_propagates = false,
|
|
|
|
walkable = false,
|
|
|
|
pointable = false,
|
|
|
|
diggable = false,
|
|
|
|
buildable_to = true, -- A way to remove accidentally placed ignores
|
|
|
|
air_equivalent = true,
|
2012-11-03 18:29:01 +01:00
|
|
|
drop = "",
|
2012-07-25 16:59:37 +02:00
|
|
|
groups = {not_in_creative_inventory=1},
|
2012-04-01 11:37:41 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- The hand (bare definition)
|
2014-04-28 03:02:48 +02:00
|
|
|
core.register_item(":", {
|
2012-04-01 11:37:41 +02:00
|
|
|
type = "none",
|
2012-07-25 16:59:37 +02:00
|
|
|
groups = {not_in_creative_inventory=1},
|
2012-04-01 11:37:41 +02:00
|
|
|
})
|
|
|
|
|
2013-12-08 04:03:07 +01:00
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.override_item(name, redefinition)
|
2014-01-14 01:28:55 +01:00
|
|
|
if redefinition.name ~= nil then
|
2014-01-14 04:11:31 +01:00
|
|
|
error("Attempt to redefine name of "..name.." to "..dump(redefinition.name), 2)
|
2014-01-14 01:28:55 +01:00
|
|
|
end
|
|
|
|
if redefinition.type ~= nil then
|
2014-01-14 04:11:31 +01:00
|
|
|
error("Attempt to redefine type of "..name.." to "..dump(redefinition.type), 2)
|
2014-01-14 01:28:55 +01:00
|
|
|
end
|
2014-04-28 03:02:48 +02:00
|
|
|
local item = core.registered_items[name]
|
2014-01-14 01:28:55 +01:00
|
|
|
if not item then
|
2014-01-14 04:11:31 +01:00
|
|
|
error("Attempt to override non-existent item "..name, 2)
|
2014-01-14 01:28:55 +01:00
|
|
|
end
|
|
|
|
for k, v in pairs(redefinition) do
|
|
|
|
rawset(item, k, v)
|
|
|
|
end
|
|
|
|
register_item_raw(item)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
function core.run_callbacks(callbacks, mode, ...)
|
2013-12-08 04:03:07 +01:00
|
|
|
assert(type(callbacks) == "table")
|
|
|
|
local cb_len = #callbacks
|
|
|
|
if cb_len == 0 then
|
|
|
|
if mode == 2 or mode == 3 then
|
|
|
|
return true
|
|
|
|
elseif mode == 4 or mode == 5 then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local ret = nil
|
|
|
|
for i = 1, cb_len do
|
|
|
|
local cb_ret = callbacks[i](...)
|
|
|
|
|
|
|
|
if mode == 0 and i == 1 then
|
|
|
|
ret = cb_ret
|
|
|
|
elseif mode == 1 and i == cb_len then
|
|
|
|
ret = cb_ret
|
|
|
|
elseif mode == 2 then
|
|
|
|
if not cb_ret or i == 1 then
|
|
|
|
ret = cb_ret
|
|
|
|
end
|
|
|
|
elseif mode == 3 then
|
|
|
|
if cb_ret then
|
|
|
|
return cb_ret
|
|
|
|
end
|
|
|
|
ret = cb_ret
|
|
|
|
elseif mode == 4 then
|
|
|
|
if (cb_ret and not ret) or i == 1 then
|
|
|
|
ret = cb_ret
|
|
|
|
end
|
|
|
|
elseif mode == 5 and cb_ret then
|
|
|
|
return cb_ret
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return ret
|
|
|
|
end
|
|
|
|
|
2012-04-01 11:37:41 +02:00
|
|
|
--
|
|
|
|
-- Callback registration
|
|
|
|
--
|
|
|
|
|
2015-01-05 03:30:55 +01:00
|
|
|
local register_biome_raw = core.register_biome
|
|
|
|
core.registered_biomes = {}
|
|
|
|
function core.register_biome(biome)
|
|
|
|
core.registered_biomes[biome.name] = biome
|
|
|
|
register_biome_raw(biome)
|
|
|
|
end
|
|
|
|
|
2012-04-01 11:37:41 +02:00
|
|
|
local function make_registration()
|
|
|
|
local t = {}
|
|
|
|
local registerfunc = function(func) table.insert(t, func) end
|
|
|
|
return t, registerfunc
|
|
|
|
end
|
|
|
|
|
2012-07-22 16:10:58 +02:00
|
|
|
local function make_registration_reverse()
|
|
|
|
local t = {}
|
|
|
|
local registerfunc = function(func) table.insert(t, 1, func) end
|
|
|
|
return t, registerfunc
|
|
|
|
end
|
|
|
|
|
2015-01-05 03:30:55 +01:00
|
|
|
local function make_registration_wrap(name)
|
|
|
|
local list = {}
|
|
|
|
local full_name = "register_"..name
|
|
|
|
local orig_func = core[full_name]
|
|
|
|
core[full_name] = function(def)
|
|
|
|
table.insert(list, def)
|
|
|
|
orig_func(def)
|
|
|
|
end
|
|
|
|
return list
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
core.registered_ores = make_registration_wrap("ore")
|
|
|
|
core.registered_decorations = make_registration_wrap("decoration")
|
|
|
|
|
2014-04-28 03:02:48 +02:00
|
|
|
core.registered_on_chat_messages, core.register_on_chat_message = make_registration()
|
|
|
|
core.registered_globalsteps, core.register_globalstep = make_registration()
|
|
|
|
core.registered_playerevents, core.register_playerevent = make_registration()
|
|
|
|
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
|
|
|
core.registered_on_punchnodes, core.register_on_punchnode = make_registration()
|
|
|
|
core.registered_on_placenodes, core.register_on_placenode = make_registration()
|
|
|
|
core.registered_on_dignodes, core.register_on_dignode = make_registration()
|
|
|
|
core.registered_on_generateds, core.register_on_generated = make_registration()
|
|
|
|
core.registered_on_newplayers, core.register_on_newplayer = make_registration()
|
|
|
|
core.registered_on_dieplayers, core.register_on_dieplayer = make_registration()
|
|
|
|
core.registered_on_respawnplayers, core.register_on_respawnplayer = make_registration()
|
|
|
|
core.registered_on_prejoinplayers, core.register_on_prejoinplayer = make_registration()
|
|
|
|
core.registered_on_joinplayers, core.register_on_joinplayer = make_registration()
|
|
|
|
core.registered_on_leaveplayers, core.register_on_leaveplayer = make_registration()
|
|
|
|
core.registered_on_player_receive_fields, core.register_on_player_receive_fields = make_registration_reverse()
|
|
|
|
core.registered_on_cheats, core.register_on_cheat = make_registration()
|
|
|
|
core.registered_on_crafts, core.register_on_craft = make_registration()
|
|
|
|
core.registered_craft_predicts, core.register_craft_predict = make_registration()
|
|
|
|
core.registered_on_protection_violation, core.register_on_protection_violation = make_registration()
|
2014-05-20 16:21:09 +02:00
|
|
|
core.registered_on_item_eats, core.register_on_item_eat = make_registration()
|
2012-04-01 11:37:41 +02:00
|
|
|
|
2014-12-29 18:58:55 +01:00
|
|
|
--
|
|
|
|
-- Compatibility for on_mapgen_init()
|
|
|
|
--
|
|
|
|
|
|
|
|
core.register_on_mapgen_init = function(func) func(core.get_mapgen_params()) end
|
|
|
|
|