Ticket #697: units_promotion.diff

File units_promotion.diff, 44.3 KB (added by fcxSanya, 13 years ago)
  • binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_a.xml

     
    3333        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    3434        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3535        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     36        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3637      </animations>
    3738      <mesh>skeletal/m_pants.dae</mesh>
    3839      <props>
  • binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_e.xml

     
    3131        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    3232        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3333        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     34        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3435      </animations>
    3536      <mesh>skeletal/m_tights.dae</mesh>
    3637      <props>
  • binaries/data/mods/public/art/actors/units/celts/infantry_spearman_a.xml

     
    3030        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    3131        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3232        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     33        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3334      </animations>
    3435      <mesh>skeletal/m_pants_celt.dae</mesh>
    3536      <props>
  • binaries/data/mods/public/art/actors/units/celts/infantry_spearman_e.xml

     
    3131        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    3232        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3333        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     34        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3435      </animations>
    3536      <mesh>skeletal/m_pants_celt.dae</mesh>
    3637      <props>
  • binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_a.xml

     
    2828        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    2929        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3030        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     31        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3132      </animations>
    3233      <mesh>skeletal/m_tunic_short.dae</mesh>
    3334      <props>
  • binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_e.xml

     
    2727        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    2828        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    2929        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     30        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3031      </animations>
    3132      <mesh>skeletal/m_tunic_long.dae</mesh>
    3233      <props>
  • binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_a.xml

     
    3030        <animation file="infantry/general/death/inf_05.psa" name="Death" speed="600"/>
    3131        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3232        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     33        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3334      </animations>
    3435      <props>
    3536        <prop actor="props/units/heads/floppy_b.xml" attachpoint="helmet"/>
  • binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_e.xml

     
    3030        <animation file="infantry/general/death/inf_05.psa" name="Death" speed="600"/>
    3131        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    3232        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     33        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3334      </animations>
    3435      <mesh>skeletal/m_tunic_long.dae</mesh>
    3536      <props>
  • binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_a.xml

     
    2727        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    2828        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    2929        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     30        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3031      </animations>
    3132      <mesh>skeletal/m_tunic_short.dae</mesh>
    3233      <props>
  • binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_e.xml

     
    2727        <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
    2828        <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
    2929        <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
     30        <animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
    3031      </animations>
    3132      <mesh>skeletal/m_tunic_short.dae</mesh>
    3233      <props>
  • binaries/data/mods/public/gui/session/selection.js

     
    190190// Update the selection to take care of changes (like units that have been killed)
    191191EntitySelection.prototype.update = function()
    192192{
     193    this.checkRenamedEntities();
    193194    for each (var ent in this.selected)
    194195    {
    195196        var entState = GetEntityState(ent);
     
    218219    }
    219220};
    220221
     222/**
     223 * Update selection if some selected entities was renamed
     224 * (in case of unit promotion or finishing building structure)
     225 */
     226EntitySelection.prototype.checkRenamedEntities = function()
     227{
     228    var renamedEntities = Engine.GuiInterfaceCall("GetRenamedEntities", true);
     229    if (renamedEntities.length > 0)
     230    {
     231        var selectedEntities = this.toList();
     232        var removeFromSelectionList = [];
     233        var addToSelectionList = [];
     234        for each (var renamedEntity in renamedEntities)
     235        {
     236            if (selectedEntities.indexOf(renamedEntity.oldEntityId) != -1)
     237            {
     238                removeFromSelectionList.push(renamedEntity.oldEntityId);
     239                addToSelectionList.push(renamedEntity.newEntityId);
     240            }
     241        }
     242        this.removeList(removeFromSelectionList);
     243        this.addList(addToSelectionList);
     244    }
     245}
     246
    221247EntitySelection.prototype.addList = function(ents)
    222248{
    223249    var selectionSize = this.toList().length;
  • binaries/data/mods/public/gui/session/selection_details.js

     
    6565    {
    6666        getGUIObjectByName("health").hidden = true;
    6767    }
     68   
     69    // Experience
     70    if (entState.promotion)
     71    {
     72        var experienceBar = getGUIObjectByName("experienceBar");
     73        var experienceSize = experienceBar.size;
     74        experienceSize.rtop = 100 - 100 * Math.max(0, Math.min(1, 1.0 * entState.promotion.curr / entState.promotion.req));
     75        experienceBar.size = experienceSize;
    6876
     77        experience = "[font=\"serif-bold-13\"]XP [/font]" + entState.promotion.curr;
     78        if (entState.promotion.curr < entState.promotion.req) experience += "/" + entState.promotion.req;
     79        getGUIObjectByName("experience").tooltip = experience;
     80        getGUIObjectByName("experience").hidden = false;
     81    }
     82    else
     83    {
     84        getGUIObjectByName("experience").hidden = true;
     85    }
     86
    6987    // Resource stats
    7088    var resources = "";
    7189    var resourceType = "";
  • binaries/data/mods/public/gui/session/session.xml

     
    498498                        <object type="image" sprite="resourceForeground" ghost="true" name="resourceBar"/>
    499499                        <object type="image" sprite="statsBarShader" ghost="true"/>
    500500                    </object>
     501                   
     502                    <!-- Experience bar -->
     503                    <object size="46 0 58 100%" type="image" name="experience" tooltip="XP" tooltip_style="snToolTip">
     504                        <object type="image" sprite="experienceBackground" ghost="true"/>
     505                        <object type="image" sprite="experienceForeground" ghost="true" name="experienceBar"/>
     506                        <object type="image" sprite="statsBarShader" ghost="true"/>
     507                    </object>
    501508                </object>
    502509               
    503510                <!-- Specific Name -->
  • binaries/data/mods/public/gui/session/sprites.xml

     
    706706    <sprite name="staminaForeground">
    707707        <image backcolor="blue"/>
    708708    </sprite>
     709   
     710    <sprite name="experienceBackground">
     711        <image backcolor="darkgray"/>
     712    </sprite>
    709713
     714    <sprite name="experienceForeground">
     715        <image backcolor="white"/>
     716    </sprite>
     717
    710718    <!-- ================================  ================================ -->
    711719    <!-- Chat -->
    712720    <!-- ================================  ================================ -->
  • binaries/data/mods/public/simulation/components/Armour.js

     
    1919
    2020Armour.prototype.Init = function()
    2121{
     22    this.invulnerable = false;
    2223};
    2324
     25Armour.prototype.SetInvulnerability = function(invulnerability)
     26{
     27    this.invulnerable = invulnerability;
     28};
     29
    2430Armour.prototype.TakeDamage = function(hack, pierce, crush)
    2531{
     32    if (this.invulnerable) return { "killed": false };
    2633    // Adjust damage values based on armour
    2734    var adjHack = Math.max(0, hack - this.template.Hack);
    2835    var adjPierce = Math.max(0, pierce - this.template.Pierce);
  • binaries/data/mods/public/simulation/components/Attack.js

     
    205205
    206206/**
    207207 * Called when some units kills something (another unit, building, animal etc)
    208  * update player statistics only for now
    209208 */
    210209Attack.prototype.TargetKilled = function(killerEntity, targetEntity)
    211210{
     
    213212    if (cmpKillerPlayerStatisticsTracker) cmpKillerPlayerStatisticsTracker.KilledEntity(targetEntity);
    214213    var cmpTargetPlayerStatisticsTracker = QueryOwnerInterface(targetEntity, IID_StatisticsTracker);
    215214    if (cmpTargetPlayerStatisticsTracker) cmpTargetPlayerStatisticsTracker.LostEntity(targetEntity);
     215
     216    // if unit can collect loot, lets try to collect it
     217    var cmpLooter = Engine.QueryInterface(killerEntity, IID_Looter);
     218    if (cmpLooter)
     219    {
     220        cmpLooter.Collect(targetEntity);
     221    }
    216222}
    217223
    218224/**
  • binaries/data/mods/public/simulation/components/Foundation.js

     
    121121        Engine.PostMessage(this.entity, MT_ConstructionFinished,
    122122            { "entity": this.entity, "newentity": building });
    123123
     124        Engine.BroadcastMessage(MT_EntityRenamed, { oldEntityId: this.entity, newEntityId: building });
     125           
    124126        Engine.DestroyEntity(this.entity);
    125127    }
    126128};
  • binaries/data/mods/public/simulation/components/GuiInterface.js

     
    11function GuiInterface()
    22{
    33    this.notifications = [];
     4    this.renamedEntities = [];
    45}
    56
    67GuiInterface.prototype.Schema =
     
    8182    return ret;
    8283};
    8384
     85GuiInterface.prototype.GetRenamedEntities = function(player, clearList)
     86{
     87    var result = this.renamedEntities.slice();
     88    if (clearList) this.renamedEntities = [];
     89    return result; 
     90};
     91
    8492GuiInterface.prototype.GetEntityState = function(player, ent)
    8593{
    8694    var cmpTempMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
     
    199207        };
    200208    }
    201209   
     210    var cmpPromotion = Engine.QueryInterface(ent, IID_Promotion);
     211    if (cmpPromotion)
     212    {
     213        ret.promotion = {
     214            "curr": cmpPromotion.GetCurr(),
     215            "req": cmpPromotion.GetReq()
     216        };
     217    }
     218   
    202219    var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
    203220    ret.visibility = cmpRangeManager.GetLosVisibility(ent, player);
    204221
     
    462479    cmpRangeManager.SetDebugOverlay(enabled);
    463480};
    464481
     482GuiInterface.prototype.OnGlobalEntityRenamed = function(msg)
     483{
     484    this.renamedEntities.push(msg);
     485}
     486
    465487// List the GuiInterface functions that can be safely called by GUI scripts.
    466488// (GUI scripts are non-deterministic and untrusted, so these functions must be
    467489// appropriately careful. They are called with a first argument "player", which is
     
    471493   
    472494    "GetSimulationState": 1,
    473495    "GetExtendedSimulationState": 1,
     496    "GetRenamedEntities": 1,
    474497    "GetEntityState": 1,
    475498    "GetTemplateData": 1,
    476499    "GetNextNotification": 1,
  • binaries/data/mods/public/simulation/components/Identity.js

     
    112112
    113113Identity.prototype.GetRank = function()
    114114{
    115     if (this.template.Rank)
    116         return this.template.Rank;
    117     return "";
     115    return (this.template.Rank || "");
    118116};
    119117
     118Identity.prototype.SetRank = function(newRank)
     119{
     120    this.template.Rank = newRank;
     121};
     122
    120123Identity.prototype.GetClassesList = function()
    121124{
    122125    if (this.template.Classes)
  • binaries/data/mods/public/simulation/components/interfaces/Messages.js

     
     1/**
     2 * Broadcast message
     3 * sent when one entity is changed to other:
     4 * from Foundation component when building constuction is done
     5 * and from Promotion component when unit is promoted
     6 * Data: { oldEntityId: <integer>, newEntityId: <integer> }
     7 */
     8Engine.RegisterMessageType("EntityRenamed");
  • binaries/data/mods/public/simulation/components/Loot.js

     
    1717        "<element name='metal'><data type='nonNegativeInteger'/></element>" +
    1818    "</optional>";
    1919
    20 /*
    21  * TODO: this all needs to be designed and implemented
    22  */
     20Loot.prototype.GetXp = function()
     21{
     22    return this.template.xp;
     23};
    2324
     25Loot.prototype.GetResources = function()
     26{
     27    return {
     28        "food": +(this.template.food || 0),
     29        "wood": +(this.template.wood || 0),
     30        "metal": +(this.template.metal || 0),   
     31        "stone": +(this.template.stone || 0)
     32    };
     33};
     34
    2435Engine.RegisterComponentType(IID_Loot, "Loot", Loot);
  • binaries/data/mods/public/simulation/components/Looter.js

     
    33Looter.prototype.Schema =
    44    "<empty/>";
    55   
    6 /*
    7  * TODO: this all needs to be designed and implemented
     6/**
     7 * Try to collect loot from target entity
    88 */
    9  
     9Looter.prototype.Collect = function(targetEntity)
     10{
     11    var cmpLoot = Engine.QueryInterface(targetEntity, IID_Loot);
     12    if (!cmpLoot) return;
     13   
     14    var xp = cmpLoot.GetXp();
     15    if (xp > 0)
     16    {
     17        var cmpPromotion = Engine.QueryInterface(this.entity, IID_Promotion);
     18        if (cmpPromotion) cmpPromotion.IncreaseXp(xp);
     19    }
     20    var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
     21    cmpPlayer.AddResources(cmpLoot.GetResources());
     22}
     23
    1024Engine.RegisterComponentType(IID_Looter, "Looter", Looter);
    1125
  • binaries/data/mods/public/simulation/components/Promotion.js

     
    66    "</element>" +
    77    "<element name='Req'>" +
    88        "<data type='positiveInteger'/>" +
    9     "</element>";
     9    "</element>" +
     10    "<optional>" +
     11        "<element name='Curr'>" +
     12            "<data type='positiveInteger'/>" +
     13        "</element>" +
     14    "</optional>";
    1015
    11 /*
    12  * TODO: this all needs to be designed and implemented
    13  */
     16Promotion.prototype.Init = function()
     17{
     18    this.curr = +(this.template.Curr || 0);
     19}
     20   
     21Promotion.prototype.GetReq = function()
     22{
     23    return +(this.template.Req);
     24};
    1425
     26Promotion.prototype.GetCurr = function()
     27{
     28    return +(this.curr || 0);
     29};
     30
     31Promotion.prototype.GetPromotedTemplateName = function()
     32{
     33    if (this.template.Entity) return this.template.Entity;
     34    // TODO: check for name with following suffix b -> a -> e
     35    return null;
     36}
     37
     38Promotion.prototype.CanPromote = function()
     39{
     40    var cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity);
     41    if (cmpIdentity.GetRank == "" || cmpIdentity.GetRank == "Elite") return false;
     42    if (!this.GetPromotedTemplateName()) return false;
     43    return true;
     44}
     45
     46Promotion.prototype.Promote = function()
     47{
     48    // Create promoted unit entity
     49    var promotedUnitEntity = Engine.AddEntity(this.GetPromotedTemplateName());
     50       
     51    // Copy parameters from current entity to promoted one
     52    var cmpCurrentUnitPosition = Engine.QueryInterface(this.entity, IID_Position);
     53    var cmpPromotedUnitPosition = Engine.QueryInterface(promotedUnitEntity, IID_Position);
     54    var pos = cmpCurrentUnitPosition.GetPosition();
     55    cmpPromotedUnitPosition.JumpTo(pos.x, pos.z);
     56    var rot = cmpCurrentUnitPosition.GetRotation();
     57    cmpPromotedUnitPosition.SetYRotation(rot.y);
     58    cmpPromotedUnitPosition.SetXZRotation(rot.x, rot.z);
     59   
     60    var cmpCurrentUnitOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
     61    var cmpPromotedUnitOwnership = Engine.QueryInterface(promotedUnitEntity, IID_Ownership);
     62    cmpPromotedUnitOwnership.SetOwner(cmpCurrentUnitOwnership.GetOwner());
     63
     64    var cmpPromotedUnitPromotion = Engine.QueryInterface(promotedUnitEntity, IID_Promotion);
     65    if (cmpPromotedUnitPromotion)
     66        cmpPromotedUnitPromotion.IncreaseXp(this.curr - this.template.Req);
     67       
     68    var cmpCurrentUnitResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
     69    var cmpPromotedUnitResourceGatherer = Engine.QueryInterface(promotedUnitEntity, IID_ResourceGatherer);
     70    if (cmpCurrentUnitResourceGatherer && cmpPromotedUnitResourceGatherer)
     71    {
     72        var carriedResorces = cmpCurrentUnitResourceGatherer.GetCarryingStatus();
     73        cmpPromotedUnitResourceGatherer.GiveResources(carriedResorces);
     74    }
     75   
     76    var cmpCurrentUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
     77    var cmpPromotedUnitAI = Engine.QueryInterface(promotedUnitEntity, IID_UnitAI);
     78    cmpPromotedUnitAI.Cheer();
     79    var orders = cmpCurrentUnitAI.GetOrders();
     80    cmpPromotedUnitAI.AddOrders(orders);
     81   
     82    Engine.BroadcastMessage(MT_EntityRenamed, { oldEntityId: this.entity, newEntityId: promotedUnitEntity });
     83   
     84    // Destroy current entity
     85    Engine.DestroyEntity(this.entity);
     86}
     87
     88Promotion.prototype.IncreaseXp = function(amount)
     89{
     90    this.curr += +(amount);
     91    if (this.CanPromote() && this.curr >= this.template.Req)
     92    {
     93        this.Promote();
     94    }
     95}
     96
    1597Engine.RegisterComponentType(IID_Promotion, "Promotion", Promotion);
  • binaries/data/mods/public/simulation/components/ResourceGatherer.js

     
    8181            "amount": this.carrying[type],
    8282            "max": +this.template.Capacities[type]
    8383        });
    84     }
     84    }   
    8585    return ret;
    8686};
    8787
    8888/**
     89 * Used to instantly give resources to unit
     90 * @param resources The same structure as returned form GetCarryingStatus
     91 */
     92ResourceGatherer.prototype.GiveResources = function(resources)
     93{
     94    for each (var resource in resources)
     95    {
     96        this.carrying[resource.type] = +(resource.amount);
     97    }   
     98};
     99
     100/**
    89101 * Returns the type of one particular resource this unit is
    90102 * currently carrying, or undefined if none.
    91103 */
  • binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js

     
    55Engine.LoadComponentScript("interfaces/GarrisonHolder.js");
    66Engine.LoadComponentScript("interfaces/Health.js");
    77Engine.LoadComponentScript("interfaces/Identity.js");
     8Engine.LoadComponentScript("interfaces/Promotion.js");
    89Engine.LoadComponentScript("interfaces/RallyPoint.js");
    910Engine.LoadComponentScript("interfaces/ResourceDropsite.js");
    1011Engine.LoadComponentScript("interfaces/ResourceGatherer.js");
  • binaries/data/mods/public/simulation/components/UnitAI.js

     
    191191            this.SetNextState("INDIVIDUAL.GARRISON.GARRISONED");
    192192        }
    193193    },
     194   
     195    "Order.Cheering": function(msg) {
     196        this.SetNextState("INDIVIDUAL.CHEERING");
     197    },
    194198
    195199    // States for the special entity representing a group of units moving in formation:
    196200    "FORMATIONCONTROLLER": {
     
    693697            },
    694698        },
    695699
     700        "CHEERING": {
     701            "enter": function() {
     702                // Unit is invulnerable while cheering
     703                var cmpDamageReceiver = Engine.QueryInterface(this.entity, IID_DamageReceiver);
     704                cmpDamageReceiver.SetInvulnerability(true);
     705                this.SelectAnimation("promotion");
     706                this.StartTimer(4000, 4000);
     707                return false;
     708            },
     709           
     710            "leave": function() {   
     711                this.StopTimer();
     712               
     713            },
     714           
     715            "Timer": function(msg) {
     716                var cmpDamageReceiver = Engine.QueryInterface(this.entity, IID_DamageReceiver);
     717                cmpDamageReceiver.SetInvulnerability(false);
     718                this.FinishOrder();
     719            },
     720        },
    696721    },
    697722};
    698723
     
    839864UnitAI.prototype.PushOrderFront = function(type, data)
    840865{
    841866    var order = { "type": type, "data": data };
    842     this.orderQueue.unshift(order);
    843 
    844     this.order = order;
    845     UnitFsm.ProcessMessage(this, {"type": "Order."+this.order.type, "data": this.order.data});
     867    // If current order is cheering then add new order after it
     868    if (this.order && this.order.type == "Cheering")
     869    {
     870        var cheeringOrder = this.orderQueue.shift();
     871        this.orderQueue.unshift(cheeringOrder, order); 
     872    }
     873    else
     874    {
     875        this.orderQueue.unshift(order);
     876        this.order = order;
     877        UnitFsm.ProcessMessage(this, {"type": "Order."+this.order.type, "data": this.order.data});
     878    }
    846879};
    847880
    848881UnitAI.prototype.ReplaceOrder = function(type, data)
    849882{
    850     this.orderQueue = [];
    851     this.PushOrder(type, data);
     883    // If current order is cheering then add new order after it
     884    if (this.order && this.order.type == "Cheering")
     885    {
     886        var order = { "type": type, "data": data };
     887        var cheeringOrder = this.orderQueue.shift();
     888        this.orderQueue = [ cheeringOrder, order ];
     889    }
     890    else
     891    {
     892        this.orderQueue = [];
     893        this.PushOrder(type, data);
     894    }
    852895};
    853896
     897UnitAI.prototype.GetOrders = function()
     898{
     899    return this.orderQueue.slice();
     900}
     901
     902UnitAI.prototype.AddOrders = function(orders)
     903{
     904    for each (var order in orders)
     905    {
     906        this.PushOrder(order.type, order.data);
     907    }
     908}
     909
    854910UnitAI.prototype.TimerHandler = function(data, lateness)
    855911{
    856912    // Reset the timer
     
    12851341    this.AddOrder("Repair", { "target": target }, queued);
    12861342};
    12871343
     1344UnitAI.prototype.Cheer = function()
     1345{
     1346    this.AddOrder("Cheering", null, false);
     1347};
     1348
    12881349UnitAI.prototype.SetStance = function(stance)
    12891350{
    12901351    if (g_Stances[stance])
  • binaries/data/mods/public/simulation/templates/template_unit.xml

     
    8383    <RetainInFog>false</RetainInFog>
    8484    <AlwaysVisible>false</AlwaysVisible>
    8585  </Vision>
     86  <Looter />
    8687</Entity>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>celt_cavalry_javelinist_e</Entity>
     7    <Entity>units/celt_cavalry_javelinist_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_b.xml

     
    88    <Icon>units/celt_cavalry_javelinist.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>celt_cavalry_javelinist_a</Entity>
     11    <Entity>units/celt_cavalry_javelinist_a</Entity>
    1212  </Promotion>
    1313  <Armour>
    1414    <Hack>2.0</Hack>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_e.xml

     
    2929  <VisualActor>
    3030    <Actor>units/celts/cavalry_javelinist_e.xml</Actor>
    3131  </VisualActor>
     32  <Promotion disable="" />
    3233</Entity>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>celt_cavalry_spearman_e</Entity>
     7    <Entity>units/celt_cavalry_spearman_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_b.xml

     
    1010    <Icon>units/celt_cavalry_spearman.png</Icon>
    1111  </Identity>
    1212  <Promotion>
    13     <Entity>celt_cavalry_spearman_a</Entity>
     13    <Entity>units/celt_cavalry_spearman_a</Entity>
    1414  </Promotion>
    1515  <Cost>
    1616    <BuildTime>10</BuildTime>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_e.xml

     
    2828  <VisualActor>
    2929    <Actor>units/celts/cavalry_spearman_e.xml</Actor>
    3030  </VisualActor>
     31  <Promotion disable="" />
    3132</Entity>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>celt_cavalry_swordsman_e</Entity>
     7    <Entity>units/celt_cavalry_swordsman_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_b.xml

     
    88    <Icon>units/celt_cavalry_swordsman.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>celt_cavalry_swordsman_a</Entity>
     11    <Entity>units/celt_cavalry_swordsman_a</Entity>
    1212  </Promotion>
    1313  <Armour>
    1414    <Hack>3.0</Hack>
  • binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_e.xml

     
    3131  <VisualActor>
    3232    <Actor>units/celts/cavalry_swordsman_e.xml</Actor>
    3333  </VisualActor>
     34  <Promotion disable="" />
    3435</Entity>
  • binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>celt_infantry_javelinist_e</Entity>
     7    <Entity>units/celt_infantry_javelinist_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_b.xml

     
    88    <Icon>units/celt_infantry_javelinist.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>celt_infantry_javelinist_a</Entity>
     11    <Entity>units/celt_infantry_javelinist_a</Entity>
    1212  </Promotion>
    1313  <Armour>
    1414    <Hack>2.0</Hack>
  • binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_e.xml

     
    2929  <VisualActor>
    3030    <Actor>units/celts/infantry_javelinist_e.xml</Actor>
    3131  </VisualActor>
     32  <Promotion disable="" />
    3233</Entity>
  • binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>celt_infantry_spearman_e</Entity>
     7    <Entity>units/celt_infantry_spearman_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_b.xml

     
    88    <Icon>units/celt_infantry_spearman.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>celt_infantry_spearman_a</Entity>
     11    <Entity>units/celt_infantry_spearman_a</Entity>
    1212  </Promotion>
    1313  <Armour>
    1414    <Hack>3.0</Hack>
  • binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_e.xml

     
    3333  <VisualActor>
    3434    <Actor>units/celts/infantry_spearman_e.xml</Actor>
    3535  </VisualActor>
     36  <Promotion disable="" />
    3637</Entity>
  • binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>hele_cavalry_javelinist_e</Entity>
     7    <Entity>units/hele_cavalry_javelinist_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_b.xml

     
    88    <Icon>units/hele_cavalry_javelinist.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>hele_cavalry_javelinist_a</Entity>
     11    <Entity>units/hele_cavalry_javelinist_a</Entity>
    1212  </Promotion>
    1313  <Vision>
    1414    <Range>110</Range>
  • binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_e.xml

     
    2929  <VisualActor>
    3030    <Actor>units/hellenes/cavalry_javelinist_e.xml</Actor>
    3131  </VisualActor>
    32 
     32  <Promotion disable="" />
    3333</Entity>
  • binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>hele_cavalry_swordsman_e</Entity>
     7    <Entity>units/hele_cavalry_swordsman_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_b.xml

     
    88    <Icon>units/hele_cavalry_swordsman.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>hele_cavalry_swordsman_a</Entity>
     11    <Entity>units/hele_cavalry_swordsman_a</Entity>
    1212  </Promotion>
    1313  <Vision>
    1414    <Range>110</Range>
  • binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_e.xml

     
    3131  <VisualActor>
    3232    <Actor>units/hellenes/cavalry_swordsman_e.xml</Actor>
    3333  </VisualActor>
    34 
     34  <Promotion disable="" />
    3535</Entity>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>hele_infantry_archer_e</Entity>
     7    <Entity>units/hele_infantry_archer_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_b.xml

     
    99    <Icon>units/hele_infantry_archer.png</Icon>
    1010  </Identity>
    1111  <Promotion>
    12     <Entity>hele_infantry_archer_a</Entity>
     12    <Entity>units/hele_infantry_archer_a</Entity>
    1313  </Promotion>
    1414  <Cost>
    1515    <Resources>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_e.xml

     
    3333  <VisualActor>
    3434    <Actor>units/hellenes/infantry_archer_e.xml</Actor>
    3535  </VisualActor>
     36  <Promotion disable="" />
    3637</Entity>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>hele_infantry_javelinist_e</Entity>
     7    <Entity>units/hele_infantry_javelinist_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_b.xml

     
    88    <Icon>units/hele_infantry_javelinist.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>hele_infantry_javelinist_a</Entity>
     11    <Entity>units/hele_infantry_javelinist_a</Entity>
    1212  </Promotion>
    1313  <Cost>
    1414    <Resources>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_e.xml

     
    2222  <VisualActor>
    2323    <Actor>units/hellenes/infantry_javelinist_e.xml</Actor>
    2424  </VisualActor>
     25  <Promotion disable="" />
    2526</Entity>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_a.xml

     
    44    <Rank>Advanced</Rank>
    55  </Identity>
    66  <Promotion>
    7     <Entity>hele_infantry_spearman_e</Entity>
     7    <Entity>units/hele_infantry_spearman_e</Entity>
    88  </Promotion>
    99  <ResourceGatherer>
    1010    <BaseSpeed>0.75</BaseSpeed>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_b.xml

     
    88    <Icon>units/hele_infantry_spearman.png</Icon>
    99  </Identity>
    1010  <Promotion>
    11     <Entity>hele_infantry_spearman_a</Entity>
     11    <Entity>units/hele_infantry_spearman_a</Entity>
    1212  </Promotion>
    1313  <Cost>
    1414    <Resources>
  • binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_e.xml

     
    3333  <VisualActor>
    3434    <Actor>units/hellenes/infantry_spearman_e.xml</Actor>
    3535  </VisualActor>
    36  
     36  <Promotion disable="" />
    3737</Entity>