Builtin: Replace deprecated function calls (#7561)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Tue, 17 Jul 2018 18:17:54 +0000 (20:17 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Jul 2018 18:17:54 +0000 (20:17 +0200)
builtin/game/chatcommands.lua
builtin/game/falling.lua
builtin/game/item.lua
builtin/game/item_entity.lua
builtin/game/misc.lua
builtin/game/static_spawn.lua

index 98567057260414862f11ccaba4bbb7a7204ac77a..b7f228c1b2b2882726d91fb138b5f7bcce84ed54 100644 (file)
@@ -380,7 +380,7 @@ core.register_chatcommand("teleport", {
                        end
                        teleportee = core.get_player_by_name(name)
                        if teleportee then
-                               teleportee:setpos(p)
+                               teleportee:set_pos(p)
                                return true, "Teleporting to "..core.pos_to_string(p)
                        end
                end
@@ -393,12 +393,12 @@ core.register_chatcommand("teleport", {
                if target_name then
                        local target = core.get_player_by_name(target_name)
                        if target then
-                               p = target:getpos()
+                               p = target:get_pos()
                        end
                end
                if teleportee and p then
                        p = find_free_position_near(p)
-                       teleportee:setpos(p)
+                       teleportee:set_pos(p)
                        return true, "Teleporting to " .. target_name
                                        .. " at "..core.pos_to_string(p)
                end
@@ -417,7 +417,7 @@ core.register_chatcommand("teleport", {
                        teleportee = core.get_player_by_name(teleportee_name)
                end
                if teleportee and p.x and p.y and p.z then
-                       teleportee:setpos(p)
+                       teleportee:set_pos(p)
                        return true, "Teleporting " .. teleportee_name
                                        .. " to " .. core.pos_to_string(p)
                end
@@ -433,12 +433,12 @@ core.register_chatcommand("teleport", {
                if target_name then
                        local target = core.get_player_by_name(target_name)
                        if target then
-                               p = target:getpos()
+                               p = target:get_pos()
                        end
                end
                if teleportee and p then
                        p = find_free_position_near(p)
-                       teleportee:setpos(p)
+                       teleportee:set_pos(p)
                        return true, "Teleporting " .. teleportee_name
                                        .. " to " .. target_name
                                        .. " at " .. core.pos_to_string(p)
@@ -664,7 +664,7 @@ core.register_chatcommand("spawnentity", {
                        return false, "Cannot spawn an unknown entity"
                end
                if p == "" then
-                       p = player:getpos()
+                       p = player:get_pos()
                else
                        p = core.string_to_pos(p)
                        if p == nil then
index 4806a7427a3f1f373331c4df5a921e34ecc091ef..62b6973a7f2078ec483b546572655524301bf627 100644 (file)
@@ -52,12 +52,12 @@ core.register_entity(":__builtin:falling_node", {
 
        on_step = function(self, dtime)
                -- Set gravity
-               local acceleration = self.object:getacceleration()
+               local acceleration = self.object:get_acceleration()
                if not vector.equals(acceleration, {x = 0, y = -10, z = 0}) then
-                       self.object:setacceleration({x = 0, y = -10, z = 0})
+                       self.object:set_acceleration({x = 0, y = -10, z = 0})
                end
                -- Turn to actual node when colliding with ground, or continue to move
-               local pos = self.object:getpos()
+               local pos = self.object:get_pos()
                -- Position of bottom center point
                local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z}
                -- 'bcn' is nil for unloaded nodes
@@ -124,10 +124,10 @@ core.register_entity(":__builtin:falling_node", {
                        core.check_for_falling(np)
                        return
                end
-               local vel = self.object:getvelocity()
+               local vel = self.object:get_velocity()
                if vector.equals(vel, {x = 0, y = 0, z = 0}) then
-                       local npos = self.object:getpos()
-                       self.object:setpos(vector.round(npos))
+                       local npos = self.object:get_pos()
+                       self.object:set_pos(vector.round(npos))
                end
        end
 })
index 8fbe5b672c45355787621f776783c2b9e4100ebe..591531db0b4b9e145b1dceb67b680ac8809aee54 100644 (file)
@@ -33,7 +33,7 @@ function core.get_pointed_thing_position(pointed_thing, above)
                -- The position where a node would be dug
                return pointed_thing.under
        elseif pointed_thing.type == "object" then
-               return pointed_thing.ref and pointed_thing.ref:getpos()
+               return pointed_thing.ref and pointed_thing.ref:get_pos()
        end
 end
 
@@ -331,7 +331,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
        -- Calculate the direction for furnaces and chests and stuff
        elseif (def.paramtype2 == "facedir" or
                        def.paramtype2 == "colorfacedir") and not param2 then
-               local placer_pos = placer and placer:getpos()
+               local placer_pos = placer and placer:get_pos()
                if placer_pos then
                        local dir = {
                                x = above.x - placer_pos.x,
@@ -478,7 +478,7 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
                                if inv and inv:room_for_item("main", {name=replace_with_item}) then
                                        inv:add_item("main", replace_with_item)
                                else
-                                       local pos = user:getpos()
+                                       local pos = user:get_pos()
                                        pos.y = math.floor(pos.y + 0.5)
                                        core.add_item(pos, replace_with_item)
                                end
index 4dca6117dab5732a6f98a4a6cd88768dd59fb130..a330e8723c6998aceee25804f223087e22340d7c 100644 (file)
@@ -152,7 +152,7 @@ core.register_entity(":__builtin:item", {
                        return
                end
 
-               local vel = self.object:getvelocity()
+               local vel = self.object:get_velocity()
                local def = node and core.registered_nodes[node.name]
                local is_moving = (def and not def.walkable) or
                        vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0
index 472cb21077b536287ac8dcb1aabba64a92cfe7a9..e6d16dde7918d4ff1eca8667cab86ff9081dfe59 100644 (file)
@@ -113,7 +113,7 @@ function core.get_player_radius_area(player_name, radius)
                return nil
        end
 
-       local p1 = player:getpos()
+       local p1 = player:get_pos()
        local p2 = p1
 
        if radius then
index 2a5d9b1fa8fb7ead1ada2e1775c09cf4cde4d2df..fae23eab0726a841bb2926a2ec39561e24480376 100644 (file)
@@ -15,7 +15,7 @@ local function put_player_in_spawn(player_obj)
        end
        core.log("action", "Moving " .. player_obj:get_player_name() ..
                " to static spawnpoint at " .. core.pos_to_string(static_spawnpoint))
-       player_obj:setpos(static_spawnpoint)
+       player_obj:set_pos(static_spawnpoint)
        return true
 end