Update deprecated methods and move x_default to optional dependencies

This commit is contained in:
Juraj Vajda 2023-04-08 22:24:50 -04:00
parent 6676b6a3f8
commit f30395040c
7 changed files with 38 additions and 29 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.DS_Store
docs/build
*.blend1
*.blend2
*.old
node_modules
*.log
logs
*.mtl

View File

@ -23,15 +23,15 @@ function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture,
}
dummy_definition.on_activate = function(self)
self.object:setvelocity({x=0, y=0, z=0})
self.object:setacceleration({x=0, y=0, z=0})
self.object:set_velocity({x=0, y=0, z=0})
self.object:set_acceleration({x=0, y=0, z=0})
self.object:set_armor_groups({immortal=1})
end
-- remove dummy after dug up the spawner
dummy_definition.on_step = function(self, dtime)
self.timer = self.timer + dtime
local n = minetest.get_node_or_nil(self.object:getpos())
local n = minetest.get_node_or_nil(self.object:get_pos())
if self.timer > 2 then
if n and n.name and n.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active" then
self.object:remove()

View File

@ -1,5 +1,5 @@
default
x_default
x_default?
xpanes?
fire?
mobs?

View File

@ -146,7 +146,7 @@ local balrog_def = {
local player_hp = object:get_hp()
-- is in MMO Arena & health check
if x_default:isInMMOArena(player_pos) and player_hp > 0 then
if minetest.global_exists('x_default') and x_default:isInMMOArena(player_pos) and player_hp > 0 then
-- play sound
minetest.sound_play("spawners_mobs_teleport", {
object = object,

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 KiB

View File

@ -24,8 +24,8 @@ function spawners_mobs.create(mob_table, idx)
static_save = false,
on_activate = function(self, staticdata, dtime_s)
self.object:setvelocity({x = 0, y = 0, z = 0})
self.object:setacceleration({x = 0, y = 0, z = 0})
self.object:set_velocity({x = 0, y = 0, z = 0})
self.object:set_acceleration({x = 0, y = 0, z = 0})
self.object:set_armor_groups({immortal = 1})
end
})

View File

@ -89,15 +89,15 @@ function spawners_ores.create(def)
local ore = string.split(ore_name, "_")
dummy_ore_definition.on_activate = function(self)
self.object:setvelocity({x=0, y=0, z=0})
self.object:setacceleration({x=0, y=0, z=0})
self.object:set_velocity({x=0, y=0, z=0})
self.object:set_acceleration({x=0, y=0, z=0})
self.object:set_armor_groups({immortal=1})
end
-- remove dummy after dug up the spawner
dummy_ore_definition.on_step = function(self, dtime)
self.timer = self.timer + dtime
local n = minetest.get_node_or_nil(self.object:getpos())
local n = minetest.get_node_or_nil(self.object:get_pos())
if self.timer > 2 then
if n and n.name and n.name ~= "spawners_ores:"..ore_name.."_spawner_active" and n.name ~= "spawners_ores:"..ore_name.."_spawner_waiting" and n.name ~= "spawners_ores:"..ore_name.."_spawner" then
self.object:remove()