Ticket #2757: 2757.patch

File 2757.patch, 2.2 KB (added by maveric, 9 years ago)
  • binaries/data/mods/public/simulation/ai/petra/chatHelper.js

     
    106106    Engine.PostCommand(PlayerID, chat);
    107107};
    108108
     109m.chatNewPhase = function(gameState, phase, started)
     110{
     111    if(started)
     112        var message = "/team " + markForTranslation("I am advancing to the phase " + phase + ".");
     113    else
     114        var message = "/team " + markForTranslation("I have reached the phase " + phase + ".");
     115   
     116    var chat = {
     117        "type" : "aichat",
     118        "message" : message,
     119        "translateMessage" : true
     120    };
     121    Engine.PostCommand(PlayerID, chat);
     122};
     123
     124
    109125return m;
    110126}(PETRA);
  • binaries/data/mods/public/simulation/ai/petra/headquarters.js

     
    2020   
    2121    this.econState = "growth";  // existing values: growth, townPhasing.
    2222    this.phaseStarted = undefined;
     23    this.currentPhase = undefined;
    2324
    2425    // cache the rates.
    2526    this.wantedRates = { "food": 0, "wood": 0, "stone":0, "metal": 0 };
     
    7172        return false;
    7273    });
    7374    this.treasures.registerUpdates();
     75    this.currentPhase = gameState.currentPhase();
    7476};
    7577
    7678/**
     
    281283        this.femaleRatio = 0.4;
    282284
    283285    this.phaseStarted = 2;
     286    m.chatNewPhase(gameState, 2, true);
    284287};
    285288
    286289// Called by the "city phase" research plan once it's started
     
    290293        this.femaleRatio = 0.3;
    291294
    292295    this.phaseStarted = 3;
     296    m.chatNewPhase(gameState, 3, true);
    293297};
    294298
    295299// This code trains females and citizen workers, trying to keep close to a ratio of females/CS
     
    17221726m.HQ.prototype.update = function(gameState, queues, events)
    17231727{
    17241728    Engine.ProfileStart("Headquarters update");
     1729   
     1730    if(this.currentPhase != gameState.currentPhase())
     1731    {
     1732        this.currentPhase = gameState.currentPhase();
     1733        m.chatNewPhase(gameState, this.currentPhase, false);
     1734    }
    17251735
    17261736    this.territoryMap = m.createTerritoryMap(gameState);
    17271737