Skip to content

Commit e302cfc

Browse files
committed
DiplomacyActionView: Don't hide Alliance tab
Overrides the AddIntelAlliance function in the DiplomacyActionView file to remove hiding the Alliance tab if the player is on the same team as the leader they're viewing
1 parent 756fa66 commit e302cfc

2 files changed

Lines changed: 82 additions & 2 deletions

File tree

Assets/Expansion1/Replacements/diplomacyactionview_CQUI_expansion1.lua

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,44 @@
33
-- ===========================================================================
44
include("DiplomacyActionView_Expansion1.lua");
55

6-
include("diplomacyactionview_CQUI.lua");
6+
include("diplomacyactionview_CQUI.lua");
7+
8+
-- ===========================================================================
9+
-- MEMBERS
10+
-- ===========================================================================
11+
local m_AllianceTabContext = nil;
12+
13+
-- ===========================================================================
14+
-- CQUI modified AddIntelAlliance function
15+
-- Removed hiding the alliance tab if on the same team
16+
-- ===========================================================================
17+
function AddIntelAlliance(tabContainer:table)
18+
-- CQUI: Comment out the following lines to reveal alliance tab on teams
19+
-- Don't show the alliance tab if we're in a team with the selected player
20+
-- if ms_SelectedPlayer:GetTeam() == ms_LocalPlayer:GetTeam() then
21+
-- if m_AllianceTabContext then
22+
-- m_AllianceTabContext:SetHide(true);
23+
-- end
24+
-- return;
25+
-- end
26+
27+
-- Create tab
28+
local tabAnchor = GetTabAnchor(tabContainer);
29+
if m_AllianceTabContext == nil then
30+
m_AllianceTabContext = ContextPtr:LoadNewContext("DiplomacyActionView_AllianceTab", tabAnchor.Anchor);
31+
else
32+
m_AllianceTabContext:ChangeParent(tabAnchor.Anchor);
33+
end
34+
35+
m_AllianceTabContext:SetHide(false);
36+
37+
-- Create tab button
38+
local tabButtonInstance:table = CreateTabButton();
39+
tabButtonInstance.Button:RegisterCallback( Mouse.eLClick, function() ShowPanel(tabAnchor.Anchor); end );
40+
tabButtonInstance.Button:SetToolTipString(Locale.Lookup("LOC_DIPLOACTION_ALLIANCE_TAB_TOOLTIP"));
41+
tabButtonInstance.ButtonIcon:SetIcon("ICON_STAT_ALLIANCES");
42+
43+
-- Cache references to the button instance and header text on the panel instance
44+
tabAnchor.Anchor.m_ButtonInstance = tabButtonInstance;
45+
tabAnchor.Anchor.m_HeaderText = Locale.ToUpper("LOC_DIPLOACTION_INTEL_REPORT_ALLIANCE");
46+
end

Assets/Expansion2/Replacements/diplomacyactionview_CQUI_expansion2.lua

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,44 @@
33
-- ===========================================================================
44
include("DiplomacyActionView_Expansion2.lua");
55

6-
include("diplomacyactionview_CQUI.lua");
6+
include("diplomacyactionview_CQUI.lua");
7+
8+
-- ===========================================================================
9+
-- MEMBERS
10+
-- ===========================================================================
11+
local m_AllianceTabContext = nil;
12+
13+
-- ===========================================================================
14+
-- CQUI modified AddIntelAlliance function
15+
-- Removed hiding the alliance tab if on the same team
16+
-- ===========================================================================
17+
function AddIntelAlliance(tabContainer:table)
18+
-- CQUI: Comment out the following lines to reveal alliance tab on teams
19+
-- Don't show the alliance tab if we're in a team with the selected player
20+
-- if ms_SelectedPlayer:GetTeam() == ms_LocalPlayer:GetTeam() then
21+
-- if m_AllianceTabContext then
22+
-- m_AllianceTabContext:SetHide(true);
23+
-- end
24+
-- return;
25+
-- end
26+
27+
-- Create tab
28+
local tabAnchor = GetTabAnchor(tabContainer);
29+
if m_AllianceTabContext == nil then
30+
m_AllianceTabContext = ContextPtr:LoadNewContext("DiplomacyActionView_AllianceTab", tabAnchor.Anchor);
31+
else
32+
m_AllianceTabContext:ChangeParent(tabAnchor.Anchor);
33+
end
34+
35+
m_AllianceTabContext:SetHide(false);
36+
37+
-- Create tab button
38+
local tabButtonInstance:table = CreateTabButton();
39+
tabButtonInstance.Button:RegisterCallback( Mouse.eLClick, function() ShowPanel(tabAnchor.Anchor); end );
40+
tabButtonInstance.Button:SetToolTipString(Locale.Lookup("LOC_DIPLOACTION_ALLIANCE_TAB_TOOLTIP"));
41+
tabButtonInstance.ButtonIcon:SetIcon("ICON_STAT_ALLIANCES");
42+
43+
-- Cache references to the button instance and header text on the panel instance
44+
tabAnchor.Anchor.m_ButtonInstance = tabButtonInstance;
45+
tabAnchor.Anchor.m_HeaderText = Locale.ToUpper("LOC_DIPLOACTION_INTEL_REPORT_ALLIANCE");
46+
end

0 commit comments

Comments
 (0)