1 /* Default scenario objects */
2 // Use gold rush objects with minor adjustments
3
4 /*-- Scenario Initialization --*/
5
InitializeObjects()6 public func InitializeObjects()
7 {
8 // Place player start centered above ground
9 var start_x = LandscapeWidth()/2;
10 var start_y = 0;
11 while (!GBackSolid(start_x, start_y) && start_y < LandscapeHeight()) ++start_y;
12 CreateObjectAbove(PlayerStart, start_x, start_y);
13 // Place regular objects
14 InitEnvironment();
15 InitVegetation();
16 InitAnimals();
17 return true;
18 }
19
InitEnvironment()20 private func InitEnvironment()
21 {
22 CreateEnvironmentObjects("Temperate");
23
24 // Set time of day to evening and create some clouds and celestials.
25 Cloud->Place(10);
26 Cloud->SetPrecipitation("Water", 8);
27 var time = CreateObject(Time);
28 time->SetTime(60 * 12);
29 time->SetCycleSpeed(20);
30 }
31
InitVegetation()32 private func InitVegetation()
33 {
34 // Place some trees in a forest shape.
35 PlaceForest([Tree_Deciduous, Tree_Coniferous2], 0, LandscapeHeight() / 2 + 50, nil, true);
36
37 SproutBerryBush->Place();
38 PlaceGrass(100);
39
40 // Some objects in the earth.
41 var map_size = Max(1, LandscapeWidth() * LandscapeHeight() / 250000);
42 PlaceObjects(Rock, 25 + 10 * map_size + Random(10),"Earth");
43 PlaceObjects(Firestone, 20 + 10 * map_size + Random(5), "Earth");
44 PlaceObjects(Loam, 20 + 10 * map_size + Random(5), "Earth");
45 }
46
InitAnimals(int map_size)47 private func InitAnimals(int map_size)
48 {
49 // Some butterflies
50 for (var i = 0; i < 10 + 5 * Max(1, LandscapeWidth() / 500); i++)
51 PlaceAnimal(Butterfly);
52 }
53