From ec56cf530d95e31bceff2c680331c7dee511613b Mon Sep 17 00:00:00 2001 From: Forboding Angel Date: Wed, 14 Mar 2018 20:38:23 -0700 Subject: [PATCH] Color sm according to how close your possible supply is to MaxSupply Fix single player only being able to build 200 supply --- LuaRules/Gadgets/unit_supply_requirement.lua | 2 +- LuaUI/Widgets_Evo/gui_resourceBar.lua | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/LuaRules/Gadgets/unit_supply_requirement.lua b/LuaRules/Gadgets/unit_supply_requirement.lua index 039fea60e..c8acc2ff0 100644 --- a/LuaRules/Gadgets/unit_supply_requirement.lua +++ b/LuaRules/Gadgets/unit_supply_requirement.lua @@ -34,7 +34,7 @@ local spSetTeamRulesParam = Spring.SetTeamRulesParam -------------------------------------------------------------------------------- -- Configuration -local SUPPLY_CAP = tonumber(Spring.GetModOptions().supplycap) or 200 +local SUPPLY_CAP = tonumber(Spring.GetModOptions().supplycap) or 400 local INTRINSIC_SUPPLY = tonumber(Spring.GetModOptions().intrinsicsupply) or 0 -------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_resourceBar.lua b/LuaUI/Widgets_Evo/gui_resourceBar.lua index 0755d6eb1..6b12d2442 100644 --- a/LuaUI/Widgets_Evo/gui_resourceBar.lua +++ b/LuaUI/Widgets_Evo/gui_resourceBar.lua @@ -388,6 +388,7 @@ function generateDisplayList2() local metalIncomeColor = green local energyPosNeg = "+" local metalPosNeg = "+" + local supplyAvailableColor = white if displayList2 ~= nil then gl.DeleteList(displayList2) end @@ -450,7 +451,15 @@ function generateDisplayList2() supplyUsedColor = red end end - supplyStr = supplyUsedColor .. su .. white .. "/" .. sm .. " " + if sm < maxSupply * 0.50 then + supplyAvailableColor = orange + elseif sm < maxSupply then + supplyAvailableColor = yellow + elseif sm == maxSupply then + supplyAvailableColor = green + end + + supplyStr = supplyUsedColor .. su .. white .. "/" .. supplyAvailableColor .. sm .. " " else supplyStr = white .. su .. "/" .. sm .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. maxSupply .. white .. ") " end