forked from thunderdog1138/star_wars
Replace deprecated function calls
This commit is contained in:
parent
0df2753a68
commit
255031fc91
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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!"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue