forked from mtcontrib/homedecor_modpack
desk fans (YAHN)
uses new fan blades object for recipe
This commit is contained in:
parent
6518120958
commit
f73cfa1cf5
@ -87,6 +87,11 @@ minetest.register_craftitem("homedecor:speaker_driver", {
|
||||
inventory_image = "homedecor_speaker_driver.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("homedecor:fan_blades", {
|
||||
description = S("Fan blades"),
|
||||
inventory_image = "homedecor_fan_blades.png"
|
||||
})
|
||||
|
||||
-- alternate crafting if mesecons is/isn't installed
|
||||
|
||||
if not minetest.get_modpath("mesecons") then
|
||||
@ -129,6 +134,15 @@ minetest.register_alias("homedecor:brass_ingot", "technic:brass_ingot")
|
||||
|
||||
-- the actual crafts
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "homedecor:fan_blades 2",
|
||||
recipe = {
|
||||
{ "", "homedecor:plastic_sheeting", "" },
|
||||
{ "", "default:steel_ingot", "" },
|
||||
{ "homedecor:plastic_sheeting", "", "homedecor:plastic_sheeting" }
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "homedecor:steel_wire 4",
|
||||
recipe = {
|
||||
@ -2068,3 +2082,11 @@ minetest.register_craft( {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "homedecor:desk_fan",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "homedecor:fan_blades", "homedecor:motor"},
|
||||
{"", "default:steel_ingot", ""}
|
||||
},
|
||||
})
|
||||
|
||||
|
85
homedecor/fans.lua
Normal file
85
homedecor/fans.lua
Normal file
@ -0,0 +1,85 @@
|
||||
minetest.register_entity("homedecor:mesh_desk_fan", {
|
||||
collisionbox = { 0, 0, 0, 0, 0, 0 },
|
||||
visual = "mesh",
|
||||
mesh = "homedecor_desk_fan.b3d",
|
||||
textures = {"homedecor_desk_fan_uv.png"},
|
||||
visual_size = {x=10, y=10},
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:desk_fan", {
|
||||
description = "Desk Fan",
|
||||
drawtype = "nodebox",
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
paramtype = "light",
|
||||
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",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("active", "no")
|
||||
print (meta:get_string("active"))
|
||||
if entity_remove[1] == nil then
|
||||
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "homedecor:mesh_desk_fan") --+(0.0625*10)
|
||||
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
if minetest.get_node(pos).param2 == 0 then --list of rad to 90 degree: 3.142/2 = 90; 3.142 = 180; 3*3.142 = 270
|
||||
entity_remove[1]:setyaw(3.142)
|
||||
elseif minetest.get_node(pos).param2 == 1 then
|
||||
entity_remove[1]:setyaw(3.142/2)
|
||||
elseif minetest.get_node(pos).param2 == 3 then
|
||||
entity_remove[1]:setyaw((-3.142/2))
|
||||
else
|
||||
entity_remove[1]:setyaw(0)
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_punch = function(pos)
|
||||
local entity_anim = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
local speedy_meta = minetest.get_meta(pos)
|
||||
if speedy_meta:get_string("active") == "no" then
|
||||
speedy_meta:set_string("active", "yes")
|
||||
print (speedy_meta:get_string("active"))
|
||||
elseif speedy_meta:get_string("active") == "yes" then
|
||||
speedy_meta:set_string("active", "no")
|
||||
print (speedy_meta:get_string("active"))
|
||||
end
|
||||
|
||||
if entity_anim[1] == nil then
|
||||
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "homedecor:mesh_desk_fan") --+(0.0625*10)
|
||||
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
if minetest.get_node(pos).param2 == 0 then --list of rad to 90 degree: 3.142/2 = 90; 3.142 = 180; 3*3.142 = 270
|
||||
entity_remove[1]:setyaw(3.142)
|
||||
elseif minetest.get_node(pos).param2 == 1 then
|
||||
entity_remove[1]:setyaw(3.142/2)
|
||||
elseif minetest.get_node(pos).param2 == 3 then
|
||||
entity_remove[1]:setyaw((-3.142/2))
|
||||
else
|
||||
entity_remove[1]:setyaw(0)
|
||||
end
|
||||
end
|
||||
local entity_anim = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
if minetest.get_meta(pos):get_string("active") == "no" then
|
||||
entity_anim[1]:set_animation({x=0,y=0}, 1, 0)
|
||||
elseif minetest.get_meta(pos):get_string("active") == "yes" then
|
||||
entity_anim[1]:set_animation({x=0,y=96}, 24, 0)
|
||||
end
|
||||
end,
|
||||
after_dig_node = function(pos)
|
||||
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
entity_remove[1]:remove()
|
||||
end,
|
||||
})
|
@ -99,7 +99,10 @@ dofile(homedecor.modpath.."/furniture.lua")
|
||||
dofile(homedecor.modpath.."/furniture_medieval.lua")
|
||||
dofile(homedecor.modpath.."/furniture_bathroom.lua")
|
||||
dofile(homedecor.modpath.."/furniture_recipes.lua")
|
||||
dofile(homedecor.modpath.."/fans.lua")
|
||||
|
||||
dofile(homedecor.modpath.."/locked.lua")
|
||||
|
||||
|
||||
|
||||
print("[HomeDecor] "..S("Loaded!"))
|
||||
|
BIN
homedecor/models/homedecor_desk_fan.b3d
Normal file
BIN
homedecor/models/homedecor_desk_fan.b3d
Normal file
Binary file not shown.
BIN
homedecor/models/homedecor_desk_fan_uv.png
Normal file
BIN
homedecor/models/homedecor_desk_fan_uv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
BIN
homedecor/textures/homedecor_desk_fan_body.png
Normal file
BIN
homedecor/textures/homedecor_desk_fan_body.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 419 B |
BIN
homedecor/textures/homedecor_desk_fan_inv.png
Normal file
BIN
homedecor/textures/homedecor_desk_fan_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
homedecor/textures/homedecor_fan_blades.png
Normal file
BIN
homedecor/textures/homedecor_fan_blades.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 627 B |
Loading…
Reference in New Issue
Block a user