2022-06-15 16:18:11 -07:00
|
|
|
-- legacy: export old API for mods which depend on it
|
2022-06-12 21:10:36 -07:00
|
|
|
-- provide a configuration option to *disable* legacy. it must be enabled by default, to prevent breaking
|
|
|
|
-- existing servers
|
2022-06-13 16:11:20 -07:00
|
|
|
local api = stairsplus.api
|
|
|
|
|
2022-06-16 16:32:55 -07:00
|
|
|
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
|
2022-06-14 16:30:41 -07:00
|
|
|
local legacy_mode = stairsplus.settings.legacy_mode
|
|
|
|
|
2022-06-13 16:11:20 -07:00
|
|
|
function stairsplus:register_all(modname, subname, recipeitem, fields)
|
2022-06-16 16:32:55 -07:00
|
|
|
local meta = {}
|
|
|
|
if is_legacy_drawtype(recipeitem) then
|
|
|
|
meta.ignore_drawtype = true
|
|
|
|
end
|
|
|
|
|
2022-06-14 16:30:41 -07:00
|
|
|
if legacy_mode then
|
2022-06-16 16:32:55 -07:00
|
|
|
api.register_group(recipeitem, "legacy", fields, meta)
|
2022-06-14 16:30:41 -07:00
|
|
|
else
|
2022-06-16 16:32:55 -07:00
|
|
|
api.register_group(recipeitem, "common", fields, meta)
|
2022-06-14 16:30:41 -07:00
|
|
|
end
|
2022-06-13 16:11:20 -07:00
|
|
|
|
2022-06-14 11:17:06 -07:00
|
|
|
local old_name = ("%s:%s"):format(modname, subname)
|
2022-06-13 16:11:20 -07:00
|
|
|
if old_name ~= recipeitem then
|
|
|
|
api.register_alias_all(old_name, recipeitem)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
|
|
|
|
api.register_alias_all(
|
|
|
|
("%s:%s"):format(modname_old, subname_old),
|
|
|
|
("%s:%s"):format(modname_new, subname_new)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
|
|
|
|
api.register_alias_force_all(
|
|
|
|
("%s:%s"):format(modname_old, subname_old),
|
|
|
|
("%s:%s"):format(modname_new, subname_new)
|
|
|
|
)
|
|
|
|
end
|