Index: binaries/data/mods/public/simulation/components/Auras.js
===================================================================
--- binaries/data/mods/public/simulation/components/Auras.js (révision 18521)
+++ binaries/data/mods/public/simulation/components/Auras.js (copie de travail)
@@ -210,6 +210,17 @@
continue;
}
+ // When only Player class affected, we do not need a rangeQuery as applicable only to player entity
+ // and templates TODO maybe add a new type "player"
+ if (this.IsGlobalAura(name) && this.GetClasses(name).length == 1 && this.GetClasses(name)[0] == "Player")
+ {
+ this.ApplyTemplateBonus(name, affectedPlayers);
+ let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
+ let playerEnts = affectedPlayers.map(player => cmpPlayerManager.GetPlayerByID(player));
+ this.ApplyBonus(name, playerEnts);
+ continue;
+ }
+
this[name].rangeQuery = cmpRangeManager.CreateActiveQuery(
this.entity,
0,
Index: binaries/data/mods/public/simulation/components/ResourceTrickle.js
===================================================================
--- binaries/data/mods/public/simulation/components/ResourceTrickle.js (révision 18521)
+++ binaries/data/mods/public/simulation/components/ResourceTrickle.js (copie de travail)
@@ -32,36 +32,47 @@
ResourceTrickle.prototype.Init = function()
{
+ this.ComputeRates();
// Call the timer
- var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
+ let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
cmpTimer.SetInterval(this.entity, IID_ResourceTrickle, "Trickle", this.GetTimer(), this.GetTimer(), undefined);
};
ResourceTrickle.prototype.GetTimer = function()
{
- var interval = +this.template.Interval;
- return interval;
+ return +this.template.Interval;
};
ResourceTrickle.prototype.GetRates = function()
{
- var rates = {};
- for (var resource in this.template.Rates)
- rates[resource] = ApplyValueModificationsToEntity("ResourceTrickle/Rates/"+resource, +this.template.Rates[resource], this.entity);
+ return this.rates;
+};
- return rates;
+ResourceTrickle.prototype.ComputeRates = function()
+{
+ this.rates = {};
+ for (let resource in this.template.Rates)
+ this.rates[resource] = ApplyValueModificationsToEntity("ResourceTrickle/Rates/"+resource, +this.template.Rates[resource], this.entity);
};
// Do the actual work here
ResourceTrickle.prototype.Trickle = function(data, lateness)
{
- var cmpPlayer = QueryOwnerInterface(this.entity);
+ // The player entity may also be a ResourceTrickle component
+ let cmpPlayer = QueryOwnerInterface(this.entity) || Engine.QueryInterface(this.entity, IID_Player);
if (!cmpPlayer)
return;
- var rates = this.GetRates();
- for (var resource in rates)
- cmpPlayer.AddResource(resource, rates[resource]);
+ for (let resource in this.rates)
+ cmpPlayer.AddResource(resource, this.rates[resource]);
};
+ResourceTrickle.prototype.OnValueModification = function(msg)
+{
+ if (msg.component != "ResourceTrickle")
+ return;
+
+ this.ComputeRates();
+};
+
Engine.RegisterComponentType(IID_ResourceTrickle, "ResourceTrickle", ResourceTrickle);
Index: binaries/data/mods/public/simulation/data/auras/teambonuses/ptol_player_teambonus.json
===================================================================
--- binaries/data/mods/public/simulation/data/auras/teambonuses/ptol_player_teambonus.json (nonexistent)
+++ binaries/data/mods/public/simulation/data/auras/teambonuses/ptol_player_teambonus.json (copie de travail)
@@ -0,0 +1,10 @@
+{
+ "type": "global",
+ "affects": ["Player"],
+ "affectedPlayers": ["ExclusiveMutualAlly"],
+ "modifications": [
+ { "value": "ResourceTrickle/Rates/food", "add": 1.5 }
+ ],
+ "auraName": "Breadbasket of the Mediterranean",
+ "auraDescription": "All allies automatically gain a slow trickle of food income."
+}
Index: binaries/data/mods/public/simulation/templates/special/player.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/special/player.xml (révision 18521)
+++ binaries/data/mods/public/simulation/templates/special/player.xml (copie de travail)
@@ -60,6 +60,15 @@
unlock_shared_los
unlock_shared_dropsites
+
+
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+
+ 1000
+
Index: binaries/data/mods/public/simulation/templates/special/player_ptol.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/special/player_ptol.xml (révision 18521)
+++ binaries/data/mods/public/simulation/templates/special/player_ptol.xml (copie de travail)
@@ -1,5 +1,6 @@
+ teambonuses/ptol_player_teambonus