artifact_one/mods/artifact_world/init.lua
2025-11-09 16:29:33 -05:00

156 lines
3.4 KiB
Lua

artifact.registered_nodes = {}
function artifact.register_node(name, def)
artifact.registered_nodes[name] = def
def._name = name
if not name:find ":" then
name = "artifact:"..name
end
if artifact.debug then
if not def.groups then def.groups = {} end
def.groups.dig_immediate = 3
end
minetest.register_node(":"..name, def)
if name ~= def._name then
minetest.register_alias(def._name, name)
end
end
function artifact.register_craftitem(name, def)
def._name = name
if not name:find ":" then
name = "artifact:"..name
end
minetest.register_craftitem(":"..name, def)
if name ~= def._name then
minetest.register_alias(def._name, name)
end
end
local function rep(tx, size)
local out = "[combine:"..(size *16).."x"..(size *16)
for x = 0, size -1 do
for y = 0, size -1 do
out = out..":"..(x *16)..","..(y *16).."="..tx
end
end
return out
end
artifact.register_node("stone", {
tiles = {"artifact_stone.png"}
})
artifact.register_node("stone_bricks", {
tiles = {"artifact_stone_bricks.png"}
})
artifact.register_node("stone_bricks_small", {
tiles = {"artifact_stone_bricks_small.png"}
})
artifact.register_node("stone_tile", {
tiles = {"artifact_stone_tile.png"}
})
artifact.register_node("stone_tile_small", {
tiles = {"artifact_stone_tile_small.png"}
})
artifact.register_node("vines", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-0.5, -0.5, 0.48,
0.5, 0.5, 0.48
}
},
walkable = false,
selection_box = {
type = "fixed",
fixed = {
-0.5, -0.5, 0.5,
0.5, 0.5, 0.45
}
},
paramtype = "light",
paramtype2 = "facedir",
tiles = {"artifact_vines.png"},
use_texture_alpha = true
})
artifact.register_node("leaves", {
drawtype = "allfaces",
-- paramtype = "light",
tiles = {"artifact_leaves.png"},
use_texture_alpha = true
})
artifact.register_node("wood_planks", {
tiles = {"artifact_wood_planks.png"}
})
artifact.register_node("ladder_wood", {
drawtype = "mesh",
mesh = "artifact_ladder.obj",
paramtype = "light",
paramtype2 = "facedir",
tiles = {"artifact_ladder_wood.png"},
walkable = false,
climbable = true
})
artifact.register_node("lamp_gold", {
drawtype = "mesh",
mesh = "artifact_lamp.obj",
tiles = {"artifact_lamp_gold.png"},
light_source = 8,
paramtype = "light",
sunlight_propagates = true
})
artifact.register_node("lamp_red", {
drawtype = "mesh",
mesh = "artifact_lamp.obj",
tiles = {"artifact_lamp_red.png"},
light_source = 6,
paramtype = "light",
sunlight_propagates = true
})
artifact.register_node("lamp_blue", {
drawtype = "mesh",
mesh = "artifact_lamp.obj",
tiles = {"artifact_lamp_blue.png"},
light_source = 10,
paramtype = "light",
sunlight_propagates = true
})
artifact.register_node("light", {
tiles = {"artifact_light.png"},
paramtype = "light",
light_source = 14
})
minetest.override_item("air", {
sunlight_propagates = false,
light_source = 2
})
minetest.register_mapgen_script(minetest.get_modpath(minetest.get_current_modname()).."/mapgen.lua")
minetest.register_decoration {
deco_type = "simple",
decoration = "lamp_gold",
place_on = "stone",
fill_ratio = 0.02,
}