mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Bulk LBMs (#14954)
This commit is contained in:
parent
7ae51382c8
commit
811adf5d42
9 changed files with 126 additions and 49 deletions
|
@ -105,7 +105,12 @@ function core.register_lbm(spec)
|
|||
-- Add to core.registered_lbms
|
||||
check_modname_prefix(spec.name)
|
||||
check_node_list(spec.nodenames, "nodenames")
|
||||
assert(type(spec.action) == "function", "Required field 'action' of type function")
|
||||
local have = spec.action ~= nil
|
||||
local have_bulk = spec.bulk_action ~= nil
|
||||
assert(not have or type(spec.action) == "function", "Field 'action' must be a function")
|
||||
assert(not have_bulk or type(spec.bulk_action) == "function", "Field 'bulk_action' must be a function")
|
||||
assert(have ~= have_bulk, "Either 'action' or 'bulk_action' must be present")
|
||||
|
||||
core.registered_lbms[#core.registered_lbms + 1] = spec
|
||||
spec.mod_origin = core.get_current_modname() or "??"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue