Loading

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. }
  6.  
  7. function WrightAI::GetEngineRouteIncome(engine_id, cargo, fakedist) {
  8.     local running_cost = AIEngine.GetRunningCost(engine_id);
  9.     local capacity = AIEngine.GetCapacity(engine_id);
  10.     local days_in_transit = WrightAI.GetEngineDaysInTransit(engine_id, fakedist);
  11.     local income = capacity * AICargo.GetCargoIncome(cargo, fakedist, days_in_transit) - running_cost * days_in_transit / 365;
  12.     return income;
  13. }
  14.  
  15. /* Somewhere else */
  16. (...)
  17.     engine_list.Valuate(WrightAI.GetEngineRouteIncome, this.cargoId, dist);
  18. (...)

Version history

Revision # Author Created at
pkj6pnebd Anonymous 05 Sep 2018, 19:15:05 UTC Diff
pex5dlqpr Anonymous 05 Sep 2018, 18:16:07 UTC Diff
pjzwj6cj6 Anonymous 05 Sep 2018, 18:14:52 UTC Diff

Comments