diff options
| author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-01-31 19:39:31 -0500 | 
|---|---|---|
| committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-01-31 19:39:31 -0500 | 
| commit | 39f5cba27eef35877c91291f518974f34130fcb6 (patch) | |
| tree | 117a9d1b7d4ee5f78f73e1216e982c366ed9ecc6 /homedecor/handlers | |
| parent | 2922421f4a88e56a0a1c819f62bf2bc287835388 (diff) | |
| download | dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.gz dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.bz2 dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.xz dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.zip | |
Huge update - lots of mods:
areas, biome_lib, blox, bobblocks, boost_cart, homedecor, mobs,
coloredwood, ilights, inbox, item_tweaks, moreblocks, moreores,
pipeworks, plasticbox, signs_lib, stainedglass, roads, unifieddyes,
vines, worldedit, xban2, maybe some others I didn't think about ;-)
Diffstat (limited to 'homedecor/handlers')
| -rw-r--r-- | homedecor/handlers/expansion.lua | 120 | ||||
| -rw-r--r-- | homedecor/handlers/furnaces.lua | 44 | ||||
| -rw-r--r-- | homedecor/handlers/inventory.lua | 61 | ||||
| -rw-r--r-- | homedecor/handlers/nodeboxes.lua | 3 | ||||
| -rw-r--r-- | homedecor/handlers/registration.lua | 2 | ||||
| -rw-r--r-- | homedecor/handlers/sit.lua | 4 | ||||
| -rw-r--r-- | homedecor/handlers/water_particles.lua | 9 | 
7 files changed, 138 insertions, 105 deletions
| diff --git a/homedecor/handlers/expansion.lua b/homedecor/handlers/expansion.lua index 0767837..705f313 100644 --- a/homedecor/handlers/expansion.lua +++ b/homedecor/handlers/expansion.lua @@ -1,4 +1,3 @@ -local S = homedecor.gettext  -- vectors to place one node next to or behind another @@ -23,6 +22,35 @@ 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 = "Expansion placeholder (you hacker you!)", @@ -67,8 +95,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 fdir = fdir or minetest.dir_to_facedir(placer:get_look_dir()) -		minetest.set_node(pos, { name = node1, param2 = fdir }) +		local lfdir = fdir or minetest.dir_to_facedir(placer:get_look_dir()) +		minetest.set_node(pos, { name = node1, param2 = lfdir })  		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" @@ -76,7 +104,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 fdir) or nil }) +		minetest.set_node(pos2, { name = node2, param2 = (has_facedir and lfdir) or nil })  		-- call after_place_node of the placed node if available  		local ctrl_node_def = minetest.registered_nodes[node1] @@ -91,18 +119,18 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)  	return itemstack  end -local function rightclick_pointed_thing(pos, placer, itemstack) +local function rightclick_pointed_thing(pos, placer, itemstack, pointed_thing)  	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) or itemstack +	return def.on_rightclick(pos, node, placer, itemstack, pointed_thing) 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) +	local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)  	if rightclick_result then return rightclick_result end  	local pos, def = select_node(pointed_thing) @@ -117,7 +145,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) +	local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)  	if rightclick_result then return rightclick_result end  	local pos, def = select_node(pointed_thing) @@ -136,27 +164,27 @@ 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) +	local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)  	if rightclick_result then return rightclick_result end  	local pos, def = select_node(pointed_thing)  	if not pos then return itemstack end  	local fdir = minetest.dir_to_facedir(placer:get_look_dir()) -	local fdir_transform = dir and homedecor.fdir_to_right or homedecor.fdir_to_fwd +	local fdir_transform = dir and homedecor.fdir_to_right or homedecor.dir_to_fwd  	local pos2 = { x = pos.x + fdir_transform[fdir+1][1], y=pos.y, z = pos.z + fdir_transform[fdir+1][2] }  	return stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)  end -function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color) +function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks)  	local thisnode = minetest.get_node(pos)  	local fdir = thisnode.param2 -	local fxd = homedecor.fdir_to_fwd[fdir+1][1] -	local fzd = homedecor.fdir_to_fwd[fdir+1][2] +	local fxd = homedecor.wall_fdir_to_fwd[fdir+1][1] +	local fzd = homedecor.wall_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) @@ -170,65 +198,67 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color)  		return true  	end -	if minetest.is_protected(forwardpos, placer_name) then  +	if minetest.is_protected(forwardpos, placer_name) then  		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.fdir_to_left[fdir+1][1] -	local lzd = homedecor.fdir_to_left[fdir+1][2] +	local lxd = homedecor.wall_fdir_to_left[fdir+1][1] +	local lzd = homedecor.wall_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.fdir_to_right[fdir+1][1] -	local rzd = homedecor.fdir_to_right[fdir+1][2] +	local rxd = homedecor.wall_fdir_to_right[fdir+1][1] +	local rzd = homedecor.wall_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_"..color.."_regular" then +	if leftnode.name == "homedecor:bed_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_"..color.."_regular" then +	elseif rightnode.name == "homedecor:bed_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 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 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 +	local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z} +	local botpos = {x=pos.x, y=pos.y-1.0, z=pos.z} -	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 +	local topposfwd = {x=toppos.x+fxd, y=toppos.y, z=toppos.z+fzd} +	local topnodefwd = minetest.get_node(topposfwd) + +	local topnode = minetest.get_node(toppos) +	local bottomnode = minetest.get_node(botpos) + +	print(topnode.name, thisnode.name, bottomnode.name, itemstack:get_name(), dump(trybunks)) + +	if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then +		print("want to stack beds, top seems to be clear") +		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()  	end  end -function homedecor.unextend_bed(pos, color) +function homedecor.unextend_bed(pos)  	local bottomnode = minetest.get_node({x=pos.x, y=pos.y-1.0, z=pos.z})  	local fdir = bottomnode.param2 -	if string.find(bottomnode.name, "homedecor:bed_.*_extended$") then +	if 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) +	local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)  	if rightclick_result then return rightclick_result end -	local pos, def = select_node(pointed_thing) +	local pos, _ = select_node(pointed_thing)  	if not pos then return itemstack end  	local fdir = minetest.dir_to_facedir(placer:get_look_dir()) @@ -244,7 +274,7 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)  		return itemstack  	end -	if minetest.is_protected(abovepos, placer_name) then  +	if minetest.is_protected(abovepos, placer_name) then  		minetest.chat_send_player(placer_name, "Someone already owns that spot." )  		return itemstack  	end @@ -269,21 +299,20 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)  	local right_fwd_below_pos = { x=pos.x+rxd+fxd, y=pos.y-1, z=pos.z+rzd+fzd }  	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 below_node =           minetest.get_node(below_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. @@ -326,7 +355,7 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)  		new_place_name = string.gsub(right_node.name, "_diagonal_.-$", "_horizontal")  	-- try to place a horizontal in-line with the nearest diagonal, at the bottom -	elseif left_fwd_node and string.find(left_fwd_node.name, "homedecor:banister_.*_diagonal")  +	elseif left_fwd_node and string.find(left_fwd_node.name, "homedecor:banister_.*_diagonal")  	  and is_buildable_to(placer_name, fwd_pos, fwd_pos) then  		fdir = left_fwd_node.param2  		pos = fwd_pos @@ -359,4 +388,3 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)  	itemstack:take_item()  	return itemstack  end - diff --git a/homedecor/handlers/furnaces.lua b/homedecor/handlers/furnaces.lua index d436b49..36a7939 100644 --- a/homedecor/handlers/furnaces.lua +++ b/homedecor/handlers/furnaces.lua @@ -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.gettext +local S = homedecor_i18n.gettext  local function swap_node(pos, name)  	local node = minetest.get_node(pos) @@ -88,7 +88,7 @@ function homedecor.register_furnace(name, furnacedef)  	furnacedef.cook_speed = furnacedef.cook_speed or 1 -	local description = furnacedef.description or "Furnace" +	local description = furnacedef.description or S("Furnace")  	local furnace_construct = function(pos)  		local meta = minetest.get_meta(pos) @@ -106,7 +106,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("%s is empty"):format(description)) +					meta:set_string("infotext", S("@1 (empty)", description))  				end  				return stack:get_count()  			else @@ -125,7 +125,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("%s is empty"):format(description)) +					meta:set_string("infotext", S("@1 (empty)", description))  				end  				return count  			else @@ -151,7 +151,7 @@ function homedecor.register_furnace(name, furnacedef)  	}  	local def_active = { -		description = description .. " (active)", +		description = S("@1 (active)", description),  		tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),  		light_source = 8,  		drop = "homedecor:" .. name, @@ -171,28 +171,28 @@ function homedecor.register_furnace(name, furnacedef)  		end  	end -	local name_active = name.."_active" +	local n_active = name.."_active"  	homedecor.register(name, def) -	homedecor.register(name_active, def_active) +	homedecor.register(n_active, def_active) -	local name, name_active = "homedecor:"..name, "homedecor:"..name_active +	local nname, name_active = "homedecor:"..name, "homedecor:"..n_active  	minetest.register_abm({ -		nodenames = {name, name_active, name.."_locked", name_active.."_locked"}, +		nodenames = {nname, name_active, nname.."_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, name in ipairs({ +			for i, pname in ipairs({  					"fuel_totaltime",  					"fuel_time",  					"src_totaltime",  					"src_time"  			}) do -				if meta:get_string(name) == "" then -					meta:set_float(name, 0.0) +				if meta:get_string(pname) == "" then +					meta:set_float(pname, 0.0)  				end  			end @@ -226,12 +226,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[name..locked].description +			local desc = minetest.registered_nodes[nname..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("%s active: %d%%"):format(desc,percent)) +				meta:set_string("infotext", S("@1 (active: @2%)", desc, percent))  				swap_node(pos,name_active..locked)  				meta:set_string("formspec", make_formspec(furnacedef, percent))  				return @@ -239,9 +239,9 @@ function homedecor.register_furnace(name, furnacedef)  			local fuel = nil  			local afterfuel -			local cooked = nil +			cooked = nil  			local fuellist = inv:get_list("fuel") -			local srclist = inv:get_list("src") +			srclist = inv:get_list("src")  			if srclist then  				cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) @@ -251,24 +251,24 @@ function homedecor.register_furnace(name, furnacedef)  			end  			if (not fuel) or (fuel.time <= 0) then -				meta:set_string("infotext",desc..S(": Out of fuel")) -				swap_node(pos, name..locked) +				meta:set_string("infotext", S("@1 (out of fuel)", desc)) +				swap_node(pos, nname..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("%s is empty"):format(desc)) -					swap_node(pos, name..locked) +					meta:set_string("infotext", S("@1 (empty)", desc)) +					swap_node(pos, nname..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", desc..S(": output bins are full")) -				swap_node(pos, name..locked) +				meta:set_string("infotext", S("@1 (output bins are full)", desc)) +				swap_node(pos, nname..locked)  				meta:set_string("formspec", make_formspec(furnacedef, 0))  				return  			end diff --git a/homedecor/handlers/inventory.lua b/homedecor/handlers/inventory.lua index dc4b740..4db9892 100644 --- a/homedecor/handlers/inventory.lua +++ b/homedecor/handlers/inventory.lua @@ -1,4 +1,5 @@ -local S = homedecor.gettext + +local S = homedecor_i18n.gettext  local default_can_dig = function(pos,player)  	local meta = minetest.get_meta(pos) @@ -84,17 +85,17 @@ 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("%s moves stuff in %s at %s"):format( +		minetest.log("action", S("@1 moves stuff in @2 at @3",  			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("%s moves %s to %s at %s"):format( +		minetest.log("action", S("@1 moves @2 to @3 at @4",  			player:get_player_name(), stack:get_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("%s takes %s from %s at %s"):format( +		minetest.log("action", S("@1 takes @2 from @3 at @4",  			player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)  		))  	end @@ -107,7 +108,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("%s (owned by %s)"):format(def.infotext or def.description, owner)) +			meta:set_string("infotext", S("@1 (owned by @2)", def.infotext or def.description, owner))  			return after_place_node and after_place_node(pos, placer)  		end @@ -117,15 +118,17 @@ function homedecor.handle_inventory(name, def, original_def)  			local owner = meta:get_string("owner")  			local playername = player:get_player_name() -			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 +			if playername == owner or +					minetest.check_player_privs(player, "protection_bypass") then +				return allow_move and +						allow_move(pos, from_list, from_index, to_list, to_index, count, player) or +						count  			end -			return allow_move and allow_move(pos, from_list, from_index, to_list, to_index, count, player) -				or count +			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  		end  		local allow_put = def.allow_metadata_inventory_put @@ -134,14 +137,16 @@ function homedecor.handle_inventory(name, def, original_def)  			local owner = meta:get_string("owner")  			local playername = player:get_player_name() -			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 +			if playername == owner or +					minetest.check_player_privs(player, "protection_bypass") then +				return allow_put and allow_put(pos, listname, index, stack, player) or +						stack:get_count()  			end -			return allow_put and allow_put(pos, listname, index, stack, player) -				or stack:get_count() + +			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  		end  		local allow_take = def.allow_metadata_inventory_take @@ -150,21 +155,23 @@ function homedecor.handle_inventory(name, def, original_def)  			local owner = meta:get_string("owner")  			local playername = player:get_player_name() -			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 +			if playername == owner or +					minetest.check_player_privs(player, "protection_bypass") then +				return allow_take and allow_take(pos, listname, index, stack, player) or +						stack:get_count()  			end -			return allow_take and allow_take(pos, listname, index, stack, player) -				or stack:get_count() + +			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  		end  	end  	local lockable = inventory.lockable  	if lockable then  		local locked_def = table.copy(original_def) -		locked_def.description = S("Locked %s"):format(def.description or name) +		locked_def.description = S("@1 (Locked)", def.description or name)  		local locked_inventory = locked_def.inventory  		locked_inventory.locked = true diff --git a/homedecor/handlers/nodeboxes.lua b/homedecor/handlers/nodeboxes.lua index 0d8306e..c0a7df7 100644 --- a/homedecor/handlers/nodeboxes.lua +++ b/homedecor/handlers/nodeboxes.lua @@ -57,6 +57,3 @@ mt.__index = function(table, key)  	error("unexpected datatype " .. tostring(type(ref)) .. " while looking for " .. key)  end  setmetatable(homedecor.nodebox, mt) - - - diff --git a/homedecor/handlers/registration.lua b/homedecor/handlers/registration.lua index b25378f..8c20558 100644 --- a/homedecor/handlers/registration.lua +++ b/homedecor/handlers/registration.lua @@ -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 diff --git a/homedecor/handlers/sit.lua b/homedecor/handlers/sit.lua index 636a585..fc49177 100644 --- a/homedecor/handlers/sit.lua +++ b/homedecor/handlers/sit.lua @@ -1,5 +1,6 @@  function homedecor.sit(pos, node, clicker) -	do return end -- delete it when the engine is stabler for the player's physics +	return -- 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() @@ -29,4 +30,5 @@ function homedecor.sit(pos, node, clicker)  			clicker:set_look_yaw(4.75)  		else return end  	end +--]]  end diff --git a/homedecor/handlers/water_particles.lua b/homedecor/handlers/water_particles.lua index a3334b0..c514e9a 100644 --- a/homedecor/handlers/water_particles.lua +++ b/homedecor/handlers/water_particles.lua @@ -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(s_handle) -				minetest.sound_stop(s_handle) +			minetest.after(0, function(handle) +				minetest.sound_stop(handle)  			end, s_handle)  		end  		minetest.delete_particlespawner(id) @@ -104,12 +104,11 @@ function homedecor.stop_particle_spawner(pos)  	end  	if s_handle then -		minetest.after(0, function(s_handle) -			minetest.sound_stop(s_handle) +		minetest.after(0, function(handle) +			minetest.sound_stop(handle)  		end, s_handle)  	end  	this_spawner_meta:set_int("active", nil)  	this_spawner_meta:set_int("sound", nil)  end - | 
