27 | AILog.Info("I am a very new AI with a ticker called MyNewAI and I am at tick " + this.GetTick());
| 39 | while (AIEventController.IsEventWaiting()) {
|
---|
28 | this.Sleep(50);
| 40 | local e = AIEventController.GetNextEvent();
|
---|
| | 41 | switch (e.GetEventType()) {
|
---|
| | 42 | case AIEvent.ET_INVALID:
|
---|
| | 43 | AILog.Info("Event: ET_INVALID")
|
---|
| | 44 | break
|
---|
| | 45 |
|
---|
| | 46 | case AIEvent.ET_TEST:
|
---|
| | 47 | AILog.Info("Event: ET_TEST")
|
---|
| | 48 | break
|
---|
| | 49 |
|
---|
| | 50 | case AIEvent.ET_SUBSIDY_OFFER:
|
---|
| | 51 | local ec = AIEventSubsidyOffer.Convert(e)
|
---|
| | 52 | local s = ec.GetSubsidyID()
|
---|
| | 53 | AILog.Info("Event: ET_SUBSIDY_OFFER (" + s + ")")
|
---|
| | 54 | break
|
---|
| | 55 |
|
---|
| | 56 | case AIEvent.ET_SUBSIDY_OFFER_EXPIRED:
|
---|
| | 57 | local ec = AIEventSubsidyOfferExpired.Convert(e)
|
---|
| | 58 | local s = ec.GetSubsidyID()
|
---|
| | 59 | AILog.Info("Event: ET_SUBSIDY_OFFER_EXPIRED (" + s + ")")
|
---|
| | 60 | break
|
---|
| | 61 |
|
---|
| | 62 | case AIEvent.ET_SUBSIDY_AWARDED:
|
---|
| | 63 | local ec = AIEventSubsidyAwarded.Convert(e)
|
---|
| | 64 | local s = ec.GetSubsidyID()
|
---|
| | 65 | AILog.Info("Event: ET_SUBSIDY_AWARDED (" + s + ")")
|
---|
| | 66 | break
|
---|
| | 67 |
|
---|
| | 68 | // ET_SUBSIDY_AWARDED,
|
---|
| | 69 | // ET_SUBSIDY_EXPIRED,
|
---|
| | 70 | // ET_ENGINE_PREVIEW,
|
---|
| | 71 | // ET_COMPANY_NEW,
|
---|
| | 72 | // ET_COMPANY_IN_TROUBLE,
|
---|
| | 73 | // ET_COMPANY_ASK_MERGER,
|
---|
| | 74 | // ET_COMPANY_MERGER,
|
---|
| | 75 | // ET_COMPANY_BANKRUPT,
|
---|
| | 76 | // ET_VEHICLE_CRASHED,
|
---|
| | 77 | // ET_VEHICLE_LOST,
|
---|
| | 78 | // ET_VEHICLE_WAITING_IN_DEPOT,
|
---|
| | 79 | // ET_VEHICLE_UNPROFITABLE,
|
---|
| | 80 | // ET_INDUSTRY_OPEN,
|
---|
| | 81 | // ET_INDUSTRY_CLOSE,
|
---|
| | 82 | // ET_ENGINE_AVAILABLE,
|
---|
| | 83 | // ET_STATION_FIRST_VEHICLE,
|
---|
| | 84 | // ET_DISASTER_ZEPPELINER_CRASHED,
|
---|
| | 85 | // ET_DISASTER_ZEPPELINER_CLEARED,
|
---|
| | 86 | // ET_TOWN_FOUNDED,
|
---|
| | 87 | // ET_AIRCRAFT_DEST_TOO_FAR,
|
---|
| | 88 | // ET_ADMIN_PORT,
|
---|
| | 89 | // ET_WINDOW_WIDGET_CLICK,
|
---|
| | 90 | // ET_GOAL_QUESTION_ANSWER,
|
---|
| | 91 | // ET_EXCLUSIVE_TRANSPORT_RIGHTS,
|
---|
| | 92 | // ET_ROAD_RECONSTRUCTION
|
---|
| | 93 | case AIEvent.ET_VEHICLE_CRASHED:
|
---|
| | 94 | local ec = AIEventVehicleCrashed.Convert(e);
|
---|
| | 95 | local v = ec.GetVehicleID();
|
---|
| | 96 | local c = ec.GetCrashSite();
|
---|
| | 97 | local r = ec.GetCrashReason();
|
---|
| | 98 | AILog.Info("Event: ET_VEHICLE_CRASHED (" + v + ") (" + c + ") (" + r + ")");
|
---|
| | 99 | /* Handle the crashed vehicle */
|
---|
| | 100 | break;
|
---|
| | 101 | }
|
---|
| | 102 | }
|
---|
| | 103 |
|
---|
| | 104 | // AILog.Info("I am a very new AI with a ticker called MyNewAI and I am at tick " + this.GetTick());
|
---|