Skip to content

Commit

Permalink
Dungeons: add Dead Man spawn in rooms with chests. Relates to #1213
Browse files Browse the repository at this point in the history
  • Loading branch information
alek13 committed Jan 27, 2024
1 parent a01e110 commit c6bf5cc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 5 additions & 4 deletions mods/lord/Entities/lottmobs/spawn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mods/lord/Tools/tools/special.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
})
Expand Down
13 changes: 10 additions & 3 deletions mods/lord/World/Generation/buildings/src/dungeons/interior.lua
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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

Expand All @@ -109,21 +111,26 @@ 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[]
--- @param rooms_walls RoomWalls[]
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


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
}

0 comments on commit c6bf5cc

Please sign in to comment.