Ticket #4595: debug_output.patch

File debug_output.patch, 3.6 KB (added by elexis, 7 years ago)

(To reproduce above annotation)

  • binaries/data/mods/public/simulation/components/Attack.js

    Attack.prototype.PerformAttack = functio  
    538538            data.radius = +this.template.Ranged.Splash.Range;
    539539            data.shape = this.template.Ranged.Splash.Shape;
    540540            data.isSplash = true;
    541541            data.splashStrengths = this.GetAttackStrengths(type+".Splash");
    542542        }
     543        warn("SetTimeout MissileHit " + data.target + " with " + Engine.QueryInterface(data.target, IID_Health).GetHitpoints() + "HP");
    543544        cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_Damage, "MissileHit", timeToTarget * 1000, data);
    544545    }
    545546    else if (type == "Capture")
    546547    {
    547548        if (attackerOwner == -1)
  • binaries/data/mods/public/simulation/components/Health.js

    Health.prototype.CheckRegenTimer = funct  
    186186    this.regenTimer = cmpTimer.SetInterval(this.entity, IID_Health, "ExecuteRegeneration", 1000, 1000, null);
    187187};
    188188
    189189Health.prototype.Kill = function()
    190190{
     191    warn("Health.Kill " + this.entity);
    191192    this.Reduce(this.hitpoints);
    192193};
    193194
    194195/**
    195196 * Reduces entity's health by amount HP.
    196197 * Returns object of the form { "killed": false, "change": -12 }
    197198 */
    198199Health.prototype.Reduce = function(amount)
    199200{
     201    warn("Health.Reduce " + this.entity + " amount " + amount + " to " + Math.max(0, this.hitpoints - amount) + "HP");
     202
    200203    // Before changing the value, activate Fogging if necessary to hide changes
    201204    let cmpFogging = Engine.QueryInterface(this.entity, IID_Fogging);
    202205    if (cmpFogging)
    203206        cmpFogging.Activate();
    204207
    Health.prototype.Reduce = function(amoun  
    225228            if(this.template.SpawnEntityOnDeath)
    226229                this.CreateDeathSpawnedEntity();
    227230
    228231            if (this.template.DeathType == "corpse")
    229232            {
     233                warn("Health.Reduce creates corpse and deletes entity " + this.entity)
    230234                this.CreateCorpse();
    231235                Engine.DestroyEntity(this.entity);
    232236            }
    233237            else if (this.template.DeathType == "vanish")
    234238            {
  • binaries/data/mods/public/simulation/components/Promotion.js

    Promotion.prototype.GetPromotedTemplateN  
    3030
    3131Promotion.prototype.Promote = function(promotedTemplateName)
    3232{
    3333    // If the unit is dead, don't promote it
    3434    var cmpCurrentUnitHealth = Engine.QueryInterface(this.entity, IID_Health);
     35    warn("Promoting " + this.entity + " having " + cmpCurrentUnitHealth.GetHitpoints() + "HP");
    3536    if (cmpCurrentUnitHealth.GetHitpoints() == 0)
    3637        return;
    3738
    3839    // Create promoted unit entity
    3940    var promotedUnitEntity = Engine.AddEntity(promotedTemplateName);
    Promotion.prototype.Promote = function(p  
    118119                    cmpUnitAI.SetGuardOf(promotedUnitEntity);
    119120            }
    120121        }
    121122    }
    122123
     124    warn("MT_EntityRenamed " + this.entity + " to " + promotedUnitEntity);
    123125    Engine.BroadcastMessage(MT_EntityRenamed, { entity: this.entity, newentity: promotedUnitEntity });
    124126
    125127    // Destroy current entity
     128    warn("Destroy entity "+ this.entity + " due to promotion");
    126129    Engine.DestroyEntity(this.entity);
     130    warn("Destroyed entity "+ this.entity + " due to promotion");
     131
    127132    // save the entity id
    128133    this.promotedUnitEntity = promotedUnitEntity;
    129134};
    130135
    131136Promotion.prototype.IncreaseXp = function(amount)