Builtin: Replace deprecated function calls (#7561)

This commit is contained in:
SmallJoker 2018-07-17 20:17:54 +02:00 committed by Nils Dagsson Moskopp
parent 7e76781495
commit c08b05bb36
Signed by: erle
GPG Key ID: A3BC671C35191080
6 changed files with 19 additions and 19 deletions

View 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

View 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
})

View 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

View 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

View 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

View 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