Added doors API, dark rusty metal doors, added balance wheel for floor clock
parent
07000ab636
commit
0ca15f2764
|
@ -0,0 +1,251 @@
|
|||
multidecor.doors = {}
|
||||
|
||||
doors = multidecor.doors
|
||||
|
||||
-- Rotates an entity corresponding to the 'dir'
|
||||
function doors.rotate(obj, dir, rotate_p)
|
||||
if not obj:get_luaentity() then
|
||||
return
|
||||
end
|
||||
local y_rot = vector.dir_to_rotation(dir).y
|
||||
|
||||
local p = vector.copy(rotate_p)
|
||||
local rel_pos = obj:get_pos() - p
|
||||
|
||||
local y_rel_pos_r = vector.dir_to_rotation(rel_pos).y
|
||||
rel_pos = vector.rotate_around_axis(rel_pos, {x=0, y=1, z=0}, y_rot)
|
||||
|
||||
obj:set_pos(rotate_p + rel_pos)
|
||||
|
||||
local obj_rot = obj:get_rotation()
|
||||
obj:set_rotation({x=obj_rot.x, y=y_rot, z=obj_rot.z})
|
||||
end
|
||||
|
||||
-- Rotates obj's collision/selection boxes corresponding to the 'dir'
|
||||
function doors.rotate_bbox(obj, dir, rotate_cbox)
|
||||
if not obj:get_luaentity() then
|
||||
return
|
||||
end
|
||||
|
||||
local y_rot = vector.dir_to_rotation(dir).y
|
||||
|
||||
local sel_box = minetest.registered_entities[obj:get_luaentity().name].selectionbox
|
||||
local box = {
|
||||
min = {x=sel_box[1], y=sel_box[2], z=sel_box[3]},
|
||||
max = {x=sel_box[4], y=sel_box[5], z=sel_box[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)
|
||||
|
||||
local sbox = {box.min.x, box.min.y, box.min.z, box.max.x, box.max.y, box.max.z}
|
||||
obj:set_properties({selectionbox=sbox})
|
||||
obj:get_luaentity().bbox = sbox
|
||||
|
||||
if rotate_cbox then
|
||||
local col_box = minetest.registered_entities[obj:get_luaentity().name].collisionbox
|
||||
local cbox = {
|
||||
min = {x=col_box[1], y=col_box[2], z=col_box[3]},
|
||||
max = {x=col_box[4], y=col_box[5], z=col_box[6]}
|
||||
}
|
||||
|
||||
cbox.min = vector.rotate_around_axis(cbox.min, {x=0, y=1, z=0}, y_rot)
|
||||
cbox.max = vector.rotate_around_axis(cbox.max, {x=0, y=1, z=0}, y_rot)
|
||||
|
||||
obj:set_properties({collisionbox={cbox.min.x, cbox.min.y, cbox.min.z, cbox.max.x, cbox.max.y, cbox.max.z}})
|
||||
end
|
||||
end
|
||||
|
||||
-- Activates obj rotation from 'self.start_v' to 'self.end_v' or vice versa depending on 'dir_sign' value
|
||||
function doors.smooth_rotate(obj, dir_sign)
|
||||
local self = obj:get_luaentity()
|
||||
if not self then
|
||||
return
|
||||
end
|
||||
|
||||
self.dir = dir_sign
|
||||
|
||||
end
|
||||
|
||||
-- Step of obj rotation
|
||||
function doors.smooth_rotate_step(self, dtime, vel, acc)
|
||||
if self.dir == 0 or not self.dir then
|
||||
return
|
||||
end
|
||||
|
||||
local rot = self.object:get_rotation()
|
||||
local target_rot = self.dir == 1 and self.end_v or self.start_v
|
||||
|
||||
rot.y = helpers.clamp(self.start_v, self.end_v, rot.y)
|
||||
|
||||
if math.abs(target_rot-rot.y) <= math.rad(10) then
|
||||
minetest.debug("the door is rotated!")
|
||||
self.dir = 0
|
||||
self.step_c = nil
|
||||
self.object:set_rotation({x=rot.x, y=target_rot, z=rot.z})
|
||||
return
|
||||
end
|
||||
|
||||
self.step_c = self.step_c and self.step_c+acc or 1
|
||||
-- Rotation speed is 60 degrees/sec
|
||||
local sign = self.start_v > self.end_v and -1 or 1
|
||||
local new_rot = self.dir*sign*math.rad(vel)*dtime*0.5*self.step_c
|
||||
|
||||
self.object:set_rotation({x=rot.x, y=rot.y+new_rot, z=rot.z})
|
||||
end
|
||||
|
||||
function doors.convert_to_entity(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local dir = helpers.get_dir(pos)
|
||||
|
||||
minetest.remove_node(pos)
|
||||
|
||||
local is_open = minetest.registered_nodes[node.name].add_properties.door.mode == "open"
|
||||
|
||||
local obj_name = is_open and node.name:gsub("_open", "") or node.name
|
||||
|
||||
local shift = {x=pos.x+0.495, y=pos.y, z=pos.z+0.45}
|
||||
local obj = minetest.add_entity(shift, obj_name)
|
||||
|
||||
if is_open then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, -math.pi/2)
|
||||
end
|
||||
|
||||
doors.rotate(obj, dir, pos)
|
||||
doors.rotate_bbox(obj, dir, true)
|
||||
|
||||
local y_rot = vector.dir_to_rotation(dir).y
|
||||
|
||||
local self = obj:get_luaentity()
|
||||
self.start_v = y_rot
|
||||
self.end_v = y_rot+math.pi/2
|
||||
|
||||
if is_open then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, math.pi/2)
|
||||
doors.rotate(obj, dir, shift)
|
||||
doors.rotate_bbox(obj, dir, true)
|
||||
end
|
||||
|
||||
return obj
|
||||
end
|
||||
|
||||
function 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 param2 = minetest.dir_to_facedir(dir)
|
||||
|
||||
local pos = obj:get_pos()
|
||||
local self = obj:get_luaentity()
|
||||
obj:remove()
|
||||
|
||||
local name = self.action == "open" and self.name .. "_open" or self.name
|
||||
|
||||
minetest.set_node(pos, {name=name, param2=param2})
|
||||
end
|
||||
|
||||
local function default_door_on_rightclick(pos)
|
||||
local door_data = minetest.registered_nodes[minetest.get_node(pos).name].add_properties.door
|
||||
|
||||
local obj = doors.convert_to_entity(pos)
|
||||
local self = obj:get_luaentity()
|
||||
local dir_sign = 0
|
||||
if door_data.mode == "closed" then
|
||||
dir_sign = 1
|
||||
self.action = "open"
|
||||
else
|
||||
dir_sign = -1
|
||||
self.action = "close"
|
||||
end
|
||||
|
||||
doors.smooth_rotate(obj, dir_sign)
|
||||
end
|
||||
|
||||
local function default_entity_door_on_rightclick(self)
|
||||
self.dir = self.dir * -1
|
||||
end
|
||||
|
||||
local function default_entity_door_on_activate(self, staticdata)
|
||||
if staticdata ~= "" then
|
||||
local data = minetest.deserialize(staticdata)
|
||||
self.dir = data[1]
|
||||
self.bbox = data[2]
|
||||
self.start_v = data[3]
|
||||
self.end_v = data[4]
|
||||
self.action = data[5]
|
||||
end
|
||||
|
||||
if self.bbox then
|
||||
obj:set_properties({
|
||||
collisionbox = self.bbox,
|
||||
selectionbox = self.bbox
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local function default_entity_door_on_step(self, dtime)
|
||||
local door_data = minetest.registered_nodes[self.name].add_properties.door
|
||||
|
||||
doors.smooth_rotate_step(self, dtime, door_data.vel or 30, door_data.acc or 0)
|
||||
|
||||
if self.dir == 0 then
|
||||
doors.convert_from_entity(self.object)
|
||||
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})
|
||||
end
|
||||
|
||||
function register.register_door(name, base_def, add_def, craft_def)
|
||||
local c_def = table.copy(base_def)
|
||||
|
||||
c_def.type = "table"
|
||||
|
||||
if add_def then
|
||||
if add_def.recipe then
|
||||
return
|
||||
else
|
||||
c_def.add_properties = add_def
|
||||
end
|
||||
end
|
||||
|
||||
c_def.add_properties.door.mode = "closed"
|
||||
|
||||
if c_def.callbacks then
|
||||
c_def.callbacks.on_rightclick = c_def.callbacks.on_rightclick or default_door_on_rightclick
|
||||
else
|
||||
c_def.callbacks = {on_rightclick = default_door_on_rightclick}
|
||||
end
|
||||
|
||||
register.register_furniture_unit(name, c_def, craft_def)
|
||||
|
||||
local c_def2 = table.copy(c_def)
|
||||
c_def2.add_properties.door.mode = "open"
|
||||
c_def2.mesh = c_def2.add_properties.door.mesh_open
|
||||
c_def2.drop = "multidecor:" .. name
|
||||
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
|
||||
|
||||
register.register_furniture_unit(name .. "_open", c_def2)
|
||||
|
||||
minetest.register_entity(":multidecor:" .. name, {
|
||||
visual = "mesh",
|
||||
visual_size = {x=5, y=5, z=5},
|
||||
textures = base_def.tiles,
|
||||
mesh = c_def2.add_properties.door.mesh_activated,
|
||||
collisionbox = base_def.bounding_boxes[1],
|
||||
selectionbox = base_def.bounding_boxes[1],
|
||||
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
|
||||
})
|
||||
end
|
|
@ -5,6 +5,7 @@ local modpath = minetest.get_modpath("decor_api")
|
|||
dofile(modpath .. "/common_helpers.lua")
|
||||
dofile(modpath .. "/connecting.lua")
|
||||
dofile(modpath .. "/register.lua")
|
||||
dofile(modpath .. "/door.lua")
|
||||
dofile(modpath .. "/bed.lua")
|
||||
dofile(modpath .. "/hedge.lua")
|
||||
dofile(modpath .. "/lighting.lua")
|
||||
|
|
|
@ -32,24 +32,16 @@ end
|
|||
|
||||
-- Rotates the shelf 'obj' around 'pos' position of the node
|
||||
function shelves.rotate_shelf(pos, obj, is_drawer, move_dist)
|
||||
if not obj:get_luaentity() then
|
||||
return
|
||||
end
|
||||
|
||||
local dir = helpers.get_dir(pos)
|
||||
local rot_y = vector.dir_to_rotation(dir).y
|
||||
|
||||
local rel_obj_pos = vector.subtract(obj:get_pos(), pos)
|
||||
rel_obj_pos = vector.rotate_around_axis(rel_obj_pos, {x=0, y=1, z=0}, rot_y)
|
||||
obj:set_pos(vector.add(pos, rel_obj_pos))
|
||||
local rot = obj:get_rotation()
|
||||
obj:set_rotation({x=rot.x, y=rot_y, z=rot.z})
|
||||
doors.rotate(obj, dir, pos)
|
||||
|
||||
local self = obj:get_luaentity()
|
||||
if is_drawer then
|
||||
local rel_obj_pos = vector.subtract(obj:get_pos(), pos)
|
||||
self.start_v = vector.add(pos, rel_obj_pos)
|
||||
self.end_v = vector.add(pos, vector.add(rel_obj_pos, vector.multiply(dir, move_dist)))
|
||||
else
|
||||
local rot_y = vector.dir_to_rotation(dir).y
|
||||
self.start_v = rot_y
|
||||
self.end_v = rot_y+move_dist
|
||||
end
|
||||
|
@ -58,34 +50,16 @@ end
|
|||
-- Rotates the obj`s selectionbox depending on the connected node rotation
|
||||
function shelves.rotate_shelf_bbox(obj)
|
||||
local self = obj:get_luaentity()
|
||||
|
||||
if not self then return end
|
||||
|
||||
local sel_box = minetest.registered_entities[self.name].selectionbox
|
||||
local dir = helpers.get_dir(self.connected_to.pos)
|
||||
local yaw = vector.dir_to_rotation(dir).y
|
||||
|
||||
local box = {
|
||||
min = {x=sel_box[1], y=sel_box[2], z=sel_box[3]},
|
||||
max = {x=sel_box[4], y=sel_box[5], z=sel_box[6]}
|
||||
}
|
||||
|
||||
box.min = vector.rotate_around_axis(box.min, {x=0, y=1, z=0}, yaw)
|
||||
box.max = vector.rotate_around_axis(box.max, {x=0, y=1, z=0}, yaw)
|
||||
|
||||
local shelf = minetest.registered_nodes[self.connected_to.name].add_properties.shelves_data[self.shelf_data_i]
|
||||
|
||||
if shelf.type == "sym_doors" and
|
||||
vector.round(vector.subtract(obj:get_pos(), self.connected_to.pos)) == vector.round(shelf.pos2) or self.is_flip_z_scale then
|
||||
local x_dist = math.abs(sel_box[1])+math.abs(sel_box[4])
|
||||
local rot_dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, -math.pi/2)
|
||||
local x_shift = rot_dir * x_dist
|
||||
|
||||
box.min = box.min + x_shift
|
||||
box.max = box.max + x_shift
|
||||
vector.round(vector.subtract(obj:get_pos(), self.connected_to.pos)) == vector.round(shelf.pos2) or self.is_flip_x_scale then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, math.pi)
|
||||
end
|
||||
|
||||
obj:set_properties({selectionbox={box.min.x, box.min.y, box.min.z, box.max.x, box.max.y, box.max.z}})
|
||||
doors.rotate_bbox(obj, dir, false)
|
||||
end
|
||||
|
||||
-- Animates opening or closing the shelf 'obj'. The action directly depends on 'dir_sign' value ('1' is open, '-1' is close)
|
||||
|
@ -111,7 +85,7 @@ function shelves.open_shelf(obj, dir_sign)
|
|||
end
|
||||
|
||||
if shelf.type == "sym_doors" then
|
||||
local tpos = self.is_flip_z_scale and shelf.pos or shelf.pos2
|
||||
local tpos = self.is_flip_x_scale and shelf.pos or shelf.pos2
|
||||
tpos = self.connected_to.pos + vector.rotate_around_axis(tpos, {x=0, y=1, z=0}, vector.dir_to_rotation(dir).y)
|
||||
local obj2 = minetest.get_objects_inside_radius(tpos, 0.05)[1]
|
||||
|
||||
|
@ -173,7 +147,7 @@ function shelves.set_shelves(pos)
|
|||
|
||||
local vis_size = obj2:get_properties().visual_size
|
||||
obj2:set_properties({visual_size={x=vis_size.x*-1, y=vis_size.y, z=vis_size.z}})
|
||||
obj2:get_luaentity().is_flip_z_scale = true
|
||||
obj2:get_luaentity().is_flip_x_scale = true
|
||||
|
||||
shelves.rotate_shelf(pos, obj2, false, math.pi/2)
|
||||
end
|
||||
|
@ -190,7 +164,14 @@ shelves.default_on_activate = function(self, staticdata)
|
|||
self.inv_list = data[5] or {}
|
||||
self.start_v = data[6]
|
||||
self.end_v = data[7]
|
||||
self.is_flip_z_scale = data[8]
|
||||
self.is_flip_x_scale = data[8]
|
||||
end
|
||||
|
||||
local node = minetest.get_node(self.connected_to.pos)
|
||||
|
||||
if node.name ~= self.connected_to.name then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
local shelf_data = minetest.registered_nodes[self.connected_to.name].add_properties.shelves_data[self.shelf_data_i]
|
||||
|
@ -202,7 +183,7 @@ shelves.default_on_activate = function(self, staticdata)
|
|||
obj_props.visual_size = vector.add(obj_props.visual_size, shelf_data.visual_size_adds)
|
||||
end
|
||||
|
||||
if self.is_flip_z_scale then
|
||||
if self.is_flip_x_scale then
|
||||
obj_props.visual_size.x = obj_props.visual_size.x * -1
|
||||
end
|
||||
-- Usually means a material which the shelf is made of
|
||||
|
@ -249,7 +230,7 @@ shelves.default_on_activate = function(self, staticdata)
|
|||
end
|
||||
|
||||
shelves.default_get_staticdata = function(self)
|
||||
return minetest.serialize({self.inv, self.connected_to, self.dir, self.shelf_data_i, self.inv_list, self.start_v, self.end_v, self.is_flip_z_scale})
|
||||
return minetest.serialize({self.inv, self.connected_to, self.dir, self.shelf_data_i, self.inv_list, self.start_v, self.end_v, self.is_flip_x_scale})
|
||||
end
|
||||
|
||||
shelves.default_on_rightclick = function(self, clicker)
|
||||
|
@ -290,28 +271,8 @@ shelves.default_door_on_step = function(self, dtime)
|
|||
return
|
||||
end
|
||||
|
||||
if self.dir == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local rot = self.object:get_rotation()
|
||||
local target_rot = self.dir == 1 and self.end_v or self.start_v
|
||||
|
||||
rot.y = helpers.clamp(self.start_v, self.end_v, rot.y)
|
||||
|
||||
if math.abs(target_rot-rot.y) <= math.rad(10) then
|
||||
self.dir = 0
|
||||
self.step_c = nil
|
||||
self.object:set_rotation({x=rot.x, y=target_rot, z=rot.z})
|
||||
return
|
||||
end
|
||||
|
||||
self.step_c = self.step_c and self.step_c+1 or 1
|
||||
-- Rotation speed is 60 degrees/sec
|
||||
local sign = self.start_v > self.end_v and -1 or 1
|
||||
local new_rot = self.dir*sign*math.pi/3*dtime*0.5*self.step_c
|
||||
|
||||
self.object:set_rotation({x=rot.x, y=rot.y+new_rot, z=rot.z})
|
||||
local shelf_data = minetest.registered_nodes[node.name].add_properties.shelves_data[self.shelf_data_i]
|
||||
doors.smooth_rotate_step(self, dtime, shelf_data.vel or 30, shelf_data.acc or 0)
|
||||
end
|
||||
|
||||
shelves.default_on_receive_fields = function(player, formname, fields)
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
register.register_door("high_dark_rusty_gate", {
|
||||
style = "modern",
|
||||
material = "metal",
|
||||
visual_scale = 0.5,
|
||||
description = "High Dark Rusty Gate",
|
||||
mesh = "multidecor_high_dark_rusty_gate.b3d",
|
||||
tiles = {
|
||||
"multidecor_fence_chainlink.png",
|
||||
"multidecor_dark_metal_rusty_fence.png",
|
||||
"multidecor_wood.png",
|
||||
"multidecor_metal_material.png"
|
||||
},
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 1.5, -0.4}}
|
||||
},
|
||||
{
|
||||
door = {
|
||||
mesh_open = "multidecor_high_dark_rusty_gate_open.b3d",
|
||||
mesh_activated = "multidecor_high_dark_rusty_gate_activated.b3d",
|
||||
vel = 90 -- degrees per sec
|
||||
}
|
||||
})
|
||||
|
||||
register.register_door("dark_rusty_gate", {
|
||||
style = "modern",
|
||||
material = "metal",
|
||||
visual_scale = 0.5,
|
||||
description = "Dark Rusty Gate",
|
||||
mesh = "multidecor_dark_rusty_gate.b3d",
|
||||
tiles = {
|
||||
"multidecor_fence_chainlink.png",
|
||||
"multidecor_dark_metal_rusty_fence.png",
|
||||
"multidecor_wood.png",
|
||||
"multidecor_metal_material.png"
|
||||
},
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.4}}
|
||||
},
|
||||
{
|
||||
door = {
|
||||
mesh_open = "multidecor_dark_rusty_gate_open.b3d",
|
||||
mesh_activated = "multidecor_dark_rusty_gate_activated.b3d",
|
||||
vel = 90 -- degrees per sec
|
||||
}
|
||||
})
|
|
@ -2,6 +2,7 @@ local modpath = minetest.get_modpath("modern")
|
|||
|
||||
dofile(modpath .. "/bedroom.lua")
|
||||
dofile(modpath .. "/chairs.lua")
|
||||
dofile(modpath .. "/doors.lua")
|
||||
dofile(modpath .. "/fences.lua")
|
||||
dofile(modpath .. "/lamps.lua")
|
||||
dofile(modpath .. "/living_room.lua")
|
||||
|
|
|
@ -1,21 +1,83 @@
|
|||
register.register_furniture_unit("modern_floor_clock", {
|
||||
type = "decoration",
|
||||
style = "modern",
|
||||
material = "wood",
|
||||
minetest.register_node(":multidecor:modern_floor_clock", {
|
||||
visual_scale = 0.5,
|
||||
drawtype = "mesh",
|
||||
description = "Floor Clock",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
inventory_image = "multidecor_floor_clock_inv.png",
|
||||
use_texture_alpha = "blend",
|
||||
mesh = "multidecor_floor_clock.b3d",
|
||||
tiles = {
|
||||
"multidecor_gold_material.png",
|
||||
"multidecor_jungle_wood.png",
|
||||
"multidecor_dial.png",
|
||||
"multidecor_gold_material.png",
|
||||
"multidecor_glass_material.png"
|
||||
},
|
||||
bounding_boxes = {{-0.4, -0.5, -0.3, 0.4, 2, 0.4}}
|
||||
},
|
||||
groups = {choppy=1.5},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.4, -0.5, -0.3, 0.4, 2, 0.4}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.4, -0.5, -0.3, 0.4, 2, 0.4}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local wheel = minetest.add_entity(pos, "modern:floor_clock_balance_wheel")
|
||||
|
||||
local dir = vector.multiply(minetest.facedir_to_dir(minetest.get_node(pos).param2), -1)
|
||||
local y_rot = vector.dir_to_rotation(dir).y
|
||||
|
||||
wheel:set_rotation({x=0, y=y_rot, z=0})
|
||||
|
||||
minetest.get_meta(pos):set_string("is_activated", "false")
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local wheel = minetest.get_objects_inside_radius(pos, 0.3)
|
||||
|
||||
-- Not found the balance wheel
|
||||
if #wheel == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
wheel = wheel[1]
|
||||
|
||||
if wheel:get_luaentity().name ~= "modern:floor_clock_balance_wheel" then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if meta:get_string("is_activated") == "false" then
|
||||
minetest.debug("activate")
|
||||
wheel:set_animation({x=1, y=40}, 25.0, 0.0, true)
|
||||
meta:set_string("is_activated", "true")
|
||||
else
|
||||
wheel:set_animation({x=1, y=1}, 0.0)
|
||||
meta:set_string("is_activated", "false")
|
||||
end
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
local wheel = minetest.get_objects_inside_radius(pos, 0.3)
|
||||
|
||||
-- Not found the balance wheel
|
||||
if #wheel == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
wheel = wheel[1]
|
||||
|
||||
if wheel:get_luaentity().name ~= "modern:floor_clock_balance_wheel" then
|
||||
return
|
||||
end
|
||||
|
||||
wheel:remove()
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "multidecor:modern_floor_clock",
|
||||
recipe = {
|
||||
{"multidecor:jungleboard", "multidecor:jungleboard", "multidecor:jungleboard"},
|
||||
{"doors:door_glass", "multidecor:digital_dial", "multidecor:jungleboard"},
|
||||
|
@ -23,6 +85,15 @@ register.register_furniture_unit("modern_floor_clock", {
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_entity("modern:floor_clock_balance_wheel", {
|
||||
visual = "mesh",
|
||||
visual_size = {x=5, y=5, z=5},
|
||||
physical = false,
|
||||
pointable = false,
|
||||
mesh = "multidecor_floor_clock_balance_wheel.b3d",
|
||||
textures = {"multidecor_gold_material.png"},
|
||||
static_save = true
|
||||
})
|
||||
|
||||
register.register_furniture_unit("book", {
|
||||
type = "decoration",
|
||||
|
@ -234,29 +305,6 @@ for name, def in pairs(pots_defs) do
|
|||
end
|
||||
end
|
||||
|
||||
--[[minetest.register_node(":multidecor:terracotta_flowerpot", {
|
||||
visual_scale = 0.5,
|
||||
drawtype = "mesh",
|
||||
description = "Terracotta Flowerpot (right-click to place wielded flower)",
|
||||
paramtype = "light"
|
||||
mesh = "multidecor_terracotta_flowerpot.b3d",
|
||||
tiles = {
|
||||
"multidecor_terracotta_material2.png^[multiply:brown",
|
||||
"multidecor_terracotta_material.png^[multiply:brown",
|
||||
"default_dirt.png",
|
||||
},
|
||||
bounding_boxes = {{-0.4, -0.5, -0.4, 0.4, 0.25, 0.4}},
|
||||
callbacks = {
|
||||
on_rightclick = on_rightclick_flowerpot
|
||||
}
|
||||
},
|
||||
{
|
||||
recipe = {
|
||||
{"multidecor:jungleboard", "multidecor:jungleboard", "multidecor:jungleboard"},
|
||||
{"doors:door_glass", "multidecor:digital_dial", "multidecor:jungleboard"},
|
||||
{"multidecor:gear", "multidecor:gear", "multidecor:spring"}
|
||||
}
|
||||
}]]
|
||||
|
||||
register.register_furniture_unit("white_plastic_flowerpot", {
|
||||
type = "decoration",
|
||||
|
@ -270,77 +318,4 @@ register.register_furniture_unit("white_plastic_flowerpot", {
|
|||
"default_dirt.png"
|
||||
},
|
||||
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}
|
||||
}--[[,
|
||||
{
|
||||
recipe = {
|
||||
{"multidecor:jungleboard", "multidecor:jungleboard", "multidecor:jungleboard"},
|
||||
{"doors:door_glass", "multidecor:digital_dial", "multidecor:jungleboard"},
|
||||
{"multidecor:gear", "multidecor:gear", "multidecor:spring"}
|
||||
}
|
||||
}]])
|
||||
|
||||
--[[register.register_furniture_unit("green_small_flowerpot", {
|
||||
type = "decoration",
|
||||
style = "modern",
|
||||
material = "stone",
|
||||
visual_scale = 0.5,
|
||||
description = "Green Small Flowerpot (right-click to place wielded flower)",
|
||||
mesh = "multidecor_green_small_flowerpot.b3d",
|
||||
tiles = {
|
||||
"multidecor_terracotta_material.png^[multiply:palegreen",
|
||||
"default_dirt.png"
|
||||
},
|
||||
bounding_boxes = {{-0.3, -0.5, -0.3, 0.3, 0.05, 0.3}},
|
||||
callbacks = {
|
||||
on_rightclick = on_rightclick_flowerpot
|
||||
}
|
||||
}--[[,
|
||||
{
|
||||
recipe = {
|
||||
{"multidecor:jungleboard", "multidecor:jungleboard", "multidecor:jungleboard"},
|
||||
{"doors:door_glass", "multidecor:digital_dial", "multidecor:jungleboard"},
|
||||
{"multidecor:gear", "multidecor:gear", "multidecor:spring"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
for i = 1, #flowers do
|
||||
register.register_furniture_unit("terracotta_flowerpot_with_flower_" .. flowers[i], {
|
||||
type = "decoration",
|
||||
style = "modern",
|
||||
material = "stone",
|
||||
visual_scale = 0.5,
|
||||
description = "Terracotta Flowerpot (right-click to place wielded flower)",
|
||||
mesh = "multidecor_terracotta_flowerpot_with_flower.b3d",
|
||||
tiles = {
|
||||
"multidecor_terracotta_material2.png^[multiply:brown",
|
||||
"multidecor_terracotta_material.png^[multiply:brown",
|
||||
"default_dirt.png",
|
||||
"flowers_" .. flowers[i] .. ".png"
|
||||
},
|
||||
bounding_boxes = {{-0.4, -0.5, -0.4, 0.4, 0.25, 0.4}},
|
||||
groups = {not_in_creative_inventory=1, flower_in_pot=i},
|
||||
callbacks = {
|
||||
on_rightclick = on_rightclick_flowerpot_with_flower
|
||||
}
|
||||
})
|
||||
|
||||
register.register_furniture_unit("green_small_flowerpot_with_flower_" .. flowers[i], {
|
||||
type = "decoration",
|
||||
style = "modern",
|
||||
material = "stone",
|
||||
visual_scale = 0.5,
|
||||
description = "Green Small Flowerpot (right-click to place wielded flower)",
|
||||
mesh = "multidecor_green_small_flowerpot_with_flower.b3d",
|
||||
tiles = {
|
||||
"multidecor_terracotta_material.png^[multiply:palegreen",
|
||||
"default_dirt.png",
|
||||
"flowers_" .. flowers[i] .. ".png"
|
||||
},
|
||||
bounding_boxes = {{-0.3, -0.5, -0.3, 0.3, 0.05, 0.3}},
|
||||
groups = {not_in_creative_inventory=1, flower_in_pot=i},
|
||||
callbacks = {
|
||||
on_rightclick = on_rightclick_flowerpot_with_flower
|
||||
}
|
||||
})
|
||||
end]]
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -47,7 +47,8 @@ local images = {
|
|||
{"sky", 3, 2, 1, {4, 14, 12, 15, 7}},
|
||||
{"sunset_in_sea", 6, 1, 1, {14, 15, 2, 13}},
|
||||
{"supernova", 3, 1, 2, {1, 11, 14, 13}},
|
||||
{"tropic", 2, 2, 1, {4, 2, 7, 5, 14}}
|
||||
{"tropic", 2, 2, 1, {4, 2, 7, 5, 14}},
|
||||
{"physical_world_map", 2, 2, 2, {4, 14, 7, 15}}
|
||||
}
|
||||
|
||||
local function painting_craft_recipe(inds)
|
||||
|
|
|
@ -100,7 +100,8 @@ register.register_table("modern_wooden_desk", {
|
|||
pos = {x=-0.825, y=-0.15, z=0.4},
|
||||
object = "modern:wooden_door",
|
||||
side = "left",
|
||||
inv_size = {w=6,h=3}
|
||||
inv_size = {w=6,h=3},
|
||||
acc = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -162,6 +163,7 @@ register.register_table("modern_bedside_table", {
|
|||
style = "modern",
|
||||
material = "wood",
|
||||
description = "Modern Bedside Table",
|
||||
visual_scale = 0.5,
|
||||
mesh = "multidecor_bedside_table.b3d",
|
||||
tiles = {"multidecor_pine_wood2.png", "multidecor_hardboard.png"},
|
||||
bounding_boxes = {
|
||||
|
@ -178,8 +180,8 @@ register.register_table("modern_bedside_table", {
|
|||
{
|
||||
type = "drawer",
|
||||
base_texture = "multidecor_pine_wood2.png",
|
||||
visual_size_adds = {x=1.2, y=1.5, z=-0.8},
|
||||
pos = {x=0, y=-0.28, z=0.06},
|
||||
visual_size_adds = {x=1.2*2.2, y=1.5*2.2, z=-0.8*2.2},
|
||||
pos = {x=0, y=-0.22, z=0.2375},
|
||||
object = "modern:wooden_drawer",
|
||||
length = 0.8,
|
||||
inv_size = {w=6,h=1}
|
||||
|
@ -187,8 +189,8 @@ register.register_table("modern_bedside_table", {
|
|||
{
|
||||
type = "drawer",
|
||||
base_texture = "multidecor_pine_wood2.png",
|
||||
visual_size_adds = {x=1.2, y=1.5, z=-0.8},
|
||||
pos = {x=0, y=0.06, z=0.06},
|
||||
visual_size_adds = {x=1.2*2.2, y=1.5*2.2, z=-0.8*2.2},
|
||||
pos = {x=0, y=0.205, z=0.2375},
|
||||
object = "modern:wooden_drawer",
|
||||
length = 0.8,
|
||||
inv_size = {w=6,h=1}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
|
@ -22,14 +22,16 @@ register.register_table("modern_cupboard_with_glass_doors", {
|
|||
pos = {x=0.5, y=1.6625, z=0.25},
|
||||
pos2 = {x=-0.5, y=1.6625, z=0.25},
|
||||
object = "modern:wardrobe_wooden_glass_door",
|
||||
inv_size = {w=8,h=6}
|
||||
inv_size = {w=8,h=6},
|
||||
acc = 1
|
||||
},
|
||||
{
|
||||
type = "sym_doors",
|
||||
pos = {x=0.5, y=0.2375, z=0.25},
|
||||
pos2 = {x=-0.5, y=0.2375, z=0.25},
|
||||
object = "modern:wardrobe_wooden_door",
|
||||
inv_size = {w=8,h=6}
|
||||
inv_size = {w=8,h=6},
|
||||
acc = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue