Page MenuHomeWildfire Games

Get projectile names from template.
Changes PlannedPublic

Authored by Freagarach on Nov 18 2019, 3:50 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Now the cool artillery towers are implemented the user visible string "arrows" in the rate tooltip is wrong sometimes. This patch aims at fixing that.

I've used | as the singular/plural delimiter, not knowing whether that is good?

Test Plan

Verify that different projectiles are shown correctly.
Currently only the arty towers are updated.

Event Timeline

Freagarach created this revision.Nov 18 2019, 3:50 PM
Owners added a subscriber: Restricted Owners Package.Nov 18 2019, 3:50 PM

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 206| 206| 			"projectileName": unitFont(sprintf(translatePlural("%(singularProjectileName)s", "%(pluralProjectileName)s", projectiles), {
| 207| 207| 				"singularProjectileName": projectileNames[0],
| 208| 208| 				"pluralProjectileName": projectileNames[1]
| 209|    |-				}))
|    | 209|+			}))
| 210| 210| 		});
| 211| 211| 
| 212| 212| 		attackRateString = sprintf(translate("%(projectileString)s / %(attackRateString)s"), {
|    | [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
| 823| 823| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 824| 824| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 825| 825| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 826|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 826|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 827| 827| 	}
| 828| 828| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 829| 829| 	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
|1656|1656| 			{
|1657|1657| 				minDist2 = dist2;
|1658|1658| 				minDistEntitySnapData = {
|1659|    |-						"x": pos.x,
|    |1659|+					"x": pos.x,
|1660|1660| 						"z": pos.z,
|1661|1661| 						"angle": cmpPosition.GetRotation().y,
|1662|1662| 						"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
|1657|1657| 				minDist2 = dist2;
|1658|1658| 				minDistEntitySnapData = {
|1659|1659| 						"x": pos.x,
|1660|    |-						"z": pos.z,
|    |1660|+					"z": pos.z,
|1661|1661| 						"angle": cmpPosition.GetRotation().y,
|1662|1662| 						"ent": ent
|1663|1663| 				};
|    | [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| 				minDistEntitySnapData = {
|1659|1659| 						"x": pos.x,
|1660|1660| 						"z": pos.z,
|1661|    |-						"angle": cmpPosition.GetRotation().y,
|    |1661|+					"angle": cmpPosition.GetRotation().y,
|1662|1662| 						"ent": ent
|1663|1663| 				};
|1664|1664| 			}
|    | [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| 						"x": pos.x,
|1660|1660| 						"z": pos.z,
|1661|1661| 						"angle": cmpPosition.GetRotation().y,
|1662|    |-						"ent": ent
|    |1662|+					"ent": ent
|1663|1663| 				};
|1664|1664| 			}
|1665|1665| 		}
Executing section cli...

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

bb added a subscriber: bb.Jul 21 2020, 8:42 PM

I've used | as the singular/plural delimiter, not knowing whether that is good?

Well that is certainly not going to work straight away, since there are languages in the world that have more than 2 plural forms. So firstly need some way to have plural translatable template tags (afaik we only have singular now)

binaries/data/mods/public/gui/common/tooltips.js
191

This will also fail in translation, since the extractor scripts need the english strings inside the translate call.

Freagarach planned changes to this revision.Jul 23 2020, 7:49 AM
In D2431#125256, @bb wrote:

(,,,) since there are languages in the world that have more than 2 plural forms. So firstly need some way to have plural translatable template tags (afaik we only have singular now)

We could add two template entries: ProjectileNameSingular and ProjectileNamePlural, but that wouldn't solve the "more than 2 plural forms".

binaries/data/mods/public/gui/common/tooltips.js
191

I've indeed learned that in the meantime ^^