diff --git a/bobber.lua b/bobber.lua index 4287e8a..c9eb465 100755 --- a/bobber.lua +++ b/bobber.lua @@ -30,11 +30,8 @@ minetest.register_node("fishing:bobber_box", { local FISHING_BOBBER_ENTITY={ - hp_max = 605, - water_damage = 1, physical = true, timer = 0, - env_damage_timer = 0, visual = "wielditem", visual_size = {x=1/3, y=1/3, z=1/3}, textures = {"fishing:bobber_box"}, @@ -44,6 +41,10 @@ local FISHING_BOBBER_ENTITY={ baitball = 0, prize = "", bait = "", + owner = nil, + old_pos = nil, + old_pos2 = nil, + -- DESTROY BOBBER WHEN PUNCHING IT on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir) @@ -72,9 +73,14 @@ local FISHING_BOBBER_ENTITY={ on_rightclick = function (self, clicker) local item = clicker:get_wielded_item() local player_name = clicker:get_player_name() + if not player_name or not self.owner then + self.object:remove() + return + end local inv = clicker:get_inventory() local pos = self.object:getpos() local item_name = item:get_name() + if string.find(item_name, "fishing:pole_") ~= nil then if player_name ~= self.owner then return end if self.prize ~= "" then @@ -135,7 +141,7 @@ local FISHING_BOBBER_ENTITY={ local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-0.5, z=pos.z}) if not node or string.find(node.name, "water_source") == nil then if fishing_setting.settings["message"] == true then - minetest.chat_send_player(self.owner, "Haha, Fishing is prohibited outside water!") + minetest.chat_send_player(self.owner, fishing_setting.func.S("Haha, Fishing is prohibited outside water!")) end self.object:remove() return diff --git a/bobber_shark.lua b/bobber_shark.lua index b27bc74..fd7b45b 100755 --- a/bobber_shark.lua +++ b/bobber_shark.lua @@ -28,11 +28,8 @@ minetest.register_node("fishing:bobber_shark_box", { local FISHING_BOBBER_SHARK_ENTITY={ - hp_max = 605, - water_damage = 1, physical = true, timer = 0, - env_damage_timer = 0, visual = "wielditem", visual_size = {x=1/3, y=1/3, z=1/3}, textures = {"fishing:bobber_shark_box"}, @@ -42,6 +39,10 @@ local FISHING_BOBBER_SHARK_ENTITY={ baitball = 0, prize = "", bait = "", + owner = nil, + old_pos = nil, + old_pos2 = nil, + -- DESTROY BOBBER WHEN PUNCHING IT on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir) @@ -70,9 +71,14 @@ local FISHING_BOBBER_SHARK_ENTITY={ on_rightclick = function (self, clicker) local item = clicker:get_wielded_item() local player_name = clicker:get_player_name() + if not player_name or not self.owner then + self.object:remove() + return + end local inv = clicker:get_inventory() local pos = self.object:getpos() local item_name = item:get_name() + if string.find(item_name, "fishing:pole_") ~= nil then if player_name ~= self.owner then return end if self.prize ~= "" then