Page MenuHomeWildfire Games

Add an option to display ranges when pressing the showstatusbars hotkey
Needs ReviewPublic

Authored by Stan on Oct 9 2019, 5:49 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#5592
Summary

Currently there is no way to have the unit attack and aura range always displayed. This patches combines it with the status bar so you can get all at once, and also allows it to be disabled in the options

Test Plan

Test that pressing tab displays the range once it has been enabled (disabled by default as to not change the behavior)
Test that pressing tab again disable it
Test that disabling the option disables it too.

Diff Detail

Event Timeline

Stan created this revision.Oct 9 2019, 5:49 PM
Vulcan added a comment.Oct 9 2019, 5:55 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/431/display/redirect

Vulcan added a comment.Oct 9 2019, 5:56 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 5.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
| 392| 392| 				// Players see colors depending on diplomacy
| 393| 393| 				g_DisplayedPlayerColors[i] =
| 394| 394| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 395|    |-					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
|    | 395|+						g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 396| 396| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 397| 397| 					getDiplomacyColor("enemy");
| 398| 398| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 5.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
| 393| 393| 				g_DisplayedPlayerColors[i] =
| 394| 394| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 395| 395| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 396|    |-					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
|    | 396|+							g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 397| 397| 					getDiplomacyColor("enemy");
| 398| 398| 
| 399| 399| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 8 tabs but found 5.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
| 394| 394| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 395| 395| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 396| 396| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 397|    |-					getDiplomacyColor("enemy");
|    | 397|+								getDiplomacyColor("enemy");
| 398| 398| 
| 399| 399| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
| 400| 400| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
| 656| 656| 					"civ": setStringTags(g_CivData[g_Players[g_ViewedPlayer].civ].Name, { "font": "sans-bold-stroke-14" }),
| 657| 657| 					"hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"),
| 658| 658| 					"hotkey_structree": colorizeHotkey("%(hotkey)s", "structree")
| 659|    |-			});
|    | 659|+				});
| 660| 660| 	}
| 661| 661| 
| 662| 662| 	// Following gaia can be interesting on scripted maps
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|1212|1212| 
|1213|1213| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1214|1214| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1215|    |-		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|    |1215|+			"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1216|1216| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1217|1217| 	});
|1218|1218| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|1213|1213| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1214|1214| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1215|1215| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1216|    |-		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|    |1216|+			"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1217|1217| 	});
|1218|1218| 
|1219|1219| 	let resCodes = g_ResourceData.GetCodes();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/session.js
|1214|1214| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1215|1215| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1216|1216| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1217|    |-	});
|    |1217|+		});
|1218|1218| 
|1219|1219| 	let resCodes = g_ResourceData.GetCodes();
|1220|1220| 	for (let r = 0; r < resCodes.length; ++r)

binaries/data/mods/public/gui/session/session.js
|1073| »   let·getPanelEntNameTooltip·=·panelEntState·=>·"[font=\"sans-bold-16\"]"·+·template.name.specific·+·"[/font]";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'panelEntState' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
|1148| »   »   button.onpress·=·(function(i)·{·return·function()·{·performGroup((Engine.HotkeyIsPressed("selection.add")·?·"add"·:·"select"),·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
|1149| »   »   button.ondoublepress·=·(function(i)·{·return·function()·{·performGroup("snap",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
|1150| »   »   button.onpressright·=·(function(i)·{·return·function()·{·performGroup("breakUp",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
| 821| 821| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 822| 822| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 823| 823| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 824|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 824|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 825| 825| 	}
| 826| 826| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 827| 827| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1658|1658| 			{
|1659|1659| 				minDist2 = dist2;
|1660|1660| 				minDistEntitySnapData = {
|1661|    |-						"x": pos.x,
|    |1661|+					"x": pos.x,
|1662|1662| 						"z": pos.z,
|1663|1663| 						"angle": cmpPosition.GetRotation().y,
|1664|1664| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1659|1659| 				minDist2 = dist2;
|1660|1660| 				minDistEntitySnapData = {
|1661|1661| 						"x": pos.x,
|1662|    |-						"z": pos.z,
|    |1662|+					"z": pos.z,
|1663|1663| 						"angle": cmpPosition.GetRotation().y,
|1664|1664| 						"ent": ent
|1665|1665| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1660|1660| 				minDistEntitySnapData = {
|1661|1661| 						"x": pos.x,
|1662|1662| 						"z": pos.z,
|1663|    |-						"angle": cmpPosition.GetRotation().y,
|    |1663|+					"angle": cmpPosition.GetRotation().y,
|1664|1664| 						"ent": ent
|1665|1665| 				};
|1666|1666| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1661|1661| 						"x": pos.x,
|1662|1662| 						"z": pos.z,
|1663|1663| 						"angle": cmpPosition.GetRotation().y,
|1664|    |-						"ent": ent
|    |1664|+					"ent": ent
|1665|1665| 				};
|1666|1666| 			}
|1667|1667| 		}
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/946/display/redirect

Stan updated the Trac tickets for this revision.Oct 9 2019, 6:01 PM
Angen added a subscriber: Angen.Oct 10 2019, 8:07 AM
Angen added inline comments.
binaries/data/mods/public/gui/options/options.json
485

Use this callback to update range visualisation values

502

Not entirely true

  1. Ranges are showed for structures as well not only for units
  2. I guess aura visualization is done at L474
binaries/data/mods/public/gui/session/session.js
1364

I guess this function and updateEnabledRangeOverlayTypes should be enough to deal with the issue as soon needed value in config is set to wanted value

so I do not see reason to have L1344

Stan added inline comments.Oct 10 2019, 8:34 AM
binaries/data/mods/public/gui/options/options.json
485

None of the other options does it ?

502

Yeah that was the goal I wanted to show everything.

binaries/data/mods/public/gui/session/session.js
1364

This only deal with selection no ? I want everything (g_selected)

elexis added a subscriber: elexis.Oct 10 2019, 11:15 AM

See ticket and irclogs yesterday, I don't see why this should be an option when it could be a hotkey that allows for the same plus more combination (only persistently showing one of the two)..

Stan added a comment.Oct 10 2019, 12:12 PM

See IRC today, where the current configuration already allows for options, as one can press ALT+C or ALT+V to disable some overlays when in TAB mode.