tsm_pyramids/room.lua

1175 lines
33 KiB
Lua
Raw Permalink Normal View History

local S = minetest.get_translator("tsm_pyramids")
2019-08-20 00:27:25 +02:00
-- ROOM LAYOUTS
2019-08-22 14:50:26 +02:00
local ROOM_WIDTH = 9
2019-08-20 00:27:25 +02:00
local room_types = {
-- Pillar room
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" ","^"," ","^"," ","^"," ","^"," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:43:04 +02:00
" ","v"," ","v"," ","v"," ","v"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," "
},
traps = true,
},
-- Hieroglyph walls
{
style = "yrepeat",
layout = {
2019-08-24 17:14:08 +02:00
"s","h","h","h","h","h","h","h","s",
"h"," "," "," "," "," "," "," ","h",
"h"," "," "," "," "," "," "," ","h",
"h"," "," "," "," "," "," "," ","h",
" "," "," "," ","<"," "," "," ","h",
"h"," "," "," "," "," "," "," ","h",
"h"," "," "," "," "," "," "," ","h",
"h"," "," "," "," "," "," "," ","h",
"s","h","h","h","h","h","h","h","s"
2019-08-20 00:27:25 +02:00
},
},
-- 4 large pillars
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
" "," "," "," ","v"," "," "," "," ",
" ","c","c"," "," "," ","c","c"," ",
" ","c","c"," "," "," ","c","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," "," "," "," "," ","<",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","c","c"," "," "," ","c","c"," ",
" ","c","c"," "," "," ","c","c"," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","^"," "," "," "," "
2019-08-20 00:27:25 +02:00
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- hidden room
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","c","S","c","S","c"," "," ",
2019-08-20 00:27:25 +02:00
" "," ","S"," "," "," ","S"," "," ",
" "," ","c"," ",">"," ","c"," ","<",
2019-08-20 00:27:25 +02:00
" "," ","S"," "," "," ","S"," "," ",
" "," ","c","S","c","S","c"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," "
},
},
-- spiral 1
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","S","S","S","S","S","S","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S"," ","c","c","c"," ","S"," ",
" ","S"," ","c","v","c"," ","S"," ",
"S","S"," ","c"," ","c"," ","S"," ",
"S","S"," ","c"," "," "," ","S"," ",
2019-08-20 00:43:04 +02:00
"v","S"," ","S","S","S","S","S"," ",
2019-08-20 00:27:25 +02:00
" ","S"," "," "," "," "," "," "," "
},
},
-- spiral 2
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","S","S","S","S","S","S","S"," ",
" "," "," ","c"," "," "," ","S"," ",
"S","S"," ","c"," ","c"," ","S"," ",
" ","S"," ","c","^","c"," ","S"," ",
" ","S"," ","c","c","c"," ","S"," ",
2019-08-20 00:27:25 +02:00
" ","S"," "," "," "," "," ","S"," ",
" ","S","S","S","S","S","S","S"," ",
" "," "," "," "," "," "," "," "," "
},
},
-- pillar mania
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
" "," ","v"," ","v"," ","v"," ","v",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:43:04 +02:00
" "," ","^"," ","^"," ","^"," ","^",
2019-08-20 00:27:25 +02:00
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- plusses
{
style = "yrepeat",
layout = {
"c"," "," "," "," "," "," "," ","c",
" "," ","c",">"," ","<","c"," "," ",
" ","c","s","c"," ","c","s","c"," ",
" "," ","c"," "," "," ","c"," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","<"," "," "," "," ",
" "," ","c"," "," "," ","c"," "," ",
" ","c","s","c"," ","c","s","c"," ",
" "," ","c",">"," ","<","c"," "," ",
"c"," "," "," "," "," "," "," ","c",
2019-08-20 00:27:25 +02:00
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- diamond
{
style = "yrepeat",
layout = {
">","s","s","c","c","c","s","s","s",
"s","s","c"," "," "," ","c","s","s",
"s","c"," "," "," "," "," ","c","s",
"c"," "," "," "," "," "," "," ","c",
" "," "," "," "," "," "," ","<","c",
"c"," "," "," "," "," "," "," ","c",
"s","c"," "," "," "," "," ","c","s",
"s","s","c"," "," "," ","c","s","s",
">","s","s","c","c","c","s","s","s",
2019-08-20 00:27:25 +02:00
},
},
2019-08-20 06:16:03 +02:00
-- square
2019-08-20 00:27:25 +02:00
{
style = "yrepeat",
layout = {
2019-08-20 06:16:03 +02:00
" "," "," "," "," "," "," "," "," ",
" ","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","S"," ",
" ","S","S","S","v","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:27:25 +02:00
},
},
-- hallway 2
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
"S","S","S","S",">"," "," "," "," ",
"S","S","S","S","S","^","S","S"," ",
2019-08-20 00:27:25 +02:00
"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"," ",
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","v","S","S"," ",
"S","S","S","S",">"," "," "," "," ",
2019-08-20 00:27:25 +02:00
},
},
-- hallway 3
{
style = "yrepeat",
layout = {
"S","S","S","S","S"," "," "," "," ",
"S","S","S","S","c",">"," "," "," ",
"S","c","S","c","S","c","S"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
"S","c","S","c","S","c","S"," "," ",
"S","S","S","S","c",">"," "," "," ",
2019-08-20 00:27:25 +02:00
"S","S","S","S","S"," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- hallway 4
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","v","S","S","S",
2019-08-20 00:27:25 +02:00
"S","S","S","S","S","S","S","S","S",
"c","S","c","S","c","S","c","S","c",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," "," "," "," "," ","<",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
"c","S","c","S","c","S","c","S","c",
2019-08-20 00:27:25 +02:00
"S","S","S","S","S","S","S","S","S",
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","^","S","S","S",
2019-08-20 00:27:25 +02:00
},
},
-- tiny
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","S","S","S","v",
2019-08-20 00:27:25 +02:00
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S"," "," "," ","S","S"," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","<"," ","S","S"," ",
2019-08-20 00:27:25 +02:00
"S","S","S"," "," "," ","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
"S","S","S","S","S","S","S","S"," ",
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","S","S","S","^",
2019-08-20 00:27:25 +02:00
},
},
-- small
{
style = "yrepeat",
layout = {
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
2019-08-20 00:43:04 +02:00
"S","S"," ","v"," ","v"," ","S","S",
"S","S",">"," "," "," ","<","S"," ",
" "," "," "," ","c"," "," ","S"," ",
2019-08-20 00:43:04 +02:00
"S","S",">"," "," "," ","<","S"," ",
"S","S"," ","^"," ","^"," ","S","S",
2019-08-20 00:27:25 +02:00
"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"," ",
2019-08-20 00:43:04 +02:00
" ","S"," "," ","v"," "," ","S"," ",
2019-08-20 00:27:25 +02:00
"S","S"," "," "," "," "," ","S"," ",
2019-08-20 00:43:04 +02:00
" "," "," "," "," "," ","<","S"," ",
2019-08-20 00:27:25 +02:00
"S","S"," "," "," "," "," ","S"," ",
2019-08-20 00:43:04 +02:00
" ","S"," "," ","^"," "," ","S"," ",
2019-08-20 00:27:25 +02:00
" ","S","S","S","S","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
},
},
-- big pillar
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","^"," "," "," "," ",
" "," "," ","c","c","c"," "," "," ",
" "," ","<","c","S","c",">"," "," ",
" "," "," ","c","c","c"," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","v"," "," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- pacman
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," ","c","c","c"," "," "," ",
" "," ","c","c","v","c","c"," "," ",
" "," ","c",">"," "," "," "," "," ",
" "," ","c","c","^","c","c"," "," ",
" "," "," ","c","c","c"," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- the wall
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","S","S"," ","<",
2019-08-25 00:50:22 +02:00
"s","c","s","c","s","c","s"," ","c",
"c"," "," "," "," "," ","c"," ","<",
2019-08-25 00:50:22 +02:00
"s"," "," "," "," "," ","s"," ","c",
" "," "," "," "," ","<","c"," ","<",
2019-08-25 00:50:22 +02:00
"s"," "," "," "," "," ","s"," ","c",
"c"," "," "," "," "," ","c"," ","<",
2019-08-25 00:50:22 +02:00
"s","c","s","c","s","c","s"," ","c",
2019-08-20 00:43:04 +02:00
"S","S","S","S","S","S","S"," ","<",
2019-08-20 00:27:25 +02:00
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- split
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," ","^"," ","^"," "," "," ",
" "," "," ","c"," ","c"," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," ","v"," ","v"," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- 4 small pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","^"," "," "," "," ",
" "," "," "," ","c"," "," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","<","c"," "," "," ","c",">"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","c"," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","v"," "," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- 6 pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," ","^"," ","^"," ","^"," "," ",
" "," ","c"," ","c"," ","c"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","c"," ","c"," ","c"," "," ",
2019-08-20 00:43:04 +02:00
" "," ","v"," ","v"," ","v"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
},
traps = true,
},
-- stripes
{
style = "yrepeat",
layout = {
2019-08-20 00:43:04 +02:00
" ","S","v","S","v","S","v","S","v",
2019-08-20 00:27:25 +02:00
" ","S"," ","S"," ","S"," ","S"," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:27:25 +02:00
" ","S"," ","S"," ","S"," ","S"," ",
2019-08-20 00:43:04 +02:00
" ","S","^","S","^","S","^","S","^",
2019-08-20 00:27:25 +02:00
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- inside
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","c"," "," "," "," "," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," ","c","S","c"," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," ","S",">"," "," "," "," ",
" "," "," ","c","S","c"," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","c"," "," "," "," "," ","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
},
},
-- 1 chest
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," ","<"," "," "," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- 2 chests
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," "," "," "," "," ","<",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," "," "," "," "," "," "," ","<",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
},
traps = true,
},
-- X
{
style = "yrepeat",
layout = {
"c"," "," "," "," "," "," "," ","c",
"c","c",">"," "," "," ","<","c","c",
" ","c","c"," "," "," ","c","c"," ",
" "," ","c","c"," ","c","c"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," ","c","c"," ","c","c"," "," ",
" ","c","c"," "," "," ","c","c"," ",
"c","c",">"," "," "," ","<","c","c",
"c"," "," "," "," "," "," "," ","c",
2019-08-20 00:27:25 +02:00
},
},
-- split 2
{
style = "yrepeat",
layout = {
"S","S","S","S","S","S","S","S","S",
"S","S","S"," "," "," "," "," "," ",
"S","S","S"," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
"S","S","S"," "," ","^","^","^","^",
" "," "," "," "," ","c","c","c","c",
2019-08-20 00:43:04 +02:00
"S","S","S"," "," ","v","v","v","v",
2019-08-20 00:27:25 +02:00
"S","S","S"," "," "," "," "," "," ",
"S","S","S"," "," "," "," "," "," ",
"S","S","S","S","S","S","S","S","S",
},
},
-- split 3
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" ","^"," ","^"," ","^"," ","^"," ",
" ","c"," ","c"," ","c"," ","c"," ",
2019-08-20 00:43:04 +02:00
" ","v"," ","v"," ","v"," ","v"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- diamond 2
{
style = "yrepeat",
layout = {
"S","S"," "," "," "," "," ","S","S",
"S"," "," "," ","c"," "," "," ","S",
2019-08-20 00:43:04 +02:00
" "," ","<","S","S","S",">"," "," ",
2019-08-20 00:27:25 +02:00
" "," ","S","S","S","S","S"," "," ",
" ","c","S","S","S","S","S","c"," ",
2019-08-20 00:27:25 +02:00
" "," ","S","S","S","S","S"," "," ",
2019-08-20 00:43:04 +02:00
" "," ","<","S","S","S",">"," "," ",
"S"," "," "," ","c"," "," "," ","S",
2019-08-20 00:27:25 +02:00
"S","S"," "," "," "," "," ","S","S",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- ultra pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
" ","c","^","c"," ","c","^","c"," ",
" ","c","c","c"," ","c","c","c"," ",
" ","c","c","c"," ","c","c","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" ","c","c","c"," ","c","c","c"," ",
" ","c","c","c"," ","c","c","c"," ",
" ","c","v","c"," ","c","v","c"," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
},
},
-- vstripes
{
style = "yrepeat",
layout = {
"S"," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
"S"," "," ","^"," "," ","^"," "," ",
"S"," "," ","c"," "," ","c"," "," ",
2019-08-20 00:27:25 +02:00
"S"," "," "," "," "," "," "," "," ",
" "," "," ","c"," "," ","c"," "," ",
2019-08-20 00:27:25 +02:00
"S"," "," "," "," "," "," "," "," ",
"S"," "," ","c"," "," ","c"," "," ",
2019-08-20 00:43:04 +02:00
"S"," "," ","v"," "," ","v"," "," ",
2019-08-20 00:27:25 +02:00
"S"," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
-- sides
{
style = "yrepeat",
layout = {
"c"," ","c"," ","c"," ","c"," ","c",
2019-08-20 00:43:04 +02:00
" "," ","v"," ","v"," ","v"," "," ",
"c"," "," "," "," "," "," "," ","c",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","c",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
"c"," "," "," "," "," "," "," ","c",
2019-08-20 00:43:04 +02:00
" "," ","^"," ","^"," ","^"," "," ",
"c"," ","c"," ","c"," ","c"," ","c",
2019-08-20 00:27:25 +02:00
},
traps = true,
},
-- 9 pillars
{
style = "yrepeat",
layout = {
" "," "," "," "," "," "," "," "," ",
2019-08-20 00:43:04 +02:00
" "," ","^"," ","^"," ","^"," "," ",
" "," ","c"," ","c"," ","c"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," ","c"," ","c"," ","c"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
" "," ","c"," ","c"," ","c"," "," ",
2019-08-20 00:43:04 +02:00
" "," ","v"," ","v"," ","v"," "," ",
2019-08-20 00:27:25 +02:00
" "," "," "," "," "," "," "," "," ",
},
2019-08-25 00:50:22 +02:00
traps = true,
2019-08-20 00:27:25 +02:00
},
2019-08-24 16:08:11 +02:00
-- Ankh statue
{
style = "stacked",
layout = { {
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s",">"," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},{
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},{
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},{
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},{
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","s"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
}},
stype = "desert_sandstone",
wall = {
"S","S","S","S","S","S","S","S","S",
2019-08-25 00:16:54 +02:00
"s","1","s","1","s","1","s","1","s",
2019-08-24 16:08:11 +02:00
"S","S","S","S","S","S","S","S","S",
2019-08-25 00:16:54 +02:00
"1","s","1","s","1","s","1","s","1",
2019-08-24 16:08:11 +02:00
"S","S","S","S","S","S","S","S","S",
},
},
2019-08-25 00:16:54 +02:00
--[[
-- Cactus room 1
2019-08-24 16:08:11 +02:00
{
style = "stacked",
layout_offset = -1,
layout_height = 5,
layout = {{
"s","s","s","s","s","s","s","s","s",
"s","a","a","a","a","a","a","a","s",
"s","a","a","a","a","a","a","a","s",
"s","a","a","a","a","a","a","a","s",
"s","a","a","a","a","a","a","a","s",
"s","a","a","a","a","a","a","a","s",
"s","a","a","a","a","a","a","a","s",
"s","a","a","a","a","a","a","a","s",
"s","s","s","s","s","s","s","s","s",
},{
" "," "," "," "," "," "," "," ","<",
" ","C"," ","C"," ","C"," ","C"," ",
2019-08-24 16:08:11 +02:00
" "," "," "," "," "," "," "," "," ",
" ","C"," ","C"," ","C"," ","C"," ",
2019-08-24 16:08:11 +02:00
" "," "," "," "," "," "," "," "," ",
" ","C"," ","C"," ","C"," ","C"," ",
2019-08-24 16:08:11 +02:00
" "," "," "," "," "," "," "," "," ",
" ","C"," ","C"," ","C"," ","C"," ",
2019-08-24 16:08:11 +02:00
" "," "," "," "," "," "," "," ","<",
2019-08-20 00:27:25 +02:00
2019-08-24 16:08:11 +02:00
}},
wall = {
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
2019-08-25 00:16:54 +02:00
"s","3","s","3","s","3","s","3","s",
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
},
stype = "desert_sandstone",
},
]]
-- Cactus room 2
{
style = "stacked",
layout_offset = -1,
layout_height = 5,
layout = {{
"S","S","S","S","S","S","S","S","S",
"S","s","s","s","s","s","s","s","S",
"S","s","a","a","a","a","a","s","S",
"S","s","a","a","a","a","a","s","S",
"S","s","a","a","a","a","a","s","S",
"S","s","a","a","a","a","a","s","S",
"S","s","a","a","a","a","a","s","S",
"S","s","s","s","s","s","s","s","S",
"S","S","S","S","S","S","S","S","S",
},{
" "," "," "," "," "," "," "," ","<",
" "," "," "," "," "," "," "," "," ",
" "," ","C"," ","C"," ","C"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","C"," ","C"," ","C"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," ","C"," ","C"," ","C"," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," ","<",
}},
wall = {
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
"s","3","s","3","s","3","s","3","s",
"S","S","S","S","S","S","S","S","S",
2019-08-24 16:08:11 +02:00
"S","S","S","S","S","S","S","S","S",
},
stype = "desert_sandstone",
},
-- Sun room
{
style = "stacked",
layout_offset = 0,
layout_height = 8,
layout = {{
2019-08-24 22:30:38 +02:00
"n","s","s","s","s","s","s","s","n",
"s","n","s","s","s","s","s","n","s",
"s","s","n","n","n","n","n","s","s",
"s","s","n","s","s","s","n","s","s",
"s","s","n","s","s","s","n","s","s",
"s","s","n","s","s","s","n","s","s",
"s","s","n","n","n","n","n","s","s",
"s","n","s","s","s","s","s","n","s",
"n","s","s","s","s","s","s","s","n",
2019-08-24 16:08:11 +02:00
},{
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," ","<"," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
" "," "," "," "," "," "," "," "," ",
},{
2019-08-24 22:30:38 +02:00
"n","s","s","s","s","s","s","s","n",
"s","n","s","s","s","s","s","n","s",
"s","s","n","n","n","n","n","s","s",
"s","s","n","s","s","s","n","s","s",
"s","s","n","s","s","s","n","s","s",
"s","s","n","s","s","s","n","s","s",
"s","s","n","n","n","n","n","s","s",
"s","n","s","s","s","s","s","n","s",
"n","s","s","s","s","s","s","s","n",
2019-08-24 16:08:11 +02:00
}},
wall = {
"S","S","S","S","S","S","S","S","S",
2019-08-25 00:16:54 +02:00
"s","3","s","3","s","3","s","3","s",
2019-08-24 16:08:11 +02:00
"S","S","S","S","S","S","S","S","S",
2019-08-25 00:16:54 +02:00
"3","s","3","s","3","s","3","s","3",
2019-08-24 16:08:11 +02:00
"S","S","S","S","S","S","S","S","S",
},
stype = "sandstone",
open_roof = true,
},
-- Attic
{
style = "stacked",
layout_height = 6,
layout_offset = 1,
layout = { {
" "," "," "," "," "," "," "," "," ",
" ","S","S","S"," ","S","S","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" "," "," "," ","c",">"," "," "," ",
2019-08-24 16:08:11 +02:00
" ","S"," "," "," "," "," ","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S","S","S"," ","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
},{
" "," "," "," "," "," "," "," "," ",
" ","S","S","S"," ","S","S","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" "," "," "," ","c"," "," "," "," ",
2019-08-24 16:08:11 +02:00
" ","S"," "," "," "," "," ","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S","S","S"," ","S","S","S"," ",
" "," "," "," "," "," "," "," "," ",
},{
" "," "," "," "," "," "," "," "," ",
" ","S","S","S"," ","S","S","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" ","S"," "," "," "," "," ","S"," ",
" "," "," "," ","c"," "," "," "," ",
2019-08-24 16:08:11 +02:00
" ","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","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","S","S","S","c",
2019-08-24 16:08:11 +02:00
"s","s","s","s","s","s","s","s","s",
},{
"S","S","S","S","S","S","S","S","S",
"S","S","S","S","v","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",
},{
"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","S","S","S","S","S","S","S","S",
"S","S","S","S","S","S","S","S","S",
}},
},
2019-08-19 18:38:48 +02:00
}
2013-10-01 14:37:40 +02:00
2019-08-19 19:41:20 +02:00
local layout_traps_template = {
"S","S","S","S","S","S","S","S","S",
2019-08-23 14:37:38 +02:00
"?","?","?","?","?","?","?","?","S",
"?","?","?","?","?","?","?","?","S",
2019-08-19 19:41:20 +02:00
"?","?","?","?","?","?","?","?","S",
"?","?","?","?","?","?","?","?","S", -- << entrance on left side
"?","?","?","?","?","?","?","?","S",
2019-08-23 14:37:38 +02:00
"?","?","?","?","?","?","?","?","S",
"?","?","?","?","?","?","?","?","S",
2019-08-19 19:41:20 +02:00
"S","S","S","S","S","S","S","S","S"
}
2018-05-25 00:23:05 +02:00
local code_sandstone = {
2019-08-19 18:38:48 +02:00
[" "] = "air",
["c"] = "default:sandstone",
2019-08-20 20:36:50 +02:00
["s"] = "default:sandstone",
2019-08-24 22:30:38 +02:00
["n"] = "default:desert_sandstone",
2019-08-24 17:14:08 +02:00
["h"] = "default:sandstone",
2019-08-20 20:36:50 +02:00
["S"] = "default:sandstonebrick",
["1"] = "tsm_pyramids:deco_stone1",
["2"] = "tsm_pyramids:deco_stone2",
["3"] = "tsm_pyramids:deco_stone3",
["^"] = "default:chest",
["<"] = "default:chest",
[">"] = "default:chest",
["v"] = "default:chest",
["~"] = "default:lava_source",
["t"] = "tsm_pyramids:trap",
["C"] = "default:large_cactus_seedling",
2019-08-24 16:08:11 +02:00
["a"] = "default:sand",
2018-05-25 00:23:05 +02:00
}
local code_desert_sandstone = table.copy(code_sandstone)
code_desert_sandstone["c"] = "default:desert_sandstone"
2019-08-20 20:36:50 +02:00
code_desert_sandstone["s"] = "default:desert_sandstone"
2019-08-24 22:30:38 +02:00
code_desert_sandstone["n"] = "default:sandstone"
2019-08-24 17:14:08 +02:00
code_desert_sandstone["h"] = "default:desert_sandstone"
2019-08-20 20:36:50 +02:00
code_desert_sandstone["1"] = "tsm_pyramids:deco_stone4"
code_desert_sandstone["2"] = "tsm_pyramids:deco_stone5"
code_desert_sandstone["3"] = "tsm_pyramids:deco_stone6"
code_desert_sandstone["S"] = "default:desert_sandstone_brick"
code_desert_sandstone["t"] = "tsm_pyramids:desert_trap"
2019-08-24 16:08:11 +02:00
code_desert_sandstone["a"] = "default:desert_sand"
local code_desert_stone = table.copy(code_sandstone)
code_desert_stone["c"] = "default:desert_stone_block"
2019-08-20 20:36:50 +02:00
code_desert_stone["s"] = "default:desert_stone_block"
2019-08-24 22:30:38 +02:00
code_desert_stone["n"] = "default:desert_stone_block"
2019-08-24 17:14:08 +02:00
code_desert_stone["h"] = "default:desert_stone_block"
2019-08-20 20:36:50 +02:00
code_desert_stone["1"] = "default:desert_stone_block"
code_desert_stone["2"] = "default:desert_stone_block"
code_desert_stone["3"] = "default:desert_stone_block"
code_desert_stone["S"] = "default:desert_stonebrick"
code_desert_stone["t"] = "air"
2019-08-24 16:08:11 +02:00
code_desert_stone["a"] = "default:desert_sand"
2019-08-20 05:16:29 +02:00
local function replace(str, iy, code_table, deco, column_style)
2019-08-20 00:43:04 +02:00
if iy < 4 and (str == "<" or str == ">" or str == "^" or str == "v") then str = " " end
2019-08-24 17:14:08 +02:00
if str == "h" then
local r = math.random(0,3)
if r > 0 then
str = deco[r]
else
str = "c"
2019-08-24 17:14:08 +02:00
end
elseif column_style == 1 or column_style == 2 then
if iy == 0 and str == "c" then str = deco[1] end
if iy == 3 and str == "c" then str = deco[2] end
2019-08-20 05:16:29 +02:00
elseif column_style == 3 then
if iy == 0 and str == "c" then str = deco[1] end
if iy == 2 and str == "c" then str = deco[2] end
2019-08-20 05:16:29 +02:00
elseif column_style == 4 then
if iy == 2 and str == "c" then str = deco[1] end
2019-08-20 05:16:29 +02:00
end
2019-08-20 20:36:50 +02:00
return code_table[str]
end
2019-08-25 15:17:04 +02:00
local function replace2(str, iy, depth, code_table, trap_node)
if iy == depth then
-- Sandstone at the bottom-most layer
str = "s"
elseif iy == depth-1 then
-- Brick at the layer above
str = "S"
elseif iy == 0 and str == "~" then
-- Trap stones at the top layer
str = "t"
2019-08-25 15:17:04 +02:00
elseif str == "~" then
if iy < depth-3 then
-- Air below the trap stones
str = " "
else
str = trap_node
end
end
-- Everything else is untouched (will stay pyramid material)
2013-10-01 14:37:40 +02:00
2019-08-20 20:36:50 +02:00
return code_table[str]
2013-10-01 14:37:40 +02:00
end
2019-08-22 14:50:26 +02:00
local function get_flat_index(x, y, width)
return 1 + x + y * width
end
local function rotate_layout_single(layout, width)
local size = width*width
local new_layout = {}
for x=0, width-1 do
for y=0, width-1 do
local symbol = layout[get_flat_index((width-1) - y, x, width)]
-- Rotate chest
if symbol == "^" then
symbol = "<"
elseif symbol == "<" then
symbol = "v"
elseif symbol == "v" then
symbol = ">"
elseif symbol == ">" then
symbol = "^"
end
new_layout[get_flat_index(x, y, width)] = symbol
end
end
return new_layout
end
local function rotate_layout(layout, width, rotations)
local new_layout = table.copy(layout)
for r=1, rotations do
new_layout = rotate_layout_single(new_layout, width)
end
return new_layout
end
-- pos: Position to spawn pyramid
-- stype: Sand type ("sandstone" or "desert")
-- room_id: Room layout identified (see list of rooms above)
-- rotations: Number of times to rotate the room (0-3)
function tsm_pyramids.make_room(pos, stype, room_id, rotations)
2018-05-25 00:23:05 +02:00
local code_table = code_sandstone
if stype == "desert_sandstone" then
code_table = code_desert_sandstone
elseif stype == "desert_stone" then
code_table = code_desert_stone
2018-05-25 00:23:05 +02:00
end
2018-05-25 00:34:33 +02:00
-- Select random deco block
local deco_ids = {"1", "2", "3"}
local deco = {}
2019-08-24 17:14:08 +02:00
for i=1, 3 do
2018-05-25 00:34:33 +02:00
local r = math.random(1, #deco_ids)
table.insert(deco, deco_ids[r])
table.remove(deco_ids, r)
end
2018-05-25 00:23:05 +02:00
local hole = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
if room_id == nil then
room_id = math.random(1, #room_types)
end
local room
if room_id < 1 or room_id > #room_types then
return false, S("Incorrect room type ID: @1", room_id)
end
2019-08-22 14:50:26 +02:00
local room = table.copy(room_types[room_id])
2019-08-24 23:19:41 +02:00
local tries = 0
while tries < #room_types do
if room.stype and room.stype ~= stype then
room_id = room_id + 1
if room_id > #room_types then
room_id = 1
end
room = table.copy(room_types[room_id])
else
break
end
tries = tries + 1
end
local chests = {}
2019-08-23 12:58:27 +02:00
local column_style
if stype == "desert_stone" then
column_style = 0
2019-08-23 12:58:27 +02:00
else
column_style = math.random(0,4)
end
2019-08-25 00:16:54 +02:00
-- Custom room walls
if room.wall then
for iy=0,4,1 do
for ie=0,8,1 do
local nn = code_table[room.wall[iy*9+ie+1]]
minetest.set_node({x=hole.x+ie, y=hole.y-iy, z=hole.z-1}, {name=nn})
minetest.set_node({x=hole.x-1, y=hole.y-iy, z=hole.z+ie}, {name=nn})
minetest.set_node({x=hole.x+ie, y=hole.y-iy, z=hole.z+9}, {name=nn})
minetest.set_node({x=hole.x+9, y=hole.y-iy, z=hole.z+ie}, {name=nn})
end
end
end
2019-08-24 16:24:23 +02:00
local layout
2019-08-25 00:16:54 +02:00
-- Place the room nodes
2019-08-20 00:27:25 +02:00
if room.style == "yrepeat" then
2019-08-24 16:24:23 +02:00
layout = rotate_layout(room.layout, ROOM_WIDTH, rotations)
2019-08-20 00:27:25 +02:00
for iy=0,4,1 do
for ix=0,8,1 do
for iz=0,8,1 do
2019-08-25 00:16:54 +02:00
local n_str = layout[ix*9+iz+1]
2019-08-20 00:27:25 +02:00
local p2 = 0
2019-08-20 00:43:04 +02:00
if n_str == "<" then
p2 = 0
elseif n_str == ">" then
p2 = 2
elseif n_str == "^" then
p2 = 1
elseif n_str == "v" then
p2 = 3
2019-08-20 00:27:25 +02:00
end
local cpos = {x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}
2019-08-20 05:16:29 +02:00
local nn = replace(n_str, iy, code_table, deco, column_style)
minetest.set_node(cpos, {name=nn, param2=p2})
if nn == "default:chest" then
table.insert(chests, cpos)
2019-08-24 16:08:11 +02:00
end
end
end
end
elseif room.style == "stacked" then
local layout_list = room.layout
local layout
local layout_offset = room.layout_offset
local layout_height = room.layout_height
if not layout_offset then
layout_offset = 0
end
if not layout_height then
layout_height = 5
end
for iy=0,layout_height-1,1 do
layout = nil
if layout_list[layout_height-iy] then
layout = rotate_layout(layout_list[layout_height-iy], ROOM_WIDTH, rotations)
end
for ix=0,8,1 do
for iz=0,8,1 do
local n_str
if layout then
2019-08-25 00:16:54 +02:00
n_str = layout[ix*9+iz+1]
2019-08-24 16:08:11 +02:00
else
n_str = " "
end
local p2 = 0
if n_str == "<" then
p2 = 0
elseif n_str == ">" then
p2 = 2
elseif n_str == "^" then
p2 = 1
elseif n_str == "v" then
p2 = 3
end
local cpos = {x=hole.x+ix,y=hole.y-iy+layout_offset,z=hole.z+iz}
local nn = code_table[n_str]
minetest.set_node(cpos, {name=nn, param2=p2})
if nn == "default:chest" then
table.insert(chests, cpos)
end
2016-12-30 14:22:38 +01:00
end
end
end
2019-08-20 00:27:25 +02:00
else
minetest.log("error", "Invalid pyramid room style! room type ID="..r)
2019-08-20 00:27:25 +02:00
end
2019-08-20 20:47:11 +02:00
local sanded = room.flood_sand ~= false and stype ~= "desert_stone" and math.random(1,8) == 1
if #chests > 0 then
-- Make at least 8 attempts to fill chests
local filled = 0
2019-08-25 12:37:36 +02:00
local chests_with_treasure = 0
while filled < 8 do
for c=1, #chests do
2019-08-25 12:37:36 +02:00
local has_treasure = tsm_pyramids.fill_chest(chests[c], stype, sanded, 30)
if has_treasure then
chests_with_treasure = chests_with_treasure + 1
end
filled = filled + 1
end
end
2019-08-25 12:37:36 +02:00
-- If no chests were filled with treasure so far, fill a random chest guaranteed
if chests_with_treasure == 0 then
2019-08-25 13:50:53 +02:00
tsm_pyramids.fill_chest(chests[math.random(1, #chests)], stype, sanded, 100)
2019-08-25 12:37:36 +02:00
end
end
2019-08-25 16:33:14 +02:00
if room.traps and math.random(1,4) == 1 then
2019-08-23 14:34:42 +02:00
tsm_pyramids.make_traps(pos, stype, rotations, layout)
end
2019-08-20 03:26:54 +02:00
if sanded then
tsm_pyramids.flood_sand(pos, stype)
2019-08-20 02:58:37 +02:00
end
return true, nil, sanded
end
2013-10-01 14:37:40 +02:00
2019-08-25 16:33:14 +02:00
local shuffle_traps = function(layout_traps, layout_room, chance)
2019-08-19 19:41:20 +02:00
for a=1, #layout_traps do
2019-08-23 14:34:42 +02:00
-- Delete trap if this space of the room is occupied
if layout_room[a] ~= " " then
layout_traps[a] = "S"
-- Randomly turn tile into a trap, or not
elseif layout_traps[a] == "?" then
-- percentage for a trap
2019-08-19 19:41:20 +02:00
if math.random(1,100) <= chance then
layout_traps[a] = "~"
else
layout_traps[a] = "S"
end
end
end
end
2019-08-23 14:34:42 +02:00
function tsm_pyramids.make_traps(pos, stype, rotations, layout_room)
2018-05-25 00:23:05 +02:00
local code_table = code_sandstone
if stype == "desert_sandstone" then
code_table = code_desert_sandstone
elseif stype == "desert_stone" then
code_table = code_desert_stone
2018-05-25 00:23:05 +02:00
end
2019-08-25 16:33:14 +02:00
local layout_traps = table.copy(layout_traps_template)
layout_traps = rotate_layout(layout_traps, ROOM_WIDTH, rotations)
shuffle_traps(layout_traps, layout_room, math.random(10,100))
-- Depth is total depth of trap area:
-- * top layer with trap stones
-- * followed by air layers
2019-08-25 15:17:04 +02:00
-- * followed by 2 layers of lava
-- * and 2 layers of sandstone/brick at the bottom (to prevent lava escaping)
-- The depth of air between trap stones and lava layer is <depth> - 4
2019-08-25 15:17:04 +02:00
local deep_trap = math.random(1,2) == 1
local trap_node
2019-10-01 13:06:20 +02:00
local depth
2019-08-25 15:17:04 +02:00
if deep_trap then
trap_node = " "
2019-10-01 13:06:20 +02:00
depth = 14
2019-08-25 15:17:04 +02:00
else
trap_node = "~"
2019-10-01 13:06:20 +02:00
depth = 7
2019-08-25 15:17:04 +02:00
end
2019-08-23 13:53:43 +02:00
local wmin, wmax = -1,9
2019-08-25 16:33:14 +02:00
local hole = {x=pos.x+7,y=pos.y, z=pos.z+7}
for iy=0,depth,1 do
2019-08-23 13:53:43 +02:00
for ix=wmin,wmax,1 do
for iz=wmin,wmax,1 do
local n_str
if ix == wmin or ix == wmax or iz == wmin or iz == wmax then
-- Walls around room
if iy == depth then
n_str = code_table["s"]
else
n_str = code_table["S"]
end
minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=n_str})
else
2019-08-25 16:33:14 +02:00
n_str = layout_traps[ix*9+iz+1]
2019-08-25 15:17:04 +02:00
minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace2(n_str, iy, depth, code_table, trap_node)})
2019-08-23 13:53:43 +02:00
end
2016-12-30 14:22:38 +01:00
end
2013-10-01 14:37:40 +02:00
end
end
end
2019-08-20 02:58:37 +02:00
function tsm_pyramids.flood_sand(pos, stype)
local set_to_sand = {}
2019-08-20 02:58:37 +02:00
local nn = "default:sand"
if stype == "desert_sandstone" or stype == "desert_stone" then
2019-08-20 02:58:37 +02:00
nn = "default:desert_sand"
end
local hole = {x=pos.x+7,y=pos.y+1, z=pos.z+7}
local maxh = math.random(1,4)
local chance = math.random(1,7)
for ix=0,8,1 do
for iz=0,8,1 do
if math.random(1,chance) == 1 then
local h = math.random(1,maxh)
for iy=0,h,1 do
local p = {x=hole.x+ix,y=hole.y+iy,z=hole.z+iz}
if minetest.get_node(p).name == "air" then
table.insert(set_to_sand, p)
2019-08-20 02:58:37 +02:00
end
end
end
end
end
minetest.bulk_set_node(set_to_sand, {name=nn})
2019-08-20 02:58:37 +02:00
end