Ticket #3590: undeletable.diff

File undeletable.diff, 5.4 KB (added by leper, 8 years ago)
  • binaries/data/mods/public/gui/session/unit_actions.js

     
    691691    "delete": {
    692692        "getInfo": function(entState)
    693693        {
     694            if (!entState.canDelete)
     695                return false;
     696
    694697            if (entState.mirage)
    695698                return {
    696699                    "tooltip": translate("You cannot destroy this entity because it is in the fog-of-war"),
  • binaries/data/mods/public/simulation/components/GuiInterface.js

     
    272272        ret.maxHitpoints = cmpHealth.GetMaxHitpoints();
    273273        ret.needsRepair = cmpHealth.IsRepairable() && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints());
    274274        ret.needsHeal = !cmpHealth.IsUnhealable();
     275        ret.canDelete = !cmpHealth.IsUndeletable();
    275276    }
    276277
    277278    var cmpCapturable = QueryMiragedInterface(ent, IID_Capturable);
  • binaries/data/mods/public/simulation/components/Health.js

     
    3030            "<value a:help='Remain in the world with 0 health'>remain</value>" +
    3131        "</choice>" +
    3232    "</element>" +
     33    "<element name='Undeletable' a:help='Prevent players from deleting this entity.'>" +
     34        "<data type='boolean'/>" +
     35    "</element>" +
    3336    "<element name='Unhealable' a:help='Indicates that the entity can not be healed by healer units'>" +
    3437        "<data type='boolean'/>" +
    3538    "</element>";
     
    99102        || this.GetHitpoints() >= this.GetMaxHitpoints());
    100103};
    101104
     105Health.prototype.IsUndeletable = function()
     106{
     107    return this.template.Undeletable == "true";
     108};
     109
    102110Health.prototype.GetRegenRate = function()
    103111{
    104112    return this.regenRate;
  • binaries/data/mods/public/simulation/components/Mirage.js

     
    2222    this.hitpoints = null;
    2323    this.repairable = null;
    2424    this.unhealable = null;
     25    this.undeletable = null;
    2526
    2627    this.capturePoints = [];
    2728    this.maxCapturePoints = 0;
     
    7980    this.hitpoints = cmpHealth.GetHitpoints();
    8081    this.repairable = cmpHealth.IsRepairable();
    8182    this.unhealable = cmpHealth.IsUnhealable();
     83    this.undeletable = cmpHealth.IsUndeletable();
    8284};
    8385
    8486Mirage.prototype.GetMaxHitpoints = function() { return this.maxHitpoints; };
    8587Mirage.prototype.GetHitpoints = function() { return this.hitpoints; };
    8688Mirage.prototype.IsRepairable = function() { return this.repairable; };
    8789Mirage.prototype.IsUnhealable = function() { return this.unhealable; };
     90Mirage.prototype.IsUndeletable = function() { return this.undeletable; };
    8891
    8992// Capture data
    9093
  • binaries/data/mods/public/simulation/helpers/Commands.js

     
    366366            var cmpHealth = Engine.QueryInterface(ent, IID_Health);
    367367            if (cmpHealth)
    368368            {
     369                if (cmpHealth.IsUndeletable())
     370                    continue;
    369371                var cmpResourceSupply = Engine.QueryInterface(ent, IID_ResourceSupply);
    370372                if (!cmpResourceSupply || !cmpResourceSupply.GetKillBeforeGather())
    371373                    cmpHealth.Kill();
  • binaries/data/mods/public/simulation/templates/template_structure.xml

     
    4747  <Health>
    4848    <DeathType>corpse</DeathType>
    4949    <RegenRate>0</RegenRate>
     50    <Undeletable>false</Undeletable>
    5051    <Unhealable>true</Unhealable>
    5152  </Health>
    5253  <Repairable>
  • binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml

     
    6565    <Max>3000</Max>
    6666    <SpawnEntityOnDeath>rubble/rubble_stone_6x6</SpawnEntityOnDeath>
    6767  </Health>
    68     <Identity>
     68  <Identity>
    6969    <GenericName>Civic Center</GenericName>
    7070    <Tooltip>Build to acquire large tracts of territory. Train citizens. Garrison: 20.</Tooltip>
    7171    <Classes datatype="tokens">
  • binaries/data/mods/public/simulation/templates/template_unit.xml

     
    3131    <DeathType>corpse</DeathType>
    3232    <Max>100</Max>
    3333    <RegenRate>0</RegenRate>
     34    <Undeletable>false</Undeletable>
    3435    <Unhealable>false</Unhealable>
    3536  </Health>
    3637  <Identity>