/** 
	Krakatoa
	A Volcano with lot's of small islands and chasms.
	
	@author Maikel
*/


// Fills an overlay with random specks.
overlay RandomMat {
	mask=1; invert=1; grp=1;
	loosebounds=1;
	// Combine multiple algortihms.
	overlay {
		algo=rndchecker; a=15;
		zoomX=10; zoomY=-10;
		turbulence=100; lambda=3;
		mask=1; loosebounds=1;
	} | overlay { 
		algo=bozo; a=15;
		zoomX=10; zoomY=-10;
		turbulence=1000; lambda=3;
		mask=1; loosebounds=1;
	} | overlay {
		algo=bozo; a=12;
		zoomX=-10; zoomY=10;
		turbulence=1000; lambda=3;
		mask=1; loosebounds=1;
	};
};

// Fills an overlay with some random spots.
overlay RandomSpots {
	mask=1; invert=1; grp=1;
	overlay {
		algo=bozo; a=10;
		zoomX=10; zoomY=-10;
		turbulence=1000; lambda=3;
		mask=1; loosebounds=1;
	} & overlay {
		algo=bozo; a=10;
		zoomX=-10; zoomY=10;
		turbulence=1000; lambda=3;
		mask=1; loosebounds=1;
	};
};

// A nice volcano with some less nice places to settle.
map Volcano {
	// The main volcano shape, by a sine.
	overlay {
		algo=sin;
		ox=-44; oy=30;
		zoomX=85; zoomY=70;
		turbulence=10; lambda=2;
		
		// Earth as background material.
		mat=Earth; tex=earth;
		
		// Different volcano layers are created with shifted sines.
		// Outer volcano layer: Barely any materials, but lot's of earth.
		overlay {
			algo=sin; 
			ox=-44; oy=30;
			zoomX=85; zoomY=70;
			turbulence=10; lambda=2;
			mat=Earth; tex=earth;
			RandomMat & overlay { mat=Granite; tex=granite; };
			RandomMat & overlay { mat=Rock; tex=rock_cracked; }; 
			RandomMat & overlay { mat=Ore; tex=ore; };
			RandomMat & overlay { mat=Sulphur; tex=sulphur; };
			RandomMat & overlay { mat=Coal; tex=coal; };
			RandomMat & overlay { mat=Rock; tex=rock; };
			RandomSpots & overlay { mat=Ore; tex=ore; }; 
			RandomMat & overlay { algo=bozo; mat=Earth; tex=earth_rough; };
			RandomMat & overlay { algo=bozo; mat=Earth; tex=earth_dry; };
 			RandomMat & overlay { algo=bozo; mat=Earth; tex=earth_topsoil; };
 			RandomSpots & overlay { mat=Ashes; tex=ashes; };
 			RandomSpots & overlay { mat=Earth; tex=earth_midsoil; };
 			RandomSpots & overlay { mat=Earth; tex=earth_midsoil; };
		}; 		
		
		// Middle volcano layer: Mostly with necessary resources like ore, coal, sulphur.
		overlay {
			algo=sin;
			ox=-44; oy=50;
			zoomX=85; zoomY=70;
			turbulence=10; lambda=2;
			mat=Earth; tex=earth;
			RandomMat & overlay { mat=Rock; tex=rock_cracked; }; 
 			RandomMat & overlay { mat=Granite; tex=granite; };
 			RandomMat & overlay { mat=Earth; tex=earth_topsoil; }; 
			RandomMat & overlay { mat=Ore; tex=ore; };
			RandomMat & overlay { mat=Sulphur; tex=sulphur; };
			RandomMat & overlay { mat=Coal; tex=coal; };
			RandomMat & overlay { mat=Rock; tex=rock; };
			RandomSpots & overlay { mat=Ore; tex=ore; }; 			
 			RandomMat & overlay { algo=bozo; mat=Earth; tex=earth_rough; };
			RandomMat & overlay { algo=bozo; mat=Earth; tex=earth_dry; };
			RandomSpots & overlay { mat=Ashes; tex=ashes; };
 			RandomSpots & overlay { mat=Earth; tex=earth_midsoil; };
 			RandomSpots & overlay { mat=Earth; tex=earth_midsoil; };
		};
				
		// Volcano core: Mostly rare materials like gold.
		overlay {
			algo=sin;
			ox=-44; oy=70;
			zoomX=85; zoomY=70;
			turbulence=10; lambda=2;
			mat=Earth; tex=earth;
			RandomMat & overlay { mat=Granite; tex=granite; };
 			RandomMat & overlay { mat=Earth; tex=earth_topsoil; }; 
			RandomMat & overlay { mat=Ore; tex=ore; };
			RandomMat & overlay { mat=Sulphur; tex=sulphur; };
			RandomMat & overlay { mat=Coal; tex=coal; };
			RandomMat & overlay { mat=Rock; tex=rock; }; 			
 			RandomMat & overlay { mat=Earth; tex=earth_rough; };
 			RandomMat & overlay { mat=Earth; tex=earth_dry; };
 			RandomMat & overlay { mat=Ashes; tex=ashes; };
			RandomSpots & overlay { mat=Earth; tex=earth_midsoil; };
			RandomSpots & overlay { mat=Earth; tex=earth_midsoil; };
			RandomMat & overlay { mat=Gold; tex=gold; };
			RandomMat & overlay { mat=Granite; tex=granite; };
			RandomSpots & overlay { mat=Gold; tex=gold; };
		};		
		
 		// Create tilted tunnel shafts.
		overlay { 
			algo=lines;	a=8; b=24;
			x=10; y=0; wdt=80; hgt=70;
			rotate=40;
			turbulence=100; lambda=2;
			mat=Tunnel; tex=tunnel;
		};
		overlay { 
			algo=lines;	a=8; b=24;
			x=10; y=0; wdt=80; hgt=70;
			rotate=-40;
			turbulence=100; lambda=2;
			mat=Tunnel; tex=tunnel;
		};
		
		// Create tilted lava chasms.
		overlay	{
			algo=sin; invert=1; mask=1;
			ox=25; oy=65;
			zoomX=82; zoomY=90;
			turbulence=10; lambda=2;
			overlay { 
				algo=lines;	a=8; b=20;
				x=0; y=70; wdt=100; hgt=30;
				rotate=45;
				turbulence=100; lambda=3;
				mat=DuroLava; tex=lava_red;
			};
			overlay { 
				algo=lines;	a=8; b=20;
				x=0; y=70; wdt=100; hgt=30;
				rotate=-45;
				turbulence=100; lambda=3;
				mat=DuroLava; tex=lava_red;
			};
		};	
	};
};
