Version MFF.

This commit is contained in:
sys4-fr
2018-09-07 22:32:38 +02:00
parent 2d0363f3ac
commit a11527ed63
1027 changed files with 8090 additions and 37753 deletions

115
homedecor/handlers/expansion.lua Normal file → Executable file
View File

@ -1,5 +1,4 @@
local S = homedecor_i18n.gettext
local S = homedecor.gettext
-- vectors to place one node next to or behind another
@ -24,38 +23,9 @@ homedecor.fdir_to_fwd = {
{ -1, 0 },
}
-- special case for wallmounted nodes
homedecor.wall_fdir_to_right = {
nil,
nil,
{ -1, 0 },
{ 1, 0 },
{ 0, -1 },
{ 0, 1 },
}
homedecor.wall_fdir_to_left = {
nil,
nil,
{ 1, 0 },
{ -1, 0 },
{ 0, 1 },
{ 0, -1 },
}
homedecor.wall_fdir_to_fwd = {
nil,
nil,
{ 0, -1 },
{ 0, 1 },
{ 1, 0 },
{ -1, 0 },
}
local placeholder_node = "homedecor:expansion_placeholder"
minetest.register_node(placeholder_node, {
description = S("Expansion placeholder (you hacker you!)"),
description = "Expansion placeholder (you hacker you!)",
groups = { not_in_creative_inventory=1 },
drawtype = "airlike",
paramtype = "light",
@ -97,8 +67,8 @@ end
local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
local placer_name = placer:get_player_name() or ""
if is_buildable_to(placer_name, pos, pos2) then
local lfdir = fdir or minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, { name = node1, param2 = lfdir })
local fdir = fdir or minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, { name = node1, param2 = fdir })
node2 = node2 or "air" -- this can be used to clear buildable_to nodes even though we are using a multinode mesh
-- do not assume by default, as we still might want to allow overlapping in some cases
local has_facedir = node2 ~= "air"
@ -106,7 +76,7 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
has_facedir = false
node2 = placeholder_node
end
minetest.set_node(pos2, { name = node2, param2 = (has_facedir and lfdir) or nil })
minetest.set_node(pos2, { name = node2, param2 = (has_facedir and fdir) or nil })
-- call after_place_node of the placed node if available
local ctrl_node_def = minetest.registered_nodes[node1]
@ -121,18 +91,18 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
return itemstack
end
local function rightclick_pointed_thing(pos, placer, itemstack, pointed_thing)
local function rightclick_pointed_thing(pos, placer, itemstack)
local node = minetest.get_node_or_nil(pos)
if not node then return false end
local def = minetest.registered_nodes[node.name]
if not def or not def.on_rightclick then return false end
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack
return def.on_rightclick(pos, node, placer, itemstack) or itemstack
end
-- Stack one node above another
-- leave the last argument nil if it's one 2m high node
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing)
@ -147,7 +117,7 @@ end
-- like homedecor.stack_vertically but tests first if it was placed as a right wing, then uses node1_right and node2_right instead
function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, node1_right, node2_right)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing)
@ -166,7 +136,7 @@ function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, no
end
function homedecor.stack_sideways(itemstack, placer, pointed_thing, node1, node2, dir)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing)
@ -180,13 +150,13 @@ function homedecor.stack_sideways(itemstack, placer, pointed_thing, node1, node2
return stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
end
function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks)
function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color)
local thisnode = minetest.get_node(pos)
local fdir = thisnode.param2
local fxd = homedecor.wall_fdir_to_fwd[fdir+1][1]
local fzd = homedecor.wall_fdir_to_fwd[fdir+1][2]
local fxd = homedecor.fdir_to_fwd[fdir+1][1]
local fzd = homedecor.fdir_to_fwd[fdir+1][2]
local forwardpos = {x=pos.x+fxd, y=pos.y, z=pos.z+fzd}
local forwardnode = minetest.get_node(forwardpos)
@ -195,65 +165,70 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
local placer_name = placer:get_player_name()
if not (def and def.buildable_to) then
minetest.chat_send_player( placer:get_player_name(),
S("Not enough room - the space for the headboard is occupied!"))
minetest.chat_send_player( placer:get_player_name(), "Not enough room - the space for the headboard is occupied!" )
minetest.set_node(pos, {name = "air"})
return true
end
if minetest.is_protected(forwardpos, placer_name) then
minetest.chat_send_player( placer:get_player_name(),
S("Someone already owns the spot where the headboard goes."))
minetest.chat_send_player( placer:get_player_name(), "Someone already owns the spot where the headboard goes." )
return true
end
minetest.set_node(forwardpos, {name = "air"})
local lxd = homedecor.wall_fdir_to_left[fdir+1][1]
local lzd = homedecor.wall_fdir_to_left[fdir+1][2]
local lxd = homedecor.fdir_to_left[fdir+1][1]
local lzd = homedecor.fdir_to_left[fdir+1][2]
local leftpos = {x=pos.x+lxd, y=pos.y, z=pos.z+lzd}
local leftnode = minetest.get_node(leftpos)
local rxd = homedecor.wall_fdir_to_right[fdir+1][1]
local rzd = homedecor.wall_fdir_to_right[fdir+1][2]
local rxd = homedecor.fdir_to_right[fdir+1][1]
local rzd = homedecor.fdir_to_right[fdir+1][2]
local rightpos = {x=pos.x+rxd, y=pos.y, z=pos.z+rzd}
local rightnode = minetest.get_node(rightpos)
if leftnode.name == "homedecor:bed_regular" then
if leftnode.name == "homedecor:bed_"..color.."_regular" then
local newname = string.gsub(thisnode.name, "_regular", "_kingsize")
minetest.set_node(pos, {name = "air"})
minetest.set_node(leftpos, { name = newname, param2 = fdir})
elseif rightnode.name == "homedecor:bed_regular" then
elseif rightnode.name == "homedecor:bed_"..color.."_regular" then
local newname = string.gsub(thisnode.name, "_regular", "_kingsize")
minetest.set_node(rightpos, {name = "air"})
minetest.set_node(pos, { name = newname, param2 = fdir})
end
local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z}
local topposfwd = {x=toppos.x+fxd, y=toppos.y, z=toppos.z+fzd}
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
local bottomnode = minetest.get_node({x=pos.x, y=pos.y-1.0, z=pos.z})
if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then
local newname = string.gsub(thisnode.name, "_regular", "_extended")
minetest.set_node(toppos, { name = thisnode.name, param2 = fdir})
minetest.set_node(pos, { name = newname, param2 = fdir})
itemstack:take_item()
if string.find(topnode.name, "homedecor:bed_.*_regular$") then
if fdir == topnode.param2 then
local newname = string.gsub(thisnode.name, "_regular", "_extended")
minetest.set_node(pos, { name = newname, param2 = fdir})
end
end
if string.find(bottomnode.name, "homedecor:bed_.*_regular$") then
if fdir == bottomnode.param2 then
local newname = string.gsub(bottomnode.name, "_regular", "_extended")
minetest.set_node({x=pos.x, y=pos.y-1.0, z=pos.z}, { name = newname, param2 = fdir})
end
end
end
function homedecor.unextend_bed(pos)
function homedecor.unextend_bed(pos, color)
local bottomnode = minetest.get_node({x=pos.x, y=pos.y-1.0, z=pos.z})
local fdir = bottomnode.param2
if bottomnode.name == "homedecor:bed_extended" then
if string.find(bottomnode.name, "homedecor:bed_.*_extended$") then
local newname = string.gsub(bottomnode.name, "_extended", "_regular")
minetest.set_node({x=pos.x, y=pos.y-1.0, z=pos.z}, { name = newname, param2 = fdir})
end
end
function homedecor.place_banister(itemstack, placer, pointed_thing)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
if rightclick_result then return rightclick_result end
local pos, _ = select_node(pointed_thing)
local pos, def = select_node(pointed_thing)
if not pos then return itemstack end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
@ -265,12 +240,12 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
local placer_name = placer:get_player_name()
if not (adef and adef.buildable_to) then
minetest.chat_send_player(placer_name, S("Not enough room - the upper space is occupied!" ))
minetest.chat_send_player(placer_name, "Not enough room - the upper space is occupied!" )
return itemstack
end
if minetest.is_protected(abovepos, placer_name) then
minetest.chat_send_player(placer_name, S("Someone already owns that spot."))
minetest.chat_send_player(placer_name, "Someone already owns that spot." )
return itemstack
end
@ -295,19 +270,20 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
local left_fwd_below_pos = { x=pos.x+lxd+fxd, y=pos.y-1, z=pos.z+lzd+fzd }
local below_node = minetest.get_node(below_pos)
--local fwd_node = minetest.get_node(fwd_pos)
local fwd_node = minetest.get_node(fwd_pos)
local left_node = minetest.get_node(left_pos)
local right_node = minetest.get_node(right_pos)
local left_fwd_node = minetest.get_node(left_fwd_pos)
local right_fwd_node = minetest.get_node(right_fwd_pos)
local left_below_node = minetest.get_node({x=left_pos.x, y=left_pos.y-1, z=left_pos.z})
local right_below_node = minetest.get_node({x=right_pos.x, y=right_pos.y-1, z=right_pos.z})
--local right_fwd_above_node = minetest.get_node(right_fwd_above_pos)
--local left_fwd_above_node = minetest.get_node(left_fwd_above_pos)
local right_fwd_above_node = minetest.get_node(right_fwd_above_pos)
local left_fwd_above_node = minetest.get_node(left_fwd_above_pos)
local right_fwd_below_node = minetest.get_node(right_fwd_below_pos)
local left_fwd_below_node = minetest.get_node(left_fwd_below_pos)
local new_place_name = itemstack:get_name()
local n = 0
-- try to place a diagonal one on the side of blocks stacked like stairs
-- or follow an existing diagonal with another.
@ -383,3 +359,4 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
itemstack:take_item()
return itemstack
end

