2012-03-11 23:50:13 +00:00
|
|
|
/**
|
|
|
|
Skylands
|
|
|
|
Assemble a plane on some floating islands
|
|
|
|
|
|
|
|
@authors Sven2
|
|
|
|
*/
|
|
|
|
|
|
|
|
static g_is_initialized;
|
|
|
|
static g_intro_initialized;
|
|
|
|
|
|
|
|
func DoInit(int first_player)
|
|
|
|
{
|
2012-10-13 22:00:09 +00:00
|
|
|
// Test
|
2015-01-10 09:14:02 +00:00
|
|
|
//CreateObjectAbove(LiftTower, 178,405, first_player);
|
2012-03-11 23:50:13 +00:00
|
|
|
// Set time of day to evening and create some clouds and celestials.
|
2012-04-03 17:13:07 +00:00
|
|
|
Cloud->Place(15);
|
2012-03-11 23:50:13 +00:00
|
|
|
EnsureObject(Rule_BuyAtFlagpole,0,0,-1);
|
2012-11-26 22:15:26 +00:00
|
|
|
SetSkyAdjust(0xff000000);
|
|
|
|
var storm = EnsureObject(Storm,0,0,NO_OWNER);
|
2012-12-07 22:11:52 +00:00
|
|
|
storm->SetStorm(-20,0,1000);
|
2012-11-26 22:15:26 +00:00
|
|
|
SetSkyParallax(1); // move background with the wind
|
2012-03-11 23:50:13 +00:00
|
|
|
var time = EnsureObject(Environment_Time,0,0,-1);
|
|
|
|
time->SetTime(600);
|
2012-10-29 23:08:01 +00:00
|
|
|
time->SetCycleSpeed(20);
|
2012-03-11 23:50:13 +00:00
|
|
|
// Goal
|
2015-01-10 16:56:54 +00:00
|
|
|
CreateObject(Goal_Plane);
|
2012-03-18 16:25:11 +00:00
|
|
|
// Plane part restore
|
|
|
|
for (var part in FindObjects(Find_Func("IsPlanePart"))) part->AddRestoreMode();
|
2012-03-11 23:50:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
func EnsureObject(id def, int x, int y, int owner)
|
|
|
|
{
|
|
|
|
var obj = FindObject(Find_ID(def));
|
2015-01-10 09:14:02 +00:00
|
|
|
if (!obj) obj = CreateObjectAbove(def,x,y,owner);
|
2012-03-11 23:50:13 +00:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
func InitializePlayer(int plr)
|
|
|
|
{
|
|
|
|
// Scenario init
|
|
|
|
if (!g_is_initialized) g_is_initialized = DoInit(plr);
|
|
|
|
// Move clonks to location and give them a shovel.
|
|
|
|
var index = 0, crew;
|
|
|
|
while (crew = GetCrew(plr, index))
|
|
|
|
{
|
|
|
|
var x = 150 + Random(50);
|
|
|
|
crew->SetPosition(x , 400);
|
|
|
|
crew->CreateContents(Shovel);
|
|
|
|
// one clonk can construct, another can mine.
|
|
|
|
if (index == 1)
|
|
|
|
{
|
|
|
|
crew->CreateContents(Hammer);
|
|
|
|
crew->CreateContents(Wood,4);
|
|
|
|
crew->CreateContents(Metal);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
crew->CreateContents(Axe);
|
2012-12-02 20:33:17 +00:00
|
|
|
crew->CreateContents(Wood,3);
|
|
|
|
crew->CreateContents(Metal,2);
|
2012-03-11 23:50:13 +00:00
|
|
|
}
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-18 21:11:30 +00:00
|
|
|
func OnPlaneFinished(object plane)
|
|
|
|
{
|
|
|
|
// todo: outro
|
2015-01-10 09:14:02 +00:00
|
|
|
plane->CreateObjectAbove(Plane, 0,0, NO_OWNER);
|
2012-03-18 21:11:30 +00:00
|
|
|
plane->RemoveObject();
|
|
|
|
}
|
2014-09-25 13:25:33 +00:00
|
|
|
|
|
|
|
func OnGoalsFulfilled()
|
|
|
|
{
|
|
|
|
GainScenarioAchievement("Done");
|
|
|
|
return false;
|
|
|
|
}
|