Compare commits
78 Commits
master
...
desert_sto
Author | SHA1 | Date | |
---|---|---|---|
08a750820b | |||
7b0c42954f | |||
461326ad32 | |||
783a5d8666 | |||
9b9e4c1f50 | |||
9c6dc7908a | |||
d834170a7b | |||
b00f540567 | |||
bd38820a32 | |||
03a7de0b2d | |||
104b2e947a | |||
a6c3ab814b | |||
600b54e5ad | |||
9ddfbed720 | |||
51bf3783ff | |||
2407c70523 | |||
fa844864bb | |||
84a04cec27 | |||
1d43f7c06e | |||
6a43244322 | |||
6fc1d927f8 | |||
fb6cbbea66 | |||
acc22a5576 | |||
d3187e4a08 | |||
d6bc045bbb | |||
9e9433dcae | |||
d64e5d5b47 | |||
4c52d902e4 | |||
7aadb0f0ac | |||
e91b61f849 | |||
6b453f781e | |||
d86a85340c | |||
3c0d699fd1 | |||
971bc77ff8 | |||
d46d199de1 | |||
5727e51949 | |||
47f80863ba | |||
21e57108d8 | |||
8901184f72 | |||
2ce13628cc | |||
351292740b | |||
f6f1b4bd06 | |||
ae94b8b508 | |||
30f29c8490 | |||
a069c026fd | |||
4a8dab67db | |||
7949f68e12 | |||
74597d9394 | |||
214ef62bda | |||
eb3590ce68 | |||
05bef9bf6e | |||
c066cedd2e | |||
47e54b4184 | |||
ee8c87470e | |||
be2bc3f0fe | |||
45a6bd0c71 | |||
b447f0af75 | |||
273e11dd40 | |||
df312a19b1 | |||
47ffb0d254 | |||
7568a2b3fa | |||
281eae639e | |||
82e6e5bdd0 | |||
e78434b1f0 | |||
e05d0e21a7 | |||
246011153d | |||
3e15c497c3 | |||
bcfd8e73e5 | |||
10d15c532d | |||
98e494f665 | |||
368f822ebf | |||
b5ef3d0e7f | |||
1eeef3723c | |||
d70f7e4adb | |||
b9513e92d2 | |||
24e6c49b83 | |||
b8c8a2eb55 | |||
44e66d661a |
0
.gitattributes
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
41
README.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Pyramids (with Treasurer support) [`tsm_pyramids`]
|
||||
|
||||
* Version: 0.7
|
||||
|
||||
## Description
|
||||
This is a mod for Minetest Game which adds randomly spawned pyramids in deserts and
|
||||
sandstone deserts. The pyramids are very rare and contain chests with stuff.
|
||||
Also there are mummies inside, which attack the player if found in their radius.
|
||||
|
||||
## Historic notes
|
||||
This mod is a fork of the old `pyramids` mod by BlockMen and intended to be a direct
|
||||
(but unofficial) successor of it.
|
||||
|
||||
## Licensing
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law.
|
||||
|
||||
### Source code and textures
|
||||
|
||||
* [MIT License](https://mit-license.org/)
|
||||
* (c) Copyright BlockMen (2013)
|
||||
|
||||
### Mummy model
|
||||
|
||||
* MIT License
|
||||
* (c) Copyright Pavel\_S (2013)
|
||||
|
||||
### Textures
|
||||
|
||||
* `tsm_pyramids_eye.png` by bas080, [CC-BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/)
|
||||
* `tsm_pyramids_men.png` by bas080, CC-BY-SA 3.0
|
||||
* `tsm_pyramids_sun.png` by bas080, CC-BY-SA 3.0
|
||||
* All other: BlockMen (MIT License)
|
||||
|
||||
### Sounds
|
||||
The authors are ([freesound.org](https://freesound.org)):
|
||||
|
||||
* `mummy.1.ogg` by Raventhornn, [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
* `mummy.2.ogg` by Raventhornn, CC0
|
||||
* `mummy_hurt.1.ogg` by Under7dude, CC0
|
||||
* `mummy_death.1.ogg` by scorpion67890 (modified by Wuzzy), CC0
|
43
README.txt
@ -1,43 +0,0 @@
|
||||
Minetest mod "Pyramids"
|
||||
=======================
|
||||
version: 0.6
|
||||
|
||||
License of source code and textures: WTFPL
|
||||
------------------------------------------
|
||||
(c) Copyright BlockMen (2013)
|
||||
|
||||
|
||||
License of mesh model: WTFPL
|
||||
----------------------------
|
||||
(c) Copyright Pavel_S (2013)
|
||||
|
||||
|
||||
License of textures
|
||||
-------------------
|
||||
-tsm_pyramids_eye.png by bas080, CC-BY-SA 3.0
|
||||
-tsm_pyramids_men.png by bas080, CC-BY-SA 3.0
|
||||
-tsm_pyramids_sun.png by bas080, CC-BY-SA 3.0
|
||||
|
||||
all other: BlockMen, WTFPL
|
||||
|
||||
|
||||
Licenses of sounds
|
||||
------------------
|
||||
The authors are : (freesound.org)
|
||||
-mummy.1.ogg by Raventhornn, CC0
|
||||
-mummy.2.ogg by Raventhornn, CC0
|
||||
-mummy_hurt.1.ogg by Under7dude, CC0
|
||||
-mummy_death.1.ogg by Michel88, CC-Sampling Plus 1.0
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
||||
|
||||
Using the mod:
|
||||
--------------
|
||||
|
||||
This mod adds randomly spawned pyramids in deserts. The pyramids are very rare and contain a chest with stuff.
|
||||
Also there are mummys inside, which attack the player if found in their radius.
|
@ -1,6 +0,0 @@
|
||||
default
|
||||
mobs
|
||||
maptools
|
||||
farming?
|
||||
treasurer?
|
||||
watershed?
|
347
init.lua
Executable file → Normal file
@ -1,55 +1,77 @@
|
||||
pyramids = {}
|
||||
pyramids.max_time = 30*60
|
||||
local S = minetest.get_translator("tsm_pyramids")
|
||||
|
||||
tsm_pyramids = {}
|
||||
|
||||
dofile(minetest.get_modpath("tsm_pyramids").."/mummy.lua")
|
||||
dofile(minetest.get_modpath("tsm_pyramids").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("tsm_pyramids").."/room.lua")
|
||||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
local chest_stuff = {
|
||||
{name="default:apple", max = 3},
|
||||
{name="farming:bread", max = 3},
|
||||
{name="default:steel_ingot", max = 2},
|
||||
{name="default:steel_ingot", max = 3},
|
||||
{name="default:copper_ingot", max = 3},
|
||||
{name="default:gold_ingot", max = 2},
|
||||
{name="default:diamond", max = 1},
|
||||
{name="default:pick_steel", max = 1},
|
||||
{name="default:pick_diamond", max = 1}
|
||||
|
||||
{name="default:pick_diamond", max = 1},
|
||||
{name="default:papyrus", max = 9},
|
||||
}
|
||||
|
||||
function pyramids.fill_chest(pos)
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
if n and n.name and n.name == "tsm_pyramids:chest" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_list("main",
|
||||
{
|
||||
[1] = "",
|
||||
[32] = ""
|
||||
}
|
||||
)
|
||||
if math.random(1,10) < 7 then return end
|
||||
local stacks = {}
|
||||
if minetest.get_modpath("treasurer") ~= nil then
|
||||
stacks = treasurer.select_random_treasures()
|
||||
else
|
||||
for i=0,2,1 do
|
||||
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
||||
if stuff.name == "farming:bread" and not minetest.get_modpath("farming") then stuff = chest_stuff[1] end
|
||||
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
|
||||
end
|
||||
end
|
||||
for s=1,#stacks do
|
||||
if not inv:contains_item("main", stacks[s]) then
|
||||
inv:set_stack("main", math.random(1,32), stacks[s])
|
||||
end
|
||||
end
|
||||
end
|
||||
if minetest.get_modpath("farming") then
|
||||
table.insert(chest_stuff, {name="farming:bread", max = 3})
|
||||
table.insert(chest_stuff, {name="farming:cotton", max = 8})
|
||||
else
|
||||
table.insert(chest_stuff, {name="farming:apple", max = 8})
|
||||
table.insert(chest_stuff, {name="farming:apple", max = 3})
|
||||
end
|
||||
if minetest.get_modpath("tnt") then
|
||||
table.insert(chest_stuff, {name="tnt:gunpowder", max = 6})
|
||||
else
|
||||
table.insert(chest_stuff, {name="farming:apple", max = 3})
|
||||
end
|
||||
|
||||
local function add_spawner(pos)
|
||||
function tsm_pyramids.fill_chest(pos, stype, flood_sand)
|
||||
minetest.after(2, function()
|
||||
local sand = "default:sand"
|
||||
if stype == "desert_sandstone" or stype == "desert_stone" then
|
||||
sand = "default:desert_sand"
|
||||
end
|
||||
local n = minetest.get_node(pos)
|
||||
if n and n.name and n.name == "default:chest" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
local stacks = {}
|
||||
-- Fill with sand in sand-flooded pyramids
|
||||
if flood_sand then
|
||||
table.insert(stacks, {name=sand, count = math.random(1,32)})
|
||||
end
|
||||
-- Add treasures
|
||||
if math.random(1,10) >= 7 then
|
||||
if minetest.get_modpath("treasurer") ~= nil then
|
||||
stacks = treasurer.select_random_treasures(3,7,9,{"minetool", "food", "crafting_component"})
|
||||
else
|
||||
for i=0,2,1 do
|
||||
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
||||
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
|
||||
end
|
||||
end
|
||||
end
|
||||
for s=1,#stacks do
|
||||
if not inv:contains_item("main", stacks[s]) then
|
||||
inv:set_stack("main", math.random(1,32), stacks[s])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function add_spawner(pos, mummy_offset)
|
||||
minetest.set_node(pos, {name="tsm_pyramids:spawner_mummy"})
|
||||
if not minetest.setting_getbool("only_peaceful_mobs") then pyramids.spawn_mummy({x=pos.x,y=pos.y,z=pos.z-2},2) end
|
||||
if not minetest.settings:get_bool("only_peaceful_mobs") then tsm_pyramids.spawn_mummy(vector.add(pos, mummy_offset),2) end
|
||||
end
|
||||
|
||||
local function can_replace(pos)
|
||||
@ -63,56 +85,96 @@ local function can_replace(pos)
|
||||
end
|
||||
end
|
||||
|
||||
local function underground(pos)
|
||||
local function make_foundation_part(pos, set_to_stone)
|
||||
local p2 = pos
|
||||
local cnt = 0
|
||||
local mat = "desert_sand"
|
||||
p2.y = p2.y-1
|
||||
while can_replace(p2)==true do
|
||||
cnt = cnt+1
|
||||
if cnt > 25 then break end
|
||||
if cnt>math.random(2,4) then mat = "desert_stone" end
|
||||
minetest.set_node(p2, {name="default:"..mat})
|
||||
if cnt > 25 then
|
||||
break
|
||||
end
|
||||
table.insert(set_to_stone, table.copy(p2))
|
||||
p2.y = p2.y-1
|
||||
end
|
||||
end
|
||||
|
||||
local function make_entrance(pos)
|
||||
local function make_entrance(pos, brick, sand, flood_sand)
|
||||
local gang = {x=pos.x+10,y=pos.y, z=pos.z}
|
||||
for iy=2,3,1 do
|
||||
for iz=0,6,1 do
|
||||
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
||||
local max_sand_height = math.random(1,3)
|
||||
for iz=0,6,1 do
|
||||
local sand_height = math.random(1,max_sand_height)
|
||||
for iy=2,3,1 do
|
||||
if flood_sand and sand ~= "ignore" and iy <= sand_height and iz >= 3 then
|
||||
minetest.set_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz}, {name=sand})
|
||||
else
|
||||
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
||||
end
|
||||
if iz >=3 and iy == 3 then
|
||||
minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name=brick})
|
||||
minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name=brick})
|
||||
minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name=brick})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pyramids.make(pos)
|
||||
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
|
||||
for iy=0,10,1 do
|
||||
local function make_pyramid(pos, brick, sandstone, stone, sand)
|
||||
local set_to_brick = {}
|
||||
local set_to_sand = {}
|
||||
local set_to_stone = {}
|
||||
-- Build pyramid
|
||||
for iy=0,math.random(10,11),1 do
|
||||
for ix=iy,22-iy,1 do
|
||||
for iz=iy,22-iy,1 do
|
||||
if iy <1 then underground({x=pos.x+ix,y=pos.y,z=pos.z+iz}) end
|
||||
minetest.set_node({x=pos.x+ix,y=pos.y+iy,z=pos.z+iz}, {name="maptools:sandstone_brick"})
|
||||
for yy=1,10-iy,1 do
|
||||
local n = minetest.get_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz})
|
||||
if n and n.name and n.name == "default:desert_stone" then minetest.set_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz},{name="default:desert_sand"}) end
|
||||
if iy < 1 then
|
||||
make_foundation_part({x=pos.x+ix,y=pos.y,z=pos.z+iz}, set_to_stone)
|
||||
end
|
||||
table.insert(set_to_brick, {x=pos.x+ix,y=pos.y+iy,z=pos.z+iz})
|
||||
if sand ~= "ignore" then
|
||||
for yy=1,10-iy,1 do
|
||||
local n = minetest.get_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz})
|
||||
if n and n.name and n.name == stone then
|
||||
table.insert(set_to_sand, {x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.bulk_set_node(set_to_stone , {name=stone})
|
||||
minetest.bulk_set_node(set_to_brick, {name=brick})
|
||||
if sand ~= "ignore" then
|
||||
minetest.bulk_set_node(set_to_sand, {name=sand})
|
||||
end
|
||||
end
|
||||
|
||||
pyramids.make_room(pos)
|
||||
minetest.after(2, pyramids.make_traps, pos)
|
||||
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})
|
||||
local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
|
||||
-- Build pyramid
|
||||
make_pyramid(pos, brick, sandstone, stone, sand)
|
||||
-- Build room
|
||||
local ok, msg, flood_sand = tsm_pyramids.make_room(pos, ptype, room_id)
|
||||
-- Place mummy spawner
|
||||
local r = math.random(1,3)
|
||||
if r == 1 then
|
||||
-- front
|
||||
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17}, {x=0, y=0, z=-2})
|
||||
elseif r == 2 then
|
||||
-- right
|
||||
add_spawner({x=pos.x+17,y=pos.y+2, z=pos.z+11}, {x=-2, y=0, z=0})
|
||||
else
|
||||
-- left
|
||||
add_spawner({x=pos.x+5,y=pos.y+2, z=pos.z+11}, {x=2, y=0, z=0})
|
||||
end
|
||||
-- Build entrance
|
||||
make_entrance({x=pos.x,y=pos.y, z=pos.z}, brick, sand, flood_sand)
|
||||
-- Done
|
||||
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
|
||||
return ok, msg
|
||||
end
|
||||
|
||||
local perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
|
||||
local perlin1
|
||||
|
||||
local function hlp_fnct(pos, name)
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
@ -122,7 +184,6 @@ local function hlp_fnct(pos, name)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local function ground(pos, old)
|
||||
local p2 = pos
|
||||
while hlp_fnct(p2, "air") do
|
||||
@ -137,51 +198,133 @@ end
|
||||
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
minetest.after(3, function(minp, maxp, seed)
|
||||
if maxp.y < 0 then return end
|
||||
math.randomseed(seed)
|
||||
if not perlin1 then
|
||||
perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
||||
end
|
||||
local noise1 = perlin1:get_2d({x=minp.x,y=minp.y})--,z=minp.z})
|
||||
|
||||
if maxp.y < 0 then return end
|
||||
math.randomseed(seed)
|
||||
if noise1 > 0.25 or noise1 < -0.26 then
|
||||
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
|
||||
local sands = {"default:sand", "default:desert_sand", "default:desert_stone"}
|
||||
local p2
|
||||
local psand = {}
|
||||
local sand
|
||||
local cnt = 0
|
||||
|
||||
local perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
||||
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
|
||||
|
||||
if noise1 > 0.25 or noise1 < -0.26 and math.random(1,100) % 2 == 0 then -- Coward attempt to divide per 2 the spawn rate
|
||||
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
|
||||
local p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||
while p2 == nil and cnt < 5 do
|
||||
local cnt_min = 100
|
||||
for s=1, #sands do
|
||||
cnt = 0
|
||||
sand = sands[s]
|
||||
psand[s] = minetest.find_node_near(mpos, 25, sand)
|
||||
while psand == nil and cnt < 5 do
|
||||
cnt = cnt+1
|
||||
mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||
psand[s] = minetest.find_node_near(mpos, 25, sand)
|
||||
end
|
||||
if p2 == nil then return end
|
||||
if p2.y < 0 then return end
|
||||
|
||||
local off = 0
|
||||
local opos1 = {x=p2.x+22,y=p2.y-1,z=p2.z+22}
|
||||
local opos2 = {x=p2.x+22,y=p2.y-1,z=p2.z}
|
||||
local opos3 = {x=p2.x,y=p2.y-1,z=p2.z+22}
|
||||
local opos1_n = minetest.get_node_or_nil(opos1)
|
||||
local opos2_n = minetest.get_node_or_nil(opos2)
|
||||
local opos3_n = minetest.get_node_or_nil(opos3)
|
||||
if opos1_n and opos1_n.name and opos1_n.name == "air" then
|
||||
p2 = ground(opos1, p2)
|
||||
if psand[s] ~= nil then
|
||||
if cnt < cnt_min then
|
||||
cnt_min = cnt
|
||||
p2 = psand[s]
|
||||
end
|
||||
end
|
||||
if opos2_n and opos2_n.name and opos2_n.name == "air" then
|
||||
p2 = ground(opos2, p2)
|
||||
end
|
||||
if opos3_n and opos3_n.name and opos3_n.name == "air" then
|
||||
p2 = ground(opos3, p2)
|
||||
end
|
||||
p2.y = p2.y - 3
|
||||
if p2.y < 0 then p2.y = 0 end
|
||||
if minetest.find_node_near(p2, 25, {"default:water_source"}) ~= nil
|
||||
or minetest.find_node_near(p2, 22, {"default:dirt_with_grass"}) ~= nil
|
||||
or minetest.find_node_near(p2, 52, {"maptools:sandstone_brick"}) ~= nil then return end
|
||||
|
||||
if math.random(0,10) > 7 then return end
|
||||
pyramids.make(p2)
|
||||
end
|
||||
end, minp, maxp, seed)
|
||||
if p2 == nil then return end
|
||||
if p2.y < 0 then return end
|
||||
|
||||
local off = 0
|
||||
local opos1 = {x=p2.x+22,y=p2.y-1,z=p2.z+22}
|
||||
local opos2 = {x=p2.x+22,y=p2.y-1,z=p2.z}
|
||||
local opos3 = {x=p2.x,y=p2.y-1,z=p2.z+22}
|
||||
local opos1_n = minetest.get_node_or_nil(opos1)
|
||||
local opos2_n = minetest.get_node_or_nil(opos2)
|
||||
local opos3_n = minetest.get_node_or_nil(opos3)
|
||||
if opos1_n and opos1_n.name and opos1_n.name == "air" then
|
||||
p2 = ground(opos1, p2)
|
||||
end
|
||||
if opos2_n and opos2_n.name and opos2_n.name == "air" then
|
||||
p2 = ground(opos2, p2)
|
||||
end
|
||||
if opos3_n and opos3_n.name and opos3_n.name == "air" then
|
||||
p2 = ground(opos3, p2)
|
||||
end
|
||||
p2.y = p2.y - 3
|
||||
if p2.y < 0 then p2.y = 0 end
|
||||
if minetest.find_node_near(p2, 25, {"default:water_source"}) ~= nil or
|
||||
minetest.find_node_near(p2, 22, {"default:dirt_with_grass"}) ~= nil or
|
||||
minetest.find_node_near(p2, 52, {"default:sandstonebrick"}) ~= nil or
|
||||
minetest.find_node_near(p2, 52, {"default:desert_sandstone_brick"}) ~= nil then
|
||||
return
|
||||
end
|
||||
|
||||
if math.random(0,10) > 7 then
|
||||
return
|
||||
end
|
||||
if (mg_name == "v6" and sand == "default:desert_sand" and math.random(1, 2) == 1) then
|
||||
sand = "default:sand"
|
||||
end
|
||||
if sand == "default:desert_sand" then
|
||||
-- Desert sandstone pyramid
|
||||
minetest.after(0.8, make, p2, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert_sandstone")
|
||||
elseif sand == "default:sand" then
|
||||
-- Sandstone pyramid
|
||||
minetest.after(0.8, make, p2, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone")
|
||||
else
|
||||
-- Desert stone pyramid
|
||||
minetest.after(0.8, make, p2, "default:desert_stonebrick", "default:desert_stone_block", "default:desert_stone", "default:desert_sand", "desert_stone")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Add backwards-compability for nodes from the original pyramids mod
|
||||
if minetest.get_modpath("pyramids") == nil then
|
||||
-- Nodes
|
||||
minetest.register_alias("pyramids:trap", "tsm_pyramids:trap")
|
||||
minetest.register_alias("pyramids:trap_2", "tsm_pyramids:trap_2")
|
||||
minetest.register_alias("pyramids:deco_stone1", "tsm_pyramids:deco_stone1")
|
||||
minetest.register_alias("pyramids:deco_stone2", "tsm_pyramids:deco_stone2")
|
||||
minetest.register_alias("pyramids:deco_stone3", "tsm_pyramids:deco_stone3")
|
||||
minetest.register_alias("pyramids:spawner_mummy", "tsm_pyramids:spawner_mummy")
|
||||
|
||||
-- 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 = S("[<room_type>]"),
|
||||
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 s = math.random(1,3)
|
||||
local r = tonumber(param)
|
||||
local room_id
|
||||
if r then
|
||||
room_id = r
|
||||
end
|
||||
local ok, msg
|
||||
pos = vector.add(pos, {x=-11, y=-1, z=0})
|
||||
if s == 1 then
|
||||
-- Sandstone
|
||||
ok, msg = make(pos, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone", room_id)
|
||||
elseif s == 2 then
|
||||
-- Desert sandstone
|
||||
ok, msg = make(pos, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert_sandstone", room_id)
|
||||
else
|
||||
-- Desert stone
|
||||
ok, msg = make(pos, "default:desert_stonebrick", "default:desert_stone_block", "default:desert_stone", "ignore", "desert_stone", room_id)
|
||||
end
|
||||
if ok then
|
||||
return true, S("Pyramid generated at @1.", minetest.pos_to_string(pos))
|
||||
else
|
||||
return false, msg
|
||||
end
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
24
locale/template.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# textdomain:tsm_pyramids
|
||||
Cracked Desert Sandstone Brick=
|
||||
Cracked Sandstone Brick=
|
||||
Desert Sandstone with Ankh Engraving=
|
||||
Desert Sandstone with Cactus Engraving=
|
||||
Desert Sandstone with Scarab Engraving=
|
||||
Falling Cracked Sandstone Brick=
|
||||
Falling Cracked Desert Sandstone Brick=
|
||||
Mummy Spawn Egg=
|
||||
Mummy Spawner=
|
||||
Sandstone with Eye Engraving=
|
||||
Sandstone with Man Engraving=
|
||||
Sandstone with Sun Engraving=
|
||||
A mummy spawner causes hostile mummies to appear in its vicinity as long it exists.=
|
||||
Can be used to create a hostile mummy.=
|
||||
Place the egg to create a mummy on this spot. Careful, it will probably attack immediately!=
|
||||
This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it.=
|
||||
This old porous brick falls under its own weight.=
|
||||
No more mummies!=
|
||||
Destroy a mummy spawner by digging.=
|
||||
Generate a pyramid=
|
||||
[<room_type>]
|
||||
Pyramid generated at @1.
|
||||
Incorrect room type ID: @1
|
24
locale/tsm_pyramids.de.tr
Normal file
@ -0,0 +1,24 @@
|
||||
# textdomain:tsm_pyramids
|
||||
Cracked Desert Sandstone Brick=Rissiger Wüstensandsteinziegel
|
||||
Cracked Sandstone Brick=Rissiger Sandsteinziegel
|
||||
Desert Sandstone with Ankh Engraving=Wüstensandstein mit Ankh-Gravur
|
||||
Desert Sandstone with Cactus Engraving=Wüstensandstein mit Kaktusgravur
|
||||
Desert Sandstone with Scarab Engraving=Wüstensandstein mit Skarabäusgravur
|
||||
Falling Cracked Sandstone Brick=Fallender rissiger Sandsteinziegel
|
||||
Falling Cracked Desert Sandstone Brick=Fallender rissiger Wüstensandsteinziegel
|
||||
Mummy Spawn Egg=Mumien-Spawn-Ei
|
||||
Mummy Spawner=Mumien-Spawner
|
||||
Sandstone with Eye Engraving=Sandstein mit Augengravur
|
||||
Sandstone with Man Engraving=Sandstein mit Manngravur
|
||||
Sandstone with Sun Engraving=Sandstein mit Sonnengravur
|
||||
A mummy spawner causes hostile mummies to appear in its vicinity as long it exists.=Ein Mumien-Spawner lässt feindliche Mumien in seiner näheren Umgebung auftauchen, solange er existiert.
|
||||
Can be used to create a hostile mummy.=Kann benutzt werden, um eine feindliche Mumie zu erzeugen (auch »spawnen« genannt).
|
||||
Place the egg to create a mummy on this spot. Careful, it will probably attack immediately!=Platzieren Sie das Ei, um dort eine Mumie zu erzeugen. Vorsicht, sie wird wahrscheinlich sofort angreifen!
|
||||
This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it.=Dieser Ziegel ist alt, porös und instabil und kann sich so gerade noch selbst stützen. Man sollte vorsichtig sein, ihn nicht zu belasten.
|
||||
This old porous brick falls under its own weight.=Dieser alte poröse Ziegel fällt unter seinem eigenem Gewicht.
|
||||
No more mummies!=Keine Mumien mehr!
|
||||
Destroy a mummy spawner by digging.=Zerstören Sie einen Mumien-Spawner, indem Sie ihn graben.
|
||||
Generate a pyramid=Eine Pyramide erzeugen
|
||||
[<room_type>]=[<Raumtyp>]
|
||||
Pyramid generated at @1.=Pyramide erzeugt bei @1.
|
||||
Incorrect room type ID: @1=Ungültige Raumtyp-ID: @1
|
4
mod.conf
Normal file
@ -0,0 +1,4 @@
|
||||
name = tsm_pyramids
|
||||
description = Pyramids with treasures! You can find them in deserts and sandstone deserts.
|
||||
depends = default
|
||||
optional_depends = farming, tnt, treasurer, doc_items, awards
|
BIN
models/tsm_pyramids_hit.png
Executable file → Normal file
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 214 B |
BIN
models/tsm_pyramids_mummy.png
Executable file → Normal file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.9 KiB |
0
models/tsm_pyramids_mummy.x
Executable file → Normal file
558
mummy.lua
Executable file → Normal file
@ -1,165 +1,106 @@
|
||||
-- Pyramid mummy
|
||||
local S = minetest.get_translator("tsm_pyramids")
|
||||
|
||||
mobs:register_mob("tsm_pyramids:mummy", {
|
||||
-- animal, monster, npc, barbarian
|
||||
type = "monster",
|
||||
-- aggressive, deals 4 damage to player when hit
|
||||
passive = false,
|
||||
attack_type = "dogfight",
|
||||
damage = 4,
|
||||
-- health & armor
|
||||
hp_min = 15, hp_max = 20, armor = 100,
|
||||
-- textures and model
|
||||
local mummy_walk_limit = 1
|
||||
local mummy_chillaxin_speed = 1
|
||||
local mummy_animation_speed = 10
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local mummy_animation_blend = 0
|
||||
|
||||
-- Default player appearance
|
||||
local mummy_mesh = "tsm_pyramids_mummy.x"
|
||||
local mummy_texture = {"tsm_pyramids_mummy.png"}
|
||||
local mummy_hp = 20
|
||||
local mummy_drop = "default:papyrus"
|
||||
|
||||
local sound_normal = "mummy"
|
||||
local sound_hit = "mummy_hurt"
|
||||
local sound_dead = "mummy_death"
|
||||
|
||||
local spawner_range = 17
|
||||
local spawner_max_mobs = 6
|
||||
|
||||
local function get_animations()
|
||||
return {
|
||||
stand_START = 74,
|
||||
stand_END = 74,
|
||||
sit_START = 81,
|
||||
sit_END = 160,
|
||||
lay_START = 162,
|
||||
lay_END = 166,
|
||||
walk_START = 74,
|
||||
walk_END = 105,
|
||||
mine_START = 74,
|
||||
mine_END = 105,
|
||||
walk_mine_START = 74,
|
||||
walk_mine_END = 105
|
||||
}
|
||||
end
|
||||
|
||||
local npc_model = {}
|
||||
local npc_anim = {}
|
||||
local npc_sneak = {}
|
||||
local ANIM_STAND = 1
|
||||
local ANIM_SIT = 2
|
||||
local ANIM_LAY = 3
|
||||
local ANIM_WALK = 4
|
||||
local ANIM_WALK_MINE = 5
|
||||
local ANIM_MINE = 6
|
||||
|
||||
local function hit(self)
|
||||
local prop = {
|
||||
mesh = mummy_mesh,
|
||||
textures = {"tsm_pyramids_mummy.png^tsm_pyramids_hit.png"},
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
minetest.after(0.4, function(self)
|
||||
local prop = {textures = mummy_texture,}
|
||||
if self.object ~= nil then
|
||||
self.object:set_properties(prop)
|
||||
end
|
||||
end, self)
|
||||
end
|
||||
|
||||
local function mummy_update_visuals_def(self)
|
||||
npc_anim = 0 -- Animation will be set further below immediately
|
||||
local prop = {
|
||||
mesh = mummy_mesh,
|
||||
textures = mummy_texture,
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
end
|
||||
|
||||
local MUMMY_DEF = {
|
||||
physical = true,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "tsm_pyramids_mummy.x",
|
||||
drawtype = "front",
|
||||
textures = {
|
||||
{"tsm_pyramids_mummy.png"},
|
||||
},
|
||||
visual_size = {x=8,y=8},
|
||||
blood_texture = "default_sand.png",
|
||||
-- sounds
|
||||
mesh = mummy_mesh,
|
||||
textures = mummy_texture,
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "mummy",
|
||||
},
|
||||
-- speed and jump, sinks in water
|
||||
walk_velocity = 0.4,
|
||||
run_velocity = 0.8,
|
||||
view_range = 16,
|
||||
jump = false,
|
||||
floats = 0,
|
||||
knock_back = 0.1, --this is a test
|
||||
-- drops papyrus when dead
|
||||
drops = {
|
||||
{name = "default:papyrus",
|
||||
chance = 2, min = 4, max = 6,},
|
||||
{name = "maptools:silver_coin",
|
||||
chance = 10, min = 1, max = 1,},
|
||||
},
|
||||
-- damaged by
|
||||
water_damage = 0,
|
||||
lava_damage = 15,
|
||||
light_damage = 15,
|
||||
-- model animation
|
||||
animation = {
|
||||
speed_normal = 15, speed_run = 15,
|
||||
stand_start = 74, stand_end = 74,
|
||||
walk_start = 74, walk_end = 105,
|
||||
run_start = 74, run_end = 105,
|
||||
punch_start = 74, punch_end = 105,
|
||||
sit_start = 81, sit_end = 160,
|
||||
lay_start = 162, lay_end = 166,
|
||||
mine_start = 74, mine_end = 105,
|
||||
walk_mine_start = 74, walk_mine_end = 105,
|
||||
},
|
||||
})
|
||||
npc_anim = 0,
|
||||
timer = 0,
|
||||
turn_timer = 0,
|
||||
vec = 0,
|
||||
yaw = 0,
|
||||
yawwer = 0,
|
||||
state = 1,
|
||||
jump_timer = 0,
|
||||
punch_timer = 0,
|
||||
sound_timer = 0,
|
||||
envdmg_timer = 0,
|
||||
attacker = "",
|
||||
attacking_timer = 0,
|
||||
mob_name = "mummy"
|
||||
}
|
||||
|
||||
--MFF ABM to replace old maptools:chest
|
||||
minetest.register_abm({
|
||||
nodenames = {"tsm_pyramids:spawner_mummy"},
|
||||
interval = 10.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local chests = minetest.find_nodes_in_area(
|
||||
{x=pos.x-4, y=pos.y-3, z=pos.z-10},
|
||||
{x=pos.x+4, y=pos.y, z=pos.z},
|
||||
"maptools:chest"
|
||||
)
|
||||
for _, cpos in ipairs(chests) do
|
||||
local p2 = 0
|
||||
local n = minetest.get_node_or_nil(cpos)
|
||||
if n and n.param2 then
|
||||
p2 = n.param2
|
||||
end
|
||||
minetest.set_node(cpos, {name="tsm_pyramids:chest", param2=p2})
|
||||
end
|
||||
end
|
||||
})
|
||||
-- spawner (spawn in pyramids, near the spawner)
|
||||
if not minetest.setting_getbool("only_peaceful_mobs") then
|
||||
minetest.register_abm({
|
||||
nodenames = {"tsm_pyramids:spawner_mummy"},
|
||||
interval = 10.0,
|
||||
chance = 20,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local player_near = false
|
||||
local mobs = 0
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 17)) do
|
||||
if obj then
|
||||
if obj:is_player() then
|
||||
player_near = true
|
||||
else
|
||||
if obj:get_luaentity() and obj:get_luaentity().mob_name == "mummy" then mobs = mobs + 1 end
|
||||
end
|
||||
end
|
||||
end
|
||||
if player_near then
|
||||
if mobs < 6 then
|
||||
pos.x = pos.x+1
|
||||
local p = minetest.find_node_near(pos, 5, {"air"})
|
||||
minetest.add_entity(p,"tsm_pyramids:mummy")
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function pyramids.spawn_mummy (pos, number)
|
||||
for i=0,number do
|
||||
minetest.add_entity(pos,"tsm_pyramids:mummy")
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("tsm_pyramids:spawner_mummy", {
|
||||
description = "Mummy spawner",
|
||||
paramtype = "light",
|
||||
tiles = {"tsm_pyramids_spawner.png"},
|
||||
is_ground_content = true,
|
||||
drawtype = "allfaces",--_optional",
|
||||
groups = {unbreakable=1},
|
||||
drop = "",
|
||||
on_construct = function(pos)
|
||||
pos.y = pos.y - 0.28
|
||||
minetest.add_entity(pos,"tsm_pyramids:mummy_spawner")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if not obj:is_player() then
|
||||
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- register spawn egg
|
||||
minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
||||
description = "Mummy spawn-egg",
|
||||
inventory_image = "tsm_pyramids_mummy_egg.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 99,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.add_entity(pointed_thing.above,"tsm_pyramids:mummy")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Spawner entity
|
||||
|
||||
spawner_DEF = {
|
||||
local spawner_DEF = {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
visual = "mesh",
|
||||
visual_size = {x=3.3,y=3.3},
|
||||
mesh = "tsm_pyramids_mummy.x",
|
||||
textures = {"tsm_pyramids_mummy.png"},
|
||||
mesh = mummy_mesh,
|
||||
textures = mummy_texture,
|
||||
makes_footstep_sound = false,
|
||||
timer = 0,
|
||||
automatic_rotate = math.pi * 2.9,
|
||||
@ -168,15 +109,15 @@ spawner_DEF = {
|
||||
|
||||
spawner_DEF.on_activate = function(self)
|
||||
mummy_update_visuals_def(self)
|
||||
self.object:setvelocity({x=0, y=0, z=0})
|
||||
self.object:setacceleration({x=0, y=0, z=0})
|
||||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=0, z=0})
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
|
||||
end
|
||||
|
||||
spawner_DEF.on_step = function(self, dtime)
|
||||
self.timer = self.timer + 0.01
|
||||
local n = minetest.get_node_or_nil(self.object:getpos())
|
||||
local n = minetest.get_node_or_nil(self.object:get_pos())
|
||||
if self.timer > 1 then
|
||||
if n and n.name and n.name ~= "tsm_pyramids:spawner_mummy" then
|
||||
self.object:remove()
|
||||
@ -188,17 +129,304 @@ spawner_DEF.on_punch = function(self, hitter)
|
||||
|
||||
end
|
||||
|
||||
MUMMY_DEF.on_activate = function(self)
|
||||
mummy_update_visuals_def(self)
|
||||
self.anim = get_animations()
|
||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
||||
self.npc_anim = ANIM_STAND
|
||||
self.object:set_acceleration({x=0,y=-20,z=0})--20
|
||||
self.state = 1
|
||||
self.object:set_hp(mummy_hp)
|
||||
self.object:set_armor_groups({fleshy=130})
|
||||
end
|
||||
|
||||
MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
|
||||
self.attacker = puncher
|
||||
|
||||
if puncher ~= nil then
|
||||
local sound = sound_hit
|
||||
if self.object:get_hp() == 0 then sound = sound_dead end
|
||||
minetest.sound_play(sound, {to_player = puncher:get_player_name(), loop = false, gain = 0.3})
|
||||
if time_from_last_punch >= 0.45 then
|
||||
hit(self)
|
||||
self.direction = {x=self.object:get_velocity().x, y=self.object:get_velocity().y, z=self.object:get_velocity().z}
|
||||
self.punch_timer = 0
|
||||
self.object:set_velocity({x=dir.x*mummy_chillaxin_speed,y=5,z=dir.z*mummy_chillaxin_speed})
|
||||
if self.state == 1 then
|
||||
self.state = 8
|
||||
elseif self.state >= 2 then
|
||||
self.state = 9
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.object:get_hp() == 0 then
|
||||
local obj = minetest.add_item(self.object:get_pos(), mummy_drop.." "..math.random(0,3))
|
||||
end
|
||||
end
|
||||
|
||||
local cnt1 = 0
|
||||
local cnt2 = 0
|
||||
|
||||
MUMMY_DEF.on_step = function(self, dtime)
|
||||
self.timer = self.timer + 0.01
|
||||
self.turn_timer = self.turn_timer + 0.01
|
||||
self.jump_timer = self.jump_timer + 0.01
|
||||
self.punch_timer = self.punch_timer + 0.01
|
||||
self.attacking_timer = self.attacking_timer + 0.01
|
||||
self.sound_timer = self.sound_timer + dtime + 0.01
|
||||
|
||||
local current_pos = self.object:get_pos()
|
||||
local current_node = minetest.get_node(current_pos)
|
||||
if self.time_passed == nil then
|
||||
self.time_passed = 0
|
||||
end
|
||||
|
||||
if self.object:get_hp() == 0 then
|
||||
minetest.sound_play(sound_dead, {pos = current_pos, max_hear_distance = 10 , gain = 0.3})
|
||||
self.object:remove()
|
||||
end
|
||||
local def = minetest.registered_nodes[current_node.name]
|
||||
local dps = def.damage_per_second
|
||||
local dmg = 0
|
||||
if dps ~= nil and dps > 0 then
|
||||
dmg = dps
|
||||
end
|
||||
-- Damage from node
|
||||
if dmg < 4 and (minetest.get_item_group(current_node.name, "water") ~= 0 or minetest.get_item_group(current_node.name, "lava") ~= 0) then
|
||||
dmg = 4
|
||||
end
|
||||
-- Damage by suffocation
|
||||
if (def.walkable == nil or def.walkable == true)
|
||||
and (def.drowning == nil or def.drowning == 0)
|
||||
and (def.damage_per_second == nil or def.damage_per_second <= 0)
|
||||
and (def.collision_box == nil or def.collision_box.type == "regular")
|
||||
and (def.node_box == nil or def.node_box.type == "regular")
|
||||
and (def.groups and def.groups.disable_suffocation ~= 1) then
|
||||
dmg = dmg + 1
|
||||
end
|
||||
self.envdmg_timer = self.envdmg_timer + dtime
|
||||
if dmg > 0 then
|
||||
if self.envdmg_timer >= 1 then
|
||||
self.envdmg_timer = 0
|
||||
self.object:set_hp(self.object:get_hp()-dmg)
|
||||
hit(self)
|
||||
self.sound_timer = 0
|
||||
minetest.sound_play(sound_hit, {pos = current_pos, max_hear_distance = 10, gain = 0.3})
|
||||
end
|
||||
else
|
||||
self.time_passed = 0
|
||||
end
|
||||
|
||||
--update moving state every 1 or 2 seconds
|
||||
if self.state < 3 then
|
||||
if self.timer > math.random(1,2) then
|
||||
if self.attacker == "" then
|
||||
self.state = math.random(1,2)
|
||||
else self.state = 1 end
|
||||
self.timer = 0
|
||||
end
|
||||
end
|
||||
|
||||
--play sound
|
||||
if self.sound_timer > math.random(5,35) then
|
||||
minetest.sound_play(sound_normal, {pos = current_pos, max_hear_distance = 10, gain = 0.2})
|
||||
self.sound_timer = 0
|
||||
end
|
||||
|
||||
--after punched
|
||||
if self.state >= 8 then
|
||||
if self.punch_timer > 0.15 then
|
||||
if self.state == 9 then
|
||||
self.object:set_velocity({x=self.direction.x*mummy_chillaxin_speed,y=-20,z=self.direction.z*mummy_chillaxin_speed})
|
||||
self.state = 2
|
||||
elseif self.state == 8 then
|
||||
self.object:set_velocity({x=0,y=-20,z=0})
|
||||
self.state = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--STANDING
|
||||
if self.state == 1 then
|
||||
self.yawwer = true
|
||||
self.attacker = ""
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 4)) do
|
||||
if object:is_player() then
|
||||
self.yawwer = false
|
||||
local NPC = self.object:get_pos()
|
||||
local PLAYER = object:get_pos()
|
||||
self.vec = {x=PLAYER.x-NPC.x, y=PLAYER.y-NPC.y, z=PLAYER.z-NPC.z}
|
||||
self.yaw = math.atan(self.vec.z/self.vec.x)+math.pi^2
|
||||
if PLAYER.x > NPC.x then
|
||||
self.yaw = self.yaw + math.pi
|
||||
end
|
||||
self.yaw = self.yaw - 2
|
||||
self.object:set_yaw(self.yaw)
|
||||
self.attacker = object
|
||||
end
|
||||
end
|
||||
|
||||
if self.attacker == "" and self.turn_timer > math.random(1,4) then
|
||||
self.yaw = 360 * math.random()
|
||||
self.object:set_yaw(self.yaw)
|
||||
self.turn_timer = 0
|
||||
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
||||
end
|
||||
self.object:set_velocity({x=0,y=self.object:get_velocity().y,z=0})
|
||||
if self.npc_anim ~= ANIM_STAND then
|
||||
self.anim = get_animations()
|
||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
||||
self.npc_anim = ANIM_STAND
|
||||
end
|
||||
if self.attacker ~= "" then
|
||||
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
||||
self.state = 2
|
||||
end
|
||||
end
|
||||
--WALKING
|
||||
if self.state == 2 then
|
||||
|
||||
if self.direction ~= nil then
|
||||
self.object:set_velocity({x=self.direction.x*mummy_chillaxin_speed,y=self.object:get_velocity().y,z=self.direction.z*mummy_chillaxin_speed})
|
||||
end
|
||||
if self.turn_timer > math.random(1,4) and not self.attacker then
|
||||
self.yaw = 360 * math.random()
|
||||
self.object:set_yaw(self.yaw)
|
||||
self.turn_timer = 0
|
||||
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
||||
end
|
||||
if self.npc_anim ~= ANIM_WALK then
|
||||
self.anim = get_animations()
|
||||
self.object:set_animation({x=self.anim.walk_START,y=self.anim.walk_END}, mummy_animation_speed, mummy_animation_blend)
|
||||
self.npc_anim = ANIM_WALK
|
||||
end
|
||||
|
||||
if self.attacker ~= "" and minetest.settings:get_bool("enable_damage") then
|
||||
local s = self.object:get_pos()
|
||||
local p = self.attacker:get_pos()
|
||||
if (s ~= nil and p ~= nil) then
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
|
||||
if dist < 2 and self.attacking_timer > 0.6 then
|
||||
self.attacker:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups = {fleshy=1}
|
||||
})
|
||||
self.attacking_timer = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_entity("tsm_pyramids:mummy", MUMMY_DEF)
|
||||
minetest.register_entity("tsm_pyramids:mummy_spawner", spawner_DEF)
|
||||
|
||||
function mummy_update_visuals_def(self)
|
||||
--local name = get_player_name()
|
||||
-- visual = default_model_def
|
||||
self.npc_anim = 0 -- Animation will be set further below immediately
|
||||
--npc_sneak[name] = false
|
||||
local prop = {
|
||||
mesh = self.mesh,
|
||||
textures = self.textures,
|
||||
--visual_size = {x=1, y=1, z=1},
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
|
||||
--spawn-egg/spawner
|
||||
|
||||
minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
||||
description = S("Mummy Spawn Egg"),
|
||||
_doc_items_longdesc = S("Can be used to create a hostile mummy."),
|
||||
_doc_items_usagehelp = S("Place the egg to create a mummy on this spot. Careful, it will probably attack immediately!"),
|
||||
inventory_image = "tsm_pyramids_mummy_egg.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 99,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.add_entity(pointed_thing.above,"tsm_pyramids:mummy")
|
||||
if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
function tsm_pyramids.spawn_mummy (pos, number)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
for _=1, number do
|
||||
minetest.add_entity(pos,"tsm_pyramids:mummy")
|
||||
end
|
||||
end
|
||||
|
||||
local spawnersounds
|
||||
if default.node_sound_metal_defaults then
|
||||
spawnersounds = default.node_sound_metal_defaults()
|
||||
else
|
||||
spawnersounds = default.node_sound_stone_defaults()
|
||||
end
|
||||
|
||||
minetest.register_node("tsm_pyramids:spawner_mummy", {
|
||||
description = S("Mummy Spawner"),
|
||||
_doc_items_longdesc = S("A mummy spawner causes hostile mummies to appear in its vicinity as long it exists."),
|
||||
paramtype = "light",
|
||||
tiles = {"tsm_pyramids_spawner.png"},
|
||||
is_ground_content = false,
|
||||
drawtype = "allfaces",
|
||||
groups = {cracky=1,level=1},
|
||||
drop = "",
|
||||
on_construct = function(pos)
|
||||
pos.y = pos.y - 0.28
|
||||
minetest.add_entity(pos,"tsm_pyramids:mummy_spawner")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if not obj:is_player() then
|
||||
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
sounds = spawnersounds,
|
||||
})
|
||||
if not minetest.settings:get_bool("only_peaceful_mobs") then
|
||||
minetest.register_abm({
|
||||
nodenames = {"tsm_pyramids:spawner_mummy"},
|
||||
interval = 2.0,
|
||||
chance = 20,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local player_near = false
|
||||
local mobs = 0
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, spawner_range)) do
|
||||
if obj:is_player() then
|
||||
player_near = true
|
||||
else
|
||||
if obj:get_luaentity() and obj:get_luaentity().mob_name == "mummy" then
|
||||
mobs = mobs + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
if player_near then
|
||||
if mobs < spawner_max_mobs then
|
||||
pos.x = pos.x+1
|
||||
local p = minetest.find_node_near(pos, 5, {"air"})
|
||||
local p2 = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local n2 = minetest.get_node(p2)
|
||||
if n2.name == "air" then
|
||||
tsm_pyramids.spawn_mummy(p, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("awards") then
|
||||
awards.register_achievement("tsm_pyramids_no_mummy_spawner", {
|
||||
title = S("No more mummies!"),
|
||||
description = S("Destroy a mummy spawner by digging."),
|
||||
secret = true,
|
||||
icon = "tsm_pyramids_spawner.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "tsm_pyramids:spawner_mummy",
|
||||
target = 1
|
||||
}
|
||||
})
|
||||
end
|
||||
|
127
nodes.lua
Executable file → Normal file
@ -1,23 +1,54 @@
|
||||
local img = {"eye", "men", "sun"}
|
||||
local S = minetest.get_translator("tsm_pyramids")
|
||||
|
||||
for i=1,3 do
|
||||
local img = {
|
||||
"eye", "men", "sun",
|
||||
"ankh", "scarab", "cactus"
|
||||
}
|
||||
local desc = {
|
||||
S("Sandstone with Eye Engraving"), S("Sandstone with Man Engraving"), S("Sandstone with Sun Engraving"),
|
||||
S("Desert Sandstone with Ankh Engraving"), S("Desert Sandstone with Scarab Engraving"), S("Desert Sandstone with Cactus Engraving")
|
||||
}
|
||||
|
||||
local decodesc = ""
|
||||
if minetest.get_modpath("doc_items") then
|
||||
decodesc = doc.sub.items.temp.deco
|
||||
end
|
||||
|
||||
for i=1, #img do
|
||||
local sandstone_img, basenode
|
||||
if i > 3 then
|
||||
sandstone_img = "default_desert_sandstone.png"
|
||||
basenode = "default:desert_sandstone"
|
||||
else
|
||||
sandstone_img = "default_sandstone.png"
|
||||
basenode = "default:sandstone"
|
||||
end
|
||||
minetest.register_node("tsm_pyramids:deco_stone"..i, {
|
||||
description = "Sandstone with "..img[i],
|
||||
tiles = {"default_sandstone.png^tsm_pyramids_"..img[i]..".png"},
|
||||
description = desc[i],
|
||||
_doc_items_longdesc = decodesc,
|
||||
is_ground_content = false,
|
||||
groups = {unbreakable=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
tiles = {sandstone_img, sandstone_img, sandstone_img.."^tsm_pyramids_"..img[i]..".png"},
|
||||
groups = minetest.registered_nodes[basenode].groups,
|
||||
sounds = minetest.registered_nodes[basenode].sounds,
|
||||
})
|
||||
end
|
||||
|
||||
local trap_on_timer = function (pos, elapsed)
|
||||
local trap_on_timer = function(pos, elapsed)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 2)
|
||||
local n = minetest.get_node(pos)
|
||||
for i, obj in pairs(objs) do
|
||||
if obj:is_player() then
|
||||
local n = minetest.get_node(pos)
|
||||
if n and n.name and minetest.registered_nodes[n.name].crack < 2 then
|
||||
minetest.set_node(pos, {name="tsm_pyramids:trap_2"})
|
||||
nodeupdate(pos)
|
||||
if n and n.name then
|
||||
if minetest.registered_nodes[n.name]._tsm_pyramids_crack and minetest.registered_nodes[n.name]._tsm_pyramids_crack < 2 then
|
||||
if n.name == "tsm_pyramids:trap" then
|
||||
minetest.set_node(pos, {name="tsm_pyramids:trap_2"})
|
||||
minetest.check_for_falling(pos)
|
||||
elseif n.name == "tsm_pyramids:desert_trap" then
|
||||
minetest.set_node(pos, {name="tsm_pyramids:desert_trap_2"})
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -25,47 +56,71 @@ local trap_on_timer = function (pos, elapsed)
|
||||
end
|
||||
|
||||
minetest.register_node("tsm_pyramids:trap", {
|
||||
description = "Cracked sandstone brick",
|
||||
description = S("Cracked Sandstone Brick"),
|
||||
_doc_items_longdesc = S("This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it."),
|
||||
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=2,cracky=3},
|
||||
groups = {crumbly=3,cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.1)
|
||||
end,
|
||||
crack = 1,
|
||||
_tsm_pyramids_crack = 1,
|
||||
on_timer = trap_on_timer,
|
||||
drop = "",
|
||||
drop = {
|
||||
items = {
|
||||
{ items = { "default:sand" }, rarity = 1 },
|
||||
{ items = { "default:sand" }, rarity = 2 },
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("tsm_pyramids:trap_2", {
|
||||
description = "trapstone",
|
||||
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png^[transformR90"},
|
||||
description = S("Falling Cracked Sandstone Brick"),
|
||||
_doc_items_longdesc = S("This old porous brick falls under its own weight."),
|
||||
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack2.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=2,cracky=3,falling_node=1,not_in_creative_inventory=1},
|
||||
groups = {crumbly=3,cracky=3,falling_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "",
|
||||
drop = {
|
||||
items = {
|
||||
{ items = { "default:sand" }, rarity = 1 },
|
||||
{ items = { "default:sand" }, rarity = 2 },
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
local chestdef = minetest.registered_nodes["default:chest"]
|
||||
minetest.register_node("tsm_pyramids:chest",{
|
||||
description = "tsm_pyramids Chest auto refilled",
|
||||
tiles = chestdef.tiles,
|
||||
stack_max = 1000,
|
||||
paramtype2 = "facedir",
|
||||
minetest.register_node("tsm_pyramids:desert_trap", {
|
||||
description = S("Cracked Desert Sandstone Brick"),
|
||||
_doc_items_longdesc = S("This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it."),
|
||||
tiles = {"default_desert_sandstone_brick.png^tsm_pyramids_crack.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=3,cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
chestdef.on_construct(pos)
|
||||
minetest.get_node_timer(pos):start(pyramids.max_time)
|
||||
pyramids.fill_chest(pos)
|
||||
end,
|
||||
on_metadata_inventory_move = chestdef.on_metadata_inventory_move,
|
||||
on_metadata_inventory_put = chestdef.on_metadata_inventory_put,
|
||||
on_metadata_inventory_take = chestdef.on_metadata_inventory_take,
|
||||
groups = {unbreakable = 1, not_in_creative_inventory = 1},
|
||||
on_timer = function (pos, elapsed)
|
||||
pyramids.fill_chest(pos)
|
||||
return true
|
||||
minetest.get_node_timer(pos):start(0.1)
|
||||
end,
|
||||
_tsm_pyramids_crack = 1,
|
||||
on_timer = trap_on_timer,
|
||||
drop = {
|
||||
items = {
|
||||
{ items = { "default:desert_sand" }, rarity = 1 },
|
||||
{ items = { "default:desert_sand" }, rarity = 2 },
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("tsm_pyramids:desert_trap_2", {
|
||||
description = S("Falling Cracked Desert Sandstone Brick"),
|
||||
_doc_items_longdesc = S("This old porous brick falls under its own weight."),
|
||||
tiles = {"default_desert_sandstone_brick.png^tsm_pyramids_crack2.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=3,cracky=3,falling_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = {
|
||||
items = {
|
||||
{ items = { "default:desert_sand" }, rarity = 1 },
|
||||
{ items = { "default:desert_sand" }, rarity = 2 },
|
||||
},
|
||||
}
|
||||
})
|
||||
|
762
room.lua
Executable file → Normal file
@ -1,80 +1,728 @@
|
||||
local S = minetest.get_translator("tsm_pyramids")
|
||||
|
||||
local room = {"a","a","a","a","a","a","a","a","a",
|
||||
"a","c","a","c","a","c","a","c","a",
|
||||
"a","s","a","s","a","s","a","s","a",
|
||||
"a","a","a","a","a","a","a","a","a",
|
||||
"a","a","a","a","a","a","a","a","a",
|
||||
"a","a","a","a","a","a","a","a","a",
|
||||
"a","s","a","s","a","s","a","s","a",
|
||||
"a","c","a","c","a","c","a","c","a",
|
||||
"a","a","a","a","a","a","a","a","a"}
|
||||
-- ROOM LAYOUTS
|
||||
|
||||
local trap = {"b","b","b","b","b","b","b","b","b",
|
||||
"l","b","l","b","l","b","l","b","b",
|
||||
"l","b","l","b","l","b","l","b","b",
|
||||
"l","b","l","l","l","b","l","l","b",
|
||||
"l","l","b","l","b","l","l","b","b",
|
||||
"l","b","l","l","l","l","l","l","b",
|
||||
"l","b","l","b","l","b","l","b","b",
|
||||
"l","b","l","b","l","b","l","b","b",
|
||||
"b","b","b","b","b","b","b","b","b"}
|
||||
local room_types = {
|
||||
-- Pillar room
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","^"," ","^"," ","^"," ","^"," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" ","v"," ","v"," ","v"," ","v"," ",
|
||||
" "," "," "," "," "," "," "," "," "
|
||||
},
|
||||
traps = true,
|
||||
},
|
||||
-- Hieroglyph walls
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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"
|
||||
},
|
||||
},
|
||||
-- 4 large pillars
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," ","v"," "," "," "," ",
|
||||
" ","s","s"," "," "," ","s","s"," ",
|
||||
" ","s","s"," "," "," ","s","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," ","<",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s","s"," "," "," ","s","s"," ",
|
||||
" ","s","s"," "," "," ","s","s"," ",
|
||||
" "," "," "," ","^"," "," "," "," "
|
||||
},
|
||||
},
|
||||
-- hidden room
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," ","s","S","s","S","s"," "," ",
|
||||
" "," ","S"," "," "," ","S"," "," ",
|
||||
" "," ","s"," ",">"," ","s"," ","<",
|
||||
" "," ","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","v","s"," ","S"," ",
|
||||
"S","S"," ","s"," ","s"," ","S"," ",
|
||||
"S","S"," ","s"," "," "," ","S"," ",
|
||||
"v","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","^","s"," ","S"," ",
|
||||
" ","S"," ","s","s","s"," ","S"," ",
|
||||
" ","S"," "," "," "," "," ","S"," ",
|
||||
" ","S","S","S","S","S","S","S"," ",
|
||||
" "," "," "," "," "," "," "," "," "
|
||||
},
|
||||
},
|
||||
-- pillar mania
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," ","v"," ","v"," ","v"," ","v",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" "," ","^"," ","^"," ","^"," ","^",
|
||||
},
|
||||
--traps = true,
|
||||
},
|
||||
-- plusses
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"s"," "," "," "," "," "," "," ","s",
|
||||
" "," ","s",">"," ","<","s"," "," ",
|
||||
" ","s","s","s"," ","s","s","s"," ",
|
||||
" "," ","s"," "," "," ","s"," "," ",
|
||||
" "," "," "," ","<"," "," "," "," ",
|
||||
" "," ","s"," "," "," ","s"," "," ",
|
||||
" ","s","s","s"," ","s","s","s"," ",
|
||||
" "," ","s",">"," ","<","s"," "," ",
|
||||
"s"," "," "," "," "," "," "," ","s",
|
||||
},
|
||||
--traps = true,
|
||||
},
|
||||
-- diamond
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
">","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",
|
||||
},
|
||||
--traps = true,
|
||||
},
|
||||
-- square
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","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"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- hallway 2
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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","v","S","S"," ",
|
||||
"S","S","S","S",">"," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- hallway 3
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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"," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- hallway 4
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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",
|
||||
},
|
||||
},
|
||||
-- tiny
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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","^",
|
||||
},
|
||||
},
|
||||
-- small
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"S","S","S","S","S","S","S","S","S",
|
||||
"S","S","S","S","S","S","S","S","S",
|
||||
"S","S"," ","v"," ","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",
|
||||
},
|
||||
},
|
||||
-- small 2
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","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"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- big pillar
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," ","^"," "," "," "," ",
|
||||
" "," "," ","s","s","s"," "," "," ",
|
||||
" "," ","<","s","S","s",">"," "," ",
|
||||
" "," "," ","s","s","s"," "," "," ",
|
||||
" "," "," "," ","v"," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
--traps = true,
|
||||
},
|
||||
-- pacman
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," ","s","s","s"," "," "," ",
|
||||
" "," ","s","s","v","s","s"," "," ",
|
||||
" "," ","s",">"," "," "," "," "," ",
|
||||
" "," ","s","s","^","s","s"," "," ",
|
||||
" "," "," ","s","s","s"," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- the wall
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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"," ","<",
|
||||
},
|
||||
},
|
||||
-- split
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," ","^"," ","^"," "," "," ",
|
||||
" "," "," ","s"," ","s"," "," "," ",
|
||||
" "," "," ","v"," ","v"," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- 4 small pillars
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," ","^"," "," "," "," ",
|
||||
" "," "," "," ","s"," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","<","s"," "," "," ","s",">"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," ","s"," "," "," "," ",
|
||||
" "," "," "," ","v"," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- 6 pillars
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," ","^"," ","^"," ","^"," "," ",
|
||||
" "," ","s"," ","s"," ","s"," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," ","s"," ","s"," ","s"," "," ",
|
||||
" "," ","v"," ","v"," ","v"," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
traps = true,
|
||||
},
|
||||
-- stripes
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" ","S","v","S","v","S","v","S","v",
|
||||
" ","S"," ","S"," ","S"," ","S"," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" ","S"," ","S"," ","S"," ","S"," ",
|
||||
" ","S","^","S","^","S","^","S","^",
|
||||
},
|
||||
},
|
||||
-- inside
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," "," "," "," "," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," ","s","S","s"," "," "," ",
|
||||
" "," "," ","S",">"," "," "," "," ",
|
||||
" "," "," ","s","S","s"," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","s"," "," "," "," "," ","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- 1 chest
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," ","<"," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- 2 chests
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," ","<",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," ","<",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
traps = true,
|
||||
},
|
||||
-- X
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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",
|
||||
},
|
||||
},
|
||||
-- split 2
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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","v","v","v",
|
||||
"S","S","S"," "," "," "," "," "," ",
|
||||
"S","S","S"," "," "," "," "," "," ",
|
||||
"S","S","S","S","S","S","S","S","S",
|
||||
},
|
||||
},
|
||||
-- split 3
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","^"," ","^"," ","^"," ","^"," ",
|
||||
" ","s"," ","s"," ","s"," ","s"," ",
|
||||
" ","v"," ","v"," ","v"," ","v"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- diamond 2
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"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",
|
||||
},
|
||||
},
|
||||
-- ultra pillars
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" ","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","v","s"," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- vstripes
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"S"," "," "," "," "," "," "," "," ",
|
||||
"S"," "," ","^"," "," ","^"," "," ",
|
||||
"S"," "," ","s"," "," ","s"," "," ",
|
||||
"S"," "," "," "," "," "," "," "," ",
|
||||
" "," "," ","s"," "," ","s"," "," ",
|
||||
"S"," "," "," "," "," "," "," "," ",
|
||||
"S"," "," ","s"," "," ","s"," "," ",
|
||||
"S"," "," ","v"," "," ","v"," "," ",
|
||||
"S"," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
},
|
||||
-- sides
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
"s"," ","s"," ","s"," ","s"," ","s",
|
||||
" "," ","v"," ","v"," ","v"," "," ",
|
||||
"s"," "," "," "," "," "," "," ","s",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," "," "," "," "," "," "," ","s",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
"s"," "," "," "," "," "," "," ","s",
|
||||
" "," ","^"," ","^"," ","^"," "," ",
|
||||
"s"," ","s"," ","s"," ","s"," ","s",
|
||||
},
|
||||
traps = true,
|
||||
},
|
||||
-- 9 pillars
|
||||
{
|
||||
style = "yrepeat",
|
||||
layout = {
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," ","^"," ","^"," ","^"," "," ",
|
||||
" "," ","s"," ","s"," ","s"," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," ","s"," ","s"," ","s"," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
" "," ","s"," ","s"," ","s"," "," ",
|
||||
" "," ","v"," ","v"," ","v"," "," ",
|
||||
" "," "," "," "," "," "," "," "," ",
|
||||
},
|
||||
--traps = true,
|
||||
},
|
||||
|
||||
local code = {}
|
||||
code["s"] = "sandstone"
|
||||
code["eye"] = "deco_stone1"
|
||||
code["men"] = "deco_stone2"
|
||||
code["sun"] = "deco_stone3"
|
||||
code["c"] = "chest"
|
||||
code["b"] = "sandstonebrick"
|
||||
code["a"] = "air"
|
||||
code["l"] = "lava_source"
|
||||
code["t"] = "trap"
|
||||
|
||||
local function replace(str,iy)
|
||||
local out = "default:"
|
||||
if iy < 4 and str == "c" then str = "a" end
|
||||
if iy == 0 and str == "s" then out = "tsm_pyramids:" str = "sun" end
|
||||
if iy == 3 and str == "s" then out = "tsm_pyramids:" str = "men" end
|
||||
if str == "a" then out = "" end
|
||||
if str == "c" then out = "tsm_pyramids:" end --MFF newchest
|
||||
if str == "s" or str == "b" then out = "maptools:" end
|
||||
return out..code[str]
|
||||
|
||||
}
|
||||
|
||||
local layout_traps
|
||||
local layout_traps_template = {
|
||||
"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"
|
||||
}
|
||||
|
||||
local code_sandstone = {
|
||||
[" "] = "air",
|
||||
["s"] = "default:sandstone",
|
||||
["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",
|
||||
}
|
||||
local code_desert_sandstone = table.copy(code_sandstone)
|
||||
code_desert_sandstone["s"] = "default:desert_sandstone"
|
||||
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"
|
||||
|
||||
local code_desert_stone = table.copy(code_sandstone)
|
||||
code_desert_stone["s"] = "default:desert_stone_block"
|
||||
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"
|
||||
-- TODO: Add desert stone trap?
|
||||
code_desert_stone["t"] = "air"
|
||||
|
||||
local function replace(str, iy, code_table, deco, column_style)
|
||||
if iy < 4 and (str == "<" or str == ">" or str == "^" or str == "v") then str = " " end
|
||||
if column_style == 1 or column_style == 2 then
|
||||
if iy == 0 and str == "s" then str = deco[1] end
|
||||
if iy == 3 and str == "s" then str = deco[2] end
|
||||
elseif column_style == 3 then
|
||||
if iy == 0 and str == "s" then str = deco[1] end
|
||||
if iy == 2 and str == "s" then str = deco[2] end
|
||||
elseif column_style == 4 then
|
||||
if iy == 2 and str == "s" then str = deco[1] end
|
||||
end
|
||||
return code_table[str]
|
||||
end
|
||||
|
||||
local function replace2(str,iy)
|
||||
local out = "default:"
|
||||
if iy == 0 and str == "l" then out = "tsm_pyramids:" str = "t"
|
||||
elseif iy < 3 and str == "l" then str = "a" end
|
||||
local function replace2(str, iy, code_table)
|
||||
if iy == 0 and str == "~" then str = "t"
|
||||
elseif iy < 3 and str == "~" then str = " " end
|
||||
|
||||
if str == "a" then out = "" end
|
||||
return out..code[str]
|
||||
return code_table[str]
|
||||
end
|
||||
|
||||
function pyramids.make_room(pos)
|
||||
local loch = {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 = room[tonumber(ix*9+iz+1)]
|
||||
local p2 = 0
|
||||
if n_str == "c" then
|
||||
if ix < 3 then p2 = 1 else p2 = 3 end
|
||||
function tsm_pyramids.make_room(pos, stype, room_id)
|
||||
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
|
||||
end
|
||||
-- Select random deco block
|
||||
local deco_ids = {"1", "2", "3"}
|
||||
local deco = {}
|
||||
for i=1, 2 do
|
||||
local r = math.random(1, #deco_ids)
|
||||
table.insert(deco, deco_ids[r])
|
||||
table.remove(deco_ids, r)
|
||||
end
|
||||
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
|
||||
local room = room_types[room_id]
|
||||
local chests = {}
|
||||
local column_style = math.random(0,4)
|
||||
if stype == "desert_stone" then
|
||||
column_style = 0
|
||||
end
|
||||
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 == "<" 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,z=hole.z+iz}
|
||||
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)
|
||||
end
|
||||
end
|
||||
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace(n_str,iy), param2=p2})
|
||||
end
|
||||
end
|
||||
else
|
||||
minetest.log("error", "Invalid pyramid room style! room type ID="..r)
|
||||
end
|
||||
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
|
||||
while filled < 8 do
|
||||
for c=1, #chests do
|
||||
tsm_pyramids.fill_chest(chests[c], stype, sanded)
|
||||
filled = filled + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
if room.traps then
|
||||
tsm_pyramids.make_traps(pos, stype)
|
||||
end
|
||||
if sanded then
|
||||
tsm_pyramids.flood_sand(pos, stype)
|
||||
end
|
||||
return true, nil, sanded
|
||||
end
|
||||
|
||||
local shuffle_traps = function(chance)
|
||||
layout_traps = table.copy(layout_traps_template)
|
||||
for a=1, #layout_traps do
|
||||
if layout_traps[a] == "?" then
|
||||
if math.random(1,100) <= chance then
|
||||
layout_traps[a] = "~"
|
||||
else
|
||||
layout_traps[a] = "S"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pyramids.make_traps(pos)
|
||||
local loch = {x=pos.x+7,y=pos.y, z=pos.z+7}
|
||||
function tsm_pyramids.make_traps(pos, stype)
|
||||
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
|
||||
end
|
||||
shuffle_traps(math.random(10,100))
|
||||
local hole = {x=pos.x+7,y=pos.y, 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 = trap[tonumber(ix*9+iz+1)]
|
||||
local n_str = layout_traps[tonumber(ix*9+iz+1)]
|
||||
local p2 = 0
|
||||
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace2(n_str,iy), param2=p2})
|
||||
minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace2(n_str, iy, code_table), param2=p2})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tsm_pyramids.flood_sand(pos, stype)
|
||||
local set_to_sand = {}
|
||||
local nn = "default:sand"
|
||||
if stype == "desert_sandstone" or stype == "desert_stone" then
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.bulk_set_node(set_to_sand, {name=nn})
|
||||
end
|
||||
|
||||
|
BIN
screenshot.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
sounds/mummy.1.ogg
Executable file → Normal file
BIN
sounds/mummy.2.ogg
Executable file → Normal file
BIN
sounds/mummy_death.1.ogg
Executable file → Normal file
BIN
sounds/mummy_hurt.1.ogg
Executable file → Normal file
BIN
textures/tsm_pyramids_ankh.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
textures/tsm_pyramids_cactus.png
Normal file
After Width: | Height: | Size: 236 B |
0
textures/tsm_pyramids_crack.png
Executable file → Normal file
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 390 B |
BIN
textures/tsm_pyramids_crack2.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
textures/tsm_pyramids_eye.png
Executable file → Normal file
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 248 B |
BIN
textures/tsm_pyramids_men.png
Executable file → Normal file
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 240 B |
BIN
textures/tsm_pyramids_mummy_egg.png
Executable file → Normal file
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 731 B |
BIN
textures/tsm_pyramids_scarab.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
textures/tsm_pyramids_spawner.png
Executable file → Normal file
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 453 B |
BIN
textures/tsm_pyramids_sun.png
Executable file → Normal file
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 248 B |