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_<colour>')

* 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
This commit is contained in:
Luke aka SwissalpS 2024-12-29 17:41:13 +01:00 committed by GitHub
parent 3b1559ccb1
commit c6f7c02e79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

@ -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

@ -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