Replace deprecated function calls
authorSmallJoker <SmallJoker@users.noreply.github.com>
Sun, 1 Jul 2018 19:44:03 +0000 (21:44 +0200)
committerParamat <paramat@users.noreply.github.com>
Sun, 1 Jul 2018 19:44:03 +0000 (20:44 +0100)
12 files changed:
mods/beds/functions.lua
mods/beds/spawns.lua
mods/boats/init.lua
mods/bones/init.lua
mods/bucket/init.lua
mods/default/craftitems.lua
mods/default/item_entity.lua
mods/dungeon_loot/mapgen.lua
mods/fire/init.lua
mods/sethome/init.lua
mods/stairs/init.lua
mods/tnt/init.lua

index 88ae31e712a81de01b905689336da508753fac7d..32721cd4bc50ca0c7ed0292c6041902ee4aeb92b 100644 (file)
@@ -69,7 +69,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
                        return
                end
                if p then
-                       player:setpos(p)
+                       player:set_pos(p)
                end
 
                -- physics, eye_offset, etc
@@ -94,7 +94,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
                local dir = minetest.facedir_to_dir(param2)
                local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
                player:set_physics_override(0, 0, 0)
-               player:setpos(p)
+               player:set_pos(p)
                default.player_attached[name] = true
                hud_flags.wielditem = false
                default.player_set_animation(player, "lay" , 0)
@@ -139,7 +139,7 @@ end
 
 function beds.on_rightclick(pos, player)
        local name = player:get_player_name()
-       local ppos = player:getpos()
+       local ppos = player:get_pos()
        local tod = minetest.get_timeofday()
 
        if tod > 0.2 and tod < 0.805 then
@@ -194,7 +194,7 @@ if enable_respawn then
                local name = player:get_player_name()
                local pos = beds.spawn[name]
                if pos then
-                       player:setpos(pos)
+                       player:set_pos(pos)
                        return true
                end
        end)
index 6b1f4041795f9bc75dba33f639aaf8c6196efe20..baee364df68c6d44a6821216e94c7b18726a2a49 100644 (file)
@@ -53,7 +53,7 @@ end
 function beds.set_spawns()
        for name,_ in pairs(beds.player) do
                local player = minetest.get_player_by_name(name)
-               local p = player:getpos()
+               local p = player:get_pos()
                -- but don't change spawn location if borrowing a bed
                if not minetest.is_protected(p, name) then
                        beds.spawn[name] = p
index 72ca478f8dc6a61a9e63023b9c0898f7daf58ddf..82722ee11529d53fd255d8995f2829b5b91fc969 100644 (file)
@@ -58,10 +58,10 @@ function boat.on_rightclick(self, clicker)
                clicker:set_detach()
                player_api.player_attached[name] = false
                player_api.set_animation(clicker, "stand" , 30)
-               local pos = clicker:getpos()
+               local pos = clicker:get_pos()
                pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
                minetest.after(0.1, function()
-                       clicker:setpos(pos)
+                       clicker:set_pos(pos)
                end)
        elseif not self.driver then
                local attach = clicker:get_attach()
@@ -79,7 +79,7 @@ function boat.on_rightclick(self, clicker)
                minetest.after(0.2, function()
                        player_api.set_animation(clicker, "sit" , 30)
                end)
-               clicker:set_look_horizontal(self.object:getyaw())
+               clicker:set_look_horizontal(self.object:get_yaw())
        end
 end
 
@@ -116,7 +116,7 @@ function boat.on_punch(self, puncher)
                        local leftover = inv:add_item("main", "boats:boat")
                        -- if no room in inventory add a replacement boat to the world
                        if not leftover:is_empty() then
-                               minetest.add_item(self.object:getpos(), leftover)
+                               minetest.add_item(self.object:get_pos(), leftover)
                        end
                end
                -- delay remove to ensure player is detached
@@ -128,10 +128,10 @@ end
 
 
 function boat.on_step(self, dtime)
-       self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
+       self.v = get_v(self.object:get_velocity()) * get_sign(self.v)
        if self.driver then
                local ctrl = self.driver:get_player_control()
-               local yaw = self.object:getyaw()
+               local yaw = self.object:get_yaw()
                if ctrl.up then
                        self.v = self.v + 0.1
                elseif ctrl.down then
@@ -139,27 +139,27 @@ function boat.on_step(self, dtime)
                end
                if ctrl.left then
                        if self.v < 0 then
-                               self.object:setyaw(yaw - (1 + dtime) * 0.03)
+                               self.object:set_yaw(yaw - (1 + dtime) * 0.03)
                        else
-                               self.object:setyaw(yaw + (1 + dtime) * 0.03)
+                               self.object:set_yaw(yaw + (1 + dtime) * 0.03)
                        end
                elseif ctrl.right then
                        if self.v < 0 then
-                               self.object:setyaw(yaw + (1 + dtime) * 0.03)
+                               self.object:set_yaw(yaw + (1 + dtime) * 0.03)
                        else
-                               self.object:setyaw(yaw - (1 + dtime) * 0.03)
+                               self.object:set_yaw(yaw - (1 + dtime) * 0.03)
                        end
                end
        end
