Add chests, doors, and levers, and improve progressive interaction.

This commit is contained in:
Signal 2025-11-11 01:29:41 -05:00
parent 6439f11c2f
commit 8f98a7fa2d
18 changed files with 692 additions and 107 deletions

View file

@ -11,6 +11,15 @@ function artifact.register_node(name, def)
if not def.groups then def.groups = {} end
def.groups.dig_immediate = 3
end
if def._variants then
for _, x in ipairs(def._variants) do
if x == "slab" then
artifact.register_slab(def)
elseif x == "stair" then
artifact.register_stair(def)
end
end
end
minetest.register_node(":"..name, def)
if name ~= def._name then
minetest.register_alias(def._name, name)
@ -28,6 +37,58 @@ function artifact.register_craftitem(name, def)
end
end
function artifact.register_slab(def)
def = table.copy(def)
def._variants = nil
artifact.register_node(def._name.."_slab", extend(def, {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}
},
paramtype = "light",
paramtype2 = "facedir"
}))
end
function artifact.register_stair(def)
def = table.copy(def)
def._variants = nil
def.groups[def._name.."_stair"] = 1
artifact.register_node(def._name.."_stair", extend(table.copy(def), {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, -0.5, 0, 0.5, 0.5, 0.5}}
},
paramtype = "light",
paramtype2 = "facedir"
}))
artifact.register_node(def._name.."_stair_inner", extend(table.copy(def), {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0, 0.5, 0.5}}
},
paramtype = "light",
paramtype2 = "facedir"
}))
artifact.register_node(def._name.."_stair_outer", extend(def, {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0.5, 0, 0.5, 0}}
},
paramtype = "light",
paramtype2 = "facedir"
}))
end
local function rep(tx, size)
local out = "[combine:"..(size *16).."x"..(size *16)
for x = 0, size -1 do
@ -39,29 +100,36 @@ local function rep(tx, size)
end
artifact.register_node("stone", {
tiles = {"artifact_stone.png"}
tiles = {{name = "artifact_stone.png", align_style = "world"}},
_variants = {"stair", "slab"}
})
artifact.register_node("stone_mossy", {
tiles = {{name = rep("artifact_stone.png", 4).."^artifact_moss.png", align_style = "world", scale = 4}}
tiles = {{name = rep("artifact_stone.png", 4).."^artifact_moss.png", align_style = "world", scale = 4}},
_variants = {"stair", "slab"},
})
artifact.register_node("stone_bricks", {
tiles = {"artifact_stone_bricks.png"}
tiles = {{name = "artifact_stone_bricks.png", align_style = "world"}},
_variants = {"stair", "slab"},
})
artifact.register_node("stone_bricks_mossy", {
tiles = {{name = rep("artifact_stone_bricks.png", 4).."^artifact_moss_bricks.png", align_style = "world", scale = 4}}
tiles = {{name = rep("artifact_stone_bricks.png", 4).."^artifact_moss_bricks.png", align_style = "world", scale = 4}},
_variants = {"stair", "slab"},
})
artifact.register_node("stone_bricks_small", {
tiles = {"artifact_stone_bricks_small.png"}
tiles = {{name = "artifact_stone_bricks_small.png", align_style = "world"}},
_variants = {"stair", "slab"},
})
artifact.register_node("stone_tile", {
tiles = {"artifact_stone_tile.png"}
tiles = {{name = "artifact_stone_tile.png", align_style = "world"}},
_variants = {"stair", "slab"},
})
artifact.register_node("stone_tile_small", {
tiles = {"artifact_stone_tile_small.png"}
tiles = {{name = "artifact_stone_tile_small.png", align_style = "world"}},
_variants = {"stair", "slab"},
})
@ -85,7 +153,7 @@ artifact.register_node("vines", {
paramtype = "light",
paramtype2 = "facedir",
tiles = {"artifact_vines.png"},
use_texture_alpha = true
use_texture_alpha = "clip"
})
artifact.register_node("vines_dry", {
drawtype = "nodebox",
@ -107,25 +175,26 @@ artifact.register_node("vines_dry", {
paramtype = "light",
paramtype2 = "facedir",
tiles = {"artifact_vines_dry.png"},
use_texture_alpha = true
use_texture_alpha = "clip"
})
artifact.register_node("leaves", {
drawtype = "allfaces",
-- paramtype = "light",
tiles = {"artifact_leaves.png"},
use_texture_alpha = true
use_texture_alpha = "clip"
})
artifact.register_node("leaves_dry", {
drawtype = "allfaces",
-- paramtype = "light",
tiles = {"artifact_leaves_dry.png"},
use_texture_alpha = true
use_texture_alpha = "clip"
})
artifact.register_node("wood_planks", {
tiles = {"artifact_wood_planks.png"}
tiles = {{name = "artifact_wood_planks.png", align_style = "world"}},
_variants = {"stair", "slab"},
})
artifact.register_node("ladder_wood", {
@ -139,6 +208,13 @@ artifact.register_node("ladder_wood", {
})
artifact.register_node("glass", {
drawtype = "glasslike",
use_texture_alpha = "clip",
tiles = {"artifact_glass.png"},
_variants = {"stair", "slab"},
})
local function register_lamp(color, brightness)
artifact.register_node("lamp_"..color, {
@ -176,11 +252,15 @@ minetest.override_item("air", {
light_source = 2
})
minetest.register_mapgen_script(minetest.get_modpath(minetest.get_current_modname()).."/mapgen.lua")
if artifact.debug then
minetest.register_decoration {
deco_type = "simple",
decoration = "lamp_gold",
place_on = "stone",
fill_ratio = 0.02,
}
minetest.register_mapgen_script(minetest.get_modpath(minetest.get_current_modname()).."/mapgen.lua")
minetest.register_decoration {
deco_type = "simple",
decoration = "lamp_blue",
place_on = "stone",
fill_ratio = 0.02,
}
end