return
end
if p then
- player:setpos(p)
+ player:set_pos(p)
end
-- physics, eye_offset, etc
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)
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
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)
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
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()
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
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
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
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
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}
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
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
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
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,
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
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 })
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
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,
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
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)
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(
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!"
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
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
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
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
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