0
0
Fork 0

Replace getpos() with get_pos()

This commit is contained in:
Wuzzy 2019-02-01 06:33:07 +01:00
parent 1f1361d179
commit e789801662
58 changed files with 105 additions and 105 deletions

View File

@ -4,7 +4,7 @@ minetest.register_globalstep(function(dtime)
timer = timer + dtime; timer = timer + dtime;
if timer >= 0.3 then if timer >= 0.3 then
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
local pp = player:getpos() local pp = player:get_pos()
pp.y = math.ceil(pp.y) pp.y = math.ceil(pp.y)
local loc = vector.add(pp, {x=0,y=-1,z=0}) local loc = vector.add(pp, {x=0,y=-1,z=0})
if loc ~= nil then if loc ~= nil then

View File

@ -25,7 +25,7 @@ minetest.register_entity("drippingwater:drop_water", {
on_step = function(self, dtime) on_step = function(self, dtime)
local k = math.random(1,222) local k = math.random(1,222)
local ownpos = self.object:getpos() local ownpos = self.object:get_pos()
if k==1 then if k==1 then
self.object:setacceleration({x=0, y=-5, z=0}) self.object:setacceleration({x=0, y=-5, z=0})
@ -63,7 +63,7 @@ minetest.register_entity("drippingwater:drop_lava", {
on_step = function(self, dtime) on_step = function(self, dtime)
local k = math.random(1,222) local k = math.random(1,222)
local ownpos = self.object:getpos() local ownpos = self.object:get_pos()
if k==1 then if k==1 then
self.object:setacceleration({x=0, y=-5, z=0}) self.object:setacceleration({x=0, y=-5, z=0})

View File

@ -67,7 +67,7 @@ function boat.on_rightclick(self, clicker)
clicker:set_properties({visual_size = {x=1, y=1}}) clicker:set_properties({visual_size = {x=1, y=1}})
mcl_player.player_attached[name] = false mcl_player.player_attached[name] = false
mcl_player.player_set_animation(clicker, "stand" , 30) mcl_player.player_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} pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
clicker:setpos(pos) clicker:setpos(pos)
elseif not self._driver then elseif not self._driver then
@ -131,7 +131,7 @@ function boat.on_punch(self, puncher)
self._removed = true self._removed = true
-- Drop boat as item on the ground after punching -- Drop boat as item on the ground after punching
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(self.object:getpos(), self._itemstring) minetest.add_item(self.object:get_pos(), self._itemstring)
end end
self.object:remove() self.object:remove()
end end
@ -189,7 +189,7 @@ function boat.on_step(self, dtime)
end end
local velo = self.object:getvelocity() local velo = self.object:getvelocity()
if self._v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then 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:setpos(self.object:get_pos())
return return
end end
local s = get_sign(self._v) local s = get_sign(self._v)
@ -203,7 +203,7 @@ function boat.on_step(self, dtime)
self._v = 5 * get_sign(self._v) self._v = 5 * get_sign(self._v)
end end
local p = self.object:getpos() local p = self.object:get_pos()
p.y = p.y - boat_y_offset p.y = p.y - boat_y_offset
local new_velo local new_velo
local new_acce = {x = 0, y = 0, z = 0} local new_acce = {x = 0, y = 0, z = 0}
@ -217,7 +217,7 @@ function boat.on_step(self, dtime)
end end
new_velo = get_velocity(self._v, self.object:getyaw(), new_velo = get_velocity(self._v, self.object:getyaw(),
self.object:getvelocity().y) self.object:getvelocity().y)
self.object:setpos(self.object:getpos()) self.object:setpos(self.object:get_pos())
else else
p.y = p.y + 1 p.y = p.y + 1
if is_water(p) then if is_water(p) then
@ -230,18 +230,18 @@ function boat.on_step(self, dtime)
new_acce = {x = 0, y = 5, z = 0} new_acce = {x = 0, y = 5, z = 0}
end end
new_velo = get_velocity(self._v, self.object:getyaw(), y) new_velo = get_velocity(self._v, self.object:getyaw(), y)
self.object:setpos(self.object:getpos()) self.object:setpos(self.object:get_pos())
else else
new_acce = {x = 0, y = 0, z = 0} new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:getvelocity().y) < 1 then if math.abs(self.object:getvelocity().y) < 1 then
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = math.floor(pos.y) + boat_y_offset pos.y = math.floor(pos.y) + boat_y_offset
self.object:setpos(pos) self.object:setpos(pos)
new_velo = get_velocity(self._v, self.object:getyaw(), 0) new_velo = get_velocity(self._v, self.object:getyaw(), 0)
else else
new_velo = get_velocity(self._v, self.object:getyaw(), new_velo = get_velocity(self._v, self.object:getyaw(),
self.object:getvelocity().y) self.object:getvelocity().y)
self.object:setpos(self.object:getpos()) self.object:setpos(self.object:get_pos())
end end
end end
end end

View File

@ -55,7 +55,7 @@ end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
local pos = player:getpos() local pos = player:get_pos()
local inv = player:get_inventory() local inv = player:get_inventory()
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z} local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
@ -67,7 +67,7 @@ minetest.register_globalstep(function(dtime)
if object:get_luaentity()._magnet_timer >= 0 and object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then if object:get_luaentity()._magnet_timer >= 0 and object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
-- Collection -- Collection
if vector.distance(checkpos, object:getpos()) <= item_drop_settings.radius_collect and not object:get_luaentity()._removed then if vector.distance(checkpos, object:get_pos()) <= item_drop_settings.radius_collect and not object:get_luaentity()._removed then
-- Ignore if itemstring is not set yet -- Ignore if itemstring is not set yet
if object:get_luaentity().itemstring ~= "" then if object:get_luaentity().itemstring ~= "" then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
@ -95,7 +95,7 @@ minetest.register_globalstep(function(dtime)
-- Move object to player -- Move object to player
disable_physics(object, object:get_luaentity()) disable_physics(object, object:get_luaentity())
local opos = object:getpos() local opos = object:get_pos()
local vec = vector.subtract(checkpos, opos) local vec = vector.subtract(checkpos, opos)
vec = vector.add(opos, vector.divide(vec, 2)) vec = vector.add(opos, vector.divide(vec, 2))
object:moveto(vec) object:moveto(vec)
@ -503,12 +503,12 @@ core.register_entity(":__builtin:item", {
-- Delete corrupted item entities. The itemstring MUST be non-empty on its first step, -- Delete corrupted item entities. The itemstring MUST be non-empty on its first step,
-- otherwise there might have some data corruption. -- otherwise there might have some data corruption.
if self.itemstring == "" then if self.itemstring == "" then
minetest.log("warning", "Item entity with empty itemstring found at "..minetest.pos_to_string(self.object:getpos()).. "! Deleting it now.") minetest.log("warning", "Item entity with empty itemstring found at "..minetest.pos_to_string(self.object:get_pos()).. "! Deleting it now.")
self._removed = true self._removed = true
self.object:remove() self.object:remove()
end end
local p = self.object:getpos() local p = self.object:get_pos()
local node = core.get_node_or_nil(p) local node = core.get_node_or_nil(p)
local in_unloaded = (node == nil) local in_unloaded = (node == nil)
@ -530,7 +530,7 @@ core.register_entity(":__builtin:item", {
if (def and def.groups and (def.groups.lava or def.groups.destroys_items == 1)) then if (def and def.groups and (def.groups.lava or def.groups.destroys_items == 1)) then
-- Special effect for lava -- Special effect for lava
if def.groups.lava then if def.groups.lava then
minetest.sound_play("builtin_item_lava", {pos = self.object:getpos(), gain = 0.5}) minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5})
end end
self._removed = true self._removed = true
self.object:remove() self.object:remove()

View File

@ -41,7 +41,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
end end
function cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) function cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos() local pos = self.object:get_pos()
if not self._railtype then if not self._railtype then
local node = minetest.get_node(vector.floor(pos)).name local node = minetest.get_node(vector.floor(pos)).name
self._railtype = minetest.get_item_group(node, "connect_to_raillike") self._railtype = minetest.get_item_group(node, "connect_to_raillike")
@ -83,7 +83,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
-- Drop items and remove cart entity -- Drop items and remove cart entity
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
for d=1, #drop do for d=1, #drop do
minetest.add_item(self.object:getpos(), drop[d]) minetest.add_item(self.object:get_pos(), drop[d])
end end
end end
@ -124,7 +124,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
local pos, rou_pos, node local pos, rou_pos, node
-- Drop minecart if it isn't on a rail anymore -- Drop minecart if it isn't on a rail anymore
if self._last_float_check >= mcl_minecarts.check_float_time then if self._last_float_check >= mcl_minecarts.check_float_time then
pos = self.object:getpos() pos = self.object:get_pos()
rou_pos = vector.round(pos) rou_pos = vector.round(pos)
node = minetest.get_node(rou_pos) node = minetest.get_node(rou_pos)
local g = minetest.get_item_group(node.name, "connect_to_raillike") local g = minetest.get_item_group(node.name, "connect_to_raillike")
@ -145,7 +145,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
-- Drop items and remove cart entity -- Drop items and remove cart entity
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
for d=1, #drop do for d=1, #drop do
minetest.add_item(self.object:getpos(), drop[d]) minetest.add_item(self.object:get_pos(), drop[d])
end end
end end
@ -165,7 +165,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
local dir, last_switch = nil, nil local dir, last_switch = nil, nil
if not pos then if not pos then
pos = self.object:getpos() pos = self.object:get_pos()
end end
if self._old_pos and not self._punched then if self._old_pos and not self._punched then
local flo_pos = vector.floor(pos) local flo_pos = vector.floor(pos)
@ -485,7 +485,7 @@ register_minecart(
clicker:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0}) clicker:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
elseif not self._driver then elseif not self._driver then
self._driver = player_name self._driver = player_name
self._start_pos = self.object:getpos() self._start_pos = self.object:get_pos()
mcl_player.player_attached[player_name] = true mcl_player.player_attached[player_name] = true
clicker:set_attach(self.object, "", {x=0, y=8.25, z=-2}, {x=0, y=0, z=0}) clicker:set_attach(self.object, "", {x=0, y=8.25, z=-2}, {x=0, y=0, z=0})
mcl_player.player_attached[name] = true mcl_player.player_attached[name] = true

View File

@ -710,7 +710,7 @@ mobs:register_mob("mob_horse:horse", {
if inv:room_for_item("main", "mobs:saddle") then if inv:room_for_item("main", "mobs:saddle") then
inv:add_item("main", "mobs:saddle") inv:add_item("main", "mobs:saddle")
else else
minetest.add_item(clicker.getpos(), "mobs:saddle") minetest.add_item(clicker.get_pos(), "mobs:saddle")
end end
-- attach player to horse -- attach player to horse

View File

@ -52,7 +52,7 @@ local THROWING_ARROW_ENTITY={
--ARROW CODE --ARROW CODE
THROWING_ARROW_ENTITY.on_step = function(self, dtime) THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:get_pos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
minetest.add_particle({ minetest.add_particle({
@ -113,7 +113,7 @@ local throwing_shoot_arrow = function(itemstack, player)
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
player:get_inventory():remove_item("main", arrow[1]) player:get_inventory():remove_item("main", arrow[1])
end end
local playerpos = player:getpos() local playerpos = player:get_pos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) --mc local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) --mc
local dir = player:get_look_dir() local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*22, y=dir.y*22, z=dir.z*22}) obj:setvelocity({x=dir.x*22, y=dir.y*22, z=dir.z*22})
@ -247,7 +247,7 @@ if c("egg") then
-- shoot egg -- shoot egg
local mobs_shoot_egg = function (item, player, pointed_thing) local mobs_shoot_egg = function (item, player, pointed_thing)
local playerpos = player:getpos() local playerpos = player:get_pos()
minetest.sound_play("default_place_node_hard", { minetest.sound_play("default_place_node_hard", {
pos = playerpos, pos = playerpos,
@ -337,7 +337,7 @@ if c("snowball") then
-- shoot snowball -- shoot snowball
local mobs_shoot_snowball = function (item, player, pointed_thing) local mobs_shoot_snowball = function (item, player, pointed_thing)
local playerpos = player:getpos() local playerpos = player:get_pos()
local obj = minetest.add_entity({ local obj = minetest.add_entity({
x = playerpos.x, x = playerpos.x,

View File

@ -32,13 +32,13 @@ mobs_mc.make_owner_teleport_function = function(dist, teleport_check_interval)
self._teleport_timer = self._teleport_timer - dtime self._teleport_timer = self._teleport_timer - dtime
if self._teleport_timer <= 0 then if self._teleport_timer <= 0 then
self._teleport_timer = teleport_check_interval self._teleport_timer = teleport_check_interval
local mob_pos = self.object:getpos() local mob_pos = self.object:get_pos()
local owner = minetest.get_player_by_name(self.owner) local owner = minetest.get_player_by_name(self.owner)
if not owner then if not owner then
-- No owner found, no teleportation -- No owner found, no teleportation
return return
end end
local owner_pos = owner:getpos() local owner_pos = owner:get_pos()
local dist_from_owner = vector.distance(owner_pos, mob_pos) local dist_from_owner = vector.distance(owner_pos, mob_pos)
if dist_from_owner > dist then if dist_from_owner > dist then
-- Check for nodes below air in a 5×1×5 area around the owner position -- Check for nodes below air in a 5×1×5 area around the owner position

View File

@ -80,7 +80,7 @@ mobs:register_mob("mobs_mc:chicken", {
return return
end end
local pos = self.object:getpos() local pos = self.object:get_pos()
minetest.add_item(pos, mobs_mc.items.egg) minetest.add_item(pos, mobs_mc.items.egg)

View File

@ -61,7 +61,7 @@ local cow_def = {
if inv:room_for_item("main", {name=mobs_mc.items.milk}) then if inv:room_for_item("main", {name=mobs_mc.items.milk}) then
clicker:get_inventory():add_item("main", mobs_mc.items.milk) clicker:get_inventory():add_item("main", mobs_mc.items.milk)
else else
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs_mc.items.milk}) minetest.add_item(pos, {name = mobs_mc.items.milk})
end end
@ -91,7 +91,7 @@ mooshroom_def.on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item() local item = clicker:get_wielded_item()
-- Use shears to get mushrooms and turn mooshroom into cow -- Use shears to get mushrooms and turn mooshroom into cow
if item:get_name() == mobs_mc.items.shears then if item:get_name() == mobs_mc.items.shears then
local pos = self.object:getpos() local pos = self.object:get_pos()
minetest.sound_play("shears", {pos = pos}) minetest.sound_play("shears", {pos = pos})
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, mobs_mc.items.mushroom_red .. " 5") minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, mobs_mc.items.mushroom_red .. " 5")
@ -112,7 +112,7 @@ mooshroom_def.on_rightclick = function(self, clicker)
if inv:room_for_item("main", {name=mobs_mc.items.milk}) then if inv:room_for_item("main", {name=mobs_mc.items.milk}) then
clicker:get_inventory():add_item("main", mobs_mc.items.milk) clicker:get_inventory():add_item("main", mobs_mc.items.milk)
else else
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs_mc.items.milk}) minetest.add_item(pos, {name = mobs_mc.items.milk})
end end
@ -124,7 +124,7 @@ mooshroom_def.on_rightclick = function(self, clicker)
if inv:room_for_item("main", {name=mobs_mc.items.mushroom_stew}) then if inv:room_for_item("main", {name=mobs_mc.items.mushroom_stew}) then
clicker:get_inventory():add_item("main", mobs_mc.items.mushroom_stew) clicker:get_inventory():add_item("main", mobs_mc.items.mushroom_stew)
else else
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew}) minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew})
end end

View File

@ -62,19 +62,19 @@ mobs:register_mob("mobs_mc:creeper", {
item:add_wear(1000) item:add_wear(1000)
-- Tool break sound -- Tool break sound
if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = clicker:getpos(), gain = 0.5}) minetest.sound_play(wdef.sound.breaks, {pos = clicker:get_pos(), gain = 0.5})
end end
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end
self._forced_explosion_countdown_timer = self.explosion_timer self._forced_explosion_countdown_timer = self.explosion_timer
minetest.sound_play(self.sounds.attack, {pos = self.object:getpos(), gain = 1, max_hear_distance = 16}) minetest.sound_play(self.sounds.attack, {pos = self.object:get_pos(), gain = 1, max_hear_distance = 16})
end end
end, end,
do_custom = function(self, dtime) do_custom = function(self, dtime)
if self._forced_explosion_countdown_timer ~= nil then if self._forced_explosion_countdown_timer ~= nil then
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
if self._forced_explosion_countdown_timer <= 0 then if self._forced_explosion_countdown_timer <= 0 then
mobs:explosion(self.object:getpos(), self.explosion_radius, 0, 1, self.sounds.explode) mobs:explosion(self.object:get_pos(), self.explosion_radius, 0, 1, self.sounds.explode)
self.object:remove() self.object:remove()
end end
end end

View File

@ -110,7 +110,7 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
on_step = function(self, dtime) on_step = function(self, dtime)
local pos = self.object:getpos() local pos = self.object:get_pos()
local n = minetest.get_node(pos).name local n = minetest.get_node(pos).name
@ -158,7 +158,7 @@ mobs:register_arrow(":mobs_mc:fireball2", {
-- direct hit, no fire... just plenty of pain -- direct hit, no fire... just plenty of pain
hit_player = function(self, player) hit_player = function(self, player)
minetest.sound_play("tnt_explode", {pos = player:getpos(), gain = 1.5, max_hear_distance = 2*64}) minetest.sound_play("tnt_explode", {pos = player:get_pos(), gain = 1.5, max_hear_distance = 2*64})
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 6}, damage_groups = {fleshy = 6},
@ -167,7 +167,7 @@ mobs:register_arrow(":mobs_mc:fireball2", {
end, end,
hit_mob = function(self, mob) hit_mob = function(self, mob)
minetest.sound_play("tnt_explode", {pos = mob:getpos(), gain = 1.5, max_hear_distance = 2*64}) minetest.sound_play("tnt_explode", {pos = mob:get_pos(), gain = 1.5, max_hear_distance = 2*64})
mob:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 12}, damage_groups = {fleshy = 12},

View File

@ -217,7 +217,7 @@ mobs:register_mob("mobs_mc:enderman", {
-- Take random node -- Take random node
self._take_place_timer = 0 self._take_place_timer = 0
self._next_take_place_time = math.random(place_frequency_min, place_frequency_max) self._next_take_place_time = math.random(place_frequency_min, place_frequency_max)
local pos = self.object:getpos() local pos = self.object:get_pos()
local takable_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mobs_mc.enderman_takable) local takable_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mobs_mc.enderman_takable)
if #takable_nodes >= 1 then if #takable_nodes >= 1 then
local r = pr:next(1, #takable_nodes) local r = pr:next(1, #takable_nodes)
@ -268,7 +268,7 @@ mobs:register_mob("mobs_mc:enderman", {
-- Place taken node -- Place taken node
self._take_place_timer = 0 self._take_place_timer = 0
self._next_take_place_time = math.random(take_frequency_min, take_frequency_max) self._next_take_place_time = math.random(take_frequency_min, take_frequency_max)
local pos = self.object:getpos() local pos = self.object:get_pos()
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
-- Place node at looking direction -- Place node at looking direction
local place_pos = vector.subtract(pos, minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(yaw)))) local place_pos = vector.subtract(pos, minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(yaw))))
@ -291,7 +291,7 @@ mobs:register_mob("mobs_mc:enderman", {
-- TODO: Teleport enderman on damage, etc. -- TODO: Teleport enderman on damage, etc.
_do_teleport = function(self) _do_teleport = function(self)
-- Attempt to randomly teleport enderman -- Attempt to randomly teleport enderman
local pos = self.object:getpos() local pos = self.object:get_pos()
-- Find all solid nodes below air in a 65×65×65 cuboid centered on the enderman -- Find all solid nodes below air in a 65×65×65 cuboid centered on the enderman
local nodes = minetest.find_nodes_in_area_under_air(vector.subtract(pos, 32), vector.add(pos, 32), {"group:solid", "group:cracky", "group:crumbly"}) local nodes = minetest.find_nodes_in_area_under_air(vector.subtract(pos, 32), vector.add(pos, 32), {"group:solid", "group:cracky", "group:crumbly"})
local telepos local telepos

View File

@ -85,7 +85,7 @@ local ocelot = {
-- 1/3 chance of getting tamed -- 1/3 chance of getting tamed
if pr:next(1, 3) == 1 then if pr:next(1, 3) == 1 then
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
local cat = minetest.add_entity(self.object:getpos(), "mobs_mc:cat") local cat = minetest.add_entity(self.object:get_pos(), "mobs_mc:cat")
cat:set_yaw(yaw) cat:set_yaw(yaw)
local ent = cat:get_luaentity() local ent = cat:get_luaentity()
ent.owner = clicker:get_player_name() ent.owner = clicker:get_player_name()

View File

@ -153,7 +153,7 @@ mobs:register_mob("mobs_mc:pig", {
-- Break carrot on a stick -- Break carrot on a stick
local def = wielditem:get_definition() local def = wielditem:get_definition()
if def.sounds and def.sounds.breaks then if def.sounds and def.sounds.breaks then
minetest.sound_play(def.sounds.breaks, {pos = clicker:getpos(), max_hear_distance = 8, gain = 0.5}) minetest.sound_play(def.sounds.breaks, {pos = clicker:get_pos(), max_hear_distance = 8, gain = 0.5})
end end
wielditem = {name = mobs_mc.items.fishing_rod, count = 1} wielditem = {name = mobs_mc.items.fishing_rod, count = 1}
else else

View File

@ -156,7 +156,7 @@ mobs:register_mob("mobs_mc:sheep", {
if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then
self.gotten = true self.gotten = true
local pos = self.object:getpos() local pos = self.object:get_pos()
minetest.sound_play("shears", {pos = pos}) minetest.sound_play("shears", {pos = pos})
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
if not self.color then if not self.color then

View File

@ -85,7 +85,7 @@ mobs:register_mob("mobs_mc:snowman", {
self._snowtimer = self._snowtimer + dtime self._snowtimer = self._snowtimer + dtime
if self.health > 0 and self._snowtimer > snow_trail_frequency then if self.health > 0 and self._snowtimer > snow_trail_frequency then
self._snowtimer = 0 self._snowtimer = 0
local pos = self.object:getpos() local pos = self.object:get_pos()
local below = {x=pos.x, y=pos.y-1, z=pos.z} local below = {x=pos.x, y=pos.y-1, z=pos.z}
local def = minetest.registered_nodes[minetest.get_node(pos).name] local def = minetest.registered_nodes[minetest.get_node(pos).name]
-- Node at snow golem's position must be replacable -- Node at snow golem's position must be replacable
@ -110,7 +110,7 @@ mobs:register_mob("mobs_mc:snowman", {
textures = gotten_texture, textures = gotten_texture,
}) })
local pos = self.object:getpos() local pos = self.object:get_pos()
minetest.sound_play("shears", {pos = pos}) minetest.sound_play("shears", {pos = pos})
-- Wear out -- Wear out

View File

@ -38,7 +38,7 @@ mobs:register_mob("mobs_mc:evoker", {
-- Summon vexes -- Summon vexes
custom_attack = function(self, to_attack) custom_attack = function(self, to_attack)
local r = pr:next(2,4) local r = pr:next(2,4)
local basepos = self.object:getpos() local basepos = self.object:get_pos()
basepos.y = basepos.y + 1 basepos.y = basepos.y + 1
for i=1, r do for i=1, r do
local spawnpos = vector.add(basepos, minetest.yaw_to_dir(pr:next(0,360))) local spawnpos = vector.add(basepos, minetest.yaw_to_dir(pr:next(0,360)))

View File

@ -84,7 +84,7 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
on_step = function(self, dtime) on_step = function(self, dtime)
local pos = self.object:getpos() local pos = self.object:get_pos()
local n = minetest.get_node(pos).name local n = minetest.get_node(pos).name

View File

@ -65,7 +65,7 @@ local wolf = {
-- 1/3 chance of getting tamed -- 1/3 chance of getting tamed
if pr:next(1, 3) == 1 then if pr:next(1, 3) == 1 then
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
dog = minetest.add_entity(self.object:getpos(), "mobs_mc:dog") dog = minetest.add_entity(self.object:get_pos(), "mobs_mc:dog")
dog:set_yaw(yaw) dog:set_yaw(yaw)
ent = dog:get_luaentity() ent = dog:get_luaentity()
ent.owner = clicker:get_player_name() ent.owner = clicker:get_player_name()

View File

@ -54,7 +54,7 @@ local function choose_pos(pos)
local r = rng:next(1, playercount) local r = rng:next(1, playercount)
local randomplayer = playerlist[r] local randomplayer = playerlist[r]
pos = randomplayer:getpos() pos = randomplayer:get_pos()
-- avoid striking underground -- avoid striking underground
if pos.y < -20 then if pos.y < -20 then

View File

@ -178,7 +178,7 @@ mcl_weather.rain.make_weather = function()
end end
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:getpos())) then if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
mcl_weather.rain.remove_sound(player) mcl_weather.rain.remove_sound(player)
return false return false
end end

View File

@ -140,7 +140,7 @@ mcl_weather.skycolor = {
local players = mcl_weather.skycolor.utils.get_players(nil) local players = mcl_weather.skycolor.utils.get_players(nil)
for _, player in ipairs(players) do for _, player in ipairs(players) do
local pos = player:getpos() local pos = player:get_pos()
local dim = mcl_worlds.pos_to_dimension(pos) local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "overworld" then if dim == "overworld" then
player:set_sky(color, "plain", nil, true) player:set_sky(color, "plain", nil, true)

View File

@ -8,7 +8,7 @@ mcl_weather.snow.add_snow_particles = function(player)
mcl_weather.rain.last_rp_count = 0 mcl_weather.rain.last_rp_count = 0
for i=mcl_weather.snow.particles_count, 1,-1 do for i=mcl_weather.snow.particles_count, 1,-1 do
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player) local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
random_pos_y = math.random() + math.random(player:getpos().y - 1, player:getpos().y + 7) random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7)
if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1 mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
minetest.add_particle({ minetest.add_particle({
@ -78,7 +78,7 @@ minetest.register_globalstep(function(dtime)
end end
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:getpos())) then if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
return false return false
end end
mcl_weather.snow.add_snow_particles(player) mcl_weather.snow.add_snow_particles(player)

View File

@ -75,7 +75,7 @@ end
-- checks if player is undewater. This is needed in order to -- checks if player is undewater. This is needed in order to
-- turn off weather particles generation. -- turn off weather particles generation.
mcl_weather.is_underwater = function(player) mcl_weather.is_underwater = function(player)
local ppos = player:getpos() local ppos = player:get_pos()
local offset = player:get_eye_offset() local offset = player:get_eye_offset()
local player_eye_pos = {x = ppos.x + offset.x, local player_eye_pos = {x = ppos.x + offset.x,
y = ppos.y + offset.y + 1.5, y = ppos.y + offset.y + 1.5,

View File

@ -125,7 +125,7 @@ minetest.register_on_dieplayer(function(player)
return return
end end
local node = minetest.registered_nodes[minetest.get_node(player:getpos()).name] local node = minetest.registered_nodes[minetest.get_node(player:get_pos()).name]
local msg local msg
-- Lava -- Lava
if minetest.get_item_group(node.name, "lava") ~= 0 then if minetest.get_item_group(node.name, "lava") ~= 0 then

View File

@ -36,7 +36,7 @@ end
local function return_fields(player, name) local function return_fields(player, name)
local inv = player:get_inventory() local inv = player:get_inventory()
for i,stack in ipairs(inv:get_list(name)) do for i,stack in ipairs(inv:get_list(name)) do
return_item(stack, player, player:getpos(), inv) return_item(stack, player, player:get_pos(), inv)
stack:clear() stack:clear()
inv:set_stack(name, i, stack) inv:set_stack(name, i, stack)
end end

View File

@ -41,7 +41,7 @@ local function resolve_commands(commands, pos)
local nearest, farthest = nil, nil local nearest, farthest = nil, nil
local min_distance, max_distance = math.huge, -1 local min_distance, max_distance = math.huge, -1
for index, player in pairs(players) do for index, player in pairs(players) do
local distance = vector.distance(pos, player:getpos()) local distance = vector.distance(pos, player:get_pos())
if distance < min_distance then if distance < min_distance then
min_distance = distance min_distance = distance
nearest = player:get_player_name() nearest = player:get_player_name()

View File

@ -304,7 +304,7 @@ function mesecon.mvps_move_objects(pos, dir, nodestack)
for _, obj in ipairs(objects_to_move) do for _, obj in ipairs(objects_to_move) do
local entity = obj:get_luaentity() local entity = obj:get_luaentity()
if not entity or not mesecon.is_mvps_unmov(entity.name) then if not entity or not mesecon.is_mvps_unmov(entity.name) then
local np = vector.add(obj:getpos(), dir) local np = vector.add(obj:get_pos(), dir)
--move only if destination is not solid --move only if destination is not solid
local nn = minetest.get_node(np) local nn = minetest.get_node(np)

View File

@ -56,7 +56,7 @@ local function pp_on_timer(pos, elapsed)
end end
elseif node.name == basename .. "_off" then elseif node.name == basename .. "_off" then
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
local objpos = obj:getpos() local objpos = obj:get_pos()
if obj_does_activate(obj, activated_by) then if obj_does_activate(obj, activated_by) then
if objpos.y > pos.y-1 and objpos.y < pos.y then if objpos.y > pos.y-1 and objpos.y < pos.y then
minetest.set_node(pos, {name = basename .. "_on"}) minetest.set_node(pos, {name = basename .. "_on"})

View File

@ -394,7 +394,7 @@ local entity_standing = {
-- This is a custom function which causes the banner to be dropped as item and destroys the entity. -- This is a custom function which causes the banner to be dropped as item and destroys the entity.
_drop = function(self) _drop = function(self)
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = pos.y + 1 pos.y = pos.y + 1
if not minetest.settings:get_bool("creative_mode") and self._base_color then if not minetest.settings:get_bool("creative_mode") and self._base_color then

View File

@ -212,7 +212,7 @@ function mcl_beds.on_rightclick(pos, player)
end end
end end
local name = player:get_player_name() local name = player:get_player_name()
local ppos = player:getpos() local ppos = player:get_pos()
local tod = minetest.get_timeofday() * 24000 local tod = minetest.get_timeofday() * 24000
-- Values taken from Minecraft Wiki with offset of +6000 -- Values taken from Minecraft Wiki with offset of +6000

View File

@ -94,7 +94,7 @@ local spawn_item = function(self, pos)
end end
ARROW_ENTITY.on_step = function(self, dtime) ARROW_ENTITY.on_step = function(self, dtime)
local pos = self.object:getpos() local pos = self.object:get_pos()
local dpos = table.copy(pos) -- digital pos local dpos = table.copy(pos) -- digital pos
dpos = vector.round(dpos) dpos = vector.round(dpos)
local node = minetest.get_node(dpos) local node = minetest.get_node(dpos)
@ -166,7 +166,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
end end
if ok then if ok then
local dist = vector.distance(pos, obj:getpos()) local dist = vector.distance(pos, obj:get_pos())
if not closest_object or not closest_distance then if not closest_object or not closest_distance then
closest_object = obj closest_object = obj
closest_distance = dist closest_distance = dist

View File

@ -82,7 +82,7 @@ local player_shoot_arrow = function(itemstack, player, power, damage)
local inv = player:get_inventory() local inv = player:get_inventory()
inv:set_stack("main", arrow_stack_id, arrow_stack) inv:set_stack("main", arrow_stack_id, arrow_stack)
end end
local playerpos = player:getpos() local playerpos = player:get_pos()
local dir = player:get_look_dir() local dir = player:get_look_dir()
local yaw = player:get_look_horizontal() local yaw = player:get_look_horizontal()

View File

@ -146,7 +146,7 @@ function mcl_buckets.register_liquid(source_place, source_take, itemname, invent
if inv:room_for_item("main", new_bucket) then if inv:room_for_item("main", new_bucket) then
inv:add_item("main", new_bucket) inv:add_item("main", new_bucket)
else else
minetest.add_item(user:getpos(), new_bucket) minetest.add_item(user:get_pos(), new_bucket)
end end
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
@ -247,7 +247,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
if inv:room_for_item("main", new_bucket) then if inv:room_for_item("main", new_bucket) then
inv:add_item("main", new_bucket) inv:add_item("main", new_bucket)
else else
minetest.add_item(user:getpos(), new_bucket) minetest.add_item(user:get_pos(), new_bucket)
end end
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()

View File

@ -96,7 +96,7 @@ minetest.register_globalstep(function(dtime)
local dim = mcl_worlds.pos_to_dimension(player:get_pos()) local dim = mcl_worlds.pos_to_dimension(player:get_pos())
local frame local frame
-- Clocks do not work in certain zones -- Clocks do not work in certain zones
if not mcl_worlds.clock_works(player:getpos()) then if not mcl_worlds.clock_works(player:get_pos()) then
frame = random_frame frame = random_frame
else else
frame = now frame = now

View File

@ -28,7 +28,7 @@ minetest.register_globalstep(function(dtime)
return false return false
end end
if has_compass(player) then if has_compass(player) then
local pos = player:getpos() local pos = player:get_pos()
local dim = mcl_worlds.pos_to_dimension(pos) local dim = mcl_worlds.pos_to_dimension(pos)
local compass_image local compass_image
-- Compasses do not work in certain zones -- Compasses do not work in certain zones

View File

@ -121,7 +121,7 @@ function mcl_doors:register_trapdoor(name, def)
local p1 = pointed_thing.above local p1 = pointed_thing.above
local param2 = 0 local param2 = 0
local placer_pos = placer:getpos() local placer_pos = placer:get_pos()
if placer_pos then if placer_pos then
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos)) param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
end end

View File

@ -95,7 +95,7 @@ minetest.register_node("mcl_end:end_rod", {
local p1 = pointed_thing.above local p1 = pointed_thing.above
local param2 = 0 local param2 = 0
local placer_pos = placer:getpos() local placer_pos = placer:get_pos()
if placer_pos then if placer_pos then
local dir = { local dir = {
x = p1.x - placer_pos.x, x = p1.x - placer_pos.x,

View File

@ -35,7 +35,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
used = true used = true
end end
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5}) minetest.sound_play(idef.sound.breaks, {pos=user:get_pos(), gain=0.5})
end end
if not minetest.settings:get_bool("creative_mode") and used == true then if not minetest.settings:get_bool("creative_mode") and used == true then
itemstack:add_wear(65535/65) -- 65 uses itemstack:add_wear(65535/65) -- 65 uses

View File

@ -203,7 +203,7 @@ if flame_sound then
function mcl_fire.update_player_sound(player) function mcl_fire.update_player_sound(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
-- Search for flame nodes in radius around player -- Search for flame nodes in radius around player
local ppos = player:getpos() local ppos = player:get_pos()
local areamin = vector.subtract(ppos, radius) local areamin = vector.subtract(ppos, radius)
local areamax = vector.add(ppos, radius) local areamax = vector.add(ppos, radius)
local fpos, num = minetest.find_nodes_in_area( local fpos, num = minetest.find_nodes_in_area(

View File

@ -297,7 +297,7 @@ minetest.register_abm({
-- Item must get sucked in when the item just TOUCHES the block above the hopper -- Item must get sucked in when the item just TOUCHES the block above the hopper
-- This is the reason for the Y calculation. -- This is the reason for the Y calculation.
-- Test: Items on farmland and slabs get sucked, but items on full blocks don't -- Test: Items on farmland and slabs get sucked, but items on full blocks don't
local posob = object:getpos() local posob = object:get_pos()
local posob_miny = posob.y + object:get_properties().collisionbox[2] local posob_miny = posob.y + object:get_properties().collisionbox[2]
if math.abs(posob.x-pos.x) <= 0.5 and (posob_miny-pos.y < 1.5 and posob.y-pos.y >= 0.3) then if math.abs(posob.x-pos.x) <= 0.5 and (posob_miny-pos.y < 1.5 and posob.y-pos.y >= 0.3) then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) inv:add_item("main", ItemStack(object:get_luaentity().itemstring))

View File

@ -9,7 +9,7 @@ local make_filled_map = function(itemstack, placer, pointed_thing)
if inv:room_for_item("main", new_map) then if inv:room_for_item("main", new_map) then
inv:add_item("main", new_map) inv:add_item("main", new_map)
else else
minetest.add_item(placer:getpos(), new_map) minetest.add_item(placer:get_pos(), new_map)
end end
return itemstack return itemstack
end end

View File

@ -365,7 +365,7 @@ end
doll_def.on_step = function(self, dtime) doll_def.on_step = function(self, dtime)
-- Check if spawner is still present. If not, delete the entity -- Check if spawner is still present. If not, delete the entity
self.timer = self.timer + 0.01 self.timer = self.timer + 0.01
local n = minetest.get_node_or_nil(self.object:getpos()) local n = minetest.get_node_or_nil(self.object:get_pos())
if self.timer > 1 then if self.timer > 1 then
if n and n.name and n.name ~= "mcl_mobspawners:spawner" then if n and n.name and n.name ~= "mcl_mobspawners:spawner" then
self.object:remove() self.object:remove()

View File

@ -223,7 +223,7 @@ minetest.register_abm({
if obj:is_player() or lua_entity then if obj:is_player() or lua_entity then
local dim = mcl_worlds.pos_to_dimension(pos) local dim = mcl_worlds.pos_to_dimension(pos)
local objpos = obj:getpos() local objpos = obj:get_pos()
if objpos == nil then if objpos == nil then
return return
end end

View File

@ -415,7 +415,7 @@ minetest.register_abm({
if portal_cooloff[obj] then if portal_cooloff[obj] then
return return
end end
local objpos = obj:getpos() local objpos = obj:get_pos()
if objpos == nil then if objpos == nil then
return return
end end

View File

@ -84,7 +84,7 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
if inv:room_for_item("main", water_bottle) then if inv:room_for_item("main", water_bottle) then
inv:add_item("main", water_bottle) inv:add_item("main", water_bottle)
else else
minetest.add_item(placer:getpos(), water_bottle) minetest.add_item(placer:get_pos(), water_bottle)
end end
itemstack:take_item() itemstack:take_item()
end end

View File

@ -283,7 +283,7 @@ minetest.register_node("mcl_signs:wall_sign", {
local wdir = minetest.dir_to_wallmounted(dir) local wdir = minetest.dir_to_wallmounted(dir)
local placer_pos = placer:getpos() local placer_pos = placer:get_pos()
local fdir = minetest.dir_to_facedir(dir) local fdir = minetest.dir_to_facedir(dir)
@ -443,7 +443,7 @@ minetest.register_entity("mcl_signs:text", {
self._signnodename = des._signnodename self._signnodename = des._signnodename
end end
end end
local meta = minetest.get_meta(self.object:getpos()) local meta = minetest.get_meta(self.object:get_pos())
local text = meta:get_string("text") local text = meta:get_string("text")
self.object:set_properties({ self.object:set_properties({
textures={generate_texture(create_lines(text), self._signnodename)}, textures={generate_texture(create_lines(text), self._signnodename)},

View File

@ -29,7 +29,7 @@ local function place_slab_normal(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under local p0 = pointed_thing.under
local p1 = pointed_thing.above local p1 = pointed_thing.above
local placer_pos = placer:getpos() local placer_pos = placer:get_pos()
local fpos = get_fpos(placer, pointed_thing) local fpos = get_fpos(placer, pointed_thing)
@ -57,7 +57,7 @@ local function place_stair(itemstack, placer, pointed_thing)
local p1 = pointed_thing.above local p1 = pointed_thing.above
local param2 = 0 local param2 = 0
local placer_pos = placer:getpos() local placer_pos = placer:get_pos()
if placer_pos then if placer_pos then
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos)) param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
end end

View File

@ -114,7 +114,7 @@ local pearl_ENTITY={
-- Snowball on_step()--> called when snowball is moving. -- Snowball on_step()--> called when snowball is moving.
local snowball_on_step = function(self, dtime) local snowball_on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:get_pos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
@ -131,7 +131,7 @@ end
-- Movement function of egg -- Movement function of egg
local egg_on_step = function(self, dtime) local egg_on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:get_pos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
@ -185,7 +185,7 @@ end
-- Movement function of ender pearl -- Movement function of ender pearl
local pearl_on_step = function(self, dtime) local pearl_on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = math.floor(pos.y) pos.y = math.floor(pos.y)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local nn = node.name local nn = node.name
@ -259,7 +259,7 @@ local pearl_on_step = function(self, dtime)
end end
end end
local oldpos = player:getpos() local oldpos = player:get_pos()
-- Teleport and hurt player -- Teleport and hurt player
player:setpos(telepos) player:setpos(telepos)
player:set_hp(player:get_hp() - 5) player:set_hp(player:get_hp() - 5)

View File

@ -20,7 +20,7 @@ local function do_tnt_physics(tnt_np,tntr)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
local ent = obj:get_luaentity() local ent = obj:get_luaentity()
local v = obj:getvelocity() local v = obj:getvelocity()
local p = obj:getpos() local p = obj:get_pos()
if ent and ent.name == "mcl_tnt:tnt" then if ent and ent.name == "mcl_tnt:tnt" then
obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 2) + v.x, y=(p.y - tnt_np.y) + tntr + v.y, z=(p.z - tnt_np.z) + (tntr / 2) + v.z}) obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 2) + v.x, y=(p.y - tnt_np.y) + tntr + v.y, z=(p.z - tnt_np.z) + (tntr / 2) + v.z})
else else
@ -159,7 +159,7 @@ local function add_effects(pos, radius, drops)
end end
function TNT:on_step(dtime) function TNT:on_step(dtime)
local pos = self.object:getpos() local pos = self.object:get_pos()
minetest.add_particle({ minetest.add_particle({
pos = {x=pos.x,y=pos.y+0.5,z=pos.z}, pos = {x=pos.x,y=pos.y+0.5,z=pos.z},
velocity = vector.new(math.random() * 0.2 - 0.1, 1.0 + math.random(), math.random() * 0.2 - 0.1), velocity = vector.new(math.random() * 0.2 - 0.1, 1.0 + math.random(), math.random() * 0.2 - 0.1),
@ -181,7 +181,7 @@ function TNT:on_step(dtime)
self.blinkstatus = not self.blinkstatus self.blinkstatus = not self.blinkstatus
end end
if self.timer > 4 then if self.timer > 4 then
tnt.boom(self.object:getpos()) tnt.boom(self.object:get_pos())
self.object:remove() self.object:remove()
end end
end end

View File

@ -245,7 +245,7 @@ armor.get_valid_player = function(self, player, msg)
minetest.log("error", "3d_armor: Player name is nil "..msg) minetest.log("error", "3d_armor: Player name is nil "..msg)
return return
end end
local pos = player:getpos() local pos = player:get_pos()
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"}) local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"})
if not pos then if not pos then
@ -539,7 +539,7 @@ minetest.register_globalstep(function(dtime)
end end
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local pos = player:getpos() local pos = player:get_pos()
local hp = player:get_hp() local hp = player:get_hp()
-- water breathing -- water breathing
if name and armor.def[name].water > 0 then if name and armor.def[name].water > 0 then

View File

@ -219,7 +219,7 @@ minetest.register_entity("3d_armor_stand:armor_entity", {
pos = nil, pos = nil,
timer = 0, timer = 0,
on_activate = function(self) on_activate = function(self)
local pos = self.object:getpos() local pos = self.object:get_pos()
self.object:set_armor_groups({immortal=1}) self.object:set_armor_groups({immortal=1})
if pos then if pos then
self.pos = vector.round(pos) self.pos = vector.round(pos)
@ -233,7 +233,7 @@ minetest.register_entity("3d_armor_stand:armor_entity", {
self.timer = self.timer + dtime self.timer = self.timer + dtime
if self.timer > 1 then if self.timer > 1 then
self.timer = 0 self.timer = 0
local pos = self.object:getpos() local pos = self.object:get_pos()
if pos then if pos then
if vector.equals(vector.round(pos), self.pos) then if vector.equals(vector.round(pos), self.pos) then
return return

View File

@ -334,7 +334,7 @@ minetest.register_chatcommand("spawnstruct", {
description = "Generate a pre-defined structure near your position.", description = "Generate a pre-defined structure near your position.",
privs = {debug = true}, privs = {debug = true},
func = function(name, param) func = function(name, param)
local pos= minetest.get_player_by_name(name):getpos() local pos= minetest.get_player_by_name(name):get_pos()
if not pos then if not pos then
return return
end end

View File

@ -141,7 +141,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
local name = user:get_player_name() local name = user:get_player_name()
local hp = user:get_hp() local hp = user:get_hp()
local pos = user:getpos() local pos = user:get_pos()
-- player height -- player height
pos.y = pos.y + 1.5 pos.y = pos.y + 1.5
local foodtype = minetest.get_item_group(itemname, "food") local foodtype = minetest.get_item_group(itemname, "food")

View File

@ -57,7 +57,7 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name() local name = player:get_player_name()
-- where am I? -- where am I?
local pos = player:getpos() local pos = player:get_pos()
-- what is around me? -- what is around me?
local node_stand, node_stand_below, node_head, node_feet = get_player_nodes(pos) local node_stand, node_stand_below, node_head, node_feet = get_player_nodes(pos)

View File

@ -18,7 +18,7 @@ minetest.register_globalstep(function(dtime)
end end
if player:get_player_control().jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then if player:get_player_control().jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then
local pos = player:getpos() local pos = player:get_pos()
local node_stand = mcl_playerinfo[name].node_stand local node_stand = mcl_playerinfo[name].node_stand
local node_stand_below = mcl_playerinfo[name].node_stand_below local node_stand_below = mcl_playerinfo[name].node_stand_below
@ -76,7 +76,7 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name() local name = player:get_player_name()
-- where am I? -- where am I?
local pos = player:getpos() local pos = player:get_pos()
-- what is around me? -- what is around me?
local node_stand = mcl_playerinfo[name].node_stand local node_stand = mcl_playerinfo[name].node_stand
@ -183,7 +183,7 @@ minetest.register_globalstep(function(dtime)
-- Show positions of barriers when player is wielding a barrier -- Show positions of barriers when player is wielding a barrier
local wi = player:get_wielded_item():get_name() local wi = player:get_wielded_item():get_name()
if wi == "mcl_core:barrier" or wi == "mcl_core:realm_barrier" then if wi == "mcl_core:barrier" or wi == "mcl_core:realm_barrier" then
local pos = vector.round(player:getpos()) local pos = vector.round(player:get_pos())
local r = 8 local r = 8
local vm = minetest.get_voxel_manip() local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map({x=pos.x-r, y=pos.y-r, z=pos.z-r}, {x=pos.x+r, y=pos.y+r, z=pos.z+r}) local emin, emax = vm:read_from_map({x=pos.x-r, y=pos.y-r, z=pos.z-r}, {x=pos.x+r, y=pos.y+r, z=pos.z+r})

View File

@ -31,7 +31,7 @@ minetest.register_on_joinplayer(function(player)
sprinting = false, sprinting = false,
timeOut = 0, timeOut = 0,
shouldSprint = false, shouldSprint = false,
lastPos = player:getpos(), lastPos = player:get_pos(),
sprintDistance = 0, sprintDistance = 0,
} }
end) end)
@ -69,7 +69,7 @@ minetest.register_globalstep(function(dtime)
players[playerName]["shouldSprint"] = false players[playerName]["shouldSprint"] = false
end end
local playerPos = player:getpos() local playerPos = player:get_pos()
--If the player is sprinting, create particles behind and cause exhaustion --If the player is sprinting, create particles behind and cause exhaustion
if playerInfo["sprinting"] == true and gameTime % 0.1 == 0 then if playerInfo["sprinting"] == true and gameTime % 0.1 == 0 then