Page MenuHomeWildfire Games

Apply modifications to template values based on entity owner instead watching player
Needs ReviewPublic

Authored by Angen on Sun, Jul 7, 4:00 PM.

Details

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

Again noticed by ValihrAnt https://www.youtube.com/watch?v=C-D_CwlTBtY, that as observer one does not see bonuses to cost for training.

Making that optional as I do not think we want it everywhere.

Test Plan

Check we do not affect values of another player.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 8264
Build 13479: Vulcan BuildJenkins
Build 13477: arc lint + arc unit

Event Timeline

Angen created this revision.Sun, Jul 7, 4:00 PM
Owners added a subscriber: Restricted Owners Package.Sun, Jul 7, 4:00 PM
Vulcan added a comment.Sun, Jul 7, 4:02 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 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 392| 392| function getRepairTimeTooltip(entState)
| 393| 393| {
| 394| 394| 	return sprintf(translate("%(label)s %(details)s"), {
| 395|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 395|+		"label": headerFont(translate("Number of repairers:")),
| 396| 396| 			"details": entState.repairable.numBuilders
| 397| 397| 		}) + "\n" + (entState.repairable.numBuilders ?
| 398| 398| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| {
| 394| 394| 	return sprintf(translate("%(label)s %(details)s"), {
| 395| 395| 			"label": headerFont(translate("Number of repairers:")),
| 396|    |-			"details": entState.repairable.numBuilders
|    | 396|+		"details": entState.repairable.numBuilders
| 397| 397| 		}) + "\n" + (entState.repairable.numBuilders ?
| 398| 398| 		sprintf(translatePlural(
| 399| 399| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| 	return sprintf(translate("%(label)s %(details)s"), {
| 395| 395| 			"label": headerFont(translate("Number of repairers:")),
| 396| 396| 			"details": entState.repairable.numBuilders
| 397|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 397|+	}) + "\n" + (entState.repairable.numBuilders ?
| 398| 398| 		sprintf(translatePlural(
| 399| 399| 			"Add another worker to speed up the repairs by %(second)s second.",
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 414| 414| function getBuildTimeTooltip(entState)
| 415| 415| {
| 416| 416| 	return sprintf(translate("%(label)s %(details)s"), {
| 417|    |-			"label": headerFont(translate("Number of builders:")),
|    | 417|+		"label": headerFont(translate("Number of builders:")),
| 418| 418| 			"details": entState.foundation.numBuilders
| 419| 419| 		}) + "\n" + (entState.foundation.numBuilders ?
| 420| 420| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| {
| 416| 416| 	return sprintf(translate("%(label)s %(details)s"), {
| 417| 417| 			"label": headerFont(translate("Number of builders:")),
| 418|    |-			"details": entState.foundation.numBuilders
|    | 418|+		"details": entState.foundation.numBuilders
| 419| 419| 		}) + "\n" + (entState.foundation.numBuilders ?
| 420| 420| 		sprintf(translatePlural(
| 421| 421| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| 	return sprintf(translate("%(label)s %(details)s"), {
| 417| 417| 			"label": headerFont(translate("Number of builders:")),
| 418| 418| 			"details": entState.foundation.numBuilders
| 419|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 419|+	}) + "\n" + (entState.foundation.numBuilders ?
| 420| 420| 		sprintf(translatePlural(
| 421| 421| 			"Add another worker to speed up the construction by %(second)s second.",
| 422| 422| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 222| 222| {
| 223| 223| 	if (!(templateName in g_TemplateData))
| 224| 224| 	{
| 225|    |-		let template = Engine.GuiInterfaceCall("GetTemplateData", {"templateName": templateName, "templatePlayer": templatePlayer});
|    | 225|+		let template = Engine.GuiInterfaceCall("GetTemplateData", { "templateName": templateName, "templatePlayer": templatePlayer});
| 226| 226| 		translateObjectKeys(template, ["specific", "generic", "tooltip"]);
| 227| 227| 		g_TemplateData[templateName] = deepfreeze(template);
| 228| 228| 	}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 222| 222| {
| 223| 223| 	if (!(templateName in g_TemplateData))
| 224| 224| 	{
| 225|    |-		let template = Engine.GuiInterfaceCall("GetTemplateData", {"templateName": templateName, "templatePlayer": templatePlayer});
|    | 225|+		let template = Engine.GuiInterfaceCall("GetTemplateData", {"templateName": templateName, "templatePlayer": templatePlayer });
| 226| 226| 		translateObjectKeys(template, ["specific", "generic", "tooltip"]);
| 227| 227| 		g_TemplateData[templateName] = deepfreeze(template);
| 228| 228| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 391| 391| 				// Players see colors depending on diplomacy
| 392| 392| 				g_DisplayedPlayerColors[i] =
| 393| 393| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 394|    |-					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
|    | 394|+						g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 395| 395| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 396| 396| 					getDiplomacyColor("enemy");
| 397| 397| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 392| 392| 				g_DisplayedPlayerColors[i] =
| 393| 393| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 394| 394| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 395|    |-					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
|    | 395|+							g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 396| 396| 					getDiplomacyColor("enemy");
| 397| 397| 
| 398| 398| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 8 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 393| 393| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 394| 394| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 395| 395| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 396|    |-					getDiplomacyColor("enemy");
|    | 396|+								getDiplomacyColor("enemy");
| 397| 397| 
| 398| 398| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
| 399| 399| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 643| 643| 					"civ": setStringTags(g_CivData[g_Players[g_ViewedPlayer].civ].Name, { "font": "sans-bold-stroke-14" }),
| 644| 644| 					"hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"),
| 645| 645| 					"hotkey_structree": colorizeHotkey("%(hotkey)s", "structree")
| 646|    |-			});
|    | 646|+				});
| 647| 647| 	}
| 648| 648| 
| 649| 649| 	// Following gaia can be interesting on scripted maps
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1193|1193| 
|1194|1194| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1195|1195| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1196|    |-		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|    |1196|+			"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1197|1197| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1198|1198| 	});
|1199|1199| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1194|1194| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1195|1195| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1196|1196| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1197|    |-		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|    |1197|+			"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1198|1198| 	});
|1199|1199| 
|1200|1200| 	let resCodes = g_ResourceData.GetCodes();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 1.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1195|1195| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1196|1196| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1197|1197| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1198|    |-	});
|    |1198|+		});
|1199|1199| 
|1200|1200| 	let resCodes = g_ResourceData.GetCodes();
|1201|1201| 	for (let r = 0; r < resCodes.length; ++r)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1678|1678| 	for (let rct of resourcesCounterTypes)
|1679|1679| 		for (let rt of resourcesTypes)
|1680|1680| 			reportObject[rt + rct.substr(9)] = playerStatistics[rct][rt];
|1681|    |-			// eg. rt = food rct.substr = Gathered rct = resourcesGathered
|    |1681|+	// eg. rt = food rct.substr = Gathered rct = resourcesGathered
|1682|1682| 
|1683|1683| 	reportObject.vegetarianFoodGathered = playerStatistics.resourcesGathered.vegetarianFood;
|1684|1684| 	for (let type of unitsClasses)

binaries/data/mods/public/gui/session/session.js
|1054| »   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
|1129| »   »   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
|1130| »   »   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
|1131| »   »   button.onpressright·=·(function(i)·{·return·function()·{·performGroup("breakUp",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
| 452| 452| 				continue;
| 453| 453| 
| 454| 454| 			if (state.pack.progress == 0)
| 455|    |-			{
|    | 455|+			
| 456| 456| 				if (state.pack.packed)
| 457| 457| 					checks.unpackButton = true;
| 458| 458| 				else
| 459| 459| 					checks.packButton = true;
| 460|    |-			}
|    | 460|+			
| 461| 461| 			else if (state.pack.packed)
| 462| 462| 				checks.unpackCancelButton = true;
| 463| 463| 			else
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
| 763| 763| 				addResearchToQueue(data.item.researchFacilityId, t);
| 764| 764| 			})(tech);
| 765| 765| 
| 766|    |-			button.onPressRight = (t => function () {
|    | 766|+			button.onPressRight = (t => function() {
| 767| 767| 				showTemplateDetails(
| 768| 768| 					t,
| 769| 769| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

binaries/data/mods/public/gui/session/selection_panels.js
|  48| »   »   »   switch·(data.item)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/selection_panels.js
|  59| »   »   switch·(data.item)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/selection_panels.js
| 731| »   »   »   »   »   »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 799| 799| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 800| 800| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 801| 801| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 802|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 802|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 803| 803| 	}
| 804| 804| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 805| 805| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1318|1318| 		}
|1319|1319| 	}
|1320|1320| 	else
|1321|    |-	{
|    |1321|+	
|1322|1322| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1323|1323| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1324|1324| 		// wall piece.
|1339|1339| 			"pos": start.pos,
|1340|1340| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1341|1341| 		});
|1342|    |-	}
|    |1342|+	
|1343|1343| 
|1344|1344| 	if (end.pos)
|1345|1345| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1342|1342| 	}
|1343|1343| 
|1344|1344| 	if (end.pos)
|1345|    |-	{
|    |1345|+	
|1346|1346| 		// Analogous to the starting side case above
|1347|1347| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1348|1348| 		{
|1380|1380| 				"pos": end.pos,
|1381|1381| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1382|1382| 			});
|1383|    |-	}
|    |1383|+	
|1384|1384| 
|1385|1385| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1386|1386| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1558|1558| 
|1559|1559| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1560|1560| 		if (cmpVisual)
|1561|    |-		{
|    |1561|+		
|1562|1562| 			if (!allPiecesValid || !canAfford)
|1563|1563| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1564|1564| 			else
|1565|1565| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1566|    |-		}
|    |1566|+		
|1567|1567| 
|1568|1568| 		++entPool.numUsed;
|1569|1569| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 			{
|1633|1633| 				minDist2 = dist2;
|1634|1634| 				minDistEntitySnapData = {
|1635|    |-						"x": pos.x,
|    |1635|+					"x": pos.x,
|1636|1636| 						"z": pos.z,
|1637|1637| 						"angle": cmpPosition.GetRotation().y,
|1638|1638| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1633|1633| 				minDist2 = dist2;
|1634|1634| 				minDistEntitySnapData = {
|1635|1635| 						"x": pos.x,
|1636|    |-						"z": pos.z,
|    |1636|+					"z": pos.z,
|1637|1637| 						"angle": cmpPosition.GetRotation().y,
|1638|1638| 						"ent": ent
|1639|1639| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1634|1634| 				minDistEntitySnapData = {
|1635|1635| 						"x": pos.x,
|1636|1636| 						"z": pos.z,
|1637|    |-						"angle": cmpPosition.GetRotation().y,
|    |1637|+					"angle": cmpPosition.GetRotation().y,
|1638|1638| 						"ent": ent
|1639|1639| 				};
|1640|1640| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1635|1635| 						"x": pos.x,
|1636|1636| 						"z": pos.z,
|1637|1637| 						"angle": cmpPosition.GetRotation().y,
|1638|    |-						"ent": ent
|    |1638|+					"ent": ent
|1639|1639| 				};
|1640|1640| 			}
|1641|1641| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1780|1780| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1781|1781| 	}
|1782|1782| 	else if (data.target === secondMarket)
|1783|    |-	{
|    |1783|+	
|1784|1784| 		result = {
|1785|1785| 			"type": "is second",
|1786|1786| 			"gain": cmpEntityTrader.GetGoods().amount,
|1787|1787| 		};
|1788|    |-	}
|    |1788|+	
|1789|1789| 	else if (!firstMarket)
|1790|1790| 	{
|1791|1791| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1787|1787| 		};
|1788|1788| 	}
|1789|1789| 	else if (!firstMarket)
|1790|    |-	{
|    |1790|+	
|1791|1791| 		result = { "type": "set first" };
|1792|    |-	}
|    |1792|+	
|1793|1793| 	else if (!secondMarket)
|1794|1794| 	{
|1795|1795| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1791|1791| 		result = { "type": "set first" };
|1792|1792| 	}
|1793|1793| 	else if (!secondMarket)
|1794|    |-	{
|    |1794|+	
|1795|1795| 		result = {
|1796|1796| 			"type": "set second",
|1797|1797| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1798|1798| 		};
|1799|    |-	}
|    |1799|+	
|1800|1800| 	else
|1801|1801| 	{
|1802|1802| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1798|1798| 		};
|1799|1799| 	}
|1800|1800| 	else
|1801|    |-	{
|    |1801|+	
|1802|1802| 		// Else both markets are not null and target is different from them
|1803|1803| 		result = { "type": "set first" };
|1804|    |-	}
|    |1804|+	
|1805|1805| 	return result;
|1806|1806| };
|1807|1807| 
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1935/display/redirect

Angen retitled this revision from Apply modifications to template values based of entity owner instead watching player to Apply modifications to template values based on entity owner instead watching player.Sun, Jul 7, 4:09 PM
Nescio added a subscriber: Nescio.Sun, Jul 7, 4:53 PM

This is great, many thanks! I just tried it out and it solves something that has bothered me for a long time.
The question to be asked is is it complete, does it correctly give all stats displayed everywhere? Hopefully someone more familiar with js could verify.

Angen added a comment.EditedSun, Jul 7, 4:59 PM

I added it only for training, I should and will add it for research and building to be complete. Only stats not displayed with updates could be when you right click at icon. Anything else should be taken from entity state, which has current values.

Angen updated this revision to Diff 8767.Sun, Jul 7, 5:35 PM

[complete]
Added buildings.
Technologies are handled differently so they does not have this issue.

Vulcan added a comment.Sun, Jul 7, 5:37 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
| 455| 455| 				continue;
| 456| 456| 
| 457| 457| 			if (state.pack.progress == 0)
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (state.pack.packed)
| 460| 460| 					checks.unpackButton = true;
| 461| 461| 				else
| 462| 462| 					checks.packButton = true;
| 463|    |-			}
|    | 463|+			
| 464| 464| 			else if (state.pack.packed)
| 465| 465| 				checks.unpackCancelButton = true;
| 466| 466| 			else
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels.js
| 766| 766| 				addResearchToQueue(data.item.researchFacilityId, t);
| 767| 767| 			})(tech);
| 768| 768| 
| 769|    |-			button.onPressRight = (t => function () {
|    | 769|+			button.onPressRight = (t => function() {
| 770| 770| 				showTemplateDetails(
| 771| 771| 					t,
| 772| 772| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

binaries/data/mods/public/gui/session/selection_panels.js
|  48| »   »   »   switch·(data.item)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/selection_panels.js
|  59| »   »   switch·(data.item)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/selection_panels.js
| 734| »   »   »   »   »   »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 392| 392| function getRepairTimeTooltip(entState)
| 393| 393| {
| 394| 394| 	return sprintf(translate("%(label)s %(details)s"), {
| 395|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 395|+		"label": headerFont(translate("Number of repairers:")),
| 396| 396| 			"details": entState.repairable.numBuilders
| 397| 397| 		}) + "\n" + (entState.repairable.numBuilders ?
| 398| 398| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| {
| 394| 394| 	return sprintf(translate("%(label)s %(details)s"), {
| 395| 395| 			"label": headerFont(translate("Number of repairers:")),
| 396|    |-			"details": entState.repairable.numBuilders
|    | 396|+		"details": entState.repairable.numBuilders
| 397| 397| 		}) + "\n" + (entState.repairable.numBuilders ?
| 398| 398| 		sprintf(translatePlural(
| 399| 399| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| 	return sprintf(translate("%(label)s %(details)s"), {
| 395| 395| 			"label": headerFont(translate("Number of repairers:")),
| 396| 396| 			"details": entState.repairable.numBuilders
| 397|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 397|+	}) + "\n" + (entState.repairable.numBuilders ?
| 398| 398| 		sprintf(translatePlural(
| 399| 399| 			"Add another worker to speed up the repairs by %(second)s second.",
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 414| 414| function getBuildTimeTooltip(entState)
| 415| 415| {
| 416| 416| 	return sprintf(translate("%(label)s %(details)s"), {
| 417|    |-			"label": headerFont(translate("Number of builders:")),
|    | 417|+		"label": headerFont(translate("Number of builders:")),
| 418| 418| 			"details": entState.foundation.numBuilders
| 419| 419| 		}) + "\n" + (entState.foundation.numBuilders ?
| 420| 420| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| {
| 416| 416| 	return sprintf(translate("%(label)s %(details)s"), {
| 417| 417| 			"label": headerFont(translate("Number of builders:")),
| 418|    |-			"details": entState.foundation.numBuilders
|    | 418|+		"details": entState.foundation.numBuilders
| 419| 419| 		}) + "\n" + (entState.foundation.numBuilders ?
| 420| 420| 		sprintf(translatePlural(
| 421| 421| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| 	return sprintf(translate("%(label)s %(details)s"), {
| 417| 417| 			"label": headerFont(translate("Number of builders:")),
| 418| 418| 			"details": entState.foundation.numBuilders
| 419|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 419|+	}) + "\n" + (entState.foundation.numBuilders ?
| 420| 420| 		sprintf(translatePlural(
| 421| 421| 			"Add another worker to speed up the construction by %(second)s second.",
| 422| 422| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 222| 222| {
| 223| 223| 	if (!(templateName in g_TemplateData))
| 224| 224| 	{
| 225|    |-		let template = Engine.GuiInterfaceCall("GetTemplateData", {"templateName": templateName, "templatePlayer": templatePlayer});
|    | 225|+		let template = Engine.GuiInterfaceCall("GetTemplateData", { "templateName": templateName, "templatePlayer": templatePlayer});
| 226| 226| 		translateObjectKeys(template, ["specific", "generic", "tooltip"]);
| 227| 227| 		g_TemplateData[templateName] = deepfreeze(template);
| 228| 228| 	}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 222| 222| {
| 223| 223| 	if (!(templateName in g_TemplateData))
| 224| 224| 	{
| 225|    |-		let template = Engine.GuiInterfaceCall("GetTemplateData", {"templateName": templateName, "templatePlayer": templatePlayer});
|    | 225|+		let template = Engine.GuiInterfaceCall("GetTemplateData", {"templateName": templateName, "templatePlayer": templatePlayer });
| 226| 226| 		translateObjectKeys(template, ["specific", "generic", "tooltip"]);
| 227| 227| 		g_TemplateData[templateName] = deepfreeze(template);
| 228| 228| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 391| 391| 				// Players see colors depending on diplomacy
| 392| 392| 				g_DisplayedPlayerColors[i] =
| 393| 393| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 394|    |-					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
|    | 394|+						g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 395| 395| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 396| 396| 					getDiplomacyColor("enemy");
| 397| 397| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 392| 392| 				g_DisplayedPlayerColors[i] =
| 393| 393| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 394| 394| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 395|    |-					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
|    | 395|+							g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 396| 396| 					getDiplomacyColor("enemy");
| 397| 397| 
| 398| 398| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 8 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 393| 393| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 394| 394| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 395| 395| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 396|    |-					getDiplomacyColor("enemy");
|    | 396|+								getDiplomacyColor("enemy");
| 397| 397| 
| 398| 398| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
| 399| 399| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 643| 643| 					"civ": setStringTags(g_CivData[g_Players[g_ViewedPlayer].civ].Name, { "font": "sans-bold-stroke-14" }),
| 644| 644| 					"hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"),
| 645| 645| 					"hotkey_structree": colorizeHotkey("%(hotkey)s", "structree")
| 646|    |-			});
|    | 646|+				});
| 647| 647| 	}
| 648| 648| 
| 649| 649| 	// Following gaia can be interesting on scripted maps
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1193|1193| 
|1194|1194| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1195|1195| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1196|    |-		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|    |1196|+			"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1197|1197| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1198|1198| 	});
|1199|1199| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1194|1194| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1195|1195| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1196|1196| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1197|    |-		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|    |1197|+			"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1198|1198| 	});
|1199|1199| 
|1200|1200| 	let resCodes = g_ResourceData.GetCodes();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 1.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1195|1195| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1196|1196| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1197|1197| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1198|    |-	});
|    |1198|+		});
|1199|1199| 
|1200|1200| 	let resCodes = g_ResourceData.GetCodes();
|1201|1201| 	for (let r = 0; r < resCodes.length; ++r)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1678|1678| 	for (let rct of resourcesCounterTypes)
|1679|1679| 		for (let rt of resourcesTypes)
|1680|1680| 			reportObject[rt + rct.substr(9)] = playerStatistics[rct][rt];
|1681|    |-			// eg. rt = food rct.substr = Gathered rct = resourcesGathered
|    |1681|+	// eg. rt = food rct.substr = Gathered rct = resourcesGathered
|1682|1682| 
|1683|1683| 	reportObject.vegetarianFoodGathered = playerStatistics.resourcesGathered.vegetarianFood;
|1684|1684| 	for (let type of unitsClasses)

binaries/data/mods/public/gui/session/session.js
|1054| »   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
|1129| »   »   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
|1130| »   »   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
|1131| »   »   button.onpressright·=·(function(i)·{·return·function()·{·performGroup("breakUp",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 799| 799| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 800| 800| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 801| 801| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 802|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 802|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 803| 803| 	}
| 804| 804| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 805| 805| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1318|1318| 		}
|1319|1319| 	}
|1320|1320| 	else
|1321|    |-	{
|    |1321|+	
|1322|1322| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1323|1323| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1324|1324| 		// wall piece.
|1339|1339| 			"pos": start.pos,
|1340|1340| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1341|1341| 		});
|1342|    |-	}
|    |1342|+	
|1343|1343| 
|1344|1344| 	if (end.pos)
|1345|1345| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1342|1342| 	}
|1343|1343| 
|1344|1344| 	if (end.pos)
|1345|    |-	{
|    |1345|+	
|1346|1346| 		// Analogous to the starting side case above
|1347|1347| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1348|1348| 		{
|1380|1380| 				"pos": end.pos,
|1381|1381| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1382|1382| 			});
|1383|    |-	}
|    |1383|+	
|1384|1384| 
|1385|1385| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1386|1386| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1558|1558| 
|1559|1559| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1560|1560| 		if (cmpVisual)
|1561|    |-		{
|    |1561|+		
|1562|1562| 			if (!allPiecesValid || !canAfford)
|1563|1563| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1564|1564| 			else
|1565|1565| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1566|    |-		}
|    |1566|+		
|1567|1567| 
|1568|1568| 		++entPool.numUsed;
|1569|1569| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 			{
|1633|1633| 				minDist2 = dist2;
|1634|1634| 				minDistEntitySnapData = {
|1635|    |-						"x": pos.x,
|    |1635|+					"x": pos.x,
|1636|1636| 						"z": pos.z,
|1637|1637| 						"angle": cmpPosition.GetRotation().y,
|1638|1638| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1633|1633| 				minDist2 = dist2;
|1634|1634| 				minDistEntitySnapData = {
|1635|1635| 						"x": pos.x,
|1636|    |-						"z": pos.z,
|    |1636|+					"z": pos.z,
|1637|1637| 						"angle": cmpPosition.GetRotation().y,
|1638|1638| 						"ent": ent
|1639|1639| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1634|1634| 				minDistEntitySnapData = {
|1635|1635| 						"x": pos.x,
|1636|1636| 						"z": pos.z,
|1637|    |-						"angle": cmpPosition.GetRotation().y,
|    |1637|+					"angle": cmpPosition.GetRotation().y,
|1638|1638| 						"ent": ent
|1639|1639| 				};
|1640|1640| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1635|1635| 						"x": pos.x,
|1636|1636| 						"z": pos.z,
|1637|1637| 						"angle": cmpPosition.GetRotation().y,
|1638|    |-						"ent": ent
|    |1638|+					"ent": ent
|1639|1639| 				};
|1640|1640| 			}
|1641|1641| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1780|1780| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1781|1781| 	}
|1782|1782| 	else if (data.target === secondMarket)
|1783|    |-	{
|    |1783|+	
|1784|1784| 		result = {
|1785|1785| 			"type": "is second",
|1786|1786| 			"gain": cmpEntityTrader.GetGoods().amount,
|1787|1787| 		};
|1788|    |-	}
|    |1788|+	
|1789|1789| 	else if (!firstMarket)
|1790|1790| 	{
|1791|1791| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1787|1787| 		};
|1788|1788| 	}
|1789|1789| 	else if (!firstMarket)
|1790|    |-	{
|    |1790|+	
|1791|1791| 		result = { "type": "set first" };
|1792|    |-	}
|    |1792|+	
|1793|1793| 	else if (!secondMarket)
|1794|1794| 	{
|1795|1795| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1791|1791| 		result = { "type": "set first" };
|1792|1792| 	}
|1793|1793| 	else if (!secondMarket)
|1794|    |-	{
|    |1794|+	
|1795|1795| 		result = {
|1796|1796| 			"type": "set second",
|1797|1797| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1798|1798| 		};
|1799|    |-	}
|    |1799|+	
|1800|1800| 	else
|1801|1801| 	{
|1802|1802| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1798|1798| 		};
|1799|1799| 	}
|1800|1800| 	else
|1801|    |-	{
|    |1801|+	
|1802|1802| 		// Else both markets are not null and target is different from them
|1803|1803| 		result = { "type": "set first" };
|1804|    |-	}
|    |1804|+	
|1805|1805| 	return result;
|1806|1806| };
|1807|1807| 
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1936/display/redirect

Nescio added a comment.Tue, Jul 9, 8:10 PM

Not quite sure what causes the duplication here:

Angen added a comment.Tue, Jul 9, 8:33 PM

@Nescio
do you have mods with edited files in this patch? I cannot reproduce it.

Nescio added a comment.Tue, Jul 9, 8:47 PM

Oops, I did, you're right, sorry for the false alarm.

Nescio added a comment.Tue, Jul 9, 8:49 PM

However, I'm getting the following recurring errors when attempting to build palisades (or another wallset):

WARNING: JavaScript warning: simulation/components/GuiInterface.js line 540 Script value conversion check failed: v.isString() || v.isNumber() (got type undefined)

ERROR: CCacheLoader failed to find archived or source file for: "simulation/templates/undefined.xml"

ERROR: Failed to load entity template 'undefined'

ERROR: JavaScript error: simulation/components/GuiInterface.js line 1199 TypeError: this.placementWallEntities[tpl].templateData is null GuiInterface.prototype.SetWallPlacementPreview@simulation/components/GuiInterface.js:1199:8 GuiInterface.prototype.ScriptCall@simulation/components/GuiInterface.js:1973:1 updateBuildingPlacementPreview@gui/session/input.js:195:1 handleInputAfterGui@gui/session/input.js:1076:4

ERROR: Error calling component script function ScriptCall
Angen planned changes to this revision.Tue, Jul 9, 8:50 PM

uhg, ok thnx

Angen updated this revision to Diff 8798.Tue, Jul 9, 8:58 PM

@Nescio fixed, thank you for report

Vulcan added a comment.Tue, Jul 9, 9:02 PM

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

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

Nescio added a comment.EditedTue, Jul 9, 9:05 PM

That's quick! And yes, I can confirm the errors have now gone, thank you.

([EDIT]: And I've also solved that duplicated cost tooltip within my mod: I forgot to remove a line.)

elexis added a subscriber: elexis.Mon, Jul 15, 11:51 AM

"Apply modifications to template values based on entity owner instead watching player" sounds like #5109

Angen updated the Trac tickets for this revision.Mon, Jul 15, 12:29 PM