Charakterbewegungen hinzugefügt, Deko hinzugefügt, Kochrezepte angepasst

This commit is contained in:
N-Nachtigal 2025-05-14 16:36:42 +02:00
parent 95945c0306
commit a0c893ca0b
1124 changed files with 64294 additions and 763 deletions

View file

@ -0,0 +1,43 @@
-- luacheck: globals i3
if not stairsplus.has.i3 then
return
end
-- https://github.com/fluxionary/minetest-moreblocks/issues/13
-- remove i3's assumption that it controls our compression groups
for node in pairs(i3.compress_groups) do
if node:match("^moreblocks:slope_") or node:match("^wool:slope_") then
i3.compress_groups[node] = nil
end
end
local api = stairsplus.api
i3.register_craft_type("stairsplus:circular_saw", {
description = "Stairs+ circular saw",
icon = "stairsplus_saw_button.png",
})
local function on_register_single(node, shaped_name)
i3.register_craft({
type = "stairsplus:circular_saw",
result = shaped_name,
items = { node },
})
local micronode = api.get_micronode(node)
if shaped_name ~= micronode then
local compress_groups = i3.compress_groups[micronode] or {}
table.insert(compress_groups, shaped_name)
i3.compress_groups[micronode] = compress_groups
i3.compressed[shaped_name] = true
end
end
for _, single in ipairs(api.registered_singles) do
local node, shaped_name = unpack(single)
on_register_single(node, shaped_name)
end
api.register_on_register_single(on_register_single)

View file

@ -0,0 +1,19 @@
stairsplus.compat = {
is_legacy_drawtype = function(node)
local def = minetest.registered_nodes[node]
return (def.drawtype == "mesh" or def.drawtype == "plantlike" or def.drawtype == "nodebox")
end,
is_legacy_paramtype2 = function(node)
local def = minetest.registered_nodes[node]
return (
def.paramtype2 == "color"
or def.paramtype2 == "colorwallmounted"
or def.paramtype2 == "glasslikeliquidlevel"
)
end,
}
stairsplus.dofile("compat", "i3")
stairsplus.dofile("compat", "unified_inventory")
stairsplus.dofile("compat", "old_moreblocks")

View file

