Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -167,6 +167,7 @@ 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 @@ -346,6 +347,7 @@ 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 Index: ps/trunk/binaries/data/mods/public/gui/manual/intro.txt =================================================================== --- ps/trunk/binaries/data/mods/public/gui/manual/intro.txt +++ ps/trunk/binaries/data/mods/public/gui/manual/intro.txt @@ -112,6 +112,7 @@ 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 Index: ps/trunk/binaries/data/mods/public/gui/options/options.json =================================================================== --- ps/trunk/binaries/data/mods/public/gui/options/options.json +++ ps/trunk/binaries/data/mods/public/gui/options/options.json @@ -104,6 +104,12 @@ }, { "type": "boolean", + "label": "Attack Range Visualization", + "tooltip": "Display the attack range of selected defensive structures (can also be toggled in-game with the hotkey).", + "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: ps/trunk/binaries/data/mods/public/gui/session/hotkeys/misc.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/hotkeys/misc.xml +++ ps/trunk/binaries/data/mods/public/gui/session/hotkeys/misc.xml @@ -97,6 +97,10 @@ clearSelection(); + + toggleRangeOverlay("Attack"); + + toggleRangeOverlay("Aura"); @@ -111,5 +115,4 @@ recalculateStatusBarDisplay(); - Index: ps/trunk/binaries/data/mods/public/gui/session/session.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/session.js +++ ps/trunk/binaries/data/mods/public/gui/session/session.js @@ -798,7 +798,7 @@ 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: ps/trunk/binaries/data/mods/public/simulation/components/Attack.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Attack.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Attack.js @@ -124,6 +124,15 @@ ""+ "" + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + "" + "" + "" + @@ -608,4 +617,22 @@ cmpUnitAI.UpdateRangeQueries(); }; +Attack.prototype.GetRangeOverlays = function() +{ + if (!this.template.Ranged || !this.template.Ranged.RangeOverlay) + return []; + + let range = this.GetRange("Ranged"); + let rangeOverlays = []; + for (let i in range) + if ((i == "min" || i == "max") && range[i]) + rangeOverlays.push({ + "radius": range[i], + "texture": this.template.Ranged.RangeOverlay.LineTexture, + "textureMask": this.template.Ranged.RangeOverlay.LineTextureMask, + "thickness": +this.template.Ranged.RangeOverlay.LineThickness, + }); + return rangeOverlays; +}; + Engine.RegisterComponentType(IID_Attack, "Attack", Attack); Index: ps/trunk/binaries/data/mods/public/simulation/components/RangeVisualization.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/RangeVisualization.js +++ ps/trunk/binaries/data/mods/public/simulation/components/RangeVisualization.js @@ -6,6 +6,7 @@ { this.enabled = false; this.enabledRangeTypes = { + "Attack": false, "Aura": false, "Heal": false }; @@ -21,6 +22,13 @@ this.Init(); }; +RangeVisualization.prototype.UpdateVisualAttackRanges = function() +{ + let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); + if (cmpAttack) + this.rangeVisualizations.set("Attack", cmpAttack.GetRangeOverlays()); +}; + RangeVisualization.prototype.UpdateVisualAuraRanges = function() { let cmpAuras = Engine.QueryInterface(this.entity, IID_Auras); @@ -93,7 +101,9 @@ RangeVisualization.prototype.OnValueModification = function(msg) { - if (msg.valueNames.indexOf("Heal/Range") == -1) + if (msg.valueNames.indexOf("Heal/Range") == -1 && + msg.valueNames.indexOf("Attack/Ranged/MinRange") == -1 && + msg.valueNames.indexOf("Attack/Ranged/MaxRange") == -1) return; this["UpdateVisual" + msg.component + "Ranges"](); Index: ps/trunk/binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml @@ -23,6 +23,11 @@ 2000 1.5 0 + + outline_border.png + outline_border_mask.png + 0.175 + Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml @@ -27,6 +27,11 @@ 1.5 0 Human + + outline_border.png + outline_border_mask.png + 0.175 + Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_tower.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_tower.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_tower.xml @@ -12,6 +12,11 @@ 1.5 0 Human + + outline_border.png + outline_border_mask.png + 0.175 + Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml @@ -14,6 +14,11 @@ 1.5 0 Human + + outline_border.png + outline_border_mask.png + 0.175 + Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_military_fortress.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_military_fortress.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_military_fortress.xml @@ -19,6 +19,11 @@ 1.5 0 Human + + outline_border.png + outline_border_mask.png + 0.175 + Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml @@ -15,6 +15,11 @@ 2.0 0 Human + + outline_border.png + outline_border_mask.png + 0.175 +