Add spawner compatibility transition code
This commit is contained in:
parent
44ff7e04a9
commit
1537d6efd5
@ -1,8 +1,8 @@
|
||||
-------------------------------------------------------------------------------
|
||||
-- Mob Framework Mod by Sapier
|
||||
--
|
||||
--
|
||||
-- You may copy, use, modify or do nearly anything except removing this
|
||||
-- copyright notice.
|
||||
-- copyright notice.
|
||||
-- And of course you are NOT allow to pretend you have written it.
|
||||
--
|
||||
--! @file compatibility.lua
|
||||
@ -23,9 +23,9 @@ minetest.register_abm({
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_node(pos,{name="wool:white"})
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "animalmaterials:wool_grey" },
|
||||
interval = 1,
|
||||
@ -35,9 +35,9 @@ minetest.register_abm({
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_node(pos,{name="wool:grey"})
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "animalmaterials:wool_brown" },
|
||||
interval = 1,
|
||||
@ -47,9 +47,9 @@ minetest.register_abm({
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_node(pos,{name="wool:brown"})
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "animalmaterials:wool_black" },
|
||||
interval = 1,
|
||||
@ -59,13 +59,53 @@ minetest.register_abm({
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_node(pos,{name="wool:black"})
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("mobf:compat_spawner",
|
||||
{
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
groups = { "immortal" },
|
||||
on_activate =
|
||||
function(self,staticdata,dtime_s)
|
||||
local pos = self.object:getpos()
|
||||
local delta,y_offset = adv_spawning.get_spawner_density()
|
||||
|
||||
local spawnerpos = {
|
||||
x = math.floor(pos.x/delta) * delta,
|
||||
y = math.floor((pos.y-y_offset)/delta) * delta + y_offset,
|
||||
z = math.floor(pos.x/delta) * delta
|
||||
}
|
||||
|
||||
local objects_at = minetest.get_objects_inside_radius(spawnerpos, 0.5)
|
||||
|
||||
local found = false
|
||||
|
||||
for i=1,#objects_at,1 do
|
||||
local luaentity = objects_at[i]:get_luaentity()
|
||||
|
||||
if luaentity ~= nil then
|
||||
if luaentity.name == "adv_spawning:spawn_seed" then
|
||||
found = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not found then
|
||||
minetest.add_entity(spawnerpos,"adv_spawning:spawn_seed")
|
||||
end
|
||||
|
||||
self.object:remove()
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- compatibility functions to make transition to new name easier
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function animals_add_animal(animal)
|
||||
mobf_add_mob(animal)
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user