2014-07-18 16:22:44 +02:00
|
|
|
-- Nodes that would affect the local temperature e.g. fans, heater, A/C
|
|
|
|
|
|
|
|
local S = homedecor.gettext
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("air_conditioner", {
|
2014-07-18 16:22:44 +02:00
|
|
|
description = S("Air Conditioner"),
|
2015-05-08 00:05:46 +02:00
|
|
|
mesh = "homedecor_ac.obj",
|
|
|
|
tiles = {
|
|
|
|
"homedecor_ac.png",
|
|
|
|
"default_glass.png"
|
|
|
|
},
|
2014-07-18 16:22:44 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2015-01-23 17:40:57 +01:00
|
|
|
selection_box = { type="regular" },
|
2014-07-18 16:22:44 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- fans
|
|
|
|
|
2014-07-18 15:01:00 +02:00
|
|
|
minetest.register_entity("homedecor:mesh_desk_fan", {
|
2015-01-23 17:40:57 +01:00
|
|
|
collisionbox = homedecor.nodebox.null,
|
|
|
|
visual = "mesh",
|
2014-07-18 15:01:00 +02:00
|
|
|
mesh = "homedecor_desk_fan.b3d",
|
2015-01-23 17:40:57 +01:00
|
|
|
textures = {"homedecor_desk_fan_uv.png"},
|
2014-07-18 15:01:00 +02:00
|
|
|
visual_size = {x=10, y=10},
|
|
|
|
})
|
|
|
|
|
2017-01-09 06:01:33 +01:00
|
|
|
local add_mesh_desk_fan_entity = function(pos)
|
|
|
|
print("in add_mesh_desk_fan_entity()")
|
|
|
|
local param2 = minetest.get_node(pos).param2
|
|
|
|
local entity = minetest.add_entity(pos, "homedecor:mesh_desk_fan")
|
|
|
|
if param2 == 0 then
|
|
|
|
entity:setyaw(3.142) -- 180 degrees
|
|
|
|
elseif minetest.get_node(pos).param2 == 1 then
|
|
|
|
entity:setyaw(3.142/2) -- 90 degrees
|
|
|
|
elseif minetest.get_node(pos).param2 == 3 then
|
|
|
|
entity:setyaw((-3.142/2)) -- 270 degrees
|
|
|
|
else
|
|
|
|
entity:setyaw(0)
|
|
|
|
end
|
|
|
|
return entity
|
|
|
|
end
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("desk_fan", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Desk Fan"),
|
2014-07-18 15:01:00 +02:00
|
|
|
groups = {oddly_breakable_by_hand=2},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.1875, -0.5, -0.1875, 0.1875, -0.375, 0.1875}, -- NodeBox1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tiles = {"homedecor_desk_fan_body.png"},
|
|
|
|
inventory_image = "homedecor_desk_fan_inv.png",
|
|
|
|
wield_image = "homedecor_desk_fan_inv.png",
|
2015-01-23 17:40:57 +01:00
|
|
|
selection_box = { type = "regular" },
|
2015-05-14 12:25:11 +02:00
|
|
|
on_rotate = screwdriver.disallow,
|
2014-07-18 15:01:00 +02:00
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("active", "no")
|
2017-01-09 06:01:33 +01:00
|
|
|
add_mesh_desk_fan_entity(pos)
|
2014-07-18 15:01:00 +02:00
|
|
|
end,
|
|
|
|
on_punch = function(pos)
|
2017-01-09 06:01:33 +01:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local entities = minetest.get_objects_inside_radius(pos, 0.1)
|
|
|
|
local entity = entities[1] or add_mesh_desk_fan_entity(pos)
|
|
|
|
if meta:get_string("active") == "no" then
|
|
|
|
meta:set_string("active", "yes")
|
|
|
|
entity:set_animation({x=0,y=96}, 24, 0)
|
|
|
|
else
|
|
|
|
meta:set_string("active", "no")
|
|
|
|
entity:set_animation({x=0,y=0}, 1, 0)
|
2014-07-18 15:01:00 +02:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2017-01-09 06:01:33 +01:00
|
|
|
local entities = minetest.get_objects_inside_radius(pos, 0.1)
|
|
|
|
if entities[1] then entities[1]:remove() end
|
2014-07-18 15:01:00 +02:00
|
|
|
end,
|
|
|
|
})
|
2014-07-18 16:22:44 +02:00
|
|
|
|
2014-08-20 21:01:41 +02:00
|
|
|
-- ceiling fan
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("ceiling_fan", {
|
2014-08-20 21:01:41 +02:00
|
|
|
description = S("Ceiling Fan"),
|
|
|
|
tiles = {
|
|
|
|
{ name="homedecor_ceiling_fan_top.png",
|
|
|
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.5} },
|
|
|
|
{ name="homedecor_ceiling_fan_bottom.png",
|
|
|
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.5} },
|
|
|
|
'homedecor_ceiling_fan_sides.png',
|
|
|
|
},
|
|
|
|
inventory_image = "homedecor_ceiling_fan_inv.png",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -0.5, 0.495, -0.5, 0.5, 0.495, 0.5 },
|
|
|
|
{ -0.0625, 0.375, -0.0625, 0.0625, 0.5, 0.0625 }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
groups = { snappy = 3 },
|
2016-07-31 01:23:10 +02:00
|
|
|
light_source = default.LIGHT_MAX-1,
|
2015-04-29 14:14:36 +02:00
|
|
|
sounds = default.node_sound_glass_defaults(),
|
2014-08-20 21:01:41 +02:00
|
|
|
})
|
|
|
|
|
2014-08-08 21:13:47 +02:00
|
|
|
-- heating devices
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("space_heater", {
|
2014-08-08 21:13:47 +02:00
|
|
|
description = S("Space heater"),
|
|
|
|
tiles = { 'homedecor_heater_tb.png',
|
|
|
|
'homedecor_heater_tb.png',
|
|
|
|
'homedecor_heater_sides.png',
|
|
|
|
'homedecor_heater_sides.png',
|
|
|
|
'homedecor_heater_back.png',
|
|
|
|
'homedecor_heater_front.png'
|
|
|
|
},
|
|
|
|
inventory_image = "homedecor_heater_inv.png",
|
2015-04-29 14:14:36 +02:00
|
|
|
walkable = false,
|
2014-08-08 21:13:47 +02:00
|
|
|
groups = { snappy = 3 },
|
2015-04-29 14:14:36 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-08-08 21:13:47 +02:00
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.1875, -0.5, 0.0625, 0.1875, 0, 0.3125},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.1875, -0.5, 0.0625, 0.1875, 0, 0.3125}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2015-08-19 15:49:32 +02:00
|
|
|
local r_cbox = homedecor.nodebox.slab_z(-0.25)
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("radiator", {
|
2015-04-15 04:44:37 +02:00
|
|
|
mesh = "homedecor_radiator.obj",
|
|
|
|
tiles = {
|
2015-05-04 00:30:56 +02:00
|
|
|
"homedecor_generic_metal_black.png^[colorize:#ffffff:200",
|
2015-04-15 04:44:37 +02:00
|
|
|
"homedecor_radiator_controls.png"
|
|
|
|
},
|
2014-08-08 21:13:47 +02:00
|
|
|
inventory_image = "homedecor_radiator_inv.png",
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Radiator heater"),
|
2015-01-23 22:14:00 +01:00
|
|
|
groups = {snappy=3},
|
2015-04-15 04:44:37 +02:00
|
|
|
selection_box = r_cbox,
|
|
|
|
collision_box = r_cbox,
|
2015-04-29 14:14:36 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-08-08 21:13:47 +02:00
|
|
|
})
|