From 95cbac78a8282bbbeeb4429643cf2530c96c9d97 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 01:00:35 +0100 Subject: [PATCH 01/11] Change number of children spawned on die. When a slime or magma cube dies, it should spawn between 2 to 4 smaller children. The code was always spawning 4 children (3 for big magma cubes). This commit makes the following changes to the function `spawn_children_on_die`: * Make the number of children spawned a random number between 2 and 4. * No longer accept the `children_count` as an argument, because this number should always be a random number between 2 and 4 anyway. * Update all callers accordingly. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index c6de471e3e..b9d7c4dd8a 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -7,10 +7,9 @@ local S = minetest.get_translator("mobs_mc") -- self: mob reference -- pos: position of "mother" mob -- child_mod: Mob to spawn --- children_count: Number of children to spawn -- spawn_distance: Spawn distance from "mother" mob -- eject_speed: Initial speed of child mob away from "mother" mob -local spawn_children_on_die = function(child_mob, children_count, spawn_distance, eject_speed) +local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) return function(self, pos) local angle, posadd, newpos, dir if not eject_speed then @@ -20,7 +19,8 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance local mother_stuck = mndef and mndef.walkable angle = math.random(0, math.pi*2) local children = {} - for i=1,children_count do + local spawn_count = math.random(2, 4) + for i = 1, spawn_count do dir = {x=math.cos(angle),y=0,z=math.sin(angle)} posadd = vector.multiply(vector.normalize(dir), spawn_distance) newpos = vector.add(pos, posadd) @@ -38,7 +38,7 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance end mob:set_yaw(angle - math.pi/2) table.insert(children, mob) - angle = angle + (math.pi*2)/children_count + angle = angle + (math.pi*2) / spawn_count end -- If mother was murdered, children attack the killer after 1 second if self.state == "attack" then @@ -106,7 +106,7 @@ local slime_big = { jump_height = 5.2, fear_height = 0, spawn_small_alternative = "mobs_mc:slime_small", - on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5), + on_die = spawn_children_on_die("mobs_mc:slime_small", 1.0, 1.5), use_texture_alpha = true, } mcl_mobs.register_mob("mobs_mc:slime_big", slime_big) @@ -125,7 +125,7 @@ slime_small.walk_velocity = 1.3 slime_small.run_velocity = 1.3 slime_small.jump_height = 4.3 slime_small.spawn_small_alternative = "mobs_mc:slime_tiny" -slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 4, 0.6, 1.0) +slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 0.6, 1.0) mcl_mobs.register_mob("mobs_mc:slime_small", slime_small) local slime_tiny = table.copy(slime_big) @@ -345,7 +345,7 @@ local magma_cube_big = { walk_chance = 0, fear_height = 0, spawn_small_alternative = "mobs_mc:magma_cube_small", - on_die = spawn_children_on_die("mobs_mc:magma_cube_small", 3, 0.8, 1.5), + on_die = spawn_children_on_die("mobs_mc:magma_cube_small", 0.8, 1.5), fire_resistant = true, } mcl_mobs.register_mob("mobs_mc:magma_cube_big", magma_cube_big) @@ -368,7 +368,7 @@ magma_cube_small.damage = 4 magma_cube_small.reach = 2.75 magma_cube_small.armor = 66 magma_cube_small.spawn_small_alternative = "mobs_mc:magma_cube_tiny" -magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 4, 0.6, 1.0) +magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 0.6, 1.0) mcl_mobs.register_mob("mobs_mc:magma_cube_small", magma_cube_small) local magma_cube_tiny = table.copy(magma_cube_big) From ea19f02e14740238b84d4aff3a67af0fbf7cc2b4 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 01:47:38 +0100 Subject: [PATCH 02/11] Assorted `spawn_children_on_die` fixes. * Use proper vector semantics. * Optimize away superfluous temp variables and repetitive local variable declarations. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index b9d7c4dd8a..41ee427bac 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -11,30 +11,31 @@ local S = minetest.get_translator("mobs_mc") -- eject_speed: Initial speed of child mob away from "mother" mob local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) return function(self, pos) - local angle, posadd, newpos, dir + local posadd, newpos, dir if not eject_speed then eject_speed = 1 end local mndef = minetest.registered_nodes[minetest.get_node(pos).name] local mother_stuck = mndef and mndef.walkable - angle = math.random(0, math.pi*2) + local angle = math.random(0, math.pi*2) local children = {} local spawn_count = math.random(2, 4) for i = 1, spawn_count do - dir = {x=math.cos(angle),y=0,z=math.sin(angle)} - posadd = vector.multiply(vector.normalize(dir), spawn_distance) - newpos = vector.add(pos, posadd) + dir = vector.new(math.cos(angle), 0, math.sin(angle)) + posadd = vector.normalize(dir) * spawn_distance + newpos = pos + posadd -- If child would end up in a wall, use position of the "mother", unless -- the "mother" was stuck as well - local speed_penalty = 1 - local cndef = minetest.registered_nodes[minetest.get_node(newpos).name] - if (not mother_stuck) and cndef and cndef.walkable then - newpos = pos - speed_penalty = 0.5 + if not mother_stuck then + local cndef = minetest.registered_nodes[minetest.get_node(newpos).name] + if cndef and cndef.walkable then + newpos = pos + eject_speed = eject_speed * 0.5 + end end local mob = minetest.add_entity(newpos, child_mob) - if (not mother_stuck) then - mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty)) + if not mother_stuck then + mob:set_velocity(dir * eject_speed) end mob:set_yaw(angle - math.pi/2) table.insert(children, mob) @@ -43,10 +44,11 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) -- If mother was murdered, children attack the killer after 1 second if self.state == "attack" then minetest.after(1.0, function(children, enemy) - for c=1, #children do - local child = children[c] - local le = child:get_luaentity() - if le ~= nil then + local child, le + for c = 1, #children do + child = children[c] + le = childdren[c]:get_luaentity() + if le then le.state = "attack" le.attack = enemy end From 8279dcb3dd9353ccfd31549059437b1f1100748c Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 02:06:56 +0100 Subject: [PATCH 03/11] Add FIXME notes to slime mob code. Missing features: * Slimes should not only spawn in caves, but also at night in swamps. * Slimes should only spawn on 10% of the map ("slime chunks"). * There are no spawn eggs registered for small and tiny slimes and magma cubes. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 41ee427bac..ed876ef47e 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -1,5 +1,12 @@ --License for code WTFPL and otherwise stated in readmes +-- FIXME: Slimes should spawn not only in underground caves, but also +-- during the night in Swampland and MangroveSwamp biomes, with a spawn +-- chance proportional to the phase of the moon + +-- FIXME: Slimes should spawn only in "slime chunks" which make up only +-- 10% of the map. +-- local S = minetest.get_translator("mobs_mc") -- Returns a function that spawns children in a circle around pos. @@ -44,10 +51,9 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) -- If mother was murdered, children attack the killer after 1 second if self.state == "attack" then minetest.after(1.0, function(children, enemy) - local child, le + local le for c = 1, #children do - child = children[c] - le = childdren[c]:get_luaentity() + le = children[c]:get_luaentity() if le then le.state = "attack" le.attack = enemy @@ -452,3 +458,5 @@ mmax) mcl_mobs.register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "#350000", "#fcfc00") mcl_mobs.register_egg("mobs_mc:slime_big", S("Slime"), "#52a03e", "#7ebf6d") + +-- FIXME: add spawn eggs for small and tiny slimes and magma cubes From 0c454a34c9a11bc1a848be1a24f958a78476888a Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 02:38:35 +0100 Subject: [PATCH 04/11] Use vectors in `get_next_mob_spawn_pos()` --- mods/ENTITIES/mcl_mobs/spawning.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index a8250c19e0..02e31b9d13 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -402,11 +402,9 @@ local two_pi = 2 * math.pi local function get_next_mob_spawn_pos(pos) local distance = math_random(25, 32) local angle = math_random() * two_pi - return { - x = math_round(pos.x + distance * math_cos(angle)), - y = pos.y, - z = math_round(pos.z + distance * math_sin(angle)) - } + local xoff = math_round(distance * math_cos(angle)) + local yoff = math_round(distance * math_sin(angle)) + return vector.offset(pos, xoff, 0, yoff) end local function decypher_limits(posy) From 6756ee340cebf9c5c300fc328f5246c756334600 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 03:13:26 +0100 Subject: [PATCH 05/11] Mob spawning chatcommand refactoring. * Put calculations that are only used conditionally inside the related `if` block. * Make code logic more explicit. * Take logging statement out of return value assignment. * Remove duplicate assignment. * Fix a typo in the function's description. --- mods/ENTITIES/mcl_mobs/spawning.lua | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 02e31b9d13..01ef2a823d 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -557,7 +557,7 @@ local S = minetest.get_translator("mcl_mobs") minetest.register_chatcommand("spawn_mob",{ privs = { debug = true }, - description=S("spawn_mob is a chatcommand that allows you to type in the name of a mob without 'typing mobs_mc:' all the time like so; 'spawn_mob spider'. however, there is more you can do with this special command, currently you can edit any number, boolian, and string variable you choose with this format: spawn_mob 'any_mob:var:'. any_mob being your mob of choice, mobs_variable being the variable, and variable value being the value of the chosen variable. and example of this format: \n spawn_mob skeleton:var:\n this would spawn a skeleton that wouldn't attack you. REMEMBER-THIS> when changing a number value always prefix it with 'NUM', example: \n spawn_mob skeleton:var:\n this setting the skelly's jump height to 10. if you want to make multiple changes to a mob, you can, example: \n spawn_mob skeleton:var::var::var::var:\n etc."), + description=S("spawn_mob is a chatcommand that allows you to type in the name of a mob without 'typing mobs_mc:' all the time like so; 'spawn_mob spider'. however, there is more you can do with this special command, currently you can edit any number, boolean, and string variable you choose with this format: spawn_mob 'any_mob:var:'. any_mob being your mob of choice, mobs_variable being the variable, and variable value being the value of the chosen variable. and example of this format: \n spawn_mob skeleton:var:\n this would spawn a skeleton that wouldn't attack you. REMEMBER-THIS> when changing a number value always prefix it with 'NUM', example: \n spawn_mob skeleton:var:\n this setting the skelly's jump height to 10. if you want to make multiple changes to a mob, you can, example: \n spawn_mob skeleton:var::var::var::var:\n etc."), func = function(n,param) local pos = minetest.get_player_by_name(n):get_pos() @@ -577,15 +577,14 @@ minetest.register_chatcommand("spawn_mob",{ local mob = mcl_mobs.spawn(pos,mobname) - for c=1, #modifiers do - modifs = modifiers[c] + if mob then + for c=1, #modifiers do + modifs = modifiers[c] - local mod1 = string.find(modifs, ":") - local mod_start = string.find(modifs, "<") - local mod_vals = string.find(modifs, "=") - local mod_end = string.find(modifs, ">") - local mod_end = string.find(modifs, ">") - if mob then + local mod1 = string.find(modifs, ":") + local mod_start = string.find(modifs, "<") + local mod_vals = string.find(modifs, "=") + local mod_end = string.find(modifs, ">") local mob_entity = mob:get_luaentity() if string.sub(modifs, mod1+1, mod1+3) == "var" then if mod1 and mod_start and mod_vals and mod_end then @@ -616,14 +615,12 @@ minetest.register_chatcommand("spawn_mob",{ minetest.log("warning", n.." couldn't modify "..mobname.." at "..minetest.pos_to_string(pos).. ", missing modification type") end end - end - - if mob then - return true, mobname.." spawned at "..minetest.pos_to_string(pos), minetest.log("action", n.." spawned "..mobname.." at "..minetest.pos_to_string(pos)) + return true, mobname.." spawned at "..minetest.pos_to_string(pos) + else + return false, "Couldn't spawn "..mobname end - return false, "Couldn't spawn "..mobname end }) From da17ff8ea0168ebf2ce2fff37d858bca43f12395 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 05:20:51 +0100 Subject: [PATCH 06/11] Remove stray dependency. While mobs_mc_gameconfig was deleted at some point during the mob refactoring, it was still listed in mobs_mc's mod.conf. --- mods/ENTITIES/mobs_mc/mod.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/mod.conf b/mods/ENTITIES/mobs_mc/mod.conf index 89964c8359..5b94879b27 100644 --- a/mods/ENTITIES/mobs_mc/mod.conf +++ b/mods/ENTITIES/mobs_mc/mod.conf @@ -2,4 +2,4 @@ name = mobs_mc author = maikerumine description = Adds Minecraft-like monsters and animals. depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util -optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items +optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items From ea6201d32fbb590f95f5b503caaeab5dbb382f96 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 05:38:47 +0100 Subject: [PATCH 07/11] Add missing biome to slime spawn list. * Add "MangroveSwamp_underground" to the lists of spawnable biomes for big, small and tiny slimes. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index ed876ef47e..56628d0283 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -199,6 +199,7 @@ mcl_mobs:spawn_specific( "JungleM_underground", "ExtremeHillsM_underground", "JungleEdgeM_underground", +"MangroveSwamp_underground", }, 0, minetest.LIGHT_MAX+1, @@ -243,6 +244,7 @@ mcl_mobs:spawn_specific( "JungleM_underground", "ExtremeHillsM_underground", "JungleEdgeM_underground", +"MangroveSwamp_underground", }, 0, minetest.LIGHT_MAX+1, @@ -287,6 +289,7 @@ mcl_mobs:spawn_specific( "JungleM_underground", "ExtremeHillsM_underground", "JungleEdgeM_underground", +"MangroveSwamp_underground", }, 0, minetest.LIGHT_MAX+1, From 4af814885053662e37ce39f33d32a3a34ed3747f Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 05:43:59 +0100 Subject: [PATCH 08/11] Refactor spawn registrations. * Unduplicate spawnable biome lists for slimes and magma cubes. * Rename min and max spawndepth identifiers. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 188 +++++++-------------- 1 file changed, 60 insertions(+), 128 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 56628d0283..b1aee3ad10 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -161,143 +161,84 @@ slime_tiny.on_die = nil mcl_mobs.register_mob("mobs_mc:slime_tiny", slime_tiny) -local smin = mcl_vars.mg_overworld_min -local smax = mobs_mc.water_level - 23 +local water_level = mobs_mc.water_level + +local cave_biomes = { + "FlowerForest_underground", + "JungleEdge_underground", + "StoneBeach_underground", + "MesaBryce_underground", + "Mesa_underground", + "RoofedForest_underground", + "Jungle_underground", + "Swampland_underground", + "MushroomIsland_underground", + "BirchForest_underground", + "Plains_underground", + "MesaPlateauF_underground", + "ExtremeHills_underground", + "MegaSpruceTaiga_underground", + "BirchForestM_underground", + "SavannaM_underground", + "MesaPlateauFM_underground", + "Desert_underground", + "Savanna_underground", + "Forest_underground", + "SunflowerPlains_underground", + "ColdTaiga_underground", + "IcePlains_underground", + "IcePlainsSpikes_underground", + "MegaTaiga_underground", + "Taiga_underground", + "ExtremeHills+_underground", + "JungleM_underground", + "ExtremeHillsM_underground", + "JungleEdgeM_underground", + "MangroveSwamp_underground" +} + +local cave_min = mcl_vars.mg_overworld_min +local cave_max = water_level - 23 + mcl_mobs:spawn_specific( "mobs_mc:slime_tiny", "overworld", "ground", -{ -"FlowerForest_underground", -"JungleEdge_underground", -"StoneBeach_underground", -"MesaBryce_underground", -"Mesa_underground", -"RoofedForest_underground", -"Jungle_underground", -"Swampland_underground", -"MushroomIsland_underground", -"BirchForest_underground", -"Plains_underground", -"MesaPlateauF_underground", -"ExtremeHills_underground", -"MegaSpruceTaiga_underground", -"BirchForestM_underground", -"SavannaM_underground", -"MesaPlateauFM_underground", -"Desert_underground", -"Savanna_underground", -"Forest_underground", -"SunflowerPlains_underground", -"ColdTaiga_underground", -"IcePlains_underground", -"IcePlainsSpikes_underground", -"MegaTaiga_underground", -"Taiga_underground", -"ExtremeHills+_underground", -"JungleM_underground", -"ExtremeHillsM_underground", -"JungleEdgeM_underground", -"MangroveSwamp_underground", -}, +cave_biomes, 0, minetest.LIGHT_MAX+1, 30, 12000, 4, -smin, -smax) +cave_min, +cave_max) mcl_mobs:spawn_specific( "mobs_mc:slime_small", "overworld", "ground", -{ -"FlowerForest_underground", -"JungleEdge_underground", -"StoneBeach_underground", -"MesaBryce_underground", -"Mesa_underground", -"RoofedForest_underground", -"Jungle_underground", -"Swampland_underground", -"MushroomIsland_underground", -"BirchForest_underground", -"Plains_underground", -"MesaPlateauF_underground", -"ExtremeHills_underground", -"MegaSpruceTaiga_underground", -"BirchForestM_underground", -"SavannaM_underground", -"MesaPlateauFM_underground", -"Desert_underground", -"Savanna_underground", -"Forest_underground", -"SunflowerPlains_underground", -"ColdTaiga_underground", -"IcePlains_underground", -"IcePlainsSpikes_underground", -"MegaTaiga_underground", -"Taiga_underground", -"ExtremeHills+_underground", -"JungleM_underground", -"ExtremeHillsM_underground", -"JungleEdgeM_underground", -"MangroveSwamp_underground", -}, +cave_biomes, 0, minetest.LIGHT_MAX+1, 30, 8500, 4, -smin, -smax) +cave_min, +cave_max) mcl_mobs:spawn_specific( "mobs_mc:slime_big", "overworld", "ground", -{ -"FlowerForest_underground", -"JungleEdge_underground", -"StoneBeach_underground", -"MesaBryce_underground", -"Mesa_underground", -"RoofedForest_underground", -"Jungle_underground", -"Swampland_underground", -"MushroomIsland_underground", -"BirchForest_underground", -"Plains_underground", -"MesaPlateauF_underground", -"ExtremeHills_underground", -"MegaSpruceTaiga_underground", -"BirchForestM_underground", -"SavannaM_underground", -"MesaPlateauFM_underground", -"Desert_underground", -"Savanna_underground", -"Forest_underground", -"SunflowerPlains_underground", -"ColdTaiga_underground", -"IcePlains_underground", -"IcePlainsSpikes_underground", -"MegaTaiga_underground", -"Taiga_underground", -"ExtremeHills+_underground", -"JungleM_underground", -"ExtremeHillsM_underground", -"JungleEdgeM_underground", -"MangroveSwamp_underground", -}, +cave_biomes, 0, minetest.LIGHT_MAX+1, 30, 10000, 4, -smin, -smax) +cave_min, +cave_max) -- Magma cube local magma_cube_big = { @@ -405,57 +346,48 @@ magma_cube_tiny.on_die = nil mcl_mobs.register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny) -local mmin = mcl_vars.mg_nether_min -local mmax = mcl_vars.mg_nether_max +local magma_cube_biomes = {"Nether", "BasaltDelta"} +local nether_min = mcl_vars.mg_nether_min +local nether_max = mcl_vars.mg_nether_max mcl_mobs:spawn_specific( "mobs_mc:magma_cube_tiny", "nether", "ground", -{ -"Nether", -"BasaltDelta", -}, +magma_cube_biomes, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, -mmin, -mmax) - +nether_min, +nether_max) mcl_mobs:spawn_specific( "mobs_mc:magma_cube_small", "nether", "ground", -{ -"Nether", -"BasaltDelta", -}, +magma_cube_biomes, 0, minetest.LIGHT_MAX+1, 30, 15500, 4, -mmin, -mmax) +nether_min, +nether_max) mcl_mobs:spawn_specific( "mobs_mc:magma_cube_big", "nether", "ground", -{ -"Nether", -"BasaltDelta", -}, +magma_cube_biomes, 0, minetest.LIGHT_MAX+1, 30, 16000, 4, -mmin, -mmax) +nether_min, +nether_max) -- spawn eggs mcl_mobs.register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "#350000", "#fcfc00") From 15f5c3c30aa5d4beb296fbcaf5a885e6cf459ca5 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 06:05:00 +0100 Subject: [PATCH 09/11] Make slimes spawn at night in swamps. * Adds spawn definitions for large, small and tiny slimes to spawn in Swampland and MangroveSwamp biomes when light levels are less than 7. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index b1aee3ad10..06945264c0 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -200,6 +200,10 @@ local cave_biomes = { local cave_min = mcl_vars.mg_overworld_min local cave_max = water_level - 23 +local swampy_biomes = {"Swampland", "MangroveSwamp"} +local swamp_light_max = 7 +local swamp_min = water_level +local swamp_max = water_level + 27 mcl_mobs:spawn_specific( "mobs_mc:slime_tiny", @@ -214,6 +218,19 @@ minetest.LIGHT_MAX+1, cave_min, cave_max) +mcl_mobs:spawn_specific( +"mobs_mc:slime_tiny", +"overworld", +"ground", +swampy_biomes, +0, +swamp_light_max, +30, +12000, +4, +swamp_min, +swamp_max) + mcl_mobs:spawn_specific( "mobs_mc:slime_small", "overworld", @@ -227,6 +244,19 @@ minetest.LIGHT_MAX+1, cave_min, cave_max) +mcl_mobs:spawn_specific( +"mobs_mc:slime_small", +"overworld", +"ground", +swampy_biomes, +0, +swamp_light_max, +30, +8500, +4, +swamp_min, +swamp_max) + mcl_mobs:spawn_specific( "mobs_mc:slime_big", "overworld", @@ -240,6 +270,19 @@ minetest.LIGHT_MAX+1, cave_min, cave_max) +mcl_mobs:spawn_specific( +"mobs_mc:slime_big", +"overworld", +"ground", +swampy_biomes, +0, +swamp_light_max, +30, +10000, +4, +swamp_min, +swamp_max) + -- Magma cube local magma_cube_big = { description = S("Magma Cube"), From d8a883e81faa0f5df1df1db0aec276dc68d36bb9 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 06:29:31 +0100 Subject: [PATCH 10/11] Limit size of cow herds spawning. * Cows should spawn in herds of max 4, not 8. --- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 5ac5912a40..9de5d1ccef 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -12,7 +12,7 @@ local cow_def = { xp_min = 1, xp_max = 3, collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.39, 0.45}, - spawn_in_group = 8, + spawn_in_group = 4, spawn_in_group_min = 3, visual = "mesh", mesh = "mobs_mc_cow.b3d", From 60b0cfe89a7d2c3dbe70621109803bc31970be38 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 22 Dec 2022 06:35:45 +0100 Subject: [PATCH 11/11] Remove FIXME about slimes spawning in swamps. * This has been fixed. --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 06945264c0..31ecad1879 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -1,9 +1,5 @@ --License for code WTFPL and otherwise stated in readmes --- FIXME: Slimes should spawn not only in underground caves, but also --- during the night in Swampland and MangroveSwamp biomes, with a spawn --- chance proportional to the phase of the moon - -- FIXME: Slimes should spawn only in "slime chunks" which make up only -- 10% of the map. --