From 3d80544f6f9a821ac2a0f921d298b42403089158 Mon Sep 17 00:00:00 2001 From: "0gb.us" <0gb.us@0gb.us> Date: Wed, 6 Mar 2013 21:58:01 -0800 Subject: [PATCH] Modified landclaim_0gb_us to work on a slightly more basic level, resulting in less code and fixing an error in handling on Minetest 0.4.5's on_rightclick() node property. --- .../mods/added/landclaim_0gb_us/init.lua | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/0gb.us_game/mods/added/landclaim_0gb_us/init.lua b/0gb.us_game/mods/added/landclaim_0gb_us/init.lua index 1e94297..c540687 100644 --- a/0gb.us_game/mods/added/landclaim_0gb_us/init.lua +++ b/0gb.us_game/mods/added/landclaim_0gb_us/init.lua @@ -1,5 +1,5 @@ if io.open(minetest.get_modpath("landclaim_0gb_us").."/INIT.LUA") then - return minetest.debug("[landclaim_0gb_us]:\nThis plugin depends on points_0gb_us, which requires a case-sensitive file system to function correctly.") + return minetest.debug("[landclaim_0gb_us]: This plugin depends on points_0gb_us, which requires a case-sensitive file system to function correctly.") end local path = minetest.get_modpath("landclaim_0gb_us") @@ -7,7 +7,7 @@ dofile(path.."/api.lua") dofile(path.."/commands.lua") dofile(path.."/debug.lua") -local default_place = minetest.item_place +local default_place = minetest.item_place_node local default_dig = minetest.node_dig function minetest.node_dig(pos, node, digger) @@ -19,17 +19,13 @@ function minetest.node_dig(pos, node, digger) end end -function minetest.item_place(itemstack, placer, pointed_thing) - if itemstack:get_definition().type == "node" then - owner = landclaim_0gb_us.get_owner(pointed_thing.above) - player = placer:get_player_name() - if landclaim_0gb_us.can_interact(player, pointed_thing.above) then - return default_place(itemstack, placer, pointed_thing) - else - minetest.chat_send_player(player, "Area owned by "..owner) - end - else +function minetest.item_place_node(itemstack, placer, pointed_thing) + local owner = landclaim_0gb_us.get_owner(pointed_thing.above) + local player = placer:get_player_name() + if landclaim_0gb_us.can_interact(player, pointed_thing.above) then return default_place(itemstack, placer, pointed_thing) + else + minetest.chat_send_player(player, "Area owned by "..owner) end end