summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2016-08-03 09:34:36 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2016-08-03 09:34:36 +0100
commite944712c903162c7448d443ba91b7eea43a9b4b0 (patch)
tree873600852ea4926381a40578a133af676e3bafd0
parenta470ac7cc1786c188866ca57d4a0d13e3e8f37d0 (diff)
Added MarkBu's new mob:spawn command
-rw-r--r--api.lua23
-rw-r--r--api.txt7
2 files changed, 28 insertions, 2 deletions
diff --git a/api.lua b/api.lua
index 4ccdda4..94dfb46 100644
--- a/api.lua
+++ b/api.lua
@@ -1,5 +1,5 @@
--- Mobs Api (21st July 2016)
+-- Mobs Api (3rd August 2016)
mobs = {}
mobs.mod = "redo"
@@ -2400,7 +2400,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
chance = chance,
catch_up = true,
- action = function(pos, node, aoc, active_object_count_wider)
+ action = function(pos, node, active_object_count, active_object_count_wider)
-- do not spawn if too many active entities in area
if active_object_count_wider > active_object_count
@@ -2491,6 +2491,25 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
chance, active_object_count, -31000, max_height, day_toggle)
end
+-- MarkBu's spawn function
+function mobs:spawn(def)
+
+ local name = def.name
+ local nodes = def.nodes or {"group:soil", "group:stone"}
+ local neighbors = def.neighbors or {"air"}
+ local min_light = def.min_light or 0
+ local max_light = def.max_light or 15
+ local interval = def.interval or 30
+ local chance = def.chance or 5000
+ local active_object_count = def.active_object_count or 1
+ local min_height = def.min_height or -31000
+ local max_height = def.max_height or 31000
+ local day_toggle = def.day_toggle or nil
+
+ mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
+ chance, active_object_count, min_height, max_height, day_toggle)
+end
+
-- set content id's
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
diff --git a/api.txt b/api.txt
index 85900ee..f421b98 100644
--- a/api.txt
+++ b/api.txt
@@ -152,6 +152,13 @@ These functions register a spawn algorithm for the mob. Without this function th
'max_height' is the maximum height the mob can spawn
'day_toggle' true for day spawning, false for night or nil for anytime
+... also a simpler way to handle mob spawns has been added with the mobs:spawn(def) command which uses above names to make settings clearer:
+
+ mobs:spawn({name = "mobs_monster:tree_monster",
+ nodes = {"group:leaves"},
+ max_light = 7,
+ })
+
Players can override the spawn chance for each mob registered by adding a line to their minetest.conf file with a new value, the lower the value the more each mob will spawn e.g.