add no_spawn to api
This commit is contained in:
parent
80a6f79436
commit
4564a686be
17
api.lua
17
api.lua
@ -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)
|
||||
table.insert(water_life.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)
|
||||
|
1
init.lua
1
init.lua
@ -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")
|
||||
|
@ -66,8 +66,12 @@ local function repel_insects(player)
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user