Make indentation consistent

This commit is contained in:
Wuzzy 2016-12-30 14:22:38 +01:00
parent be2bc3f0fe
commit ee8c87470e
3 changed files with 75 additions and 69 deletions

View File

@ -74,38 +74,40 @@ local function underground(pos)
end end
local function make_entrance(pos) local function make_entrance(pos)
local gang = {x=pos.x+10,y=pos.y, z=pos.z} local gang = {x=pos.x+10,y=pos.y, z=pos.z}
for iy=2,3,1 do for iy=2,3,1 do
for iz=0,6,1 do for iz=0,6,1 do
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})
if iz >=3 and iy == 3 then if iz >=3 and iy == 3 then
minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"}) minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"})
minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"}) minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"})
minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"}) minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"})
end
end end
end end
end
end end
local function make(pos) local function make(pos)
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")") minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
for iy=0,10,1 do for iy=0,10,1 do
for ix=iy,22-iy,1 do for ix=iy,22-iy,1 do
for iz=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 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="default:sandstonebrick"}) minetest.set_node({x=pos.x+ix,y=pos.y+iy,z=pos.z+iz}, {name="default:sandstonebrick"})
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 == "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 n and n.name and n.name == "default:desert_stone" then
end minetest.set_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz},{name="default:desert_sand"})
end
end
end
end end
end end
end
pyramids.make_room(pos) pyramids.make_room(pos)
minetest.after(2, pyramids.make_traps, pos) minetest.after(2, pyramids.make_traps, pos)
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17}) 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}) make_entrance({x=pos.x,y=pos.y, z=pos.z})
end end
local perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise. local perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
@ -140,7 +142,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z}) local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
if noise1 > 0.25 or noise1 < -0.26 then 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 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"}) local p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
while p2 == nil and cnt < 5 do while p2 == nil and cnt < 5 do
@ -169,9 +171,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
p2.y = p2.y - 3 p2.y = p2.y - 3
if p2.y < 0 then p2.y = 0 end 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 then return 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 then
return
end
if math.random(0,10) > 7 then return end if math.random(0,10) > 7 then
return
end
minetest.after(0.8,make,p2) minetest.after(0.8,make,p2)
end end
end) end)

View File

@ -365,31 +365,31 @@ minetest.register_node("tsm_pyramids:spawner_mummy", {
sounds = spawnersounds, sounds = spawnersounds,
}) })
if not minetest.setting_getbool("only_peaceful_mobs") then if not minetest.setting_getbool("only_peaceful_mobs") then
minetest.register_abm({ minetest.register_abm({
nodenames = {"tsm_pyramids:spawner_mummy"}, nodenames = {"tsm_pyramids:spawner_mummy"},
interval = 2.0, interval = 2.0,
chance = 20, chance = 20,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local player_near = false local player_near = false
local mobs = 0 local mobs = 0
for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, spawner_range)) do for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, spawner_range)) do
if obj:is_player() then if obj:is_player() then
player_near = true player_near = true
else else
if obj:get_luaentity() and obj:get_luaentity().mob_name == "mummy" then if obj:get_luaentity() and obj:get_luaentity().mob_name == "mummy" then
mobs = mobs + 1 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"})
minetest.env:add_entity(p,"tsm_pyramids:mummy")
end end
end 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"})
minetest.env:add_entity(p,"tsm_pyramids:mummy")
end
end
end
})
end end
if minetest.get_modpath("awards") then if minetest.get_modpath("awards") then

View File

@ -48,31 +48,31 @@ local function replace2(str,iy)
end end
function pyramids.make_room(pos) function pyramids.make_room(pos)
local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7} local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
for iy=0,4,1 do for iy=0,4,1 do
for ix=0,8,1 do for ix=0,8,1 do
for iz=0,8,1 do for iz=0,8,1 do
local n_str = room[tonumber(ix*9+iz+1)] local n_str = room[tonumber(ix*9+iz+1)]
local p2 = 0 local p2 = 0
if n_str == "c" then if n_str == "c" then
if ix < 3 then p2 = 1 else p2 = 3 end if ix < 3 then p2 = 1 else p2 = 3 end
pyramids.fill_chest({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}) pyramids.fill_chest({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz})
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
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace(n_str,iy), param2=p2})
end end
end end
end
end end
function pyramids.make_traps(pos) function pyramids.make_traps(pos)
local loch = {x=pos.x+7,y=pos.y, z=pos.z+7} local loch = {x=pos.x+7,y=pos.y, z=pos.z+7}
for iy=0,4,1 do for iy=0,4,1 do
for ix=0,8,1 do for ix=0,8,1 do
for iz=0,8,1 do for iz=0,8,1 do
local n_str = trap[tonumber(ix*9+iz+1)] local n_str = trap[tonumber(ix*9+iz+1)]
local p2 = 0 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=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace2(n_str,iy), param2=p2})
end
end end
end end
end
end end