forked from civfanatics/Civ6-UIFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LocalPlayerActionSupport.lua
44 lines (40 loc) · 1.36 KB
/
LocalPlayerActionSupport.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
------------------------------------------------------------------------------
-- Common LUA support functions for helping with user actions
------------------------------------------------------------------------------
-- ===========================================================================
function IsLocalPlayerTurnActive()
local localPlayer = Game.GetLocalPlayer();
if (localPlayer ~= -1) then
local pPlayer = Players[localPlayer];
if pPlayer ~= nil and pPlayer:IsTurnActive() then
return true;
end
end
return false;
end
-- ===========================================================================
function CanLocalPlayerSaveGame()
if UI.HasFeature("Saving") then
if GameConfiguration.IsNetworkMultiplayer() or IsLocalPlayerTurnActive() or WorldBuilder:IsActive() then
return true;
end
end
return false;
end
-- ===========================================================================
function CanLocalPlayerLoadGame()
if UI.HasFeature("Loading") then
if IsLocalPlayerTurnActive()
and not GameConfiguration.IsNetworkMultiplayer() then -- Mechanically, players have to load multiplayer games from the front end.
return true;
end
end
return false;
end
-- ===========================================================================
function CanLocalPlayerChangeOptions()
if UI.HasFeature("Options") then
return true;
end
return false;
end