Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -164,7 +164,8 @@ 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.toggleaurarange = "Alt+V" ; Toggle rendering of aura range overlays of selected units and 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 @@ -338,7 +339,8 @@ 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) -aurarange = true +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: 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 @@ -109,6 +109,7 @@ Alt + S: Toggle unit silhouettes (might give a small performance boost) Alt + Z: Toggle sky 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: 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 @@ -115,6 +115,18 @@ "label": "Chat Timestamp", "tooltip": "Show time that messages are posted in the lobby, gamesetup and ingame chat.", "parameters": { "config": "chat.timestamp" } + }, + { + "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).", + "parameters": { "config": "gui.session.aurarange" } + }, + { + "type": "boolean", + "label": "Heal Range Visualization", + "tooltip": "Display the healing range of selected units (can also be toggled in-game with the hotkey).", + "parameters": { "config": "gui.session.healrange" } } ], "graphicsSetting": @@ -228,12 +240,6 @@ "label": "FPS throttling in games", "tooltip": "To save CPU workload, throttle render frequency in running games. Set to maximum to disable throttling.", "parameters": { "config": "adaptivefps.session", "min": 20, "max": 100 } - }, - { - "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).", - "parameters": { "config": "gui.session.aurarange" } } ], "soundSetting": 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 @@ -96,6 +96,10 @@ toggleRangeOverlay("Aura"); + + toggleRangeOverlay("Heal"); + + g_ShowAllStatusBars = !g_ShowAllStatusBars; 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 @@ -804,10 +804,11 @@ handleNotifications(); updateGUIObjects(); - Engine.GuiInterfaceCall("EnableVisualRangeOverlayType", { - "type": "Aura", - "enabled": Engine.ConfigDB_GetValue("user", "gui.session.aurarange") == "true" - }); + for (let type of ["Aura", "Heal"]) + Engine.GuiInterfaceCall("EnableVisualRangeOverlayType", { + "type": type, + "enabled": Engine.ConfigDB_GetValue("user", "gui.session." + type.toLowerCase() + "range") == "true" + }); if (g_ConfirmExit) confirmExit(); @@ -1272,7 +1273,7 @@ * Toggles the display of range overlays of selected entities for the given range type. * @param {string} type - for example "Aura" */ -function toggleRangeOverlay(type, currentValue) +function toggleRangeOverlay(type) { let configString = "gui.session." + type.toLowerCase() + "range"; let enabled = Engine.ConfigDB_GetValue("user", configString) != "true"; Index: ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js +++ ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -893,7 +893,7 @@ if (!cmpRangeVisualization || player != owner && player != -1) continue; - cmpRangeVisualization.SetEnabled(cmd.selected, this.enabledVisualRangeOverlayTypes); + cmpRangeVisualization.SetEnabled(cmd.selected, this.enabledVisualRangeOverlayTypes, false); } }; @@ -948,7 +948,7 @@ { let cmpRangeVisualization = Engine.QueryInterface(ent, IID_RangeVisualization); if (cmpRangeVisualization) - cmpRangeVisualization.SetEnabled(cmd.enabled, this.enabledVisualRangeOverlayTypes); + cmpRangeVisualization.SetEnabled(cmd.enabled, this.enabledVisualRangeOverlayTypes, true); } }; Index: ps/trunk/binaries/data/mods/public/simulation/components/Heal.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Heal.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Heal.js @@ -4,6 +4,11 @@ "Controls the healing abilities of the unit." + "" + "20" + + "" + + "outline_border.png" + + "outline_border_mask.png" + + "0.2" + + "" + "5" + "2000" + "Cavalry" + @@ -12,6 +17,15 @@ "" + "" + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + "" + "" + "" + @@ -73,6 +87,21 @@ return this.template.HealableClasses._string || ""; }; +Heal.prototype.GetLineTexture = function() +{ + return this.template.RangeOverlay ? this.template.RangeOverlay.LineTexture : "outline_border.png"; +}; + +Heal.prototype.GetLineTextureMask = function() +{ + return this.template.RangeOverlay ? this.template.RangeOverlay.LineTextureMask : "outline_border_mask.png"; +}; + +Heal.prototype.GetLineThickness = function() +{ + return this.template.RangeOverlay ? +this.template.RangeOverlay.LineThickness : 0.15; +}; + /** * Heal the target entity. This should only be called after a successful range * check, and should only be called after GetTimers().repeat msec has passed 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,12 +6,13 @@ { this.enabled = false; this.enabledRangeTypes = { - "Aura": false + "Aura": false, + "Heal": false }; this.rangeVisualizations = new Map(); for (let type in this.enabledRangeTypes) - this["GetVisual" + type + "Ranges"](type); + this["UpdateVisual" + type + "Ranges"](); }; // The GUI enables visualizations @@ -22,16 +23,16 @@ this.Init(); }; -RangeVisualization.prototype.GetVisualAuraRanges = function(type) +RangeVisualization.prototype.UpdateVisualAuraRanges = function() { let cmpAuras = Engine.QueryInterface(this.entity, IID_Auras); if (!cmpAuras) return; - this.rangeVisualizations.set(type, []); + this.rangeVisualizations.set("Aura", []); for (let auraName of cmpAuras.GetVisualAuraRangeNames()) - this.rangeVisualizations.get(type).push({ + this.rangeVisualizations.get("Aura").push({ "radius": cmpAuras.GetRange(auraName), "texture": cmpAuras.GetLineTexture(auraName), "textureMask": cmpAuras.GetLineTextureMask(auraName), @@ -39,15 +40,29 @@ }); }; -RangeVisualization.prototype.SetEnabled = function(enabled, enabledRangeTypes) +RangeVisualization.prototype.UpdateVisualHealRanges = function() +{ + let cmpHeal = Engine.QueryInterface(this.entity, IID_Heal); + if (!cmpHeal) + return; + + this.rangeVisualizations.set("Heal", [{ + "radius": cmpHeal.GetRange().max, + "texture": cmpHeal.GetLineTexture(), + "textureMask": cmpHeal.GetLineTextureMask(), + "thickness": cmpHeal.GetLineThickness(), + }]); +}; + +RangeVisualization.prototype.SetEnabled = function(enabled, enabledRangeTypes, forceUpdate) { this.enabled = enabled; this.enabledRangeTypes = enabledRangeTypes; - this.RegenerateRangeVisualizations(); + this.RegenerateRangeVisualizations(forceUpdate); }; -RangeVisualization.prototype.RegenerateRangeVisualizations = function() +RangeVisualization.prototype.RegenerateRangeVisualizations = function(forceUpdate) { let cmpSelectable = Engine.QueryInterface(this.entity, IID_Selectable); if (!cmpSelectable) @@ -55,7 +70,7 @@ cmpSelectable.ResetRangeOverlays(); - if (!this.enabled) + if (!this.enabled && !forceUpdate) return; // Only render individual range types that have been enabled @@ -72,7 +87,16 @@ RangeVisualization.prototype.OnOwnershipChanged = function(msg) { if (this.enabled && msg.to != -1) - this.RegenerateRangeVisualizations(); + this.RegenerateRangeVisualizations(false); +}; + +RangeVisualization.prototype.OnValueModification = function(msg) +{ + if (msg.valueNames.indexOf("Heal/Range") == -1) + return; + + this["UpdateVisual" + msg.component + "Ranges"](); + this.RegenerateRangeVisualizations(false); }; Engine.RegisterComponentType(IID_RangeVisualization, "RangeVisualization", RangeVisualization);