From bf2f311f21a4a7fd24148aa57f415d2ad6d67562 Mon Sep 17 00:00:00 2001 From: BremaWeb Date: Sat, 30 Nov 2013 19:45:43 -0600 Subject: swap parameters for all calls to can_interact --- bucket.lua | 6 +++--- chest.lua | 6 +++--- default.lua | 2 +- doors.lua | 2 +- fire.lua | 16 ++++++++-------- screwdriver.lua | 2 +- shared_door.lua | 8 ++++---- snow.lua | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bucket.lua b/bucket.lua index 2557a1f..8316838 100644 --- a/bucket.lua +++ b/bucket.lua @@ -14,7 +14,7 @@ if minetest.get_modpath("bucket") then liquiddef = bucket.liquids[n.name] if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then local player = user:get_player_name() - if landrush.can_interact(player, pointed_thing.under) then + if landrush.can_interact(pointed_thing.under, player) then minetest.env:add_node(pointed_thing.under, {name="air"}) return {name=liquiddef.itemname} else @@ -36,13 +36,13 @@ if minetest.get_modpath("bucket") then n = minetest.env:get_node(pointed_thing.under) local player = user:get_player_name() if minetest.registered_nodes[n.name].buildable_to then - if landrush.can_interact(player, pointed_thing.under) then + if landrush.can_interact(pointed_thing.under, player) then return on_use(itemstack, user, pointed_thing) else minetest.chat_send_player(player, "Area owned by "..landrush.get_owner(pointed_thing.above)) end else - if landrush.can_interact(player, pointed_thing.above) then + if landrush.can_interact(pointed_thing.above, player) then return on_use(itemstack, user, pointed_thing) else minetest.chat_send_player(player, "Area owned by "..landrush.get_owner(pointed_thing.above)) diff --git a/chest.lua b/chest.lua index 93373d3..ccaaf9e 100644 --- a/chest.lua +++ b/chest.lua @@ -24,7 +24,7 @@ minetest.register_node("landrush:shared_chest", { allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) local meta = minetest.get_meta(pos) - if not landrush.can_interact(player:get_player_name(),pos) then + if not landrush.can_interact(pos,player:get_player_name()) then minetest.log("action", player:get_player_name() .. " tried to access a shared chest at ".. minetest.pos_to_string(pos)) return 0 end @@ -33,7 +33,7 @@ minetest.register_node("landrush:shared_chest", { allow_metadata_inventory_put = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) - if not landrush.can_interact(player:get_player_name(),pos) then + if not landrush.can_interact(pos,player:get_player_name()) then minetest.log("action", player:get_player_name() .. " tried to access a shared chest at ".. minetest.pos_to_string(pos)) return 0 end @@ -42,7 +42,7 @@ minetest.register_node("landrush:shared_chest", { allow_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) - if not landrush.can_interact(player:get_player_name(),pos) then + if not landrush.can_interact(pos,player:get_player_name()) then minetest.log("action", player:get_player_name().. " tried to access a shared chest at ".. minetest.pos_to_string(pos)) diff --git a/default.lua b/default.lua index 5285967..926da20 100644 --- a/default.lua +++ b/default.lua @@ -28,7 +28,7 @@ if minetest.get_modpath("default") then on_receive_fields = function(pos, formname, fields, sender) --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields)) local name = sender:get_player_name() - if landrush.can_interact(name, pos) then + if landrush.can_interact(pos, name) then local meta = minetest.env:get_meta(pos) fields.text = fields.text or "" print((name or "").." wrote \""..fields.text.. diff --git a/doors.lua b/doors.lua index 6804797..72662d9 100644 --- a/doors.lua +++ b/doors.lua @@ -6,7 +6,7 @@ if minetest.get_modpath("doors") then local bottom = pointed_thing.above local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z} local name = placer:get_player_name() - if landrush.can_interact(name, top) and landrush.can_interact(name, bottom) then + if landrush.can_interact(top,name) and landrush.can_interact(bottom, name) then return on_place(itemstack, placer, pointed_thing) else topowner = landrush.get_owner(top) diff --git a/fire.lua b/fire.lua index a03376c..1059603 100644 --- a/fire.lua +++ b/fire.lua @@ -2,14 +2,14 @@ if minetest.get_modpath("fire") then landrush.default_flame_should_extinguish = fire.flame_should_extinguish function fire.flame_should_extinguish(pos) - corner0 = landrush.can_interact("-!-", {x=pos.x-1,y=pos.y-1,z=pos.z-1}) - corner1 = landrush.can_interact("-!-", {x=pos.x-1,y=pos.y-1,z=pos.z+1}) - corner2 = landrush.can_interact("-!-", {x=pos.x-1,y=pos.y+1,z=pos.z-1}) - corner3 = landrush.can_interact("-!-", {x=pos.x-1,y=pos.y+1,z=pos.z+1}) - corner4 = landrush.can_interact("-!-", {x=pos.x+1,y=pos.y-1,z=pos.z-1}) - corner5 = landrush.can_interact("-!-", {x=pos.x+1,y=pos.y-1,z=pos.z+1}) - corner6 = landrush.can_interact("-!-", {x=pos.x+1,y=pos.y+1,z=pos.z-1}) - corner7 = landrush.can_interact("-!-", {x=pos.x+1,y=pos.y+1,z=pos.z+1}) + corner0 = landrush.can_interact({x=pos.x-1,y=pos.y-1,z=pos.z-1},"-!-") + corner1 = landrush.can_interact({x=pos.x-1,y=pos.y-1,z=pos.z+1},"-!-") + corner2 = landrush.can_interact({x=pos.x-1,y=pos.y+1,z=pos.z-1},"-!-") + corner3 = landrush.can_interact({x=pos.x-1,y=pos.y+1,z=pos.z+1},"-!-") + corner4 = landrush.can_interact({x=pos.x+1,y=pos.y-1,z=pos.z-1},"-!-") + corner5 = landrush.can_interact({x=pos.x+1,y=pos.y-1,z=pos.z+1},"-!-") + corner6 = landrush.can_interact({x=pos.x+1,y=pos.y+1,z=pos.z-1},"-!-") + corner7 = landrush.can_interact({x=pos.x+1,y=pos.y+1,z=pos.z+1},"-!-") if corner0 and corner1 then return landrush.default_flame_should_extinguish(pos) else diff --git a/screwdriver.lua b/screwdriver.lua index 079d65c..75d9c21 100644 --- a/screwdriver.lua +++ b/screwdriver.lua @@ -38,7 +38,7 @@ function safe_screwdriver_handler (itemstack,user,pointed_thing) if pointed_thing.type~="node" then return end local pos=minetest.get_pointed_thing_position(pointed_thing,above) -- Landrush fix - if not landrush.can_interact( player_name, pos ) then + if not landrush.can_interact( pos, player_name ) then return nil end -- end fix diff --git a/shared_door.lua b/shared_door.lua index a876485..ec9f8fb 100644 --- a/shared_door.lua +++ b/shared_door.lua @@ -36,13 +36,13 @@ minetest.register_craft({ minetest.registered_nodes['landrush:shared_door_b_1'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(clicker:get_player_name(),pos) ) then +if ( landrush.can_interact(pos,clicker:get_player_name()) ) then landrush.on_rightclick(pos, 1, "landrush:shared_door_t_1", "landrush:shared_door_b_2", "landrush:shared_door_t_2", {1,2,3,0}) end end minetest.registered_nodes['landrush:shared_door_t_1'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(clicker:get_player_name(),pos) ) then +if ( landrush.can_interact(pos,clicker:get_player_name()) ) then landrush.on_rightclick(pos, -1, "landrush:shared_door_b_1", "landrush:shared_door_t_2", "landrush:shared_door_b_2", {1,2,3,0}) end end @@ -51,13 +51,13 @@ end -- Bug was caused, because the reverse order of the on_rightclick was not taken into account minetest.registered_nodes['landrush:shared_door_b_2'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(clicker:get_player_name(),pos) ) then +if ( landrush.can_interact(pos,clicker:get_player_name()) ) then landrush.on_rightclick(pos, 1, "landrush:shared_door_t_2", "landrush:shared_door_b_1", "landrush:shared_door_t_1", {3,0,1,2}) end end minetest.registered_nodes['landrush:shared_door_t_2'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(clicker:get_player_name(),pos) ) then +if ( landrush.can_interact(pos,clicker:get_player_name()) ) then landrush.on_rightclick(pos, -1, "landrush:shared_door_b_2", "landrush:shared_door_t_1", "landrush:shared_door_b_1", {3,0,1,2}) end end diff --git a/snow.lua b/snow.lua index 7f21548..14d529a 100644 --- a/snow.lua +++ b/snow.lua @@ -16,7 +16,7 @@ if minetest.get_modpath( 'snow' ) then if self.lastpos.x~=nil then if node.name ~= "air" then - if landrush.can_interact( ' ', pos ) then + if landrush.can_interact( pos, ' ' ) then snow.place(pos) end self.object:remove() -- cgit v1.2.3