@ -0,0 +1,251 @@
-- legacy: export old API for mods which depend on it
-- provide a configuration option to *disable* legacy. it must be enabled by default, to prevent breaking
-- existing servers
local api = stairsplus.api
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
local is_legacy_paramtype2 = stairsplus.compat.is_legacy_paramtype2
local legacy_mode = stairsplus.settings.legacy_mode
local function clean_legacy_fields(fields)
fields = table.copy(fields) or {}
fields.drawtype = nil
fields.light_source = nil
fields.inventory_image = nil
fields.inventory_overlay = nil
fields.wield_image = nil
fields.wield_overlay = nil
fields.wield_scale = nil
fields.tool_capabilities = nil
fields.node_placement_prediction = nil
fields.node_dig_prediction = nil
fields.on_place = nil
fields.on_secondary_use = nil
fields.on_drop = nil
fields.on_use = nil
fields.after_use = nil
fields.paramtype2 = nil
fields.node_box = nil
fields.mesh = nil
fields.connects_to = nil
fields.connect_sides = nil
fields.selection_box = nil
fields.collision_box = nil
fields.legacy_facedir_simple = nil
fields.legacy_wallmounted = nil
fields.drop = nil
fields.on_construct = nil
fields.on_destruct = nil
fields.after_destruct = nil
fields.after_place_node = nil
fields.after_dig_node = nil
fields.can_dig = nil
fields.on_punch = nil
fields.on_rightclick = nil
fields.on_dig = nil
fields.on_timer = nil
fields.on_receive_fields = nil
return fields
end
local function handle_legacy_drop(modname, drop)
if not drop then
return
end
if type(drop) == "table" then
return drop
else
return ("%s:%s"):format(modname, drop)
end
end
local function register_group(modname, subname, recipeitem, fields, group)
if not minetest.registered_nodes[recipeitem] then
error(("cannot register stairs for %s before the node is defined"):format(recipeitem))
end
local meta = {}
meta.legacy_drop = handle_legacy_drop(modname, fields.drop)
if is_legacy_drawtype(recipeitem) then
meta.ignore_drawtype = true
end
if is_legacy_paramtype2(recipeitem) then
meta.ignore_paramtype2 = true
end
fields = clean_legacy_fields(fields)
api.register_group(recipeitem, group, fields, meta)
local old_name = ("%s:%s"):format(modname, subname)
if old_name ~= recipeitem then
api.register_alias_group(old_name, recipeitem, group)
end
end
function stairsplus:register_all(modname, subname, recipeitem, fields)
if legacy_mode then
register_group(modname, subname, recipeitem, fields, "legacy")
else
register_group(modname, subname, recipeitem, fields, "common")
end
end
function stairsplus:register_micro(modname, subname, recipeitem, fields)
register_group(modname, subname, recipeitem, fields, "micro")
end
function stairsplus:register_panel(modname, subname, recipeitem, fields)
register_group(modname, subname, recipeitem, fields, "panel")
end
function stairsplus:register_slab(modname, subname, recipeitem, fields)
register_group(modname, subname, recipeitem, fields, "slab")
end
function stairsplus:register_slope(modname, subname, recipeitem, fields)
register_group(modname, subname, recipeitem, fields, "slope")
end
function stairsplus:register_stair(modname, subname, recipeitem, fields)
register_group(modname, subname, recipeitem, fields, "stair")
end
local fix_shape_table = {
micro = "micro_8",
panel = "panel_8",
slab = "slab_8",
slab_quarter = "slab_4",
slab_three_quarter = "slab_12",
stair_alt = "stair_alt_8",
}
local function interpret_subset(subset)
local shapes = {}
for _, v in ipairs(subset) do
local shape = table.concat(v, "")
shape = fix_shape_table[shape] or shape
table.insert(shapes, shape)
end
return shapes
end
function stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)
local shapes = interpret_subset(subset)
fields = clean_legacy_fields(fields)
local meta = {}
if is_legacy_drawtype(recipeitem) then
meta.ignore_drawtype = true
end
api.register_singles(recipeitem, shapes, fields, meta)
local old_name = ("%s:%s"):format(modname, subname)
if old_name ~= recipeitem then
api.register_alias_shapes(old_name, recipeitem, shapes)
end
end
function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
if legacy_mode then
api.register_alias_group(old_node, new_node, "legacy")
else
api.register_alias_group(old_node, new_node, "common")
end
end
function stairsplus:register_alias_micro(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_group(old_node, new_node, "micro")
end
function stairsplus:register_alias_panel(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_group(old_node, new_node, "panel")
end
function stairsplus:register_alias_slab(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_group(old_node, new_node, "slab")
end
function stairsplus:register_alias_slope(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_group(old_node, new_node, "slope")
end
function stairsplus:register_alias_stair(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_group(old_node, new_node, "stair")
end
function stairsplus:register_custom_subset_alias(subset, modname_old, subname_old, modname_new, subname_new)
local shapes = interpret_subset(subset)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_shapes(old_node, new_node, shapes)
end
function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
if legacy_mode then
api.register_alias_force_group(old_node, new_node, "legacy")
else
api.register_alias_force_group(old_node, new_node, "common")
end
end
function stairsplus:register_alias_force_micro(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_force_group(old_node, new_node, "micro")
end
function stairsplus:register_alias_force_panel(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_force_group(old_node, new_node, "panel")
end
function stairsplus:register_alias_force_slab(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_force_group(old_node, new_node, "slab")
end
function stairsplus:register_alias_force_slope(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_force_group(old_node, new_node, "slope")
end
function stairsplus:register_alias_force_stair(modname_old, subname_old, modname_new, subname_new)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_force_group(old_node, new_node, "stair")
end
function stairsplus:register_custom_subset_alias(subset, modname_old, subname_old, modname_new, subname_new)
local shapes = interpret_subset(subset)
local old_node = ("%s:%s"):format(modname_old, subname_old)
local new_node = ("%s:%s"):format(modname_new, subname_new)
api.register_alias_force_shapes(old_node, new_node, shapes)
end

View file

@ -0,0 +1,54 @@
-- luacheck: read globals unified_inventory
if not stairsplus.has.unified_inventory then
return
end
local in_creative_inventory = stairsplus.settings.in_creative_inventory
local api = stairsplus.api
unified_inventory.register_craft_type("stairsplus:circular_saw", {
description = "Stairs+ circular saw",
icon = "stairsplus_saw_button.png",
width = 1,
height = 1,
uses_crafting_grid = false,
})
unified_inventory.register_category("stairsplus:cuttable", {
symbol = "stairsplus:circular_saw",
label = "Cuttable in the circular saw",
index = 0,
items = {},
})
if in_creative_inventory then
unified_inventory.register_category("stairsplus:cut_node", {
symbol = "stairsplus:circular_saw",
label = "Nodes cut in the circular saw",
index = 0,
items = {},
})
end
local function on_register_single(node, shaped_name)
unified_inventory.register_craft({
output = shaped_name,
type = "stairsplus:circular_saw",
items = { node },
width = 1,
})
unified_inventory.add_category_item("stairsplus:cuttable", node)
if in_creative_inventory then
unified_inventory.add_category_item("stairsplus:cut_node", shaped_name)
end
end
for _, single in ipairs(api.registered_singles) do
local node, shaped_name = unpack(single)
on_register_single(node, shaped_name)
end
api.register_on_register_single(on_register_single)