mirror of
https://github.com/Poikilos/mobs.git
synced 2023-10-03 07:28:50 -07:00
Added air_damage and configurable neighbour for spawners
This commit is contained in:
parent
e6108f359d
commit
464a561c41
13
init.lua
13
init.lua
@ -184,6 +184,15 @@ mobapi.default_definition = {
|
|||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.air_damage and self.air_damage ~= 0 and
|
||||||
|
n.name == "air"
|
||||||
|
then
|
||||||
|
self.object:set_hp(self.object:get_hp()-self.air_damage)
|
||||||
|
if self.object:get_hp() == 0 then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.env_damage_timer = self.env_damage_timer + dtime
|
self.env_damage_timer = self.env_damage_timer + dtime
|
||||||
@ -459,12 +468,12 @@ function mobapi:register_mob(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
mobapi.spawning_mobs = {}
|
mobapi.spawning_mobs = {}
|
||||||
function mobapi:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_func)
|
function mobapi:register_spawn(name, nodes, neighbors, max_light, min_light, chance, active_object_count, max_height, spawn_func)
|
||||||
if minetest.setting_getbool(string.gsub(name,":","_").."_spawn") ~= false then
|
if minetest.setting_getbool(string.gsub(name,":","_").."_spawn") ~= false then
|
||||||
mobapi.spawning_mobs[name] = true
|
mobapi.spawning_mobs[name] = true
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = nodes,
|
nodenames = nodes,
|
||||||
neighbors = {"air"},
|
neighbors = neighbors,
|
||||||
interval = 30,
|
interval = 30,
|
||||||
chance = chance,
|
chance = chance,
|
||||||
action = function(pos, node, _, active_object_count_wider)
|
action = function(pos, node, _, active_object_count_wider)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user