Place mirrored counterpart door near the identical one (optional)
This commit is contained in:
parent
a3c9a08a90
commit
ea0d8e0f77
@ -9,13 +9,9 @@ function multidecor.banister.check_for_foot_node(pos)
|
||||
return stair == 1, spiral == 1
|
||||
end
|
||||
|
||||
local function ndef(pos)
|
||||
return minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
end
|
||||
|
||||
function multidecor.banister.check_for_free_space(pos, invert_second_cond)
|
||||
local node_def = ndef(pos)
|
||||
local down_node_def = ndef({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
local node_def = hlpfuncs.ndef(pos)
|
||||
local down_node_def = hlpfuncs.ndef({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
local second_cond = down_node_def.drawtype == "airlike" or
|
||||
not down_node_def.walkable
|
||||
@ -26,10 +22,6 @@ function multidecor.banister.check_for_free_space(pos, invert_second_cond)
|
||||
return node_def.drawtype == "airlike" and second_cond
|
||||
end
|
||||
|
||||
local function rotate_vert(dir, sign)
|
||||
return vector.rotate_around_axis(dir, vector.new(0, 1, 0), sign*math.pi/2)
|
||||
end
|
||||
|
||||
function multidecor.banister.place_banister(pos, common_name, itemstack)
|
||||
local is_stair, is_spiral = multidecor.banister.check_for_foot_node(pos)
|
||||
|
||||
@ -61,8 +53,8 @@ function multidecor.banister.place_banister(pos, common_name, itemstack)
|
||||
local res1 = multidecor.banister.check_for_free_space(bpos)
|
||||
|
||||
if res1 then
|
||||
local fwd_dir = rotate_vert(dir_to_pos, -1)
|
||||
local bwd_dir = rotate_vert(dir_to_pos, 1)
|
||||
local fwd_dir = hlpfuncs.rot(dir_to_pos, -math.pi/2)
|
||||
local bwd_dir = hlpfuncs.rot(dir_to_pos, math.pi/2)
|
||||
local res2 = multidecor.banister.check_for_free_space(bpos + fwd_dir, true)
|
||||
local res3 = multidecor.banister.check_for_free_space(bpos + bwd_dir, true)
|
||||
|
||||
@ -70,7 +62,7 @@ function multidecor.banister.place_banister(pos, common_name, itemstack)
|
||||
local cname = name
|
||||
|
||||
if res2 then
|
||||
param2 = minetest.dir_to_facedir(rotate_vert(fwd_dir, 1))
|
||||
param2 = minetest.dir_to_facedir(hlpfuncs.rot(fwd_dir, math.pi/2))
|
||||
cname = cname .. "_corner"
|
||||
elseif res3 then
|
||||
param2 = minetest.dir_to_facedir(fwd_dir)
|
||||
@ -89,11 +81,11 @@ function multidecor.banister.place_banister(pos, common_name, itemstack)
|
||||
check_and_set_banister(pos, {x=0, y=0, z=1}, "forward")
|
||||
check_and_set_banister(pos, {x=0, y=0, z=-1}, "backward")
|
||||
elseif shape == "raised" then
|
||||
local dir = multidecor.helpers.get_dir({x=pos.x, y=pos.y-1, z=pos.z})*-1
|
||||
local dir = hlpfuncs.get_dir({x=pos.x, y=pos.y-1, z=pos.z})*-1
|
||||
local dir_to_param2 = minetest.dir_to_facedir(dir)
|
||||
|
||||
local left_pos = pos + rotate_vert(dir, 1)
|
||||
local right_pos = pos + rotate_vert(dir, -1)
|
||||
local left_pos = pos + hlpfuncs.rot(dir, math.pi/2)
|
||||
local right_pos = pos + hlpfuncs.rot(dir, -math.pi/2)
|
||||
|
||||
if multidecor.banister.check_for_free_space(left_pos) then
|
||||
minetest.set_node(left_pos, {name=name.."_left", param2=dir_to_param2})
|
||||
@ -104,23 +96,8 @@ function multidecor.banister.place_banister(pos, common_name, itemstack)
|
||||
minetest.set_node(right_pos, {name=name.."_right", param2=dir_to_param2})
|
||||
itemstack:take_item()
|
||||
end
|
||||
--[[local left_node_def = ndef(left_pos)
|
||||
local right_node_def = ndef(right_pos)
|
||||
|
||||
local down_left_node_def = ndef({x=left_pos.x, y=left_pos.y-1, z=left_pos.z})
|
||||
local down_right_node_def = ndef({x=right_pos.x, y=right_pos.y-1, z=right_pos.z})
|
||||
|
||||
if left_node_def.drawtype == "airlike" and (down_left_node_def.drawtype == "airlike" or not down_left_node_def.walkable) then
|
||||
minetest.set_node(left_pos, {name=name.."_left", param2=dir_to_param2})
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
if right_node_def.drawtype == "airlike" and (down_right_node_def.drawtype == "airlike" or not down_right_node_def.walkable) then
|
||||
minetest.set_node(right_pos, {name=name.."_right", param2=dir_to_param2})
|
||||
itemstack:take_item()
|
||||
end]]
|
||||
elseif shape == "spiral" then
|
||||
local dir = multidecor.helpers.get_dir({x=pos.x, y=pos.y-1, z=pos.z})*-1
|
||||
local dir = hlpfuncs.get_dir({x=pos.x, y=pos.y-1, z=pos.z})*-1
|
||||
local dir_to_param2 = minetest.dir_to_facedir(dir)
|
||||
minetest.set_node(pos, {name=name, param2=dir_to_param2})
|
||||
itemstack:take_item()
|
||||
@ -130,7 +107,7 @@ function multidecor.banister.place_banister(pos, common_name, itemstack)
|
||||
end
|
||||
|
||||
function multidecor.banister.default_after_place_node(pos, placer, itemstack)
|
||||
local add_properties = ndef(pos).add_properties
|
||||
local add_properties = hlpfuncs.ndef(pos).add_properties
|
||||
|
||||
return multidecor.banister.place_banister(pos, add_properties.common_name, itemstack)
|
||||
end
|
||||
@ -142,39 +119,34 @@ function multidecor.register.register_banister(name, base_def, add_def, craft_de
|
||||
def.paramtype2 = "facedir"
|
||||
|
||||
-- additional properties
|
||||
if add_def then
|
||||
if add_def.recipe then
|
||||
craft_def = add_def
|
||||
else
|
||||
def.add_properties = add_def
|
||||
end
|
||||
if not add_def or not add_def.banister_shapes then
|
||||
return
|
||||
end
|
||||
|
||||
def.add_properties = add_def
|
||||
def.callbacks = def.callbacks or {}
|
||||
|
||||
def.callbacks.after_place_node = def.callbacks.after_place_node or multidecor.banister.default_after_place_node
|
||||
|
||||
multidecor.register.register_furniture_unit(name, def, craft_def)
|
||||
|
||||
if def.add_properties and def.add_properties.banister_shapes then
|
||||
local banister_shapes = def.add_properties.banister_shapes
|
||||
local banister_shapes = def.add_properties.banister_shapes
|
||||
|
||||
local bshape_def = table.copy(def)
|
||||
bshape_def.groups = bshape_def.groups or {}
|
||||
bshape_def.groups.not_in_creative_inventory = 1
|
||||
local bshape_def = table.copy(def)
|
||||
bshape_def.groups = bshape_def.groups or {}
|
||||
bshape_def.groups.not_in_creative_inventory = 1
|
||||
bshape_def.drop = "multidecor:" .. name
|
||||
|
||||
bshape_def.callbacks.after_place_node = nil
|
||||
bshape_def.callbacks.after_place_node = nil
|
||||
|
||||
local function register_banister_shape(shape)
|
||||
local shape_def = table.copy(bshape_def)
|
||||
shape_def.mesh = banister_shapes[shape].mesh
|
||||
shape_def.bounding_boxes = banister_shapes[shape].bboxes
|
||||
multidecor.register.register_furniture_unit(name .. "_" .. shape, shape_def)
|
||||
end
|
||||
|
||||
register_banister_shape("raised_left")
|
||||
register_banister_shape("raised_right")
|
||||
register_banister_shape("spiral")
|
||||
register_banister_shape("corner")
|
||||
local function register_banister_shape(shape)
|
||||
local shape_def = table.copy(bshape_def)
|
||||
shape_def.mesh = banister_shapes[shape].mesh
|
||||
shape_def.bounding_boxes = banister_shapes[shape].bboxes
|
||||
multidecor.register.register_furniture_unit(name .. "_" .. shape, shape_def)
|
||||
end
|
||||
|
||||
register_banister_shape("raised_left")
|
||||
register_banister_shape("raised_right")
|
||||
register_banister_shape("spiral")
|
||||
register_banister_shape("corner")
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
multidecor.helpers = {}
|
||||
|
||||
hlpfuncs = multidecor.helpers
|
||||
|
||||
-- Returns a direction of the node with 'pos' position
|
||||
function multidecor.helpers.get_dir(pos)
|
||||
@ -13,6 +14,16 @@ function multidecor.helpers.get_dir(pos)
|
||||
return dir
|
||||
end
|
||||
|
||||
-- Returns a node def of the node at 'pos'
|
||||
function multidecor.helpers.ndef(pos)
|
||||
return minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
end
|
||||
|
||||
-- Rotates 'dir' vector around (0, 1, 0) axis at 'angle'.
|
||||
function multidecor.helpers.rot(dir, angle)
|
||||
return vector.rotate_around_axis(dir, vector.new(0, 1, 0), angle)
|
||||
end
|
||||
|
||||
-- Rotates 'rel_pos' vertically relative to 'pos' of some node according to its facedir
|
||||
function multidecor.helpers.rotate_to_node_dir(pos, rel_pos)
|
||||
local dir = multidecor.helpers.get_dir(pos)
|
||||
@ -28,6 +39,7 @@ function multidecor.helpers.rotate_to_node_dir(pos, rel_pos)
|
||||
return new_rel_pos
|
||||
end
|
||||
|
||||
-- Limits the 'v' value at the range [s, e]. If 'v' < 's', returns 's', 'v' > 'e', returns 'e'
|
||||
function multidecor.helpers.clamp(s, e, v)
|
||||
local start_v = s
|
||||
local end_v = e
|
||||
@ -40,6 +52,7 @@ function multidecor.helpers.clamp(s, e, v)
|
||||
return v < start_v and start_v or v > end_v and end_v or v
|
||||
end
|
||||
|
||||
-- Makes the first letters of each word uppercase in 's' string
|
||||
function multidecor.helpers.upper_first_letters(s)
|
||||
local new_s = ""
|
||||
|
||||
@ -50,6 +63,7 @@ function multidecor.helpers.upper_first_letters(s)
|
||||
return new_s
|
||||
end
|
||||
|
||||
-- Builds a inv/list/fs name in the template 'multidecor:<name>_<i>_<type>_<strpos>'
|
||||
function multidecor.helpers.build_name_from_tmp(name, type, i, pos)
|
||||
local strpos = pos.x .. "_" .. pos.y .. "_" .. pos.z
|
||||
local res = name .. "_" .. i .. "_".. type .. "_" .. strpos
|
||||
@ -61,6 +75,7 @@ function multidecor.helpers.build_name_from_tmp(name, type, i, pos)
|
||||
return res
|
||||
end
|
||||
|
||||
-- Copies all elements from 't1' array inserting them in 't2'
|
||||
function table.copy_to(t1, t2)
|
||||
for _, val in ipairs(t1) do
|
||||
table.insert(t2, val)
|
||||
|
@ -6,7 +6,7 @@ function multidecor.doors.rotate(pos, dir, rotate_p)
|
||||
local y_rot = vector.dir_to_rotation(dir).y
|
||||
local rel_pos = pos - rotate_p
|
||||
|
||||
rel_pos = vector.rotate_around_axis(rel_pos, {x=0, y=1, z=0}, y_rot)
|
||||
rel_pos = hlpfuncs.rot(rel_pos, y_rot)
|
||||
|
||||
return rotate_p + rel_pos, {x=0, y=y_rot, z=0}
|
||||
end
|
||||
@ -20,10 +20,14 @@ function multidecor.doors.rotate_bbox(sbox, cbox, dir)
|
||||
max = {x=sbox[4], y=sbox[5], z=sbox[6]}
|
||||
}
|
||||
|
||||
box.min = vector.rotate_around_axis(box.min, {x=0, y=1, z=0}, y_rot)
|
||||
box.max = vector.rotate_around_axis(box.max, {x=0, y=1, z=0}, y_rot)
|
||||
box.min = hlpfuncs.rot(box.min, y_rot)
|
||||
box.max = hlpfuncs.rot(box.max, y_rot)
|
||||
|
||||
local new_sbox = {
|
||||
box.min.x, box.min.y, box.min.z,
|
||||
box.max.x, box.max.y, box.max.z
|
||||
}
|
||||
|
||||
local new_sbox = {box.min.x, box.min.y, box.min.z, box.max.x, box.max.y, box.max.z}
|
||||
local new_cbox
|
||||
|
||||
if cbox then
|
||||
@ -32,10 +36,13 @@ function multidecor.doors.rotate_bbox(sbox, cbox, dir)
|
||||
max = {x=cbox[4], y=cbox[5], z=cbox[6]}
|
||||
}
|
||||
|
||||
box.min = vector.rotate_around_axis(box.min, {x=0, y=1, z=0}, y_rot)
|
||||
box.max = vector.rotate_around_axis(box.max, {x=0, y=1, z=0}, y_rot)
|
||||
box.min = hlpfuncs.rot(box.min, y_rot)
|
||||
box.max = hlpfuncs.rot(box.max, y_rot)
|
||||
|
||||
new_cbox = {box.min.x, box.min.y, box.min.z, box.max.x, box.max.y, box.max.z}
|
||||
new_cbox = {
|
||||
box.min.x, box.min.y, box.min.z,
|
||||
box.max.x, box.max.y, box.max.z
|
||||
}
|
||||
end
|
||||
|
||||
return new_sbox, new_cbox
|
||||
@ -62,7 +69,7 @@ function multidecor.doors.smooth_rotate_step(self, dtime, vel, acc)
|
||||
local rot_axis = self.rotate_x and "x" or "y"
|
||||
local target_rot = self.dir == 1 and self.end_v or self.start_v
|
||||
|
||||
rot[rot_axis] = multidecor.helpers.clamp(self.start_v, self.end_v, rot[rot_axis])
|
||||
rot[rot_axis] = hlpfuncs.clamp(self.start_v, self.end_v, rot[rot_axis])
|
||||
|
||||
if math.abs(target_rot-rot[rot_axis]) <= math.rad(10) then
|
||||
self.dir = 0
|
||||
@ -83,8 +90,9 @@ end
|
||||
|
||||
function multidecor.doors.convert_to_entity(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local dir = multidecor.helpers.get_dir(pos)
|
||||
local dir = hlpfuncs.get_dir(pos)
|
||||
|
||||
local is_mir_cpart = minetest.get_meta(pos):get_string("mirrored_counterpart") == "true"
|
||||
minetest.remove_node(pos)
|
||||
|
||||
local add_props = minetest.registered_nodes[node.name].add_properties
|
||||
@ -93,7 +101,7 @@ function multidecor.doors.convert_to_entity(pos)
|
||||
local obj_name = is_open and node.name:gsub("_open", "") or node.name
|
||||
|
||||
if is_open then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, -math.pi/2)
|
||||
dir = hlpfuncs.rot(dir, -math.pi/2)
|
||||
end
|
||||
|
||||
local shift = {x=pos.x+0.495, y=pos.y, z=pos.z+0.45}
|
||||
@ -102,15 +110,18 @@ function multidecor.doors.convert_to_entity(pos)
|
||||
local def = minetest.registered_entities[obj_name]
|
||||
local sbox, cbox = multidecor.doors.rotate_bbox(def.selectionbox, def.collisionbox, dir)
|
||||
|
||||
local y_rot = vector.dir_to_rotation(dir).y
|
||||
local start_r, end_r = y_rot, y_rot+math.pi/2
|
||||
local start_r, end_r = rot.y, rot.y+math.pi/2
|
||||
|
||||
if is_open then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, math.pi/2)
|
||||
dir = hlpfuncs.rot(dir, math.pi/2)
|
||||
local new_pos2, rot2 = multidecor.doors.rotate(new_pos, dir, shift)
|
||||
rot = rot2
|
||||
end
|
||||
|
||||
if is_mir_cpart then
|
||||
is_open = not is_open
|
||||
end
|
||||
|
||||
if add_props.door.sounds and not is_open then
|
||||
minetest.sound_play(add_props.door.sounds.open, {pos=pos, max_hear_distance=10})
|
||||
end
|
||||
@ -126,20 +137,31 @@ function multidecor.doors.convert_to_entity(pos)
|
||||
self.start_v = start_r
|
||||
self.end_v = end_r
|
||||
|
||||
if is_mir_cpart then
|
||||
self.mirrored_counterpart = true
|
||||
end
|
||||
|
||||
return obj
|
||||
end
|
||||
|
||||
function multidecor.doors.convert_from_entity(obj)
|
||||
local y_rots_n = math.round(math.deg(obj:get_rotation().y) / 90)
|
||||
local dir = vector.rotate_around_axis({x=0, y=0, z=1}, {x=0, y=1, z=0}, math.pi/2*y_rots_n)*-1
|
||||
local dir = hlpfuncs.rot({x=0, y=0, z=1}, math.pi/2*y_rots_n)*-1
|
||||
local param2 = minetest.dir_to_facedir(dir)
|
||||
|
||||
local pos = obj:get_pos()
|
||||
local self = obj:get_luaentity()
|
||||
|
||||
local is_mir_cpart = self.mirrored_counterpart
|
||||
local add_props = minetest.registered_nodes[self.name].add_properties
|
||||
|
||||
if add_props.door.sounds and self.action == "close" then
|
||||
local is_closed = self.action == "close"
|
||||
|
||||
if is_mir_cpart then
|
||||
is_closed = not is_closed
|
||||
end
|
||||
|
||||
if add_props.door.sounds and is_closed then
|
||||
minetest.sound_play(add_props.door.sounds.close, {pos=pos, max_hear_distance=10})
|
||||
end
|
||||
|
||||
@ -148,10 +170,14 @@ function multidecor.doors.convert_from_entity(obj)
|
||||
local name = self.action == "open" and self.name .. "_open" or self.name
|
||||
|
||||
minetest.set_node(pos, {name=name, param2=param2})
|
||||
|
||||
if is_mir_cpart then
|
||||
minetest.get_meta(pos):set_string("mirrored_counterpart", "true")
|
||||
end
|
||||
end
|
||||
|
||||
local function default_door_on_rightclick(pos)
|
||||
local door_data = minetest.registered_nodes[minetest.get_node(pos).name].add_properties.door
|
||||
function multidecor.doors.default_node_on_rightclick(pos)
|
||||
local door_data = hlpfuncs.ndef(pos).add_properties.door
|
||||
|
||||
local obj = multidecor.doors.convert_to_entity(pos)
|
||||
local self = obj:get_luaentity()
|
||||
@ -167,7 +193,32 @@ local function default_door_on_rightclick(pos)
|
||||
multidecor.doors.smooth_rotate(obj, dir_sign)
|
||||
end
|
||||
|
||||
local function default_entity_door_on_rightclick(self)
|
||||
function multidecor.doors.default_after_place_node(pos)
|
||||
local nodedef = hlpfuncs.ndef(pos)
|
||||
|
||||
if not nodedef.add_properties.door.has_mirrored_counterpart then
|
||||
return
|
||||
end
|
||||
|
||||
local dir = hlpfuncs.get_dir(pos)
|
||||
|
||||
local to_left = hlpfuncs.rot(dir, -math.pi/2)
|
||||
local left_nodedef = hlpfuncs.ndef(pos + to_left)
|
||||
local left_dir = hlpfuncs.get_dir(pos + to_left)
|
||||
|
||||
if left_nodedef.add_properties and left_nodedef.add_properties.common_name ==
|
||||
nodedef.add_properties.common_name and vector.equals(dir, left_dir) then
|
||||
|
||||
local open_door_name = nodedef.add_properties.common_name .. "_open"
|
||||
local open_door_param2 = minetest.dir_to_facedir(dir)
|
||||
|
||||
minetest.set_node(pos, {name="multidecor:" .. open_door_name, param2=open_door_param2})
|
||||
|
||||
minetest.get_meta(pos):set_string("mirrored_counterpart", "true")
|
||||
end
|
||||
end
|
||||
|
||||
function multidecor.doors.default_entity_on_rightclick(self)
|
||||
local dir_sign = 0
|
||||
if self.action == "open" then
|
||||
dir_sign = -1
|
||||
@ -180,7 +231,7 @@ local function default_entity_door_on_rightclick(self)
|
||||
multidecor.doors.smooth_rotate(self.object, dir_sign)
|
||||
end
|
||||
|
||||
local function default_entity_door_on_activate(self, staticdata)
|
||||
function multidecor.doors.default_entity_on_activate(self, staticdata)
|
||||
if staticdata ~= "" then
|
||||
local data = minetest.deserialize(staticdata)
|
||||
self.dir = data[1]
|
||||
@ -188,6 +239,7 @@ local function default_entity_door_on_activate(self, staticdata)
|
||||
self.start_v = data[3]
|
||||
self.end_v = data[4]
|
||||
self.action = data[5]
|
||||
self.mirrored_counterpart = data[6]
|
||||
end
|
||||
|
||||
if self.bbox then
|
||||
@ -200,7 +252,7 @@ local function default_entity_door_on_activate(self, staticdata)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
end
|
||||
|
||||
local function default_entity_door_on_step(self, dtime)
|
||||
function multidecor.doors.default_entity_on_step(self, dtime)
|
||||
local door_data = minetest.registered_nodes[self.name].add_properties.door
|
||||
|
||||
multidecor.doors.smooth_rotate_step(self, dtime, door_data.vel or 30, door_data.acc or 0)
|
||||
@ -210,27 +262,26 @@ local function default_entity_door_on_step(self, dtime)
|
||||
end
|
||||
end
|
||||
|
||||
local function default_entity_door_get_staticdata(self)
|
||||
return minetest.serialize({self.dir, self.bbox, self.start_v, self.end_v, self.action})
|
||||
function multidecor.doors.default_entity_get_staticdata(self)
|
||||
return minetest.serialize({self.dir, self.bbox,
|
||||
self.start_v, self.end_v, self.action, self.mirrored_counterpart})
|
||||
end
|
||||
|
||||
function multidecor.register.register_door(name, base_def, add_def, craft_def)
|
||||
local c_def = table.copy(base_def)
|
||||
|
||||
c_def.type = "table"
|
||||
c_def.type = "door"
|
||||
|
||||
if add_def then
|
||||
if add_def.recipe then
|
||||
return
|
||||
else
|
||||
c_def.add_properties = add_def
|
||||
end
|
||||
if not add_def or not add_def.door then
|
||||
return
|
||||
end
|
||||
|
||||
c_def.add_properties = add_def
|
||||
c_def.add_properties.door.mode = "closed"
|
||||
|
||||
c_def.callbacks = c_def.callbacks or {}
|
||||
c_def.callbacks.on_rightclick = c_def.callbacks.on_rightclick or default_door_on_rightclick
|
||||
c_def.callbacks.on_rightclick = c_def.callbacks.on_rightclick or multidecor.doors.default_node_on_rightclick
|
||||
c_def.callbacks.after_place_node = c_def.callbacks.after_place_node or multidecor.doors.default_after_place_node
|
||||
|
||||
multidecor.register.register_furniture_unit(name, c_def, craft_def)
|
||||
|
||||
@ -241,11 +292,10 @@ function multidecor.register.register_door(name, base_def, add_def, craft_def)
|
||||
c_def2.bounding_boxes[1][3] = c_def2.bounding_boxes[1][3] * -1
|
||||
c_def2.bounding_boxes[1][6] = c_def2.bounding_boxes[1][6] *-1
|
||||
|
||||
if c_def2.groups then
|
||||
c_def2.groups.not_in_creative_inventory = 1
|
||||
else
|
||||
c_def2.groups = {not_in_creative_inventory=1}
|
||||
end
|
||||
c_def2.groups = c_def2.groups or {}
|
||||
c_def2.groups.not_in_creative_inventory = 1
|
||||
|
||||
c_def2.callbacks.after_place_node = nil
|
||||
|
||||
multidecor.register.register_furniture_unit(name .. "_open", c_def2)
|
||||
|
||||
@ -267,9 +317,9 @@ function multidecor.register.register_door(name, base_def, add_def, craft_def)
|
||||
use_texture_alpha = base_def.use_texture_alpha == "blend",
|
||||
backface_culling = false,
|
||||
static_save = true,
|
||||
on_activate = default_entity_door_on_activate,
|
||||
on_rightclick = default_entity_door_on_rightclick,
|
||||
on_step = default_entity_door_on_step,
|
||||
get_staticdata = default_entity_door_get_staticdata
|
||||
on_activate = multidecor.doors.default_entity_on_activate,
|
||||
on_rightclick = multidecor.doors.default_entity_on_rightclick,
|
||||
on_step = multidecor.doors.default_entity_on_step,
|
||||
get_staticdata = multidecor.doors.default_entity_get_staticdata
|
||||
})
|
||||
end
|
||||
|
@ -79,18 +79,14 @@ function multidecor.placement.check_for_placement(pos, placer, itemstack)
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local def = minetest.registered_nodes[nodename]
|
||||
|
||||
--minetest.debug("check_for_placement()")
|
||||
if def.drawtype ~= "mesh" and def.drawtype ~= "nodebox" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
--minetest.debug("continue check_for_placement() (1)")
|
||||
if def.prevent_placement_check then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
--minetest.debug("continue check_for_placement() (2)")
|
||||
|
||||
local bboxes
|
||||
|
||||
if def.drawtype == "nodebox" then
|
||||
|
@ -6,6 +6,7 @@ multidecor.register = {}
|
||||
-- Default furniture types
|
||||
multidecor.register.supported_types = {
|
||||
"banister",
|
||||
"door",
|
||||
"seat",
|
||||
"table",
|
||||
"shelf",
|
||||
|
@ -12,7 +12,9 @@ multidecor.register.register_door("high_dark_rusty_gate", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.4}}
|
||||
},
|
||||
{
|
||||
common_name = "high_dark_rusty_fence",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_high_dark_rusty_gate_open.b3d",
|
||||
mesh_activated = "multidecor_high_dark_rusty_gate_activated.b3d",
|
||||
vel = 90, -- degrees per sec
|
||||
@ -45,7 +47,9 @@ multidecor.register.register_door("dark_rusty_gate", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.4}}
|
||||
},
|
||||
{
|
||||
common_name = "dark_rusty_gate",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_dark_rusty_gate_open.b3d",
|
||||
mesh_activated = "multidecor_dark_rusty_gate_activated.b3d",
|
||||
vel = 90, -- degrees per sec
|
||||
@ -271,7 +275,9 @@ multidecor.register.register_door("bathroom_door", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.35}}
|
||||
},
|
||||
{
|
||||
common_name = "bathroom_door",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_bathroom_door_open.b3d",
|
||||
mesh_activated = "multidecor_bathroom_door_activated.b3d",
|
||||
vel = 100, -- degrees per sec
|
||||
@ -305,7 +311,9 @@ multidecor.register.register_door("white_pine_glass_door", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.35}}
|
||||
},
|
||||
{
|
||||
common_name = "white_pine_glass_door",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_white_pine_glass_door_open.b3d",
|
||||
mesh_activated = "multidecor_white_pine_glass_door_activated.b3d",
|
||||
vel = 100, -- degrees per sec
|
||||
@ -330,7 +338,9 @@ multidecor.register.register_door("pine_glass_door", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.4}}
|
||||
},
|
||||
{
|
||||
common_name = "pine_glass_door",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_pine_glass_door_open.b3d",
|
||||
mesh_activated = "multidecor_pine_glass_door_activated.b3d",
|
||||
vel = 100, -- degrees per sec
|
||||
@ -362,7 +372,9 @@ multidecor.register.register_door("pine_door", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.4}}
|
||||
},
|
||||
{
|
||||
common_name = "pine_door",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_pine_door_open.b3d",
|
||||
mesh_activated = "multidecor_pine_door_activated.b3d",
|
||||
vel = 100, -- degrees per sec
|
||||
@ -388,7 +400,9 @@ multidecor.register.register_door("dark_pine_glass_door", {
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.4}}
|
||||
},
|
||||
{
|
||||
common_name = "dark_pine_glass_door",
|
||||
door = {
|
||||
has_mirrored_counterpart = true,
|
||||
mesh_open = "multidecor_dark_pine_glass_door_open.b3d",
|
||||
mesh_activated = "multidecor_dark_pine_glass_door_activated.b3d",
|
||||
vel = 100, -- degrees per sec
|
||||
|
@ -167,16 +167,6 @@ for _, sstair in ipairs(spiral_stairs_data) do
|
||||
bounding_boxes = sstair_plank_bboxes_wban
|
||||
})
|
||||
|
||||
--[[multidecor.register.register_banister("spiral_" .. sstair.name .. "_banister", {
|
||||
style = "modern",
|
||||
material = sstair.name == "sequoia" and "wood" or sstair.name,
|
||||
description = "Spiral " .. upper_name .. " Banister",
|
||||
mesh = "multidecor_spiral_banister.b3d",
|
||||
tiles = sstair.tex,
|
||||
bounding_boxes = spiral_banister_bboxes,
|
||||
prevent_placement_check = true
|
||||
})]]
|
||||
|
||||
local banister_common_name = sstair.name .. "_banister"
|
||||
multidecor.register.register_banister(banister_common_name, {
|
||||
style = "modern",
|
||||
@ -196,15 +186,4 @@ for _, sstair in ipairs(spiral_stairs_data) do
|
||||
["corner"] = {mesh="multidecor_banister_corner.b3d", bboxes=corner_banister_bboxes}
|
||||
}
|
||||
})
|
||||
|
||||
--[[multidecor.register.register_banister(sstair.name .. "_banister_raised", {
|
||||
type = "decoration",
|
||||
style = "modern",
|
||||
material = sstair.name == "sequoia" and "wood" or sstair.name,
|
||||
description = upper_name .. " Banister Raised",
|
||||
mesh = "multidecor_banister_raised.b3d",
|
||||
tiles = sstair.tex,
|
||||
bounding_boxes = banister_bboxes,
|
||||
prevent_placement_check = true
|
||||
})]]
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user