From 47cda09073edf8d0f2b403a82cc3ca6051787a05 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 11 Apr 2020 02:46:03 +0200 Subject: [PATCH] Implement per-class mob cap --- mods/ENTITIES/mcl_mobs/api.lua | 70 ++++++++++++++----- mods/ENTITIES/mcl_mobs/api.txt | 2 + mods/ENTITIES/mobs_mc/agent.lua | 1 + mods/ENTITIES/mobs_mc/bat.lua | 1 + mods/ENTITIES/mobs_mc/blaze.lua | 1 + mods/ENTITIES/mobs_mc/chicken.lua | 1 + mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 1 + mods/ENTITIES/mobs_mc/creeper.lua | 1 + mods/ENTITIES/mobs_mc/ender_dragon.lua | 1 + mods/ENTITIES/mobs_mc/enderman.lua | 1 + mods/ENTITIES/mobs_mc/endermite.lua | 1 + mods/ENTITIES/mobs_mc/ghast.lua | 1 + mods/ENTITIES/mobs_mc/guardian.lua | 1 + mods/ENTITIES/mobs_mc/guardian_elder.lua | 1 + mods/ENTITIES/mobs_mc/horse.lua | 1 + mods/ENTITIES/mobs_mc/iron_golem.lua | 1 + mods/ENTITIES/mobs_mc/llama.lua | 1 + mods/ENTITIES/mobs_mc/ocelot.lua | 1 + mods/ENTITIES/mobs_mc/parrot.lua | 1 + mods/ENTITIES/mobs_mc/pig.lua | 1 + mods/ENTITIES/mobs_mc/polar_bear.lua | 1 + mods/ENTITIES/mobs_mc/rabbit.lua | 2 + mods/ENTITIES/mobs_mc/sheep.lua | 1 + mods/ENTITIES/mobs_mc/shulker.lua | 1 + mods/ENTITIES/mobs_mc/silverfish.lua | 1 + mods/ENTITIES/mobs_mc/skeleton+stray.lua | 1 + mods/ENTITIES/mobs_mc/skeleton_wither.lua | 1 + mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 2 + mods/ENTITIES/mobs_mc/snowman.lua | 1 + mods/ENTITIES/mobs_mc/spider.lua | 1 + mods/ENTITIES/mobs_mc/squid.lua | 1 + mods/ENTITIES/mobs_mc/vex.lua | 1 + mods/ENTITIES/mobs_mc/villager.lua | 1 + mods/ENTITIES/mobs_mc/villager_evoker.lua | 1 + mods/ENTITIES/mobs_mc/villager_illusioner.lua | 1 + mods/ENTITIES/mobs_mc/villager_vindicator.lua | 1 + mods/ENTITIES/mobs_mc/villager_zombie.lua | 1 + mods/ENTITIES/mobs_mc/witch.lua | 1 + mods/ENTITIES/mobs_mc/wither.lua | 1 + mods/ENTITIES/mobs_mc/wolf.lua | 1 + mods/ENTITIES/mobs_mc/zombie.lua | 1 + mods/ENTITIES/mobs_mc/zombiepig.lua | 1 + 42 files changed, 96 insertions(+), 18 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 055d01a2e..8f455e9d4 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -7,6 +7,12 @@ mobs.version = "20180531" -- don't rely too much on this, rarely updated, if eve local MAX_MOB_NAME_LENGTH = 30 +local MOB_CAP = {} +MOB_CAP.hostile = 70 +MOB_CAP.passive = 10 +MOB_CAP.ambient = 15 +MOB_CAP.water = 15 + -- Localize local S = minetest.get_translator("mcl_mobs") @@ -3369,6 +3375,7 @@ minetest.register_entity(name, { _cmi_is_mob = true, -- MCL2 extensions + spawn_class = def.spawn_class, ignores_nametag = def.ignores_nametag or false, rain_damage = def.rain_damage or 0, glow = def.glow, @@ -3413,33 +3420,48 @@ end -- END mobs:register_mob function -- count how many mobs of one type are inside an area -local count_mobs = function(pos, type) +local count_mobs = function(pos, mobtype) - local num_type = 0 - local num_total = 0 + local num = 0 local objs = minetest.get_objects_inside_radius(pos, aoc_range) for n = 1, #objs do - if not objs[n]:is_player() then + local obj = objs[n]:get_luaentity() - local obj = objs[n]:get_luaentity() + if obj and obj.name and obj._cmi_is_mob then - -- count mob type and add to total also - if obj and obj.name and obj.name == type then - - num_type = num_type + 1 - num_total = num_total + 1 - - -- add to total mobs - elseif obj and obj.name and obj.health ~= nil then - - num_total = num_total + 1 + -- count passive mobs only + if mobtype == "!passive" then + if obj.spawn_class == "passive" then + num = num + 1 + end + -- count hostile mobs only + elseif mobtype == "!hostile" then + if obj.spawn_class == "hostile" then + num = num + 1 + end + -- count ambient mobs only + elseif mobtype == "!ambient" then + if obj.spawn_class == "ambient" then + num = num + 1 + end + -- count water mobs only + elseif mobtype == "!water" then + if obj.spawn_class == "water" then + num = num + 1 + end + -- count mob type + elseif mobtype and obj.name == mobtype then + num = num + 1 + -- count total mobs + elseif not mobtype then + num = num + 1 end end end - return num_type, num_total + return num end @@ -3494,9 +3516,21 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, return end + -- count nearby mobs in same spawn class + local entdef = minetest.registered_entities[name] + local spawn_class = entdef and entdef.spawn_class + if not spawn_class then + if entdef.type == "monster" then + spawn_class = "hostile" + else + spawn_class = "passive" + end + end + local in_class_cap = count_mobs(pos, "!"..spawn_class) < MOB_CAP[spawn_class] -- 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 + if active_object_count_wider >= max_per_block -- large-range mob cap + or (not in_class_cap) -- spawn class mob cap + or count_mobs(pos, name) >= aoc then -- per-mob mob cap -- too many entities minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too crowded!") return diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index 0b3542243..17a6a8b04 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -226,6 +226,8 @@ functions needed for the mob to work properly which contains the following: MineClone 2 extensions: + 'spawn_class' Classification of mod for the spawning algorithm: + "hostile", "passive", "ambient" or "water" 'ignores_nametag' if true, mob cannot be named by nametag 'rain_damage' damage per second if mob is standing in rain (default: 0) 'sunlight_damage' holds the damage per second inflicted to mobs when they diff --git a/mods/ENTITIES/mobs_mc/agent.lua b/mods/ENTITIES/mobs_mc/agent.lua index 172698eb4..8efcbd629 100644 --- a/mods/ENTITIES/mobs_mc/agent.lua +++ b/mods/ENTITIES/mobs_mc/agent.lua @@ -6,6 +6,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:agent", { type = "npc", + spawn_class = "passive", passive = true, hp_min = 20, hp_max = 20, diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index a4b54bb93..2d071914a 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -4,6 +4,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:bat", { type = "animal", + spawn_class = "ambient", can_despawn = true, passive = true, hp_min = 6, diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index adf5238c9..967dbb051 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -12,6 +12,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:blaze", { type = "monster", + spawn_class = "hostile", hp_min = 20, hp_max = 20, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3}, diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index de1773c0d..c4e2707c2 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -10,6 +10,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:chicken", { type = "animal", + spawn_class = "passive", hp_min = 4, hp_max = 4, diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 142569875..542b5615e 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -4,6 +4,7 @@ local S = minetest.get_translator("mobs_mc") local cow_def = { type = "animal", + spawn_class = "passive", hp_min = 10, hp_max = 10, collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.39, 0.45}, diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index 7add39b36..4995fa6b8 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -11,6 +11,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:creeper", { type = "monster", + spawn_class = "hostile", hp_min = 20, hp_max = 20, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3}, diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index de4a2a599..c9da0c498 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -6,6 +6,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:enderdragon", { type = "monster", + spawn_class = "hostile", pathfinding = 1, attacks_animals = true, walk_chance = 100, diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 467fb290a..71dcb99e6 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -168,6 +168,7 @@ local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false mobs:register_mob("mobs_mc:enderman", { -- TODO: Endermen should be classified as passive type = "monster", + spawn_class = "passive", passive = false, pathfinding = 1, hp_min = 40, diff --git a/mods/ENTITIES/mobs_mc/endermite.lua b/mods/ENTITIES/mobs_mc/endermite.lua index 5a9793cd4..3fb0c1ebf 100644 --- a/mods/ENTITIES/mobs_mc/endermite.lua +++ b/mods/ENTITIES/mobs_mc/endermite.lua @@ -6,6 +6,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:endermite", { type = "monster", + spawn_class = "hostile", passive = false, hp_min = 8, hp_max = 8, diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index ae480bc71..cc06155f9 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -12,6 +12,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:ghast", { type = "monster", + spawn_class = "hostile", pathfinding = 1, group_attack = true, hp_min = 10, diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index 7db141983..42742db89 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -8,6 +8,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:guardian", { type = "monster", + spawn_class = "hostile", hp_min = 30, hp_max = 30, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 7d955e390..93792a5dc 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -8,6 +8,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:guardian_elder", { type = "monster", + spawn_class = "hostile", hp_min = 80, hp_max = 80, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index d5123edd4..564950809 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -84,6 +84,7 @@ end -- Horse local horse = { type = "animal", + spawn_class = "passive", visual = "mesh", mesh = "mobs_mc_horse.b3d", visual_size = {x=3.0, y=3.0}, diff --git a/mods/ENTITIES/mobs_mc/iron_golem.lua b/mods/ENTITIES/mobs_mc/iron_golem.lua index 046c655ac..49a14c2c4 100644 --- a/mods/ENTITIES/mobs_mc/iron_golem.lua +++ b/mods/ENTITIES/mobs_mc/iron_golem.lua @@ -13,6 +13,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:iron_golem", { type = "npc", + spawn_class = "passive", passive = true, hp_min = 100, hp_max = 100, diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 491839803..3b75e57ae 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -26,6 +26,7 @@ local carpets = { mobs:register_mob("mobs_mc:llama", { type = "animal", + spawn_class = "passive", hp_min = 15, hp_max = 30, passive = false, diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index f57a4e4ae..31d319f88 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -28,6 +28,7 @@ end -- Ocelot local ocelot = { type = "animal", + spawn_class = "passive", can_despawn = true, hp_min = 10, hp_max = 10, diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 42006d8c7..4cee41d15 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -13,6 +13,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:parrot", { type = "npc", + spawn_class = "passive", pathfinding = 1, hp_min = 6, hp_max = 6, diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index 415c9094f..921eb91f1 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -4,6 +4,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:pig", { type = "animal", + spawn_class = "passive", runaway = true, hp_min = 10, hp_max = 10, diff --git a/mods/ENTITIES/mobs_mc/polar_bear.lua b/mods/ENTITIES/mobs_mc/polar_bear.lua index c6f0d5848..b4e2e34f3 100644 --- a/mods/ENTITIES/mobs_mc/polar_bear.lua +++ b/mods/ENTITIES/mobs_mc/polar_bear.lua @@ -9,6 +9,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:polar_bear", { type = "animal", + spawn_class = "passive", runaway = false, passive = false, hp_min = 30, diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index 5a0f58c18..a7c05315a 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -4,6 +4,7 @@ local S = minetest.get_translator("mobs_mc") local rabbit = { type = "animal", + spawn_class = "passive", passive = true, reach = 1, @@ -74,6 +75,7 @@ mobs:register_mob("mobs_mc:rabbit", rabbit) -- The killer bunny (Only with spawn egg) local killer_bunny = table.copy(rabbit) killer_bunny.type = "monster" +killer_bunny.spawn_class = "hostile" killer_bunny.attack_type = "dogfight" killer_bunny.specific_attack = { "player", "mobs_mc:wolf", "mobs_mc:dog" } killer_bunny.damage = 8 diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 1747d3cae..2982580df 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -44,6 +44,7 @@ local gotten_texture = { "blank.png", "mobs_mc_sheep.png" } --mcsheep mobs:register_mob("mobs_mc:sheep", { type = "animal", + spawn_class = "passive", hp_min = 8, hp_max = 8, diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 0a06fe89c..ead105d2a 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -13,6 +13,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:shulker", { type = "monster", + spawn_class = "hostile", attack_type = "shoot", shoot_interval = 0.5, arrow = "mobs_mc:shulkerbullet", diff --git a/mods/ENTITIES/mobs_mc/silverfish.lua b/mods/ENTITIES/mobs_mc/silverfish.lua index f2c111987..a6baf1e46 100644 --- a/mods/ENTITIES/mobs_mc/silverfish.lua +++ b/mods/ENTITIES/mobs_mc/silverfish.lua @@ -6,6 +6,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:silverfish", { type = "monster", + spawn_class = "hostile", passive = false, group_attack = true, reach = 1, diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 0530f8b6a..5d06b812f 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -14,6 +14,7 @@ local mod_bows = minetest.get_modpath("mcl_bows") ~= nil local skeleton = { type = "monster", + spawn_class = "hostile", hp_min = 20, hp_max = 20, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index 896df69a8..8af94a856 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -11,6 +11,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:witherskeleton", { type = "monster", + spawn_class = "hostile", hp_min = 20, hp_max = 20, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 58a15d039..236e2277a 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -57,6 +57,7 @@ end -- Slime local slime_big = { type = "monster", + spawn_class = "hostile", pathfinding = 1, group_attack = { "mobs_mc:slime_big", "mobs_mc:slime_small", "mobs_mc:slime_tiny" }, hp_min = 16, @@ -156,6 +157,7 @@ mobs:spawn_specific("mobs_mc:slime_big", mobs_mc.spawn.solid, {"air"}, 0, minete -- Magma cube local magma_cube_big = { type = "monster", + spawn_class = "hostile", hp_min = 16, hp_max = 16, collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02}, diff --git a/mods/ENTITIES/mobs_mc/snowman.lua b/mods/ENTITIES/mobs_mc/snowman.lua index d645d6b2e..f0cab4dfb 100644 --- a/mods/ENTITIES/mobs_mc/snowman.lua +++ b/mods/ENTITIES/mobs_mc/snowman.lua @@ -22,6 +22,7 @@ local gotten_texture = { mobs:register_mob("mobs_mc:snowman", { type = "npc", + spawn_class = "passive", passive = true, hp_min = 4, hp_max = 4, diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index eda2e37bf..5dbff6af1 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -14,6 +14,7 @@ local S = minetest.get_translator("mobs_mc") local spider = { type = "monster", + spawn_class = "hostile", passive = false, docile_by_day = true, attack_type = "dogfight", diff --git a/mods/ENTITIES/mobs_mc/squid.lua b/mods/ENTITIES/mobs_mc/squid.lua index ddbabe0a3..a43bade39 100644 --- a/mods/ENTITIES/mobs_mc/squid.lua +++ b/mods/ENTITIES/mobs_mc/squid.lua @@ -8,6 +8,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:squid", { type = "animal", + spawn_class = "water", can_despawn = true, passive = true, hp_min = 10, diff --git a/mods/ENTITIES/mobs_mc/vex.lua b/mods/ENTITIES/mobs_mc/vex.lua index fc8b45dc5..ec0f56222 100644 --- a/mods/ENTITIES/mobs_mc/vex.lua +++ b/mods/ENTITIES/mobs_mc/vex.lua @@ -11,6 +11,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:vex", { type = "monster", + spawn_class = "hostile", pathfinding = 1, passive = false, attack_type = "dogfight", diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 6432a87a8..39fabe9fe 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -908,6 +908,7 @@ end) mobs:register_mob("mobs_mc:villager", { type = "npc", + spawn_class = "passive", hp_min = 20, hp_max = 20, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3}, diff --git a/mods/ENTITIES/mobs_mc/villager_evoker.lua b/mods/ENTITIES/mobs_mc/villager_evoker.lua index 7bb48e729..3fc22e1d0 100644 --- a/mods/ENTITIES/mobs_mc/villager_evoker.lua +++ b/mods/ENTITIES/mobs_mc/villager_evoker.lua @@ -13,6 +13,7 @@ local pr = PseudoRandom(os.time()*666) mobs:register_mob("mobs_mc:evoker", { type = "monster", + spawn_class = "hostile", physical = true, pathfinding = 1, hp_min = 24, diff --git a/mods/ENTITIES/mobs_mc/villager_illusioner.lua b/mods/ENTITIES/mobs_mc/villager_illusioner.lua index 9c0429ec0..4ead33e27 100644 --- a/mods/ENTITIES/mobs_mc/villager_illusioner.lua +++ b/mods/ENTITIES/mobs_mc/villager_illusioner.lua @@ -8,6 +8,7 @@ local mod_bows = minetest.get_modpath("mcl_bows") ~= nil mobs:register_mob("mobs_mc:illusioner", { type = "monster", + spawn_class = "hostile", attack_type = "shoot", shoot_interval = 2.5, shoot_offset = 1.5, diff --git a/mods/ENTITIES/mobs_mc/villager_vindicator.lua b/mods/ENTITIES/mobs_mc/villager_vindicator.lua index a228aa560..2155d511e 100644 --- a/mods/ENTITIES/mobs_mc/villager_vindicator.lua +++ b/mods/ENTITIES/mobs_mc/villager_vindicator.lua @@ -12,6 +12,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:vindicator", { type = "monster", + spawn_class = "hostile", physical = false, pathfinding = 1, hp_min = 24, diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index bc974277c..b5f6cd83d 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -14,6 +14,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:villager_zombie", { type = "monster", + spawn_class = "hostile", hp_min = 20, hp_max = 20, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/witch.lua b/mods/ENTITIES/mobs_mc/witch.lua index 58d745b0c..076738791 100644 --- a/mods/ENTITIES/mobs_mc/witch.lua +++ b/mods/ENTITIES/mobs_mc/witch.lua @@ -14,6 +14,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:witch", { type = "monster", + spawn_class = "hostile", hp_min = 26, hp_max = 26, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3}, diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 19d2386b6..7686efc97 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -11,6 +11,7 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:wither", { type = "monster", + spawn_class = "hostile", hp_max = 300, hp_min = 300, armor = 80, diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index 3dc12e1f2..37bfc5fea 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -20,6 +20,7 @@ end -- Wolf local wolf = { type = "animal", + spawn_class = "passive", can_despawn = true, hp_min = 8, hp_max = 8, diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index c67e73c3d..6e55d6e83 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -40,6 +40,7 @@ table.insert(drops_zombie, { local zombie = { type = "monster", + spawn_class = "hostile", hp_min = 20, hp_max = 20, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index 2f2aeedea..777f23869 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -14,6 +14,7 @@ local pigman = { -- type="animal", passive=false: This combination is needed for a neutral mob which becomes hostile, if attacked type = "animal", passive = false, + spawn_class = "passive", hp_min = 20, hp_max = 20, breath_max = -1,