1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-01-11 10:30:25 +01:00

Updated homedecor mod to remove global vars and use meshs

This commit is contained in:
LeMagnesium 2015-01-28 15:37:59 +01:00
parent 5df7181ba9
commit 839fe273f1
27 changed files with 211 additions and 132 deletions

View File

@ -152,7 +152,6 @@ minetest.register_node("computer:monitor_on", {
on_rightclick = function ( pos, node, clicker, itemstack)
node.name = "computer:monitor";
minetest.set_node(pos, node);
nodeupdate(pos)
end
})
@ -286,7 +285,6 @@ minetest.register_node("computer:monitor", {
on_rightclick = function ( pos, node, clicker, itemstack)
node.name = "computer:monitor_on";
minetest.set_node(pos, node);
nodeupdate(pos)
end
})
@ -343,7 +341,6 @@ minetest.register_node("computer:tower_on", {
on_rightclick = function ( pos, node, clicker, itemstack)
node.name = "computer:tower";
minetest.set_node(pos, node);
nodeupdate(pos)
end
})
@ -375,7 +372,6 @@ minetest.register_node("computer:tower", {
on_rightclick = function ( pos, node, clicker, itemstack)
node.name = "computer:tower_on";
minetest.set_node(pos, node);
nodeupdate(pos)
end
})
@ -436,7 +432,6 @@ minetest.register_node("computer:server", {
on_rightclick = function ( pos, node, clicker, itemstack)
node.name = "computer:server_on";
minetest.set_node(pos, node);
nodeupdate(pos)
end,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
@ -478,6 +473,5 @@ minetest.register_node("computer:server_on", {
on_rightclick = function ( pos, node, clicker, itemstack)
node.name = "computer:server";
minetest.set_node(pos, node);
nodeupdate(pos)
end
})

View File

@ -31,7 +31,6 @@ computer.register = function ( name, def )
end
node.name = OFFSTATE;
minetest.set_node(pos, node);
nodeupdate(pos);
end;
});
minetest.register_node(OFFSTATE, {
@ -56,7 +55,6 @@ computer.register = function ( name, def )
end
node.name = ONSTATE;
minetest.set_node(pos, node);
nodeupdate(pos);
end;
drop = ONSTATE;
});

View File

