Skip to content

Commit

Permalink
Fix for Hotseat Multiplayer
Browse files Browse the repository at this point in the history
Builder lens will properly hightlight plots when in hotseat multiplayer.
  • Loading branch information
astog committed Jan 17, 2020
1 parent ed57374 commit 926e86b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Lenses/ModLens_Builder_Config_Default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ end
-- Add rules for builder lens
-- ===========================================================================

local localPlayer = Game.GetLocalPlayer()
local pPlayer:table = Players[localPlayer]

local m_NothingColor:number = UI.GetColorValue("COLOR_NOTHING_BUILDER_LENS")
local m_ResourceColor:number = UI.GetColorValue("COLOR_RESOURCE_BUILDER_LENS")
local m_DamagedColor:number = UI.GetColorValue("COLOR_DAMAGED_BUILDER_LENS")
Expand All @@ -413,6 +410,7 @@ local m_GenericColor:number = UI.GetColorValue("COLOR_GENERIC_BUILDER_LENS")
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_NothingColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
if pPlot:GetOwner() == localPlayer then
if pPlot:IsNationalPark() then
return m_NothingColor
Expand All @@ -426,6 +424,7 @@ table.insert(g_ModLenses_Builder_Config[m_NothingColor],
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_DamagedColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
if pPlot:GetOwner() == localPlayer and not plotHasDistrict(pPlot) then
if plotHasImprovement(pPlot) and pPlot:IsImprovementPillaged() then
return m_DamagedColor
Expand All @@ -439,6 +438,8 @@ table.insert(g_ModLenses_Builder_Config[m_DamagedColor],
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_ResourceColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
local pPlayer:table = Players[localPlayer]
if pPlot:GetOwner() == localPlayer and not plotHasDistrict(pPlot) then
if playerHasDiscoveredResource(pPlayer, pPlot) then
if plotHasImprovement(pPlot) then
Expand Down Expand Up @@ -474,6 +475,8 @@ table.insert(g_ModLenses_Builder_Config[m_ResourceColor],
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_RecommendedColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
local pPlayer:table = Players[localPlayer]
if pPlot:GetOwner() == localPlayer and not plotHasDistrict(pPlot) and not plotHasImprovement(pPlot) then
if plotHasFeature(pPlot) then
local featureInfo = GameInfo.Features[pPlot:GetFeatureType()]
Expand Down Expand Up @@ -519,6 +522,8 @@ table.insert(g_ModLenses_Builder_Config[m_RecommendedColor],
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_RecommendedColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
local pPlayer:table = Players[localPlayer]
if pPlot:GetOwner() == localPlayer and not plotHasDistrict(pPlot) and not plotHasImprovement(pPlot) then
-- If the plot has a feature, and we cannot extract it then ignore it
if plotHasFeature(pPlot) and not playerCanRemoveFeature(pPlayer, pPlot) then
Expand All @@ -538,6 +543,8 @@ table.insert(g_ModLenses_Builder_Config[m_RecommendedColor],
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_FeatureColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
local pPlayer:table = Players[localPlayer]
if pPlot:GetOwner() == localPlayer and not plotHasDistrict(pPlot) and plotHasFeature(pPlot) and not plotHasImprovement(pPlot) then
if playerCanRemoveFeature(pPlayer, pPlot) then
return m_FeatureColor
Expand All @@ -555,6 +562,8 @@ table.insert(g_ModLenses_Builder_Config[m_FeatureColor],
--------------------------------------
table.insert(g_ModLenses_Builder_Config[m_GenericColor],
function(pPlot)
local localPlayer = Game.GetLocalPlayer()
local pPlayer:table = Players[localPlayer]
if pPlot:GetOwner() == localPlayer and not plotHasImprovement(pPlot) then

-- Mountains, natural wonders, etec
Expand Down

0 comments on commit 926e86b

Please sign in to comment.