diff --git a/binaries/data/mods/public/simulation/components/Armour.js b/binaries/data/mods/public/simulation/components/Armour.js
index 17cfff222c..77c514591b 100644
--- a/binaries/data/mods/public/simulation/components/Armour.js
+++ b/binaries/data/mods/public/simulation/components/Armour.js
@@ -83,7 +83,7 @@ Armour.prototype.GetArmourStrengths = function()
// Work out the armour values with technology effects
var self = this;
- var applyTechs = function(type, foundation)
+ var applyMods = function(type, foundation)
{
var strength;
if (foundation)
@@ -96,26 +96,24 @@ Armour.prototype.GetArmourStrengths = function()
strength = +self.template[type];
}
- // All causes caching problems so disable it for now.
- // var allComponent = ApplyTechModificationsToEntity("Armour/All", strength, self.entity) - self.template[type];
- strength = ApplyTechModificationsToEntity("Armour/" + type, strength, self.entity);
+ strength = ApplyValueModificationsToEntity("Armour/" + type, strength, self.entity);
return strength;
};
if (Engine.QueryInterface(this.entity, IID_Foundation) && this.template.Foundation)
{
return {
- hack: applyTechs("Hack", true),
- pierce: applyTechs("Pierce", true),
- crush: applyTechs("Crush", true)
+ hack: applyMods("Hack", true),
+ pierce: applyMods("Pierce", true),
+ crush: applyMods("Crush", true)
};
}
else
{
return {
- hack: applyTechs("Hack"),
- pierce: applyTechs("Pierce"),
- crush: applyTechs("Crush")
+ hack: applyMods("Hack"),
+ pierce: applyMods("Pierce"),
+ crush: applyMods("Crush")
};
}
};
diff --git a/binaries/data/mods/public/simulation/components/Attack.js b/binaries/data/mods/public/simulation/components/Attack.js
index 004245d1f2..a2e8142235 100644
--- a/binaries/data/mods/public/simulation/components/Attack.js
+++ b/binaries/data/mods/public/simulation/components/Attack.js
@@ -322,10 +322,10 @@ Attack.prototype.CompareEntitiesByPreference = function(a, b)
Attack.prototype.GetTimers = function(type)
{
var prepare = +(this.template[type].PrepareTime || 0);
- prepare = ApplyTechModificationsToEntity("Attack/" + type + "/PrepareTime", prepare, this.entity);
+ prepare = ApplyValueModificationsToEntity("Attack/" + type + "/PrepareTime", prepare, this.entity);
var repeat = +(this.template[type].RepeatTime || 1000);
- repeat = ApplyTechModificationsToEntity("Attack/" + type + "/RepeatTime", repeat, this.entity);
+ repeat = ApplyValueModificationsToEntity("Attack/" + type + "/RepeatTime", repeat, this.entity);
return { "prepare": prepare, "repeat": repeat, "recharge": repeat - prepare };
};
@@ -343,30 +343,28 @@ Attack.prototype.GetAttackStrengths = function(type)
splash = "/Splash";
}
- var applyTechs = function(damageType)
+ var applyMods = function(damageType)
{
- // All causes caching problems so disable it for now.
- //var allComponent = ApplyTechModificationsToEntity("Attack/" + type + splash + "/All", +(template[damageType] || 0), self.entity) - self.template[type][damageType];
- return ApplyTechModificationsToEntity("Attack/" + type + splash + "/" + damageType, +(template[damageType] || 0), self.entity);
+ return ApplyValueModificationsToEntity("Attack/" + type + splash + "/" + damageType, +(template[damageType] || 0), self.entity);
};
return {
- hack: applyTechs("Hack"),
- pierce: applyTechs("Pierce"),
- crush: applyTechs("Crush")
+ hack: applyMods("Hack"),
+ pierce: applyMods("Pierce"),
+ crush: applyMods("Crush")
};
};
Attack.prototype.GetRange = function(type)
{
var max = +this.template[type].MaxRange;
- max = ApplyTechModificationsToEntity("Attack/" + type + "/MaxRange", max, this.entity);
+ max = ApplyValueModificationsToEntity("Attack/" + type + "/MaxRange", max, this.entity);
var min = +(this.template[type].MinRange || 0);
- min = ApplyTechModificationsToEntity("Attack/" + type + "/MinRange", min, this.entity);
+ min = ApplyValueModificationsToEntity("Attack/" + type + "/MinRange", min, this.entity);
var elevationBonus = +(this.template[type].ElevationBonus || 0);
- elevationBonus = ApplyTechModificationsToEntity("Attack/" + type + "/ElevationBonus", elevationBonus, this.entity);
+ elevationBonus = ApplyValueModificationsToEntity("Attack/" + type + "/ElevationBonus", elevationBonus, this.entity);
return { "max": max, "min": min, "elevationBonus": elevationBonus};
};
@@ -438,7 +436,7 @@ Attack.prototype.PerformAttack = function(type, target)
var gravity = 9.81; // this affects the shape of the curve; assume it's constant for now
var spread = +this.template.Ranged.Spread;
- spread = ApplyTechModificationsToEntity("Attack/Ranged/Spread", spread, this.entity);
+ spread = ApplyValueModificationsToEntity("Attack/Ranged/Spread", spread, this.entity);
//horizSpeed /= 2; gravity /= 2; // slow it down for testing
diff --git a/binaries/data/mods/public/simulation/components/AuraManager.js b/binaries/data/mods/public/simulation/components/AuraManager.js
index b546a9f535..565577f4ff 100644
--- a/binaries/data/mods/public/simulation/components/AuraManager.js
+++ b/binaries/data/mods/public/simulation/components/AuraManager.js
@@ -37,6 +37,7 @@ AuraManager.prototype.ApplyBonus = function(value, ent, data, key)
if (this.modifications[value][ent][key].length > 1)
return;
+
// first time added this aura
if (data.multiply)
this.modificationsCache[value][ent].multiply *= data.multiply;
@@ -45,12 +46,7 @@ AuraManager.prototype.ApplyBonus = function(value, ent, data, key)
this.modificationsCache[value][ent].add += data.add;
// post message to the entity to notify it about the change
- // TODO MT_TechnologyModification expects a player ID, so we have to provide something.
- // Use -1 until this is changed not to require one.
- // This player info is not needed, as the message gets send to the correct entities immediately
- // A better way of handling this would be to remove the player info from the message data.
- var component = value.split("/")[0];
- Engine.PostMessage(ent, MT_TechnologyModification, { "component": component, "player": -1 });
+ Engine.PostMessage(ent, MT_ValueModification, { "component": value.split("/")[0] });
};
AuraManager.prototype.ApplyTemplateBonus = function(value, player, classes, data, key)
@@ -78,10 +74,6 @@ AuraManager.prototype.ApplyTemplateBonus = function(value, player, classes, data
this.templateModificationsCache[value][player][c][key].add += data.add;
}
-
- // post message to notify about the change
- var component = value.split("/")[0];
- Engine.BroadcastMessage(MT_TechnologyModification, { "component": component, "player": player});
};
AuraManager.prototype.RemoveBonus = function(value, ent, key)
@@ -106,12 +98,7 @@ AuraManager.prototype.RemoveBonus = function(value, ent, key)
this.modificationsCache[value][ent].multiply /= data.multiply;
// post message to the entity to notify it about the change
- // TODO MT_TechnologyModification expects a player ID, so we have to provide something.
- // Use -1 until this is changed not to require one.
- // This player info is not needed, as the message gets send to the correct entities immediately
- // A better way of handling this would be to remove the player info from the message data.
- var component = value.split("/")[0];
- Engine.PostMessage(ent, MT_TechnologyModification, { "component": component, "player": -1 });
+ Engine.PostMessage(ent, MT_ValueModification, { "component": value.split("/")[0] });
};
AuraManager.prototype.RemoveTemplateBonus = function(value, player, classes, key)
@@ -132,10 +119,6 @@ AuraManager.prototype.RemoveTemplateBonus = function(value, player, classes, key
this.templateModificationsCache[value][player][c][key].multiply = 1;
this.templateModificationsCache[value][player][c][key].add = 0;
}
-
- // post message to notify about the change
- var component = value.split("/")[0];
- Engine.BroadcastMessage(MT_TechnologyModification, { "component": component, "player": player });
};
AuraManager.prototype.ApplyModifications = function(valueName, value, ent)
diff --git a/binaries/data/mods/public/simulation/components/Auras.js b/binaries/data/mods/public/simulation/components/Auras.js
index 9cecb8132d..fd765f1821 100644
--- a/binaries/data/mods/public/simulation/components/Auras.js
+++ b/binaries/data/mods/public/simulation/components/Auras.js
@@ -354,9 +354,9 @@ Auras.prototype.OnDiplomacyChanged = function(msg)
this.Clean();
};
-Auras.prototype.OnTechnologyModification = function(msg)
+Auras.prototype.OnValueModification = function(msg)
{
- if (msg.component =="Auras")
+ if (msg.component == "Auras")
this.Clean();
};
diff --git a/binaries/data/mods/public/simulation/components/BuildRestrictions.js b/binaries/data/mods/public/simulation/components/BuildRestrictions.js
index 4ff3261a04..289f208a70 100644
--- a/binaries/data/mods/public/simulation/components/BuildRestrictions.js
+++ b/binaries/data/mods/public/simulation/components/BuildRestrictions.js
@@ -271,7 +271,7 @@ BuildRestrictions.prototype.GetCategory = function()
BuildRestrictions.prototype.GetTerritories = function()
{
- return ApplyTechModificationsToEntity("BuildRestrictions/Territory", this.territories, this.entity);
+ return ApplyValueModificationsToEntity("BuildRestrictions/Territory", this.territories, this.entity);
};
BuildRestrictions.prototype.HasTerritory = function(territory)
diff --git a/binaries/data/mods/public/simulation/components/Builder.js b/binaries/data/mods/public/simulation/components/Builder.js
index faa80bda95..e0e1112647 100644
--- a/binaries/data/mods/public/simulation/components/Builder.js
+++ b/binaries/data/mods/public/simulation/components/Builder.js
@@ -56,7 +56,7 @@ Builder.prototype.GetRange = function()
*/
Builder.prototype.PerformBuilding = function(target)
{
- var rate = ApplyTechModificationsToEntity("Builder/Rate", +this.template.Rate, this.entity);
+ var rate = ApplyValueModificationsToEntity("Builder/Rate", +this.template.Rate, this.entity);
// If it's a foundation, then build it
var cmpFoundation = Engine.QueryInterface(target, IID_Foundation);
diff --git a/binaries/data/mods/public/simulation/components/BuildingAI.js b/binaries/data/mods/public/simulation/components/BuildingAI.js
index 8573a93633..5a5051d060 100644
--- a/binaries/data/mods/public/simulation/components/BuildingAI.js
+++ b/binaries/data/mods/public/simulation/components/BuildingAI.js
@@ -199,13 +199,13 @@ BuildingAI.prototype.OnRangeUpdate = function(msg)
BuildingAI.prototype.GetDefaultArrowCount = function()
{
var arrowCount = +this.template.DefaultArrowCount;
- return ApplyTechModificationsToEntity("BuildingAI/DefaultArrowCount", arrowCount, this.entity);
+ return ApplyValueModificationsToEntity("BuildingAI/DefaultArrowCount", arrowCount, this.entity);
};
BuildingAI.prototype.GetGarrisonArrowMultiplier = function()
{
var arrowMult = +this.template.GarrisonArrowMultiplier;
- return ApplyTechModificationsToEntity("BuildingAI/GarrisonArrowMultiplier", arrowMult, this.entity);
+ return ApplyValueModificationsToEntity("BuildingAI/GarrisonArrowMultiplier", arrowMult, this.entity);
};
BuildingAI.prototype.GetGarrisonArrowClasses = function()
diff --git a/binaries/data/mods/public/simulation/components/Cost.js b/binaries/data/mods/public/simulation/components/Cost.js
index 280e4fcb6e..72e8de71cd 100644
--- a/binaries/data/mods/public/simulation/components/Cost.js
+++ b/binaries/data/mods/public/simulation/components/Cost.js
@@ -51,7 +51,7 @@ Cost.prototype.GetBuildTime = function()
{
var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
var buildTime = (+this.template.BuildTime) * cmpPlayer.cheatTimeMultiplier;
- return ApplyTechModificationsToEntity("Cost/BuildTime", buildTime, this.entity);
+ return ApplyValueModificationsToEntity("Cost/BuildTime", buildTime, this.entity);
}
Cost.prototype.GetResourceCosts = function()
@@ -60,7 +60,7 @@ Cost.prototype.GetResourceCosts = function()
for (var r in this.template.Resources)
{
costs[r] = +this.template.Resources[r];
- costs[r] = ApplyTechModificationsToEntity("Cost/Resources/"+r, costs[r], this.entity);
+ costs[r] = ApplyValueModificationsToEntity("Cost/Resources/"+r, costs[r], this.entity);
}
return costs;
};
diff --git a/binaries/data/mods/public/simulation/components/EntityLimitsChanger.js b/binaries/data/mods/public/simulation/components/EntityLimitsChanger.js
index 9888b63a51..3a8eb64c78 100644
--- a/binaries/data/mods/public/simulation/components/EntityLimitsChanger.js
+++ b/binaries/data/mods/public/simulation/components/EntityLimitsChanger.js
@@ -18,7 +18,7 @@ EntityLimitsChanger.prototype.OnOwnershipChanged = function(msg)
{
this.changes = {};
for (var cat in this.template)
- this.changes[cat] = ApplyTechModificationsToEntity("EntityLimitsChanger/Value", +this.template[cat], this.entity);
+ this.changes[cat] = ApplyValueModificationsToEntity("EntityLimitsChanger/Value", +this.template[cat], this.entity);
}
if (msg.from > -1)
@@ -38,7 +38,7 @@ EntityLimitsChanger.prototype.OnOwnershipChanged = function(msg)
}
}
-EntityLimitsChanger.prototype.OnTechnologyModification = function(msg)
+EntityLimitsChanger.prototype.OnValueModification = function(msg)
{
if (msg.component != "EntityLimitsChanger")
return;
@@ -50,7 +50,7 @@ EntityLimitsChanger.prototype.OnTechnologyModification = function(msg)
for (var cat in this.changes)
{
cmpEntityLimits.DecreaseLimit(cat, this.changes[cat]);
- this.changes[cat] = ApplyTechModificationsToEntity("EntityLimitsChanger/Value", +this.template[cat], this.entity);
+ this.changes[cat] = ApplyValueModificationsToEntity("EntityLimitsChanger/Value", +this.template[cat], this.entity);
cmpEntityLimits.IncreaseLimit(cat, this.changes[cat]);
}
};
diff --git a/binaries/data/mods/public/simulation/components/GarrisonHolder.js b/binaries/data/mods/public/simulation/components/GarrisonHolder.js
index 7093576a3e..426098cd31 100644
--- a/binaries/data/mods/public/simulation/components/GarrisonHolder.js
+++ b/binaries/data/mods/public/simulation/components/GarrisonHolder.js
@@ -66,7 +66,7 @@ GarrisonHolder.prototype.GetAllowedClassesList = function()
*/
GarrisonHolder.prototype.GetCapacity = function()
{
- return ApplyTechModificationsToEntity("GarrisonHolder/Max", +this.template.Max, this.entity);
+ return ApplyValueModificationsToEntity("GarrisonHolder/Max", +this.template.Max, this.entity);
};
/**
@@ -74,7 +74,7 @@ GarrisonHolder.prototype.GetCapacity = function()
*/
GarrisonHolder.prototype.GetHealRate = function()
{
- return ApplyTechModificationsToEntity("GarrisonHolder/BuffHeal", +this.template.BuffHeal, this.entity);
+ return ApplyValueModificationsToEntity("GarrisonHolder/BuffHeal", +this.template.BuffHeal, this.entity);
};
GarrisonHolder.prototype.EjectEntitiesOnDestroy = function()
diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js
index 1bb537e3f5..3575cc64a6 100644
--- a/binaries/data/mods/public/simulation/components/GuiInterface.js
+++ b/binaries/data/mods/public/simulation/components/GuiInterface.js
@@ -416,9 +416,9 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName)
if (template.Armour)
{
ret.armour = {
- "hack": ApplyTechModificationsToTemplate("Armour/Hack", +template.Armour.Hack, player, template),
- "pierce": ApplyTechModificationsToTemplate("Armour/Pierce", +template.Armour.Hack, player, template),
- "crush": ApplyTechModificationsToTemplate("Armour/Crush", +template.Armour.Hack, player, template),
+ "hack": ApplyValueModificationsToTemplate("Armour/Hack", +template.Armour.Hack, player, template),
+ "pierce": ApplyValueModificationsToTemplate("Armour/Pierce", +template.Armour.Hack, player, template),
+ "crush": ApplyValueModificationsToTemplate("Armour/Crush", +template.Armour.Hack, player, template),
};
}
@@ -428,12 +428,12 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName)
for (var type in template.Attack)
{
ret.attack[type] = {
- "hack": ApplyTechModificationsToTemplate("Attack/"+type+"/Hack", +(template.Attack[type].Hack || 0), player, template),
- "pierce": ApplyTechModificationsToTemplate("Attack/"+type+"/Pierce", +(template.Attack[type].Pierce || 0), player, template),
- "crush": ApplyTechModificationsToTemplate("Attack/"+type+"/Crush", +(template.Attack[type].Crush || 0), player, template),
- "minRange": ApplyTechModificationsToTemplate("Attack/"+type+"/MinRange", +(template.Attack[type].MinRange || 0), player, template),
- "maxRange": ApplyTechModificationsToTemplate("Attack/"+type+"/MaxRange", +template.Attack[type].MaxRange, player, template),
- "elevationBonus": ApplyTechModificationsToTemplate("Attack/"+type+"/ElevationBonus", +(template.Attack[type].ElevationBonus || 0), player, template),
+ "hack": ApplyValueModificationsToTemplate("Attack/"+type+"/Hack", +(template.Attack[type].Hack || 0), player, template),
+ "pierce": ApplyValueModificationsToTemplate("Attack/"+type+"/Pierce", +(template.Attack[type].Pierce || 0), player, template),
+ "crush": ApplyValueModificationsToTemplate("Attack/"+type+"/Crush", +(template.Attack[type].Crush || 0), player, template),
+ "minRange": ApplyValueModificationsToTemplate("Attack/"+type+"/MinRange", +(template.Attack[type].MinRange || 0), player, template),
+ "maxRange": ApplyValueModificationsToTemplate("Attack/"+type+"/MaxRange", +template.Attack[type].MaxRange, player, template),
+ "elevationBonus": ApplyValueModificationsToTemplate("Attack/"+type+"/ElevationBonus", +(template.Attack[type].ElevationBonus || 0), player, template),
};
}
}
@@ -468,13 +468,13 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName)
if (template.Cost)
{
ret.cost = {};
- if (template.Cost.Resources.food) ret.cost.food = ApplyTechModificationsToTemplate("Cost/Resources/food", +template.Cost.Resources.food, player, template);
- if (template.Cost.Resources.wood) ret.cost.wood = ApplyTechModificationsToTemplate("Cost/Resources/wood", +template.Cost.Resources.wood, player, template);
- if (template.Cost.Resources.stone) ret.cost.stone = ApplyTechModificationsToTemplate("Cost/Resources/stone", +template.Cost.Resources.stone, player, template);
- if (template.Cost.Resources.metal) ret.cost.metal = ApplyTechModificationsToTemplate("Cost/Resources/metal", +template.Cost.Resources.metal, player, template);
- if (template.Cost.Population) ret.cost.population = ApplyTechModificationsToTemplate("Cost/Population", +template.Cost.Population, player, template);
- if (template.Cost.PopulationBonus) ret.cost.populationBonus = ApplyTechModificationsToTemplate("Cost/PopulationBonus", +template.Cost.PopulationBonus, player, template);
- if (template.Cost.BuildTime) ret.cost.time = ApplyTechModificationsToTemplate("Cost/BuildTime", +template.Cost.BuildTime, player, template);
+ if (template.Cost.Resources.food) ret.cost.food = ApplyValueModificationsToTemplate("Cost/Resources/food", +template.Cost.Resources.food, player, template);
+ if (template.Cost.Resources.wood) ret.cost.wood = ApplyValueModificationsToTemplate("Cost/Resources/wood", +template.Cost.Resources.wood, player, template);
+ if (template.Cost.Resources.stone) ret.cost.stone = ApplyValueModificationsToTemplate("Cost/Resources/stone", +template.Cost.Resources.stone, player, template);
+ if (template.Cost.Resources.metal) ret.cost.metal = ApplyValueModificationsToTemplate("Cost/Resources/metal", +template.Cost.Resources.metal, player, template);
+ if (template.Cost.Population) ret.cost.population = ApplyValueModificationsToTemplate("Cost/Population", +template.Cost.Population, player, template);
+ if (template.Cost.PopulationBonus) ret.cost.populationBonus = ApplyValueModificationsToTemplate("Cost/PopulationBonus", +template.Cost.PopulationBonus, player, template);
+ if (template.Cost.BuildTime) ret.cost.time = ApplyValueModificationsToTemplate("Cost/BuildTime", +template.Cost.BuildTime, player, template);
}
if (template.Footprint)
@@ -523,13 +523,13 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName)
{
ret.pack = {
"state": template.Pack.State,
- "time": ApplyTechModificationsToTemplate("Pack/Time", +template.Pack.Time, player, template),
+ "time": ApplyValueModificationsToTemplate("Pack/Time", +template.Pack.Time, player, template),
};
}
if (template.Health)
{
- ret.health = Math.round(ApplyTechModificationsToTemplate("Health/Max", +template.Health.Max, player, template));
+ ret.health = Math.round(ApplyValueModificationsToTemplate("Health/Max", +template.Health.Max, player, template));
}
if (template.Identity)
diff --git a/binaries/data/mods/public/simulation/components/Heal.js b/binaries/data/mods/public/simulation/components/Heal.js
index 54e37f5427..38cb9fc2f2 100644
--- a/binaries/data/mods/public/simulation/components/Heal.js
+++ b/binaries/data/mods/public/simulation/components/Heal.js
@@ -42,7 +42,7 @@ Heal.prototype.GetTimers = function()
var prepare = 1000;
var repeat = +this.template.Rate;
- repeat = ApplyTechModificationsToEntity("Heal/Rate", repeat, this.entity);
+ repeat = ApplyValueModificationsToEntity("Heal/Rate", repeat, this.entity);
return { "prepare": prepare, "repeat": repeat };
};
@@ -52,7 +52,7 @@ Heal.prototype.GetRange = function()
var min = 0;
var max = +this.template.Range;
- max = ApplyTechModificationsToEntity("Heal/Range", max, this.entity);
+ max = ApplyValueModificationsToEntity("Heal/Range", max, this.entity);
return { "max": max, "min": min };
};
@@ -80,7 +80,7 @@ Heal.prototype.PerformHeal = function(target)
if (!cmpHealth)
return;
- var targetState = cmpHealth.Increase(ApplyTechModificationsToEntity("Heal/HP", +this.template.HP, this.entity));
+ var targetState = cmpHealth.Increase(ApplyValueModificationsToEntity("Heal/HP", +this.template.HP, this.entity));
// Add XP
var cmpLoot = Engine.QueryInterface(target, IID_Loot);
diff --git a/binaries/data/mods/public/simulation/components/Health.js b/binaries/data/mods/public/simulation/components/Health.js
index aedf287a18..fc5cd4cdfe 100644
--- a/binaries/data/mods/public/simulation/components/Health.js
+++ b/binaries/data/mods/public/simulation/components/Health.js
@@ -327,25 +327,25 @@ Health.prototype.Repair = function(builderEnt, work)
}
};
-Health.prototype.OnTechnologyModification = function(msg)
+Health.prototype.OnValueModification = function(msg)
{
- if (msg.component == "Health")
- {
- var oldMaxHitpoints = this.GetMaxHitpoints();
- var newMaxHitpoints = Math.round(ApplyTechModificationsToEntity("Health/Max", +this.template.Max, this.entity));
- if (oldMaxHitpoints != newMaxHitpoints)
- {
- var newHitpoints = Math.round(this.GetHitpoints() * newMaxHitpoints/oldMaxHitpoints);
- this.maxHitpoints = newMaxHitpoints;
- this.SetHitpoints(newHitpoints);
- }
+ if (msg.component != "Health")
+ return;
- var oldRegenRate = this.regenRate;
- this.regenRate = ApplyTechModificationsToEntity("Health/RegenRate", +this.template.RegenRate, this.entity);
-
- if (this.regenRate != oldRegenRate)
- this.CheckRegenTimer();
+ var oldMaxHitpoints = this.GetMaxHitpoints();
+ var newMaxHitpoints = Math.round(ApplyValueModificationsToEntity("Health/Max", +this.template.Max, this.entity));
+ if (oldMaxHitpoints != newMaxHitpoints)
+ {
+ var newHitpoints = Math.round(this.GetHitpoints() * newMaxHitpoints/oldMaxHitpoints);
+ this.maxHitpoints = newMaxHitpoints;
+ this.SetHitpoints(newHitpoints);
}
+
+ var oldRegenRate = this.regenRate;
+ this.regenRate = ApplyValueModificationsToEntity("Health/RegenRate", +this.template.RegenRate, this.entity);
+
+ if (this.regenRate != oldRegenRate)
+ this.CheckRegenTimer();
};
Health.prototype.OnHealthChanged = function()
diff --git a/binaries/data/mods/public/simulation/components/Pack.js b/binaries/data/mods/public/simulation/components/Pack.js
index dc740cb964..2632eaa45b 100644
--- a/binaries/data/mods/public/simulation/components/Pack.js
+++ b/binaries/data/mods/public/simulation/components/Pack.js
@@ -95,7 +95,7 @@ Pack.prototype.CancelPack = function()
Pack.prototype.GetPackTime = function()
{
- return ApplyTechModificationsToEntity("Pack/Time", +this.template.Time, this.entity);
+ return ApplyValueModificationsToEntity("Pack/Time", +this.template.Time, this.entity);
};
Pack.prototype.GetElapsedTime = function()
diff --git a/binaries/data/mods/public/simulation/components/Player.js b/binaries/data/mods/public/simulation/components/Player.js
index f517421881..2435903de2 100644
--- a/binaries/data/mods/public/simulation/components/Player.js
+++ b/binaries/data/mods/public/simulation/components/Player.js
@@ -108,7 +108,7 @@ Player.prototype.SetMaxPopulation = function(max)
Player.prototype.GetMaxPopulation = function()
{
- return Math.round(ApplyTechModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity));
+ return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity));
};
Player.prototype.SetGatherRateMultiplier = function(value)
diff --git a/binaries/data/mods/public/simulation/components/ProductionQueue.js b/binaries/data/mods/public/simulation/components/ProductionQueue.js
index 4cadc7250e..b222541aae 100644
--- a/binaries/data/mods/public/simulation/components/ProductionQueue.js
+++ b/binaries/data/mods/public/simulation/components/ProductionQueue.js
@@ -200,12 +200,12 @@ ProductionQueue.prototype.AddBatch = function(templateName, type, count, metadat
// Obviously we don't have the entities yet, so we must use template data
var costs = {};
var totalCosts = {};
- var buildTime = ApplyTechModificationsToTemplate("Cost/BuildTime", +template.Cost.BuildTime, cmpPlayer.GetPlayerID(), template);
+ var buildTime = ApplyValueModificationsToTemplate("Cost/BuildTime", +template.Cost.BuildTime, cmpPlayer.GetPlayerID(), template);
var time = timeMult * buildTime;
for (var r in template.Cost.Resources)
{
- costs[r] = ApplyTechModificationsToTemplate("Cost/Resources/"+r, +template.Cost.Resources[r], cmpPlayer.GetPlayerID(), template);
+ costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, +template.Cost.Resources[r], cmpPlayer.GetPlayerID(), template);
totalCosts[r] = Math.floor(count * costs[r]);
}
@@ -405,7 +405,7 @@ ProductionQueue.prototype.GetBatchTime = function(batchSize)
{
var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
- var batchTimeModifier = ApplyTechModificationsToEntity("ProductionQueue/BatchTimeModifier", +this.template.BatchTimeModifier, this.entity);
+ var batchTimeModifier = ApplyValueModificationsToEntity("ProductionQueue/BatchTimeModifier", +this.template.BatchTimeModifier, this.entity);
// TODO: work out what equation we should use here.
return Math.pow(batchSize, batchTimeModifier) * cmpPlayer.GetCheatTimeMultiplier();
diff --git a/binaries/data/mods/public/simulation/components/Promotion.js b/binaries/data/mods/public/simulation/components/Promotion.js
index 94d957d75f..cad7279b4b 100644
--- a/binaries/data/mods/public/simulation/components/Promotion.js
+++ b/binaries/data/mods/public/simulation/components/Promotion.js
@@ -15,7 +15,7 @@ Promotion.prototype.Init = function()
Promotion.prototype.GetRequiredXp = function()
{
- return ApplyTechModificationsToEntity("Promotion/RequiredXp", +this.template.RequiredXp, this.entity);
+ return ApplyValueModificationsToEntity("Promotion/RequiredXp", +this.template.RequiredXp, this.entity);
};
Promotion.prototype.GetCurrentXp = function()
diff --git a/binaries/data/mods/public/simulation/components/ResourceGatherer.js b/binaries/data/mods/public/simulation/components/ResourceGatherer.js
index 0b38f37c89..3ce078dc63 100644
--- a/binaries/data/mods/public/simulation/components/ResourceGatherer.js
+++ b/binaries/data/mods/public/simulation/components/ResourceGatherer.js
@@ -130,11 +130,11 @@ ResourceGatherer.prototype.GetGatherRates = function()
var ret = {};
var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
- var baseSpeed = ApplyTechModificationsToEntity("ResourceGatherer/BaseSpeed", +this.template.BaseSpeed, this.entity) * cmpPlayer.GetGatherRateMultiplier();
+ var baseSpeed = ApplyValueModificationsToEntity("ResourceGatherer/BaseSpeed", +this.template.BaseSpeed, this.entity) * cmpPlayer.GetGatherRateMultiplier();
for (var r in this.template.Rates)
{
- var rate = ApplyTechModificationsToEntity("ResourceGatherer/Rates/" + r, +this.template.Rates[r], this.entity);
+ var rate = ApplyValueModificationsToEntity("ResourceGatherer/Rates/" + r, +this.template.Rates[r], this.entity);
ret[r] = rate * baseSpeed;
}
@@ -147,7 +147,7 @@ ResourceGatherer.prototype.GetCapacities = function()
for (var r in this.template.Capacities)
{
- ret[r] = ApplyTechModificationsToEntity("ResourceGatherer/Capacities/" + r, +this.template.Capacities[r], this.entity);
+ ret[r] = ApplyValueModificationsToEntity("ResourceGatherer/Capacities/" + r, +this.template.Capacities[r], this.entity);
}
return ret;
diff --git a/binaries/data/mods/public/simulation/components/ResourceSupply.js b/binaries/data/mods/public/simulation/components/ResourceSupply.js
index e0686d162c..e55601850c 100644
--- a/binaries/data/mods/public/simulation/components/ResourceSupply.js
+++ b/binaries/data/mods/public/simulation/components/ResourceSupply.js
@@ -80,7 +80,7 @@ ResourceSupply.prototype.GetGatherers = function()
ResourceSupply.prototype.GetDiminishingReturns = function()
{
if ("DiminishingReturns" in this.template)
- return ApplyTechModificationsToEntity("ResourceSupply/DiminishingReturns", +this.template.DiminishingReturns, this.entity);
+ return ApplyValueModificationsToEntity("ResourceSupply/DiminishingReturns", +this.template.DiminishingReturns, this.entity);
return null;
};
diff --git a/binaries/data/mods/public/simulation/components/TechnologyManager.js b/binaries/data/mods/public/simulation/components/TechnologyManager.js
index 85f710858e..f3a822afc2 100644
--- a/binaries/data/mods/public/simulation/components/TechnologyManager.js
+++ b/binaries/data/mods/public/simulation/components/TechnologyManager.js
@@ -219,8 +219,6 @@ TechnologyManager.prototype.OnGlobalOwnershipChanged = function (msg)
// we want it to maintain whatever technologies previously applied)
if (msg.from == -1)
{
- var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
- var playerID = cmpPlayer.GetPlayerID();
var modifiedComponents = {};
for (var name in this.modifications)
{
@@ -234,7 +232,7 @@ TechnologyManager.prototype.OnGlobalOwnershipChanged = function (msg)
// Send mesage(s) to the entity so it knows about researched techs
for (var component in modifiedComponents)
- Engine.PostMessage(msg.entity, MT_TechnologyModification, { "component": component, "player": playerID });
+ Engine.PostMessage(msg.entity, MT_ValueModification, { "component": component });
}
}
if (msg.from == playerID)
@@ -331,15 +329,9 @@ TechnologyManager.prototype.ResearchTechnology = function (tech)
this.UpdateAutoResearch();
- var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
- var player = cmpPlayer.GetPlayerID();
// TODO: Handle technology broadcasting for autoresearch properly (some components might not be initialized currently)
- if (player === undefined)
- return;
-
- for (var component in modifiedComponents){
- Engine.BroadcastMessage(MT_TechnologyModification, { "component": component, "player": player });
- }
+ for (var component in modifiedComponents)
+ Engine.BroadcastMessage(MT_ValueModification, { "component": component });
};
// Clears the cached data for an entity from the modifications cache
diff --git a/binaries/data/mods/public/simulation/components/TerritoryDecay.js b/binaries/data/mods/public/simulation/components/TerritoryDecay.js
index e30afaf74e..6786421f74 100644
--- a/binaries/data/mods/public/simulation/components/TerritoryDecay.js
+++ b/binaries/data/mods/public/simulation/components/TerritoryDecay.js
@@ -72,7 +72,7 @@ TerritoryDecay.prototype.Decay = function()
if (!cmpHealth)
return; // error
- var decayRate = ApplyTechModificationsToEntity("TerritoryDecay/HealthDecayRate", +this.template.HealthDecayRate, this.entity);
+ var decayRate = ApplyValueModificationsToEntity("TerritoryDecay/HealthDecayRate", +this.template.HealthDecayRate, this.entity);
cmpHealth.Reduce(Math.round(decayRate));
};
diff --git a/binaries/data/mods/public/simulation/components/ValueModificationManager.js b/binaries/data/mods/public/simulation/components/ValueModificationManager.js
new file mode 100644
index 0000000000..bc4ab64cf3
--- /dev/null
+++ b/binaries/data/mods/public/simulation/components/ValueModificationManager.js
@@ -0,0 +1,16 @@
+function ValueModificationManager() {};
+
+/*
+ * A component to give the C++ defined components access to all value modifying components
+ * via the helper script.
+ */
+ValueModificationManager.prototype.Schema =
+ "";
+
+ValueModificationManager.prototype.ApplyModifications = function(valueName, currentValue, entity)
+{
+ return ApplyValueModificationsToEntity(valueName, currentValue, entity);
+};
+
+Engine.RegisterComponentType(IID_ValueModificationManager, "ValueModificationManager", ValueModificationManager);
+
diff --git a/binaries/data/mods/public/simulation/components/interfaces/TechnologyManager.js b/binaries/data/mods/public/simulation/components/interfaces/TechnologyManager.js
new file mode 100644
index 0000000000..7764e87726
--- /dev/null
+++ b/binaries/data/mods/public/simulation/components/interfaces/TechnologyManager.js
@@ -0,0 +1,2 @@
+Engine.RegisterInterface("TechnologyManager");
+
diff --git a/binaries/data/mods/public/simulation/helpers/TraderGain.js b/binaries/data/mods/public/simulation/helpers/TraderGain.js
index c748e36de1..975a87964f 100644
--- a/binaries/data/mods/public/simulation/helpers/TraderGain.js
+++ b/binaries/data/mods/public/simulation/helpers/TraderGain.js
@@ -36,10 +36,10 @@ function CalculateTraderGain(firstMarket, secondMarket, template, trader)
var ownerSecondMarket = Engine.QueryInterface(secondMarket, IID_Ownership).GetOwner();
if (ownerFirstMarket != ownerSecondMarket)
{
- var internationalGain1 = ApplyTechModificationsToEntity("Trade/International", INTERNATIONAL_TRADING_ADDITION, firstMarket);
+ var internationalGain1 = ApplyValueModificationsToEntity("Trade/International", INTERNATIONAL_TRADING_ADDITION, firstMarket);
gain.market1Gain = Math.round(gain.traderGain * internationalGain1 / 100);
gain.market1Owner = ownerFirstMarket;
- var internationalGain2 = ApplyTechModificationsToEntity("Trade/International", INTERNATIONAL_TRADING_ADDITION, secondMarket);
+ var internationalGain2 = ApplyValueModificationsToEntity("Trade/International", INTERNATIONAL_TRADING_ADDITION, secondMarket);
gain.market2Gain = Math.round(gain.traderGain * internationalGain2 / 100);
gain.market2Owner = ownerSecondMarket;
diff --git a/binaries/data/mods/public/simulation/helpers/Technology.js b/binaries/data/mods/public/simulation/helpers/ValueModification.js
similarity index 67%
rename from binaries/data/mods/public/simulation/helpers/Technology.js
rename to binaries/data/mods/public/simulation/helpers/ValueModification.js
index fdda94654c..cd0e130791 100644
--- a/binaries/data/mods/public/simulation/helpers/Technology.js
+++ b/binaries/data/mods/public/simulation/helpers/ValueModification.js
@@ -1,6 +1,6 @@
// Little helper functions to make applying tehnology more covenient
-function ApplyTechModificationsToEntity(tech_type, current_value, entity)
+function ApplyValueModificationsToEntity(tech_type, current_value, entity)
{
var cmpTechMan = QueryOwnerInterface(entity, IID_TechnologyManager);
if (cmpTechMan)
@@ -14,7 +14,7 @@ function ApplyTechModificationsToEntity(tech_type, current_value, entity)
return cmpAuraManager.ApplyModifications(tech_type, value, entity);
}
-function ApplyTechModificationsToPlayer(tech_type, current_value, player_entity)
+function ApplyValueModificationsToPlayer(tech_type, current_value, player_entity)
{
var cmpTechMan = Engine.QueryInterface(player_entity, IID_TechnologyManager);
@@ -24,7 +24,7 @@ function ApplyTechModificationsToPlayer(tech_type, current_value, player_entity)
return cmpTechMan.ApplyModifications(tech_type, current_value, player_entity);
}
-function ApplyTechModificationsToTemplate(tech_type, current_value, playerID, template)
+function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template)
{
var cmpTechMan = QueryPlayerIDInterface(playerID, IID_TechnologyManager);
if (cmpTechMan)
@@ -38,6 +38,6 @@ function ApplyTechModificationsToTemplate(tech_type, current_value, playerID, te
return cmpAuraManager.ApplyTemplateModifications(tech_type, value, playerID, template);
}
-Engine.RegisterGlobal("ApplyTechModificationsToEntity", ApplyTechModificationsToEntity);
-Engine.RegisterGlobal("ApplyTechModificationsToPlayer", ApplyTechModificationsToPlayer);
-Engine.RegisterGlobal("ApplyTechModificationsToTemplate", ApplyTechModificationsToTemplate);
+Engine.RegisterGlobal("ApplyValueModificationsToEntity", ApplyValueModificationsToEntity);
+Engine.RegisterGlobal("ApplyValueModificationsToPlayer", ApplyValueModificationsToPlayer);
+Engine.RegisterGlobal("ApplyValueModificationsToTemplate", ApplyValueModificationsToTemplate);
diff --git a/source/simulation2/MessageTypes.h b/source/simulation2/MessageTypes.h
index 33fb60e4c4..a097104336 100644
--- a/source/simulation2/MessageTypes.h
+++ b/source/simulation2/MessageTypes.h
@@ -366,20 +366,19 @@ public:
};
/**
- * Sent by technology manager when a technology is researched that modifies a component.
+ * Sent by value modification manager when a value of a certain component is changed
*/
-class CMessageTechnologyModification : public CMessage
+class CMessageValueModification : public CMessage
{
public:
- DEFAULT_MESSAGE_IMPL(TechnologyModification)
+ DEFAULT_MESSAGE_IMPL(ValueModification)
- CMessageTechnologyModification(std::wstring component, player_id_t player) :
- component(component), player(player)
+ CMessageValueModification(std::wstring component) :
+ component(component)
{
}
std::wstring component;
- player_id_t player;
};
/**
diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp
index d34c3d11b9..9295e89e51 100644
--- a/source/simulation2/Simulation2.cpp
+++ b/source/simulation2/Simulation2.cpp
@@ -125,14 +125,15 @@ public:
LOGERROR(L"Can't find component type " L##name); \
componentManager.AddComponent(systemEntity, cid, noParam)
- LOAD_SCRIPTED_COMPONENT("AuraManager");
LOAD_SCRIPTED_COMPONENT("AIInterface");
+ LOAD_SCRIPTED_COMPONENT("AuraManager");
LOAD_SCRIPTED_COMPONENT("Barter");
LOAD_SCRIPTED_COMPONENT("EndGameManager");
LOAD_SCRIPTED_COMPONENT("GuiInterface");
LOAD_SCRIPTED_COMPONENT("PlayerManager");
LOAD_SCRIPTED_COMPONENT("TechnologyTemplateManager");
LOAD_SCRIPTED_COMPONENT("Timer");
+ LOAD_SCRIPTED_COMPONENT("ValueModificationManager");
#undef LOAD_SCRIPTED_COMPONENT
diff --git a/source/simulation2/TypeList.h b/source/simulation2/TypeList.h
index 028134dab6..cde9784fe1 100644
--- a/source/simulation2/TypeList.h
+++ b/source/simulation2/TypeList.h
@@ -47,7 +47,7 @@ MESSAGE(RangeUpdate)
MESSAGE(TerrainChanged)
MESSAGE(TerritoriesChanged)
MESSAGE(PathResult)
-MESSAGE(TechnologyModification)
+MESSAGE(ValueModification)
MESSAGE(VisionRangeChanged)
MESSAGE(MinimapPing)
@@ -139,8 +139,8 @@ COMPONENT(SettlementScripted)
INTERFACE(SoundManager)
COMPONENT(SoundManager)
-INTERFACE(TechnologyManager)
-COMPONENT(TechnologyManagerScripted)
+INTERFACE(ValueModificationManager)
+COMPONENT(ValueModificationManagerScripted)
INTERFACE(TechnologyTemplateManager)
COMPONENT(TechnologyTemplateManagerScripted)
diff --git a/source/simulation2/components/CCmpTerritoryInfluence.cpp b/source/simulation2/components/CCmpTerritoryInfluence.cpp
index ca748ff90e..fdfde74017 100644
--- a/source/simulation2/components/CCmpTerritoryInfluence.cpp
+++ b/source/simulation2/components/CCmpTerritoryInfluence.cpp
@@ -22,7 +22,7 @@
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPlayerManager.h"
-#include "simulation2/components/ICmpTechnologyManager.h"
+#include "simulation2/components/ICmpValueModificationManager.h"
class CCmpTerritoryInfluence : public ICmpTerritoryInfluence
{
@@ -103,19 +103,8 @@ public:
{
u32 newRadius = m_Radius;
- CmpPtr cmpOwnership(GetEntityHandle());
- if (cmpOwnership && cmpOwnership->GetOwner() != INVALID_PLAYER)
- {
- CmpPtr cmpPlayerManager(GetSystemEntity());
- entity_id_t playerEnt = cmpPlayerManager->GetPlayerByID(cmpOwnership->GetOwner());
-
- if (playerEnt != INVALID_ENTITY)
- {
- CmpPtr cmpTechnologyManager(GetSimContext(), playerEnt);
- if (cmpTechnologyManager)
- newRadius = cmpTechnologyManager->ApplyModifications(L"TerritoryInfluence/Radius", m_Radius, GetEntityId());
- }
- }
+ CmpPtr cmpValueModificationManager(GetSystemEntity());
+ newRadius = cmpValueModificationManager->ApplyModifications(L"TerritoryInfluence/Radius", m_Radius, GetEntityId());
return newRadius;
}
diff --git a/source/simulation2/components/CCmpTerritoryManager.cpp b/source/simulation2/components/CCmpTerritoryManager.cpp
index a144c57fda..577c4d5dfd 100644
--- a/source/simulation2/components/CCmpTerritoryManager.cpp
+++ b/source/simulation2/components/CCmpTerritoryManager.cpp
@@ -66,7 +66,7 @@ public:
{
componentManager.SubscribeGloballyToMessageType(MT_OwnershipChanged);
componentManager.SubscribeGloballyToMessageType(MT_PositionChanged);
- componentManager.SubscribeGloballyToMessageType(MT_TechnologyModification);
+ componentManager.SubscribeGloballyToMessageType(MT_ValueModification);
componentManager.SubscribeToMessageType(MT_TerrainChanged);
componentManager.SubscribeToMessageType(MT_Update);
componentManager.SubscribeToMessageType(MT_Interpolate);
@@ -165,9 +165,9 @@ public:
MakeDirtyIfRelevantEntity(msgData.entity);
break;
}
- case MT_TechnologyModification:
+ case MT_ValueModification:
{
- const CMessageTechnologyModification& msgData = static_cast (msg);
+ const CMessageValueModification& msgData = static_cast (msg);
if (msgData.component == L"TerritoryInfluence")
MakeDirty();
break;
diff --git a/source/simulation2/components/CCmpVision.cpp b/source/simulation2/components/CCmpVision.cpp
index facd023cbf..eaf61ffcfa 100644
--- a/source/simulation2/components/CCmpVision.cpp
+++ b/source/simulation2/components/CCmpVision.cpp
@@ -23,14 +23,14 @@
#include "simulation2/MessageTypes.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPlayerManager.h"
-#include "simulation2/components/ICmpTechnologyManager.h"
+#include "simulation2/components/ICmpValueModificationManager.h"
class CCmpVision : public ICmpVision
{
public:
static void ClassInit(CComponentManager& componentManager)
{
- componentManager.SubscribeGloballyToMessageType(MT_TechnologyModification);
+ componentManager.SubscribeGloballyToMessageType(MT_ValueModification);
}
DEFAULT_COMPONENT_ALLOCATOR(Vision)
@@ -80,33 +80,20 @@ public:
{
switch (msg.GetType())
{
- case MT_TechnologyModification:
+ case MT_ValueModification:
{
- const CMessageTechnologyModification& msgData = static_cast (msg);
+ const CMessageValueModification& msgData = static_cast (msg);
if (msgData.component == L"Vision")
{
- CmpPtr cmpOwnership(GetEntityHandle());
- if (cmpOwnership)
+ CmpPtr cmpValueModificationManager(GetSystemEntity());
+ entity_pos_t newRange = cmpValueModificationManager->ApplyModifications(L"Vision/Range", m_BaseRange, GetEntityId());
+ if (newRange != m_Range)
{
- player_id_t owner = cmpOwnership->GetOwner();
- if (owner != INVALID_PLAYER && owner == msgData.player)
- {
- CmpPtr cmpPlayerManager(GetSystemEntity());
- entity_id_t playerEnt = cmpPlayerManager->GetPlayerByID(owner);
- CmpPtr cmpTechnologyManager(GetSimContext(), playerEnt);
- if (playerEnt != INVALID_ENTITY && cmpTechnologyManager)
- {
- entity_pos_t newRange = cmpTechnologyManager->ApplyModifications(L"Vision/Range", m_BaseRange, GetEntityId());
- if (newRange != m_Range)
- {
- // Update our vision range and broadcast message
- entity_pos_t oldRange = m_Range;
- m_Range = newRange;
- CMessageVisionRangeChanged msg(GetEntityId(), oldRange, newRange);
- GetSimContext().GetComponentManager().BroadcastMessage(msg);
- }
- }
- }
+ // Update our vision range and broadcast message
+ entity_pos_t oldRange = m_Range;
+ m_Range = newRange;
+ CMessageVisionRangeChanged msg(GetEntityId(), oldRange, newRange);
+ GetSimContext().GetComponentManager().BroadcastMessage(msg);
}
}
break;
diff --git a/source/simulation2/components/ICmpTechnologyManager.cpp b/source/simulation2/components/ICmpValueModificationManager.cpp
similarity index 77%
rename from source/simulation2/components/ICmpTechnologyManager.cpp
rename to source/simulation2/components/ICmpValueModificationManager.cpp
index 5ad8b10c90..0e1d3e4502 100644
--- a/source/simulation2/components/ICmpTechnologyManager.cpp
+++ b/source/simulation2/components/ICmpValueModificationManager.cpp
@@ -17,18 +17,18 @@
#include "precompiled.h"
-#include "ICmpTechnologyManager.h"
+#include "ICmpValueModificationManager.h"
#include "simulation2/system/InterfaceScripted.h"
#include "simulation2/scripting/ScriptComponent.h"
-BEGIN_INTERFACE_WRAPPER(TechnologyManager)
-END_INTERFACE_WRAPPER(TechnologyManager)
+BEGIN_INTERFACE_WRAPPER(ValueModificationManager)
+END_INTERFACE_WRAPPER(ValueModificationManager)
-class CCmpTechnologyManagerScripted : public ICmpTechnologyManager
+class CCmpValueModificationManagerScripted : public ICmpValueModificationManager
{
public:
- DEFAULT_SCRIPT_WRAPPER(TechnologyManagerScripted)
+ DEFAULT_SCRIPT_WRAPPER(ValueModificationManagerScripted)
virtual fixed ApplyModifications(std::wstring valueName, fixed currentValue, entity_id_t entity)
{
@@ -41,4 +41,4 @@ public:
}
};
-REGISTER_COMPONENT_SCRIPT_WRAPPER(TechnologyManagerScripted)
+REGISTER_COMPONENT_SCRIPT_WRAPPER(ValueModificationManagerScripted)
diff --git a/source/simulation2/components/ICmpTechnologyManager.h b/source/simulation2/components/ICmpValueModificationManager.h
similarity index 75%
rename from source/simulation2/components/ICmpTechnologyManager.h
rename to source/simulation2/components/ICmpValueModificationManager.h
index 303c0ff891..d72db17917 100644
--- a/source/simulation2/components/ICmpTechnologyManager.h
+++ b/source/simulation2/components/ICmpValueModificationManager.h
@@ -15,25 +15,25 @@
* along with 0 A.D. If not, see .
*/
-#ifndef INCLUDED_ICMPTECHNOLOGYMANAGER
-#define INCLUDED_ICMPTECHNOLOGYMANAGER
+#ifndef INCLUDED_ICMPVALUEMODIFICATIONMANAGER
+#define INCLUDED_ICMPVALUEMODIFICATIONMANAGER
#include "simulation2/system/Interface.h"
#include "maths/Fixed.h"
/**
- * Technology manager interface.
+ * value modification manager interface.
* (This interface only includes the functions needed by native code for accessing
- * technology modification data, the associated logic is handled in scripts)
+ * value modification data, the associated logic is handled in scripts)
*/
-class ICmpTechnologyManager : public IComponent
+class ICmpValueModificationManager : public IComponent
{
public:
virtual fixed ApplyModifications(std::wstring valueName, fixed currentValue, entity_id_t entity) = 0;
virtual u32 ApplyModifications(std::wstring valueName, u32 currentValue, entity_id_t entity) = 0;
- DECLARE_INTERFACE_TYPE(TechnologyManager)
+ DECLARE_INTERFACE_TYPE(ValueModificationManager)
};
-#endif // INCLUDED_ICMPTECHNOLOGYMANAGER
+#endif // INCLUDED_ICMPVALUEMODIFICATIONMANAGER
diff --git a/source/simulation2/scripting/MessageTypeConversions.cpp b/source/simulation2/scripting/MessageTypeConversions.cpp
index 190555c7a7..781dec975c 100644
--- a/source/simulation2/scripting/MessageTypeConversions.cpp
+++ b/source/simulation2/scripting/MessageTypeConversions.cpp
@@ -300,20 +300,18 @@ CMessage* CMessagePathResult::FromJSVal(ScriptInterface& UNUSED(scriptInterface)
////////////////////////////////
-jsval CMessageTechnologyModification::ToJSVal(ScriptInterface& scriptInterface) const
+jsval CMessageValueModification::ToJSVal(ScriptInterface& scriptInterface) const
{
TOJSVAL_SETUP();
SET_MSG_PROPERTY(component);
- SET_MSG_PROPERTY(player);
return OBJECT_TO_JSVAL(obj);
}
-CMessage* CMessageTechnologyModification::FromJSVal(ScriptInterface& scriptInterface, jsval val)
+CMessage* CMessageValueModification::FromJSVal(ScriptInterface& scriptInterface, jsval val)
{
FROMJSVAL_SETUP();
GET_MSG_PROPERTY(std::wstring, component);
- GET_MSG_PROPERTY(player_id_t, player);
- return new CMessageTechnologyModification(component, player);
+ return new CMessageValueModification(component);
}
////////////////////////////////