-       local velo = self.object:getvelocity()
+       local velo = self.object:get_velocity()
        if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
-               self.object:setpos(self.object:getpos())
+               self.object:set_pos(self.object:get_pos())
                return
        end
        local s = get_sign(self.v)
        self.v = self.v - 0.02 * s
        if s ~= get_sign(self.v) then
-               self.object:setvelocity({x = 0, y = 0, z = 0})
+               self.object:set_velocity({x = 0, y = 0, z = 0})
                self.v = 0
                return
        end
@@ -167,7 +167,7 @@ function boat.on_step(self, dtime)
                self.v = 5 * get_sign(self.v)
        end
 
-       local p = self.object:getpos()
+       local p = self.object:get_pos()
        p.y = p.y - 0.5
        local new_velo
        local new_acce = {x = 0, y = 0, z = 0}
@@ -179,13 +179,13 @@ function boat.on_step(self, dtime)
                else
                        new_acce = {x = 0, y = -9.8, z = 0}
                end
-               new_velo = get_velocity(self.v, self.object:getyaw(),
-                       self.object:getvelocity().y)
-               self.object:setpos(self.object:getpos())
+               new_velo = get_velocity(self.v, self.object:get_yaw(),
+                       self.object:get_velocity().y)
+               self.object:set_pos(self.object:get_pos())
        else
                p.y = p.y + 1
                if is_water(p) then
-                       local y = self.object:getvelocity().y
+                       local y = self.object:get_velocity().y
                        if y >= 5 then
                                y = 5
                        elseif y < 0 then
@@ -193,24 +193,24 @@ function boat.on_step(self, dtime)
                        else
                                new_acce = {x = 0, y = 5, z = 0}
                        end
-                       new_velo = get_velocity(self.v, self.object:getyaw(), y)
-                       self.object:setpos(self.object:getpos())
+                       new_velo = get_velocity(self.v, self.object:get_yaw(), y)
+                       self.object:set_pos(self.object:get_pos())
                else
                        new_acce = {x = 0, y = 0, z = 0}
-                       if math.abs(self.object:getvelocity().y) < 1 then
-                               local pos = self.object:getpos()
+                       if math.abs(self.object:get_velocity().y) < 1 then
+                               local pos = self.object:get_pos()
                                pos.y = math.floor(pos.y) + 0.5
-                               self.object:setpos(pos)
-                               new_velo = get_velocity(self.v, self.object:getyaw(), 0)
+                               self.object:set_pos(pos)
+                               new_velo = get_velocity(self.v, self.object:get_yaw(), 0)
                        else
-                               new_velo = get_velocity(self.v, self.object:getyaw(),
-                                       self.object:getvelocity().y)
-                               self.object:setpos(self.object:getpos())
+                               new_velo = get_velocity(self.v, self.object:get_yaw(),
+                                       self.object:get_velocity().y)
+                               self.object:set_pos(self.object:get_pos())
                        end
                end
        end
-       self.object:setvelocity(new_velo)
-       self.object:setacceleration(new_acce)
+       self.object:set_velocity(new_velo)
+       self.object:set_acceleration(new_acce)
 end
 
 
