Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cruft from unit_buildmenu_config.lua. #3935

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion luaui/configs/buildmenu_sorting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ for id, value in pairs(unitOrderTable) do
end
end
unitOrderTable = newUnitOrder
newUnitOrder = nil

for unitDefID, unitDef in pairs(UnitDefs) do
if unitDef.customParams.isscavenger then
Expand Down
29 changes: 8 additions & 21 deletions luaui/configs/unit_buildmenu_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
---


local unitName = {}
local unitEnergyCost = {}
local unitMetalCost = {}
local unitGroup = {}
Expand All @@ -18,8 +17,6 @@ local isWaterUnit = {}
local isGeothermal = {}
local unitMaxWeaponRange = {}

local showWaterUnits = false

for unitDefID, unitDef in pairs(UnitDefs) do

unitGroup[unitDefID] = unitDef.customParams.unitgroup
Expand Down Expand Up @@ -138,20 +135,14 @@ maxOrder = maxOrder + 1
-- For units who have the same order value we compare the unit's IDs.
-- This sort is always stable, as no two units should have the same ID.
table.sort(unitOrder, function(aID, bID)
local aOrder = unitOrderManualOverrideTable[aID] or maxOrder
local bOrder = unitOrderManualOverrideTable[bID] or maxOrder

if (aOrder == bOrder) then
return aID < bID
end
return aOrder < bOrder
end)

local voidWater = false
local success, mapinfo = pcall(VFS.Include,"mapinfo.lua") -- load mapinfo.lua confs
if success and mapinfo then
voidWater = mapinfo.voidwater
end
local aOrder = unitOrderManualOverrideTable[aID] or maxOrder
local bOrder = unitOrderManualOverrideTable[bID] or maxOrder

if (aOrder == bOrder) then
return aID < bID
end
return aOrder < bOrder
end)

local minWaterUnitDepth = -11

Expand All @@ -161,8 +152,6 @@ local minWaterUnitDepth = -11
------------------------------------

return {

unitName = unitName,
unitEnergyCost = unitEnergyCost,
unitMetalCost = unitMetalCost,
unitGroup = unitGroup,
Expand All @@ -179,8 +168,6 @@ return {
minWaterUnitDepth = minWaterUnitDepth,
unitOrder = unitOrder,

showWaterUnits = showWaterUnits,

checkGeothermalFeatures = checkGeothermalFeatures,
restrictGeothermalUnits = restrictGeothermalUnits,
restrictWindUnits = restrictWindUnits,
Expand Down