@ -2746,6 +2746,24 @@ minetest.register_craft({
},
})
minetest.register_craft({
output = "homedecor:office_chair_basic",
recipe = {
{ "", "", "wool:black" },
{ "", "wool:black", "default:steel_ingot" },
{ "group:stick", "homedecor:pole_wrought_iron", "group:stick" }
},
})
minetest.register_craft({
output = "homedecor:office_chair_upscale",
recipe = {
{ "dye:black", "building_blocks:sticks", "group:wool" },
{ "homedecor:plastic_sheeting", "group:wool", "default:steel_ingot" },
{ "building_blocks:sticks", "homedecor:pole_wrought_iron", "building_blocks:sticks" }
},
})
minetest.register_craft({
output = "homedecor:wall_shelf 2",
recipe = {

View File

@ -623,7 +623,7 @@ homedecor.register("jpn_door_bottom", {
},
expand = { top = "homedecor:jpn_door_top" },
on_rightclick = function(pos, node, clicker)
fdir = minetest.get_node(pos).param2
local fdir = minetest.get_node(pos).param2
minetest.set_node(pos, {name = "homedecor:jpn_door_bottom_open", param2 = fdir})
minetest.set_node({x = pos.x, y=pos.y + 1, z = pos.z}, {name = "homedecor:jpn_door_top_open", param2 = fdir})
end
@ -689,7 +689,7 @@ minetest.register_node("homedecor:jpn_door_bottom_open", {
fixed = {-1.5, -0.5, -0.0625, 0.5, 1.5, 0},
},
on_rightclick = function(pos, node, clicker)
fdir = minetest.get_node(pos).param2
local fdir = minetest.get_node(pos).param2
minetest.set_node(pos, {name = "homedecor:jpn_door_bottom", param2 = fdir})
minetest.set_node({x = pos.x, y=pos.y + 1, z = pos.z}, {name = "homedecor:jpn_door_top", param2 = fdir})
end,

View File

@ -34,6 +34,46 @@ for _, i in ipairs(table_colors) do
})
end
local function sit(pos, node, clicker)
local name = clicker:get_player_name()
local meta = minetest:get_meta(pos)
local param2 = node.param2
if clicker:get_player_name() == meta:get_string("player") then
meta:set_string("player", "")
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
clicker:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(clicker, "stand", 30)
else
meta:set_string("player", clicker:get_player_name())
clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0})
clicker:set_physics_override(0, 0, 0)
default.player_attached[name] = true
if param2 == 1 then
clicker:set_look_yaw(7.9)
elseif param2 == 3 then
clicker:set_look_yaw(4.75)
elseif param2 == 0 then
clicker:set_look_yaw(3.15)
else
clicker:set_look_yaw(6.28)
end
end
end
local function sit_exec(pos, node, clicker) -- don't move these functions inside sit()
if not clicker or not clicker:is_player()
or clicker:get_player_control().up == true or clicker:get_player_control().down == true
or clicker:get_player_control().left == true or clicker:get_player_control().right == true
or clicker:get_player_control().jump == true then -- make sure that the player is immobile.
return end
sit(pos, node, clicker)
clicker:setpos(pos)
default.player_set_animation(clicker, "sit", 30)
end
local chaircolors = {
{ "", "plain" },
{ "black", "Black" },
@ -81,6 +121,10 @@ for i in ipairs(chaircolors) do
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
if color ~= "" then
@ -110,6 +154,11 @@ for i in ipairs(chaircolors) do
},
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0.1 -- player's sit position.
sit_exec(pos, node, clicker)
clicker:set_hp(20)
end,
})
minetest.register_craft({
@ -233,8 +282,8 @@ for _, color in ipairs(bedcolors) do
{-0.5, -0.5, -0.5, -0.375, 0.1875, -0.4375}, -- NodeBox1
{0.375, -0.5, -0.5, 0.5, 0.1875, -0.4375}, -- NodeBox2
{-0.5, 0, -0.5, 0.5, 0.125, -0.4375}, -- NodeBox3
{-0.5, -0.375, -0.5, 0.5, -0.125, 0.5}, -- NodeBox5
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5}, -- NodeBox6
{-0.5, -0.375, -0.5, 0.5, -0.125, 0.5}, -- NodeBox4
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5}, -- NodeBox5
}
},
selection_box = {
@ -346,15 +395,19 @@ homedecor.register("simple_bench", {
"homedecor_bench_large_2_left_back.png^[transformFX"
},
description = "Simple Bench",
groups = {snappy=3},
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.15, 0, 0.5, -0.05, 0.4},
{-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
{ 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
}
type = "fixed",
fixed = {
{-0.5, -0.15, 0, 0.5, -0.05, 0.4},
{-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
{ 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
}
},
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_1_left", {
@ -386,6 +439,10 @@ homedecor.register("bench_large_1_left", {
fixed = { -0.5, -0.5, -0.09375, 1.5, 0.5, 0.5 }
},
expand = { right="homedecor:bench_large_1_right" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_1_right", {
@ -452,6 +509,10 @@ homedecor.register("bench_large_2_left", {
fixed = { -0.5, -0.5, -0.15625, 1.5, 0.5, 0.5 }
},
expand = { right="homedecor:bench_large_2_right" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_2_right", {
@ -497,7 +558,7 @@ homedecor.register("deckchair_head", {
"homedecor_deckchair_sides.png",
"homedecor_deckchair_front.png"
},
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory = 1 },
node_box = {
type = "fixed",
fixed = {
@ -530,7 +591,7 @@ homedecor.register("deckchair_foot", {
},
description = "Deck chair",
inventory_image = "homedecor_deckchair_inv.png",
groups = { snappy = 3 },
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
@ -615,6 +676,62 @@ homedecor.register("grandfather_clock_top", {
selection_box = homedecor.nodebox.null,
})
homedecor.register("office_chair_upscale", {
description = "Office chair (upscale)",
drawtype = "mesh",
tiles = { "homedecor_office_chair_upscale.png" },
mesh = "homedecor_office_chair_upscale.obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
},
collision_box = {
type = "fixed",
fixed = {
{ -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
{ -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
{ -7/16, 1/16, -9/32, -5/16, 7/16, 6/16 }, -- right arm
{ 5/16, 1/16, -9/32, 7/16, 7/16, 6/16 }, -- left arm
{ -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
{ -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
}
},
expand = { top = "air" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y+0.14 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("office_chair_basic", {
description = "Office chair (basic)",
drawtype = "mesh",
tiles = { "homedecor_office_chair_basic.png" },
mesh = "homedecor_office_chair_basic.obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
},
collision_box = {
type = "fixed",
fixed = {
{ -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
{ -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
{ -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
{ -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
}
},
expand = { top = "air" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y+0.14 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
-- Aliases for 3dforniture mod.
minetest.register_alias("3dforniture:table", "homedecor:table")

View File

@ -111,13 +111,11 @@ function homedecor.register(name, def)
if expand then
def.on_place = def.on_place or function(itemstack, placer, pointed_thing)
if expand.top then
homedecor.stack_vertically(itemstack, placer, pointed_thing, itemstack:get_name(), expand.top)
end
if expand.right then
homedecor.stack_sideways(itemstack, placer, pointed_thing, itemstack:get_name(), expand.right, true)
end
if expand.forward then
homedecor.stack_sideways(itemstack, placer, pointed_thing, itemstack:get_name(), expand.forward, false)
return homedecor.stack_vertically(itemstack, placer, pointed_thing, itemstack:get_name(), expand.top)
elseif expand.right then
return homedecor.stack_sideways(itemstack, placer, pointed_thing, itemstack:get_name(), expand.right, true)
elseif expand.forward then
return homedecor.stack_sideways(itemstack, placer, pointed_thing, itemstack:get_name(), expand.forward, false)
end
end
def.after_dig_node = def.after_dig_node or function(pos, oldnode, oldmetadata, digger)

View File

@ -349,7 +349,6 @@ local function reg_lamp(suffix, nxt, tilesuffix, light, color)
on_punch = function(pos, node, puncher)
node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node)
nodeupdate(pos)
end,
})
@ -370,7 +369,6 @@ local function reg_lamp(suffix, nxt, tilesuffix, light, color)
on_punch = function(pos, node, puncher)
node.name = "homedecor:standing_lamp"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node)
nodeupdate(pos)
end,
expand = { top="air" },
})

View File

@ -498,36 +498,20 @@ homedecor.register("pool_table_2", {
selection_box = homedecor.nodebox.null,
})
local trash_cbox = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.125, 0.25 }
}
homedecor.register("trash_can", {
tiles = {
"homedecor_trashcan_tb.png",
"homedecor_trashcan_tb.png",
"homedecor_trashcan_sides.png",
"homedecor_trashcan_sides.png",
"homedecor_trashcan_sides.png",
"homedecor_trashcan_sides.png"
},
inventory_image = "homedecor_trashcan_inv.png",
drawtype = "mesh",
mesh = "homedecor_trash_can.obj",
tiles = { "homedecor_trash_can.png" },
inventory_image = "homedecor_trash_can_inv.png",
description = "Trash Can",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.125, -0.1875, 0.125, 0.125}, -- NodeBox1
{0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.5, -0.25, 0.125, 0.125, -0.1875}, -- NodeBox3
{-0.125, -0.5, 0.1875, 0.125, 0.125, 0.25}, -- NodeBox4
{-0.1875, -0.5, 0.125, -0.125, 0.125, 0.1875}, -- NodeBox5
{-0.1875, -0.5, -0.1875, -0.125, 0.125, -0.125}, -- NodeBox6
{0.125, -0.5, -0.1875, 0.1875, 0.125, -0.125}, -- NodeBox7
{0.125, -0.5, 0.125, 0.1875, 0.125, 0.1875}, -- NodeBox8
{-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875}, -- NodeBox9
}
},
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.125, 0.25 }
}
selection_box = trash_cbox,
collision_box = trash_cbox,
})
homedecor.register("well_base", {
@ -667,47 +651,23 @@ homedecor.register("coat_tree", {
},
})
local cutlery_cbox = {
type = "fixed",
fixed = {
{ -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 },
{ -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 }
}
}
homedecor.register("cutlery_set", {
tiles = {
"homedecor_cutlery_set_top.png",
"homedecor_cutlery_set_sides.png",
"homedecor_cutlery_set_sides.png"
},
drawtype = "mesh",
mesh = "homedecor_cutlery_set.obj",
tiles = { "homedecor_cutlery_set.png" },
inventory_image = "homedecor_cutlery_set_inv.png",
description = "Cutlery set",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.4375, 0.125, -0.49, -0.1875}, -- NodeBox1
{0.035, -0.5, -0.12, 0.042, -0.375, -0.036}, -- NodeBox2
{-0.042, -0.5, -0.12, -0.035, -0.375, -0.036}, -- NodeBox3
{-0.042, -0.5, -0.12, 0.042, -0.375, -0.112}, -- NodeBox4
{-0.042, -0.5, -0.044, 0.042, -0.375, -0.036}, -- NodeBox5
{-0.042, -0.40, -0.12, 0.042, -0.5, -0.036}, -- NodeBox6
{-0.22, -0.5, -0.45, -0.205, -0.49, -0.245}, -- NodeBox7
{-0.23, -0.5, -0.245, -0.195, -0.49, -0.24}, -- NodeBox8
{-0.23, -0.5, -0.24, -0.225, -0.49, -0.1875}, -- NodeBox9
{-0.22, -0.5, -0.24, -0.215, -0.49, -0.1875}, -- NodeBox10
{-0.21, -0.5, -0.24, -0.205, -0.49, -0.1875}, -- NodeBox11
{-0.2, -0.5, -0.24, -0.195, -0.49, -0.1875}, -- NodeBox12
{0.205, -0.5, -0.45, 0.22, -0.49, -0.3125}, -- NodeBox13
{0.193, -0.5, -0.3125, 0.22, -0.49, -0.185839}, -- NodeBox14
{0.2, -0.5, -0.322, 0.22, -0.49, -0.175}, -- NodeBox15
{-0.1095, -0.5, -0.1875, 0.1095, -0.48, -0.172}, -- NodeBox16
{-0.1095, -0.5, -0.453, 0.1095, -0.48, -0.4375}, -- NodeBox17
{-0.14, -0.5, -0.422, -0.125, -0.48, -0.203}, -- NodeBox18
{0.125, -0.5, -0.422, 0.14, -0.48, -0.203}, -- NodeBox19
{-0.125, -0.5, -0.203, -0.1095, -0.48, -0.1875}, -- NodeBox20
{0.1095, -0.5, -0.203, 0.125, -0.48, -0.1875}, -- NodeBox21
{-0.125, -0.5, -0.4375, -0.1095, -0.48, -0.422}, -- NodeBox22
{0.1095, -0.5, -0.4375, 0.125, -0.48, -0.422}, -- NodeBox23
}
},
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.5, 0.25, -0.375, 0 }
}
selection_box = cutlery_cbox,
collision_box = cutlery_cbox
})
local bottle_cbox = {
@ -1090,33 +1050,21 @@ homedecor.register("beer_tap", {
end
})
local beer_cbox = {
type = "fixed",
fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 }
}
homedecor.register("beer_mug", {
description = "Beer mug",
tiles = {
"homedecor_beer_top.png",
"homedecor_beer_bottom.png",
"homedecor_beer_right.png",
"homedecor_beer_right.png^[transformFX",
"homedecor_beer_front.png^[transformFX",
"homedecor_beer_front.png"
},
inventory_image = "homedecor_beer_inv.png",
use_texture_alpha = true,
drawtype = "mesh",
mesh = "homedecor_beer_mug.obj",
tiles = { "homedecor_beer_mug.png" },
inventory_image = "homedecor_beer_mug_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
sounds = default.node_sound_glass_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.25, 0.0625, -0.25, -0.0625}, -- NodeBox1
{0.0625, -0.3125, -0.18, 0.135, -0.285, -0.14}, -- NodeBox2
{0.1, -0.465, -0.18, 0.135, -0.285, -0.14}, -- NodeBox3
{0.0625, -0.465, -0.18, 0.135, -0.4375, -0.14}, -- NodeBox4
}
},
selection_box = {
type = "fixed",
fixed = { -0.125, -0.5, -0.25, 0.135, -0.25, -0.0625 }
}
selection_box = beer_cbox,
collision_box = beer_cbox
})
homedecor.register("tool_cabinet_bottom", {

View File

@ -16,25 +16,33 @@ local shutters = {
{"white", "White"},
}
local shutter_cbox = {
type = "wallmounted",
wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 },
}
for i in ipairs(shutters) do
local name = shutters[i][1]
local desc = shutters[i][2]
homedecor.register("shutter_"..name, {
mesh = "homedecor_window_shutter.obj",
tiles = { "homedecor_window_shutter_"..name..".png" },
description = S("Wooden Shutter ("..desc..")"),
inventory_image = "homedecor_window_shutter_"..name.."_inv.png",
wield_image = "homedecor_window_shutter_"..name.."_inv.png",
paramtype = "light",
paramtype2 = "wallmounted",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "wallmounted",
-- wall_side = { -0.5, -0.5, 0.44, 0.5, 0.5, 0.5 }
},
})
homedecor.register("shutter_"..name, {
mesh = "homedecor_window_shutter.obj",
tiles = { "homedecor_window_shutter_"..name..".png" },
description = S("Wooden Shutter ("..desc..")"),
inventory_image = "homedecor_window_shutter_"..name.."_inv.png",
wield_image = "homedecor_window_shutter_"..name.."_inv.png",
paramtype = "light",
paramtype2 = "wallmounted",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = shutter_cbox,
node_box = shutter_cbox,
-- collision_box doesn't accept type="wallmounted", but node_box
-- does. Said nodeboxes create a custom collision box but are
-- invisible themselves because drawtype="mesh".
})
end
minetest.register_alias("homedecor:shutter_purple", "homedecor:shutter_violet")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B