From 8c123639098a209bb55aca2ccfa2b8e7c127ed0f Mon Sep 17 00:00:00 2001 From: Cam B Date: Sat, 25 Jan 2020 00:42:03 +0000 Subject: [PATCH 1/2] Spawn config options added --- .gitignore | 1 + config.lua | 24 ++++++++++++++++++++++++ init.lua | 2 ++ ostrich.lua | 6 +++--- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 config.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..338c30b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.lua diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..42be71d --- /dev/null +++ b/config.lua @@ -0,0 +1,24 @@ + +--[[ DEFAULTS: -- +spawn_on = {"group:soil", "group:stone"}, +spawn_near = {"air"}, +spawn_min_light = 0, +spawn_max_light = 15, +spawn_interval = 30, +spawn_chance = 5000, +spawn_active_object_count = 1, +spawn_min_height = -31000, +spawn_max_height = 31000, +]] + +local config = {} + +config.spawn_enabled_ostrich = true +config.spawn_on_ostrich = {"default:desert_sand", "default:desert_stone"} +config.spawn_max_light_ostrich = 20 +config.spawn_min_light_ostrich = 10 +config.spawn_chance_ostrich = 1500 +config.spawn_active_object_count_ostrich = 1 +config.spawn_max_height_ostrich = 31000 + +global_desert_life = config diff --git a/init.lua b/init.lua index 71dca61..4b39677 100644 --- a/init.lua +++ b/init.lua @@ -5,6 +5,8 @@ if minetest.get_modpath('mymonths') then print 'mymonths is here, lets make things bloom.' end + +dofile(minetest.get_modpath('desert_life').."/config.lua") -- Oversword dofile(minetest.get_modpath('desert_life')..'/functions.lua') dofile(minetest.get_modpath('desert_life')..'/prickly_pear.lua') dofile(minetest.get_modpath('desert_life')..'/barrel_cacti.lua') diff --git a/ostrich.lua b/ostrich.lua index 064b97f..7e48dbb 100644 --- a/ostrich.lua +++ b/ostrich.lua @@ -54,8 +54,8 @@ mobs:register_mob("desert_life:ostrich", { replace_with = 'air', replace_rate = 1, }) - -mobs:register_spawn("desert_life:ostrich", - {"default:desert_sand", "default:desert_stone"}, 20, 10, 1500, 1, 31000, true) +if global_desert_life.spawn_enabled_ostrich then +mobs:register_spawn("desert_life:ostrich", global_desert_life.spawn_on_ostrich, global_desert_life.spawn_max_light_ostrich, global_desert_life.spawn_min_light_ostrich, global_desert_life.spawn_chance_ostrich, global_desert_life.spawn_active_object_count_ostrich, global_desert_life.spawn_max_height_ostrich, true) +end mobs:register_egg("desert_life:ostrich", S("Ostrich"), "dl_ostrich_inv.png", 0) From 106ade57dd246ecc2d2a739193772371d48df15f Mon Sep 17 00:00:00 2001 From: Cam B Date: Sat, 25 Jan 2020 00:43:44 +0000 Subject: [PATCH 2/2] code style --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 4b39677..18400e5 100644 --- a/init.lua +++ b/init.lua @@ -6,7 +6,7 @@ if minetest.get_modpath('mymonths') then end -dofile(minetest.get_modpath('desert_life').."/config.lua") -- Oversword +dofile(minetest.get_modpath('desert_life')..'/config.lua') -- Oversword dofile(minetest.get_modpath('desert_life')..'/functions.lua') dofile(minetest.get_modpath('desert_life')..'/prickly_pear.lua') dofile(minetest.get_modpath('desert_life')..'/barrel_cacti.lua')