diff --git a/bee.lua b/bee.lua index c642a20..70e4d38 100644 --- a/bee.lua +++ b/bee.lua @@ -46,6 +46,7 @@ mobs:register_mob("mobs_animal:bee", { -- end, }) +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:bee", nodes = {"group:flower"}, @@ -56,6 +57,7 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) +end mobs:register_egg("mobs_animal:bee", S("Bee"), "mobs_bee_inv.png") diff --git a/bunny.lua b/bunny.lua index 32c33f8..3948003 100644 --- a/bunny.lua +++ b/bunny.lua @@ -113,6 +113,7 @@ if minetest.get_modpath("ethereal") then spawn_on = "ethereal:prairie_dirt" end +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:bunny", nodes = {spawn_on}, @@ -124,6 +125,7 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) +end mobs:register_egg("mobs_animal:bunny", S("Bunny"), "mobs_bunny_inv.png", 0) diff --git a/chicken.lua b/chicken.lua index 5baca27..dd2eb8c 100644 --- a/chicken.lua +++ b/chicken.lua @@ -55,7 +55,10 @@ stepheight = 0.6, run_end = 110, run_speed = 24, }, - follow = {"farming:seed_wheat", "farming:seed_cotton"}, + follow = { + "farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley", + "farming:seed_oat", "farming:seed_rye" + }, view_range = 5, on_rightclick = function(self, clicker) @@ -97,6 +100,8 @@ if minetest.get_modpath("ethereal") then spawn_on = {"ethereal:bamboo_dirt", "ethereal:prairie_dirt"} end + +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:chicken", nodes = spawn_on, @@ -108,6 +113,7 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) +end mobs:register_egg("mobs_animal:chicken", S("Chicken"), "mobs_chicken_inv.png", 0) diff --git a/cow.lua b/cow.lua index 6682685..a79277d 100644 --- a/cow.lua +++ b/cow.lua @@ -59,7 +59,10 @@ mobs:register_mob("mobs_animal:cow", { die_speed = 10, die_loop = false, }, - follow = {"farming:wheat", "default:grass_1"}, + follow = { + "farming:wheat", "default:grass_1", "farming:barley", + "farming:oat", "farming:rye" + }, view_range = 8, replace_rate = 10, replace_what = { @@ -133,6 +136,7 @@ mobs:register_mob("mobs_animal:cow", { }) +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:cow", nodes = {"default:dirt_with_grass", "ethereal:green_dirt"}, @@ -144,6 +148,7 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) +end mobs:register_egg("mobs_animal:cow", S("Cow"), "mobs_cow_inv.png") diff --git a/init.lua b/init.lua index ec0dc82..181c4e1 100644 --- a/init.lua +++ b/init.lua @@ -1,24 +1,44 @@ -- Load support for intllib. -local path = minetest.get_modpath(minetest.get_current_modname()) +local path = minetest.get_modpath(minetest.get_current_modname()) .. "/" + local S = minetest.get_translator and minetest.get_translator("mobs_animal") or - dofile(path .. "/intllib.lua") + dofile(path .. "intllib.lua") + mobs.intllib = S + +-- Check for custom mob spawn file +local input = io.open(path .. "spawn.lua", "r") + +if input then + mobs.custom_spawn_animal = true + input:close() + input = nil +end + + -- Animals -dofile(path .. "/chicken.lua") -- JKmurray -dofile(path .. "/cow.lua") -- KrupnoPavel -dofile(path .. "/rat.lua") -- PilzAdam -dofile(path .. "/sheep.lua") -- PilzAdam -dofile(path .. "/warthog.lua") -- KrupnoPavel -dofile(path .. "/bee.lua") -- KrupnoPavel -dofile(path .. "/bunny.lua") -- ExeterDad -dofile(path .. "/kitten.lua") -- Jordach/BFD -dofile(path .. "/goat.lua") -- NALC(sys4 fork MFF) -dofile(path .. "/penguin.lua") -- D00Med -dofile(path .. "/panda.lua") -- AspireMint +dofile(path .. "chicken.lua") -- JKmurray +dofile(path .. "cow.lua") -- KrupnoPavel +dofile(path .. "rat.lua") -- PilzAdam +dofile(path .. "sheep.lua") -- PilzAdam +dofile(path .. "warthog.lua") -- KrupnoPavel +dofile(path .. "bee.lua") -- KrupnoPavel +dofile(path .. "bunny.lua") -- ExeterDad +dofile(path .. "kitten.lua") -- Jordach/BFD +dofile(path .. "penguin.lua") -- D00Med +dofile(path .. "panda.lua") -- AspireMint +dofile(path .. "goat.lua") -- NALC(sys4 fork MFF) + + +-- Load custom spawning +if mobs.custom_spawn_animal then + dofile(path .. "spawn.lua") +end -- Lucky Blocks -dofile(path .. "/lucky_block.lua") +dofile(path .. "lucky_block.lua") + print (S("[MOD] Mobs Redo Animals loaded")) diff --git a/kitten.lua b/kitten.lua index 30da932..332db45 100644 --- a/kitten.lua +++ b/kitten.lua @@ -63,6 +63,7 @@ stepheight = 1.1, "fishing:carp_raw", "fishing:perch_raw", "fishing:catfish_raw", + "xocean:fish_edible", }, view_range = 8, @@ -123,6 +124,7 @@ if minetest.get_modpath("ethereal") then spawn_on = "ethereal:grove_dirt" end +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:kitten", nodes = {spawn_on}, @@ -134,6 +136,7 @@ mobs:spawn({ max_height = 50, day_toggle = true, }) +end mobs:register_egg("mobs_animal:kitten", S("Kitten"), "mobs_kitten_inv.png", 0) diff --git a/panda.lua b/panda.lua index c49fc3e..d008e57 100644 --- a/panda.lua +++ b/panda.lua @@ -68,7 +68,7 @@ stepheight = 0.6, end, }) -if minetest.get_modpath("ethereal") then +if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:panda", diff --git a/penguin.lua b/penguin.lua index 407032f..1f86a3f 100644 --- a/penguin.lua +++ b/penguin.lua @@ -56,6 +56,7 @@ stepheight = 0.6, "fishing:carp_raw", "fishing:perch_raw", "fishing:catfish_raw", + "xocean:fish_edible", }, view_range = 5, @@ -68,7 +69,7 @@ stepheight = 0.6, end, }) - +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:penguin", nodes = {"default:snowblock"}, @@ -79,6 +80,6 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) - +end mobs:register_egg("mobs_animal:penguin", S("Penguin"), "mobs_penguin_inv.png") diff --git a/rat.lua b/rat.lua index 562b394..930a985 100644 --- a/rat.lua +++ b/rat.lua @@ -67,6 +67,7 @@ local function rat_spawn(self, pos) self.health = 100 end +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:rat", nodes = {"default:stone"}, @@ -77,6 +78,7 @@ mobs:spawn({ max_height = 0, -- on_spawn = rat_spawn, }) +end mobs:register_egg("mobs_animal:rat", S("Rat"), "mobs_rat_inv.png") diff --git a/sheep.lua b/sheep.lua index b8b79bb..afc3742 100644 --- a/sheep.lua +++ b/sheep.lua @@ -65,7 +65,10 @@ for _, col in ipairs(all_colours) do walk_start = 81, walk_end = 100, }, - follow = {"farming:wheat", "default:grass_1"}, + follow = { + "farming:wheat", "default:grass_1", "farming:barley", + "farming:oat", "farming:rye" + }, view_range = 8, replace_rate = 10, replace_what = { @@ -204,6 +207,7 @@ mobs:register_egg("mobs_animal:sheep_"..col[1], S("@1 Sheep", col[2]), "wool_".. end +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:sheep_white", nodes = {"default:dirt_with_grass", "ethereal:green_dirt"}, @@ -215,6 +219,7 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) +end mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") -- compatibility diff --git a/spawn_example.lua b/spawn_example.lua new file mode 100644 index 0000000..22814c1 --- /dev/null +++ b/spawn_example.lua @@ -0,0 +1,195 @@ + +--[[ Spawn Template, defaults to values shown if line not provided + +mobs:spawn({ + + name = "", + + - Name of mob, must be provided e.g. "mymod:my_mob" + + nodes = {"group:soil, "group:stone"}, + + - Nodes to spawn on top of. + + neighbors = {"air"}, + + - Nodes to spawn beside. + + min_light = 0, + + - Minimum light level. + + max_light = 15, + + - Maximum light level, 15 is sunlight only. + + interval = 30, + + - Spawn interval in seconds. + + chance = 5000, + + - Spawn chance, 1 in every 5000 nodes. + + active_object_count = 1, + + - Active mobs of this type in area. + + min_height = -31000, + + - Minimum height level. + + max_height = 31000, + + - Maximum height level. + + day_toggle = nil, + + - Daytime toggle, true to spawn during day, false for night, nil for both + + on_spawn = nil, + + - On spawn function to run when mob spawns in world + + on_map_load = nil, + + - On map load, when true mob only spawns in newly generated map areas +}) +]]-- + + +-- Bee + +mobs:spawn({ + name = "mobs_animal:bee", + nodes = {"group:flower"}, + min_light = 14, + interval = 60, + chance = 7000, + min_height = 3, + max_height = 200, + day_toggle = true, +}) + +-- Bunny + +mobs:spawn({ + name = "mobs_animal:bunny", + nodes = {"default:dirt_with_grass"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 8000, + min_height = 5, + max_height = 200, + day_toggle = true, +}) + +-- Chicken + +mobs:spawn({ + name = "mobs_animal:chicken", + nodes = {"default:dirt_with_grass"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 8000, + min_height = 5, + max_height = 200, + day_toggle = true, +}) + +-- Cow + +mobs:spawn({ + name = "mobs_animal:cow", + nodes = {"default:dirt_with_grass", "ethereal:green_dirt"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 8000, + min_height = 5, + max_height = 200, + day_toggle = true, +}) + +-- Kitten + +mobs:spawn({ + name = "mobs_animal:kitten", + nodes = {"default:dirt_with_grass"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 10000, + min_height = 5, + max_height = 50, + day_toggle = true, +}) + +-- Panda + +mobs:spawn({ + name = "mobs_animal:panda", + nodes = {"ethereal:bamboo_dirt"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 8000, + min_height = 10, + max_height = 80, + day_toggle = true, +}) + +-- Penguin + +mobs:spawn({ + name = "mobs_animal:penguin", + nodes = {"default:snowblock"}, + min_light = 14, + interval = 60, + chance = 20000, + min_height = 0, + max_height = 200, + day_toggle = true, +}) + +-- Rat + +mobs:spawn({ + name = "mobs_animal:rat", + nodes = {"default:stone"}, + min_light = 3, + max_light = 9, + interval = 60, + chance = 8000, + max_height = 0, +}) + +-- Sheep + +mobs:spawn({ + name = "mobs_animal:sheep_white", + nodes = {"default:dirt_with_grass", "ethereal:green_dirt"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 8000, + min_height = 0, + max_height = 200, + day_toggle = true, +}) + +-- Warthog + +mobs:spawn({ + name = "mobs_animal:pumba", + nodes = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"}, + neighbors = {"group:dry_grass"}, + min_light = 14, + interval = 60, + chance = 8000, + min_height = 0, + max_height = 200, + day_toggle = true, +}) diff --git a/warthog.lua b/warthog.lua index cd3dae5..0062a51 100644 --- a/warthog.lua +++ b/warthog.lua @@ -73,6 +73,7 @@ if minetest.get_modpath("ethereal") then spawn_by = {"flowers:mushroom_brown", "flowers:mushroom_red"} end +if not mobs.custom_spawn_animal then mobs:spawn({ name = "mobs_animal:pumba", nodes = spawn_on, @@ -84,7 +85,7 @@ mobs:spawn({ max_height = 200, day_toggle = true, }) - +end mobs:register_egg("mobs_animal:pumba", S("Warthog"), "mobs_pumba_inv.png")