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"); local accepting = AITileList_IndustryAccepting(myRef, 4); AILog.Info("I found " + accepting.Count() + " tiles for the initial candidate"); accepting.Valuate(AITile.IsCoastTile); accepting.KeepValue(1); AILog.Info("I found " + accepting.Count() + " coast tiles."); foreach(myTile, value in accepting) { local slope = AITile.GetSlope(myTile); AILog.Info("Slope at tile " + myTile + " is " + slope + "."); if (AIMarine.BuildDock(myTile, AIStation.STATION_NEW)) { break; } } while (true) { this.Sleep(50); } }