From 6e33ccfb3254f3a2fa1a3dcd82e2f3826f06e046 Mon Sep 17 00:00:00 2001 From: sys4 Date: Mon, 1 Mar 2021 23:09:15 +0100 Subject: [PATCH] Fix warnings regarding deprecated functions --- build_arrow.lua | 2 +- dig_arrow.lua | 2 +- fire_arrow.lua | 2 +- fireworks_arrows.lua | 2 +- functions.lua | 16 ++++++++-------- shell_arrow.lua | 2 +- standard_arrows.lua | 2 +- teleport_arrow.lua | 6 +++--- tnt_arrow.lua | 6 +++--- torch_arrow.lua | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/build_arrow.lua b/build_arrow.lua index d0cb031..9585a5a 100644 --- a/build_arrow.lua +++ b/build_arrow.lua @@ -42,7 +42,7 @@ local THROWING_ARROW_ENTITY={ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if not self.inventory or not self.stack then self.object:remove() diff --git a/dig_arrow.lua b/dig_arrow.lua index 4e7cf9b..2dc0904 100644 --- a/dig_arrow.lua +++ b/dig_arrow.lua @@ -41,7 +41,7 @@ local THROWING_ARROW_ENTITY={ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer>0.2 then diff --git a/fire_arrow.lua b/fire_arrow.lua index 9457a87..b6d3b23 100644 --- a/fire_arrow.lua +++ b/fire_arrow.lua @@ -41,7 +41,7 @@ local THROWING_ARROW_ENTITY={ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer>0.2 then diff --git a/fireworks_arrows.lua b/fireworks_arrows.lua index aec2284..6d8a77a 100644 --- a/fireworks_arrows.lua +++ b/fireworks_arrows.lua @@ -75,7 +75,7 @@ local function throwing_register_fireworks(color, desc) THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer < 0.07 then minetest.sound_play("throwing_firework_launch", {pos=pos, gain=0.8, max_hear_distance=2*64}) diff --git a/functions.lua b/functions.lua index 007e899..0868744 100644 --- a/functions.lua +++ b/functions.lua @@ -20,12 +20,12 @@ function throwing_shoot_arrow (itemstack, player, stiffness, is_cross) local arrow = itemstack:get_metadata() itemstack:set_metadata("") player:set_wielded_item(itemstack) - 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) local dir = player:get_look_dir() - obj:setvelocity({x=dir.x*stiffness, y=dir.y*stiffness, z=dir.z*stiffness}) - obj:setacceleration({x=dir.x*-3, y=-8.5, z=dir.z*-3}) - obj:setyaw(player:get_look_yaw()+math.pi) + obj:set_velocity({x=dir.x*stiffness, y=dir.y*stiffness, z=dir.z*stiffness}) + obj:set_acceleration({x=dir.x*-3, y=-8.5, z=dir.z*-3}) + obj:set_yaw(player:get_look_horizontal()-math.pi/2) if is_cross then minetest.sound_play("throwing_crossbow_sound", {pos=playerpos}) else @@ -58,11 +58,11 @@ function throwing_reload (itemstack, player, pos, is_cross, loaded) local playerName = player:get_player_name() players[playerName]['reloading'] = false if itemstack:get_name() == player:get_wielded_item():get_name() then - if (pos.x == player:getpos().x and pos.y == player:getpos().y and pos.z == player:getpos().z) or not is_cross then + if (pos.x == player:get_pos().x and pos.y == player:get_pos().y and pos.z == player:get_pos().z) or not is_cross then local wear = itemstack:get_wear() for _,arrow in ipairs(throwing_arrows) do if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then player:get_inventory():remove_item("main", arrow[1]) end local meta = arrow[2] @@ -82,7 +82,7 @@ function throwing_register_bow (name, desc, scale, stiffness, reload_time, tough wield_scale = scale, stack_max = 1, on_use = function(itemstack, user, pointed_thing) - local pos = user:getpos() + local pos = user:get_pos() local playerName = user:get_player_name() if not players[playerName]['reloading'] then players[playerName]['reloading'] = true @@ -99,7 +99,7 @@ function throwing_register_bow (name, desc, scale, stiffness, reload_time, tough stack_max = 1, on_use = function(itemstack, user, pointed_thing) local wear = itemstack:get_wear() - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then wear = wear + (65535/toughness) end local unloaded = "throwing:" .. name diff --git a/shell_arrow.lua b/shell_arrow.lua index 1359512..410fa0a 100644 --- a/shell_arrow.lua +++ b/shell_arrow.lua @@ -72,7 +72,7 @@ end THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer>0.2 then diff --git a/standard_arrows.lua b/standard_arrows.lua index 32feff7..c1d7ec4 100644 --- a/standard_arrows.lua +++ b/standard_arrows.lua @@ -43,7 +43,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft) THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer>0.2 then diff --git a/teleport_arrow.lua b/teleport_arrow.lua index d495de3..937af14 100644 --- a/teleport_arrow.lua +++ b/teleport_arrow.lua @@ -42,7 +42,7 @@ local THROWING_ARROW_ENTITY={ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if not self.player then self.object:remove() @@ -55,7 +55,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) if obj:get_luaentity().name ~= "throwing:arrow_teleport_entity" and obj:get_luaentity().name ~= "__builtin:item" then self.object:remove() if self.player ~= "" then - self.player:setpos(pos) + self.player:set_pos(pos) self.player:get_inventory():add_item("main", ItemStack("default:stick 2")) end end @@ -67,7 +67,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) if node.name ~= "air" then self.object:remove() if self.player ~= "" then - self.player:setpos(self.lastpos) + self.player:set_pos(self.lastpos) self.player:get_inventory():add_item("main", ItemStack("default:stick 2")) end end diff --git a/tnt_arrow.lua b/tnt_arrow.lua index d0a4f7d..e42ead5 100644 --- a/tnt_arrow.lua +++ b/tnt_arrow.lua @@ -147,8 +147,8 @@ local function entity_physics(pos, radius) radius = radius * 2 local objs = minetest.get_objects_inside_radius(pos, radius) for _, obj in pairs(objs) do - local obj_pos = obj:getpos() - local obj_vel = obj:getvelocity() + local obj_pos = obj:get_pos() + local obj_vel = obj:get_velocity() local dist = math.max(1, vector.distance(pos, obj_pos)) if obj_vel ~= nil then @@ -245,7 +245,7 @@ end THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer>0.2 then diff --git a/torch_arrow.lua b/torch_arrow.lua index 1be7ce5..d46930e 100644 --- a/torch_arrow.lua +++ b/torch_arrow.lua @@ -43,7 +43,7 @@ local THROWING_ARROW_ENTITY={ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime - local pos = self.object:getpos() + local pos = self.object:get_pos() local node = minetest.get_node(pos) if self.timer>0.2 then