mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 11:23:59 +00:00
Attack Range Visualization.
Fixes #3915 Differential Revision: https://code.wildfiregames.com/D568 Based on patch by: Sandarac This was SVN commit r20608.
This commit is contained in:
@@ -167,6 +167,7 @@ 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
|
||||
|
||||
@@ -346,6 +347,7 @@ aidifficulty = 3 ; Difficulty level, from 0 (easiest) to 5 (har
|
||||
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
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ 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
|
||||
|
||||
|
||||
@@ -102,6 +102,12 @@
|
||||
"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).",
|
||||
"config": "gui.session.attackrange"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"label": "Aura Range Visualization",
|
||||
|
||||
@@ -97,6 +97,10 @@
|
||||
<action on="Press">clearSelection();</action>
|
||||
</object>
|
||||
|
||||
<object hotkey="session.toggleattackrange">
|
||||
<action on="Press">toggleRangeOverlay("Attack");</action>
|
||||
</object>
|
||||
|
||||
<object hotkey="session.toggleaurarange">
|
||||
<action on="Press">toggleRangeOverlay("Aura");</action>
|
||||
</object>
|
||||
@@ -111,5 +115,4 @@
|
||||
recalculateStatusBarDisplay();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
@@ -798,7 +798,7 @@ function onSimulationUpdate()
|
||||
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"
|
||||
|
||||
@@ -124,6 +124,15 @@ Attack.prototype.Schema =
|
||||
"<optional>"+
|
||||
"<element name='ElevationBonus' a:help='give an elevation advantage (in meters)'><ref name='nonNegativeDecimal'/></element>" +
|
||||
"</optional>" +
|
||||
"<optional>" +
|
||||
"<element name='RangeOverlay'>" +
|
||||
"<interleave>" +
|
||||
"<element name='LineTexture'><text/></element>" +
|
||||
"<element name='LineTextureMask'><text/></element>" +
|
||||
"<element name='LineThickness'><ref name='nonNegativeDecimal'/></element>" +
|
||||
"</interleave>" +
|
||||
"</element>" +
|
||||
"</optional>" +
|
||||
"<element name='PrepareTime' a:help='Time from the start of the attack command until the attack actually occurs (in milliseconds). This value relative to RepeatTime should closely match the \"event\" point in the actor's attack animation'>" +
|
||||
"<data type='nonNegativeInteger'/>" +
|
||||
"</element>" +
|
||||
@@ -608,4 +617,22 @@ Attack.prototype.OnValueModification = function(msg)
|
||||
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);
|
||||
|
||||
@@ -6,6 +6,7 @@ RangeVisualization.prototype.Init = function()
|
||||
{
|
||||
this.enabled = false;
|
||||
this.enabledRangeTypes = {
|
||||
"Attack": false,
|
||||
"Aura": false,
|
||||
"Heal": false
|
||||
};
|
||||
@@ -21,6 +22,13 @@ RangeVisualization.prototype.Deserialize = function(data)
|
||||
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.OnOwnershipChanged = function(msg)
|
||||
|
||||
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"]();
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
<RepeatTime>2000</RepeatTime>
|
||||
<Spread>1.5</Spread>
|
||||
<Delay>0</Delay>
|
||||
<RangeOverlay>
|
||||
<LineTexture>outline_border.png</LineTexture>
|
||||
<LineTextureMask>outline_border_mask.png</LineTextureMask>
|
||||
<LineThickness>0.175</LineThickness>
|
||||
</RangeOverlay>
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
|
||||
+5
@@ -27,6 +27,11 @@
|
||||
<Spread>1.5</Spread>
|
||||
<Delay>0</Delay>
|
||||
<PreferredClasses datatype="tokens">Human</PreferredClasses>
|
||||
<RangeOverlay>
|
||||
<LineTexture>outline_border.png</LineTexture>
|
||||
<LineTextureMask>outline_border_mask.png</LineTextureMask>
|
||||
<LineThickness>0.175</LineThickness>
|
||||
</RangeOverlay>
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
<Spread>1.5</Spread>
|
||||
<Delay>0</Delay>
|
||||
<PreferredClasses datatype="tokens">Human</PreferredClasses>
|
||||
<RangeOverlay>
|
||||
<LineTexture>outline_border.png</LineTexture>
|
||||
<LineTextureMask>outline_border_mask.png</LineTextureMask>
|
||||
<LineThickness>0.175</LineThickness>
|
||||
</RangeOverlay>
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
|
||||
+5
@@ -14,6 +14,11 @@
|
||||
<Spread>1.5</Spread>
|
||||
<Delay>0</Delay>
|
||||
<PreferredClasses datatype="tokens">Human</PreferredClasses>
|
||||
<RangeOverlay>
|
||||
<LineTexture>outline_border.png</LineTexture>
|
||||
<LineTextureMask>outline_border_mask.png</LineTextureMask>
|
||||
<LineThickness>0.175</LineThickness>
|
||||
</RangeOverlay>
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
|
||||
+5
@@ -19,6 +19,11 @@
|
||||
<Spread>1.5</Spread>
|
||||
<Delay>0</Delay>
|
||||
<PreferredClasses datatype="tokens">Human</PreferredClasses>
|
||||
<RangeOverlay>
|
||||
<LineTexture>outline_border.png</LineTexture>
|
||||
<LineTextureMask>outline_border_mask.png</LineTextureMask>
|
||||
<LineThickness>0.175</LineThickness>
|
||||
</RangeOverlay>
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
|
||||
+5
@@ -15,6 +15,11 @@
|
||||
<Spread>2.0</Spread>
|
||||
<Delay>0</Delay>
|
||||
<PreferredClasses datatype="tokens">Human</PreferredClasses>
|
||||
<RangeOverlay>
|
||||
<LineTexture>outline_border.png</LineTexture>
|
||||
<LineTextureMask>outline_border_mask.png</LineTextureMask>
|
||||
<LineThickness>0.175</LineThickness>
|
||||
</RangeOverlay>
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
|
||||
Reference in New Issue
Block a user