Page MenuHomeWildfire Games

Combine "EntityCommand" and "AllyEntityCommand".
Needs ReviewPublic

Authored by Freagarach on Oct 1 2019, 6:41 PM.

Details

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

This combines the EntityCommand and AllyEntityCommand to allow for more sorts of commands (e.g. click a button to assign a idle villager to a resource).
A behaviour change which I think is not too bad is that observers do not see the command buttons anymore (exept the focus-rally).

Test Plan

Verify that all commands are shown correctly and can be used correctly by playing some games and trying the buttons.

Event Timeline

Freagarach created this revision.Oct 1 2019, 6:41 PM
Freagarach created this object with visibility "No One".
Owners added a subscriber: Restricted Owners Package.Oct 1 2019, 6:41 PM
Freagarach retitled this revision from Combine "EntityCommand" and "AllyEntityCommand". to [WIP] - Combine "EntityCommand" and "AllyEntityCommand"..Oct 2 2019, 9:42 AM
Freagarach edited the summary of this revision. (Show Details)
Freagarach changed the visibility from "No One" to "Public (No Login Required)".
Freagarach added a subscriber: Stan.
Freagarach updated this revision to Diff 10224.Oct 29 2019, 9:30 PM
Freagarach edited the summary of this revision. (Show Details)

Use existing canControlPlayer-function.

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
| 709| 709| 				addResearchToQueue(data.item.researchFacilityId, t);
| 710| 710| 			})(tech);
| 711| 711| 
| 712|    |-			button.onPressRight = (t => function () {
|    | 712|+			button.onPressRight = (t => function() {
| 713| 713| 				showTemplateDetails(
| 714| 714| 					t,
| 715| 715| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

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

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

binaries/data/mods/public/gui/session/selection_panels.js
| 677| »   »   »   »   »   »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|1112|1112| 							resumeGame();
|1113|1113| 						}
|1114|1114| 					]);
|1115|    |-			};
|    |1115|+			}
|1116|1116| 		},
|1117|1117| 	},
|1118|1118| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|1348|1348| 					};
|1349|1349| 			}
|1350|1350| 
|1351|    |-			let player = Engine.GetPlayerID()
|    |1351|+			let player = Engine.GetPlayerID();
|1352|1352| 			if (player == -1 || entStates.every(entState =>
|1353|1353| 			    !GetSimState().players[player].hasSharedDropsites ||
|1354|1354| 			    !entState.resourceDropsite || !entState.resourceDropsite.sharable))

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
|1115| »   »   »   };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/gui/session/unit_actions.js
|1351| »   »   »   let·player·=·Engine.GetPlayerID()
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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

Angen added a subscriber: Angen.Oct 30 2019, 10:48 AM
Angen added inline comments.
binaries/data/mods/public/gui/session/selection_panels_helpers.js
242–243

!g_IsObserver || ...

Angen added inline comments.Oct 30 2019, 9:55 PM
binaries/data/mods/public/gui/session/selection_panels_helpers.js
242–243

looking again, actually second part should be negated because behaviour is switched for not observer with rally point and without that command

Freagarach updated this revision to Diff 10329.Nov 15 2019, 9:25 AM
Freagarach marked 2 inline comments as done.
Freagarach edited the summary of this revision. (Show Details)

Moved the observer-focus-rally-check.

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

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

Freagarach added a comment.EditedNov 15 2019, 9:32 AM

It would be good to replace the controlsPlayer with a more easily extendable check, as suggested for the panes itself in the ToDo in unit_commands.js L158.

binaries/data/mods/public/gui/session/selection_panels.js
136–137

Could be deleted now, since the button is not visible.

binaries/data/mods/public/gui/session/unit_actions.js
1571

