summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2018-03-22 09:32:17 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2018-03-22 09:32:17 +0000
commit1bb95d742cfd50cbb2329f344a008f13809d753c (patch)
treee75cabffa3e45037ea429e440a6ba1170f216251 /api.lua
parent763fbee36d0c917c8b81f64021fa21178b1dd7c1 (diff)
add mobs:spawn_abm_check() function
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/api.lua b/api.lua
index 1d29385..7f31d92 100644
--- a/api.lua
+++ b/api.lua
@@ -3,7 +3,7 @@
mobs = {}
mobs.mod = "redo"
-mobs.version = "20180313"
+mobs.version = "20180322"
-- Intllib
@@ -2983,6 +2983,12 @@ end
-- global functions
+function mobs:spawn_abm_check(pos, node, name)
+ -- global function to add additional spawn checks
+ -- return true to stop spawning mob
+end
+
+
function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
@@ -3027,6 +3033,11 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
return
end
+ -- additional custom checks for spawning mob
+ if mobs:spawn_abm_check(pos, node, name) == true then
+ return
+ end
+
-- do not spawn if too many of same mob in area
if active_object_count_wider >= max_per_block
or count_mobs(pos, name) >= aoc then