diff --git a/components.lua b/components.lua index b0d997b..47642a2 100644 --- a/components.lua +++ b/components.lua @@ -288,7 +288,7 @@ for _,mode in ipairs({"on", "off"}) do elevator.formspecs[sender:get_player_name()] = {pos} local motorhash = meta:get_string("motor") if on and elevator.motors[motorhash] then - if vector.distance(sender:getpos(), pos) > 1 or minetest.get_node(sender:getpos()).name ~= nodename then + if vector.distance(sender:get_pos(), pos) > 1 or minetest.get_node(sender:get_pos()).name ~= nodename then minetest.chat_send_player(sender:get_player_name(), "You are not inside the booth.") return end diff --git a/formspecs.lua b/formspecs.lua index 64bd020..ecb6ebe 100644 --- a/formspecs.lua +++ b/formspecs.lua @@ -22,7 +22,7 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields) return true end -- Double check if it's ok to go. - if vector.distance(sender:getpos(), pos) > 1 then + if vector.distance(sender:get_pos(), pos) > 1 then return true end if fields.target then diff --git a/helpers.lua b/helpers.lua index ccd8ebb..45816f1 100644 --- a/helpers.lua +++ b/helpers.lua @@ -7,7 +7,7 @@ elevator.teleport_player_from_elevator = function(player) end return minetest.registered_nodes[minetest.get_node(pos).name].walkable end - local pos = vector.round(player:getpos()) + local pos = vector.round(player:get_pos()) local node = minetest.get_node(pos) -- elevator_off is like a shaft, so the player would already be falling. if node.name == "elevator:elevator_on" then @@ -16,7 +16,7 @@ elevator.teleport_player_from_elevator = function(player) local front_below = vector.subtract(front, {x=0, y=1, z=0}) -- If the front isn't solid, it's ok to teleport the player. if not solid(front) and not solid(front_above) then - player:setpos(front) + player:set_pos(front) end end end diff --git a/hooks.lua b/hooks.lua index 609f0e9..af84b43 100644 --- a/hooks.lua +++ b/hooks.lua @@ -12,7 +12,7 @@ minetest.register_globalstep(function(dtime) -- Only count riders who are still logged in. local newriding = {} for _,p in ipairs(minetest.get_connected_players()) do - local pos = p:getpos() + local pos = p:get_pos() local name = p:get_player_name() newriding[name] = elevator.riding[name] -- If the player is indeed riding, update their position. @@ -23,7 +23,7 @@ minetest.register_globalstep(function(dtime) elevator.riding = newriding for name,r in pairs(elevator.riding) do -- If the box is no longer loaded or existent, create another. - local ok = r.box and r.box.getpos and r.box:getpos() and r.box:get_luaentity() and r.box:get_luaentity().attached == name + local ok = r.box and r.box.get_pos and r.box:get_pos() and r.box:get_luaentity() and r.box:get_luaentity().attached == name if not ok then minetest.log("action", "[elevator] "..minetest.pos_to_string(r.pos).." created due to lost rider.") minetest.after(0, elevator.create_box, r.motor, r.pos, r.target, minetest.get_player_by_name(name)) @@ -36,7 +36,7 @@ minetest.register_globalstep(function(dtime) end elevator.lastboxes[motor] = elevator.lastboxes[motor] and math.min(elevator.lastboxes[motor], elevator.PTIMEOUT) or elevator.PTIMEOUT elevator.lastboxes[motor] = math.max(elevator.lastboxes[motor] - 1, 0) - local pos = obj:getpos() + local pos = obj:get_pos() if pos then for _,object in ipairs(minetest.get_objects_inside_radius(pos, 5)) do if object.is_player and object:is_player() then diff --git a/init.lua b/init.lua index b2eb03e..fdd8d92 100644 --- a/init.lua +++ b/init.lua @@ -33,9 +33,9 @@ local get_node = elevator.get_node elevator.create_box = function(motorhash, pos, target, sender) -- First create the box. local obj = minetest.add_entity(pos, "elevator:box") - obj:setpos(pos) + obj:set_pos(pos) -- Attach the player. - sender:setpos(pos) + sender:set_pos(pos) sender:set_attach(obj, "", {x=0, y=9, z=0}, {x=0, y=0, z=0}) sender:set_eye_offset({x=0, y=-9, z=0},{x=0, y=-9, z=0}) sender:set_properties({visual_size = {x=elevator.VISUAL_INCREASE, y=elevator.VISUAL_INCREASE}}) @@ -51,8 +51,8 @@ elevator.create_box = function(motorhash, pos, target, sender) obj:get_luaentity().halfway = {x=pos.x, y=(pos.y+target.y)/2, z=pos.z} obj:get_luaentity().vmult = (target.y < pos.y) and -1 or 1 -- Set the speed. - obj:setvelocity({x=0, y=elevator.SPEED*obj:get_luaentity().vmult, z=0}) - obj:setacceleration({x=0, y=elevator.ACCEL*obj:get_luaentity().vmult, z=0}) + obj:set_velocity({x=0, y=elevator.SPEED*obj:get_luaentity().vmult, z=0}) + obj:set_acceleration({x=0, y=elevator.ACCEL*obj:get_luaentity().vmult, z=0}) -- Set the tables. elevator.boxes[motorhash] = obj elevator.riding[sender:get_player_name()] = { @@ -166,11 +166,11 @@ elevator.unbuild = function(pos, add) local motorhash = elevator.locate_motor(p2) elevator.build_motor(motorhash) -- If there's a box below this point, break it. - if elevator.boxes[motorhash] and elevator.boxes[motorhash]:getpos() and p2.y >= elevator.boxes[motorhash]:getpos().y then + if elevator.boxes[motorhash] and elevator.boxes[motorhash]:get_pos() and p2.y >= elevator.boxes[motorhash]:get_pos().y then elevator.boxes[motorhash] = nil end -- If the box does not exist, just clear it. - if elevator.boxes[motorhash] and not elevator.boxes[motorhash]:getpos() then + if elevator.boxes[motorhash] and not elevator.boxes[motorhash]:get_pos() then elevator.boxes[motorhash] = nil end end, table.copy(pos), add) @@ -235,9 +235,9 @@ local function detach(self, pos) armor:update_player_visuals(player) end if pos then - player:setpos(pos) + player:set_pos(pos) minetest.after(0.1, function(pl, p) - pl:setpos(p) + pl:set_pos(p) end, player, pos) end elevator.riding[self.attached] = nil @@ -265,7 +265,7 @@ local box_entity = { end, on_step = function(self, dtime) - local pos = self.object:getpos() + local pos = self.object:get_pos() -- First, check if this box needs removed. -- If the motor has a box and it isn't this box. if elevator.boxes[self.motor] and elevator.boxes[self.motor] ~= self.object then @@ -296,7 +296,7 @@ local box_entity = { return end - minetest.get_player_by_name(self.attached):setpos(pos) + minetest.get_player_by_name(self.attached):set_pos(pos) -- Ensure lastpos is set to something. self.lastpos = self.lastpos or pos