+;

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
| 709| 709| 				addResearchToQueue(data.item.researchFacilityId, t);
| 710| 710| 			})(tech);
| 711| 711| 
| 712|    |-			button.onPressRight = (t => function () {
|    | 712|+			button.onPressRight = (t => function() {
| 713| 713| 				showTemplateDetails(
| 714| 714| 					t,
| 715| 715| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

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

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

binaries/data/mods/public/gui/session/selection_panels.js
| 677| »   »   »   »   »   »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|1333|1333| 					};
|1334|1334| 			}
|1335|1335| 
|1336|    |-			let player = Engine.GetPlayerID()
|    |1336|+			let player = Engine.GetPlayerID();
|1337|1337| 			if (player == -1 || entStates.every(entState =>
|1338|1338| 			    !GetSimState().players[player].hasSharedDropsites ||
|1339|1339| 			    !entState.resourceDropsite || !entState.resourceDropsite.sharable))

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
|1336| »   »   »   let·player·=·Engine.GetPlayerID()
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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

Freagarach updated this revision to Diff 10412.Nov 24 2019, 9:54 PM
Freagarach retitled this revision from [WIP] - Combine "EntityCommand" and "AllyEntityCommand". to Combine "EntityCommand" and "AllyEntityCommand"..
Freagarach edited the summary of this revision. (Show Details)
Freagarach added a reviewer: Restricted Owners Package.
  • Replace controlsPlayer with more extendable check.
  • Remove g_IsObserver from "enabled".
Freagarach added inline comments.Nov 24 2019, 9:55 PM
binaries/data/mods/public/gui/session/unit_actions.js
1622

!playerState -> g_IsObserver.

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
| 706| 706| 				addResearchToQueue(data.item.researchFacilityId, t);
| 707| 707| 			})(tech);
| 708| 708| 
| 709|    |-			button.onPressRight = (t => function () {
|    | 709|+			button.onPressRight = (t => function() {
| 710| 710| 				showTemplateDetails(
| 711| 711| 					t,
| 712| 712| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

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

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

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

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
Executing section cli...

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

Freagarach updated this revision to Diff 10417.Nov 25 2019, 9:28 AM
Freagarach edited the summary of this revision. (Show Details)

Incorporated D2397.

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
| 705| 705| 				addResearchToQueue(data.item.researchFacilityId, t);
| 706| 706| 			})(tech);
| 707| 707| 
| 708|    |-			button.onPressRight = (t => function () {
|    | 708|+			button.onPressRight = (t => function() {
| 709| 709| 				showTemplateDetails(
| 710| 710| 					t,
| 711| 711| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

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

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

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

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
Executing section cli...

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

Freagarach updated this revision to Diff 11974.Fri, May 22, 2:26 PM
  • Rebased.
  • Simplification of checking allowed players.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'state'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
| 242| 242| 		if (!g_AvailableFormations.has(unitEntStates[0].player))
| 243| 243| 			g_AvailableFormations.set(unitEntStates[0].player, Engine.GuiInterfaceCall("GetAvailableFormations", unitEntStates[0].player));
| 244| 244| 
| 245|    |-		return g_AvailableFormations.get(unitEntStates[0].player).filter(formation => unitEntStates.some(state => !!state.identity &&  state.identity.formations.indexOf(formation) != -1));
|    | 245|+		return g_AvailableFormations.get(unitEntStates[0].player).filter(formation => unitEntStates.some(state => !!state.identity && state.identity.formations.indexOf(formation) != -1));
| 246| 246| 	},
| 247| 247| 	"setupButton": function(data)
| 248| 248| 	{
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js
| 705| 705| 				addResearchToQueue(data.item.researchFacilityId, t);
| 706| 706| 			})(tech);
| 707| 707| 
| 708|    |-			button.onPressRight = (t => function () {
|    | 708|+			button.onPressRight = (t => function() {
| 709| 709| 				showTemplateDetails(
| 710| 710| 					t,
| 711| 711| 					GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);

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

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

binaries/data/mods/public/gui/session/selection_panels.js
| 673| »   »   »   »   »   »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'execute'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 530| 530| 
| 531| 531| 	"cancel-setup-trade-route":
| 532| 532| 	{
| 533|    |-		"execute":function(target, action, selection, queued)
|    | 533|+		"execute": function(target, action, selection, queued)
| 534| 534| 		{
| 535| 535| 			Engine.PostNetworkCommand({
| 536| 536| 				"type": "cancel-setup-trade-route",
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 575| 575| 				"cursor": "action-cancel-setup-trade-route",
| 576| 576| 				"tooltip": actionInfo.tooltip,
| 577| 577| 				"target": target
| 578|    |-			}
|    | 578|+			};
| 579| 579| 		},
| 580| 580| 		"specificness": 2,
| 581| 581| 	},

binaries/data/mods/public/gui/session/unit_actions.js
| 620| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 578| »   »   »   }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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