Add a bunch of new rooms

This commit is contained in:
Wuzzy 2019-08-20 00:27:25 +02:00
parent e91b61f849
commit 7aadb0f0ac
2 changed files with 607 additions and 32 deletions

View File

@ -1,3 +1,5 @@
local S = minetest.get_translator("tsm_pyramids")
tsm_pyramids = {}
dofile(minetest.get_modpath("tsm_pyramids").."/mummy.lua")
@ -105,7 +107,6 @@ local function make(pos, brick, sandstone, stone, sand, ptype)
end
tsm_pyramids.make_room(pos, ptype)
minetest.after(2, tsm_pyramids.make_traps, pos, ptype)
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17})
make_entrance({x=pos.x,y=pos.y, z=pos.z}, brick)
end
@ -213,3 +214,25 @@ if minetest.get_modpath("pyramids") == nil then
-- FIXME: Entities are currently NOT backwards-compatible
-- TODO: Update README when full backwards-compability is achieved
end
minetest.register_chatcommand("spawnpyramid", {
description = S("Generate a pyramid"),
params = "",
privs = { server = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if not player then
return false, S("No player.")
end
local pos = player:get_pos()
pos = vector.round(pos)
local r = math.random(1,2)
if r == 1 then
make(pos, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone")
else
make(pos, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert")
end
return true, S("Pyramid generated at @1.", minetest.pos_to_string(pos))
end,
}
)

614
room.lua
View File

@ -1,27 +1,563 @@
local layout_room = {
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
" ","s"," ","s"," ","s"," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ", -- << entrance on left side
" "," "," "," "," "," "," "," "," ",
" ","s"," ","s"," ","s"," ","s"," ",
" ","c"," ","c"," ","c"," ","c"," ",
" "," "," "," "," "," "," "," "," "
}
local layout_traps = {
"S","S","S","S","S","S","S","S","S",
"~","S","~","S","~","S","~","S","S",
"~","S","~","S","~","S","~","S","S",
"~","S","~","~","~","S","~","~","S",
"~","~","S","~","S","~","~","S","S", -- << entrance on left side
"~","S","~","~","~","~","~","~","S",
"~","S","~","S","~","S","~","S","S",
"~","S","~","S","~","S","~","S","S",
"S","S","S","S","S","S","S","S","S"
-- ROOM LAYOUTS
local room_types = {
--[[
-- Empty room
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," "
},
},
]]
-- Pillar room
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
" ","s"," ","s"," ","s"," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","s"," ","s"," ","s"," ","s"," ",
" ","c"," ","c"," ","c"," ","c"," ",
" "," "," "," "," "," "," "," "," "
},
traps = true,
},
-- Hieroglyph walls
{
style = "yrepeat",
layout = {
"s","s","s","s","s","s","s","s","s",
"s"," "," "," "," "," "," "," ","s",
"s"," "," "," "," "," "," "," ","s",
"s"," "," "," "," "," "," "," ","s",
" "," "," "," ","c"," "," "," ","s",
"s"," "," "," "," "," "," "," ","s",
"s"," "," "," "," "," "," "," ","s",
"s"," "," "," "," "," "," "," ","s",
"s","s","s","s","s","s","s","s","s"
},
},
-- 4 large pillars
{
style = "yrepeat",
layout = {
" "," "," "," ","c"," "," "," "," ",
" ","s","s"," "," "," ","s","s"," ",
" ","s","s"," "," "," ","s","s"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," "," ",
" ","s","s"," "," "," ","s","s"," ",
" ","s","s"," "," "," ","s","s"," ",
" "," "," "," ","c"," "," "," "," "
},
},
-- hidden room
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","s","S","s","S","s"," "," ",
" "," ","S"," "," "," ","S"," "," ",
" "," ","s"," ","c"," ","s"," ","c",
" "," ","S"," "," "," ","S"," "," ",
" "," ","s","S","s","S","s"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," "
},
},
-- spiral 1
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","S","S","S","S","S","S","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S"," ","s","s","s"," ","S"," ",
" ","S"," ","s","c","s"," ","S"," ",
"S","S"," ","s"," ","s"," ","S"," ",
"S","S"," ","s"," "," "," ","S"," ",
"c","S"," ","S","S","S","S","S"," ",
" ","S"," "," "," "," "," "," "," "
},
},
-- spiral 2
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","S","S","S","S","S","S","S"," ",
" "," "," ","s"," "," "," ","S"," ",
"S","S"," ","s"," ","s"," ","S"," ",
" ","S"," ","s","c","s"," ","S"," ",
" ","S"," ","s","s","s"," ","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S","S","S","S","S","S","S"," ",
" "," "," "," "," "," "," "," "," "
},
},
-- pillar mania
{
style = "yrepeat",
layout = {
" "," ","c"," ","c"," ","c"," ","c",
" ","s"," ","s"," ","s"," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" ","s"," ","s"," ","s"," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" ","s"," ","s"," ","s"," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" ","s"," ","s"," ","s"," ","s"," ",
" "," ","c"," ","c"," ","c"," ","c",
},
traps = true,
},
-- plusses
{
style = "yrepeat",
layout = {
"s"," "," "," "," "," "," "," ","s",
" "," ","s","c"," ","c","s"," "," ",
" ","s","s","s"," ","s","s","s"," ",
" "," ","s"," "," "," ","s"," "," ",
" "," "," "," ","c"," "," "," "," ",
" "," ","s"," "," "," ","s"," "," ",
" ","s","s","s"," ","s","s","s"," ",
" "," ","s","c"," ","c","s"," "," ",
"s"," "," "," "," "," "," "," ","s",
},
traps = true,
},
-- diamond
{
style = "yrepeat",
layout = {
"c","s","s","s","s","s","s","s","s",
"s","s","s"," "," "," ","s","s","s",
"s","s"," "," "," "," "," ","s","s",
"s"," "," "," "," "," "," "," ","s",
" "," "," "," "," "," "," ","c","s",
"s"," "," "," "," "," "," "," ","s",
"s","s"," "," "," "," "," ","s","s",
"s","s","s"," "," "," ","s","s","s",
"c","s","s","s","s","s","s","s","s",
},
traps = true,
},
-- hallway
{
style = "yrepeat",
layout = {
"S"," "," "," "," ","S","S","S"," ",
"S","c","c","S"," ","S","S","c"," ",
"S","S","S","S"," ","S","S","c"," ",
"S","S","S","S"," ","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
" ","S","S","S"," ","S","S","S","S",
" ","c","S","S"," ","S","S","S","S",
" ","c","S","S"," ","S","c","c","S",
" ","S","S","S"," "," "," "," "," ",
},
},
-- hallway 2
{
style = "yrepeat",
layout = {
"S","S","S","S","c"," "," "," "," ",
"S","S","S","S","S","c","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","c","S","S"," ",
"S","S","S","S","c"," "," "," "," ",
},
},
-- hallway 3
{
style = "yrepeat",
layout = {
"S","S","S","S","S"," "," "," "," ",
"S","S","S","S","s","c"," "," "," ",
"S","s","S","s","S","s","S"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
"S","s","S","s","S","s","S"," "," ",
"S","S","S","S","s","c"," "," "," ",
"S","S","S","S","S"," "," "," "," ",
},
},
-- hallway 4
{
style = "yrepeat",
layout = {
"S","S","S","S","S","c","S","S","S",
"S","S","S","S","S","S","S","S","S",
"s","S","s","S","s","S","s","S","s",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," "," ",
"s","S","s","S","s","S","s","S","s",
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","c","S","S","S",
},
},
-- tiny
{
style = "yrepeat",
layout = {
"S","S","S","S","S","S","S","S","c",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S"," "," "," ","S","S"," ",
" "," "," "," ","c"," ","S","S"," ",
"S","S","S"," "," "," ","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S","c",
},
},
-- small
{
style = "yrepeat",
layout = {
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
"S","S"," ","c"," ","c"," ","S","S",
"S","S","c"," "," "," ","c","S"," ",
" "," "," "," ","s"," "," ","S"," ",
"S","S","c"," "," "," ","c","S"," ",
"S","S"," ","c"," ","c"," ","S","S",
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
},
},
-- small 2
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","S","S","S","S","S","S","S"," ",
" ","S"," "," ","c"," "," ","S"," ",
"S","S"," "," "," "," "," ","S"," ",
" "," "," "," "," "," ","c","S"," ",
"S","S"," "," "," "," "," ","S"," ",
" ","S"," "," ","c"," "," ","S"," ",
" ","S","S","S","S","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- simple
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," ","c",
},
},
-- big pillar
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","c"," "," "," "," ",
" "," "," ","s","s","s"," "," "," ",
" "," ","c","s","S","s","c"," "," ",
" "," "," ","s","s","s"," "," "," ",
" "," "," "," ","c"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
traps = true,
},
-- pacman
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," ","s","s","s"," "," "," ",
" "," ","s","s","c","s","s"," "," ",
" "," ","s","c"," "," "," "," "," ",
" "," ","s","s","c","s","s"," "," ",
" "," "," ","s","s","s"," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- the wall
{
style = "yrepeat",
layout = {
"S","S","S","S","S","S","S"," ","c",
"s","s","s","s","s","S","S"," ","s",
"s"," "," "," "," ","s","S"," ","c",
"s"," "," "," "," ","s","S"," ","s",
" "," "," "," ","c","s","S"," ","c",
"s"," "," "," "," ","s","S"," ","s",
"s"," "," "," "," ","s","S"," ","c",
"s","s","s","s","s","s","S"," ","s",
"S","S","S","S","S","S","S"," ","c",
},
},
-- split
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," ","c"," ","c"," "," "," ",
" "," "," ","s"," ","s"," "," "," ",
" "," "," ","c"," ","c"," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- 4 small pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","c"," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","c","s"," "," "," ","s","c"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," ","c"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- 6 pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," ","c"," ","c"," ","c"," "," ",
" "," ","s"," ","s"," ","s"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","s"," ","s"," ","s"," "," ",
" "," ","c"," ","c"," ","c"," "," ",
" "," "," "," "," "," "," "," "," ",
},
traps = true,
},
-- stripes
{
style = "yrepeat",
layout = {
" ","S","c","S","c","S","c","S","c",
" ","S"," ","S"," ","S"," ","S"," ",
" ","s"," ","s"," ","s"," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","s"," ","s"," ","s"," ","s"," ",
" ","S"," ","S"," ","S"," ","S"," ",
" ","S","c","S","c","S","c","S","c",
},
},
-- inside
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","s"," "," "," "," "," ","s"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," ","s","S","s"," "," "," ",
" "," "," ","S","c"," "," "," "," ",
" "," "," ","s","S","s"," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","s"," "," "," "," "," ","s"," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- 1 chest
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","c"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- 2 chests
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," "," "," ",
},
traps = true,
},
-- X
{
style = "yrepeat",
layout = {
"s"," "," "," "," "," "," "," ","s",
"s","s","c"," "," "," ","c","s","s",
" ","s","s"," "," "," ","s","s"," ",
" "," ","s","s"," ","s","s"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","s","s"," ","s","s"," "," ",
" ","s","s"," "," "," ","s","s"," ",
"s","s","c"," "," "," ","c","s","s",
"s"," "," "," "," "," "," "," ","s",
},
},
-- split 2
{
style = "yrepeat",
layout = {
"S","S","S","S","S","S","S","S","S",
"S","S","S"," "," "," "," "," "," ",
"S","S","S"," "," "," "," "," "," ",
"S","S","S"," "," ","c","c","c","c",
" "," "," "," "," ","s","s","s","s",
"S","S","S"," "," ","c","c","c","c",
"S","S","S"," "," "," "," "," "," ",
"S","S","S"," "," "," "," "," "," ",
"S","S","S","S","S","S","S","S","S",
},
},
-- split 3
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
" ","s"," ","s"," ","s"," ","s"," ",
" ","c"," ","c"," ","c"," ","c"," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- diamond 2
{
style = "yrepeat",
layout = {
"S","S"," "," "," "," "," ","S","S",
"S"," "," "," ","s"," "," "," ","S",
" "," ","c","S","S","S","c"," "," ",
" "," ","S","S","S","S","S"," "," ",
" ","s","S","S","S","S","S","s"," ",
" "," ","S","S","S","S","S"," "," ",
" "," ","c","S","S","S","c"," "," ",
"S"," "," "," ","s"," "," "," ","S",
"S","S"," "," "," "," "," ","S","S",
},
},
-- ultra pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","s","c","s"," ","s","c","s"," ",
" ","s","s","s"," ","s","s","s"," ",
" ","s","s","s"," ","s","s","s"," ",
" "," "," "," "," "," "," "," "," ",
" ","s","s","s"," ","s","s","s"," ",
" ","s","s","s"," ","s","s","s"," ",
" ","s","c","s"," ","s","c","s"," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- vstripes
{
style = "yrepeat",
layout = {
"S"," "," "," "," "," "," "," "," ",
"S"," "," ","c"," "," ","c"," "," ",
"S"," "," ","s"," "," ","s"," "," ",
"S"," "," "," "," "," "," "," "," ",
" "," "," ","s"," "," ","s"," "," ",
"S"," "," "," "," "," "," "," "," ",
"S"," "," ","s"," "," ","s"," "," ",
"S"," "," ","c"," "," ","c"," "," ",
"S"," "," "," "," "," "," "," "," ",
},
},
-- sides
{
style = "yrepeat",
layout = {
"s"," ","s"," ","s"," ","s"," ","s",
" "," ","c"," ","c"," ","c"," "," ",
"s"," "," "," "," "," "," "," ","s",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","s",
" "," "," "," "," "," "," "," "," ",
"s"," "," "," "," "," "," "," ","s",
" "," ","c"," ","c"," ","c"," "," ",
"s"," ","s"," ","s"," ","s"," ","s",
},
traps = true,
},
-- 9 pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," ","c"," ","c"," ","c"," "," ",
" "," ","s"," ","s"," ","s"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","s"," ","s"," ","s"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","s"," ","s"," ","s"," "," ",
" "," ","c"," ","c"," ","c"," "," ",
" "," "," "," "," "," "," "," "," ",
},
traps = true,
},
}
local layout_traps
local layout_traps_template = {
"S","S","S","S","S","S","S","S","S",
"?","S","?","S","?","S","?","S","S",
@ -85,18 +621,34 @@ function tsm_pyramids.make_room(pos, stype)
table.remove(deco_ids, r)
end
local hole = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
for iy=0,4,1 do
for ix=0,8,1 do
for iz=0,8,1 do
local n_str = layout_room[tonumber(ix*9+iz+1)]
local p2 = 0
if n_str == "c" then
if ix < 3 then p2 = 1 else p2 = 3 end
tsm_pyramids.fill_chest({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz})
local r = math.random(1, #room_types)
local room = room_types[r]
if room.style == "yrepeat" then
for iy=0,4,1 do
for ix=0,8,1 do
for iz=0,8,1 do
local n_str = room.layout[tonumber(ix*9+iz+1)]
local p2 = 0
if n_str == "c" then
if ix < 4 then p2 = 1
elseif ix == 4 and iz == 0 then
p2 = 2
elseif ix == 4 and iz > 0 then
p2 = 0
else
p2 = 3
end
tsm_pyramids.fill_chest({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz})
end
minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace(n_str, iy, code_table, deco), param2=p2})
end
minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace(n_str, iy, code_table, deco), param2=p2})
end
end
else
minetest.log("error", "Invalid pyramid room style! room_types index="..r)
end
if room.traps then
tsm_pyramids.make_traps(pos, stype)
end
end