Page MenuHomeWildfire Games

[WIP] - Combine "EntityCommand" and "AllyEntityCommand".
Needs ReviewPublic

Authored by Freagarach on Oct 1 2019, 6:41 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
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.Tue, Oct 29, 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.Wed, Oct 30, 10:48 AM
Angen added inline comments.
binaries/data/mods/public/gui/session/selection_panels_helpers.js
239–240

!g_IsObserver || ...

Angen added inline comments.Wed, Oct 30, 9:55 PM
binaries/data/mods/public/gui/session/selection_panels_helpers.js
239–240

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.Fri, Nov 15, 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

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

binaries/data/mods/public/gui/session/selection_panels.js
139

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

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

+;

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