Loading

Paste #pfif4lzeo

  1. class MyTest extends AIController {
  2.   function Start();
  3. }
  4.  
  5. function MyTest::Start() {
  6.   local cargoes = AICargoList();
  7.   local oil;
  8.   foreach (cargo, value in cargoes) {
  9.     if( AICargo.GetCargoLabel(cargo) == "OIL_") {
  10.       oil = cargo;
  11.       break;
  12.     }
  13.   }
  14.  
  15.   local oilrigs = AIIndustryList_CargoProducing(oil);
  16.   oilrigs.Valuate(AIIndustry.HasDock);
  17.   oilrigs.KeepValue(1);
  18.  
  19.   oilrigs.Valuate(AIIndustry.GetLastMonthProduction, oil);
  20.   local myRig = oilrigs.Begin();
  21.   AISign.BuildSign(AIIndustry.GetLocation(myRig), "origin");
  22.  
  23.   local refineries = AIIndustryList_CargoAccepting(oil);
  24.   refineries.Valuate(AIIndustry.GetDistanceManhattanToTile, AIIndustry.GetLocation(myRig));
  25.   refineries.Sort(AIList.SORT_BY_VALUE, true);
  26.   local myRef = refineries.Begin();
  27.   AISign.BuildSign(AIIndustry.GetLocation(myRef), "destination");
  28.  
  29.   AILog.Info(AITile.GetSlope(0x418E));  // 0x418E comes from Land Area Information tool within the game
  30.   AILog.Info(AITile.IsCoastTile(0x418E));
  31.   AIMarine.BuildDock(0x418E, AIStation.STATION_NEW);
  32.  
  33.   while (true) {
  34.     this.Sleep(50);
  35.   }
  36. }

Version history

Revision # Author Created at
prif7bccz Sylf 26 Aug 2017, 03:31:28 UTC Diff

Comments