Proper code indentation, remove legacy code

This commit is contained in:
Wuzzy 2016-03-26 20:38:25 +01:00
parent 514ec4616a
commit d3a5ee97c1

View File

@ -3,13 +3,13 @@ local MINE_DEEP_MAX = tonumber(minetest.setting_get("mines_deep_max"))
local MINE_FACTOR = tonumber(minetest.setting_get("mines_spawnfactor")) local MINE_FACTOR = tonumber(minetest.setting_get("mines_spawnfactor"))
if not MINE_DEEP_MIN then if not MINE_DEEP_MIN then
MINE_DEEP_MIN = -64 MINE_DEEP_MIN = -64
end end
if not MINE_DEEP_MAX then if not MINE_DEEP_MAX then
MINE_DEEP_MAX = -380 MINE_DEEP_MAX = -380
end end
if not MINE_FACTOR then if not MINE_FACTOR then
MINE_FACTOR = 1.5 MINE_FACTOR = 1.5
end end
minetest.register_node("tsm_mines:dummy", { minetest.register_node("tsm_mines:dummy", {
@ -76,8 +76,6 @@ local function fill_chest(pos)
if n.name == "tsm_mines:dummy" then if n.name == "tsm_mines:dummy" then
minetest.set_node(pos, {name="default:chest"}) minetest.set_node(pos, {name="default:chest"})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
--meta:set_string("formspec",default.chest_formspec)
--meta:set_string("infotext", "Chest")
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 8*4) inv:set_size("main", 8*4)
local stacks = {} local stacks = {}
@ -101,16 +99,12 @@ end
local function check_dir(dir,old_dir) local function check_dir(dir,old_dir)
if old_dir == 1 and dir == 3 then if old_dir == 1 and dir == 3 then
--n_switch = 2
return true return true
elseif old_dir == 3 and dir == 1 then elseif old_dir == 3 and dir == 1 then
--n_switch = 4
return true return true
elseif old_dir == 2 and dir == 4 then elseif old_dir == 2 and dir == 4 then
--n_switch = 1
return true return true
elseif old_dir == 4 and dir == 2 then elseif old_dir == 4 and dir == 2 then
--n_switch = 3
return true return true
end end
return false return false
@ -118,12 +112,12 @@ end
local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt) local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt)
local pos = {x=mpos.x,y=mpos.y,z=mpos.z} local pos = {x=mpos.x,y=mpos.y,z=mpos.z}
for j=0,12,1 do for j=0,12,1 do
local switch = cnt+1 local switch = cnt+1
local n_switch = math.random(1,4) local n_switch = math.random(1,4)
while check_dir(n_switch,switch) == true do while check_dir(n_switch,switch) == true do
n_switch = math.random(1,4) n_switch = math.random(1,4)
end end
switch = n_switch switch = n_switch
for i=0,20,1 do for i=0,20,1 do
local pillar = ids.air local pillar = ids.air
@ -209,16 +203,12 @@ local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt)
end end
if switch == 1 then if switch == 1 then
pos.z = pos.z+20 pos.z = pos.z+20
--pos.x = pos.x+step
elseif switch == 2 then elseif switch == 2 then
pos.x = pos.x+20 pos.x = pos.x+20
--pos.z = pos.z+step
elseif switch == 3 then elseif switch == 3 then
pos.z = pos.z-20 pos.z = pos.z-20
--pos.x = pos.x+step
elseif switch == 4 then elseif switch == 4 then
pos.x = pos.x-20 pos.x = pos.x-20
--pos.z = pos.z+step
end end
end end
if cnt == 0 then if cnt == 0 then
@ -251,7 +241,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
if cnt < 8/MINE_FACTOR then return end if cnt < 8/MINE_FACTOR then return end
cnt = 0 cnt = 0
--if math.random(0,100) > 85 then return end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data() local data = vm:get_data()
local va = VoxelArea:new{ MinEdge = emin, MaxEdge = emax } local va = VoxelArea:new{ MinEdge = emin, MaxEdge = emax }