Index: binaries/data/config/default.cfg
===================================================================
--- binaries/data/config/default.cfg (revision 20598)
+++ binaries/data/config/default.cfg (working copy)
@@ -165,10 +165,11 @@ realtime.toggle = "Alt+T" ;
session.devcommands.toggle = "Alt+D" ; Toggle developer commands panel
timeelapsedcounter.toggle = "F12" ; Toggle time elapsed counter
session.showstatusbars = Tab ; Toggle display of status bars
session.highlightguarding = PgDn ; Toggle highlight of guarding units
session.highlightguarded = PgUp ; Toggle highlight of guarded units
+session.toggleattackrange = "Alt+C" ; Toggle display of attack range overlays of selected defensive structures
session.toggleaurarange = "Alt+V" ; Toggle display of aura range overlays of selected units and structures
session.togglehealrange = "Alt+B" ; Toggle display of heal range overlays of selected units
; > HOTKEYS ONLY
chat = Return ; Toggle chat window
@@ -344,10 +345,11 @@ aidifficulty = 3 ; Diff
[gui.session]
camerajump.threshold = 40 ; How close do we have to be to the actual location in order to jump back to the previous one?
timeelapsedcounter = false ; Show the game duration in the top right corner
batchtrainingsize = 5 ; Number of units to be trained per batch (when pressing the hotkey)
+attackrange = true ; Display attack range overlays of selected defensive structures
aurarange = true ; Display aura range overlays of selected units and structures
healrange = true ; Display heal range overlays of selected units
[gui.session.minimap]
blinkduration = 1.7 ; The blink duration while pinging
Index: binaries/data/mods/public/gui/manual/intro.txt
===================================================================
--- binaries/data/mods/public/gui/manual/intro.txt (revision 20602)
+++ binaries/data/mods/public/gui/manual/intro.txt (working copy)
@@ -110,10 +110,11 @@ Ctrl + Right Click with units selected:
[font="sans-14"]Alt + G: Hide/show the GUI
Alt + D: Show/hide developer overlay (with developer options)
Alt + W: Toggle wireframe mode (press once to get wireframes overlaid over the textured models, twice to get just the wireframes colored by the textures, thrice to get back to normal textured mode)
Alt + S: Toggle unit silhouettes (might give a small performance boost)
Alt + Z: Toggle sky
+Alt + C: Toggle attack range visualizations of selected defensive structures
Alt + V: Toggle aura range visualizations of selected units and structures
Alt + B: Toggle heal range visualizations of selected units
[font="sans-bold-14"]Camera manipulation
[font="sans-14"]W or \[up]: Pan screen up
Index: binaries/data/mods/public/gui/options/options.json
===================================================================
--- binaries/data/mods/public/gui/options/options.json (revision 20602)
+++ binaries/data/mods/public/gui/options/options.json (working copy)
@@ -102,10 +102,16 @@
"tooltip": "Show time that messages are posted in the lobby, gamesetup and ingame chat.",
"config": "chat.timestamp"
},
{
"type": "boolean",
+ "label": "Attack Range Visualization",
+ "tooltip": "Display the attack range of selected defensive structures (can also be toggled in-game with the hotkey).",
+ "parameters": { "config": "gui.session.attackrange" }
+ },
+ {
+ "type": "boolean",
"label": "Aura Range Visualization",
"tooltip": "Display the range of auras of selected units and structures (can also be toggled in-game with the hotkey).",
"config": "gui.session.aurarange"
},
{
Index: binaries/data/mods/public/gui/session/hotkeys/misc.xml
===================================================================
--- binaries/data/mods/public/gui/session/hotkeys/misc.xml (revision 20602)
+++ binaries/data/mods/public/gui/session/hotkeys/misc.xml (working copy)
@@ -95,10 +95,14 @@
+
+
-
Index: binaries/data/mods/public/gui/session/session.js
===================================================================
--- binaries/data/mods/public/gui/session/session.js (revision 20602)
+++ binaries/data/mods/public/gui/session/session.js (working copy)
@@ -796,11 +796,11 @@ function onSimulationUpdate()
updateCinemaPath();
handleNotifications();
updateGUIObjects();
- for (let type of ["Aura", "Heal"])
+ for (let type of ["Attack", "Aura", "Heal"])
Engine.GuiInterfaceCall("EnableVisualRangeOverlayType", {
"type": type,
"enabled": Engine.ConfigDB_GetValue("user", "gui.session." + type.toLowerCase() + "range") == "true"
});
Index: binaries/data/mods/public/simulation/components/Attack.js
===================================================================
--- binaries/data/mods/public/simulation/components/Attack.js (revision 20598)
+++ binaries/data/mods/public/simulation/components/Attack.js (working copy)
@@ -122,10 +122,22 @@ Attack.prototype.Schema =
"" +
"" +
""+
"" +
"" +
+ ""+
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
"" +
"" +
"" +
"" +
"" +
@@ -606,6 +618,26 @@ Attack.prototype.OnValueModification = f
if (this.GetAttackTypes().some(type =>
msg.valueNames.indexOf("Attack/" + type + "/MaxRange") != -1))
cmpUnitAI.UpdateRangeQueries();
};
+Attack.prototype.ShowRangeOverlay = function()
+{
+ return this.template.Ranged && !!this.template.Ranged.ShowRangeOverlay;
+};
+
+Attack.prototype.GetLineTexture = function()
+{
+ return this.template.Ranged.RangeOverlay ? this.template.Ranged.RangeOverlay.LineTexture : "outline_border.png";
+};
+
+Attack.prototype.GetLineTextureMask = function()
+{
+ return this.template.Ranged.RangeOverlay ? this.template.Ranged.RangeOverlay.LineTextureMask : "outline_border_mask.png";
+};
+
+Attack.prototype.GetLineThickness = function()
+{
+ return this.template.Ranged.RangeOverlay ? +this.template.Ranged.RangeOverlay.LineThickness : 0.175;
+};
+
Engine.RegisterComponentType(IID_Attack, "Attack", Attack);
Index: binaries/data/mods/public/simulation/components/RangeVisualization.js
===================================================================
--- binaries/data/mods/public/simulation/components/RangeVisualization.js (revision 20598)
+++ binaries/data/mods/public/simulation/components/RangeVisualization.js (working copy)
@@ -4,10 +4,11 @@ RangeVisualization.prototype.Schema = "<
RangeVisualization.prototype.Init = function()
{
this.enabled = false;
this.enabledRangeTypes = {
+ "Attack": false,
"Aura": false,
"Heal": false
};
this.rangeVisualizations = new Map();
@@ -19,10 +20,25 @@ RangeVisualization.prototype.Serialize =
RangeVisualization.prototype.Deserialize = function(data)
{
this.Init();
};
+RangeVisualization.prototype.UpdateVisualAttackRanges = function()
+{
+ let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
+ if (!cmpAttack || cmpAttack.GetAttackTypes().indexOf("Ranged") == -1 || !cmpAttack.ShowRangeOverlay())
+ return;
+
+ let range = cmpAttack.GetRange("Ranged");
+ this.rangeVisualizations.set("Attack", ["min", "max"].filter(m => range[m]).map(m => ({
+ "radius": range[m],
+ "texture": cmpAttack.GetLineTexture(),
+ "textureMask": cmpAttack.GetLineTextureMask(),
+ "thickness": cmpAttack.GetLineThickness(),
+ })));
+};
+
RangeVisualization.prototype.UpdateVisualAuraRanges = function()
{
let cmpAuras = Engine.QueryInterface(this.entity, IID_Auras);
if (!cmpAuras)
return;
@@ -91,11 +107,13 @@ RangeVisualization.prototype.OnOwnership
this.RegenerateRangeVisualizations(false);
};
RangeVisualization.prototype.OnValueModification = function(msg)
{
- if (msg.valueNames.indexOf("Heal/Range") == -1)
+ if (msg.valueNames.indexOf("Heal/Range") == -1 &&
+ msg.valueNames.indexOf("Attack/MinRange") == -1 &&
+ msg.valueNames.indexOf("Attack/MaxRange") == -1)
return;
this["UpdateVisual" + msg.component + "Ranges"]();
this.RegenerateRangeVisualizations(false);
};
Index: binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml (working copy)
@@ -21,10 +21,11 @@
9.81
1200
2000
1.5
0
+ true
1
15
Index: binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml (working copy)
@@ -25,10 +25,11 @@
1200
2000
1.5
0
Human
+ true
3
1
Index: binaries/data/mods/public/simulation/templates/template_structure_defense_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_defense_tower.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_defense_tower.xml (working copy)
@@ -10,10 +10,11 @@
1200
2000
1.5
0
Human
+ true
1
1
Index: binaries/data/mods/public/simulation/templates/template_structure_defense_tower_outpost.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_defense_tower_outpost.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_defense_tower_outpost.xml (working copy)
@@ -14,10 +14,11 @@
16
55
13
0
+ true
0
Index: binaries/data/mods/public/simulation/templates/template_structure_defense_tower_sentry.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_defense_tower_sentry.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_defense_tower_sentry.xml (working copy)
@@ -9,10 +9,11 @@
9
70
0
9
+ true
800
Index: binaries/data/mods/public/simulation/templates/template_structure_defense_tower_stone.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_defense_tower_stone.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_defense_tower_stone.xml (working copy)
@@ -4,10 +4,11 @@
12
76
10
15
+ true
150
Index: binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml (working copy)
@@ -12,10 +12,11 @@
1200
2000
1.5
0
Human
+ true
0
1
Index: binaries/data/mods/public/simulation/templates/template_structure_military_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_military_fortress.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_structure_military_fortress.xml (working copy)
@@ -17,10 +17,11 @@
1200
2000
1.5
0
Human
+ true
3
1
Index: binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml (revision 20598)
+++ binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml (working copy)
@@ -5,10 +5,11 @@
0.0
12.0
2.5
55.0
0.0
+ true
10
75.0
9.81
1200
2000