Charakterbewegungen hinzugefügt, Deko hinzugefügt, Kochrezepte angepasst
This commit is contained in:
parent
95945c0306
commit
a0c893ca0b
1124 changed files with 64294 additions and 763 deletions
154
mods/xdecor/handlers/animations.lua
Normal file
154
mods/xdecor/handlers/animations.lua
Normal file
|
@ -0,0 +1,154 @@
|
|||
local mod_player_api = minetest.get_modpath("player_api") ~= nil
|
||||
|
||||
local sitting = {}
|
||||
local seats_occupied = {}
|
||||
|
||||
local function bottom_face(pointed_thing)
|
||||
if not pointed_thing then
|
||||
return
|
||||
end
|
||||
return pointed_thing.above.y < pointed_thing.under.y
|
||||
end
|
||||
|
||||
local function stand_up(player_name)
|
||||
if not mod_player_api then
|
||||
return
|
||||
end
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
player_api.player_attached[player_name] = false
|
||||
|
||||
local old_anim = player_api.get_animation(player)
|
||||
if old_anim and old_anim.animation == "sit" then
|
||||
player_api.set_animation(player, "stand")
|
||||
end
|
||||
|
||||
local hash = minetest.hash_node_position(sitting[player_name])
|
||||
seats_occupied[hash] = nil
|
||||
sitting[player_name] = nil
|
||||
|
||||
minetest.log("action", "[xdecor] "..player_name.." stands up at "..minetest.pos_to_string(player:get_pos(), 0))
|
||||
end
|
||||
|
||||
--[[ Used when player interacts with "sittable" node to sit down
|
||||
or stand up when interacting with that node again. Should
|
||||
be used in `on_rightclick` handler
|
||||
* `pos`: Position where to sit down player (MUST only use integers for coordinates!)
|
||||
* `node`: Node table of node to sit on
|
||||
* `clicker`: Player who interacted with node (from `on_rightclick`)
|
||||
* `pointed_thing`: From `on_rightclick` ]]
|
||||
function xdecor.sit(pos, node, clicker, pointed_thing)
|
||||
if not mod_player_api then
|
||||
return
|
||||
end
|
||||
-- Can't sit down if bottom face was pointed at
|
||||
if bottom_face(pointed_thing) then
|
||||
return
|
||||
end
|
||||
local player_name = clicker:get_player_name()
|
||||
local objs = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
local vel = clicker:get_velocity()
|
||||
local ctrl = clicker:get_player_control()
|
||||
|
||||
-- Stand up if sitting
|
||||
if sitting[player_name] then
|
||||
stand_up(player_name)
|
||||
|
||||
-- Sit down if not sitting and not attached
|
||||
elseif not sitting[player_name] and not player_api.player_attached[player_name] and node.param2 <= 3 and
|
||||
not ctrl.sneak and vector.equals(vel, vector.new()) then
|
||||
|
||||
-- Can't sit down on note already occupied by player
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if seats_occupied[hash] then
|
||||
return
|
||||
end
|
||||
|
||||
player_api.player_attached[player_name] = true
|
||||
player_api.set_animation(clicker, "sit")
|
||||
sitting[player_name] = table.copy(pos)
|
||||
seats_occupied[hash] = player_name
|
||||
clicker:set_pos(pos)
|
||||
|
||||
if node.param2 == 0 then
|
||||
clicker:set_look_horizontal(0)
|
||||
elseif node.param2 == 1 then
|
||||
clicker:set_look_horizontal(3*(math.pi/2))
|
||||
elseif node.param2 == 2 then
|
||||
clicker:set_look_horizontal(math.pi)
|
||||
elseif node.param2 == 3 then
|
||||
clicker:set_look_horizontal(math.pi/2)
|
||||
end
|
||||
|
||||
minetest.log("action", "[xdecor] "..player_name.." sits down at "..minetest.pos_to_string(pos, 0))
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when `digger` (a player object) wants to
|
||||
-- dig a node at pos. Returns true if it's allowed,
|
||||
-- false otherwise. This checks if the node at pos
|
||||
-- is an occupied sittable node.
|
||||
-- Can be used for the `can_dig` node function.
|
||||
function xdecor.sit_dig(pos, digger)
|
||||
if not mod_player_api then
|
||||
return true
|
||||
end
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if seats_occupied[hash] then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- To be called when a seat (sittable node) got destroyed
|
||||
-- to clean up state. Precisely, this should be used
|
||||
-- as the `after_destruct` handler.
|
||||
function xdecor.sit_destruct(pos)
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
local occupier = seats_occupied[hash]
|
||||
if occupier then
|
||||
stand_up(occupier)
|
||||
seats_occupied[hash] = nil
|
||||
sitting[occupier] = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Automatically cause players to stand up if they pressed a control
|
||||
-- or moved away from the seat
|
||||
minetest.register_globalstep(function(dtime)
|
||||
local to_stand_up = {}
|
||||
for player_name, sitting_pos in pairs(sitting) do
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if player then
|
||||
local ctrl = player:get_player_control()
|
||||
if ctrl.up or ctrl.down or ctrl.left or ctrl.right or ctrl.sneak or ctrl.jump then
|
||||
table.insert(to_stand_up, player_name)
|
||||
elseif vector.distance(player:get_pos(), sitting_pos) > 0.55 then
|
||||
table.insert(to_stand_up, player_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
for s=1, #to_stand_up do
|
||||
stand_up(to_stand_up[s])
|
||||
end
|
||||
end)
|
||||
|
||||
-- Force player to stand on death (to the seat is released)
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
if sitting[player_name] then
|
||||
stand_up(player_name)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
if sitting[player_name] then
|
||||
local hash = minetest.hash_node_position(sitting[player_name])
|
||||
seats_occupied[hash] = nil
|
||||
sitting[player_name] = nil
|
||||
end
|
||||
end)
|
170
mods/xdecor/handlers/glasscut.lua
Normal file
170
mods/xdecor/handlers/glasscut.lua
Normal file
|
@ -0,0 +1,170 @@
|
|||
-- Tile definitions for cut nodes of glass nodes:
|
||||
-- * Woodframed Glass (this mod)
|
||||
-- * Glass (Minetest Game)
|
||||
-- * Obsidian Glass (Minetest Game)
|
||||
-- This is done so the glass nodes still look nice
|
||||
-- when cut.
|
||||
-- If we would only use the base glass tile, most
|
||||
-- cut nodes look horrible because there are no
|
||||
-- clear contours.
|
||||
|
||||
local template_suffixes_glass = {
|
||||
stair = {
|
||||
"_split.png",
|
||||
".png",
|
||||
"_stairside.png^[transformFX",
|
||||
"_stairside.png",
|
||||
".png",
|
||||
"_split.png",
|
||||
},
|
||||
stair_inner = {
|
||||
"_stairside.png^[transformR270",
|
||||
".png",
|
||||
"_stairside.png^[transformFX",
|
||||
".png",
|
||||
".png",
|
||||
"_stairside.png",
|
||||
},
|
||||
stair_outer = {
|
||||
"_stairside.png^[transformR90",
|
||||
".png",
|
||||
"_outer_stairside.png",
|
||||
"_stairside.png",
|
||||
"_stairside.png^[transformR90",
|
||||
"_outer_stairside.png",
|
||||
},
|
||||
halfstair = {
|
||||
"_cube.png",
|
||||
".png",
|
||||
"_stairside.png^[transformFX",
|
||||
"_stairside.png",
|
||||
"_split.png^[transformR90",
|
||||
"_cube.png",
|
||||
},
|
||||
slab = {
|
||||
".png",
|
||||
".png",
|
||||
"_split.png",
|
||||
},
|
||||
cube = { "_cube.png" },
|
||||
thinstair = { "_split.png" },
|
||||
micropanel = { "_split.png" },
|
||||
panel = {
|
||||
"_split.png",
|
||||
"_split.png",
|
||||
"_cube.png",
|
||||
"_cube.png",
|
||||
"_split.png",
|
||||
},
|
||||
}
|
||||
|
||||
-- Template for "grass-covered" and similar nodes.
|
||||
-- This is defined in a way so that the cut nodes
|
||||
-- still have a natural-looking grass cover.
|
||||
-- !TOP and !BOTTOM are special and will be
|
||||
-- replaced via function argument.
|
||||
|
||||
local template_suffixes_grasscover = {
|
||||
stair = {
|
||||
"!TOP",
|
||||
"!BOTTOM",
|
||||
"_stairside.png^[transformFX",
|
||||
"_stairside.png",
|
||||
".png",
|
||||
"_split.png",
|
||||
},
|
||||
stair_inner = {
|
||||
"!TOP",
|
||||
"!BOTTOM",
|
||||
"_stairside.png^[transformFX",
|
||||
".png",
|
||||
".png",
|
||||
"_stairside.png",
|
||||
},
|
||||
stair_outer = {
|
||||
"!TOP",
|
||||
"!BOTTOM",
|
||||
"_outer_stairside.png",
|
||||
"_stairside.png",
|
||||
"_stairside.png^[transformR90",
|
||||
"_outer_stairside.png",
|
||||
},
|
||||
halfstair = {
|
||||
"!TOP",
|
||||
"!BOTTOM",
|
||||
"_stairside.png^[transformFX",
|
||||
"_stairside.png",
|
||||
".png",
|
||||
"_cube.png",
|
||||
},
|
||||
slab = {
|
||||
"!TOP",
|
||||
"!BOTTOM",
|
||||
"_split.png",
|
||||
},
|
||||
cube = { "!TOP", "!BOTTOM", "_cube.png" },
|
||||
thinstair = { "!TOP", "!BOTTOM", "_cube.png" },
|
||||
micropanel = { "!TOP", "!BOTTOM", "!TOP" },
|
||||
nanoslab = { "!TOP", "!BOTTOM", "!TOP" },
|
||||
microslab = { "!TOP", "!BOTTOM", "!TOP" },
|
||||
panel = {
|
||||
"!TOP",
|
||||
"!BOTTOM",
|
||||
"_cube.png",
|
||||
"_cube.png",
|
||||
"_split.png",
|
||||
},
|
||||
}
|
||||
|
||||
local generate_tilenames_glass = function(prefix, default_texture)
|
||||
if not default_texture then
|
||||
default_texture = prefix
|
||||
end
|
||||
local cuts = {}
|
||||
for t, tiles in pairs(template_suffixes_glass) do
|
||||
cuts[t] = {}
|
||||
for i=1, #tiles do
|
||||
if tiles[i] == ".png" then
|
||||
cuts[t][i] = default_texture .. tiles[i]
|
||||
else
|
||||
cuts[t][i] = prefix .. tiles[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
return cuts
|
||||
end
|
||||
|
||||
local generate_tilenames_grasscover = function(prefix, default_texture, base, top, bottom)
|
||||
if not default_texture then
|
||||
default_texture = prefix
|
||||
end
|
||||
local cuts = {}
|
||||
for t, tiles in pairs(template_suffixes_grasscover) do
|
||||
cuts[t] = {}
|
||||
for i=1, #tiles do
|
||||
if tiles[i] == "!TOP" then
|
||||
cuts[t][i] = {name=top, align_style="world"}
|
||||
elseif tiles[i] == "!BOTTOM" then
|
||||
cuts[t][i] = {name=bottom, align_style="world"}
|
||||
else
|
||||
if tiles[i] == ".png" then
|
||||
cuts[t][i] = default_texture .. tiles[i]
|
||||
else
|
||||
cuts[t][i] = prefix .. tiles[i]
|
||||
end
|
||||
if base then
|
||||
cuts[t][i] = base .. "^" .. cuts[t][i]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return cuts
|
||||
end
|
||||
|
||||
xdecor.glasscuts = {
|
||||
["xdecor:woodframed_glass"] = generate_tilenames_glass("xdecor_woodframed_glass"),
|
||||
["default:glass"] = generate_tilenames_glass("stairs_glass", "default_glass"),
|
||||
["default:obsidian_glass"] = generate_tilenames_glass("stairs_obsidian_glass", "default_obsidian_glass"),
|
||||
["default:permafrost_with_moss"] = generate_tilenames_grasscover("xdecor_permafrost_moss", "default_moss_side", "default_permafrost.png", "default_moss.png", "default_permafrost.png"),
|
||||
["default:permafrost_with_stones"] = generate_tilenames_grasscover("xdecor_permafrost_stones", "default_stones_side", "default_permafrost.png", "default_permafrost.png^default_stones.png", "default_permafrost.png"),
|
||||
}
|
68
mods/xdecor/handlers/helpers.lua
Normal file
68
mods/xdecor/handlers/helpers.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
-- Returns the greatest numeric key in a table.
|
||||
function xdecor.maxn(T)
|
||||
local n = 0
|
||||
for k in pairs(T) do
|
||||
if k > n then
|
||||
n = k
|
||||
end
|
||||
end
|
||||
|
||||
return n
|
||||
end
|
||||
|
||||
-- Returns the length of an hash table.
|
||||
function xdecor.tablelen(T)
|
||||
local n = 0
|
||||
|
||||
for _ in pairs(T) do
|
||||
n = n + 1
|
||||
end
|
||||
|
||||
return n
|
||||
end
|
||||
|
||||
-- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons).
|
||||
function xdecor.tablecopy(T)
|
||||
if type(T) ~= "table" then
|
||||
return T -- No need to copy.
|
||||
end
|
||||
|
||||
local new = {}
|
||||
|
||||
for k, v in pairs(T) do
|
||||
if type(v) == "table" then
|
||||
new[k] = xdecor.tablecopy(v)
|
||||
else
|
||||
new[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
return new
|
||||
end
|
||||
|
||||
function xdecor.stairs_valid_def(def)
|
||||
return (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
|
||||
(def.groups.cracky or def.groups.choppy) and
|
||||
not def.on_construct and
|
||||
not def.after_place_node and
|
||||
not def.on_rightclick and
|
||||
not def.on_blast and
|
||||
not def.allow_metadata_inventory_take and
|
||||
not (def.groups.not_in_creative_inventory == 1) and
|
||||
not (def.groups.not_cuttable == 1) and
|
||||
not def.groups.wool and
|
||||
(def.tiles and type(def.tiles[1]) == "string" and not
|
||||
def.tiles[1]:find("default_mineral")) and
|
||||
not def.mesecons and
|
||||
def.description and
|
||||
def.description ~= "" and
|
||||
def.light_source == 0
|
||||
end
|
||||
|
||||
function xdecor.get_inventory_drops(pos, listnames)
|
||||
local drops = {}
|
||||
for l=1, #listnames do
|
||||
default.get_inventory_drops(pos, listnames[l], drops)
|
||||
end
|
||||
return drops
|
||||
end
|
67
mods/xdecor/handlers/nodeboxes.lua
Normal file
67
mods/xdecor/handlers/nodeboxes.lua
Normal file
|
@ -0,0 +1,67 @@
|
|||
xdecor.box = {
|
||||
slab_y = function(height, shift)
|
||||
return {
|
||||
-0.5,
|
||||
-0.5 + (shift or 0),
|
||||
-0.5,
|
||||
0.5,
|
||||
-0.5 + height + (shift or 0),
|
||||
0.5
|
||||
}
|
||||
end,
|
||||
slab_z = function(depth)
|
||||
return {-0.5, -0.5, -0.5 + depth, 0.5, 0.5, 0.5}
|
||||
end,
|
||||
bar_y = function(radius)
|
||||
return {-radius, -0.5, -radius, radius, 0.5, radius}
|
||||
end,
|
||||
cuboid = function(radius_x, radius_y, radius_z)
|
||||
return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z}
|
||||
end
|
||||
}
|
||||
|
||||
xdecor.nodebox = {
|
||||
regular = {type = "regular"},
|
||||
null = {
|
||||
type = "fixed", fixed = {0,0,0,0,0,0}
|
||||
}
|
||||
}
|
||||
|
||||
xdecor.pixelbox = function(size, boxes)
|
||||
local fixed = {}
|
||||
for _, box in ipairs(boxes) do
|
||||
-- `unpack` has been changed to `table.unpack` in newest Lua versions.
|
||||
local x, y, z, w, h, l = unpack(box)
|
||||
fixed[#fixed + 1] = {
|
||||
(x / size) - 0.5,
|
||||
(y / size) - 0.5,
|
||||
(z / size) - 0.5,
|
||||
((x + w) / size) - 0.5,
|
||||
((y + h) / size) - 0.5,
|
||||
((z + l) / size) - 0.5
|
||||
}
|
||||
end
|
||||
|
||||
return {type = "fixed", fixed = fixed}
|
||||
end
|
||||
|
||||
local mt = {}
|
||||
|
||||
mt.__index = function(table, key)
|
||||
local ref = xdecor.box[key]
|
||||
local ref_type = type(ref)
|
||||
|
||||
if ref_type == "function" then
|
||||
return function(...)
|
||||
return {type = "fixed", fixed = ref(...)}
|
||||
end
|
||||
elseif ref_type == "table" then
|
||||
return {type = "fixed", fixed = ref}
|
||||
elseif ref_type == "nil" then
|
||||
error(key .. "could not be found among nodebox presets and functions")
|
||||
end
|
||||
|
||||
error("unexpected datatype " .. tostring(type(ref)) .. " while looking for " .. key)
|
||||
end
|
||||
|
||||
setmetatable(xdecor.nodebox, mt)
|
183
mods/xdecor/handlers/registration.lua
Normal file
183
mods/xdecor/handlers/registration.lua
Normal file
|
@ -0,0 +1,183 @@
|
|||
local S = minetest.get_translator("xdecor")
|
||||
|
||||
xdecor.xbg = default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
local default_inventory_size = 32
|
||||
|
||||
local default_inventory_formspecs = {
|
||||
["8"] = [[ size[8,6]
|
||||
list[context;main;0,0;8,1;]
|
||||
list[current_player;main;0,2;8,4;]
|
||||
listring[current_player;main]
|
||||
listring[context;main] ]] ..
|
||||
default.get_hotbar_bg(0,2),
|
||||
|
||||
["16"] = [[ size[8,7]
|
||||
list[context;main;0,0;8,2;]
|
||||
list[current_player;main;0,3;8,4;]
|
||||
listring[current_player;main]
|
||||
listring[context;main] ]] ..
|
||||
default.get_hotbar_bg(0,3),
|
||||
|
||||
["24"] = [[ size[8,8]
|
||||
list[context;main;0,0;8,3;]
|
||||
list[current_player;main;0,4;8,4;]
|
||||
listring[current_player;main]
|
||||
listring[context;main]" ]] ..
|
||||
default.get_hotbar_bg(0,4),
|
||||
|
||||
["32"] = [[ size[8,9]
|
||||
list[context;main;0,0.3;8,4;]
|
||||
list[current_player;main;0,4.85;8,1;]
|
||||
list[current_player;main;0,6.08;8,3;8]
|
||||
listring[current_player;main]
|
||||
listring[context;main] ]] ..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
}
|
||||
|
||||
local function get_formspec_by_size(size)
|
||||
local formspec = default_inventory_formspecs[tostring(size)]
|
||||
return formspec or default_inventory_formspecs
|
||||
end
|
||||
|
||||
local default_can_dig = function(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end
|
||||
|
||||
local function xdecor_stairs_alternative(nodename, def)
|
||||
local mod, name = nodename:match("(.*):(.*)")
|
||||
|
||||
for groupname, value in pairs(def.groups) do
|
||||
if groupname ~= "cracky" and groupname ~= "choppy" and
|
||||
groupname ~= "flammable" and groupname ~= "crumbly" and
|
||||
groupname ~= "snappy" then
|
||||
def.groups.groupname = nil
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.get_modpath("moreblocks") then
|
||||
stairsplus:register_all(
|
||||
mod,
|
||||
name,
|
||||
nodename,
|
||||
{
|
||||
description = def.description,
|
||||
tiles = def.tiles,
|
||||
groups = def.groups,
|
||||
sounds = def.sounds,
|
||||
}
|
||||
)
|
||||
elseif minetest.get_modpath("stairs") then
|
||||
local custom_tiles = xdecor.glasscuts[nodename]
|
||||
if custom_tiles and (custom_tiles.slab or custom_tiles.stair) then
|
||||
if custom_tiles.stair then
|
||||
stairs.register_stair(name, nodename,
|
||||
def.groups, custom_tiles.stair, S("@1 Stair", def.description),
|
||||
def.sounds)
|
||||
stairs.register_stair_inner(name, nodename,
|
||||
def.groups, custom_tiles.stair_inner, "", def.sounds, nil, S("Inner @1 Stair", def.description))
|
||||
stairs.register_stair_outer(name, nodename,
|
||||
def.groups, custom_tiles.stair_outer, "", def.sounds, nil, S("Outer @1 Stair", def.description))
|
||||
end
|
||||
if custom_tiles.slab then
|
||||
stairs.register_slab(name, nodename,
|
||||
def.groups, custom_tiles.slab, S("@1 Slab", def.description),
|
||||
def.sounds)
|
||||
end
|
||||
else
|
||||
stairs.register_stair_and_slab(name,nodename,
|
||||
def.groups,
|
||||
def.tiles,
|
||||
S("@1 Stair", def.description),
|
||||
S("@1 Slab", def.description),
|
||||
def.sounds, nil,
|
||||
S("Inner @1 Stair", def.description),
|
||||
S("Outer @1 Stair", def.description)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function xdecor.register(name, def)
|
||||
def.drawtype = def.drawtype or (def.mesh and "mesh") or (def.node_box and "nodebox")
|
||||
def.sounds = def.sounds or default.node_sound_defaults()
|
||||
|
||||
if not (def.drawtype == "normal" or def.drawtype == "signlike" or
|
||||
def.drawtype == "plantlike" or def.drawtype == "glasslike_framed" or
|
||||
def.drawtype == "glasslike_framed_optional") then
|
||||
def.paramtype2 = def.paramtype2 or "facedir"
|
||||
end
|
||||
|
||||
if def.sunlight_propagates ~= false and
|
||||
(def.drawtype == "plantlike" or def.drawtype == "torchlike" or
|
||||
def.drawtype == "signlike" or def.drawtype == "fencelike") then
|
||||
def.sunlight_propagates = true
|
||||
end
|
||||
|
||||
if not def.paramtype and
|
||||
(def.light_source or def.sunlight_propagates or
|
||||
def.drawtype == "nodebox" or def.drawtype == "mesh") then
|
||||
def.paramtype = "light"
|
||||
end
|
||||
|
||||
local infotext = def.infotext
|
||||
local inventory = def.inventory
|
||||
def.inventory = nil
|
||||
|
||||
if inventory then
|
||||
def.on_construct = def.on_construct or function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if infotext then meta:set_string("infotext", infotext) end
|
||||
|
||||
local size = inventory.size or default_inventory_size
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
inv:set_size("main", size)
|
||||
meta:set_string("formspec",
|
||||
(inventory.formspec or get_formspec_by_size(size)) .. xdecor.xbg)
|
||||
end
|
||||
|
||||
def.can_dig = def.can_dig or default_can_dig
|
||||
|
||||
elseif infotext and not def.on_construct then
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", infotext)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("xdecor:" .. name, def)
|
||||
|
||||
local workbench = minetest.settings:get_bool("enable_xdecor_workbench")
|
||||
|
||||
if workbench == false and
|
||||
(minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs")) then
|
||||
if xdecor.stairs_valid_def(def) then
|
||||
xdecor_stairs_alternative("xdecor:"..name, def)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Registers aliases for a node that had a name collision
|
||||
-- with a node from the moreblocks mod
|
||||
function xdecor.register_legacy_aliases(original_basename, new_basename)
|
||||
minetest.register_alias("xdecor:"..original_basename, "xdecor:"..new_basename)
|
||||
minetest.register_alias("xdecor:"..original_basename.."_panel", "xdecor:"..new_basename.."_panel")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_doublepanel", "xdecor:"..new_basename.."_doublepanel")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_micropanel", "xdecor:"..new_basename.."_micropanel")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_halfstair", "xdecor:"..new_basename.."_halfstair")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_thinstair", "xdecor:"..new_basename.."_thinstair")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_cube", "xdecor:"..new_basename.."_cube")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_microslab", "xdecor:"..new_basename.."_microslab")
|
||||
minetest.register_alias("xdecor:"..original_basename.."_nanoslab", "xdecor:"..new_basename.."_nanoslab")
|
||||
if not minetest.get_modpath("moreblocks") then
|
||||
minetest.register_alias("stairs:slab_"..original_basename, "stairs:slab_"..new_basename)
|
||||
minetest.register_alias("stairs:stair_"..original_basename, "stairs:stair_"..new_basename)
|
||||
minetest.register_alias("stairs:stair_outer_"..original_basename, "stairs:stair_outer_"..new_basename)
|
||||
minetest.register_alias("stairs:stair_inner_"..original_basename, "stairs:stair_inner"..new_basename)
|
||||
end
|
||||
if minetest.get_modpath("stairsplus") and minetest.global_exists("stairsplus") and stairsplus.api then
|
||||
stairsplus.api.register_alias_all("xdecor:"..original_basename, "xdecor:"..new_basename)
|
||||
end
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue