mirror of
http://repo.or.cz/minetest_pyramids/tsm_pyramids.git
synced 2024-12-22 23:40:18 +01:00
Don't use sand in desert sand pyramids
This commit is contained in:
parent
7b0c42954f
commit
08a750820b
11
init.lua
11
init.lua
@ -105,7 +105,7 @@ local function make_entrance(pos, brick, sand, flood_sand)
|
|||||||
for iz=0,6,1 do
|
for iz=0,6,1 do
|
||||||
local sand_height = math.random(1,max_sand_height)
|
local sand_height = math.random(1,max_sand_height)
|
||||||
for iy=2,3,1 do
|
for iy=2,3,1 do
|
||||||
if flood_sand and iy <= sand_height and iz >= 3 then
|
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})
|
minetest.set_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz}, {name=sand})
|
||||||
else
|
else
|
||||||
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
||||||
@ -131,6 +131,7 @@ local function make_pyramid(pos, brick, sandstone, stone, sand)
|
|||||||
make_foundation_part({x=pos.x+ix,y=pos.y,z=pos.z+iz}, set_to_stone)
|
make_foundation_part({x=pos.x+ix,y=pos.y,z=pos.z+iz}, set_to_stone)
|
||||||
end
|
end
|
||||||
table.insert(set_to_brick, {x=pos.x+ix,y=pos.y+iy,z=pos.z+iz})
|
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
|
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})
|
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
|
if n and n.name and n.name == stone then
|
||||||
@ -140,10 +141,13 @@ local function make_pyramid(pos, brick, sandstone, stone, sand)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
minetest.bulk_set_node(set_to_stone , {name=stone})
|
minetest.bulk_set_node(set_to_stone , {name=stone})
|
||||||
minetest.bulk_set_node(set_to_brick, {name=brick})
|
minetest.bulk_set_node(set_to_brick, {name=brick})
|
||||||
|
if sand ~= "ignore" then
|
||||||
minetest.bulk_set_node(set_to_sand, {name=sand})
|
minetest.bulk_set_node(set_to_sand, {name=sand})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
|
local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
|
||||||
-- Build pyramid
|
-- Build pyramid
|
||||||
@ -307,11 +311,14 @@ minetest.register_chatcommand("spawnpyramid", {
|
|||||||
local ok, msg
|
local ok, msg
|
||||||
pos = vector.add(pos, {x=-11, y=-1, z=0})
|
pos = vector.add(pos, {x=-11, y=-1, z=0})
|
||||||
if s == 1 then
|
if s == 1 then
|
||||||
|
-- Sandstone
|
||||||
ok, msg = make(pos, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone", room_id)
|
ok, msg = make(pos, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone", room_id)
|
||||||
elseif s == 2 then
|
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)
|
ok, msg = make(pos, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert_sandstone", room_id)
|
||||||
else
|
else
|
||||||
ok, msg = make(pos, "default:desert_stonebrick", "default:desert_stone_block", "default:desert_stone", "default:desert_sand", "desert_stone", room_id)
|
-- Desert stone
|
||||||
|
ok, msg = make(pos, "default:desert_stonebrick", "default:desert_stone_block", "default:desert_stone", "ignore", "desert_stone", room_id)
|
||||||
end
|
end
|
||||||
if ok then
|
if ok then
|
||||||
return true, S("Pyramid generated at @1.", minetest.pos_to_string(pos))
|
return true, S("Pyramid generated at @1.", minetest.pos_to_string(pos))
|
||||||
|
2
room.lua
2
room.lua
@ -648,7 +648,7 @@ function tsm_pyramids.make_room(pos, stype, room_id)
|
|||||||
else
|
else
|
||||||
minetest.log("error", "Invalid pyramid room style! room type ID="..r)
|
minetest.log("error", "Invalid pyramid room style! room type ID="..r)
|
||||||
end
|
end
|
||||||
local sanded = room.flood_sand ~= false and math.random(1,8) == 1
|
local sanded = room.flood_sand ~= false and stype ~= "desert_stone" and math.random(1,8) == 1
|
||||||
if #chests > 0 then
|
if #chests > 0 then
|
||||||
-- Make at least 8 attempts to fill chests
|
-- Make at least 8 attempts to fill chests
|
||||||
local filled = 0
|
local filled = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user