From c6bf5ccb842031ebeffaa0a9561c676d03689a1a Mon Sep 17 00:00:00 2001 From: alek13 Date: Sat, 27 Jan 2024 05:46:42 +0300 Subject: [PATCH] Dungeons: add Dead Man spawn in rooms with chests. Relates to #1213 --- mods/lord/Entities/lottmobs/spawn.lua | 9 +++++---- mods/lord/Tools/tools/special.lua | 2 +- .../Generation/buildings/src/dungeons/interior.lua | 13 ++++++++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mods/lord/Entities/lottmobs/spawn.lua b/mods/lord/Entities/lottmobs/spawn.lua index 9c499c411..075677382 100644 --- a/mods/lord/Entities/lottmobs/spawn.lua +++ b/mods/lord/Entities/lottmobs/spawn.lua @@ -34,6 +34,7 @@ mobs:spawn_specific("lottmobs:rat", {"lottmapgen:gondor_grass"}, {"air"}, -1, 2 mobs:spawn_specific("lottmobs:rat", {"lottmapgen:dunland_grass"}, {"air"}, -1, 20, 30, 9000, 2, 0, 31000) mobs:spawn_specific("lottmobs:rat", {"lottmapgen:rohan_grass"}, {"air"}, -1, 20, 30, 9000, 2, 0, 31000) mobs:spawn_specific("lottmobs:rat", {"lottmapgen:shire_grass"}, {"air"}, -1, 20, 30, 7500, 2, 0, 31000) +mobs:spawn_specific("lottmobs:rat", {"default:stone"}, {"air"}, -1, 8, 30, 6000, 2, -31000, 0) mobs:spawn_specific("lottmobs:kitten", {"lottmapgen:gondor_grass"}, {"air"}, -1, 20, 30, 9000, 2, 0, 31000) mobs:spawn_specific("lottmobs:kitten", {"lottmapgen:dunland_grass"}, {"air"}, -1, 20, 30, 9000, 2, 0, 31000) @@ -100,13 +101,13 @@ mobs:spawn_specific("lottmobs:half_troll", {"default:snowblock"}, {"air"}, mobs:spawn_specific("lottmobs:half_troll", {"default:dirt_with_snow"}, {"air"}, -1, 15, 30, 12000, 2, 0, 31000) mobs:spawn_specific("lottmobs:half_troll", {"lottmapgen:angsnowblock"}, {"air"}, -1, 20, 30, 9000, 3, 0, 31000) -mobs:spawn_specific("lottmobs:nazgul", {"default:stone"}, {"air"}, -1, 2, 30, 30000, 2, -31000, -50) +mobs:spawn_specific("lottmobs:nazgul", {"default:stone"}, {"air"}, -1, 2, 30, 30000, 2, -31000, -100) -mobs:spawn_specific("lottmobs:witch_king", {"default:stone"}, {"air"}, -1, 2, 30, 60000, 1, -31000, -1000) +mobs:spawn_specific("lottmobs:witch_king", {"default:stone"}, {"air"}, -1, 2, 30, 60000, 1, -31000, -1000) -mobs:spawn_specific("lottmobs:balrog", {"default:stone"}, {"air"}, -1, 2, 30, 100000, 1, -31000, -10000) +mobs:spawn_specific("lottmobs:balrog", {"default:stone"}, {"air"}, -1, 2, 30, 100000, 1, -31000, -10000) -mobs:spawn_specific("lottmobs:dead_men", {"default:mossycobble"}, {"air"}, -1, 15, 15, 1, 5, -31000, -50) +mobs:spawn_specific("lottmobs:dead_men", {"default:mossycobble"}, {"air"}, -1, 7, 15, 2, 5, -31000, -50) mobs:spawn_specific("lottmobs:troll", {"default:stone"}, {"air"}, -1, 5, 30, 12000, 3, -31000, -10) mobs:spawn_specific("lottmobs:troll", {"default:snow"}, {"air"}, -1, 2, 30, 9000, 3, -31000, 31000) diff --git a/mods/lord/Tools/tools/special.lua b/mods/lord/Tools/tools/special.lua index 7edb9f4b4..9215a6b3d 100644 --- a/mods/lord/Tools/tools/special.lua +++ b/mods/lord/Tools/tools/special.lua @@ -9,7 +9,7 @@ minetest.register_tool("tools:sword_elven", { groupcaps={ snappy={times={[1]=1.60, [2]=1.30, [3]=0.90}, uses=50, maxlevel=3}, }, - damage_groups = {fleshy=7.5, soulful = 6}, + damage_groups = {fleshy=7.5, soulful = 3}, }, groups = {bronze_item = 1}, }) diff --git a/mods/lord/World/Generation/buildings/src/dungeons/interior.lua b/mods/lord/World/Generation/buildings/src/dungeons/interior.lua index fc2f0b6e9..b3ff6c55a 100644 --- a/mods/lord/World/Generation/buildings/src/dungeons/interior.lua +++ b/mods/lord/World/Generation/buildings/src/dungeons/interior.lua @@ -1,7 +1,8 @@ local pairs, math_random, table_is_empty, vector_new, id = pairs, math.random, table.is_empty, vector.new, minetest.get_content_id -local INTERIOR_CHANCE = 3 +local INTERIOR_CHANCE = 3 +local INTERIOR_Y_MAX = -50 local c_air = id("air") local c_ignore = id("ignore") @@ -100,7 +101,8 @@ function Interior:place_south_wall_torches(wall) end --- @param room_walls RoomWalls list of room walls -function Interior:place_room_interior(room_walls) +--- @param room_center Position +function Interior:place_room_interior(room_walls, room_center) local north_wall = room_walls.north local south_wall = room_walls.south @@ -109,6 +111,8 @@ function Interior:place_room_interior(room_walls) self:place_north_wall_torches(north_wall) self:place_south_wall_torches(south_wall) + + minetest.add_entity(room_center, "lottmobs:dead_men") end --- @param rooms_centers Position[] @@ -116,7 +120,7 @@ end function Interior:generate(rooms_centers, rooms_walls) for i, room_center in pairs(rooms_centers) do if (math_random(INTERIOR_CHANCE) == 1 and not table_is_empty(rooms_walls[i])) then - self:place_room_interior(rooms_walls[i]) + self:place_room_interior(rooms_walls[i], room_center) end end end @@ -124,6 +128,9 @@ end return { on_dungeon_generated = function(minp, maxp, data, param2_data, area, rooms_centers, rooms_walls) + if maxp.y > INTERIOR_Y_MAX then + return + end Interior:new(data, param2_data, area):generate(rooms_centers, rooms_walls) end }