mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Reuse changable logic from #14258.
This commit is contained in:
parent
aba2b6638e
commit
22fc23fc51
15 changed files with 319 additions and 111 deletions
|
@ -47,6 +47,7 @@ core.features = {
|
|||
particle_blend_clip = true,
|
||||
remove_item_match_meta = true,
|
||||
httpfetch_additional_methods = true,
|
||||
abm_changeable = true,
|
||||
}
|
||||
|
||||
function core.has_feature(arg)
|
||||
|
|
|
@ -14,6 +14,8 @@ core.unregister_item_raw = nil
|
|||
local register_alias_raw = core.register_alias_raw
|
||||
core.register_alias_raw = nil
|
||||
|
||||
local override_abm_raw = core.override_abm
|
||||
|
||||
--
|
||||
-- Item / entity / ABM / LBM registration functions
|
||||
--
|
||||
|
@ -100,6 +102,19 @@ function core.register_abm(spec)
|
|||
spec.mod_origin = core.get_current_modname() or "??"
|
||||
end
|
||||
|
||||
function core.override_abm(name, redef)
|
||||
for id, abm in pairs(core.registered_abms) do
|
||||
if abm.name == name then
|
||||
for key, value in pairs(redef) do
|
||||
abm[key] = redef[key]
|
||||
end
|
||||
override_abm_raw(id, abm)
|
||||
return
|
||||
end
|
||||
end
|
||||
core.log("error", "ABM '"..name.."' not found.")
|
||||
end
|
||||
|
||||
function core.register_lbm(spec)
|
||||
-- Add to core.registered_lbms
|
||||
check_modname_prefix(spec.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue