add no_spawn to api

This commit is contained in:
Gundul 2023-03-27 18:12:55 +02:00
parent 80a6f79436
commit 4564a686be
3 changed files with 22 additions and 4 deletions

15
api.lua
View File

@ -219,12 +219,25 @@ function water_life.handle_drops(self)
end
end
function water_life.no_spawn_of(mobname)
if not mobname then
return
end
table.insert(water_life.no_spawn_table, mobname)
end
function water_life.register_shark_food(name)
if not name then
return
end
table.insert(water_life.shark_food, name)
end
function water_life.register_gull_bait(name)
if name then water_life.gull_bait[name] = 1 end
if not name then
return
end
water_life.gull_bait[name] = 1
end
function water_life.feed_shark(self)

View File

@ -10,6 +10,7 @@ water_life.version = "220710"
water_life.shark_food = {}
water_life.repellant = {}
water_life.gull_bait = {}
water_life.no_spawn_table = {}
water_life.catchNet = "water_life:placeholder"
water_life.petz = minetest.get_modpath("petz")
water_life.mobsredo = minetest.get_modpath("mobs")

View File

@ -67,7 +67,11 @@ end
local function spawn_it_here(pos, mobname)
minetest.chat_send_all("Spawned: "..mobname);
for i = 0, #water_life.no_spawn_table, 1 do
if water_life.no_spawn_table[i] == mobname then
return
end
end
minetest.add_entity(pos,mobname)
end