Loading

Paste #p2xv8lx23

  1. function Utils::getValidOffsetTile(tile, offsetX, offsetY) {
  2.     local oldX = AIMap.GetTileX(tile);
  3.     local oldY = AIMap.GetTileY(tile);
  4.    
  5.     local newX = oldX;

Paste #phtxvttpa

  1. function Utils::AreOtherStationsNearby(tile, cargoClass, stationId) {
  2.     local stationType = cargoClass == AICargo.CC_PASSENGERS ? AIStation.STATION_BUS_STOP : AIStation.STATION_TRUCK_STOP;
  3.    
  4.     //check if there are other stations squareSize squares nearby
  5.     local squareSize = AIStation.GetCoverageRadius(stationType);

Paste #petu1y4ig

  1. /* method 1 */     
  2.         for (local tile = 0; tile <= AIMap.GetMapSize(); tile++) {
  3.             if (!AIMap.IsValidTile(tile)) continue;
  4.             local dist = AITile.GetDistanceSquareToTile(tile, airport1_tile);
  5.             local fake = WrightAI.DistanceRealFake(tile, airport1_tile);

Paste #p2gbtm0ut

  1.         local closestTownscopy = AIList();
  2.         for (local town = closestTowns.Begin(); closestTowns.HasNext(); town = closestTowns.Next()) {
  3.             local closest_town = AITile.GetClosestTown(tile);
  4.             if (closestTowns.HasItem(closest_town) {
  5.                 closestTownscopy.AddItem(town);

Paste #pstwsbjfb

  1.         local closestTownscopy = AIList();
  2.         for (local town = closestTowns.Begin(); closestTowns.HasNext(); town = closestTowns.Next()) {
  3.             local closest_town = AITile.GetClosestTown(tile);
  4.             if (closestTowns.HasItem(closest_town) {
  5.                 closestTownscopy.AddItem(town);

Paste #p7wwtf7xn

  1. /* method 1 */     
  2. //      for (local tile = 0; tile <= AIMap.GetMapSize(); tile++) {
  3. //          if (!AIMap.IsValidTile(tile)) continue;
  4. //          local dist = AITile.GetDistanceSquareToTile(tile, airport1_tile);
  5. //          local fake = WrightAI.DistanceRealFake(tile, airport1_tile);

Paste #plclcisfi

  1. /**
  2.  * Find a suitable spot for an airport, walking all towns hoping to find one.
  3.  * When a town is used, it is marked as such and not re-used.
  4.  */
  5. function WrightAI::FindSuitableAirportSpot(airportTypes, airport1_tile, large_aircraft, small_aircraft, helicopter)

Paste #p8fx5g6cz

  1. function WrightAI::GetEngineDaysInTransit(engine_id, fakedist)
  2. {
  3.     local days_in_transit = (fakedist * 256 * 16) / (2 * 74 * AIEngine.GetMaxSpeed(engine_id));
  4.     return days_in_transit;
  5. }

Paste #pkj6pnebd

  1. function WrightAI::GetEngineDaysInTransit(engine_id, fakedist)
  2. {
  3.     local days_in_transit = (fakedist * 256 * 16) / (2 * 74 * AIEngine.GetMaxSpeed(engine_id));
  4.     return days_in_transit;
  5. }

Paste #pex5dlqpr

  1. function WrightAI::GetEngineOptimalRealFakeDist(engine_id, days_in_transit)
  2. {
  3.     /* Assuming going in axis, it is the same as distancemanhattan */
  4.     local realfakedist = (AIEngine.GetMaxSpeed(engine_id) * 2 * 74 * days_in_transit / 256) / 16;
  5.     return realfakedist;

Paste #pjzwj6cj6

  1. function WrightAI::GetEngineOptimalDaysInTransit(engine_id, cargo, days_int, valuator = false)
  2. {
  3.     local distance = WrightAI.GetEngineOptimalRealFakeDist(engine_id, 1000);
  4.     local running_cost = AIEngine.GetRunningCost(engine_id);
  5.     local capacity = AIEngine.GetCapacity(engine_id);

Paste #ps8xl6rne

  1. Trans-Continental
  2.  
  3. Gameplay mechanics
  4.  
  5. TL;DR

Paste #przwrcgpv

  1.     AddSetting({
  2.       name = "select_town_cargo",
  3.       description = "Town Cargo",
  4.       easy_value = 0,
  5.       medium_value = 0,

Paste #pwxcszvll

  1.     AddSetting({
  2.       name = "select_town_cargo",
  3.       description = "Town Cargo",
  4.       easy_value = 0,
  5.       medium_value = 0,

Paste #pwiz28dvn

  1. Trans-Continental
  2.  
  3. Gameplay mechanics
  4.  
  5. TL;DR