forked from Mirrors/openclonk
reworked Krakatoa landscape, is now map script
parent
178008928b
commit
717ea1a031
|
@ -1,166 +0,0 @@
|
|||
/**
|
||||
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=Firestone; tex=firestone; };
|
||||
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, firestone.
|
||||
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=Firestone; tex=firestone; };
|
||||
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=Firestone; tex=firestone; };
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
|
@ -0,0 +1,211 @@
|
|||
/**
|
||||
Krakatoa
|
||||
A Volcano with lot's of small islands and chasms.
|
||||
|
||||
TODO: Scaling with mapsize.
|
||||
|
||||
@author Maikel
|
||||
*/
|
||||
|
||||
#include Library_Map
|
||||
|
||||
|
||||
// Variable to store the chasm exit points.
|
||||
static chasm_exits;
|
||||
|
||||
// Called be the engine: draw the complete map here.
|
||||
protected func InitializeMap(proplist map)
|
||||
{
|
||||
// Set chasm exits to be an array.
|
||||
chasm_exits = [];
|
||||
|
||||
// Retrieve the settings according to the MapSize setting.
|
||||
var map_size;
|
||||
if (SCENPAR_MapSize == 1)
|
||||
map_size = [200, 150];
|
||||
if (SCENPAR_MapSize == 2)
|
||||
map_size = [240, 180];
|
||||
if (SCENPAR_MapSize == 3)
|
||||
map_size = [280, 210];
|
||||
|
||||
// Set the map size.
|
||||
map->Resize(map_size[0], map_size[1]);
|
||||
|
||||
// Get the volcano main shape.
|
||||
var volcano = CreateVolcano(map);
|
||||
|
||||
// Get the main chasm shape.
|
||||
var main_chasm = CreateChasm(map, volcano);
|
||||
|
||||
// Draw the various parts of the map.
|
||||
DrawVolcano(map, volcano);
|
||||
DrawChasm(map, volcano, main_chasm);
|
||||
|
||||
// Return true to tell the engine a map has been successfully created.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Creates the main volcano shape.
|
||||
public func CreateVolcano(proplist map)
|
||||
{
|
||||
var wdt = map.Wdt;
|
||||
var hgt = map.Hgt;
|
||||
|
||||
// Use the polygon algorithm to construct the main size of the volcano, and rescale according to map size.
|
||||
var x_points = [ 0, 0, 32, 51, 67, 83, 88, 90, 92, 94, 106, 108, 110, 112, 117, 133, 149, 168, 200, 200];
|
||||
var y_points = [150, 100, 86, 75, 60, 38, 46, 48, 50, 51, 51, 50, 48, 46, 38, 60, 75, 86, 100, 150];
|
||||
for (var i = 0; i < GetLength(x_points); i++)
|
||||
{
|
||||
x_points[i] = x_points[i] * wdt / 200;
|
||||
y_points[i] = y_points[i] * hgt / 150;
|
||||
}
|
||||
// Create the volcano layer.
|
||||
var volcano = {Algo = MAPALGO_Polygon, X = x_points, Y = y_points};
|
||||
volcano = {Algo = MAPALGO_Or, Op = [volcano, {Algo = MAPALGO_Turbulence, Amplitude = 6, Scale = 6, Iterations = 2, Seed = Random(65536), Op = volcano}]};
|
||||
return volcano;
|
||||
}
|
||||
|
||||
// Creates the chasm structure.
|
||||
public func CreateChasm(proplist map, proplist volcano)
|
||||
{
|
||||
var wdt = map.Wdt;
|
||||
var hgt = map.Hgt;
|
||||
|
||||
// The main chasm ends in the crater and is a larger reservoir of lava at the bottom.
|
||||
var main_chasm = {Algo = MAPALGO_Rect, X = wdt / 2 - wdt / 40, Y = hgt / 3, Wdt = wdt / 20, Hgt = 2 * hgt / 3};
|
||||
|
||||
// Complete the chasm layer, rescale for larger map sizes.
|
||||
var x_points = [ 73, 82, 94, 106, 118, 127];
|
||||
var y_points = [150, 125, 113, 113, 125, 150];
|
||||
for (var i = 0; i < GetLength(x_points); i++)
|
||||
{
|
||||
x_points[i] = x_points[i] * wdt / 200;
|
||||
y_points[i] = y_points[i] * hgt / 150;
|
||||
}
|
||||
var chasm_bottom = {Algo = MAPALGO_Polygon, X = x_points, Y = y_points};
|
||||
main_chasm = {Algo = MAPALGO_Or, Op = [main_chasm, chasm_bottom]};
|
||||
main_chasm = {Algo = MAPALGO_Or, Op = [main_chasm, {Algo = MAPALGO_Turbulence, Amplitude = 8, Scale = 8, Iterations = 2, Seed = Random(65536), Op = main_chasm}]};
|
||||
|
||||
// Draw the four side chasms, rescale for larger map sizes.
|
||||
var chasm_points = [
|
||||
[[100, 53], [122, 70]],
|
||||
[[100, 71], [92, 52]],
|
||||
[[100, 129], [92, 52]],
|
||||
[[100, 147], [122, 70]]
|
||||
];
|
||||
for (var i = 0; i < GetLength(chasm_points); i++)
|
||||
{
|
||||
chasm_points[i][0][0] = chasm_points[i][0][0] * wdt / 200;
|
||||
chasm_points[i][0][1] = chasm_points[i][0][1] * wdt / 200;
|
||||
chasm_points[i][1][0] = chasm_points[i][1][0] * hgt / 150;
|
||||
chasm_points[i][1][1] = chasm_points[i][1][1] * hgt / 150;
|
||||
}
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
var points = chasm_points[i];
|
||||
var side_chasm = {Algo = MAPALGO_Polygon, X = points[0], Y = points[1], Wdt = 3, Open = 1, Empty = 1};
|
||||
side_chasm = {Algo = MAPALGO_Turbulence, Amplitude = 6, Scale = 6, Iterations = 2, Seed = Random(65536), Op = side_chasm};
|
||||
side_chasm = {Algo = MAPALGO_And, Op = [side_chasm, volcano]};
|
||||
main_chasm = {Algo = MAPALGO_Or, Op = [main_chasm, side_chasm]};
|
||||
}
|
||||
|
||||
// Store chasm exits.
|
||||
chasm_exits[0] = [wdt / 2, hgt / 3];
|
||||
for (var i = 1; i <= 4; i++)
|
||||
chasm_exits[i] = [chasm_points[i - 1][0][1], chasm_points[i - 1][1][1]];
|
||||
|
||||
return main_chasm;
|
||||
}
|
||||
|
||||
// Draws the main volcano shape.
|
||||
public func DrawVolcano(proplist map, proplist volcano)
|
||||
{
|
||||
// The main material for the volcano is earth.
|
||||
map->Draw("Earth", volcano);
|
||||
|
||||
// Also add other materials to the volcano.
|
||||
map->DrawMaterial("Earth-earth_rough", volcano, 2, 18);
|
||||
map->DrawMaterial("Earth-earth_dry", volcano, 2, 18);
|
||||
map->DrawMaterial("Earth-earth_midsoil", volcano, 4, 16);
|
||||
map->DrawMaterial("Ashes", volcano, 3, 8);
|
||||
map->DrawMaterial("Tunnel", volcano, 7, 16);
|
||||
map->DrawMaterial("Tunnel", volcano, 8, 10);
|
||||
map->DrawMaterial("Rock", volcano, 3, 6);
|
||||
map->DrawMaterial("Rock-rock_cracked", volcano, 3, 6);
|
||||
map->DrawMaterial("Ore", volcano, 5, 12);
|
||||
map->DrawMaterial("Firestone", volcano, 5, 12);
|
||||
map->DrawMaterial("Coal", volcano, 5, 12);
|
||||
map->DrawMaterial("DuroLava", volcano, 6, 4);
|
||||
|
||||
// Draw ashes borders around the lava parts.
|
||||
var lava = this->Duplicate("DuroLava");
|
||||
var lava_borders = {Algo = MAPALGO_Border, Op = lava, Wdt = -1, Top = 0};
|
||||
map->Draw("Ashes", lava_borders);
|
||||
|
||||
// Ashes are scattered around the surface.
|
||||
var surface = {Algo = MAPALGO_Border, Top = 1, Op = volcano};
|
||||
map->DrawMaterial("Ashes", surface, 4, 80);
|
||||
var surface = {Algo = MAPALGO_Border, Top = 3, Op = volcano};
|
||||
map->DrawMaterial("Ashes", surface, 4, 40);
|
||||
|
||||
FixLiquidBorders("Earth", "Ashes");
|
||||
return;
|
||||
}
|
||||
|
||||
// Draws the main chasm.
|
||||
public func DrawChasm(proplist map, proplist volcano, proplist chasm)
|
||||
{
|
||||
var wdt = map.Wdt;
|
||||
var hgt = map.Hgt;
|
||||
|
||||
// Add part of the crater with to the chasm.
|
||||
var sky = map->Duplicate("*");
|
||||
sky = {Algo = MAPALGO_Not, Op = {Algo = MAPALGO_Layer, Layer = sky}};
|
||||
var crater = {Algo = MAPALGO_And, Op = [sky, {Algo = MAPALGO_Rect, X = wdt / 2 - 3 * wdt / 40, Y = 43 * hgt / 150, Wdt = 6 * wdt / 40, Hgt = 20}]};
|
||||
var full_chasm = {Algo = MAPALGO_Or, Op = [chasm, crater]};
|
||||
|
||||
// First draw the chasm with tunnel and then make sure the side chasms have a flat surface.
|
||||
map->Draw("Tunnel", full_chasm);
|
||||
for (var i = 1; i <= 4; i++)
|
||||
{
|
||||
var exit = chasm_exits[i];
|
||||
var flat = {Algo = MAPALGO_Rect, X = exit[0] - 5, Y = exit[1] - 3, Wdt = 10, Hgt = 5};
|
||||
full_chasm = {Algo = MAPALGO_And, Op = [full_chasm, {Algo = MAPALGO_Not, Op = flat}]};
|
||||
}
|
||||
// Then fill the chasm with durolava.
|
||||
map->Draw("DuroLava", full_chasm);
|
||||
|
||||
// The border of the chasm is out of rock, granite and ashes.
|
||||
var chasm_crust = {Algo = MAPALGO_Border, Left = -5, Right = -5, Op = full_chasm};
|
||||
chasm_crust = {Algo = MAPALGO_And, Op = [chasm_crust, volcano]};
|
||||
map->Draw("Granite", chasm_crust);
|
||||
chasm_crust = {Algo = MAPALGO_Border, Left = -1, Right = -1, Op = full_chasm};
|
||||
map->Draw("Rock", chasm_crust);
|
||||
map->DrawMaterial("Rock-rock_cracked", chasm_crust, 3, 50);
|
||||
|
||||
// Draw the gold area in the volcano's core.
|
||||
var core = {Algo = MAPALGO_Ellipsis, X = wdt / 2, Y = hgt, Wdt = wdt / 10, Hgt = hgt / 7};
|
||||
core = {Algo = MAPALGO_Turbulence, Amplitude = 6, Scale = 6, Iterations = 2, Seed = Random(65536), Op = core};
|
||||
var lines = {Algo = MAPALGO_Lines, X = 4, Y = 0, Distance = 8};
|
||||
lines = {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = lines};
|
||||
core = {Algo = MAPALGO_And, Op = [core, lines]};
|
||||
map->Draw("Gold", core);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*-- Helper Functions --*/
|
||||
|
||||
// Draws some material inside an island.
|
||||
public func DrawMaterial(string mat, proplist onto_mask, int speck_size, int ratio)
|
||||
{
|
||||
if (!speck_size)
|
||||
speck_size = 4;
|
||||
if (!ratio)
|
||||
ratio = 15;
|
||||
// Use random checker algorithm to draw patches of the material.
|
||||
var rnd_checker = {Algo = MAPALGO_RndChecker, Ratio = ratio, Wdt = speck_size, Hgt = speck_size};
|
||||
rnd_checker = {Algo = MAPALGO_Turbulence, Iterations = 4, Op = rnd_checker};
|
||||
var algo = {Algo = MAPALGO_And, Op = [onto_mask, rnd_checker]};
|
||||
return Draw(mat, algo);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
[Material]
|
||||
Name=Granite
|
||||
Shape=Rough
|
||||
Density=80
|
||||
Friction=100
|
||||
MaxAirSpeed=100
|
||||
MaxSlide=250
|
||||
Placement=60
|
||||
TextureOverlay=granite
|
|
@ -0,0 +1,52 @@
|
|||
# Static Map Material/Texture Table
|
||||
# Index +128 for underground materials
|
||||
OverloadMaterials
|
||||
OverloadTextures
|
||||
|
||||
1=Vehicle-none
|
||||
|
||||
10=Tunnel-tunnel
|
||||
12=Tunnel-brickback
|
||||
|
||||
13=BrickSoft-brick1
|
||||
|
||||
19=DuroLava-lava_red
|
||||
20=Water-water1-water2-water3-water1-water3-water2
|
||||
22=Acid-acid
|
||||
23=Lava-lava_red
|
||||
25=Water-water
|
||||
|
||||
28=Earth-earth
|
||||
29=Earth-earth_dry
|
||||
30=Earth-earth_rough
|
||||
31=Earth-earth_topsoil
|
||||
32=Earth-earth_midsoil
|
||||
33=Ashes-ashes
|
||||
35=SandDry-sand_rough
|
||||
|
||||
36=Ore-ore
|
||||
|
||||
40=Granite-granite
|
||||
42=Granite-rock
|
||||
|
||||
45=Gold-gold
|
||||
|
||||
50=Rock-rock
|
||||
51=Rock-rock_cracked
|
||||
|
||||
53=Firestone-firestone
|
||||
|
||||
54=Coal-coal
|
||||
|
||||
55=Sand-sand_rough
|
||||
56=Sand-sand_smooth
|
||||
|
||||
60=Ruby-Ruby
|
||||
61=Amethyst-Amethyst
|
||||
|
||||
65=Ice-ice2
|
||||
67=Ice-ice3
|
||||
|
||||
70=Snow-snow1
|
||||
|
||||
73=Brick-brick1
|
|
@ -0,0 +1,47 @@
|
|||
[ParameterDef]
|
||||
Name=$Difficulty$
|
||||
Description=$DescDifficulty$
|
||||
ID=Difficulty
|
||||
Default=1
|
||||
LeagueValue=2
|
||||
|
||||
[Options]
|
||||
|
||||
[Option]
|
||||
Name=$DiffNormal$
|
||||
Description=$DescDiffNormal$
|
||||
Value=1
|
||||
|
||||
[Option]
|
||||
Name=$DiffHard$
|
||||
Description=$DescDiffHard$
|
||||
Value=2
|
||||
|
||||
[Option]
|
||||
Name=$DiffInsane$
|
||||
Description=$DescDiffInsane$
|
||||
Value=3
|
||||
|
||||
[ParameterDef]
|
||||
Name=$MapSize$
|
||||
Description=$DescMapSize$
|
||||
ID=MapSize
|
||||
Default=1
|
||||
LeagueValue=1
|
||||
|
||||
[Options]
|
||||
|
||||
[Option]
|
||||
Name=$MapSmall$
|
||||
Description=$DescMapSmall$
|
||||
Value=1
|
||||
|
||||
[Option]
|
||||
Name=$MapAverage$
|
||||
Description=$DescMapAverage$
|
||||
Value=2
|
||||
|
||||
[Option]
|
||||
Name=$MapLarge$
|
||||
Description=$DescMapLarge$
|
||||
Value=3
|
|
@ -2,7 +2,7 @@
|
|||
Icon=23
|
||||
Title=Krakatoa
|
||||
Version=5,4,0,0
|
||||
Difficulty=80
|
||||
Difficulty=60
|
||||
|
||||
[Definitions]
|
||||
Definition1=Objects.ocd
|
||||
|
@ -20,8 +20,6 @@ Crew=Clonk=2
|
|||
Crew=Clonk=2
|
||||
|
||||
[Landscape]
|
||||
InEarth=Rock=1;Firestone=3;Loam=1
|
||||
InEarthLevel=20
|
||||
Sky=Clouds2
|
||||
MapWidth=200
|
||||
MapHeight=150
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
Krakatoa
|
||||
Entry for the "Let's Rock" settlement scenario design competetion.
|
||||
Players are challenged to build up a settlement inside an active volcano.
|
||||
Players are challenged to build up a settlement on top of an active volcano.
|
||||
The goal is to expand your reign by building flags to cover the landscape.
|
||||
Also you need to gather some gold to show your skills of entering a volcano.
|
||||
|
||||
|
@ -16,79 +15,26 @@ protected func Initialize()
|
|||
{
|
||||
// Create expansion and wealth goal.
|
||||
var goal = CreateObject(Goal_Wealth);
|
||||
goal->SetWealthGoal(250);
|
||||
goal->SetWealthGoal(100 + 100 * SCENPAR_Difficulty);
|
||||
goal = CreateObject(Goal_Expansion);
|
||||
goal->SetExpansionGoal(250);
|
||||
goal->SetExpansionGoal(200 + 50 * SCENPAR_Difficulty);
|
||||
|
||||
// Some rules.
|
||||
CreateObject(Rule_TeamAccount);
|
||||
CreateObject(Rule_BuyAtFlagpole);
|
||||
CreateObject(Rule_StructureHPBars);
|
||||
|
||||
// Find start location and place lorry plus extras there.
|
||||
FindVolcanoLocation();
|
||||
var lorry = CreateObject(Lorry);
|
||||
lorry->SetPosition(volcano_location[0], volcano_location[1]);
|
||||
lorry->CreateContents(Loam, 5);
|
||||
lorry->CreateContents(Bread, 5);
|
||||
lorry->CreateContents(Wood, 8);
|
||||
lorry->CreateContents(Rock, 4);
|
||||
lorry->CreateContents(Metal, 4);
|
||||
// Rescale chasm exits.
|
||||
var map_zoom = GetScenarioVal("MapZoom", "Landscape");
|
||||
for (var i = 0; i < 5; i++)
|
||||
lorry->CreateContents(Barrel)->PutLiquid("Water", 300);
|
||||
|
||||
// Adjust the mood, orange sky, darker feeling in general.
|
||||
var dark = 10;
|
||||
SetSkyAdjust(RGB(150, 42, 0));
|
||||
SetGamma(RGB(0,0,0), RGB(128-dark,128-dark,128-dark), RGB(255-2*dark,255-2*dark,255-2*dark));
|
||||
|
||||
// Time of days and celestials.
|
||||
CreateObject(Environment_Celestial);
|
||||
var time = CreateObject(Environment_Time);
|
||||
time->SetTime(60 * 20);
|
||||
time->SetCycleSpeed(20);
|
||||
for (var j = 0; j < 2; j++)
|
||||
chasm_exits[i][j] *= map_zoom;
|
||||
|
||||
// Some dark clouds which rain few ashes.
|
||||
Cloud->Place(15);
|
||||
Cloud->SetPrecipitation("Ashes", 10);
|
||||
|
||||
// Some natural disasters, earthquakes, volcanos, meteorites.
|
||||
Meteor->SetChance(15);
|
||||
Earthquake->SetChance(2);
|
||||
Volcano->SetChance(4);
|
||||
Volcano->SetMaterial("DuroLava");
|
||||
|
||||
// Vegetation.
|
||||
// Place some trees, rather with leaves.
|
||||
var veg;
|
||||
for (var i = 0; i < 20 + Random(4); i++)
|
||||
PlaceVegetation(Tree_Coconut, 0, 0, LandscapeWidth(), LandscapeHeight(), 1000 * (61 + Random(40)));
|
||||
// Create an effect to make sure there will always grow some new trees.
|
||||
AddEffect("EnsureTrees", nil, 100, 20, nil);
|
||||
// Some dead tree trunks.
|
||||
for (var i = 0; i < 16 + Random(4); i++)
|
||||
{
|
||||
veg = PlaceVegetation(Trunk, 0, 0, LandscapeWidth(), LandscapeHeight(), 1000 * (61 + Random(20)));
|
||||
if (veg)
|
||||
veg->SetR(RandomX(-20, 20));
|
||||
}
|
||||
// Some mushrooms as source of food.
|
||||
for (var i = 0; i < 30 + Random(5); i++)
|
||||
PlaceVegetation(Mushroom, 0, 0, LandscapeWidth(), LandscapeHeight());
|
||||
// Some ferns, to be burned soon.
|
||||
for (var i = 0; i < 25 + Random(5); i++)
|
||||
PlaceVegetation(Fern, 0, 0, LandscapeWidth(), LandscapeHeight());
|
||||
// Ranks as a nice additional source of wood.
|
||||
for (var i = 0; i < 16 + Random(4); i++)
|
||||
{
|
||||
veg = PlaceVegetation(Rank, 0, 0, LandscapeWidth(), LandscapeHeight());
|
||||
if (veg)
|
||||
veg->SetR(RandomX(-20, 20));
|
||||
}
|
||||
|
||||
// Initialize the effect for controlling the big volcano.
|
||||
AddEffect("BigVolcano", nil, 100, 5, nil);
|
||||
|
||||
// Initialize different parts of the scenario.
|
||||
InitEnvironment(SCENPAR_Difficulty);
|
||||
InitVegetation(SCENPAR_MapSize);
|
||||
InitAnimals();
|
||||
InitMaterial(4 - SCENPAR_Difficulty);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -128,16 +74,8 @@ protected func InitializePlayer(int plr)
|
|||
crew->CreateContents(Shovel);
|
||||
}
|
||||
// Harsh zoom range.
|
||||
SetPlayerZoomByViewRange(plr, 500, nil, PLRZOOM_Direct | PLRZOOM_LimitMax);
|
||||
SetPlayerZoomByViewRange(plr, 5000, nil, PLRZOOM_Direct | PLRZOOM_LimitMax);
|
||||
SetPlayerViewLock(plr, true);
|
||||
|
||||
// Increase difficulty of goal with player count.
|
||||
var plr_cnt = Min(6, GetPlayerCount());
|
||||
var goal = FindObject(Find_ID(Goal_Wealth));
|
||||
goal->SetWealthGoal(200 + 50 * plr_cnt);
|
||||
goal = FindObject(Find_ID(Goal_Expansion));
|
||||
goal->SetExpansionGoal(200 + 25 * plr_cnt);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,7 +90,7 @@ private func FindVolcanoLocation()
|
|||
for (var i = cnt; i > 0; i--)
|
||||
{
|
||||
// Random x coordinate, biased to the middle of the map.
|
||||
var var_wdt = wdt * (200 - 100 * i / cnt) / 400;
|
||||
var var_wdt = wdt * (400 - 200 * i / cnt) / 400;
|
||||
var x = wdt / 2 + RandomX(-var_wdt, var_wdt);
|
||||
var y = 0;
|
||||
// Find corresponding y coordinate.
|
||||
|
@ -172,6 +110,92 @@ private func FindVolcanoLocation()
|
|||
|
||||
/*-- Scenario Initialization --*/
|
||||
|
||||
private func InitEnvironment(int difficulty)
|
||||
{
|
||||
// Adjust the mood, orange sky, darker feeling in general.
|
||||
var dark = 10;
|
||||
SetSkyAdjust(RGB(150, 42, 0));
|
||||
SetGamma(RGB(0, 0, 0), RGB(128 - dark, 128 - dark, 128 - dark), RGB(255 - 2 * dark, 255 - 2 * dark, 255 - 2 * dark));
|
||||
|
||||
// Time of days and celestials.
|
||||
CreateObject(Environment_Celestial);
|
||||
var time = CreateObject(Environment_Time);
|
||||
time->SetTime(60 * 20);
|
||||
time->SetCycleSpeed(20);
|
||||
|
||||
// Some dark clouds which rain few ashes.
|
||||
Cloud->Place(15);
|
||||
Cloud->SetPrecipitation("Ashes", 10);
|
||||
|
||||
// Some natural disasters, earthquakes, volcanos, meteorites.
|
||||
Meteor->SetChance(2 + 4 * difficulty);
|
||||
if (difficulty >= 2)
|
||||
Earthquake->SetChance(3 * difficulty);
|
||||
|
||||
// Initialize the effect for controlling the big volcano.
|
||||
var effect = AddEffect("BigVolcano", nil, 100, 5, nil);
|
||||
effect.difficulty = difficulty;
|
||||
return;
|
||||
}
|
||||
|
||||
private func InitVegetation(int map_size)
|
||||
{
|
||||
// Place some trees, rather with leaves.
|
||||
var veg;
|
||||
for (var i = 0; i < 20 + Random(4); i++)
|
||||
PlaceVegetation(Tree_Coconut, 0, 0, LandscapeWidth(), LandscapeHeight(), 1000 * (61 + Random(40)));
|
||||
// Create an effect to make sure there will always grow some new trees.
|
||||
AddEffect("EnsureTrees", nil, 100, 20, nil);
|
||||
// Some large cave mushrooms.
|
||||
LargeCaveMushroom->Place(20 + 4 * map_size, Rectangle(0, LandscapeHeight() / 2, LandscapeWidth(), LandscapeHeight() / 2), { terraform = false });
|
||||
// Some dead tree trunks.
|
||||
for (var i = 0; i < 16 + Random(4); i++)
|
||||
{
|
||||
veg = PlaceVegetation(Trunk, 0, 0, LandscapeWidth(), LandscapeHeight(), 1000 * (61 + Random(20)));
|
||||
if (veg)
|
||||
veg->SetR(RandomX(-20, 20));
|
||||
}
|
||||
// Some mushrooms as source of food.
|
||||
for (var i = 0; i < 30 + Random(5); i++)
|
||||
PlaceVegetation(Mushroom, 0, 0, LandscapeWidth(), LandscapeHeight());
|
||||
// Some ferns, to be burned soon.
|
||||
for (var i = 0; i < 25 + Random(5); i++)
|
||||
PlaceVegetation(Fern, 0, 0, LandscapeWidth(), LandscapeHeight());
|
||||
// Ranks as a nice additional source of wood.
|
||||
for (var i = 0; i < 16 + Random(4); i++)
|
||||
{
|
||||
veg = PlaceVegetation(Rank, 0, 0, LandscapeWidth(), LandscapeHeight());
|
||||
if (veg)
|
||||
veg->SetR(RandomX(-20, 20));
|
||||
}
|
||||
// Some objects in the earth.
|
||||
PlaceObjects(Rock, 30 + 15 * map_size + Random(10),"Earth");
|
||||
PlaceObjects(Firestone, 40 + 15 * map_size + Random(5), "Earth");
|
||||
PlaceObjects(Loam, 30 + 15 * map_size + Random(5), "Earth");
|
||||
return;
|
||||
}
|
||||
|
||||
private func InitAnimals()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
private func InitMaterial(int amount)
|
||||
{
|
||||
// Find start location and place lorry plus extras there.
|
||||
FindVolcanoLocation();
|
||||
var lorry = CreateObject(Lorry);
|
||||
lorry->SetPosition(volcano_location[0], volcano_location[1]);
|
||||
lorry->CreateContents(Loam, 5);
|
||||
lorry->CreateContents(Bread, 5);
|
||||
lorry->CreateContents(Wood, 8);
|
||||
lorry->CreateContents(Rock, 4);
|
||||
lorry->CreateContents(Metal, 4);
|
||||
for (var i = 0; i < 5; i++)
|
||||
lorry->CreateContents(Barrel)->PutLiquid("Water", 300);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensures that there will always grow some trees.
|
||||
global func FxEnsureTreesTimer()
|
||||
{
|
||||
|
@ -183,14 +207,22 @@ global func FxEnsureTreesTimer()
|
|||
return FX_OK;
|
||||
}
|
||||
|
||||
|
||||
/*-- Volcano Effect --*/
|
||||
|
||||
// The volcano will do two types of eruptions:
|
||||
// Smaller ones where just some lava is flowing out of the chasms.
|
||||
// Bigger ones with chunks, ashes, rocks, explosions, etc.
|
||||
global func FxBigVolcanoStart(object target, proplist effect, int temporary)
|
||||
{
|
||||
if (temporary)
|
||||
return FX_OK;
|
||||
// Ensure right effect interval.
|
||||
effect.Interval = 5;
|
||||
|
||||
for (var pos in chasm_exits)
|
||||
CreateObject(Flagpole, pos[0], pos[1]);
|
||||
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
|
@ -198,7 +230,7 @@ global func FxBigVolcanoTimer(object target, proplist effect)
|
|||
{
|
||||
// Insert some lava in the big body of lava in the core of the volcano.
|
||||
// Find a surface on which we can release some lava pixels and bubbles.
|
||||
for (var x = Random(250); x < LandscapeWidth(); x += RandomX(200, 300))
|
||||
/*for (var x = Random(250); x < LandscapeWidth(); x += RandomX(200, 300))
|
||||
{
|
||||
// Find first tunnel from the bottom.
|
||||
var y = LandscapeHeight();
|
||||
|
@ -209,25 +241,39 @@ global func FxBigVolcanoTimer(object target, proplist effect)
|
|||
{
|
||||
InsertMaterial(Material("DuroLava"), x, y + 4);
|
||||
}
|
||||
}
|
||||
// At more rare occasions there will be a bigger eruption with chunks.
|
||||
if (!Random(400))
|
||||
}*/
|
||||
|
||||
// Some bubles in the lava.
|
||||
// TODO
|
||||
|
||||
// Some small fountains at random locations in the different chasms.
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
// Find a location to erupt.
|
||||
for (var i = 0; i < 50; i++)
|
||||
var pos = chasm_exits[i];
|
||||
var lava = FindLocation(Loc_Material("DuroLava"), Loc_InRect(pos[0] - 100, pos[1] - 100, 200, 200));
|
||||
InsertMaterial(Material("DuroLava"), lava.x, lava.y);
|
||||
}
|
||||
|
||||
// At more rare occasions there will be a bigger eruption with chunks.
|
||||
if (!Random(1200 - 200 * effect.difficulty) && false)
|
||||
{
|
||||
// Find the location to erupt from the chasm_exit.
|
||||
var pos = chasm_exits[0];
|
||||
var x = pos[0];
|
||||
var y = pos[1];
|
||||
var at_lava = GBackLiquid(x, y);
|
||||
if (at_lava)
|
||||
while (GBackLiquid(x, y) && y > 0)
|
||||
y--;
|
||||
else
|
||||
while (!GBackLiquid(x, y) && y < LandscapeHeight())
|
||||
y++;
|
||||
|
||||
// Check if there is enough room for an eruption.
|
||||
if (GBackLiquid(x - 5, y + 8) && GBackLiquid(x + 5, y + 8) && !GBackSemiSolid(x - 5, y - 8) && !GBackSemiSolid(x + 5, y - 8))
|
||||
{
|
||||
// Find lava suface for a random x position.
|
||||
var x = Random(LandscapeWidth());
|
||||
var y = LandscapeHeight();
|
||||
while (GBackSemiSolid(x, y) && y > 0)
|
||||
y -= 2;
|
||||
// Check if there is enough room for an eruption.
|
||||
if (GBackLiquid(x - 5, y + 8) && GBackLiquid(x + 5, y + 8) && !GBackSemiSolid(x - 5, y - 8) && !GBackSemiSolid(x + 5, y - 8))
|
||||
{
|
||||
// Launch a big eruption from this location.
|
||||
AddEffect("BigEruption", nil, 100, 1, nil, nil, x, y - 2);
|
||||
break;
|
||||
}
|
||||
// Launch a big eruption from this location.
|
||||
AddEffect("BigEruption", nil, 100, 1, nil, nil, x, y - 2);
|
||||
}
|
||||
}
|
||||
return FX_OK;
|
||||
|
@ -242,8 +288,12 @@ global func FxBigEruptionStart(object target, proplist effect, int temporary, in
|
|||
// Take over launch coordinates.
|
||||
effect.X = x;
|
||||
effect.Y = y;
|
||||
// Duration of 2-5 seconds.
|
||||
effect.Duration = 72 + Random(108);
|
||||
// Duration of 6-9 seconds.
|
||||
effect.Duration = (6 + Random(4)) * 36;
|
||||
// Use earthquake sound for this eruption.
|
||||
Sound("Earthquake", true, 100, nil, 1);
|
||||
// Shake also the viewport a bit on a big eruption.
|
||||
ShakeViewPort(3200, x, y);
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
|
@ -252,19 +302,24 @@ global func FxBigEruptionTimer(object target, proplist effect, int time)
|
|||
// Eruption lasts for some time.
|
||||
if (time > effect.Duration)
|
||||
return FX_Execute_Kill;
|
||||
// Cast some lava pixels at surface.
|
||||
// Cast some lava and ashes pixels at surface.
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
var x = effect.X + RandomX(-5, 5);
|
||||
var x = effect.X + RandomX(-80, 80);
|
||||
var y = effect.Y + 5;
|
||||
while (GBackLiquid(x, y))
|
||||
y--;
|
||||
CastPXS("DuroLava", 2, 60, x, y - 2, 0, 40);
|
||||
CastPXS("DuroLava", 2, 120 + Random(40), x, y - 2, 0, 40);
|
||||
if (!Random(4))
|
||||
{
|
||||
CastPXS("Ashes", 2, 120 + Random(40), x, y - 2, 0, 40);
|
||||
Smoke(x, y, 8 + Random(4));
|
||||
}
|
||||
}
|
||||
// Throw around some lava chunks.
|
||||
if (!Random(18))
|
||||
if (!Random(6))
|
||||
{
|
||||
var angw = 40, lev = 60;
|
||||
var angw = 40, lev = 120;
|
||||
var obj = CreateObject(LavaChunk, effect.X + RandomX(-5, 5), effect.Y, NO_OWNER);
|
||||
var ang = - 90 + RandomX(-angw / 2, angw / 2);
|
||||
var xdir = Cos(ang, lev) + RandomX(-3, 3);
|
||||
|
@ -277,3 +332,27 @@ global func FxBigEruptionTimer(object target, proplist effect, int time)
|
|||
// Some lava glow and smoke through particles.
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
global func FxBigEruptionStop(object target, proplist effect, int reason, bool temporary)
|
||||
{
|
||||
if (temporary)
|
||||
return FX_OK;
|
||||
// Stop eruption sound.
|
||||
Sound("Earthquake", true, 100, nil, -1);
|
||||
Sound("EarthquakeEnd",true);
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
|
||||
/*-- Helper functions --*/
|
||||
|
||||
global func TestGoldCount()
|
||||
{
|
||||
var pos;
|
||||
while (pos = FindLocation(Loc_Material("Gold")))
|
||||
{
|
||||
var pos = CreateObject(Rock, pos.x, pos.y)->Explode(100);
|
||||
}
|
||||
var gold_count = ObjectCount(Find_ID(Nugget));
|
||||
return gold_count;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# Scenario parameters: difficulty
|
||||
Difficulty=Schwierigkeit
|
||||
DescDifficulty=Setzt die Schwierigkeit dieser Runde.
|
||||
DiffNormal=Normal
|
||||
DescDiffNormal=Die Schwierigkeit dieser Runde ist normal.
|
||||
DiffHard=Schwer
|
||||
DescDiffHard=Die Schwierigkeit dieser Runde ist schwer.
|
||||
DiffInsane=Insane
|
||||
DescDiffInsane=Die Schwierigkeit dieser Runde ist insane.
|
||||
|
||||
# Scenario parameters: map size
|
||||
MapSize=Kartengröße
|
||||
DescMapSize=Setzt die Kartengröße dieser Runde.
|
||||
MapSmall=Klein
|
||||
DescMapSmall=Die Karte dieser Runde wird klein sein
|
||||
MapAverage=Durchschnittlich
|
||||
DescMapAverage=Die Karte dieser Runde wird durchschnittlich sein.
|
||||
MapLarge=Groß
|
||||
DescMapLarge=Die Karte dieser Runde wird groß sein.
|
|
@ -0,0 +1,19 @@
|
|||
# Scenario parameters: difficulty
|
||||
Difficulty=Difficulty
|
||||
DescDifficulty=Sets this round's difficulty.
|
||||
DiffNormal=Normal
|
||||
DescDiffNormal=This round's difficulty will be set to normal.
|
||||
DiffHard=Hard
|
||||
DescDiffHard=This round's difficulty will be set to hard.
|
||||
DiffInsane=Insane
|
||||
DescDiffInsane=This round's difficulty will be set to insane.
|
||||
|
||||
# Scenario parameters: map size
|
||||
MapSize=Map size
|
||||
DescMapSize=Sets this round's map size.
|
||||
MapSmall=Small
|
||||
DescMapSmall=This round's map will be small.
|
||||
MapAverage=Average
|
||||
DescMapAverage=This round's map will be average.
|
||||
MapLarge=Large
|
||||
DescMapLarge=This round's map will be large.
|
|
@ -1,12 +0,0 @@
|
|||
// Clouds are a bit darker.
|
||||
/*
|
||||
#appendto Cloud
|
||||
|
||||
// Shades the clouds according to ashes and landscape.
|
||||
private func ShadeCloud()
|
||||
{
|
||||
var shade = 127 - Min(127, rain / 5);
|
||||
SetClrModulation(RGBa(shade, shade, shade, 80));
|
||||
return _inherited(...);
|
||||
}
|
||||
*/
|
|
@ -1,7 +0,0 @@
|
|||
// Trees spread a bit faster.
|
||||
|
||||
#appendto Tree_Coconut
|
||||
|
||||
// Should be done differently.
|
||||
//private func SeedChance() { return 250; }
|
||||
|
Loading…
Reference in New Issue