@@ -246,7 +246,7 @@ minetest.register_craftitem("boats:boat", {
                boat = minetest.add_entity(pointed_thing.under, "boats:boat")
                if boat then
                        if placer then
-                               boat:setyaw(placer:get_look_horizontal())
+                               boat:set_yaw(placer:get_look_horizontal())
                        end
                        local player_name = placer and placer:get_player_name() or ""
                        if not (creative and creative.is_enabled_for and
index 480a55c4847ff577434873a6c6ea20913d11e758..0043118d205f35041343611262616053088b86b0 100644 (file)
@@ -159,7 +159,7 @@ end
 local drop = function(pos, itemstack)
        local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
        if obj then
-               obj:setvelocity({
+               obj:set_velocity({
                        x = math.random(-10, 10) / 9,
                        y = 5,
                        z = math.random(-10, 10) / 9,
index 9c1481ef2096ac450924f271b345cf9fd789d5f3..1d37cb427166f6887fd7e534aa0f8d969314b285 100644 (file)
@@ -148,7 +148,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
                                if inv:room_for_item("main", {name=liquiddef.itemname}) then
                                        inv:add_item("main", liquiddef.itemname)
                                else
-                                       local pos = user:getpos()
+                                       local pos = user:get_pos()
                                        pos.y = math.floor(pos.y + 0.5)
                                        minetest.add_item(pos, liquiddef.itemname)
                                end
index e1d224d1004359c660598be40a24fe3fe95df9c9..6c07934970e609053cf234b96444d65f4f46a4e3 100644 (file)
@@ -121,7 +121,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
                        if inv:room_for_item("main", new_stack) then
                                inv:add_item("main", new_stack)
                        else
-                               minetest.add_item(player:getpos(), new_stack)
+                               minetest.add_item(player:get_pos(), new_stack)
                        end
                else
                        stack:get_meta():from_table({ fields = data })
@@ -247,7 +247,7 @@ minetest.register_craftitem("default:skeleton_key", {
                                itemstack = new_stack
                        else
                                if inv:add_item("main", new_stack):get_count() > 0 then
-                                       minetest.add_item(user:getpos(), new_stack)
+                                       minetest.add_item(user:get_pos(), new_stack)
                                end -- else: added to inventory successfully
                        end
 
index c34e60e9c2cc96cb8a3b3fe6892f5f763076a272..2a61f08edd43956de20435c3b204d701afcb6837 100644 (file)
@@ -16,7 +16,7 @@ local item = {
        burn_up = function(self)
                -- disappear in a smoke puff
                self.object:remove()
-               local p = self.object:getpos()
+               local p = self.object:get_pos()
                minetest.sound_play("default_item_smoke", {
                        pos = p,
                        max_hear_distance = 8,
@@ -48,7 +48,7 @@ local item = {
                        if self.ignite_timer > 10 then
                                self.ignite_timer = 0
 
-                               local node = minetest.get_node_or_nil(self.object:getpos())
+                               local node = minetest.get_node_or_nil(self.object:get_pos())
                                if not node then
                                        return
                                end
index 1e463450105cf0c6468f88d199b4d94fb8e1fb25..c6a4509451e6b4fea9773e7dd4a783575b40cfd9 100644 (file)
@@ -1,7 +1,7 @@
 minetest.set_gen_notify({dungeon = true, temple = true})
 
 local function noise3d_integer(noise, pos)
-       return math.abs(math.floor(noise:get3d(pos) * 0x7fffffff))
+       return math.abs(math.floor(noise:get_3d(pos) * 0x7fffffff))
 end
 
 local function random_sample(rand, list, count)
index f97636b5bd090d022909e5b5ff16f6d22fb1b65f..dfe6dd12f3f63f038bde6f6d03b2e9fba0dcf32a 100644 (file)
@@ -169,7 +169,7 @@ if flame_sound then
        function fire.update_player_sound(player)
                local player_name = player:get_player_name()
                -- Search for flame nodes in radius around player
-               local ppos = player:getpos()
+               local ppos = player:get_pos()
                local areamin = vector.subtract(ppos, radius)
                local areamax = vector.add(ppos, radius)
                local fpos, num = minetest.find_nodes_in_area(
index 7f1ebced71821cb1565d53536282a65fe6f66ca9..4563381d61dad93fba7197a67313527134772802 100644 (file)
@@ -89,7 +89,7 @@ minetest.register_chatcommand("sethome", {
        func = function(name)
                name = name or "" -- fallback to blank name if nil
                local player = minetest.get_player_by_name(name)
-               if player and sethome.set(name, player:getpos()) then
+               if player and sethome.set(name, player:get_pos()) then
                        return true, "Home set!"
                end
                return false, "Player not found!"
index 4b31540de6cbda9da7f54f929eae51d2e3ee1eb1..f6511187514371fcd9648be635e693135f18cebb 100644 (file)
@@ -23,7 +23,7 @@ local function rotate_and_place(itemstack, placer, pointed_thing)
        local param2 = 0
 
        if placer then
-               local placer_pos = placer:getpos()
+               local placer_pos = placer:get_pos()
                if placer_pos then
                        param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
                end
index 26a4d696a7b79d239c1de1448751a9cccace9192..3efc6ec0a6fe38cedecf033c272d605639db3352 100644 (file)
@@ -58,8 +58,8 @@ local function eject_drops(drops, pos, radius)
                        local obj = minetest.add_item(drop_pos, dropitem)
                        if obj then
                                obj:get_luaentity().collect = true
-                               obj:setacceleration({x = 0, y = -10, z = 0})
-                               obj:setvelocity({x = math.random(-3, 3),
+                               obj:set_acceleration({x = 0, y = -10, z = 0})
+                               obj:set_velocity({x = math.random(-3, 3),
                                                y = math.random(0, 10),
                                                z = math.random(-3, 3)})
                        end
@@ -152,7 +152,7 @@ end
 local function entity_physics(pos, radius, drops)
        local objs = minetest.get_objects_inside_radius(pos, radius)
        for _, obj in pairs(objs) do
-               local obj_pos = obj:getpos()
+               local obj_pos = obj:get_pos()
                local dist = math.max(1, vector.distance(pos, obj_pos))
 
                local damage = (4 / dist) * radius
@@ -164,7 +164,7 @@ local function entity_physics(pos, radius, drops)
                        local moveoff = vector.multiply(dir, dist + 1.0)
                        local newpos = vector.add(pos, moveoff)
                        newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0})
-                       obj:setpos(newpos)
+                       obj:set_pos(newpos)
 
                        obj:set_hp(obj:get_hp() - damage)
                else
@@ -179,8 +179,8 @@ local function entity_physics(pos, radius, drops)
                        end
 
                        if do_knockback then
-                               local obj_vel = obj:getvelocity()
-                               obj:setvelocity(calc_velocity(pos, obj_pos,
+                               local obj_vel = obj:get_velocity()
+                               obj:set_velocity(calc_velocity(pos, obj_pos,
                                                obj_vel, radius * 10))
                        end
                        if do_damage then