Timestamp:
Apr 12, 2021, 8:51:39 AM (3 years ago)
Author:
Freagarach
Message:

Attack using cmpAttack instead of UnitAI.

Keep responsibilities separated, allow easier modding of attacking behaviour.
Ideally the BuildingAI attacking routine would be merged in here as well, but not done for now.

Part of #5810
Differential revision: D3816
Comments by: @smiley, @Stan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/simulation/components/TreasureCollecter.js

    r25206 r25235  
    6666TreasureCollecter.prototype.StopCollecting = function(reason)
    6767{
    68     if (this.timer)
    69     {
    70         let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
    71         cmpTimer.CancelTimer(this.timer);
    72         delete this.timer;
    73     }
     68    if (!this.target)
     69        return;
     70
     71    let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
     72    cmpTimer.CancelTimer(this.timer);
     73    delete this.timer;
     74
    7475    delete this.target;
    7576
     
    7879        cmpVisual.SelectAnimation("idle", false, 1.0);
    7980
    80     // The callerIID component may start collecting again,
     81    // The callerIID component may start again,
    8182    // replacing the callerIID, hence save that.
    8283    let callerIID = this.callerIID;
Note: See TracChangeset for help on using the changeset viewer.