From c6f7c02e79af134bc7a14b4f1341c7a7c9b7def4 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS <161979+SwissalpS@users.noreply.github.com> Date: Sun, 29 Dec 2024 17:41:13 +0100 Subject: [PATCH] Fix deprication warnings (#24) * fix deprication warning 'initial_properties' WARNING[Server]: Reading initial object properties directly from an entity definition is deprecated, move it to the 'initial_properties' table instead. (Property 'static_save' in entity 'spacecannon:energycube_') * fix deprication warning getpos -> get_pos WARNING[Server]: Call to deprecated function 'getpos', use 'get_pos' instead. * Fix deprication warning set_velocity Call to deprecated function 'setvelocity', use 'set_velocity' instead --- cannon.lua | 6 +++--- util.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cannon.lua b/cannon.lua index 542cfd8..daa14b9 100644 --- a/cannon.lua +++ b/cannon.lua @@ -35,11 +35,11 @@ local register_spacecannon = function(def) entity_texture }, collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25}, - physical = false + physical = false, + static_save = false, }, timer = 0, lifetime = 0, - static_save = false, penetrated = 0, on_step = function(self, dtime) @@ -51,7 +51,7 @@ local register_spacecannon = function(def) return end - local pos = self.object:getpos() + local pos = self.object:get_pos() if self.timer > 0.5 then -- add sparks along the way diff --git a/util.lua b/util.lua index f39a8f7..2253422 100644 --- a/util.lua +++ b/util.lua @@ -117,7 +117,7 @@ spacecannon.fire = function(pos, playername, color, speed, is_th, storage_requir local node = minetest.get_node(pos) local dir = spacecannon.facedir_to_down_dir(node.param2) local obj = minetest.add_entity({x=pos.x+dir.x, y=pos.y+dir.y, z=pos.z+dir.z}, "spacecannon:energycube_" .. color) - obj:setvelocity({x=dir.x*speed, y=dir.y*speed, z=dir.z*speed}) + obj:set_velocity({ x = dir.x * speed, y = dir.y * speed, z = dir.z * speed }) end -- destroy stuff in range