From 11114c6847ed1eb90da964026395d24f559aba03 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Wed, 7 Apr 2021 23:54:36 +0200 Subject: [PATCH 01/51] fix add_bar function returning nil value --- mods/HUD/mcl_bossbars/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua index 3a144aac4..5c6a883d9 100644 --- a/mods/HUD/mcl_bossbars/init.lua +++ b/mods/HUD/mcl_bossbars/init.lua @@ -60,7 +60,7 @@ function mcl_bossbars.add_bar(player, def) bar.id = last_id + 1 last_id = bar.id mcl_bossbars.static[bar.id] = bar - return id + return bar.id end end From f7ddfe289178064ba36b3f1b2e88b7c83a33c0e8 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Wed, 7 Apr 2021 23:54:40 +0200 Subject: [PATCH 02/51] Revert "fix add_bar function returning nil value" This reverts commit 11114c6847ed1eb90da964026395d24f559aba03. --- mods/HUD/mcl_bossbars/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua index 5c6a883d9..3a144aac4 100644 --- a/mods/HUD/mcl_bossbars/init.lua +++ b/mods/HUD/mcl_bossbars/init.lua @@ -60,7 +60,7 @@ function mcl_bossbars.add_bar(player, def) bar.id = last_id + 1 last_id = bar.id mcl_bossbars.static[bar.id] = bar - return bar.id + return id end end From 8e30bc8dbd41082df63699c8f786ebedc04b1e0c Mon Sep 17 00:00:00 2001 From: kay27 Date: Thu, 8 Apr 2021 02:54:33 +0400 Subject: [PATCH 03/51] [mcl_portals] Prevent from spawning Nether portals in Undertale when not enough air space in Nether --- mods/ITEMS/mcl_portals/portal_nether.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_portals/portal_nether.lua b/mods/ITEMS/mcl_portals/portal_nether.lua index 825c95e05..1d9fe2efb 100644 --- a/mods/ITEMS/mcl_portals/portal_nether.lua +++ b/mods/ITEMS/mcl_portals/portal_nether.lua @@ -490,10 +490,12 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param) end if param.next_chunk_1 and param.next_chunk_2 and param.next_pos then - local pos1, pos2, pos = param.next_chunk_1, param.next_chunk_2, param.next_pos - log("action", "[mcl_portals] Making additional search in chunk below, because current one doesn't contain any air space for portal, target pos "..pos_to_string(pos)) - minetest.emerge_area(pos1, pos2, ecb_scan_area_2, {pos = pos, pos1 = pos1, pos2 = pos2, name=name, obj=obj}) - return + local pos1, pos2, p = param.next_chunk_1, param.next_chunk_2, param.next_pos + if p.x >= pos1.x and p.x <= pos2.x and p.y >= pos1.y and p.y <= pos2.y and p.z >= pos1.z and p.z <= pos2.z then + log("action", "[mcl_portals] Making additional search in chunk below, because current one doesn't contain any air space for portal, target pos "..pos_to_string(p)) + minetest.emerge_area(pos1, pos2, ecb_scan_area_2, {pos = p, pos1 = pos1, pos2 = pos2, name=name, obj=obj}) + return + end end log("action", "[mcl_portals] found no space, reverting to target pos "..pos_to_string(pos).." - creating a portal") @@ -536,7 +538,7 @@ local function create_portal(pos, limit1, limit2, name, obj) -- Basically the copy of code above, with minor additions to continue the search in single additional chunk below: local next_chunk_1 = {x = pos1.x, y = pos1.y - mcl_vars.chunk_size_in_nodes, z = pos1.z} local next_chunk_2 = add(next_chunk_1, mcl_vars.chunk_size_in_nodes - 1) - local next_pos = {x = pos.x, y=next_chunk_2.y, z = pos.z} + local next_pos = {x = pos.x, y=max(next_chunk_2.y, limit1.y), z = pos.z} if limit1 and limit1.x and limit1.y and limit1.z then pos1 = {x = max(min(limit1.x, pos.x), pos1.x), y = max(min(limit1.y, pos.y), pos1.y), z = max(min(limit1.z, pos.z), pos1.z)} next_chunk_1 = {x = max(min(limit1.x, next_pos.x), next_chunk_1.x), y = max(min(limit1.y, next_pos.y), next_chunk_1.y), z = max(min(limit1.z, next_pos.z), next_chunk_1.z)} From 2db0e176b315968363998f6c655920a174840a76 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Thu, 8 Apr 2021 12:04:29 +0800 Subject: [PATCH 04/51] Prevent param2 overflow when adding stems. Fix #1490 --- mods/ITEMS/mcl_ocean/kelp.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 3aefe85f8..bbdae64ee 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -1,6 +1,9 @@ -- TODO: whenever it becomes possible to fully implement kelp without the -- plantlike_rooted limitation, please update accordingly. -- +-- TODO: whenever it becomes possible to make kelp grow infinitely without +-- resorting to making intermediate kelp stem node, please update accordingly. +-- -- TODO: In MC, you can't actually destroy kelp by bucket'ing water in the middle. -- However, because of the plantlike_rooted hack, we'll just allow it for now. @@ -191,17 +194,18 @@ end -- Converts param2 to kelp height. +-- For the special case where the max param2 is reached, interpret that as the +-- 16th kelp stem. function kelp.get_height(param2) - return math_floor(param2 / 16) + return param2 ~= 255 and math_floor(param2 / 16) or 16 -- 256/16 end -- Obtain pos and node of the tip of kelp. -function kelp.get_tip(pos, param2) - -- Optional params: param2 - local height = kelp.get_height(param2 or mt_get_node(pos).param2) - local pos_tip = {x=pos.x, y=pos.y, z=pos.z} - pos_tip.y = pos_tip.y + height + 1 +function kelp.get_tip(pos, height) + -- Optional params: height + local height = height or kelp.get_height(mt_get_node(pos).param2) + local pos_tip = {x=pos.x, y=pos.y+height+1, z=pos.z} return pos_tip, mt_get_node(pos_tip), height end @@ -227,7 +231,8 @@ end -- Obtain next param2. function kelp.next_param2(param2) - return param2+16 - param2 % 16 + -- param2 max value is 255, so adding to 256 causes overflow. + return math_min(param2+16 - param2 % 16, 255); end @@ -526,7 +531,7 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) -- When placed on kelp. if mt_get_item_group(nu_name, "kelp") == 1 then - pos_tip,node_tip = kelp.get_tip(pos_under, node_under.param2) + pos_tip,node_tip = kelp.get_tip(pos_under, kelp.get_height(node_under.param2)) def_tip = mt_registered_nodes[node_tip.name] -- When placed on surface. From 5ccb12586dd09405f42ca7c824a817cde8fdf435 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Thu, 8 Apr 2021 13:34:04 +0800 Subject: [PATCH 05/51] Fix bug where incorrect number of items are dropped. --- mods/ITEMS/mcl_ocean/kelp.lua | 46 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index bbdae64ee..3d4c6b4b3 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -214,7 +214,7 @@ end function kelp.find_unsubmerged(pos, node, height) -- Optional params: node, height local node = node or mt_get_node(pos) - local height = height or kelp.get_height(node.param2) + local height = height or ((node.param2 >= 0 and node.param2 < 16) and 1) or kelp.get_height(node.param2) local walk_pos = {x=pos.x, z=pos.z} local y = pos.y @@ -316,7 +316,7 @@ function kelp.init_timer(pos, pos_hash) end --- Apply next kelp height. +-- Apply next kelp height. The surface is swapped. so on_construct is skipped. function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flowing) -- Modified params: node -- Optional params: node, set_node, pos_tip, node_tip, submerged, downward_flowing @@ -372,9 +372,9 @@ end -- Drops the items for detached kelps. -function kelp.detach_drop(pos, param2) - -- Optional params: param2 - local height = kelp.get_height(param2 or mt_get_node(pos).param2) +function kelp.detach_drop(pos, height) + -- Optional params: height + local height = height or kelp.get_height(mt_get_node(pos).param2) local y = pos.y local walk_pos = {x=pos.x, z=pos.z} for i=1,height do @@ -389,17 +389,18 @@ end -- Synonymous to digging the kelp. -- NOTE: this is intended for whenever kelp truly becomes segmented plants -- instead of rooted to the floor. Don't try to remove dig_pos. -function kelp.detach_dig(dig_pos, pos, node, drop) - -- Optional params: drop +function kelp.detach_dig(dig_pos, pos, drop, node, height) + -- Optional params: drop, node, height - local param2 = node.param2 + local node = node or mt_get_node(pos) + local height = height or kelp.get_height(node.param2) -- pos.y points to the surface, offset needed to point to the first kelp. local new_height = dig_pos.y - (pos.y+1) -- Digs the entire kelp. if new_height <= 0 then if drop then - kelp.detach_drop(dig_pos, param2) + kelp.detach_drop(dig_pos, height) end mt_set_node(pos, { name=mt_registered_nodes[node.name].node_dig_prediction, @@ -409,7 +410,8 @@ function kelp.detach_dig(dig_pos, pos, node, drop) -- Digs the kelp beginning at a height. else if drop then - kelp.detach_drop(dig_pos, param2 - new_height) + kelp.detach_drop(dig_pos, height - new_height) + minetest.chat_send_all(node.param2 - new_height) end mt_swap_node(pos, {name=node.name, param=node.param, param2=16*new_height}) end @@ -421,7 +423,7 @@ end -------------------------------------------------------------------------------- function kelp.surface_on_dig(pos, node, digger) - kelp.detach_dig(pos, pos, node, true) + kelp.detach_dig(pos, pos, true, node) end @@ -435,11 +437,11 @@ function kelp.surface_on_timer(pos) local pos_hash -- Update detahed kelps - local dig_pos = kelp.find_unsubmerged(pos, node) + local dig_pos,_, height = kelp.find_unsubmerged(pos, node) if dig_pos then pos_hash = mt_hash_node_position(pos) mt_sound_play(mt_registered_nodes[node.name].sounds.dug, { gain = 0.5, pos = dig_pos }, true) - kelp.detach_dig(dig_pos, pos, node, true) + kelp.detach_dig(dig_pos, pos, true, node, height) kelp.store_age(kelp.roll_init_age(), pos, pos_hash) end @@ -468,7 +470,7 @@ function kelp.surface_on_destruct(pos) -- on_falling callback. Activated by pistons for falling nodes too. if kelp.is_falling(pos, node) then - kelp.detach_drop(pos, node.param2) + kelp.detach_drop(pos, kelp.get_height(node.param2)) end -- Removes position from queue @@ -479,7 +481,7 @@ end function kelp.surface_on_mvps_move(pos, node, oldpos, nodemeta) -- Pistons moving falling nodes will have already activated on_falling callback. - kelp.detach_dig(pos, pos, node, mt_get_item_group(node.name, "falling_node") ~= 1) + kelp.detach_dig(pos, pos, mt_get_item_group(node.name, "falling_node") ~= 1, node) end @@ -523,7 +525,7 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) end - local pos_tip, node_tip, def_tip, new_kelp + local pos_tip, node_tip, def_tip, new_surface -- Kelp must also be placed on the top/tip side of the surface/kelp if pos_under.y >= pos_above.y then return itemstack @@ -536,17 +538,17 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) -- When placed on surface. else - new_kelp = false + new_surface = false for _,surface in pairs(kelp.surfaces) do if nu_name == surface.nodename then node_under.name = "mcl_ocean:kelp_" ..surface.name node_under.param2 = 0 - new_kelp = true + new_surface = true break end end -- Surface must support kelp - if not new_kelp then + if not new_surface then return itemstack end @@ -555,7 +557,7 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) def_tip = mt_registered_nodes[node_tip.name] end - -- New kelp must also be submerged in water. + -- Next kelp must also be submerged in water. local downward_flowing = kelp.is_downward_flowing(pos_tip, node_tip) local submerged = kelp.is_submerged(node_tip) if not submerged then @@ -572,9 +574,9 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) itemstack:take_item() end - -- Initialize age and timer when it's a new kelp + -- Initialize age and timer when it's planted on a new surface. local pos_hash = mt_hash_node_position(pos_under) - if new_kelp then + if new_surface then kelp.init_age(pos_under, nil, pos_hash) kelp.init_timer(pos_under, pos_hash) else From d50665d2d5e49d58317cffdaed50fd165e5d2315 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Thu, 8 Apr 2021 19:25:19 +0800 Subject: [PATCH 06/51] Allow kelp stems at half height to be treated like full-sized ones. Remove debug information --- mods/ITEMS/mcl_ocean/kelp.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 3d4c6b4b3..9670943da 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -197,7 +197,7 @@ end -- For the special case where the max param2 is reached, interpret that as the -- 16th kelp stem. function kelp.get_height(param2) - return param2 ~= 255 and math_floor(param2 / 16) or 16 -- 256/16 + return math_floor(param2 / 16) + math_floor(param2 % 16 / 8) end @@ -411,7 +411,6 @@ function kelp.detach_dig(dig_pos, pos, drop, node, height) else if drop then kelp.detach_drop(dig_pos, height - new_height) - minetest.chat_send_all(node.param2 - new_height) end mt_swap_node(pos, {name=node.name, param=node.param, param2=16*new_height}) end @@ -525,7 +524,7 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) end - local pos_tip, node_tip, def_tip, new_surface + local pos_tip, node_tip, def_tip, new_surface, height -- Kelp must also be placed on the top/tip side of the surface/kelp if pos_under.y >= pos_above.y then return itemstack @@ -533,7 +532,8 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) -- When placed on kelp. if mt_get_item_group(nu_name, "kelp") == 1 then - pos_tip,node_tip = kelp.get_tip(pos_under, kelp.get_height(node_under.param2)) + height = kelp.get_height(node_under.param2) + pos_tip,node_tip = kelp.get_tip(pos_under, height) def_tip = mt_registered_nodes[node_tip.name] -- When placed on surface. @@ -555,6 +555,7 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) pos_tip = pos_above node_tip = mt_get_node(pos_above) def_tip = mt_registered_nodes[node_tip.name] + height = 0 end -- Next kelp must also be submerged in water. @@ -569,7 +570,12 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing) if def_node.sounds then mt_sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true) end - kelp.next_height(pos_under, node_under, pos_tip, node_tip, def_tip, submerged, downward_flowing) + -- TODO: get rid of rooted plantlike hack + if height < 16 then + kelp.next_height(pos_under, node_under, pos_tip, node_tip, def_tip, submerged, downward_flowing) + else + mt_add_item(pos_tip, "mcl_ocean:kelp") + end if not mt_is_creative_enabled(player_name) then itemstack:take_item() end From 0842a36aa6f4a45a10a3ec1182dedcec1d4aac61 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 14:28:07 -0400 Subject: [PATCH 07/51] Fix extreme mesecons/redstone crashing at world border --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 7986c2908..78d675e47 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -483,6 +483,12 @@ function mesecon.turnoff(pos, link) for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) + + if not n then + mcl_explosions.explode(f.pos, 10) + return + end + if mesecon.is_receptor_on(n.name) then local receptorrules = mesecon.receptor_get_rules(n) for _, rr in pairs(receptorrules) do From b9d175e6a5d6654b19098c7943a4e14ca8e43eb1 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 15:16:38 -0400 Subject: [PATCH 08/51] Add erlehmann fix to redstone world border crash --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 78d675e47..3a8e68f95 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -484,16 +484,13 @@ function mesecon.turnoff(pos, link) local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - if not n then - mcl_explosions.explode(f.pos, 10) - return - end - - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false + if not (mesecon.get_node_force(np) == nil) then + if mesecon.is_receptor_on(n.name) then + local receptorrules = mesecon.receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and vector.equals(mesecon.invertRule(rr), r) then + return false + end end end end From 18f73ba31f3669b49a573fe6cc15050c81fe31db Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 15:48:53 -0400 Subject: [PATCH 09/51] Revert fixes to crash world border --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 3a8e68f95..d17a3acd2 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -483,14 +483,12 @@ function mesecon.turnoff(pos, link) for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - - if not (mesecon.get_node_force(np) == nil) then - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false - end + + if mesecon.is_receptor_on(n.name) then + local receptorrules = mesecon.receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and vector.equals(mesecon.invertRule(rr), r) then + return false end end end From 5e0bd2281c6546d6f9ef672263adabccb91badc0 Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 7 Apr 2021 20:47:40 +0400 Subject: [PATCH 10/51] Revert "Revert "Merge pull request 'Massively overhaul spawning algorithm for mobs' (#1487) from jordan4ibanez/MineClone2-MobTweaks:master into master"" This reverts commit 6a1a634cba4e0530a4cb72cf319f203f4a770d7f. --- mods/ENTITIES/mcl_mobs/api.lua | 255 ++++++++++++++++++++- mods/ENTITIES/mobs_mc/agent.lua | 2 +- mods/ENTITIES/mobs_mc/bat.lua | 2 +- mods/ENTITIES/mobs_mc/blaze.lua | 4 +- mods/ENTITIES/mobs_mc/chicken.lua | 2 +- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 5 +- mods/ENTITIES/mobs_mc/creeper.lua | 7 +- mods/ENTITIES/mobs_mc/enderman.lua | 6 +- mods/ENTITIES/mobs_mc/ghast.lua | 2 +- mods/ENTITIES/mobs_mc/guardian_elder.lua | 2 +- mods/ENTITIES/mobs_mc/horse.lua | 4 +- mods/ENTITIES/mobs_mc/llama.lua | 2 +- mods/ENTITIES/mobs_mc/ocelot.lua | 8 +- mods/ENTITIES/mobs_mc/parrot.lua | 4 +- mods/ENTITIES/mobs_mc/pig.lua | 2 +- mods/ENTITIES/mobs_mc/polar_bear.lua | 2 +- mods/ENTITIES/mobs_mc/rabbit.lua | 6 +- mods/ENTITIES/mobs_mc/sheep.lua | 2 +- mods/ENTITIES/mobs_mc/shulker.lua | 2 +- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 6 +- mods/ENTITIES/mobs_mc/skeleton_wither.lua | 2 +- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 18 +- mods/ENTITIES/mobs_mc/spider.lua | 2 +- mods/ENTITIES/mobs_mc/squid.lua | 2 +- mods/ENTITIES/mobs_mc/villager.lua | 2 +- mods/ENTITIES/mobs_mc/villager_zombie.lua | 4 +- mods/ENTITIES/mobs_mc/witch.lua | 2 +- mods/ENTITIES/mobs_mc/wolf.lua | 2 +- mods/ENTITIES/mobs_mc/zombie.lua | 8 +- mods/ENTITIES/mobs_mc/zombiepig.lua | 6 +- 30 files changed, 316 insertions(+), 57 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 94d6340ea..d85633421 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3562,7 +3562,7 @@ local mob_step = function(self, dtime) end -- mob plays random sound at times - if random(1, 100) == 1 then + if random(1, 70) == 1 then mob_sound(self, "random", true) end @@ -3925,7 +3925,35 @@ end end -- END mobs:register_mob function + + + + + + + + + + + +--BEGIN SPAWNING ALGORITHM + + + + + + + + + + + + + + + -- count how many mobs of one type are inside an area +--[[ local count_mobs = function(pos, mobtype) local num = 0 @@ -3969,7 +3997,7 @@ local count_mobs = function(pos, mobtype) return num end - +]]-- -- global functions @@ -3979,9 +4007,49 @@ function mobs:spawn_abm_check(pos, node, name) end -function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, - interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) +--[[ + Custom elements changed: +name: +the mobs name +dimension: +"overworld" +"nether" +"end" + +types of spawning: +"air" +"water" +"ground" +"lava" + +what is aoc??? + +WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua?? +]]-- + +--this is where all of the spawning information is kept +local spawn_dictionary = { + ["overworld"] = {}, + ["nether"] = {}, + ["end"] = {} +} + +function mobs:spawn_specific( + name, + dimension, + type_of_spawning, + min_light, + max_light, + interval, + chance, + aoc, + min_height, + max_height, + day_toggle, + on_spawn) + + -- Do mobs spawn at all? if not mobs_spawn then return @@ -4002,7 +4070,6 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, minetest.log("action", string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc)) - end local spawn_action @@ -4167,6 +4234,24 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, spawn_action(pos, node, active_object_count, active_object_count_wider, name) end + + --load information into the spawn dictionary + local key = #spawn_dictionary[dimension] + 1 + + spawn_dictionary[dimension][key] = {} + spawn_dictionary[dimension][key]["name"] = name + spawn_dictionary[dimension][key]["type"] = type_of_spawning + spawn_dictionary[dimension][key]["min_light"] = min_light + spawn_dictionary[dimension][key]["max_light"] = max_light + spawn_dictionary[dimension][key]["interval"] = interval + spawn_dictionary[dimension][key]["chance"] = chance + spawn_dictionary[dimension][key]["aoc"] = aoc + spawn_dictionary[dimension][key]["min_height"] = min_height + spawn_dictionary[dimension][key]["max_height"] = max_height + spawn_dictionary[dimension][key]["day_toggle"] = day_toggle + spawn_dictionary[dimension][key]["on_spawn"] = spawn_abm_action + + --[[ minetest.register_abm({ label = name .. " spawning", nodenames = nodes, @@ -4176,18 +4261,24 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, catch_up = false, action = spawn_abm_action, }) + ]]-- end -- compatibility with older mob registration +-- we're going to forget about this for now -j4i +--[[ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, chance, active_object_count, -31000, max_height, day_toggle) end +]]-- +--I'm not sure what this does but disabling it doesn't cause a crash -j4i -- MarkBu's spawn function +--[[ function mobs:spawn(def) local name = def.name @@ -4206,6 +4297,160 @@ function mobs:spawn(def) mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle, on_spawn) end +]]-- + + +local axis +--inner and outer part of square donut radius +local inner = 1 +local outer = 70 +local int = {-1,1} +local position_calculation = function(pos) + + pos = vector.floor(pos) + + --this is used to determine the axis buffer from the player + axis = math.random(0,1) + + --cast towards the direction + if axis == 0 then --x + pos.x = pos.x + math.random(inner,outer)*int[math.random(1,2)] + pos.z = pos.z + math.random(-outer,outer) + else --z + pos.z = pos.z + math.random(inner,outer)*int[math.random(1,2)] + pos.x = pos.x + math.random(-outer,outer) + end + return(pos) +end + +--[[ +local decypher_limits_dictionary = { + ["overworld"] = {mcl_vars.mg_overworld_min,mcl_vars.mg_overworld_max}, + ["nether"] = {mcl_vars.mg_nether_min, mcl_vars.mg_nether_max}, + ["end"] = {mcl_vars.mg_end_min, mcl_vars.mg_end_max} +} +]]-- + +local function decypher_limits(posy) + --local min_max_table = decypher_limits_dictionary[dimension] + --return min_max_table[1],min_max_table[2] + posy = math.floor(posy) + return posy - 32, posy + 32 +end + + +--todo mob limiting +--MAIN LOOP +local timer = 0 +minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer >= 15 then + timer = 0 + for _,player in ipairs(minetest.get_connected_players()) do + for i = 1,math.random(5) do + local player_pos = player:get_pos() + local _,dimension = mcl_worlds.y_to_layer(player_pos.y) + local min,max = decypher_limits(player_pos.y) + + local goal_pos = position_calculation(player_pos) + + + local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] + + if not mob_def then --to catch a crazy error if it ever happens + minetest.log("error", "WARNING!! mob spawning attempted to index a NIL mob!") + goto continue + end + + if mob_def.type == "ground" then + + local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:solid"}) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + spawning_position.y = spawning_position.y + 1 + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end + elseif mob_def.type == "air" then + local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"air"}) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end + elseif mob_def.type == "water" then + local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:water"}) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end + --elseif mob_def.type == "lava" then + --implement later + end + --local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"}) + + + ::continue:: --this is a safety catch + end + end + end +end) + + + + + + + + + + + + + +--END SPAWNING ALGORITHM + + + + + + + + + + + + + + + + + + + -- register arrow for shoot attack diff --git a/mods/ENTITIES/mobs_mc/agent.lua b/mods/ENTITIES/mobs_mc/agent.lua index 8fa7314cf..cc9910ee6 100644 --- a/mods/ENTITIES/mobs_mc/agent.lua +++ b/mods/ENTITIES/mobs_mc/agent.lua @@ -1,5 +1,5 @@ --################### ---################### AGENT +--################### AGENT - seemingly unused --################### local S = minetest.get_translator("mobs_mc") diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index 103579b67..b6825bbbf 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -64,7 +64,7 @@ else end -- Spawn on solid blocks at or below Sea level and the selected light level -mobs:spawn_specific("mobs_mc:bat", mobs_mc.spawn.solid, {"air"}, 0, maxlight, 20, 5000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-1) +mobs:spawn_specific("mobs_mc:bat", "overworld", "air", 0, maxlight, 20, 5000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-1) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index fbffa7920..d56acdf38 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -1,6 +1,6 @@ -- daufinsyd -- My work is under the LGPL terms --- Model and mobs_blaze.png see https://github.com/22i/minecraft-voxel-blender-models +-- Model and mobs_blaze.png see https://github.com/22i/minecraft-voxel-blender-models -hi 22i ~jordan4ibanez -- blaze.lua partial copy of mobs_mc/ghast.lua local S = minetest.get_translator("mobs_mc") @@ -128,7 +128,7 @@ mobs:register_mob("mobs_mc:blaze", { end, }) -mobs:spawn_specific("mobs_mc:blaze", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 5000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:blaze", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 5000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- Blaze fireball mobs:register_arrow("mobs_mc:blaze_fireball", { diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 325371e2b..397b6b8da 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -100,7 +100,7 @@ mobs:register_mob("mobs_mc:chicken", { }) --spawn -mobs:spawn_specific("mobs_mc:chicken", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 17000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:chicken", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 17000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0) diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 005af2980..a094d6d35 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -145,8 +145,9 @@ mobs:register_mob("mobs_mc:mooshroom", mooshroom_def) -- Spawning -mobs:spawn_specific("mobs_mc:cow", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 17000, 10, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:mooshroom", mobs_mc.spawn.mushroom_island, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 17000, 5, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:cow", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 17000, 10, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +--WARNING: THIS NEEDS A BIOME INTEGRATION +mobs:spawn_specific("mobs_mc:mooshroom", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 17000, 5, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn egg mobs:register_egg("mobs_mc:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0) diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index de44ba8c6..f1f0a3ef6 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -39,6 +39,8 @@ mobs:register_mob("mobs_mc:creeper", { runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" }, attack_type = "explode", + --hssssssssssss + explosion_strength = 3, explosion_radius = 3.5, explosion_damage_radius = 3.5, @@ -138,6 +140,9 @@ mobs:register_mob("mobs_mc:creeper_charged", { pathfinding = 1, visual = "mesh", mesh = "mobs_mc_creeper.b3d", + + --BOOM + textures = { {"mobs_mc_creeper.png", "mobs_mc_creeper_charge.png"}, @@ -248,7 +253,7 @@ mobs:register_mob("mobs_mc:creeper_charged", { glow = 3, }) -mobs:spawn_specific("mobs_mc:creeper", mobs_mc.spawn.solid, {"air"}, 0, 7, 20, 16500, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:creeper", "overworld", "ground", 0, 7, 20, 16500, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index f93f131cb..ca3bc84ce 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -562,11 +562,11 @@ mobs:register_mob("mobs_mc:enderman", { -- End spawn -mobs:spawn_specific("mobs_mc:enderman", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 3000, 12, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) +mobs:spawn_specific("mobs_mc:enderman", "end", "ground", 0, minetest.LIGHT_MAX+1, 30, 3000, 12, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) -- Overworld spawn -mobs:spawn_specific("mobs_mc:enderman", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 19000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:enderman", "overworld", "ground", 0, 7, 30, 19000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- Nether spawn (rare) -mobs:spawn_specific("mobs_mc:enderman", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 27500, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:enderman", "nether", "ground", 0, 7, 30, 27500, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- spawn eggs mobs:register_egg("mobs_mc:enderman", S("Enderman"), "mobs_mc_spawn_icon_enderman.png", 0) diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 7aed9395e..e2f6b1369 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -75,7 +75,7 @@ mobs:register_mob("mobs_mc:ghast", { }) -mobs:spawn_specific("mobs_mc:ghast", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 18000, 2, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:ghast", "nether", "air", 0, minetest.LIGHT_MAX+1, 30, 18000, 2, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- fireball (projectile) mobs:register_arrow("mobs_mc:fireball", { diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index a58a4a5b7..089f6e38f 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -106,7 +106,7 @@ mobs:register_mob("mobs_mc:guardian_elder", { view_range = 16, }) --- Spawning disabled due to size issues +-- Spawning disabled due to size issues <- what do you mean? -j4i -- TODO: Re-enable spawning -- mobs:spawn_specific("mobs_mc:guardian_elder", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-18) diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 3da63831e..00c292c1d 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -510,8 +510,8 @@ mobs:register_mob("mobs_mc:mule", mule) --=========================== --Spawn Function -mobs:spawn_specific("mobs_mc:horse", mobs_mc.spawn.grassland_savanna, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:donkey", mobs_mc.spawn.grassland_savanna, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:horse", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:donkey", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:horse", S("Horse"), "mobs_mc_spawn_icon_horse.png", 0) diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 36d020a65..0efb8e0ab 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -217,7 +217,7 @@ mobs:register_mob("mobs_mc:llama", { }) --spawn -mobs:spawn_specific("mobs_mc:llama", mobs_mc.spawn.savanna, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 5, mobs_mc.spawn_height.water+15, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:llama", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 5, mobs_mc.spawn_height.water+15, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:llama", S("Llama"), "mobs_mc_spawn_icon_llama.png", 0) diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index eca74d3ba..3b5273185 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -152,6 +152,9 @@ mobs:register_mob("mobs_mc:cat", cat) local base_spawn_chance = 5000 -- Spawn ocelot +--they get the same as the llama because I'm trying to rework so much of this code right now -j4i +mobs:spawn_specific("mobs_mc:ocelot", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 5, mobs_mc.spawn_height.water+15, mobs_mc.spawn_height.overworld_max) +--[[ mobs:spawn({ name = "mobs_mc:ocelot", nodes = mobs_mc.spawn.jungle, @@ -163,8 +166,8 @@ mobs:spawn({ min_height = mobs_mc.spawn_height.water+1, -- Right above ocean level max_height = mobs_mc.spawn_height.overworld_max, on_spawn = function(self, pos) - --[[ Note: Minecraft has a 1/3 spawn failure rate. - In this mod it is emulated by reducing the spawn rate accordingly (see above). ]] + Note: Minecraft has a 1/3 spawn failure rate. + In this mod it is emulated by reducing the spawn rate accordingly (see above). -- 1/7 chance to spawn 2 ocelot kittens if pr:next(1,7) == 1 then @@ -207,6 +210,7 @@ mobs:spawn({ end end, }) +]]-- -- spawn eggs -- FIXME: The spawn icon shows a cat texture, not an ocelot texture diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 407cb4466..c67263fb9 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -90,8 +90,8 @@ mobs:register_mob("mobs_mc:parrot", { }) --- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* -mobs:spawn_specific("mobs_mc:parrot", {"mcl_core:jungletree", "mcl_core:jungleleaves"}, {"air"}, 0, minetest.LIGHT_MAX+1, 7, 30000, 1, mobs_mc.spawn_height.water+7, mobs_mc.spawn_height.overworld_max) +-- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i +mobs:spawn_specific("mobs_mc:parrot","overworld", "air", 0, minetest.LIGHT_MAX+1, 7, 30000, 1, mobs_mc.spawn_height.water+7, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0) diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index 38700b6ca..143fcb495 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -182,7 +182,7 @@ mobs:register_mob("mobs_mc:pig", { end, }) -mobs:spawn_specific("mobs_mc:pig", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 15000, 8, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:pig", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 15000, 8, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:pig", S("Pig"), "mobs_mc_spawn_icon_pig.png", 0) diff --git a/mods/ENTITIES/mobs_mc/polar_bear.lua b/mods/ENTITIES/mobs_mc/polar_bear.lua index 459ca29b4..745c13a26 100644 --- a/mods/ENTITIES/mobs_mc/polar_bear.lua +++ b/mods/ENTITIES/mobs_mc/polar_bear.lua @@ -67,7 +67,7 @@ mobs:register_mob("mobs_mc:polar_bear", { }) -mobs:spawn_specific("mobs_mc:polar_bear", mobs_mc.spawn.snow, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 7000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:polar_bear", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 7000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn egg mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "mobs_mc_spawn_icon_polarbear.png", 0) diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index e167649f6..f09a70584 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -107,8 +107,11 @@ end mobs:register_mob("mobs_mc:killer_bunny", killer_bunny) -- Mob spawning rules. --- Different skins depending on spawn location +-- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out +mobs:spawn_specific("mobs_mc:rabbit", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 15000, 8, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) + +--[[ local spawn = { name = "mobs_mc:rabbit", neighbors = {"air"}, @@ -165,6 +168,7 @@ spawn_grass.on_spawn = function(self, pos) self.object:set_properties({textures = self.base_texture}) end mobs:spawn(spawn_grass) +]]-- -- Spawn egg mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0) diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 84650b4dd..b3400ab5f 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -303,7 +303,7 @@ mobs:register_mob("mobs_mc:sheep", { end end, }) -mobs:spawn_specific("mobs_mc:sheep", mobs_mc.spawn.grassland, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:sheep", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index faaf2ac40..583c5eed1 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -81,4 +81,4 @@ mobs:register_arrow("mobs_mc:shulkerbullet", { mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0) -mobs:spawn_specific("mobs_mc:shulker", mobs_mc.spawn.end_city, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 5000, 2, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) +mobs:spawn_specific("mobs_mc:shulker", "end", "ground", 0, minetest.LIGHT_MAX+1, 30, 5000, 2, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index cb12e905d..84e51c517 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -139,13 +139,13 @@ table.insert(stray.drops, { mobs:register_mob("mobs_mc:stray", stray) -- Overworld spawn -mobs:spawn_specific("mobs_mc:skeleton", mobs_mc.spawn.solid, {"air"}, 0, 7, 20, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:skeleton", "overworld", "ground", 0, 7, 20, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- Nether spawn -mobs:spawn_specific("mobs_mc:skeleton", mobs_mc.spawn.nether_fortress, {"air"}, 0, 7, 30, 10000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:skeleton", "nether", "ground", 0, 7, 30, 10000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- Stray spawn -- TODO: Spawn directly under the sky -mobs:spawn_specific("mobs_mc:stray", mobs_mc.spawn.snow, {"air"}, 0, 7, 20, 19000, 2, mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:stray", "overworld", "ground", 0, 7, 20, 19000, 2, mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index e4a1f86fc..d9de90d84 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -94,7 +94,7 @@ mobs:register_mob("mobs_mc:witherskeleton", { }) --spawn -mobs:spawn_specific("mobs_mc:witherskeleton", mobs_mc.spawn.nether_fortress, {"air"}, 0, 7, 30, 5000, 5, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:witherskeleton", "nether", "ground", 0, 7, 30, 5000, 5, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- spawn eggs mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index fd1f92bb4..2f9e8c8a9 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -157,9 +157,9 @@ mobs:register_mob("mobs_mc:slime_tiny", slime_tiny) local smin = mobs_mc.spawn_height.overworld_min local smax = mobs_mc.spawn_height.water - 23 -mobs:spawn_specific("mobs_mc:slime_tiny", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 12000, 4, smin, smax) -mobs:spawn_specific("mobs_mc:slime_small", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 8500, 4, smin, smax) -mobs:spawn_specific("mobs_mc:slime_big", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 10000, 4, smin, smax) +mobs:spawn_specific("mobs_mc:slime_tiny", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 12000, 4, smin, smax) +mobs:spawn_specific("mobs_mc:slime_small", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 8500, 4, smin, smax) +mobs:spawn_specific("mobs_mc:slime_big", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 10000, 4, smin, smax) -- Magma cube local magma_cube_big = { @@ -272,13 +272,13 @@ mobs:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny) local mmin = mobs_mc.spawn_height.nether_min local mmax = mobs_mc.spawn_height.nether_max -mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15500, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 16000, 4, mmin, mmax) +mobs:spawn_specific("mobs_mc:magma_cube_tiny", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mmin, mmax) +mobs:spawn_specific("mobs_mc:magma_cube_small", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 15500, 4, mmin, mmax) +mobs:spawn_specific("mobs_mc:magma_cube_big", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 16000, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax) +--mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax) +--mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax) +--mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 0bb03a9c7..1361e6a3a 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -87,7 +87,7 @@ cave_spider.sounds.base_pitch = 1.25 mobs:register_mob("mobs_mc:cave_spider", cave_spider) -mobs:spawn_specific("mobs_mc:spider", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:spider", "overworld", "ground", 0, 7, 30, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:spider", S("Spider"), "mobs_mc_spawn_icon_spider.png", 0) diff --git a/mods/ENTITIES/mobs_mc/squid.lua b/mods/ENTITIES/mobs_mc/squid.lua index 1877a2104..2dbb7c557 100644 --- a/mods/ENTITIES/mobs_mc/squid.lua +++ b/mods/ENTITIES/mobs_mc/squid.lua @@ -62,7 +62,7 @@ mobs:register_mob("mobs_mc:squid", { local water = mobs_mc.spawn_height.water --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height -mobs:spawn_specific("mobs_mc:squid", mobs_mc.spawn.water, {mobs_mc.items.water_source}, 0, minetest.LIGHT_MAX+1, 30, 5500, 3, water-16, water) +mobs:spawn_specific("mobs_mc:squid", "overworld", "water", 0, minetest.LIGHT_MAX+1, 30, 5500, 3, water-16, water) -- spawn eggs mobs:register_egg("mobs_mc:squid", S("Squid"), "mobs_mc_spawn_icon_squid.png", 0) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 68644266f..0b53d8015 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -1074,7 +1074,7 @@ mobs:register_mob("mobs_mc:villager", { -mobs:spawn_specific("mobs_mc:villager", mobs_mc.spawn.village, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 20, 4, mobs_mc.spawn_height.water+1, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:villager", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 20, 4, mobs_mc.spawn_height.water+1, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:villager", S("Villager"), "mobs_mc_spawn_icon_villager.png", 0) diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index 09539fa76..bcede2183 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -146,8 +146,8 @@ mobs:register_mob("mobs_mc:villager_zombie", { harmed_by_heal = true, }) -mobs:spawn_specific("mobs_mc:villager_zombie", mobs_mc.spawn.village, {"air"}, 0, 7, 30, 4090, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:villager_zombie", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 4090, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "mobs_mc_spawn_icon_zombie_villager.png", 0) diff --git a/mods/ENTITIES/mobs_mc/witch.lua b/mods/ENTITIES/mobs_mc/witch.lua index 383cbd36f..f9f9b8d1f 100644 --- a/mods/ENTITIES/mobs_mc/witch.lua +++ b/mods/ENTITIES/mobs_mc/witch.lua @@ -99,7 +99,7 @@ mobs:register_arrow("mobs_mc:potion_arrow", { end }) --- TODO: Spawn when witch works properly +-- TODO: Spawn when witch works properly <- eventually -j4i --mobs:spawn_specific("mobs_mc:witch", mobs_mc.spawn.jungle, {"air"}, 0, minetest.LIGHT_MAX-6, 12, 20000, 2, mobs_mc.spawn_height.water-6, mobs_mc.spawn_height.overworld_max) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index fe3031895..953c2df72 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -232,6 +232,6 @@ end mobs:register_mob("mobs_mc:dog", dog) -- Spawn -mobs:spawn_specific("mobs_mc:wolf", mobs_mc.spawn.wolf, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 9000, 7, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:wolf", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 9000, 7, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) mobs:register_egg("mobs_mc:wolf", S("Wolf"), "mobs_mc_spawn_icon_wolf.png", 0) diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index df9727d34..64f99d34d 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -135,11 +135,11 @@ mobs:register_mob("mobs_mc:baby_husk", baby_husk) -- Spawning -mobs:spawn_specific("mobs_mc:zombie", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 6000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:zombie", "overworld", "ground", 0, 7, 30, 6000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- Baby zombie is 20 times less likely than regular zombies -mobs:spawn_specific("mobs_mc:baby_zombie", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:husk", mobs_mc.spawn.desert, {"air"}, 0, 7, 30, 6500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:baby_husk", mobs_mc.spawn.desert, {"air"}, 0, 7, 30, 65000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:baby_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:husk", "overworld", "ground", 0, 7, 30, 6500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific("mobs_mc:baby_husk", "overworld", "ground", 0, 7, 30, 65000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- Spawn eggs mobs:register_egg("mobs_mc:husk", S("Husk"), "mobs_mc_spawn_icon_husk.png", 0) diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index 8c29a4bff..e996425c8 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -111,12 +111,12 @@ baby_pigman.child = 1 mobs:register_mob("mobs_mc:baby_pigman", baby_pigman) -- Regular spawning in the Nether -mobs:spawn_specific("mobs_mc:pigman", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:pigman", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- Baby zombie is 20 times less likely than regular zombies -mobs:spawn_specific("mobs_mc:baby_pigman", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 100000, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific("mobs_mc:baby_pigman", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 100000, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- Spawning in Nether portals in the Overworld -mobs:spawn_specific("mobs_mc:pigman", mobs_mc.spawn.nether_portal, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +--mobs:spawn_specific("mobs_mc:pigman", mobs_mc.spawn.nether_portal, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:pigman", S("Zombie Pigman"), "mobs_mc_spawn_icon_zombie_pigman.png", 0) From de41a4c26ba4d72091a26f969a435d4456a55ce0 Mon Sep 17 00:00:00 2001 From: kay27 Date: Thu, 8 Apr 2021 00:44:20 +0400 Subject: [PATCH 11/51] merge --- mods/ENTITIES/mcl_mobs/api.lua | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index d85633421..bf4880231 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -4277,13 +4277,14 @@ end --I'm not sure what this does but disabling it doesn't cause a crash -j4i +-- Just compatibility problem with outer mob mods currently, so adding a warning and temporarily enabling back -kay27 2021-04-08 -- MarkBu's spawn function ---[[ -function mobs:spawn(def) +function mobs:spawn(def) + minetest.log("warning", "[mcl_mobs] Deprecated function call: `mobs:spawn()`. Please use mobs:spawn_specific() instead!") local name = def.name local nodes = def.nodes or {"group:soil", "group:stone"} - local neighbors = def.neighbors or {"air"} +-- 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 @@ -4294,10 +4295,16 @@ function mobs:spawn(def) local day_toggle = def.day_toggle local on_spawn = def.on_spawn - mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, + --mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, + -- chance, active_object_count, min_height, max_height, day_toggle, on_spawn) + mobs:spawn_specific(name, "overworld", nodes, min_light, max_light, interval, + chance, active_object_count, min_height, max_height, day_toggle, on_spawn) + mobs:spawn_specific(name, "end", nodes, min_light, max_light, interval, + chance, active_object_count, min_height, max_height, day_toggle, on_spawn) + mobs:spawn_specific(name, "nether", nodes, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle, on_spawn) end -]]-- + local axis @@ -4409,6 +4416,22 @@ minetest.register_globalstep(function(dtime) end --elseif mob_def.type == "lava" then --implement later + else -- mob_def.type is specific node name or group name + local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), mob_def.type) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + spawning_position.y = spawning_position.y + 1 + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end end --local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"}) From d65a5e3be0a27f2c03ecc7a27e0032ec4e6e5fba Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Wed, 7 Apr 2021 23:07:04 -0400 Subject: [PATCH 12/51] Fix mobs colliding with objects --- mods/ENTITIES/mcl_mobs/api.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index bf4880231..8ab342ac5 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -866,10 +866,12 @@ local check_for_death = function(self, cause, cmi_cause) remove_texture_mod(self, "^[colorize:#FF000040") remove_texture_mod(self, "^[brighten") self.passive = true + self.object:set_properties({ pointable = false, collide_with_objects = false, }) + set_velocity(self, 0) local acc = self.object:get_acceleration() acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0 @@ -3418,7 +3420,6 @@ local mob_activate = function(self, staticdata, def, dtime) self.timer = 0 self.blinktimer = 0 self.blinkstatus = false - self.collide_with_objects = false -- check existing nametag if not self.nametag then @@ -3907,6 +3908,12 @@ minetest.register_entity(name, { on_detach_child = mob_detach_child, on_activate = function(self, staticdata, dtime) + --this is a temporary hack so mobs stop + --glitching and acting really weird with the + --default built in engine collision detection + self.object:set_properties({ + collide_with_objects = false, + }) return mob_activate(self, staticdata, def, dtime) end, @@ -4348,11 +4355,11 @@ end --todo mob limiting --MAIN LOOP -local timer = 0 +local timer = 15 --0 minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 0 + timer = 15--0 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(5) do local player_pos = player:get_pos() @@ -4361,6 +4368,7 @@ minetest.register_globalstep(function(dtime) local goal_pos = position_calculation(player_pos) + print(dump(minetest.get_biome_data(goal_pos))) local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] From 38dcbcb3d4d75bd4596d508e1a3b398bbb7ecf90 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Wed, 7 Apr 2021 23:16:03 -0400 Subject: [PATCH 13/51] Fix mobs colliding with other mobs/players --- mods/ENTITIES/mcl_mobs/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 8ab342ac5..7ec86a332 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -4359,7 +4359,7 @@ local timer = 15 --0 minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 15--0 + timer = 0--15--0 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(5) do local player_pos = player:get_pos() From abc68f4dc6a58b9c2e28d85771888fb955ed8c7e Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 02:07:15 -0400 Subject: [PATCH 14/51] Refactor spawning into it's own file --- mods/ENTITIES/mcl_mobs/api.lua | 554 ---------------------------- mods/ENTITIES/mcl_mobs/init.lua | 5 +- mods/ENTITIES/mcl_mobs/spawning.lua | 470 +++++++++++++++++++++++ mods/ENTITIES/mobs_mc/depends.txt | 1 + 4 files changed, 475 insertions(+), 555 deletions(-) create mode 100644 mods/ENTITIES/mcl_mobs/spawning.lua create mode 100644 mods/ENTITIES/mobs_mc/depends.txt diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 7ec86a332..daa209e9e 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -61,8 +61,6 @@ end -- Load settings local damage_enabled = minetest.settings:get_bool("enable_damage") -local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false - local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false @@ -3931,558 +3929,6 @@ end end -- END mobs:register_mob function - - - - - - - - - - - - ---BEGIN SPAWNING ALGORITHM - - - - - - - - - - - - - - - --- count how many mobs of one type are inside an area ---[[ -local count_mobs = function(pos, mobtype) - - local num = 0 - local objs = minetest.get_objects_inside_radius(pos, aoc_range) - - for n = 1, #objs do - - local obj = objs[n]:get_luaentity() - - if obj and obj.name and obj._cmi_is_mob then - - -- 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 -end -]]-- - --- global functions - -function mobs:spawn_abm_check(pos, node, name) - -- global function to add additional spawn checks - -- return true to stop spawning mob -end - - ---[[ - Custom elements changed: -name: -the mobs name - -dimension: -"overworld" -"nether" -"end" - -types of spawning: -"air" -"water" -"ground" -"lava" - -what is aoc??? - -WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua?? -]]-- - ---this is where all of the spawning information is kept -local spawn_dictionary = { - ["overworld"] = {}, - ["nether"] = {}, - ["end"] = {} -} - -function mobs:spawn_specific( - name, - dimension, - type_of_spawning, - min_light, - max_light, - interval, - chance, - aoc, - min_height, - max_height, - day_toggle, - on_spawn) - - - -- Do mobs spawn at all? - if not mobs_spawn then - return - end - - -- chance/spawn number override in minetest.conf for registered mob - local numbers = minetest.settings:get(name) - - if numbers then - numbers = numbers:split(",") - chance = tonumber(numbers[1]) or chance - aoc = tonumber(numbers[2]) or aoc - - if chance == 0 then - minetest.log("warning", string.format("[mobs] %s has spawning disabled", name)) - return - end - - minetest.log("action", - string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc)) - end - - local spawn_action - spawn_action = function(pos, node, active_object_count, active_object_count_wider, name) - - local orig_pos = table.copy(pos) - -- is mob actually registered? - if not mobs.spawning_mobs[name] - or not minetest.registered_entities[name] then - minetest.log("warning", "Mob spawn of "..name.." failed, unknown entity or mob is not registered for spawning!") - return - end - - -- additional custom checks for spawning mob - if mobs:spawn_abm_check(pos, node, name) == true then - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, ABM check rejected!") - 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 -- 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 - end - - -- if toggle set to nil then ignore day/night check - if day_toggle ~= nil then - - local tod = (minetest.get_timeofday() or 0) * 24000 - - if tod > 4500 and tod < 19500 then - -- daylight, but mob wants night - if day_toggle == false then - -- mob needs night - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs light!") - return - end - else - -- night time but mob wants day - if day_toggle == true then - -- mob needs day - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs daylight!") - return - end - end - end - - -- spawn above node - pos.y = pos.y + 1 - - -- only spawn away from player - local objs = minetest.get_objects_inside_radius(pos, 24) - - for n = 1, #objs do - - if objs[n]:is_player() then - -- player too close - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, player too close!") - return - end - end - - -- mobs cannot spawn in protected areas when enabled - if not spawn_protected - and minetest.is_protected(pos, "") then - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, position is protected!") - return - end - - -- are we spawning within height limits? - if pos.y > max_height - or pos.y < min_height then - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, out of height limit!") - return - end - - -- are light levels ok? - local light = minetest.get_node_light(pos) - if not light - or light > max_light - or light < min_light then - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, bad light!") - return - end - - -- do we have enough space to spawn mob? - local ent = minetest.registered_entities[name] - local width_x = max(1, math.ceil(ent.collisionbox[4] - ent.collisionbox[1])) - local min_x, max_x - if width_x % 2 == 0 then - max_x = math.floor(width_x/2) - min_x = -(max_x-1) - else - max_x = math.floor(width_x/2) - min_x = -max_x - end - - local width_z = max(1, math.ceil(ent.collisionbox[6] - ent.collisionbox[3])) - local min_z, max_z - if width_z % 2 == 0 then - max_z = math.floor(width_z/2) - min_z = -(max_z-1) - else - max_z = math.floor(width_z/2) - min_z = -max_z - end - - local max_y = max(0, math.ceil(ent.collisionbox[5] - ent.collisionbox[2]) - 1) - - for y = 0, max_y do - for x = min_x, max_x do - for z = min_z, max_z do - local pos2 = {x = pos.x+x, y = pos.y+y, z = pos.z+z} - if minetest.registered_nodes[node_ok(pos2).name].walkable == true then - -- inside block - minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too little space!") - if ent.spawn_small_alternative ~= nil and (not minetest.registered_nodes[node_ok(pos).name].walkable) then - minetest.log("info", "Trying to spawn smaller alternative mob: "..ent.spawn_small_alternative) - spawn_action(orig_pos, node, active_object_count, active_object_count_wider, ent.spawn_small_alternative) - end - return - end - end - end - end - - -- tweak X/Y/Z spawn pos - if width_x % 2 == 0 then - pos.x = pos.x + 0.5 - end - if width_z % 2 == 0 then - pos.z = pos.z + 0.5 - end - pos.y = pos.y - 0.5 - - local mob = minetest.add_entity(pos, name) - minetest.log("action", "Mob spawned: "..name.." at "..minetest.pos_to_string(pos)) - - if on_spawn then - - local ent = mob:get_luaentity() - - on_spawn(ent, pos) - end - end - - local function spawn_abm_action(pos, node, active_object_count, active_object_count_wider) - spawn_action(pos, node, active_object_count, active_object_count_wider, name) - end - - - --load information into the spawn dictionary - local key = #spawn_dictionary[dimension] + 1 - - spawn_dictionary[dimension][key] = {} - spawn_dictionary[dimension][key]["name"] = name - spawn_dictionary[dimension][key]["type"] = type_of_spawning - spawn_dictionary[dimension][key]["min_light"] = min_light - spawn_dictionary[dimension][key]["max_light"] = max_light - spawn_dictionary[dimension][key]["interval"] = interval - spawn_dictionary[dimension][key]["chance"] = chance - spawn_dictionary[dimension][key]["aoc"] = aoc - spawn_dictionary[dimension][key]["min_height"] = min_height - spawn_dictionary[dimension][key]["max_height"] = max_height - spawn_dictionary[dimension][key]["day_toggle"] = day_toggle - spawn_dictionary[dimension][key]["on_spawn"] = spawn_abm_action - - --[[ - minetest.register_abm({ - label = name .. " spawning", - nodenames = nodes, - neighbors = neighbors, - interval = interval, - chance = floor(max(1, chance * mobs_spawn_chance)), - catch_up = false, - action = spawn_abm_action, - }) - ]]-- -end - - --- compatibility with older mob registration --- we're going to forget about this for now -j4i ---[[ -function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) - - mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, - chance, active_object_count, -31000, max_height, day_toggle) -end -]]-- - - ---I'm not sure what this does but disabling it doesn't cause a crash -j4i --- Just compatibility problem with outer mob mods currently, so adding a warning and temporarily enabling back -kay27 2021-04-08 --- MarkBu's spawn function - -function mobs:spawn(def) - minetest.log("warning", "[mcl_mobs] Deprecated function call: `mobs:spawn()`. Please use mobs:spawn_specific() instead!") - 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 - local on_spawn = def.on_spawn - - --mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, - -- chance, active_object_count, min_height, max_height, day_toggle, on_spawn) - mobs:spawn_specific(name, "overworld", nodes, min_light, max_light, interval, - chance, active_object_count, min_height, max_height, day_toggle, on_spawn) - mobs:spawn_specific(name, "end", nodes, min_light, max_light, interval, - chance, active_object_count, min_height, max_height, day_toggle, on_spawn) - mobs:spawn_specific(name, "nether", nodes, min_light, max_light, interval, - chance, active_object_count, min_height, max_height, day_toggle, on_spawn) -end - - - -local axis ---inner and outer part of square donut radius -local inner = 1 -local outer = 70 -local int = {-1,1} -local position_calculation = function(pos) - - pos = vector.floor(pos) - - --this is used to determine the axis buffer from the player - axis = math.random(0,1) - - --cast towards the direction - if axis == 0 then --x - pos.x = pos.x + math.random(inner,outer)*int[math.random(1,2)] - pos.z = pos.z + math.random(-outer,outer) - else --z - pos.z = pos.z + math.random(inner,outer)*int[math.random(1,2)] - pos.x = pos.x + math.random(-outer,outer) - end - return(pos) -end - ---[[ -local decypher_limits_dictionary = { - ["overworld"] = {mcl_vars.mg_overworld_min,mcl_vars.mg_overworld_max}, - ["nether"] = {mcl_vars.mg_nether_min, mcl_vars.mg_nether_max}, - ["end"] = {mcl_vars.mg_end_min, mcl_vars.mg_end_max} -} -]]-- - -local function decypher_limits(posy) - --local min_max_table = decypher_limits_dictionary[dimension] - --return min_max_table[1],min_max_table[2] - posy = math.floor(posy) - return posy - 32, posy + 32 -end - - ---todo mob limiting ---MAIN LOOP -local timer = 15 --0 -minetest.register_globalstep(function(dtime) - timer = timer + dtime - if timer >= 15 then - timer = 0--15--0 - for _,player in ipairs(minetest.get_connected_players()) do - for i = 1,math.random(5) do - local player_pos = player:get_pos() - local _,dimension = mcl_worlds.y_to_layer(player_pos.y) - local min,max = decypher_limits(player_pos.y) - - local goal_pos = position_calculation(player_pos) - - print(dump(minetest.get_biome_data(goal_pos))) - - local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] - - if not mob_def then --to catch a crazy error if it ever happens - minetest.log("error", "WARNING!! mob spawning attempted to index a NIL mob!") - goto continue - end - - if mob_def.type == "ground" then - - local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:solid"}) - - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] - - spawning_position.y = spawning_position.y + 1 - - local gotten_light = minetest.get_node_light(spawning_position) - - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - elseif mob_def.type == "air" then - local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"air"}) - - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] - - local gotten_light = minetest.get_node_light(spawning_position) - - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - elseif mob_def.type == "water" then - local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:water"}) - - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] - - local gotten_light = minetest.get_node_light(spawning_position) - - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - --elseif mob_def.type == "lava" then - --implement later - else -- mob_def.type is specific node name or group name - local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), mob_def.type) - - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] - - spawning_position.y = spawning_position.y + 1 - - local gotten_light = minetest.get_node_light(spawning_position) - - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - end - --local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"}) - - - ::continue:: --this is a safety catch - end - end - end -end) - - - - - - - - - - - - - ---END SPAWNING ALGORITHM - - - - - - - - - - - - - - - - - - - - -- register arrow for shoot attack function mobs:register_arrow(name, def) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index c2d6cb21b..69246b470 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -4,8 +4,11 @@ local path = minetest.get_modpath(minetest.get_current_modname()) -- Mob API dofile(path .. "/api.lua") +-- Spawning Algorithm +dofile(path .. "/spawning.lua") + -- Rideable Mobs dofile(path .. "/mount.lua") -- Mob Items -dofile(path .. "/crafts.lua") +dofile(path .. "/crafts.lua") \ No newline at end of file diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua new file mode 100644 index 000000000..b56fe1cee --- /dev/null +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -0,0 +1,470 @@ +local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false +-- count how many mobs of one type are inside an area +--[[ +local count_mobs = function(pos, mobtype) + + local num = 0 + local objs = minetest.get_objects_inside_radius(pos, aoc_range) + + for n = 1, #objs do + + local obj = objs[n]:get_luaentity() + + if obj and obj.name and obj._cmi_is_mob then + + -- 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 +end +]]-- + +-- global functions + +function mobs:spawn_abm_check(pos, node, name) + -- global function to add additional spawn checks + -- return true to stop spawning mob +end + + +--[[ + Custom elements changed: +name: +the mobs name + +dimension: +"overworld" +"nether" +"end" + +types of spawning: +"air" +"water" +"ground" +"lava" + +what is aoc??? + +WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua?? +]]-- + +--this is where all of the spawning information is kept +local spawn_dictionary = { + ["overworld"] = {}, + ["nether"] = {}, + ["end"] = {} +} + +function mobs:spawn_specific(name, dimension, type_of_spawning, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) + -- Do mobs spawn at all? + if not mobs_spawn then + return + end + + -- chance/spawn number override in minetest.conf for registered mob + local numbers = minetest.settings:get(name) + + if numbers then + numbers = numbers:split(",") + chance = tonumber(numbers[1]) or chance + aoc = tonumber(numbers[2]) or aoc + + if chance == 0 then + minetest.log("warning", string.format("[mobs] %s has spawning disabled", name)) + return + end + + minetest.log("action", + string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc)) + end + + local spawn_action + spawn_action = function(pos, node, active_object_count, active_object_count_wider, name) + + local orig_pos = table.copy(pos) + -- is mob actually registered? + if not mobs.spawning_mobs[name] + or not minetest.registered_entities[name] then + minetest.log("warning", "Mob spawn of "..name.." failed, unknown entity or mob is not registered for spawning!") + return + end + + -- additional custom checks for spawning mob + if mobs:spawn_abm_check(pos, node, name) == true then + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, ABM check rejected!") + 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 -- 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 + end + + -- if toggle set to nil then ignore day/night check + if day_toggle ~= nil then + + local tod = (minetest.get_timeofday() or 0) * 24000 + + if tod > 4500 and tod < 19500 then + -- daylight, but mob wants night + if day_toggle == false then + -- mob needs night + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs light!") + return + end + else + -- night time but mob wants day + if day_toggle == true then + -- mob needs day + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs daylight!") + return + end + end + end + + -- spawn above node + pos.y = pos.y + 1 + + -- only spawn away from player + local objs = minetest.get_objects_inside_radius(pos, 24) + + for n = 1, #objs do + + if objs[n]:is_player() then + -- player too close + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, player too close!") + return + end + end + + -- mobs cannot spawn in protected areas when enabled + if not spawn_protected + and minetest.is_protected(pos, "") then + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, position is protected!") + return + end + + -- are we spawning within height limits? + if pos.y > max_height + or pos.y < min_height then + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, out of height limit!") + return + end + + -- are light levels ok? + local light = minetest.get_node_light(pos) + if not light + or light > max_light + or light < min_light then + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, bad light!") + return + end + + -- do we have enough space to spawn mob? + local ent = minetest.registered_entities[name] + local width_x = max(1, math.ceil(ent.collisionbox[4] - ent.collisionbox[1])) + local min_x, max_x + if width_x % 2 == 0 then + max_x = math.floor(width_x/2) + min_x = -(max_x-1) + else + max_x = math.floor(width_x/2) + min_x = -max_x + end + + local width_z = max(1, math.ceil(ent.collisionbox[6] - ent.collisionbox[3])) + local min_z, max_z + if width_z % 2 == 0 then + max_z = math.floor(width_z/2) + min_z = -(max_z-1) + else + max_z = math.floor(width_z/2) + min_z = -max_z + end + + local max_y = max(0, math.ceil(ent.collisionbox[5] - ent.collisionbox[2]) - 1) + + for y = 0, max_y do + for x = min_x, max_x do + for z = min_z, max_z do + local pos2 = {x = pos.x+x, y = pos.y+y, z = pos.z+z} + if minetest.registered_nodes[node_ok(pos2).name].walkable == true then + -- inside block + minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too little space!") + if ent.spawn_small_alternative ~= nil and (not minetest.registered_nodes[node_ok(pos).name].walkable) then + minetest.log("info", "Trying to spawn smaller alternative mob: "..ent.spawn_small_alternative) + spawn_action(orig_pos, node, active_object_count, active_object_count_wider, ent.spawn_small_alternative) + end + return + end + end + end + end + + -- tweak X/Y/Z spawn pos + if width_x % 2 == 0 then + pos.x = pos.x + 0.5 + end + if width_z % 2 == 0 then + pos.z = pos.z + 0.5 + end + pos.y = pos.y - 0.5 + + local mob = minetest.add_entity(pos, name) + minetest.log("action", "Mob spawned: "..name.." at "..minetest.pos_to_string(pos)) + + if on_spawn then + + local ent = mob:get_luaentity() + + on_spawn(ent, pos) + end + end + + local function spawn_abm_action(pos, node, active_object_count, active_object_count_wider) + spawn_action(pos, node, active_object_count, active_object_count_wider, name) + end + + + --load information into the spawn dictionary + local key = #spawn_dictionary[dimension] + 1 + + spawn_dictionary[dimension][key] = {} + spawn_dictionary[dimension][key]["name"] = name + spawn_dictionary[dimension][key]["type"] = type_of_spawning + spawn_dictionary[dimension][key]["min_light"] = min_light + spawn_dictionary[dimension][key]["max_light"] = max_light + spawn_dictionary[dimension][key]["interval"] = interval + spawn_dictionary[dimension][key]["chance"] = chance + spawn_dictionary[dimension][key]["aoc"] = aoc + spawn_dictionary[dimension][key]["min_height"] = min_height + spawn_dictionary[dimension][key]["max_height"] = max_height + spawn_dictionary[dimension][key]["day_toggle"] = day_toggle + spawn_dictionary[dimension][key]["on_spawn"] = spawn_abm_action + + --[[ + minetest.register_abm({ + label = name .. " spawning", + nodenames = nodes, + neighbors = neighbors, + interval = interval, + chance = floor(max(1, chance * mobs_spawn_chance)), + catch_up = false, + action = spawn_abm_action, + }) + ]]-- +end + + +-- compatibility with older mob registration +-- we're going to forget about this for now -j4i +--[[ +function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) + + mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, + chance, active_object_count, -31000, max_height, day_toggle) +end +]]-- + + +--I'm not sure what this does but disabling it doesn't cause a crash -j4i +-- MarkBu's spawn function + +function mobs:spawn(def) + --does nothing for now + --[[ + 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 + local on_spawn = def.on_spawn + + mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, + chance, active_object_count, min_height, max_height, day_toggle, on_spawn) + ]]-- +end + + + +local axis +--inner and outer part of square donut radius +local inner = 1 +local outer = 70 +local int = {-1,1} +local position_calculation = function(pos) + + pos = vector.floor(pos) + + --this is used to determine the axis buffer from the player + axis = math.random(0,1) + + --cast towards the direction + if axis == 0 then --x + pos.x = pos.x + math.random(inner,outer)*int[math.random(1,2)] + pos.z = pos.z + math.random(-outer,outer) + else --z + pos.z = pos.z + math.random(inner,outer)*int[math.random(1,2)] + pos.x = pos.x + math.random(-outer,outer) + end + return(pos) +end + +--[[ +local decypher_limits_dictionary = { + ["overworld"] = {mcl_vars.mg_overworld_min,mcl_vars.mg_overworld_max}, + ["nether"] = {mcl_vars.mg_nether_min, mcl_vars.mg_nether_max}, + ["end"] = {mcl_vars.mg_end_min, mcl_vars.mg_end_max} +} +]]-- + +local function decypher_limits(posy) + --local min_max_table = decypher_limits_dictionary[dimension] + --return min_max_table[1],min_max_table[2] + posy = math.floor(posy) + return posy - 32, posy + 32 +end + +minetest.register_on_mods_loaded(function() + for _,data in pairs(minetest.registered_biomes) do + print(data.name) + end + + print(dump(spawn_dictionary)) +end) + +--todo mob limiting +--MAIN LOOP +if mobs_spawn then + local timer = 15 --0 + minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer >= 15 then + timer = 0--15--0 + for _,player in ipairs(minetest.get_connected_players()) do + for i = 1,math.random(5) do + local player_pos = player:get_pos() + local _,dimension = mcl_worlds.y_to_layer(player_pos.y) + local min,max = decypher_limits(player_pos.y) + + local goal_pos = position_calculation(player_pos) + + local gotten_biome = minetest.get_biome_data(goal_pos) + + if not gotten_biome then + goto continue --skip if in unloaded area + end + + --print(minetest.get_biome_name(gotten_biome.biome)) + + local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] + + if not mob_def then --to catch a crazy error if it ever happens + minetest.log("error", "WARNING!! Attempted to spawn a mob that doesn't exist! Please notify developers!\nThe game will continue to run though.") + goto continue + end + + if mob_def.type == "ground" then + + local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:solid"}) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + spawning_position.y = spawning_position.y + 1 + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end + elseif mob_def.type == "air" then + local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"air"}) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end + elseif mob_def.type == "water" then + local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:water"}) + + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + + local gotten_light = minetest.get_node_light(spawning_position) + + if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then + minetest.add_entity(spawning_position, mob_def.name) + end + --elseif mob_def.type == "lava" then + --implement later + end + --local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"}) + + ::continue:: --this is a safety catch + end + end + end + end) +end \ No newline at end of file diff --git a/mods/ENTITIES/mobs_mc/depends.txt b/mods/ENTITIES/mobs_mc/depends.txt new file mode 100644 index 000000000..674eb8094 --- /dev/null +++ b/mods/ENTITIES/mobs_mc/depends.txt @@ -0,0 +1 @@ +mcl_mobs \ No newline at end of file From cb093b774ca946863e2ee09d49aec6d3d36300ac Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 06:04:36 -0400 Subject: [PATCH 15/51] Add biome list --- mods/ENTITIES/mcl_mobs/spawning.lua | 163 ++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index b56fe1cee..9ea774ba9 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -1,3 +1,166 @@ +--[[ + +THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs + +underground: +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 + +ocean: +RoofedForest_ocean +JungleEdgeM_ocean +BirchForestM_ocean +BirchForest_ocean +IcePlains_deep_ocean +Jungle_deep_ocean +Savanna_ocean +MesaPlateauF_ocean +ExtremeHillsM_deep_ocean +Savanna_deep_ocean +SunflowerPlains_ocean +Swampland_deep_ocean +Swampland_ocean +MegaSpruceTaiga_deep_ocean +ExtremeHillsM_ocean +JungleEdgeM_deep_ocean +SunflowerPlains_deep_ocean +BirchForest_deep_ocean +IcePlainsSpikes_ocean +Mesa_ocean +StoneBeach_ocean +Plains_deep_ocean +JungleEdge_deep_ocean +SavannaM_deep_ocean +Desert_deep_ocean +Mesa_deep_ocean +ColdTaiga_deep_ocean +Plains_ocean +MesaPlateauFM_ocean +Forest_deep_ocean +JungleM_deep_ocean +FlowerForest_deep_ocean +MushroomIsland_ocean +MegaTaiga_ocean +StoneBeach_deep_ocean +IcePlainsSpikes_deep_ocean +ColdTaiga_ocean +SavannaM_ocean +MesaPlateauF_deep_ocean +MesaBryce_deep_ocean +ExtremeHills+_deep_ocean +ExtremeHills_ocean +MushroomIsland_deep_ocean +Forest_ocean +MegaTaiga_deep_ocean +JungleEdge_ocean +MesaBryce_ocean +MegaSpruceTaiga_ocean +ExtremeHills+_ocean +Jungle_ocean +RoofedForest_deep_ocean +IcePlains_ocean +FlowerForest_ocean +ExtremeHills_deep_ocean +MesaPlateauFM_deep_ocean +Desert_ocean +Taiga_ocean +BirchForestM_deep_ocean +Taiga_deep_ocean +JungleM_ocean + +water or beach? +MesaPlateauFM_sandlevel +MesaPlateauF_sandlevel +MesaBryce_sandlevel +Mesa_sandlevel + +beach: +FlowerForest_beach +Forest_beach +StoneBeach +ColdTaiga_beach_water +Taiga_beach +Savanna_beach +Plains_beach +ExtremeHills_beach +ColdTaiga_beach +Swampland_shore +MushroomIslandShore +JungleM_shore +Jungle_shore + +dimension biome: +Nether +End + +Overworld regular: +Mesa +FlowerForest +Swampland +Taiga +ExtremeHills +Jungle +Savanna +BirchForest +MegaSpruceTaiga +MegaTaiga +ExtremeHills+ +Forest +Plains +Desert +ColdTaiga +MushroomIsland +IcePlainsSpikes +SunflowerPlains +IcePlains +RoofedForest + +I have no idea: +ExtremeHills+_snowtop +MesaPlateauFM_grasstop +JungleEdgeM +ExtremeHillsM +JungleM +BirchForestM +MesaPlateauF +MesaPlateauFM +MesaPlateauF_grasstop +MesaBryce +JungleEdge +SavannaM +]]-- + + + + local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false -- count how many mobs of one type are inside an area --[[ From 89f35c06af2e00150e90cfd8cb26552f99c9903e Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 06:10:07 -0400 Subject: [PATCH 16/51] Ignore default or void dimensions --- mods/ENTITIES/mcl_mobs/spawning.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 9ea774ba9..765c78ba0 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -551,11 +551,16 @@ if mobs_spawn then minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 0--15--0 + timer = 15--0 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(5) do local player_pos = player:get_pos() local _,dimension = mcl_worlds.y_to_layer(player_pos.y) + + if dimension == "void" or dimension == "default" then + goto continue -- ignore void and unloaded area + end + local min,max = decypher_limits(player_pos.y) local goal_pos = position_calculation(player_pos) @@ -566,7 +571,7 @@ if mobs_spawn then goto continue --skip if in unloaded area end - --print(minetest.get_biome_name(gotten_biome.biome)) + print(minetest.get_biome_name(gotten_biome.biome)) local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] From 34b66acc9d2b9fcc54712d2cc603d52e3042ca69 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 06:48:25 -0400 Subject: [PATCH 17/51] Make reference list copy-pastable --- mods/ENTITIES/mcl_mobs/spawning.lua | 307 ++++++++++++++-------------- 1 file changed, 159 insertions(+), 148 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 765c78ba0..40c9ee7a9 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -3,159 +3,159 @@ THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs underground: -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 +"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", ocean: -RoofedForest_ocean -JungleEdgeM_ocean -BirchForestM_ocean -BirchForest_ocean -IcePlains_deep_ocean -Jungle_deep_ocean -Savanna_ocean -MesaPlateauF_ocean -ExtremeHillsM_deep_ocean -Savanna_deep_ocean -SunflowerPlains_ocean -Swampland_deep_ocean -Swampland_ocean -MegaSpruceTaiga_deep_ocean -ExtremeHillsM_ocean -JungleEdgeM_deep_ocean -SunflowerPlains_deep_ocean -BirchForest_deep_ocean -IcePlainsSpikes_ocean -Mesa_ocean -StoneBeach_ocean -Plains_deep_ocean -JungleEdge_deep_ocean -SavannaM_deep_ocean -Desert_deep_ocean -Mesa_deep_ocean -ColdTaiga_deep_ocean -Plains_ocean -MesaPlateauFM_ocean -Forest_deep_ocean -JungleM_deep_ocean -FlowerForest_deep_ocean -MushroomIsland_ocean -MegaTaiga_ocean -StoneBeach_deep_ocean -IcePlainsSpikes_deep_ocean -ColdTaiga_ocean -SavannaM_ocean -MesaPlateauF_deep_ocean -MesaBryce_deep_ocean -ExtremeHills+_deep_ocean -ExtremeHills_ocean -MushroomIsland_deep_ocean -Forest_ocean -MegaTaiga_deep_ocean -JungleEdge_ocean -MesaBryce_ocean -MegaSpruceTaiga_ocean -ExtremeHills+_ocean -Jungle_ocean -RoofedForest_deep_ocean -IcePlains_ocean -FlowerForest_ocean -ExtremeHills_deep_ocean -MesaPlateauFM_deep_ocean -Desert_ocean -Taiga_ocean -BirchForestM_deep_ocean -Taiga_deep_ocean -JungleM_ocean +"RoofedForest_ocean", +"JungleEdgeM_ocean", +"BirchForestM_ocean", +"BirchForest_ocean", +"IcePlains_deep_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"ExtremeHillsM_deep_ocean", +"Savanna_deep_ocean", +"SunflowerPlains_ocean", +"Swampland_deep_ocean", +"Swampland_ocean", +"MegaSpruceTaiga_deep_ocean", +"ExtremeHillsM_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"BirchForest_deep_ocean", +"IcePlainsSpikes_ocean", +"Mesa_ocean", +"StoneBeach_ocean", +"Plains_deep_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"ColdTaiga_deep_ocean", +"Plains_ocean", +"MesaPlateauFM_ocean", +"Forest_deep_ocean", +"JungleM_deep_ocean", +"FlowerForest_deep_ocean", +"MushroomIsland_ocean", +"MegaTaiga_ocean", +"StoneBeach_deep_ocean", +"IcePlainsSpikes_deep_ocean", +"ColdTaiga_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"ExtremeHills+_deep_ocean", +"ExtremeHills_ocean", +"MushroomIsland_deep_ocean", +"Forest_ocean", +"MegaTaiga_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"MegaSpruceTaiga_ocean", +"ExtremeHills+_ocean", +"Jungle_ocean", +"RoofedForest_deep_ocean", +"IcePlains_ocean", +"FlowerForest_ocean", +"ExtremeHills_deep_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"Taiga_ocean", +"BirchForestM_deep_ocean", +"Taiga_deep_ocean", +"JungleM_ocean", water or beach? -MesaPlateauFM_sandlevel -MesaPlateauF_sandlevel -MesaBryce_sandlevel -Mesa_sandlevel +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", beach: -FlowerForest_beach -Forest_beach -StoneBeach -ColdTaiga_beach_water -Taiga_beach -Savanna_beach -Plains_beach -ExtremeHills_beach -ColdTaiga_beach -Swampland_shore -MushroomIslandShore -JungleM_shore -Jungle_shore +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", dimension biome: -Nether -End +"Nether", +"End", Overworld regular: -Mesa -FlowerForest -Swampland -Taiga -ExtremeHills -Jungle -Savanna -BirchForest -MegaSpruceTaiga -MegaTaiga -ExtremeHills+ -Forest -Plains -Desert -ColdTaiga -MushroomIsland -IcePlainsSpikes -SunflowerPlains -IcePlains -RoofedForest +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", I have no idea: -ExtremeHills+_snowtop -MesaPlateauFM_grasstop -JungleEdgeM -ExtremeHillsM -JungleM -BirchForestM -MesaPlateauF -MesaPlateauFM -MesaPlateauF_grasstop -MesaBryce -JungleEdge -SavannaM +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", ]]-- @@ -219,6 +219,7 @@ end --[[ Custom elements changed: + name: the mobs name @@ -233,7 +234,11 @@ types of spawning: "ground" "lava" -what is aoc??? +biomes: tells the spawner to allow certain mobs to spawn in certain biomes +{"this", "that", "grasslands", "whatever"} + + +what is aoc??? objects in area WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua?? ]]-- @@ -245,7 +250,10 @@ local spawn_dictionary = { ["end"] = {} } -function mobs:spawn_specific(name, dimension, type_of_spawning, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) +function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) + + print(dump(bimoes)) + -- Do mobs spawn at all? if not mobs_spawn then return @@ -472,7 +480,7 @@ end ]]-- ---I'm not sure what this does but disabling it doesn't cause a crash -j4i +--Don't disable this yet-j4i -- MarkBu's spawn function function mobs:spawn(def) @@ -546,6 +554,7 @@ end) --todo mob limiting --MAIN LOOP +--[[ if mobs_spawn then local timer = 15 --0 minetest.register_globalstep(function(dtime) @@ -557,9 +566,10 @@ if mobs_spawn then local player_pos = player:get_pos() local _,dimension = mcl_worlds.y_to_layer(player_pos.y) - if dimension == "void" or dimension == "default" then - goto continue -- ignore void and unloaded area - end + if dimension == "void" or dimension == "default" then + goto continue -- ignore void and unloaded area + end + local min,max = decypher_limits(player_pos.y) @@ -635,4 +645,5 @@ if mobs_spawn then end end end) -end \ No newline at end of file +end +]]-- \ No newline at end of file From 249a3c8891ed049f672bac6956c224a7488b4cf5 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 06:57:24 -0400 Subject: [PATCH 18/51] Add bats, chicken, and blaze spawn info --- mods/ENTITIES/mcl_mobs/spawning.lua | 7 ++- mods/ENTITIES/mobs_mc/bat.lua | 76 ++++++++++++++++++++++++++++- mods/ENTITIES/mobs_mc/blaze.lua | 13 ++++- mods/ENTITIES/mobs_mc/chicken.lua | 29 ++++++++++- 4 files changed, 118 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 40c9ee7a9..515dbaf3d 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -142,8 +142,6 @@ Overworld regular: "SunflowerPlains", "IcePlains", "RoofedForest", - -I have no idea: "ExtremeHills+_snowtop", "MesaPlateauFM_grasstop", "JungleEdgeM", @@ -252,7 +250,7 @@ local spawn_dictionary = { function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) - print(dump(bimoes)) + print(dump(biomes)) -- Do mobs spawn at all? if not mobs_spawn then @@ -543,7 +541,7 @@ local function decypher_limits(posy) posy = math.floor(posy) return posy - 32, posy + 32 end - +--[[ minetest.register_on_mods_loaded(function() for _,data in pairs(minetest.registered_biomes) do print(data.name) @@ -551,6 +549,7 @@ minetest.register_on_mods_loaded(function() print(dump(spawn_dictionary)) end) +]]-- --todo mob limiting --MAIN LOOP diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index b6825bbbf..a525f5583 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -64,7 +64,81 @@ else end -- Spawn on solid blocks at or below Sea level and the selected light level -mobs:spawn_specific("mobs_mc:bat", "overworld", "air", 0, maxlight, 20, 5000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-1) +mobs:spawn_specific( +"mobs_mc:bat", +"overworld", +"air", +{ +"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", +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +}, +0, +maxlight, +20, +5000, +2, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.water-1) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index d56acdf38..847e2f4a5 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -128,7 +128,18 @@ mobs:register_mob("mobs_mc:blaze", { end, }) -mobs:spawn_specific("mobs_mc:blaze", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 5000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:blaze", +"nether", +"ground", +{"Nether"}, +0, +minetest.LIGHT_MAX+1, +30, +5000, +3, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- Blaze fireball mobs:register_arrow("mobs_mc:blaze_fireball", { diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 397b6b8da..43044aae0 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -100,7 +100,34 @@ mobs:register_mob("mobs_mc:chicken", { }) --spawn -mobs:spawn_specific("mobs_mc:chicken", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 17000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:chicken", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +} +9, +minetest.LIGHT_MAX+1, +30, 17000, +3, +mobs_mc.spawn_height.spawn_height.water, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0) From c259fc2a28af4e5020d21989955a89cf9d7f6eaf Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 07:39:18 -0400 Subject: [PATCH 19/51] Add in all biome information to mobs --- mods/ENTITIES/mobs_mc/chicken.lua | 4 +- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 49 ++++- mods/ENTITIES/mobs_mc/creeper.lua | 153 +++++++++++++- mods/ENTITIES/mobs_mc/enderman.lua | 184 ++++++++++++++++- mods/ENTITIES/mobs_mc/ghast.lua | 15 +- mods/ENTITIES/mobs_mc/horse.lua | 52 ++++- mods/ENTITIES/mobs_mc/llama.lua | 20 +- mods/ENTITIES/mobs_mc/ocelot.lua | 18 +- mods/ENTITIES/mobs_mc/parrot.lua | 18 +- mods/ENTITIES/mobs_mc/pig.lua | 30 ++- mods/ENTITIES/mobs_mc/polar_bear.lua | 18 +- mods/ENTITIES/mobs_mc/sheep.lua | 30 ++- mods/ENTITIES/mobs_mc/shulker.lua | 15 +- mods/ENTITIES/mobs_mc/silverfish.lua | 22 +- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 188 ++++++++++++++++- mods/ENTITIES/mobs_mc/skeleton_wither.lua | 17 +- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 182 ++++++++++++++++- mods/ENTITIES/mobs_mc/spider.lua | 153 +++++++++++++- mods/ENTITIES/mobs_mc/squid.lua | 153 +++++++++++++- mods/ENTITIES/mobs_mc/villager.lua | 30 ++- mods/ENTITIES/mobs_mc/wolf.lua | 30 ++- mods/ENTITIES/mobs_mc/zombie.lua | 224 ++++++++++++++++++++- mods/ENTITIES/mobs_mc/zombiepig.lua | 30 ++- 23 files changed, 1589 insertions(+), 46 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 43044aae0..246bf216a 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -121,12 +121,12 @@ mobs:spawn_specific( "MesaPlateauFM_grasstop", "ExtremeHillsM", "BirchForestM", -} +}, 9, minetest.LIGHT_MAX+1, 30, 17000, 3, -mobs_mc.spawn_height.spawn_height.water, +mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index a094d6d35..656570a83 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -145,9 +145,52 @@ mobs:register_mob("mobs_mc:mooshroom", mooshroom_def) -- Spawning -mobs:spawn_specific("mobs_mc:cow", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 17000, 10, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) ---WARNING: THIS NEEDS A BIOME INTEGRATION -mobs:spawn_specific("mobs_mc:mooshroom", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 17000, 5, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:cow", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +9, +minetest.LIGHT_MAX+1, +30, +17000, +10, +mobs_mc.spawn_height.water, +mobs_mc.spawn_height.overworld_max) + + +mobs:spawn_specific( +"mobs_mc:mooshroom", +"overworld", +"ground", +{ +"MushroomIslandShore", +"MushroomIsland" +}, +9, +minetest.LIGHT_MAX+1, +30, +17000, +5, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- spawn egg mobs:register_egg("mobs_mc:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0) diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index f1f0a3ef6..0c884d569 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -253,7 +253,158 @@ mobs:register_mob("mobs_mc:creeper_charged", { glow = 3, }) -mobs:spawn_specific("mobs_mc:creeper", "overworld", "ground", 0, 7, 20, 16500, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:creeper", +"overworld", +"ground", +{ +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +"RoofedForest_ocean", +"JungleEdgeM_ocean", +"BirchForestM_ocean", +"BirchForest_ocean", +"IcePlains_deep_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"ExtremeHillsM_deep_ocean", +"Savanna_deep_ocean", +"SunflowerPlains_ocean", +"Swampland_deep_ocean", +"Swampland_ocean", +"MegaSpruceTaiga_deep_ocean", +"ExtremeHillsM_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"BirchForest_deep_ocean", +"IcePlainsSpikes_ocean", +"Mesa_ocean", +"StoneBeach_ocean", +"Plains_deep_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"ColdTaiga_deep_ocean", +"Plains_ocean", +"MesaPlateauFM_ocean", +"Forest_deep_ocean", +"JungleM_deep_ocean", +"FlowerForest_deep_ocean", +"MushroomIsland_ocean", +"MegaTaiga_ocean", +"StoneBeach_deep_ocean", +"IcePlainsSpikes_deep_ocean", +"ColdTaiga_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"ExtremeHills+_deep_ocean", +"ExtremeHills_ocean", +"MushroomIsland_deep_ocean", +"Forest_ocean", +"MegaTaiga_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"MegaSpruceTaiga_ocean", +"ExtremeHills+_ocean", +"Jungle_ocean", +"RoofedForest_deep_ocean", +"IcePlains_ocean", +"FlowerForest_ocean", +"ExtremeHills_deep_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"Taiga_ocean", +"BirchForestM_deep_ocean", +"Taiga_deep_ocean", +"JungleM_ocean", +"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", +}, +0, +7, +20, +16500, +2, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index ca3bc84ce..ba04f8b59 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -562,11 +562,189 @@ mobs:register_mob("mobs_mc:enderman", { -- End spawn -mobs:spawn_specific("mobs_mc:enderman", "end", "ground", 0, minetest.LIGHT_MAX+1, 30, 3000, 12, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) +mobs:spawn_specific( +"mobs_mc:enderman", +"end", +"ground", +{ +"End" +}, +0, +minetest.LIGHT_MAX+1, +30, +3000, +12, +mobs_mc.spawn_height.end_min, +mobs_mc.spawn_height.end_max) -- Overworld spawn -mobs:spawn_specific("mobs_mc:enderman", "overworld", "ground", 0, 7, 30, 19000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:enderman", +"overworld", +"ground", +{ +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +"RoofedForest_ocean", +"JungleEdgeM_ocean", +"BirchForestM_ocean", +"BirchForest_ocean", +"IcePlains_deep_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"ExtremeHillsM_deep_ocean", +"Savanna_deep_ocean", +"SunflowerPlains_ocean", +"Swampland_deep_ocean", +"Swampland_ocean", +"MegaSpruceTaiga_deep_ocean", +"ExtremeHillsM_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"BirchForest_deep_ocean", +"IcePlainsSpikes_ocean", +"Mesa_ocean", +"StoneBeach_ocean", +"Plains_deep_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"ColdTaiga_deep_ocean", +"Plains_ocean", +"MesaPlateauFM_ocean", +"Forest_deep_ocean", +"JungleM_deep_ocean", +"FlowerForest_deep_ocean", +"MushroomIsland_ocean", +"MegaTaiga_ocean", +"StoneBeach_deep_ocean", +"IcePlainsSpikes_deep_ocean", +"ColdTaiga_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"ExtremeHills+_deep_ocean", +"ExtremeHills_ocean", +"MushroomIsland_deep_ocean", +"Forest_ocean", +"MegaTaiga_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"MegaSpruceTaiga_ocean", +"ExtremeHills+_ocean", +"Jungle_ocean", +"RoofedForest_deep_ocean", +"IcePlains_ocean", +"FlowerForest_ocean", +"ExtremeHills_deep_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"Taiga_ocean", +"BirchForestM_deep_ocean", +"Taiga_deep_ocean", +"JungleM_ocean", +"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", +}, +0, +7, +30, +19000, +2, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) + -- Nether spawn (rare) -mobs:spawn_specific("mobs_mc:enderman", "nether", "ground", 0, 7, 30, 27500, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:enderman", +"nether", +"ground", +{ +"Nether" +}, +0, +7, +30, +27500, +4, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- spawn eggs mobs:register_egg("mobs_mc:enderman", S("Enderman"), "mobs_mc_spawn_icon_enderman.png", 0) diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index e2f6b1369..9c3e0cee1 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -75,7 +75,20 @@ mobs:register_mob("mobs_mc:ghast", { }) -mobs:spawn_specific("mobs_mc:ghast", "nether", "air", 0, minetest.LIGHT_MAX+1, 30, 18000, 2, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:ghast", +"nether", +"air", +{ +"Nether" +}, +0, +minetest.LIGHT_MAX+1, +30, +18000, +2, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- fireball (projectile) mobs:register_arrow("mobs_mc:fireball", { diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 00c292c1d..938a6b6ac 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -510,8 +510,56 @@ mobs:register_mob("mobs_mc:mule", mule) --=========================== --Spawn Function -mobs:spawn_specific("mobs_mc:horse", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:donkey", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:horse", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +0, +minetest.LIGHT_MAX+1, +30, +15000, +4, +mobs_mc.spawn_height.water+3, +mobs_mc.spawn_height.overworld_max) + + +mobs:spawn_specific( +"mobs_mc:donkey", +"overworld", +"ground", +{ +"Mesa", +"MesaPlateauFM_grasstop", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +}, +0, +minetest.LIGHT_MAX+1, +30, +15000, +4, +mobs_mc.spawn_height.water+3, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:horse", S("Horse"), "mobs_mc_spawn_icon_horse.png", 0) diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 0efb8e0ab..8ff82b502 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -217,7 +217,25 @@ mobs:register_mob("mobs_mc:llama", { }) --spawn -mobs:spawn_specific("mobs_mc:llama", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 5, mobs_mc.spawn_height.water+15, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:llama", +"overworld", +"ground", +{ +"Mesa", +"MesaPlateauFM_grasstop", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +}, +0, +minetest.LIGHT_MAX+1, +30, +15000, +5, +mobs_mc.spawn_height.water+15, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:llama", S("Llama"), "mobs_mc_spawn_icon_llama.png", 0) diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index 3b5273185..f3c8c87ae 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -153,7 +153,23 @@ local base_spawn_chance = 5000 -- Spawn ocelot --they get the same as the llama because I'm trying to rework so much of this code right now -j4i -mobs:spawn_specific("mobs_mc:ocelot", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 5, mobs_mc.spawn_height.water+15, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:ocelot", +"overworld", +"ground", +{ +"Jungle", +"JungleEdgeM", +"JungleM", +"JungleEdge", +}, +0, +minetest.LIGHT_MAX+1, +30, +15000, +5, +mobs_mc.spawn_height.water+15, +mobs_mc.spawn_height.overworld_max) --[[ mobs:spawn({ name = "mobs_mc:ocelot", diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index c67263fb9..60329211e 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -91,7 +91,23 @@ mobs:register_mob("mobs_mc:parrot", { }) -- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i -mobs:spawn_specific("mobs_mc:parrot","overworld", "air", 0, minetest.LIGHT_MAX+1, 7, 30000, 1, mobs_mc.spawn_height.water+7, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:parrot", +"overworld", +"air", +{ +"Jungle", +"JungleEdgeM", +"JungleM", +"JungleEdge", +}, +0, +minetest.LIGHT_MAX+1, +7, +30000, +1, +mobs_mc.spawn_height.water+7, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0) diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index 143fcb495..b7cdf1afe 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -182,7 +182,35 @@ mobs:register_mob("mobs_mc:pig", { end, }) -mobs:spawn_specific("mobs_mc:pig", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 15000, 8, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:pig", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +9, +minetest.LIGHT_MAX+1, +30, +15000, +8, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:pig", S("Pig"), "mobs_mc_spawn_icon_pig.png", 0) diff --git a/mods/ENTITIES/mobs_mc/polar_bear.lua b/mods/ENTITIES/mobs_mc/polar_bear.lua index 745c13a26..5d2853f6d 100644 --- a/mods/ENTITIES/mobs_mc/polar_bear.lua +++ b/mods/ENTITIES/mobs_mc/polar_bear.lua @@ -67,7 +67,23 @@ mobs:register_mob("mobs_mc:polar_bear", { }) -mobs:spawn_specific("mobs_mc:polar_bear", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 7000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:polar_bear", +"overworld", +"ground", +{ +"ColdTaiga", +"IcePlainsSpikes", +"IcePlains", +"ExtremeHills+_snowtop", +}, +0, +minetest.LIGHT_MAX+1, +30, +7000, +3, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- spawn egg mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "mobs_mc_spawn_icon_polarbear.png", 0) diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index b3400ab5f..d82df8cf9 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -303,7 +303,35 @@ mobs:register_mob("mobs_mc:sheep", { end end, }) -mobs:spawn_specific("mobs_mc:sheep", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:sheep", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +0, +minetest.LIGHT_MAX+1, +30, +15000, +3, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 583c5eed1..8000d0937 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -81,4 +81,17 @@ mobs:register_arrow("mobs_mc:shulkerbullet", { mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0) -mobs:spawn_specific("mobs_mc:shulker", "end", "ground", 0, minetest.LIGHT_MAX+1, 30, 5000, 2, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) +mobs:spawn_specific( +"mobs_mc:shulker", +"end", +"ground", +{ +"End" +}, +0, +minetest.LIGHT_MAX+1, +30, +5000, +2, +mobs_mc.spawn_height.end_min, +mobs_mc.spawn_height.end_max) diff --git a/mods/ENTITIES/mobs_mc/silverfish.lua b/mods/ENTITIES/mobs_mc/silverfish.lua index 433211503..9a6f3fc98 100644 --- a/mods/ENTITIES/mobs_mc/silverfish.lua +++ b/mods/ENTITIES/mobs_mc/silverfish.lua @@ -23,13 +23,23 @@ mobs:register_mob("mobs_mc:silverfish", { }, pathfinding = 1, visual_size = {x=3, y=3}, - sounds = { - random = "mobs_mc_silverfish_idle", - death = "mobs_mc_silverfish_death", - damage = "mobs_mc_silverfish_hurt", - distance = 16, + sounds = {"FlowerForest", + "Swampland", + "Taiga", + "ExtremeHills", + "BirchForest", + "MegaSpruceTaiga", + "MegaTaiga", + "ExtremeHills+", + "Forest", + "Plains", + "ColdTaiga", + "SunflowerPlains", + "RoofedForest", + "MesaPlateauFM_grasstop", + "ExtremeHillsM", + "BirchForestM", }, - makes_footstep_sound = false, walk_velocity = 0.6, run_velocity = 2, jump = true, diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 84e51c517..b43873b2a 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -139,13 +139,195 @@ table.insert(stray.drops, { mobs:register_mob("mobs_mc:stray", stray) -- Overworld spawn -mobs:spawn_specific("mobs_mc:skeleton", "overworld", "ground", 0, 7, 20, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:skeleton", +"overworld", +"ground", +{ +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +"RoofedForest_ocean", +"JungleEdgeM_ocean", +"BirchForestM_ocean", +"BirchForest_ocean", +"IcePlains_deep_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"ExtremeHillsM_deep_ocean", +"Savanna_deep_ocean", +"SunflowerPlains_ocean", +"Swampland_deep_ocean", +"Swampland_ocean", +"MegaSpruceTaiga_deep_ocean", +"ExtremeHillsM_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"BirchForest_deep_ocean", +"IcePlainsSpikes_ocean", +"Mesa_ocean", +"StoneBeach_ocean", +"Plains_deep_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"ColdTaiga_deep_ocean", +"Plains_ocean", +"MesaPlateauFM_ocean", +"Forest_deep_ocean", +"JungleM_deep_ocean", +"FlowerForest_deep_ocean", +"MushroomIsland_ocean", +"MegaTaiga_ocean", +"StoneBeach_deep_ocean", +"IcePlainsSpikes_deep_ocean", +"ColdTaiga_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"ExtremeHills+_deep_ocean", +"ExtremeHills_ocean", +"MushroomIsland_deep_ocean", +"Forest_ocean", +"MegaTaiga_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"MegaSpruceTaiga_ocean", +"ExtremeHills+_ocean", +"Jungle_ocean", +"RoofedForest_deep_ocean", +"IcePlains_ocean", +"FlowerForest_ocean", +"ExtremeHills_deep_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"Taiga_ocean", +"BirchForestM_deep_ocean", +"Taiga_deep_ocean", +"JungleM_ocean", +"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", +}, +0, +7, +20, +17000, +2, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) + + -- Nether spawn -mobs:spawn_specific("mobs_mc:skeleton", "nether", "ground", 0, 7, 30, 10000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:skeleton", +"nether", +"ground", +{ +"Nether" +}, +0, +7, +30, +10000, +3, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- Stray spawn -- TODO: Spawn directly under the sky -mobs:spawn_specific("mobs_mc:stray", "overworld", "ground", 0, 7, 20, 19000, 2, mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:stray", +"overworld", +"ground", +{ +"ColdTaiga", +"IcePlainsSpikes", +"IcePlains", +"ExtremeHills+_snowtop", +}, +0, +7, +20, +19000, +2, +mobs_mc.spawn_height.water, +mobs_mc.spawn_height.overworld_max) -- spawn eggs diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index d9de90d84..da472d605 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -94,7 +94,20 @@ mobs:register_mob("mobs_mc:witherskeleton", { }) --spawn -mobs:spawn_specific("mobs_mc:witherskeleton", "nether", "ground", 0, 7, 30, 5000, 5, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:witherskeleton", +"nether", +"ground", +{ +"Nether" +}, +0, +7, +30, +5000, +5, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- spawn eggs -mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0) +mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0) \ No newline at end of file diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 2f9e8c8a9..6c8000a50 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -157,9 +157,137 @@ mobs:register_mob("mobs_mc:slime_tiny", slime_tiny) local smin = mobs_mc.spawn_height.overworld_min local smax = mobs_mc.spawn_height.water - 23 -mobs:spawn_specific("mobs_mc:slime_tiny", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 12000, 4, smin, smax) -mobs:spawn_specific("mobs_mc:slime_small", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 8500, 4, smin, smax) -mobs:spawn_specific("mobs_mc:slime_big", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 10000, 4, smin, smax) +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", +}, +0, +minetest.LIGHT_MAX+1, +30, +12000, +4, +smin, +smax) + +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", +}, +0, +minetest.LIGHT_MAX+1, +30, +8500, +4, +smin, +smax) + +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", +}, +0, +minetest.LIGHT_MAX+1, +30, +10000, +4, +smin, +smax) -- Magma cube local magma_cube_big = { @@ -272,9 +400,51 @@ mobs:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny) local mmin = mobs_mc.spawn_height.nether_min local mmax = mobs_mc.spawn_height.nether_max -mobs:spawn_specific("mobs_mc:magma_cube_tiny", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_small", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 15500, 4, mmin, mmax) -mobs:spawn_specific("mobs_mc:magma_cube_big", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 16000, 4, mmin, mmax) +mobs:spawn_specific( +"mobs_mc:magma_cube_tiny", +"nether", +"ground", +{ +"Nether" +}, +0, +minetest.LIGHT_MAX+1, +30, +15000, +4, +mmin, +mmax) + + +mobs:spawn_specific( +"mobs_mc:magma_cube_small", +"nether", +"ground", +{ +"Nether" +}, +0, +minetest.LIGHT_MAX+1, +30, +15500, +4, +mmin, +mmax) + +mobs:spawn_specific( +"mobs_mc:magma_cube_big", +"nether", +"ground", +{ +"Nether" +}, +0, +minetest.LIGHT_MAX+1, +30, +16000, +4, +mmin, +mmax) --mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax) --mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 1361e6a3a..bb5e29eb1 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -87,7 +87,158 @@ cave_spider.sounds.base_pitch = 1.25 mobs:register_mob("mobs_mc:cave_spider", cave_spider) -mobs:spawn_specific("mobs_mc:spider", "overworld", "ground", 0, 7, 30, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:spider", +"overworld", +"ground", +{ +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +"RoofedForest_ocean", +"JungleEdgeM_ocean", +"BirchForestM_ocean", +"BirchForest_ocean", +"IcePlains_deep_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"ExtremeHillsM_deep_ocean", +"Savanna_deep_ocean", +"SunflowerPlains_ocean", +"Swampland_deep_ocean", +"Swampland_ocean", +"MegaSpruceTaiga_deep_ocean", +"ExtremeHillsM_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"BirchForest_deep_ocean", +"IcePlainsSpikes_ocean", +"Mesa_ocean", +"StoneBeach_ocean", +"Plains_deep_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"ColdTaiga_deep_ocean", +"Plains_ocean", +"MesaPlateauFM_ocean", +"Forest_deep_ocean", +"JungleM_deep_ocean", +"FlowerForest_deep_ocean", +"MushroomIsland_ocean", +"MegaTaiga_ocean", +"StoneBeach_deep_ocean", +"IcePlainsSpikes_deep_ocean", +"ColdTaiga_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"ExtremeHills+_deep_ocean", +"ExtremeHills_ocean", +"MushroomIsland_deep_ocean", +"Forest_ocean", +"MegaTaiga_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"MegaSpruceTaiga_ocean", +"ExtremeHills+_ocean", +"Jungle_ocean", +"RoofedForest_deep_ocean", +"IcePlains_ocean", +"FlowerForest_ocean", +"ExtremeHills_deep_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"Taiga_ocean", +"BirchForestM_deep_ocean", +"Taiga_deep_ocean", +"JungleM_ocean", +"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", +}, +0, +7, +30, +17000, +2, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:spider", S("Spider"), "mobs_mc_spawn_icon_spider.png", 0) diff --git a/mods/ENTITIES/mobs_mc/squid.lua b/mods/ENTITIES/mobs_mc/squid.lua index 2dbb7c557..cf794ea5b 100644 --- a/mods/ENTITIES/mobs_mc/squid.lua +++ b/mods/ENTITIES/mobs_mc/squid.lua @@ -62,7 +62,158 @@ mobs:register_mob("mobs_mc:squid", { local water = mobs_mc.spawn_height.water --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height -mobs:spawn_specific("mobs_mc:squid", "overworld", "water", 0, minetest.LIGHT_MAX+1, 30, 5500, 3, water-16, water) +mobs:spawn_specific( +"mobs_mc:squid", +"overworld", +"water", +{ +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +"RoofedForest_ocean", +"JungleEdgeM_ocean", +"BirchForestM_ocean", +"BirchForest_ocean", +"IcePlains_deep_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"ExtremeHillsM_deep_ocean", +"Savanna_deep_ocean", +"SunflowerPlains_ocean", +"Swampland_deep_ocean", +"Swampland_ocean", +"MegaSpruceTaiga_deep_ocean", +"ExtremeHillsM_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"BirchForest_deep_ocean", +"IcePlainsSpikes_ocean", +"Mesa_ocean", +"StoneBeach_ocean", +"Plains_deep_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"ColdTaiga_deep_ocean", +"Plains_ocean", +"MesaPlateauFM_ocean", +"Forest_deep_ocean", +"JungleM_deep_ocean", +"FlowerForest_deep_ocean", +"MushroomIsland_ocean", +"MegaTaiga_ocean", +"StoneBeach_deep_ocean", +"IcePlainsSpikes_deep_ocean", +"ColdTaiga_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"ExtremeHills+_deep_ocean", +"ExtremeHills_ocean", +"MushroomIsland_deep_ocean", +"Forest_ocean", +"MegaTaiga_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"MegaSpruceTaiga_ocean", +"ExtremeHills+_ocean", +"Jungle_ocean", +"RoofedForest_deep_ocean", +"IcePlains_ocean", +"FlowerForest_ocean", +"ExtremeHills_deep_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"Taiga_ocean", +"BirchForestM_deep_ocean", +"Taiga_deep_ocean", +"JungleM_ocean", +"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", +}, +0, +minetest.LIGHT_MAX+1, +30, +5500, +3, +water-16, +water+1) -- spawn eggs mobs:register_egg("mobs_mc:squid", S("Squid"), "mobs_mc_spawn_icon_squid.png", 0) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 0b53d8015..d251ba823 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -1074,7 +1074,35 @@ mobs:register_mob("mobs_mc:villager", { -mobs:spawn_specific("mobs_mc:villager", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 20, 4, mobs_mc.spawn_height.water+1, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:villager", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +0, +minetest.LIGHT_MAX+1, +30, +20, +4, +mobs_mc.spawn_height.water+1, +mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:villager", S("Villager"), "mobs_mc_spawn_icon_villager.png", 0) diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index 953c2df72..b1c077d46 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -232,6 +232,34 @@ end mobs:register_mob("mobs_mc:dog", dog) -- Spawn -mobs:spawn_specific("mobs_mc:wolf", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 9000, 7, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:wolf", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +0, +minetest.LIGHT_MAX+1, +30, +9000, +7, +mobs_mc.spawn_height.water+3, +mobs_mc.spawn_height.overworld_max) mobs:register_egg("mobs_mc:wolf", S("Wolf"), "mobs_mc_spawn_icon_wolf.png", 0) diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index 64f99d34d..fed83f233 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -135,11 +135,227 @@ mobs:register_mob("mobs_mc:baby_husk", baby_husk) -- Spawning -mobs:spawn_specific("mobs_mc:zombie", "overworld", "ground", 0, 7, 30, 6000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:zombie", +"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", +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +}, +0, +7, +30, +6000, +4, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- Baby zombie is 20 times less likely than regular zombies -mobs:spawn_specific("mobs_mc:baby_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:husk", "overworld", "ground", 0, 7, 30, 6500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:baby_husk", "overworld", "ground", 0, 7, 30, 65000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:baby_zombie", +"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", +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +}, +0, +7, +30, +60000, +4, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) + + +mobs:spawn_specific( +"mobs_mc:husk", +"overworld", +"ground", +{ +"Desert", +"SavannaM", +"Savanna", +"Savanna_beach", +}, +0, +7, +30, +6500, +4, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:baby_husk", +"overworld", +"ground", +{ +"Desert", +"SavannaM", +"Savanna", +"Savanna_beach", +}, +0, +7, +30, +65000, +4, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) -- Spawn eggs mobs:register_egg("mobs_mc:husk", S("Husk"), "mobs_mc_spawn_icon_husk.png", 0) diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index e996425c8..ebd8ce485 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -111,9 +111,35 @@ baby_pigman.child = 1 mobs:register_mob("mobs_mc:baby_pigman", baby_pigman) -- Regular spawning in the Nether -mobs:spawn_specific("mobs_mc:pigman", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:pigman", +"nether", +"ground", +{ +"Nether" +}, +0, +minetest.LIGHT_MAX+1, +30, +6000, +3, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- Baby zombie is 20 times less likely than regular zombies -mobs:spawn_specific("mobs_mc:baby_pigman", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 100000, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) +mobs:spawn_specific( +"mobs_mc:baby_pigman", +"nether", +"ground", +{ +"Nether" +}, +0, +minetest.LIGHT_MAX+1, +30, +100000, +4, +mobs_mc.spawn_height.nether_min, +mobs_mc.spawn_height.nether_max) -- Spawning in Nether portals in the Overworld --mobs:spawn_specific("mobs_mc:pigman", mobs_mc.spawn.nether_portal, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) From 668b67158c3ddf778825d18e33c825481d4262df Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 08:09:43 -0400 Subject: [PATCH 20/51] merge --- mods/ENTITIES/mcl_mobs/spawning.lua | 24 ++++-- mods/ENTITIES/mobs_mc/rabbit.lua | 30 ++++++- mods/ENTITIES/mobs_mc/villager_zombie.lua | 95 ++++++++++++++++++++++- 3 files changed, 139 insertions(+), 10 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 515dbaf3d..f7220f1e0 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -242,15 +242,11 @@ WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua?? ]]-- --this is where all of the spawning information is kept -local spawn_dictionary = { - ["overworld"] = {}, - ["nether"] = {}, - ["end"] = {} -} +local spawn_dictionary = {} function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) - print(dump(biomes)) + --print(dump(biomes)) -- Do mobs spawn at all? if not mobs_spawn then @@ -438,6 +434,20 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh --load information into the spawn dictionary + + --allow for new dimensions to be auto added + --this will take extra time, a whole few nanoseconds + --but will allow modularity + if not spawn_dictionary[dimension] then + spawn_dictionary[dimension] = {} + end + + print("----") + print(name) + for _,added_biome in pairs(biomes) do + print(added_biome) + end + --[[ local key = #spawn_dictionary[dimension] + 1 spawn_dictionary[dimension][key] = {} @@ -452,7 +462,7 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh spawn_dictionary[dimension][key]["max_height"] = max_height spawn_dictionary[dimension][key]["day_toggle"] = day_toggle spawn_dictionary[dimension][key]["on_spawn"] = spawn_abm_action - + ]]-- --[[ minetest.register_abm({ label = name .. " spawning", diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index f09a70584..74bdffcd8 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -109,7 +109,35 @@ mobs:register_mob("mobs_mc:killer_bunny", killer_bunny) -- Mob spawning rules. -- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out -mobs:spawn_specific("mobs_mc:rabbit", "overworld", "ground", 9, minetest.LIGHT_MAX+1, 30, 15000, 8, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:rabbit", +"overworld", +"ground", +{ +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"ColdTaiga", +"SunflowerPlains", +"RoofedForest", +"MesaPlateauFM_grasstop", +"ExtremeHillsM", +"BirchForestM", +}, +9, +minetest.LIGHT_MAX+1, +30, +15000, +8, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) --[[ local spawn = { diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index bcede2183..325cf5955 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -146,8 +146,99 @@ mobs:register_mob("mobs_mc:villager_zombie", { harmed_by_heal = true, }) -mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 4090, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) +mobs:spawn_specific( +"mobs_mc:villager_zombie", +"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", +"Mesa", +"FlowerForest", +"Swampland", +"Taiga", +"ExtremeHills", +"Jungle", +"Savanna", +"BirchForest", +"MegaSpruceTaiga", +"MegaTaiga", +"ExtremeHills+", +"Forest", +"Plains", +"Desert", +"ColdTaiga", +"MushroomIsland", +"IcePlainsSpikes", +"SunflowerPlains", +"IcePlains", +"RoofedForest", +"ExtremeHills+_snowtop", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"ExtremeHillsM", +"JungleM", +"BirchForestM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"FlowerForest_beach", +"Forest_beach", +"StoneBeach", +"ColdTaiga_beach_water", +"Taiga_beach", +"Savanna_beach", +"Plains_beach", +"ExtremeHills_beach", +"ColdTaiga_beach", +"Swampland_shore", +"MushroomIslandShore", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +}, +0, +7, +30, +4090, +4, +mobs_mc.spawn_height.overworld_min, +mobs_mc.spawn_height.overworld_max) +--mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) -- spawn eggs mobs:register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "mobs_mc_spawn_icon_zombie_villager.png", 0) From ae0c235c1fd06acb7bd7296d137014c542128fc2 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 08:12:43 -0400 Subject: [PATCH 21/51] Combine air and ground type spawning into ground --- mods/ENTITIES/mcl_mobs/spawning.lua | 15 +++++++++++---- mods/ENTITIES/mobs_mc/bat.lua | 2 +- mods/ENTITIES/mobs_mc/ghast.lua | 2 +- mods/ENTITIES/mobs_mc/parrot.lua | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index f7220f1e0..829005a8c 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -227,7 +227,6 @@ dimension: "end" types of spawning: -"air" "water" "ground" "lava" @@ -438,15 +437,23 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh --allow for new dimensions to be auto added --this will take extra time, a whole few nanoseconds --but will allow modularity + + + if type_of_spawning == "air" then + print("---------------------------- HERE") + print(name) + print("---------------------------- sdfkhjsadfhjklsfsehjkfsdhjk") + end + if not spawn_dictionary[dimension] then spawn_dictionary[dimension] = {} end - print("----") - print(name) for _,added_biome in pairs(biomes) do - print(added_biome) + --print(added_biome) end + + --[[ local key = #spawn_dictionary[dimension] + 1 diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index a525f5583..a0aa8e4f5 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -66,7 +66,7 @@ end -- Spawn on solid blocks at or below Sea level and the selected light level mobs:spawn_specific( "mobs_mc:bat", -"overworld", +"ground", "air", { "FlowerForest_underground", diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 9c3e0cee1..83a10bfc4 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -78,7 +78,7 @@ mobs:register_mob("mobs_mc:ghast", { mobs:spawn_specific( "mobs_mc:ghast", "nether", -"air", +"ground", { "Nether" }, diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 60329211e..5efcb191b 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -94,7 +94,7 @@ mobs:register_mob("mobs_mc:parrot", { mobs:spawn_specific( "mobs_mc:parrot", "overworld", -"air", +"ground", { "Jungle", "JungleEdgeM", From 71c50042e67333fb0cbe7a66f101e5d167ee0b2e Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 08:13:46 -0400 Subject: [PATCH 22/51] Fix typo --- mods/ENTITIES/mobs_mc/bat.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index a0aa8e4f5..677b96aad 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -66,8 +66,8 @@ end -- Spawn on solid blocks at or below Sea level and the selected light level mobs:spawn_specific( "mobs_mc:bat", +"overworld", "ground", -"air", { "FlowerForest_underground", "JungleEdge_underground", From f5cc2bab099570507c25bb2b4bf89bfd7b7a8895 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 08:29:16 -0400 Subject: [PATCH 23/51] Readjust mobs internal settings to not cause insane memory usage --- mods/ENTITIES/mcl_mobs/spawning.lua | 30 +++++++++++++++++++------- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 10 ++++----- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 829005a8c..d4d688085 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -438,21 +438,35 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh --this will take extra time, a whole few nanoseconds --but will allow modularity - - if type_of_spawning == "air" then - print("---------------------------- HERE") - print(name) - print("---------------------------- sdfkhjsadfhjklsfsehjkfsdhjk") - end - + --build dimensions modularly if not spawn_dictionary[dimension] then spawn_dictionary[dimension] = {} end + --build biome list modularly for _,added_biome in pairs(biomes) do - --print(added_biome) + if not spawn_dictionary[dimension][added_biome] then + spawn_dictionary[dimension][added_biome] = {} + end + + --build type of spawning per biome modularly + if not spawn_dictionary[dimension][added_biome][type_of_spawning] then + spawn_dictionary[dimension][added_biome][type_of_spawning] = {} + end + + --build light levels to spawn mob + for i = min_light,max_light do + if not spawn_dictionary[dimension][added_biome][type_of_spawning][i] then + spawn_dictionary[dimension][added_biome][type_of_spawning][i] = {} + end + + for y = min_height, max_height do + --print(y) + end + end end + --[[ local key = #spawn_dictionary[dimension] + 1 diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index 74c92d415..b979c7353 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -290,13 +290,13 @@ mobs_mc.spawn = { mobs_mc.spawn_height = { water = tonumber(minetest.settings:get("water_level")) or 0, -- Water level in the Overworld - -- Overworld boundaries (inclusive) - overworld_min = -2999, - overworld_max = 31000, + -- Overworld boundaries (inclusive) --had to make this reasonable otherwise mob spawning would go nuts using data + overworld_min = -64,-- -2999, + overworld_max = 256,-- 31000, -- Nether boundaries (inclusive) - nether_min = -3369, - nether_max = -3000, + nether_min = -29067,-- -3369, + nether_max = -28939,-- -3000, -- End boundaries (inclusive) end_min = -6200, From 26ef8c26747ff78cc5e20f2e3546870b0af9e477 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 08:33:50 -0400 Subject: [PATCH 24/51] Fix silverfish typo --- mods/ENTITIES/mcl_mobs/spawning.lua | 2 +- mods/ENTITIES/mobs_mc/silverfish.lua | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index d4d688085..01e2eb9e5 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -461,7 +461,7 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh end for y = min_height, max_height do - --print(y) + print(y) end end end diff --git a/mods/ENTITIES/mobs_mc/silverfish.lua b/mods/ENTITIES/mobs_mc/silverfish.lua index 9a6f3fc98..9befe1905 100644 --- a/mods/ENTITIES/mobs_mc/silverfish.lua +++ b/mods/ENTITIES/mobs_mc/silverfish.lua @@ -24,22 +24,13 @@ mobs:register_mob("mobs_mc:silverfish", { pathfinding = 1, visual_size = {x=3, y=3}, sounds = {"FlowerForest", - "Swampland", - "Taiga", - "ExtremeHills", - "BirchForest", - "MegaSpruceTaiga", - "MegaTaiga", - "ExtremeHills+", - "Forest", - "Plains", - "ColdTaiga", - "SunflowerPlains", - "RoofedForest", - "MesaPlateauFM_grasstop", - "ExtremeHillsM", - "BirchForestM", + sounds = { + random = "mobs_mc_silverfish_idle", + death = "mobs_mc_silverfish_death", + damage = "mobs_mc_silverfish_hurt", + distance = 16, }, + makes_footstep_sound = false, walk_velocity = 0.6, run_velocity = 2, jump = true, From 282ba2614a259c834dcc71e225a90ec80c2cf873 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 08:42:57 -0400 Subject: [PATCH 25/51] merge --- mods/ENTITIES/mcl_mobs/spawning.lua | 4 +++- mods/ENTITIES/mobs_mc/silverfish.lua | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 01e2eb9e5..0b386390b 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -461,11 +461,13 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh end for y = min_height, max_height do - print(y) + --print(y) end end end + print("--") + print(min_height, max_height) --[[ diff --git a/mods/ENTITIES/mobs_mc/silverfish.lua b/mods/ENTITIES/mobs_mc/silverfish.lua index 9befe1905..433211503 100644 --- a/mods/ENTITIES/mobs_mc/silverfish.lua +++ b/mods/ENTITIES/mobs_mc/silverfish.lua @@ -23,7 +23,6 @@ mobs:register_mob("mobs_mc:silverfish", { }, pathfinding = 1, visual_size = {x=3, y=3}, - sounds = {"FlowerForest", sounds = { random = "mobs_mc_silverfish_idle", death = "mobs_mc_silverfish_death", From ba9866db4916571039be1059855e40d4904ff1ef Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 09:52:50 -0400 Subject: [PATCH 26/51] merge --- mods/ENTITIES/mcl_mobs/spawning.lua | 226 ++++++++++--------------- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 4 +- 2 files changed, 96 insertions(+), 134 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 0b386390b..866591194 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -1,29 +1,18 @@ +--lua locals +local get_node = minetest.get_node +local get_item_group = minetest.get_item_group +local get_node_light = minetest.get_node_light +local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air +local new_vector = vector.new +local math_random = math.random +local get_biome_name = minetest.get_biome_name --[[ THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs underground: "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", +"JungleEdge_underground",local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] "ColdTaiga_underground", "IcePlains_underground", "IcePlainsSpikes_underground", @@ -433,59 +422,22 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh --load information into the spawn dictionary + local key = #spawn_dictionary + 1 + spawn_dictionary[key] = {} + spawn_dictionary[key]["name"] = name + spawn_dictionary[key]["dimension"] = dimension + spawn_dictionary[key]["type_of_spawning"] = type_of_spawning + spawn_dictionary[key]["biomes"] = biomes + spawn_dictionary[key]["min_light"] = min_light + spawn_dictionary[key]["max_light"] = max_light + spawn_dictionary[key]["interval"] = interval + spawn_dictionary[key]["chance"] = chance + spawn_dictionary[key]["aoc"] = aoc + spawn_dictionary[key]["min_height"] = min_height + spawn_dictionary[key]["max_height"] = max_height + spawn_dictionary[key]["day_toggle"] = day_toggle + spawn_dictionary[key]["on_spawn"] = spawn_abm_action - --allow for new dimensions to be auto added - --this will take extra time, a whole few nanoseconds - --but will allow modularity - - --build dimensions modularly - if not spawn_dictionary[dimension] then - spawn_dictionary[dimension] = {} - end - - --build biome list modularly - for _,added_biome in pairs(biomes) do - if not spawn_dictionary[dimension][added_biome] then - spawn_dictionary[dimension][added_biome] = {} - end - - --build type of spawning per biome modularly - if not spawn_dictionary[dimension][added_biome][type_of_spawning] then - spawn_dictionary[dimension][added_biome][type_of_spawning] = {} - end - - --build light levels to spawn mob - for i = min_light,max_light do - if not spawn_dictionary[dimension][added_biome][type_of_spawning][i] then - spawn_dictionary[dimension][added_biome][type_of_spawning][i] = {} - end - - for y = min_height, max_height do - --print(y) - end - end - end - - print("--") - print(min_height, max_height) - - - --[[ - local key = #spawn_dictionary[dimension] + 1 - - spawn_dictionary[dimension][key] = {} - spawn_dictionary[dimension][key]["name"] = name - spawn_dictionary[dimension][key]["type"] = type_of_spawning - spawn_dictionary[dimension][key]["min_light"] = min_light - spawn_dictionary[dimension][key]["max_light"] = max_light - spawn_dictionary[dimension][key]["interval"] = interval - spawn_dictionary[dimension][key]["chance"] = chance - spawn_dictionary[dimension][key]["aoc"] = aoc - spawn_dictionary[dimension][key]["min_height"] = min_height - spawn_dictionary[dimension][key]["max_height"] = max_height - spawn_dictionary[dimension][key]["day_toggle"] = day_toggle - spawn_dictionary[dimension][key]["on_spawn"] = spawn_abm_action - ]]-- --[[ minetest.register_abm({ label = name .. " spawning", @@ -499,7 +451,6 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh ]]-- end - -- compatibility with older mob registration -- we're going to forget about this for now -j4i --[[ @@ -574,108 +525,119 @@ local function decypher_limits(posy) posy = math.floor(posy) return posy - 32, posy + 32 end ---[[ -minetest.register_on_mods_loaded(function() - for _,data in pairs(minetest.registered_biomes) do - print(data.name) + +--a simple helper function for mob_spawn +local function biome_check(biome_list, biome_goal) + for _,data in ipairs(biome_list) do + if data == biome_goal then + return true + end end - print(dump(spawn_dictionary)) -end) -]]-- + return false +end + --todo mob limiting --MAIN LOOP ---[[ + if mobs_spawn then local timer = 15 --0 minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 15--0 + timer = 0--15--0 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(5) do + local player_pos = player:get_pos() + local _,dimension = mcl_worlds.y_to_layer(player_pos.y) if dimension == "void" or dimension == "default" then goto continue -- ignore void and unloaded area end - local min,max = decypher_limits(player_pos.y) local goal_pos = position_calculation(player_pos) - local gotten_biome = minetest.get_biome_data(goal_pos) + local spawning_position_list = find_nodes_in_area_under_air(new_vector(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:solid", "group:water", "group:lava"}) + + --couldn't find node + if #spawning_position_list <= 0 then + goto continue + end + + local spawning_position = spawning_position_list[math_random(1,#spawning_position_list)] + + --I have no idea why this would happen, but better to be safe + if not spawning_position then + goto continue + end + + local gotten_node = get_node(spawning_position).name + + if not gotten_node or gotten_node == "air" then --skip air nodes + goto continue + end + + local gotten_biome = minetest.get_biome_data(spawning_position) if not gotten_biome then goto continue --skip if in unloaded area end - print(minetest.get_biome_name(gotten_biome.biome)) + gotten_biome = get_biome_name(gotten_biome.biome) --makes it easier to work with - local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] + --grab random mob + local mob_def = spawn_dictionary[math.random(1,#spawn_dictionary)] - if not mob_def then --to catch a crazy error if it ever happens - minetest.log("error", "WARNING!! Attempted to spawn a mob that doesn't exist! Please notify developers!\nThe game will continue to run though.") - goto continue - end + if not mob_def then + goto continue --skip if something ridiculous happens (nil mob def) + end - if mob_def.type == "ground" then + --skip if not correct dimension + if mob_def.dimension ~= dimension then + goto continue + end - local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:solid"}) + --add this so mobs don't spawn inside nodes + spawning_position.y = spawning_position.y + 1 - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + if spawning_position.y < mob_def.min_height or spawning_position.y > mob_def.max_height then + goto continue + end - spawning_position.y = spawning_position.y + 1 + --only need to poll for node light if everything else worked + local gotten_light = get_node_light(spawning_position) - local gotten_light = minetest.get_node_light(spawning_position) + --don't spawn if not in light limits + if gotten_light < mob_def.min_light or gotten_light > mob_def.max_light then + goto continue + end - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - elseif mob_def.type == "air" then - local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"air"}) + local is_water = get_item_group(gotten_node, "water") ~= 0 + local is_lava = get_item_group(gotten_node, "lava") ~= 0 - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] + if mob_def.type_of_spawning == "ground" and is_water then + goto continue + end - local gotten_light = minetest.get_node_light(spawning_position) + if mob_def.type_of_spawning == "ground" and is_lava then + goto continue + end - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - elseif mob_def.type == "water" then - local spawning_position_list = minetest.find_nodes_in_area(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:water"}) - - if #spawning_position_list <= 0 then - goto continue - end - - local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)] - - local gotten_light = minetest.get_node_light(spawning_position) - - if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then - minetest.add_entity(spawning_position, mob_def.name) - end - --elseif mob_def.type == "lava" then - --implement later - end - --local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"}) + --adjust the position for water and lava mobs + if mob_def.type_of_spawning == "water" or mob_def.type_of_spawning == "lava" then + spawning_position.y = spawning_position.y - 1 + end + --everything is correct, spawn mob + minetest.add_entity(spawning_position, mob_def.name) ::continue:: --this is a safety catch end end end end) end -]]-- \ No newline at end of file diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index b979c7353..c92ccbba5 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -290,9 +290,9 @@ mobs_mc.spawn = { mobs_mc.spawn_height = { water = tonumber(minetest.settings:get("water_level")) or 0, -- Water level in the Overworld - -- Overworld boundaries (inclusive) --had to make this reasonable otherwise mob spawning would go nuts using data + -- Overworld boundaries (inclusive) --I adjusted this to be more reasonable overworld_min = -64,-- -2999, - overworld_max = 256,-- 31000, + overworld_max = 31000, -- Nether boundaries (inclusive) nether_min = -29067,-- -3369, From 310dcf966016905d7a551063b71935fdcc0a46a9 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 10:00:04 -0400 Subject: [PATCH 27/51] Fix forgotten biome check --- mods/ENTITIES/mcl_mobs/spawning.lua | 7 ++++++- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 866591194..84cb9928a 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -546,7 +546,7 @@ if mobs_spawn then minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 0--15--0 + timer = 15--0 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(5) do @@ -602,6 +602,11 @@ if mobs_spawn then goto continue end + --skip if not in correct biome + if not biome_check(mob_def.biomes, gotten_biome) then + goto continue + end + --add this so mobs don't spawn inside nodes spawning_position.y = spawning_position.y + 1 diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 656570a83..48fcc8197 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -176,6 +176,7 @@ mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max) + mobs:spawn_specific( "mobs_mc:mooshroom", "overworld", From 4fca50dead601c840d268f6108eeb8f066fe97e1 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 10:01:15 -0400 Subject: [PATCH 28/51] Fix spawn timer reset debug --- mods/ENTITIES/mcl_mobs/spawning.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 84cb9928a..72b014b27 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -546,7 +546,7 @@ if mobs_spawn then minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 15--0 + timer = 0--15 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(5) do From 26847bbb549aaf4f92c581f4c06ae7a753045509 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 12:07:20 -0400 Subject: [PATCH 29/51] Finish mob limiter --- mods/ENTITIES/mcl_mobs/api.lua | 5 -- mods/ENTITIES/mcl_mobs/spawning.lua | 74 ++++++++++++++--------------- 2 files changed, 37 insertions(+), 42 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index daa209e9e..6c1a0567e 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -82,11 +82,6 @@ if minetest.settings:get_bool("only_peaceful_mobs", false) then end) end --- calculate aoc range for mob count -local aosrb = tonumber(minetest.settings:get("active_object_send_range_blocks")) -local abr = tonumber(minetest.settings:get("active_block_range")) -local aoc_range = max(aosrb, abr) * 16 - -- pathfinding settings local enable_pathfinding = true local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 72b014b27..08fd04188 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -6,6 +6,12 @@ local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air local new_vector = vector.new local math_random = math.random local get_biome_name = minetest.get_biome_name +local max = math.max +local get_objects_inside_radius = minetest.get_objects_inside_radius +local vector_distance = vector.distance + +-- range for mob count +local aoc_range = 32 --[[ THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs @@ -150,51 +156,29 @@ Overworld regular: local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false -- count how many mobs of one type are inside an area ---[[ -local count_mobs = function(pos, mobtype) +local count_mobs = function(pos,mobtype) + print(mobtype) local num = 0 - local objs = minetest.get_objects_inside_radius(pos, aoc_range) - + local objs = get_objects_inside_radius(pos, aoc_range) for n = 1, #objs do - local obj = objs[n]:get_luaentity() - if obj and obj.name and obj._cmi_is_mob then - - -- 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 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 + -- count passive mobs only + else num = num + 1 end end end - + return num end -]]-- + -- global functions @@ -229,6 +213,7 @@ what is aoc??? objects in area WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua?? ]]-- + --this is where all of the spawning information is kept local spawn_dictionary = {} @@ -258,6 +243,7 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc)) end + --[[ local spawn_action spawn_action = function(pos, node, active_object_count, active_object_count_wider, name) @@ -419,7 +405,15 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh local function spawn_abm_action(pos, node, active_object_count, active_object_count_wider) spawn_action(pos, node, active_object_count, active_object_count_wider, name) end + ]]-- + local entdef = minetest.registered_entities[name] + local spawn_class + if entdef.type == "monster" then + spawn_class = "hostile" + else + spawn_class = "passive" + end --load information into the spawn dictionary local key = #spawn_dictionary + 1 @@ -436,7 +430,8 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh spawn_dictionary[key]["min_height"] = min_height spawn_dictionary[key]["max_height"] = max_height spawn_dictionary[key]["day_toggle"] = day_toggle - spawn_dictionary[key]["on_spawn"] = spawn_abm_action + --spawn_dictionary[key]["on_spawn"] = spawn_abm_action + spawn_dictionary[key]["spawn_class"] = spawn_class --[[ minetest.register_abm({ @@ -540,15 +535,14 @@ end --todo mob limiting --MAIN LOOP - if mobs_spawn then - local timer = 15 --0 + local timer = 0 minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 15 then - timer = 0--15 + timer = 0 for _,player in ipairs(minetest.get_connected_players()) do - for i = 1,math.random(5) do + for i = 1,math.random(3,8) do local player_pos = player:get_pos() @@ -571,8 +565,8 @@ if mobs_spawn then local spawning_position = spawning_position_list[math_random(1,#spawning_position_list)] - --I have no idea why this would happen, but better to be safe - if not spawning_position then + --Prevent strange behavior/too close to player + if not spawning_position or vector_distance(player_pos, spawning_position) < 15 then goto continue end @@ -633,6 +627,11 @@ if mobs_spawn then goto continue end + --finally do the heavy check (for now) of mobs in area + if count_mobs(spawning_position, mob_def.spawn_class) >= mob_def.aoc then + goto continue + end + --adjust the position for water and lava mobs if mob_def.type_of_spawning == "water" or mob_def.type_of_spawning == "lava" then spawning_position.y = spawning_position.y - 1 @@ -640,6 +639,7 @@ if mobs_spawn then --everything is correct, spawn mob minetest.add_entity(spawning_position, mob_def.name) + ::continue:: --this is a safety catch end end From 9789cf5dcde09907ec1cafb623a682a81298f2c9 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 12:48:02 -0400 Subject: [PATCH 30/51] Adjust spawning to be closer and more frequent --- mods/ENTITIES/mcl_mobs/spawning.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 08fd04188..7a7ce10d5 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -486,7 +486,7 @@ end local axis --inner and outer part of square donut radius local inner = 1 -local outer = 70 +local outer = 50 local int = {-1,1} local position_calculation = function(pos) @@ -539,7 +539,7 @@ if mobs_spawn then local timer = 0 minetest.register_globalstep(function(dtime) timer = timer + dtime - if timer >= 15 then + if timer >= 8 then timer = 0 for _,player in ipairs(minetest.get_connected_players()) do for i = 1,math.random(3,8) do From 6279f5eb414012f175af39ae5deb734bf030e033 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 8 Apr 2021 14:19:42 -0400 Subject: [PATCH 31/51] test --- mods/ENTITIES/mcl_mobs/spawning.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 7a7ce10d5..206dfdd41 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -486,7 +486,7 @@ end local axis --inner and outer part of square donut radius local inner = 1 -local outer = 50 +local outer = 65 local int = {-1,1} local position_calculation = function(pos) From 6b31e8538559487012a25af294102fc451f4765e Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 9 Apr 2021 01:31:21 +0400 Subject: [PATCH 32/51] Revert (1/3) "Revert fixes to crash world border" This reverts commit 18f73ba31f3669b49a573fe6cc15050c81fe31db. --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index d17a3acd2..3a8e68f95 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -483,12 +483,14 @@ function mesecon.turnoff(pos, link) for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false + + if not (mesecon.get_node_force(np) == nil) then + if mesecon.is_receptor_on(n.name) then + local receptorrules = mesecon.receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and vector.equals(mesecon.invertRule(rr), r) then + return false + end end end end From 26ce10d25c7392bcb3cdb0d8517db432814fc70e Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 9 Apr 2021 01:32:27 +0400 Subject: [PATCH 33/51] Revert (2/3) "Add erlehmann fix to redstone world border crash" This reverts commit b9d175e6a5d6654b19098c7943a4e14ca8e43eb1. --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 3a8e68f95..78d675e47 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -484,13 +484,16 @@ function mesecon.turnoff(pos, link) local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - if not (mesecon.get_node_force(np) == nil) then - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false - end + if not n then + mcl_explosions.explode(f.pos, 10) + return + end + + if mesecon.is_receptor_on(n.name) then + local receptorrules = mesecon.receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and vector.equals(mesecon.invertRule(rr), r) then + return false end end end From f0c2eb86a29b187a17554a7e8927a00906fece35 Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 9 Apr 2021 01:32:58 +0400 Subject: [PATCH 34/51] Revert (3/3) "Fix extreme mesecons/redstone crashing at world border" This reverts commit 0842a36aa6f4a45a10a3ec1182dedcec1d4aac61. --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 78d675e47..7986c2908 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -483,12 +483,6 @@ function mesecon.turnoff(pos, link) for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - - if not n then - mcl_explosions.explode(f.pos, 10) - return - end - if mesecon.is_receptor_on(n.name) then local receptorrules = mesecon.receptor_get_rules(n) for _, rr in pairs(receptorrules) do From 7c8cf6f79f9f695ed570f4394615af63c3f071f0 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 8 Apr 2021 01:46:01 +0200 Subject: [PATCH 35/51] Do not crash server if world border is depowered --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 7986c2908..7ad5a2bdf 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -483,11 +483,13 @@ function mesecon.turnoff(pos, link) for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false + if not (mesecon.get_node_force(np) == nil) then + if mesecon.is_receptor_on(n.name) then + local receptorrules = mesecon.receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and vector.equals(mesecon.invertRule(rr), r) then + return false + end end end end From a733eb8e0cb0c4f241c7fd2e46b316e197097a02 Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 9 Apr 2021 02:08:03 +0400 Subject: [PATCH 36/51] [mesecons] Localise several things in internal.lua --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 149 +++++++++++----------- 1 file changed, 78 insertions(+), 71 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 7ad5a2bdf..ef12bcc48 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -47,28 +47,35 @@ -- mesecon.rotate_rules_down(rules) -- These functions return rules that have been rotated in the specific direction +local equals = vector.equals +local get_node_force = mesecon.get_node_force +local receptor_get_rules = mesecon.receptor_get_rules +local invertRule = mesecon.invertRule +local copy, insert = table.copy, table.insert +local registered_nodes = minetest.registered_nodes + -- General function mesecon.get_effector(nodename) - if minetest.registered_nodes[nodename] - and minetest.registered_nodes[nodename].mesecons - and minetest.registered_nodes[nodename].mesecons.effector then - return minetest.registered_nodes[nodename].mesecons.effector + if registered_nodes[nodename] + and registered_nodes[nodename].mesecons + and registered_nodes[nodename].mesecons.effector then + return registered_nodes[nodename].mesecons.effector end end function mesecon.get_receptor(nodename) - if minetest.registered_nodes[nodename] - and minetest.registered_nodes[nodename].mesecons - and minetest.registered_nodes[nodename].mesecons.receptor then - return minetest.registered_nodes[nodename].mesecons.receptor + if registered_nodes[nodename] + and registered_nodes[nodename].mesecons + and registered_nodes[nodename].mesecons.receptor then + return registered_nodes[nodename].mesecons.receptor end end function mesecon.get_conductor(nodename) - if minetest.registered_nodes[nodename] - and minetest.registered_nodes[nodename].mesecons - and minetest.registered_nodes[nodename].mesecons.conductor then - return minetest.registered_nodes[nodename].mesecons.conductor + if registered_nodes[nodename] + and registered_nodes[nodename].mesecons + and registered_nodes[nodename].mesecons.conductor then + return registered_nodes[nodename].mesecons.conductor end end @@ -103,13 +110,14 @@ end -- Receptors -- Nodes that can power mesecons -function mesecon.is_receptor_on(nodename) +local function is_receptor_on(nodename) local receptor = mesecon.get_receptor(nodename) if receptor and receptor.state == mesecon.state.on then return true end return false end +mesecon.is_receptor_on = is_receptor_on function mesecon.is_receptor_off(nodename) local receptor = mesecon.get_receptor(nodename) @@ -186,7 +194,7 @@ end -- Activation: mesecon.queue:add_function("activate", function (pos, rulename) - local node = mesecon.get_node_force(pos) + local node = get_node_force(pos) if not node then return end local effector = mesecon.get_effector(node.name) @@ -198,7 +206,7 @@ end) function mesecon.activate(pos, node, rulename, depth) if rulename == nil then - for _,rule in ipairs(mesecon.effector_get_rules(node)) do + for _,rule in pairs(mesecon.effector_get_rules(node)) do mesecon.activate(pos, node, rule, depth + 1) end return @@ -209,7 +217,7 @@ end -- Deactivation mesecon.queue:add_function("deactivate", function (pos, rulename) - local node = mesecon.get_node_force(pos) + local node = get_node_force(pos) if not node then return end local effector = mesecon.get_effector(node.name) @@ -221,7 +229,7 @@ end) function mesecon.deactivate(pos, node, rulename, depth) if rulename == nil then - for _,rule in ipairs(mesecon.effector_get_rules(node)) do + for _,rule in pairs(mesecon.effector_get_rules(node)) do mesecon.deactivate(pos, node, rule, depth + 1) end return @@ -232,7 +240,7 @@ end -- Change mesecon.queue:add_function("change", function (pos, rulename, changetype) - local node = mesecon.get_node_force(pos) + local node = get_node_force(pos) if not node then return end local effector = mesecon.get_effector(node.name) @@ -244,7 +252,7 @@ end) function mesecon.changesignal(pos, node, rulename, newstate, depth) if rulename == nil then - for _,rule in ipairs(mesecon.effector_get_rules(node)) do + for _,rule in pairs(mesecon.effector_get_rules(node)) do mesecon.changesignal(pos, node, rule, newstate, depth + 1) end return @@ -356,15 +364,15 @@ end -- some more general high-level stuff function mesecon.is_power_on(pos, rulename) - local node = mesecon.get_node_force(pos) - if node and (mesecon.is_conductor_on(node, rulename) or mesecon.is_receptor_on(node.name)) then + local node = get_node_force(pos) + if node and (mesecon.is_conductor_on(node, rulename) or is_receptor_on(node.name)) then return true end return false end function mesecon.is_power_off(pos, rulename) - local node = mesecon.get_node_force(pos) + local node = get_node_force(pos) if node and (mesecon.is_conductor_off(node, rulename) or mesecon.is_receptor_off(node.name)) then return true end @@ -381,7 +389,7 @@ function mesecon.turnon(pos, link) local depth = 1 while frontiers[1] do local f = table.remove(frontiers, 1) - local node = mesecon.get_node_force(f.pos) + local node = get_node_force(f.pos) if not node then -- Area does not exist; do nothing @@ -389,10 +397,10 @@ function mesecon.turnon(pos, link) local rules = mesecon.conductor_get_rules(node) -- Call turnon on neighbors - for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do + for _, r in pairs(mesecon.rule2meta(f.link, rules)) do local np = vector.add(f.pos, r) - for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do - table.insert(frontiers, {pos = np, link = l}) + for _, l in pairs(mesecon.rules_link_rule_all(f.pos, r)) do + insert(frontiers, {pos = np, link = l}) end end @@ -406,12 +414,12 @@ function mesecon.turnon(pos, link) if node and f.link.spread and minetest.get_item_group(node.name, "opaque") == 1 then -- Call turnon on neighbors -- Warning: A LOT of nodes need to be looked at for this to work - for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do + for _, r in pairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) - for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do - local nlink = table.copy(l) + for _, l in pairs(mesecon.rules_link_rule_all(f.pos, r)) do + local nlink = copy(l) nlink.spread = false - table.insert(frontiers, {pos = np, link = nlink}) + insert(frontiers, {pos = np, link = nlink}) end end end @@ -443,33 +451,33 @@ function mesecon.turnoff(pos, link) local depth = 1 while frontiers[1] do local f = table.remove(frontiers, 1) - local node = mesecon.get_node_force(f.pos) + local node = get_node_force(f.pos) if not node then -- No-op elseif mesecon.is_conductor_on(node, f.link) then local rules = mesecon.conductor_get_rules(node) - for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do + for _, r in pairs(mesecon.rule2meta(f.link, rules)) do local np = vector.add(f.pos, r) -- Check if an onstate receptor is connected. If that is the case, -- abort this turnoff process by returning false. `receptor_off` will -- discard all the changes that we made in the voxelmanip: - for _, l in ipairs(mesecon.rules_link_rule_all_inverted(f.pos, r)) do - if mesecon.is_receptor_on(mesecon.get_node_force(np).name) then + for _, l in pairs(mesecon.rules_link_rule_all_inverted(f.pos, r)) do + if is_receptor_on(get_node_force(np).name) then return false end end -- Call turnoff on neighbors - for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do - table.insert(frontiers, {pos = np, link = l}) + for _, l in pairs(mesecon.rules_link_rule_all(f.pos, r)) do + insert(frontiers, {pos = np, link = l}) end end mesecon.swap_node_force(f.pos, mesecon.get_conductor_off(node, f.link)) elseif mesecon.is_effector(node.name) then - table.insert(signals, { + insert(signals, { pos = f.pos, node = node, link = f.link, @@ -480,23 +488,22 @@ function mesecon.turnoff(pos, link) if node and f.link.spread and minetest.get_item_group(node.name, "opaque") == 1 then -- Call turnoff on neighbors -- Warning: A LOT of nodes need to be looked at for this to work - for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do - local np = vector.add(f.pos, r) - local n = mesecon.get_node_force(np) - if not (mesecon.get_node_force(np) == nil) then - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false - end + local fpos = f.pos + for _, r in pairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do + local np = {x=fpos.x+r.x, y=fpos.y+r.y, z=fpos.z+r.z} + local n = get_node_force(np) + if n and is_receptor_on(n.name) then + local receptorrules = receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and equals(invertRule(rr), r) then + return false end end end - for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do - local nlink = table.copy(l) + for _, l in pairs(mesecon.rules_link_rule_all(fpos, r)) do + local nlink = copy(l) nlink.spread = false - table.insert(frontiers, {pos = np, link = nlink}) + insert(frontiers, {pos = np, link = nlink}) end end end @@ -504,7 +511,7 @@ function mesecon.turnoff(pos, link) depth = depth + 1 end - for _, sig in ipairs(signals) do + for _, sig in pairs(signals) do mesecon.changesignal(sig.pos, sig.node, sig.link, mesecon.state.off, sig.depth) if mesecon.is_effector_on(sig.node.name) and not mesecon.is_powered(sig.pos) then mesecon.deactivate(sig.pos, sig.node, sig.link, sig.depth) @@ -518,19 +525,19 @@ end -- outputnode (receptor or conductor) at position `output` and has an output in direction `rule` function mesecon.rules_link_rule_all(output, rule) local input = vector.add(output, rule) - local inputnode = mesecon.get_node_force(input) + local inputnode = get_node_force(input) local inputrules = mesecon.get_any_inputrules(inputnode) if not inputrules then return {} end local rules = {} - for _, inputrule in ipairs(mesecon.flattenrules(inputrules)) do + for _, inputrule in pairs(mesecon.flattenrules(inputrules)) do -- Check if input accepts from output - if vector.equals(vector.add(input, inputrule), output) then - local newrule = table.copy(inputrule) + if equals(vector.add(input, inputrule), output) then + local newrule = copy(inputrule) newrule.spread = rule.spread - table.insert(rules, newrule) + insert(rules, newrule) end end @@ -541,19 +548,19 @@ end -- inputnode (effector or conductor) at position `input` and has an input in direction `rule` function mesecon.rules_link_rule_all_inverted(input, rule) local output = vector.add(input, rule) - local outputnode = mesecon.get_node_force(output) + local outputnode = get_node_force(output) local outputrules = mesecon.get_any_outputrules(outputnode) if not outputrules then return {} end local rules = {} - for _, outputrule in ipairs(mesecon.flattenrules(outputrules)) do - if vector.equals(vector.add(output, outputrule), input) then - local newrule = table.copy(outputrule) - newrule = mesecon.invertRule(newrule) + for _, outputrule in pairs(mesecon.flattenrules(outputrules)) do + if equals(vector.add(output, outputrule), input) then + local newrule = copy(outputrule) + newrule = invertRule(newrule) newrule.spread = rule.spread - table.insert(rules, newrule) + insert(rules, newrule) end end return rules @@ -564,7 +571,7 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos) if depth > 1 then return false, false end - local node = mesecon.get_node_force(pos) + local node = get_node_force(pos) local rules = mesecon.get_any_inputrules(node) if not rules then return false, false @@ -580,23 +587,23 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos) local function power_walk(pos, home_pos, sourcepos, rulenames, rule, depth) local spread = false - for _, rname in ipairs(rulenames) do + for _, rname in pairs(rulenames) do local np = vector.add(pos, rname) - local nn = mesecon.get_node_force(np) - if (mesecon.is_conductor_on (nn, mesecon.invertRule(rname)) - or mesecon.is_receptor_on (nn.name)) then - if not vector.equals(home_pos, np) then + local nn = get_node_force(np) + if (mesecon.is_conductor_on (nn, invertRule(rname)) + or is_receptor_on (nn.name)) then + if not equals(home_pos, np) then local rulez = mesecon.get_any_outputrules(nn) local spread_tmp = false for r=1, #rulez do - if vector.equals(mesecon.invertRule(rname), rulez[r]) then + if equals(invertRule(rname), rulez[r]) then if rulez[r].spread then spread_tmp = true end end end if depth == 0 or spread_tmp then - table.insert(sourcepos, np) + insert(sourcepos, np) if spread_tmp then spread = true end @@ -614,7 +621,7 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos) local spread = false if not rule then - for _, rule in ipairs(mesecon.flattenrules(rules)) do + for _, rule in pairs(mesecon.flattenrules(rules)) do local spread_temp local rulenames = mesecon.rules_link_rule_all_inverted(pos, rule) sourcepos, spread_temp = power_walk(pos, home_pos, sourcepos, rulenames, rule, depth) From f5f6e232cc9e1f6e33810a8b04a8f652fb90091e Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 9 Apr 2021 16:46:41 +0200 Subject: [PATCH 37/51] Attemp to fix #1513 --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index ef12bcc48..6a90b98eb 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -52,8 +52,10 @@ local get_node_force = mesecon.get_node_force local receptor_get_rules = mesecon.receptor_get_rules local invertRule = mesecon.invertRule local copy, insert = table.copy, table.insert -local registered_nodes = minetest.registered_nodes - +local registered_nodes +minetest.register_on_mods_loaded(function() + registered_nodes = minetest.registered_nodes +end) -- General function mesecon.get_effector(nodename) if registered_nodes[nodename] From 3375e903ce87c4a5f07d8d84aea682c914e1db12 Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 9 Apr 2021 18:52:03 +0400 Subject: [PATCH 38/51] [mesecons] Fix attempt to call upvalue in internal.lua --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 6a90b98eb..a552fed70 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -49,7 +49,6 @@ local equals = vector.equals local get_node_force = mesecon.get_node_force -local receptor_get_rules = mesecon.receptor_get_rules local invertRule = mesecon.invertRule local copy, insert = table.copy, table.insert local registered_nodes @@ -137,7 +136,7 @@ function mesecon.is_receptor(nodename) return false end -function mesecon.receptor_get_rules(node) +local function receptor_get_rules(node) local receptor = mesecon.get_receptor(node.name) if receptor then local rules = receptor.rules @@ -150,6 +149,7 @@ function mesecon.receptor_get_rules(node) return mesecon.rules.default end +mesecon.receptor_get_rules = receptor_get_rules -- Effectors -- Nodes that can be powered by mesecons From d50fd06c82193e9e83efb2d1f3d77e629fa78696 Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 9 Apr 2021 19:03:45 +0400 Subject: [PATCH 39/51] Revert "Attemp to fix #1513" in favour of next commit 3375e903ce This reverts commit f5f6e232cc9e1f6e33810a8b04a8f652fb90091e. --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index a552fed70..f4ed9df4e 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -51,10 +51,8 @@ local equals = vector.equals local get_node_force = mesecon.get_node_force local invertRule = mesecon.invertRule local copy, insert = table.copy, table.insert -local registered_nodes -minetest.register_on_mods_loaded(function() - registered_nodes = minetest.registered_nodes -end) +local registered_nodes = minetest.registered_nodes + -- General function mesecon.get_effector(nodename) if registered_nodes[nodename] From 849823af1f4d381f85fe8fed4faa96171c92284a Mon Sep 17 00:00:00 2001 From: epCode Date: Fri, 9 Apr 2021 14:33:14 -0700 Subject: [PATCH 40/51] Add player pushing ;) --- mods/PLAYER/mcl_playerplus/init.lua | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 52c87a514..a9f6bd5a1 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -22,11 +22,48 @@ local mcl_playerplus_internal = {} local def = {} local time = 0 +local player_collision = function(player) + + local pos = player:get_pos() + local vel = player:get_velocity() + local x = 0 + local z = 0 + local width = .75 + + for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do + + if object:is_player() + or (object:get_luaentity()._cmi_is_mob == true and object ~= player) then + + local pos2 = object:get_pos() + local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z} + local force = (width + 0.5) - vector.distance( + {x = pos.x, y = 0, z = pos.z}, + {x = pos2.x, y = 0, z = pos2.z}) + + x = x + (vec.x * force) + z = z + (vec.z * force) + end + end + + return({x * 5,z * 5}) +end + -- converts yaw to degrees local function degrees(rad) return rad * 180.0 / math.pi end +local pi = math.pi +local atann = math.atan +local atan = function(x) + if not x or x ~= x then + return 0 + else + return atann(x) + end +end + local dir_to_pitch = function(dir) local dir2 = vector.normalize(dir) local xz = math.abs(dir.x) + math.abs(dir.z) @@ -88,6 +125,13 @@ minetest.register_globalstep(function(dtime) for _,player in pairs(get_connected_players()) do + c_x, c_y = unpack(player_collision(player)) + + if player:get_velocity().x + player:get_velocity().y < .5 and c_x + c_y > 0 then + --minetest.chat_send_player(player:get_player_name(), "pushed at " .. c_x + c_y .. " parsecs.") + player:add_velocity({x=c_x, y=0, z=c_y}) + end + --[[ _ _ _ __ _ _ __ (_)_ __ ___ __ _| |_(_) ___ _ __ ___ From 9e5fb7f533eb38123fa49b454f8e70e7b01dadbb Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 9 Apr 2021 22:04:42 +0000 Subject: [PATCH 41/51] Add #490 --- mods/ITEMS/mcl_core/nodes_trees.lua | 164 +++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index 197846ebc..4c097bad6 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -1,4 +1,4 @@ --- Tree nodes: Wood, Wooden Planks, Sapling, Leaves +-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves, Stripped Wood local S = minetest.get_translator("mcl_core") local mod_screwdriver = minetest.get_modpath("screwdriver") ~= nil @@ -48,6 +48,166 @@ local register_tree_trunk = function(subname, description_trunk, description_bar }) end +-- Register stripped trunk +minetest.register_node("mcl_core:stripped_oak", { + description = "Stripped Oak Log", + _doc_items_longdesc = "Stripped Oak Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_acacia", { + description = "Stripped Acacia Log", + _doc_items_longdesc = "Stripped Acacia Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_dark_oak", { + description = "Stripped Dark Oak Log", + _doc_items_longdesc = "Stripped Dark Oak Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_birch", { + description = "Stripped Birch Log", + _doc_items_longdesc = "Stripped Birch Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_spruce", { + description = "Stripped Spruce Log", + _doc_items_longdesc = "Stripped Spruce Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_jungle", { + description = "Stripped Jungle Log", + _doc_items_longdesc = "Stripped Jungle Log is a log that has been stripped of it's bark.", + tiles = {"mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + + +-- Register stripped bark +minetest.register_node("mcl_core:stripped_oak_bark", { + description = "Stripped Oak Bark", + _doc_items_longdesc = "Stripped Oak Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_acacia_bark", { + description = "Stripped Acacia Bark", + _doc_items_longdesc = "Stripped Acacia Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_acacia_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_dark_oak_bark", { + description = "Stripped Dark Oak Bark", + _doc_items_longdesc = "Stripped Dark Oak Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_dark_oak_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_birch_bark", { + description = "Stripped Birch Bark", + _doc_items_longdesc = "Stripped Birch Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_birch_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_spruce_bark", { + description = "Stripped Spruce Bark", + _doc_items_longdesc = "Stripped Spruce Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_spruce_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + +minetest.register_node("mcl_core:stripped_jungle_bark", { + description = "Stripped Jungle Bark", + _doc_items_longdesc = "Stripped Jungles Bark is a bark that has been stripped.", + tiles = {"mcl_core_stripped_jungle_side.png"}, + is_ground_content = false, + paramtype2 = "facedir", + on_place = mcl_util.rotate_axis, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 10, + _mcl_hardness = 2, +}) + + local register_wooden_planks = function(subname, description, tiles) minetest.register_node("mcl_core:"..subname, { description = description, @@ -226,4 +386,4 @@ register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from -- Node aliases minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree") -minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves") +minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves") \ No newline at end of file From cbcaef19c6814aa9d8f7bdefc49f37ee9c7191fd Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 9 Apr 2021 22:07:44 +0000 Subject: [PATCH 42/51] Add stripped acacia textures --- .../textures/mcl_core_stripped_acacia_side.png | Bin 0 -> 361 bytes .../textures/mcl_core_stripped_acacia_top.png | Bin 0 -> 426 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_side.png create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_top.png diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_side.png new file mode 100644 index 0000000000000000000000000000000000000000..2e2de8dbeb40446e193bc91c921dcd549cb8f5ed GIT binary patch literal 361 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=De8Ak0{?)V>TT$X?><>&pI=g;PjhMmp=(bD+>SPZ!4!i_@(^)_lzdJhiIMG_2BP zWVrpy;p(&nvkpu&yerNT<0tmQnjyefbLN6bivxTmj@7w;Yn*In_d&gJ%SzABTV^z6&A;4L z^dzKHdG-+*zwJvyw<{R_T{c1XLh-+5{y8Sa*Ltd$pH8X%_q6qDlHQw%GwclJY;_5n z^k?=_y}ni5YfERoJDt~Z*mcvjTd%JDT{SO%VXHXLuZjMen~OICLx924)z4*}Q$iB} DGklU~ literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_acacia_top.png new file mode 100644 index 0000000000000000000000000000000000000000..0746884de9e39cbf129e4291b660df94adc9676c GIT binary patch literal 426 zcmV;b0agBqP)61q=2N`9A;v0XIoR zK~y-)rBh97gFp~{4MHGccTre`7!Y#MQz3t&f2+T)mqL$?hk~F&5E68&)Lz;{JJa1& zN}-;1XPz_fLvQZyZa?skC$KMZB=~&37_KQT(Y5`o2LLNNWO)LmC6t!VFaj_2cmNed zC?G;H15&*yTMXmmNLcxrs-lJn1@>9OL#m<%0OZF5^5el7&K`(Rz+4TKmZ*x_(HTcy zJ;Kcx5M=@kmnr5at^qbh3FskGz-nzCh#!@!PA zX^DN7@W$d)GXtACy%X3b@mKb}Nok4m#o+Pbnf>tn3YLBz0@}>{`(li~oWImR0jNEf Ua`%pJIsgCw07*qoM6N<$g8! Date: Fri, 9 Apr 2021 22:08:39 +0000 Subject: [PATCH 43/51] Add stripped birch textures --- .../textures/mcl_core_stripped_birch_side.png | Bin 0 -> 531 bytes .../textures/mcl_core_stripped_birch_top.png | Bin 0 -> 439 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_side.png create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_top.png diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_side.png new file mode 100644 index 0000000000000000000000000000000000000000..a27739c1e6dcb48dbb821783a2d00a007b9f9c88 GIT binary patch literal 531 zcmV+u0_^>XP)67zmJc#F+p90ia1l zK~y-)b(6i0(?Ar3zeExKDb|Tbifvg!#LWua5UQ12ZMzS_JMbht4YX7ss$Cj_XdJW> zvJ+_(Pl|Y4K@nzlW`SE-cjlgR&za-N+c&R&0X#2L0HQEp(4+k}HRzFdpEdy0RY5B? z05gDGgt+ys+0k^8IF7lwy0n0C9Ftu{-rZ?;9K6P$N19FouwE@}KMDiZtA$6_bdsry z_~FYBqA;MY3hJt0o+O@>d6L+kA)cDyUMb7yUNq~wKzG~2g9Lz9YHtW22%Zpy0liY( zZtl6=+nTfNBrs3)`=w`^3_x|&D4`kLI2XYZw19MUQWttl<_h~&3-1Q!N;wEyQB=kzr z9S5?D$j<>lyW7+5_WuQQtLfx VuEYPSXp;Z{002ovPDHLkV1i8Z>W%;a literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_birch_top.png new file mode 100644 index 0000000000000000000000000000000000000000..e5290422d4f7f826064a1bff7baf1cea5a2b46c7 GIT binary patch literal 439 zcmV;o0Z9IdP)67!-tbnAQLQ0Yphe zK~y-)rIWvkgFq0*e-~0{BZ#1G6R;A}nJUlVGu@lqdt86rRj~`C5^Pol5p1-(D`eK) zM7ZLn+gZOq^UeD9_3{40Kk5kZ`TcO3Y2X9UPP22idjRD%UkRRp04nlmrRr2@m{0kHryVH;}4XpqG002ovPDHLkV1jcoxsLz< literal 0 HcmV?d00001 From 03e112ef9b1506701e91e15e0d7b5912a265b69b Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 9 Apr 2021 22:09:16 +0000 Subject: [PATCH 44/51] Add stripped dark oak textures --- .../textures/mcl_core_stripped_dark_oak_side.png | Bin 0 -> 382 bytes .../textures/mcl_core_stripped_dark_oak_top.png | Bin 0 -> 438 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_side.png create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_top.png diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_side.png new file mode 100644 index 0000000000000000000000000000000000000000..9345a14dc22824b02974199546cd9a357df98c15 GIT binary patch literal 382 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=De8Ak0{?)V>TT$X?><>&pI=g;Ur}+fsDTaRvrPZci7-5R22jlQ(7^cHn8-FK5Sd z)8~P~TM;JT_I-}m?HuCmoli*l1g9IxG;MKS__L==R|2b`q63UkTEUc^FZj&y%eO71NyIr4Z<=h!uSQ-{I%u#2s+plLlf%Wjp>hD|!X1N7(ZI+f^Pt0WJ-gM{OV-Jpre;-Cx4I{Mnb)uBin`s`&mMm>&*i-MjLsbOyqZwaHD%(KryrUA aW2j+WGV8#H%J0CCV(@hJb6Mw<&;$Sx!J6m* literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_dark_oak_top.png new file mode 100644 index 0000000000000000000000000000000000000000..fbc45938f39a4c70c4f1b506a630a606676ebb15 GIT binary patch literal 438 zcmV;n0ZIOeP)6HXd)Lc;o;80Ygbd zK~zY`#Z|is!axu_Lm*(~sYTFAEb<3_fFIz;3koU3%8wiq8>*L7_hUa%Zm=gv9jy>nI7 zG))uwi4-75uwE~hi$xeIpJRnX*lOjy_dle76=BD0aP)lE_3JgPS+?Krb|Dc-09F)b z`FIS!&*$s)av6Z98i=SsBP+LffJmSSfT0ve%7hUZ*MKZSmYy9z8Gc_?pIeF;0t2C# zrBTJA6oLaNGLC$VQxs*{wqc5+Uvmj!d49Xy?_nyG;hvf!vDGHZK!o41 Date: Fri, 9 Apr 2021 22:10:10 +0000 Subject: [PATCH 45/51] Add stripped jungle textures --- .../textures/mcl_core_stripped_jungle_side.png | Bin 0 -> 415 bytes .../textures/mcl_core_stripped_jungle_top.png | Bin 0 -> 480 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_side.png create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_top.png diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_jungle_side.png new file mode 100644 index 0000000000000000000000000000000000000000..74f9f03d5e667b53454ffc28375b10408cf54135 GIT binary patch literal 415 zcmV;Q0bu@#P)6D3|;pIK0!~>>+~KyL~hV^ARrenyomw^iGcB@ z-BjvWY0|&(AdUX~nLoaJdwu!ZEaw314o3jCMUJtKx+-b=fqm2Q^!NaP%pJWa3kTt$ zMB5Jl%(R}Iuk<3uDox%j=NRi^EDHpj{P~w4uo>$})vWYlQq5S$?r@wa%VhQNO{=A*IS0ZHqj{N+vz8?6D-2_EWv~DM0c}Y{ zK~zY`#Z^110znWQMMRJhMBPMCbU`rQ8yFcHc?7THJv_li-e6)uSVh6a4}yarCcdax zsd~y-_!UJ*KYSn7_y4$VSE0uhmrp{%V zG3Bzg)`sU*eVi*Pz$EE(8VzI4XYcR#u;6mJULTJ+@Mts`MA7FPGm(G*12>!2R;$K1 zx8GkbTAAJMdVM@XAe@78OrXdF6flV47lqV512aKMfQj&0?JpM2ZMUJ40Or{VTEIO- zqM8NV5VOGf+%na=B2P04DkVS+Qa_*GdmrX0*Kid09l(uQQUm}I%6`grtJP+6I2bb= z_WSMjFYf>+vb1UH+&cjtHf1{i%Nbz*a}Oc$c$_40tnJ6~et{?oTP1DCQ~d42!o$n^ zatOH)W&r!sX_EAMc_F@ua?RH^RFXnMR)&eOf(*=r<+p&9;6xCD8 Date: Fri, 9 Apr 2021 22:10:47 +0000 Subject: [PATCH 46/51] Add stripped oak textures --- .../textures/mcl_core_stripped_oak_side.png | Bin 0 -> 551 bytes .../textures/mcl_core_stripped_oak_top.png | Bin 0 -> 523 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_side.png create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_top.png diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_side.png new file mode 100644 index 0000000000000000000000000000000000000000..3bdffd76e14a9a256975620422c6830b37462408 GIT binary patch literal 551 zcmV+?0@(eDP)6Br&{$HEsX^0kla( zK~zY`V@!DCf5(3R|Njg)fY~b58KP4W{8M4KGhSyS#Ldi9R76A=7^Wy}cex(Uz#!Dd zQ_t3hQ2(y#OXII92AqHe#>jc#xkqy)LIP&sojcE;fBcBsfK#XL+tE`ORGukr zQphntqLK++BaB9OIeHYq(gKVo7r-3=i)-{a&tB-cT5}g}1JE6Y%N!UuJ@t0w>nJP^ zz!lW6s6me+bc+cAbc-?40I6~Q`t`?;U%xUi+`s?&_4n_HxW=Xb|3QZL41#!~0GE$& zr46{n1OTjDfR`I+ro=y8r-0HO2I)e~I~z=94vwUe6qaV1KE8{%49d8RXp9g*FS%eK+|a6AKAM3cqQI&{-U~BIh)uLGb?E8|hQKbd zOW&W{Ffh2f>gh>HFfja|0F4p`>`?$O0bzhZ9f462;sU#OU%K?-1@2msP)HEW1%zrn pbO$OO6aB!o6%jRr5*@Ch8vr(5L|EFRL-_yz002ovPDHLkV1kGx<`@6~ literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_oak_top.png new file mode 100644 index 0000000000000000000000000000000000000000..b07c726135d63653bd14fac277ed3f4f66cfd957 GIT binary patch literal 523 zcmV+m0`&cfP)6B>{s$G=l&D0hmcd zK~y-)rIRsF+fWpRzgQ;1wGll-+YT{u~2S_lyjc=tPz%QczHp zgh-DJ&yooWRq254l?~arizPqb<8!`yU+p40f8`V91Jr%5^77=c$@BJw$ucMF#f%p@ z`}I9;@7I;@wtxS<2}otV7yuK6SXZ!L-veO2e&WaJHxd&tvl{>v^L8~~Uf(fZ(I&}}PZ>k5tNm8lCP8JWZpR}$Amp)Q$M-YOy8Pg|HM)M*SyD{iKb>cYB0 zdukWi`D@+x`2Mw_cHh$$Hd4Z@au+7coXIl(Fw)z5KJ0(FYM;H%{{im@)*MZ?;pYGV N002ovPDHLkV1mUX;dB51 literal 0 HcmV?d00001 From c73cd8b8109c847914181ed14824432d6c385067 Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 9 Apr 2021 22:11:32 +0000 Subject: [PATCH 47/51] Add stripped spruce textures --- .../textures/mcl_core_stripped_spruce_side.png | Bin 0 -> 447 bytes .../textures/mcl_core_stripped_spruce_top.png | Bin 0 -> 556 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_side.png create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_top.png diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_side.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_side.png new file mode 100644 index 0000000000000000000000000000000000000000..11ea15bebbad35c0a09c692a42104d22382c31b1 GIT binary patch literal 447 zcmV;w0YLtVP)6F$+yP3djHe0Zd6m zK~y-)eN!=ugD@Cn(DFHykQT21UpXyqtJH67Hpx32J5l;A~zOv8BD705oJRN6ie6y7&50XsDSzB@j)! zs-}Y!8dZMmGlv^fsB1!Ruy`}ybu%1E$J8m7fL^?p8@ zbb$?4GecRVh(o>^sx3nUDYO^m>*=r=DqFkpfHad2pWnac-d&KJ7b%{M`7kZsHLd@N p-J|ZkH{p1&^$y63M23!;RDYjnz-)+rfsX(H002ovPDHLkV1l;oxO4yj literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_top.png b/mods/ITEMS/mcl_core/textures/mcl_core_stripped_spruce_top.png new file mode 100644 index 0000000000000000000000000000000000000000..7699612b6bf2721104c69d9318710f7723554e40 GIT binary patch literal 556 zcmV+{0@MA8P)6F%~X7W)T1Y0l7&; zK~zY`#Z^6P!e9_SYeEu2tOnCMC~+6GgHVueb#Ulk@LzUtNH>>)LoK)~W@-JXABcu3 zb|{YtmmIozOY$b~-92~DbMKpKw_B}7<9MVinSz(Y(?0v#k~ii)&8^`Pxvp(nR`~tn zcD((5BzjnujJtQD(P%zjufzX8)s3-j#^a^C%0lf#07!{?z2R^&A#&?>*>b{tNR%U! z43CIhGRTSpbeA?+5nvq94F|vj@PyoIwNfdcKi_I8u5!-NaWWZQmx1*Ah*HjapDCi=URlsmr}xk zNO5BTc&jACf8{xSe|!l$2Y-lGq7MF=rfG^25g}J60-yp=!2?U0K_UQ>G<5=iIR;k} z6#%k-JA9>H!!>~7$rAyPIEI{4u3||Oe9bk`Y*s48Vp!No?3a!qDwM{Jb1qE}fQeHe zshkJo=6QpG?-Oa7s;VkcpU8Sb*YO{5$$m7v_+GvM0000 Date: Fri, 9 Apr 2021 22:13:50 +0000 Subject: [PATCH 48/51] Add stripped wood crafting --- mods/ITEMS/mcl_core/crafting.lua | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index a0ad38a77..7a2b6a5c8 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -46,6 +46,56 @@ minetest.register_craft({ } }) +-- Stripped Bark +minetest.register_craft({ + output = "mcl_core:stripped_oak_bark 3", + recipe = { + { "mcl_core:stripped_oak", "mcl_core:stripped_oak" }, + { "mcl_core:stripped_oak", "mcl_core:stripped_oak" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_acacia_bark 3", + recipe = { + { "mcl_core:stripped_acacia", "mcl_core:stripped_acacia" }, + { "mcl_core:stripped_acacia", "mcl_core:stripped_acacia" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_dark_oak_bark 3", + recipe = { + { "mcl_core:stripped_dark_oak", "mcl_core:stripped_dark_oak" }, + { "mcl_core:stripped_dark_oak", "mcl_core:stripped_dark_oak" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_birch_bark 3", + recipe = { + { "mcl_core:stripped_birch", "mcl_core:stripped_birch" }, + { "mcl_core:stripped_birch", "mcl_core:stripped_birch" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_spruce_bark 3", + recipe = { + { "mcl_core:stripped_spruce", "mcl_core:stripped_spruce" }, + { "mcl_core:stripped_spruce", "mcl_core:stripped_spruce" }, + } +}) + +minetest.register_craft({ + output = "mcl_core:stripped_jungle_bark 3", + recipe = { + { "mcl_core:stripped_jungle", "mcl_core:stripped_jungle" }, + { "mcl_core:stripped_jungle", "mcl_core:stripped_jungle" }, + } +}) + + minetest.register_craft({ type = 'shapeless', output = 'mcl_core:mossycobble', From 652f8d48ed1d4a8834aa410ef31ce893b1714b54 Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 9 Apr 2021 22:16:52 +0000 Subject: [PATCH 49/51] Debark wood with an axe --- mods/ITEMS/mcl_tools/init.lua | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index b50782ec4..2d804b9bc 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -352,6 +352,56 @@ minetest.register_tool("mcl_tools:shovel_diamond", { }) -- Axes + +local make_stripped_trunk = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local pos = minetest.get_pointed_thing_position(pointed_thing) + local node = minetest.get_node(pos) + local node_name = node.name + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_name] and minetest.registered_nodes[node_name].on_rightclick then + return minetest.registered_nodes[node_name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then + minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + -- Add wear (as if digging a axey node) + local toolname = itemstack:get_name() + local wear = mcl_autogroup.get_wear(toolname, "axey") + itemstack:add_wear(wear) + end + if node_name == "mcl_core:tree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak"}) + elseif node_name == "mcl_core:darktree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak"}) + elseif node_name == "mcl_core:acaciatree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia"}) + elseif node_name == "mcl_core:birchtree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch"}) + elseif node_name == "mcl_core:sprucetree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce"}) + elseif node_name == "mcl_core:jungletree" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle"}) + elseif node_name == "mcl_core:tree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak_bark"}) + elseif node_name == "mcl_core:darktree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak_bark"}) + elseif node_name == "mcl_core:acaciatree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia_bark"}) + elseif node_name == "mcl_core:birchtree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch_bark"}) + elseif node_name == "mcl_core:sprucetree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce_bark"}) + elseif node_name == "mcl_core:jungletree_bark" then + minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"}) + end + end + return itemstack +end + minetest.register_tool("mcl_tools:axe_wood", { description = S("Wooden Axe"), _doc_items_longdesc = axe_longdesc, @@ -365,6 +415,7 @@ minetest.register_tool("mcl_tools:axe_wood", { damage_groups = {fleshy=7}, punch_attack_uses = 30, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "group:wood", _mcl_toollike_wield = true, @@ -384,6 +435,7 @@ minetest.register_tool("mcl_tools:axe_stone", { damage_groups = {fleshy=9}, punch_attack_uses = 66, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:cobble", _mcl_toollike_wield = true, @@ -404,6 +456,7 @@ minetest.register_tool("mcl_tools:axe_iron", { damage_groups = {fleshy=9}, punch_attack_uses = 126, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:iron_ingot", _mcl_toollike_wield = true, @@ -423,6 +476,7 @@ minetest.register_tool("mcl_tools:axe_gold", { damage_groups = {fleshy=7}, punch_attack_uses = 17, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:gold_ingot", _mcl_toollike_wield = true, @@ -442,6 +496,7 @@ minetest.register_tool("mcl_tools:axe_diamond", { damage_groups = {fleshy=9}, punch_attack_uses = 781, }, + on_place = make_stripped_trunk, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:diamond", _mcl_toollike_wield = true, From cdd12a0c713653367238c02c3524b1876e046587 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 10 Apr 2021 11:19:51 +0000 Subject: [PATCH 50/51] Charcoal made from debarked wood --- mods/ITEMS/mcl_core/nodes_trees.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index 4c097bad6..4af3eef34 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -56,7 +56,7 @@ minetest.register_node("mcl_core:stripped_oak", { is_ground_content = false, paramtype2 = "facedir", on_place = mcl_util.rotate_axis, - groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_blast_resistance = 10, _mcl_hardness = 2, @@ -69,7 +69,7 @@ minetest.register_node("mcl_core:stripped_acacia", { is_ground_content = false, paramtype2 = "facedir", on_place = mcl_util.rotate_axis, - groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_blast_resistance = 10, _mcl_hardness = 2, @@ -82,7 +82,7 @@ minetest.register_node("mcl_core:stripped_dark_oak", { is_ground_content = false, paramtype2 = "facedir", on_place = mcl_util.rotate_axis, - groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_blast_resistance = 10, _mcl_hardness = 2, @@ -95,7 +95,7 @@ minetest.register_node("mcl_core:stripped_birch", { is_ground_content = false, paramtype2 = "facedir", on_place = mcl_util.rotate_axis, - groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_blast_resistance = 10, _mcl_hardness = 2, @@ -108,7 +108,7 @@ minetest.register_node("mcl_core:stripped_spruce", { is_ground_content = false, paramtype2 = "facedir", on_place = mcl_util.rotate_axis, - groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_blast_resistance = 10, _mcl_hardness = 2, @@ -121,7 +121,7 @@ minetest.register_node("mcl_core:stripped_jungle", { is_ground_content = false, paramtype2 = "facedir", on_place = mcl_util.rotate_axis, - groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, + groups = {handy=1,axey=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5, tree=1}, sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_blast_resistance = 10, _mcl_hardness = 2, From 08b7340ff5999abfc5508583c36d4ae2381acde9 Mon Sep 17 00:00:00 2001 From: epCode Date: Sat, 10 Apr 2021 10:20:38 -0700 Subject: [PATCH 51/51] Fix crash with player near unknown object --- mods/PLAYER/mcl_playerplus/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index a9f6bd5a1..82b681f6d 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -32,8 +32,8 @@ local player_collision = function(player) for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do - if object:is_player() - or (object:get_luaentity()._cmi_is_mob == true and object ~= player) then + if object and (object:is_player() + or (object:get_luaentity()._cmi_is_mob == true and object ~= player)) then local pos2 = object:get_pos() local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}