class MyTest extends AIController {
function Start();
}
function MyTest::Start() {
local cargoes = AICargoList();
local oil;
foreach (cargo, value in cargoes) {
if( AICargo.GetCargoLabel(cargo) == "OIL_") {
oil = cargo;
break;
}
}
local oilrigs = AIIndustryList_CargoProducing(oil);
oilrigs.Valuate(AIIndustry.HasDock);
oilrigs.KeepValue(1);
oilrigs.Valuate(AIIndustry.GetLastMonthProduction, oil);
local myRig = oilrigs.Begin();
AISign.BuildSign(AIIndustry.GetLocation(myRig), "origin");
local refineries = AIIndustryList_CargoAccepting(oil);
refineries.Valuate(AIIndustry.GetDistanceManhattanToTile, AIIndustry.GetLocation(myRig));
refineries.Sort(AIList.SORT_BY_VALUE, true);
local myRef = refineries.Begin();
AISign.BuildSign(AIIndustry.GetLocation(myRef), "destination");
AILog.Info(AITile.GetSlope(0x418E));
AILog.Info(AITile.IsCoastTile(0x418E));
AIMarine.BuildDock(0x418E, AIStation.STATION_NEW);
while (true) {
this.Sleep(50);
}
}