Skip to content

Commit

Permalink
Color sm according to how close your possible supply is to MaxSupply
Browse files Browse the repository at this point in the history
Fix single player only being able to build 200 supply
  • Loading branch information
ForbodingAngel committed Mar 15, 2018
1 parent d81c01b commit ec56cf5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LuaRules/Gadgets/unit_supply_requirement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

--------------------------------------------------------------------------------
Expand Down
11 changes: 10 additions & 1 deletion LuaUI/Widgets_Evo/gui_resourceBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ function generateDisplayList2()
local metalIncomeColor = green
local energyPosNeg = "+"
local metalPosNeg = "+"
local supplyAvailableColor = white
if displayList2 ~= nil then
gl.DeleteList(displayList2)
end
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ec56cf5

Please sign in to comment.