Index: binaries/data/mods/public/gui/session/menu.js
===================================================================
--- binaries/data/mods/public/gui/session/menu.js (revision 18500)
+++ binaries/data/mods/public/gui/session/menu.js (working copy)
@@ -620,7 +620,9 @@
Engine.PushGuiPage("page_summary.xml", {
"sim": {
"mapSettings": g_GameAttributes.settings,
- "playerStates": extendedSimState.players,
+ "playerStates":extendedSimState.players.filter((state,player) =>
+ g_IsObserver || player == 0 || player == g_ViewedPlayer ||
+ extendedSimState.players[g_ViewedPlayer].hasSharedLos && g_Players[player].isMutualAlly[g_ViewedPlayer]),
"timeElapsed" : extendedSimState.timeElapsed
},
"gui": {
Index: binaries/data/mods/public/gui/session/menu.xml
===================================================================
--- binaries/data/mods/public/gui/session/menu.xml (revision 18500)
+++ binaries/data/mods/public/gui/session/menu.xml (working copy)
@@ -48,7 +48,6 @@
style="StoneButtonFancy"
size="0 96 100% 124"
tooltip_style="sessionToolTip"
- enabled="false"
>
Summary
openGameSummary();
Index: binaries/data/mods/public/gui/session/session.js
===================================================================
--- binaries/data/mods/public/gui/session/session.js (revision 18500)
+++ binaries/data/mods/public/gui/session/session.js (working copy)
@@ -480,7 +480,6 @@
// Disable stuff observers shouldn't use
Engine.GetGUIObjectByName("pauseButton").enabled = !g_IsObserver || !g_IsNetworked;
Engine.GetGUIObjectByName("menuResignButton").enabled = !g_IsObserver;
- Engine.GetGUIObjectByName("summaryButton").enabled = g_IsObserver;
}
function reportPerformance(time)
@@ -933,6 +932,22 @@
debug.caption = text.replace(/\[/g, "\\[");
}
+function getAllyStatTooltip(resource)
+{
+ let playersState = GetSimState().players;
+ let ret = "";
+ for (let player in playersState)
+ if (player != 0 && player != g_ViewedPlayer &&
+ (g_IsObserver || playersState[g_ViewedPlayer].hasSharedLos && g_Players[player].isMutualAlly[g_ViewedPlayer]))
+ ret += sprintf(translate("\n%(playername)s: %(statValue)s"),{
+ "playername": colorizePlayernameByID(player),
+ "statValue": resource == "pop" ?
+ playersState[player].popCount + "/" + playersState[player].popLimit :
+ playersState[player].resourceCounts[resource]
+ });
+ return ret;
+}
+
function updatePlayerDisplay()
{
let playerState = GetSimState().players[g_ViewedPlayer];
@@ -939,13 +954,15 @@
if (!playerState)
return;
- Engine.GetGUIObjectByName("resourceFood").caption = Math.floor(playerState.resourceCounts.food);
- Engine.GetGUIObjectByName("resourceWood").caption = Math.floor(playerState.resourceCounts.wood);
- Engine.GetGUIObjectByName("resourceStone").caption = Math.floor(playerState.resourceCounts.stone);
- Engine.GetGUIObjectByName("resourceMetal").caption = Math.floor(playerState.resourceCounts.metal);
+ for (let res of RESOURCES)
+ {
+ Engine.GetGUIObjectByName("resource_" + res).caption = Math.floor(playerState.resourceCounts[res]);
+ Engine.GetGUIObjectByName(res).tooltip = localisedResourceNames.firstWord[res] + getAllyStatTooltip(res);
+ }
Engine.GetGUIObjectByName("resourcePop").caption = playerState.popCount + "/" + playerState.popLimit;
Engine.GetGUIObjectByName("population").tooltip = translate("Population (current / limit)") + "\n" +
- sprintf(translate("Maximum population: %(popCap)s"), { "popCap": playerState.popMax });
+ sprintf(translate("Maximum population: %(popCap)s"), { "popCap": playerState.popMax }) +
+ getAllyStatTooltip("pop");
g_IsTrainingBlocked = playerState.trainingBlocked;
}
Index: binaries/data/mods/public/gui/session/top_panel/resource_food.xml
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/resource_food.xml (revision 18500)
+++ binaries/data/mods/public/gui/session/top_panel/resource_food.xml (working copy)
@@ -1,6 +1,5 @@
Index: binaries/data/mods/public/gui/session/top_panel/resource_metal.xml
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/resource_metal.xml (revision 18500)
+++ binaries/data/mods/public/gui/session/top_panel/resource_metal.xml (working copy)
@@ -1,6 +1,5 @@
- Metal
-
+
Index: binaries/data/mods/public/gui/session/top_panel/resource_stone.xml
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/resource_stone.xml (revision 18500)
+++ binaries/data/mods/public/gui/session/top_panel/resource_stone.xml (working copy)
@@ -1,6 +1,5 @@
- Stone
-
+
Index: binaries/data/mods/public/gui/session/top_panel/resource_wood.xml
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/resource_wood.xml (revision 18500)
+++ binaries/data/mods/public/gui/session/top_panel/resource_wood.xml (working copy)
@@ -1,6 +1,5 @@
- Wood
-
+
Index: binaries/data/mods/public/simulation/components/GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/GuiInterface.js (revision 18500)
+++ binaries/data/mods/public/simulation/components/GuiInterface.js (working copy)
@@ -107,6 +107,7 @@
"cheatsEnabled": cmpPlayer.GetCheatsEnabled(),
"disabledTemplates": cmpPlayer.GetDisabledTemplates(),
"hasSharedDropsites": cmpPlayer.HasSharedDropsites(),
+ "hasSharedLos": cmpPlayer.HasSharedLos(),
"phase": phase,
"isAlly": allies,
"isMutualAlly": mutualAllies,
Index: binaries/data/mods/public/simulation/components/Player.js
===================================================================
--- binaries/data/mods/public/simulation/components/Player.js (revision 18500)
+++ binaries/data/mods/public/simulation/components/Player.js (working copy)
@@ -545,6 +545,11 @@
return this.startCam !== undefined;
};
+Player.prototype.HasSharedLos = function()
+{
+ let cmpTechnologyManager = Engine.QueryInterface(this.entity, IID_TechnologyManager);
+ return cmpTechnologyManager && cmpTechnologyManager.IsTechnologyResearched(this.template.SharedLosTech);
+};
Player.prototype.HasSharedDropsites = function()
{
return this.sharedDropsites;
Index: binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js (revision 18500)
+++ binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js (working copy)
@@ -91,6 +91,7 @@
IsEnemy: function() { return true; },
GetDisabledTemplates: function() { return {}; },
HasSharedDropsites: function() { return false; },
+ HasSharedLos: function() { return false; },
});
AddMock(100, IID_EntityLimits, {
@@ -174,6 +175,7 @@
IsEnemy: function() { return false; },
GetDisabledTemplates: function() { return {}; },
HasSharedDropsites: function() { return false; },
+ HasSharedLos: function() { return false; },
});
AddMock(101, IID_EntityLimits, {
@@ -257,6 +259,7 @@
cheatsEnabled: false,
disabledTemplates: {},
hasSharedDropsites: false,
+ hasSharedLos: false,
phase: "village",
isAlly: [false, false],
isMutualAlly: [false, false],
@@ -298,6 +301,7 @@
cheatsEnabled: false,
disabledTemplates: {},
hasSharedDropsites: false,
+ hasSharedLos: false,
phase: "village",
isAlly: [true, true],
isMutualAlly: [false, false],
@@ -348,6 +352,7 @@
cheatsEnabled: false,
disabledTemplates: {},
hasSharedDropsites: false,
+ hasSharedLos: false,
phase: "village",
isAlly: [false, false],
isMutualAlly: [false, false],
@@ -402,6 +407,7 @@
cheatsEnabled: false,
disabledTemplates: {},
hasSharedDropsites: false,
+ hasSharedLos: false,
phase: "village",
isAlly: [true, true],
isMutualAlly: [false, false],