50
homedecor/handlers/furnaces.lua Normal file → Executable file
View File

@ -1,6 +1,6 @@
-- This code supplies an oven/stove. Basically it's just a copy of the default furnace with different textures.
local S = homedecor_i18n.gettext
local S = homedecor.gettext
local function swap_node(pos, name)
local node = minetest.get_node(pos)
@ -30,11 +30,7 @@ local function make_formspec(furnacedef, percent)
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;"..w..","..h..";]"..
"list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"
"list[current_player;main;0,5;8,4;]"
end
--[[
@ -88,7 +84,7 @@ function homedecor.register_furnace(name, furnacedef)
furnacedef.cook_speed = furnacedef.cook_speed or 1
local description = furnacedef.description or S("Furnace")
local description = furnacedef.description or "Furnace"
local furnace_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -106,7 +102,7 @@ function homedecor.register_furnace(name, furnacedef)
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("@1 (empty)", description))
meta:set_string("infotext", S("%s is empty"):format(description))
end
return stack:get_count()
else
@ -125,7 +121,7 @@ function homedecor.register_furnace(name, furnacedef)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("@1 (empty)", description))
meta:set_string("infotext", S("%s is empty"):format(description))
end
return count
else
@ -151,7 +147,7 @@ function homedecor.register_furnace(name, furnacedef)
}
local def_active = {
description = S("@1 (active)", description),
description = description .. " (active)",
tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),
light_source = 8,
drop = "homedecor:" .. name,
@ -171,28 +167,28 @@ function homedecor.register_furnace(name, furnacedef)
end
end
local n_active = name.."_active"
local name_active = name.."_active"
homedecor.register(name, def)
homedecor.register(n_active, def_active)
homedecor.register(name_active, def_active)
local nname, name_active = "homedecor:"..name, "homedecor:"..n_active
local name, name_active = "homedecor:"..name, "homedecor:"..name_active
minetest.register_abm({
nodenames = {nname, name_active, nname.."_locked", name_active.."_locked"},
nodenames = {name, name_active, name.."_locked", name_active.."_locked"},
label = "furnaces",
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
for i, pname in ipairs({
for i, name in ipairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time"
}) do
if meta:get_string(pname) == "" then
meta:set_float(pname, 0.0)
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
@ -226,12 +222,12 @@ function homedecor.register_furnace(name, furnacedef)
-- XXX: Quick patch, make it better in the future.
local locked = node.name:find("_locked$") and "_locked" or ""
local desc = minetest.registered_nodes[nname..locked].description
local desc = minetest.registered_nodes[name..locked].description
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext", S("@1 (active: @2%)", desc, percent))
meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent))
swap_node(pos,name_active..locked)
meta:set_string("formspec", make_formspec(furnacedef, percent))
return
@ -239,9 +235,9 @@ function homedecor.register_furnace(name, furnacedef)
local fuel = nil
local afterfuel
cooked = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
srclist = inv:get_list("src")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
@ -251,24 +247,24 @@ function homedecor.register_furnace(name, furnacedef)
end
if (not fuel) or (fuel.time <= 0) then
meta:set_string("infotext", S("@1 (out of fuel)", desc))
swap_node(pos, nname..locked)
meta:set_string("infotext",desc..S(": Out of fuel"))
swap_node(pos, name..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
end
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext", S("@1 (empty)", desc))
swap_node(pos, nname..locked)
meta:set_string("infotext",S("%s is empty"):format(desc))
swap_node(pos, name..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
end
return
end
if not inv:room_for_item("dst", cooked.item) then
meta:set_string("infotext", S("@1 (output bins are full)", desc))
swap_node(pos, nname..locked)
meta:set_string("infotext", desc..S(": output bins are full"))
swap_node(pos, name..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
end

0
homedecor/handlers/init.lua Normal file → Executable file
View File

90
homedecor/handlers/inventory.lua Normal file → Executable file
View File

@ -1,5 +1,4 @@
local S = homedecor_i18n.gettext
local S = homedecor.gettext
local default_can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
@ -9,47 +8,38 @@ end
local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots
local default_inventory_formspecs = {
["4"]="size[8,6]".. background ..
"list[context;main;2,0;4,1;]" ..
"list[current_player;main;0,2;8,4;]" ..
"listring[]",
"list[context;main;2,0;4,1;]"..
"list[current_player;main;0,2;8,4;]",
["6"]="size[8,6]".. background ..
"list[context;main;1,0;6,1;]"..
"list[current_player;main;0,2;8,4;]" ..
"listring[]",
"list[current_player;main;0,2;8,4;]",
["8"]="size[8,6]".. background ..
"list[context;main;0,0;8,1;]"..
"list[current_player;main;0,2;8,4;]" ..
"listring[]",
"list[current_player;main;0,2;8,4;]",
["12"]="size[8,7]".. background ..
"list[context;main;1,0;6,2;]"..
"list[current_player;main;0,3;8,4;]" ..
"listring[]",
"list[current_player;main;0,3;8,4;]",
["16"]="size[8,7]".. background ..
"list[context;main;0,0;8,2;]"..
"list[current_player;main;0,3;8,4;]" ..
"listring[]",
"list[current_player;main;0,3;8,4;]",
["24"]="size[8,8]".. background ..
"list[context;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]" ..
"listring[]",
"list[current_player;main;0,4;8,4;]",
["32"]="size[8,9]".. background ..
"list[context;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
"listring[context;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85),
["50"]="size[10,10]".. background ..
"list[context;main;0,0;10,5;]"..
"list[current_player;main;1,6;8,4;]" ..
"listring[]",
"list[current_player;main;1,6;8,4;]",
}
local function get_formspec_by_size(size)
@ -85,18 +75,18 @@ function homedecor.handle_inventory(name, def, original_def)
def.can_dig = def.can_dig or default_can_dig
def.on_metadata_inventory_move = def.on_metadata_inventory_move or function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", S("@1 moves stuff in @2 at @3",
minetest.log("action", S("%s moves stuff in %s at %s"):format(
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_put = def.on_metadata_inventory_put or function(pos, listname, index, stack, player)
minetest.log("action", S("@1 moves @2 to @3 at @4",
player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
minetest.log("action", S("%s moves stuff to %s at %s"):format(
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_take = def.on_metadata_inventory_take or function(pos, listname, index, stack, player)
minetest.log("action", S("@1 takes @2 from @3 at @4",
player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
minetest.log("action", S("%s takes stuff from %s at %s"):format(
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
@ -108,7 +98,7 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = placer:get_player_name() or ""
meta:set_string("owner", owner)
meta:set_string("infotext", S("@1 (owned by @2)", def.infotext or def.description, owner))
meta:set_string("infotext", S("%s (owned by %s)"):format(def.infotext or def.description, owner))
return after_place_node and after_place_node(pos, placer)
end
@ -118,17 +108,15 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = meta:get_string("owner")
local playername = player:get_player_name()
if playername == owner or
minetest.check_player_privs(playername, "protection_bypass") then
return allow_move and
allow_move(pos, from_list, from_index, to_list, to_index, count, player) or
count
if (playername ~= owner) then
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
end
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
return allow_move and allow_move(pos, from_list, from_index, to_list, to_index, count, player)
or count
end
local allow_put = def.allow_metadata_inventory_put
@ -137,16 +125,14 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = meta:get_string("owner")
local playername = player:get_player_name()
if playername == owner or
minetest.check_player_privs(playername, "protection_bypass") then
return allow_put and allow_put(pos, listname, index, stack, player) or
stack:get_count()
if (playername ~= owner) then
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
end
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
return allow_put and allow_put(pos, listname, index, stack, player)
or stack:get_count()
end
local allow_take = def.allow_metadata_inventory_take
@ -155,23 +141,21 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = meta:get_string("owner")
local playername = player:get_player_name()
if playername == owner or
minetest.check_player_privs(playername, "protection_bypass") then
return allow_take and allow_take(pos, listname, index, stack, player) or
stack:get_count()
if (playername ~= owner) then
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
end
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
return allow_take and allow_take(pos, listname, index, stack, player)
or stack:get_count()
end
end
local lockable = inventory.lockable
if lockable then
local locked_def = table.copy(original_def)
locked_def.description = S("@1 (Locked)", def.description or name)
locked_def.description = S("Locked %s"):format(def.description or name)
local locked_inventory = locked_def.inventory
locked_inventory.locked = true

3
homedecor/handlers/nodeboxes.lua Normal file → Executable file
View File

@ -57,3 +57,6 @@ mt.__index = function(table, key)
error("unexpected datatype " .. tostring(type(ref)) .. " while looking for " .. key)
end
setmetatable(homedecor.nodebox, mt)

2
homedecor/handlers/registration.lua Normal file → Executable file
View File

@ -1,5 +1,5 @@
homedecor = homedecor or {}
local S = homedecor.gettext
local placeholder_node = "homedecor:expansion_placeholder"
--wrapper around minetest.register_node that sets sane defaults and interprets some specialized settings

4
homedecor/handlers/sit.lua Normal file → Executable file
View File

@ -1,6 +1,5 @@
function homedecor.sit(pos, node, clicker)
return -- delete it when the engine is stabler for the player's physics
--[[
do return end -- delete it when the engine is stabler for the player's physics
local meta = minetest.get_meta(pos)
local param2 = node.param2
local name = clicker:get_player_name()
@ -30,5 +29,4 @@ function homedecor.sit(pos, node, clicker)
clicker:set_look_yaw(4.75)
else return end
end
--]]
end

9
homedecor/handlers/water_particles.lua Normal file → Executable file
View File

@ -25,8 +25,8 @@ function homedecor.start_particle_spawner(pos, node, particledef, soundname)
if id ~= 0 then
if s_handle then
minetest.after(0, function(handle)
minetest.sound_stop(handle)
minetest.after(0, function(s_handle)
minetest.sound_stop(s_handle)
end, s_handle)
end
minetest.delete_particlespawner(id)
@ -104,11 +104,12 @@ function homedecor.stop_particle_spawner(pos)
end
if s_handle then
minetest.after(0, function(handle)
minetest.sound_stop(handle)
minetest.after(0, function(s_handle)
minetest.sound_stop(s_handle)
end, s_handle)
end
this_spawner_meta:set_int("active", nil)
this_spawner_meta:set_int("sound", nil)
end