From a5a932c8ed8066cb843bcc1d6d9ffb4d6a89ef45 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Tue, 10 Mar 2015 17:14:34 +0100 Subject: [PATCH] remove deprecated minetest.env --- mods/fishing/bobber_shark.lua | 2 +- mods/fishing/init.lua | 2 +- mods/fishing/worm.lua | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mods/fishing/bobber_shark.lua b/mods/fishing/bobber_shark.lua index 75f5ff15..329af2b5 100644 --- a/mods/fishing/bobber_shark.lua +++ b/mods/fishing/bobber_shark.lua @@ -158,7 +158,7 @@ local FISHING_BOBBER_ENTITY_SHARK={ on_step = function(self, dtime) local pos = self.object:getpos() if BOBBER_CHECK_RADIUS > 0 then - local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, BOBBER_CHECK_RADIUS) + local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, BOBBER_CHECK_RADIUS) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil then if obj:get_luaentity().name == "fishing:bobber_entity_shark" then diff --git a/mods/fishing/init.lua b/mods/fishing/init.lua index ffdea4dc..068a9fb5 100644 --- a/mods/fishing/init.lua +++ b/mods/fishing/init.lua @@ -158,7 +158,7 @@ minetest.register_node("fishing:pole_deco", { sounds = default.node_sound_wood_defaults(), on_dig = function(pos, node, digger) if digger:is_player() and digger:get_inventory() then - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local wear_out = meta:get_int("wear") digger:get_inventory():add_item("main", {name="fishing:pole", count=1, wear=wear_out, metadata=""}) end diff --git a/mods/fishing/worm.lua b/mods/fishing/worm.lua index 2a76a2aa..70515f0c 100644 --- a/mods/fishing/worm.lua +++ b/mods/fishing/worm.lua @@ -26,12 +26,12 @@ minetest.register_craftitem("fishing:bait_worm", { on_use = minetest.item_eat(1), on_place = function(itemstack, placer, pointed_thing) local pt = pointed_thing - minetest.env:add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity") + minetest.add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity") itemstack:take_item() return itemstack end, on_drop = function(itemstack, dropper, pos) - minetest.env:add_entity({x = pos.x, y = pos.y, z = pos.z}, "fishing:bait_worm_entity") + minetest.add_entity({x = pos.x, y = pos.y, z = pos.z}, "fishing:bait_worm_entity") itemstack:take_item() return itemstack end, @@ -62,7 +62,7 @@ minetest.register_entity("fishing:bait_worm_entity", { -- AI :D on_step = function(self, dtime) local pos = self.object:getpos() - local n = minetest.env:get_node({x=pos.x,y=pos.y-0.3,z=pos.z}) + local n = minetest.get_node({x=pos.x,y=pos.y-0.3,z=pos.z}) -- move in world local look_whats_up = function(self) self.object:set_hp(self.object:get_hp()-self.damage_over_time) -- creature is getting older @@ -80,7 +80,7 @@ minetest.register_entity("fishing:bait_worm_entity", { self.object:set_hp(self.object:get_hp()-37) elseif minetest.get_item_group(n.name, "soil") ~= 0 then - if minetest.get_item_group(minetest.env:get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then + if minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then self.object:set_hp(199) elseif self.object:get_hp() > 200 then -- leave dirt to see whats going on self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y+0.003,z=pos.z+(0.001*(math.random(-2, 2)))}) @@ -91,15 +91,15 @@ minetest.register_entity("fishing:bait_worm_entity", { end else -- check if there's dirt anywhere (not finished) local check_group = minetest.get_item_group - local goal_01 = check_group(minetest.env:get_node({x = pos.x + 1, y = pos.y-0.4, z = pos.z }).name, "soil") - local goal_02 = check_group(minetest.env:get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil") - local goal_03 = check_group(minetest.env:get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil") - local goal_04 = check_group(minetest.env:get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil") + local goal_01 = check_group(minetest.get_node({x = pos.x + 1, y = pos.y-0.4, z = pos.z }).name, "soil") + local goal_02 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil") + local goal_03 = check_group(minetest.get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil") + local goal_04 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil") - local goal_1a = check_group(minetest.env:get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil") - local goal_2a = check_group(minetest.env:get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil") - local goal_3a = check_group(minetest.env:get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil") - local goal_4a = check_group(minetest.env:get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil") + local goal_1a = check_group(minetest.get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil") + local goal_2a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil") + local goal_3a = check_group(minetest.get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil") + local goal_4a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil") -- if there's dirt nearby, go there if goal_01 ~= 0 or goal_1a ~= 0 then self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})