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

#3959 Refactored stockpile limits into unit custom params #3994

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
84 changes: 2 additions & 82 deletions luarules/gadgets/unit_stockpile_limit.lua
WatchTheFort marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -19,87 +19,7 @@ if gadgetHandler:IsSyncedCode() then
local StockpileDesiredTarget = {}

local defaultStockpileLimit = 99
local isStockpilingUnitNames = { -- number represents maximum stockpile. You can also use stockpileLimit customParam which overwrites whatever is set in this table
['armmercury'] = 5,
['corscreamer'] = 5,

['armthor'] = 2,

['legmos'] = 8,
['legmost3'] = 8,
['legmineb'] = 1,
['legsrailt4'] = 3,

['armsilo'] = 10,
['corsilo'] = 10,
['legsilo'] = 10,
['cordesolator'] = 10,
['armseadragon'] = 10,


['armamd'] = 20,
['legabm'] = 20,
['corfmd'] = 20,
['raptor_turret_antinuke_t2_v1'] = 5,
['raptor_turret_antinuke_t3_v1'] = 10,

['armjuno'] = 20,
['corjuno'] = 20,

['armcarry'] = 20,
['corcarry'] = 20,

['armantiship'] = 20,
['corantiship'] = 20,

['armscab'] = 20,
['cormabm'] = 20,

['armemp'] = 10,
['cortron'] = 10,
['legperdition'] = 10,

['armbotrail'] = 50,
['armcomlvl2'] = 3,
['armcomlvl3'] = 3,
['armdecomlvl3'] = 1,
['armcomlvl4'] = 3,
['armcomlvl5'] = 4,
['armcomlvl6'] = 4,
['armdecomlvl6'] = 2,
['armcomlvl7'] = 4,
['armcomlvl8'] = 5,
['armcomlvl9'] = 5,
['armcomlvl10'] = 5,
['armdecomlvl10'] = 2,
['legcom'] = 2,
['legcomlvl2'] = 3,
['legcomlvl3'] = 3,
['legdecomlvl3'] = 1,
['legcomlvl4'] = 3,
['legcomlvl5'] = 4,
['legcomlvl6'] = 4,
['legdecomlvl6'] = 2,
['legcomlvl7'] = 4,
['legcomlvl8'] = 5,
['legcomlvl9'] = 5,
['legcomlvl10'] = 5,
['legdecomlvl10'] = 3,

['legstarfall'] = 1,
['legrampart'] = 20,
}
-- convert unitname -> unitDefID + add scavengers
local isStockpilingUnit = {}
for name, params in pairs(isStockpilingUnitNames) do
if UnitDefNames[name] then
isStockpilingUnit[UnitDefNames[name].id] = params
if UnitDefNames[name..'_scav'] then
isStockpilingUnit[UnitDefNames[name..'_scav'].id] = params
end
end
end
isStockpilingUnitNames = nil

----------------------------------------------------------------------------
----------------------------------------------------------------------------
Expand All @@ -112,9 +32,9 @@ if gadgetHandler:IsSyncedCode() then
if ud.canStockpile then
canStockpile[udid] = true
end
if ud.customParams and ud.customParams.stockpileLimit then
if ud.customParams.stockpileLimit then
isStockpilingUnit[udid] = tonumber(ud.customParams.stockpileLimit)
elseif ud.customParams and ud.customParams.stockpilelimit then
elseif ud.customParams.stockpilelimit then
isStockpilingUnit[udid] = tonumber(ud.customParams.stockpilelimit)
end
end
Expand Down
1 change: 1 addition & 0 deletions units/ArmBots/T2/armscab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return {
subfolder = "ArmBots/T2",
techlevel = 2,
unitgroup = "antinuke",
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmBuildings/LandDefenceOffence/armamd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return {
techlevel = 2,
unitgroup = "antinuke",
usebuildinggrounddecal = true,
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmBuildings/LandDefenceOffence/armemp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
unitgroup = "emp",
usebuildinggrounddecal = true,
yardmap = "ooooooo ooooooo ooooooo ooooooo ooooooo ooooooo",
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmBuildings/LandDefenceOffence/armjuno.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ return {
subfolder = "ArmBuildings/LandDefenceOffence",
unitgroup = "weapon",
usebuildinggrounddecal = true,
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmBuildings/LandDefenceOffence/armmercury.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ return {
techlevel = 2,
unitgroup = "aa",
usebuildinggrounddecal = true,
stockpileLimit = 5,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmBuildings/LandDefenceOffence/armsilo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
techlevel = 2,
unitgroup = "nuke",
usebuildinggrounddecal = true,
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmGantry/armthor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ return {
subfolder = "ArmGantry",
techlevel = 3,
unitgroup = "emp",
stockpileLimit = 2,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmShips/T2/armantiship.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ return {
subfolder = "ArmShips/T2",
techlevel = 2,
unitgroup = "antinuke",
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmShips/T2/armcarry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ return {
subfolder = "ArmShips/T2",
techlevel = 2,
unitgroup = "antinuke",
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/ArmShips/T2/armseadragon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ return {
subfolder = "ArmShips/T2",
techlevel = 2,
unitgroup = "nuke",
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorBuildings/LandDefenceOffence/corfmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return {
techlevel = 2,
unitgroup = "antinuke",
usebuildinggrounddecal = true,
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorBuildings/LandDefenceOffence/corjuno.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ return {
subfolder = "CorBuildings/LandDefenceOffence",
unitgroup = "weapon",
usebuildinggrounddecal = true,
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorBuildings/LandDefenceOffence/corscreamer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ return {
techlevel = 2,
unitgroup = "aa",
usebuildinggrounddecal = true,
stockpileLimit = 5,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorBuildings/LandDefenceOffence/corsilo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
techlevel = 2,
unitgroup = "nuke",
usebuildinggrounddecal = true,
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorBuildings/LandDefenceOffence/cortron.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ return {
techlevel = 2,
unitgroup = "weapon",
usebuildinggrounddecal = true,
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorShips/T2/corantiship.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ return {
subfolder = "CorShips/T2",
techlevel = 2,
unitgroup = "antinuke",
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorShips/T2/corcarry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ return {
subfolder = "CorShips/T2",
techlevel = 2,
unitgroup = "antinuke",
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorShips/T2/cordesolator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ return {
subfolder = "CorShips/T2",
techlevel = 2,
unitgroup = "nuke",
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/CorVehicles/T2/cormabm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ return {
subfolder = "CorVehicles/T2",
techlevel = 2,
unitgroup = "antinuke",
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Air/T2 Air/legmineb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ return {
model_author = "Beherith",
normaltex = "unittextures/cor_normal.dds",
subfolder = "CorSeaplanes",
stockpileLimit = 1,
},
sfxtypes = {
crashexplosiongenerators = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Air/legmos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ return {
model_author = "Tharsis",
normaltex = "unittextures/leg_normal.dds",
subfolder = "ArmAircraft",
stockpileLimit = 8,
},
sfxtypes = {
crashexplosiongenerators = {
Expand Down
3 changes: 2 additions & 1 deletion units/Legion/Defenses/legabm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return {
removewait = true,
subfolder = "CorBuildings/LandDefenceOffence",
techlevel = 2,
stockpileLimit = 20,
},
featuredefs = {
dead = {
Expand Down Expand Up @@ -99,7 +100,7 @@ return {
select = {
[1] = "loadwtr1",
},
},
},
weapondefs = {
fmd_rocket = {
areaofeffect = 420,
Expand Down
3 changes: 2 additions & 1 deletion units/Legion/Defenses/legperdition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
removewait = true,
subfolder = "CorBuildings/LandDefenceOffence",
techlevel = 2,
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down Expand Up @@ -185,7 +186,7 @@ return {
default = 2000,--plus 150*15 within 150 area
},
},

},
weapons = {
[1] = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Defenses/legsilo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
removewait = true,
subfolder = "CorBuildings/LandDefenceOffence",
techlevel = 2,
stockpileLimit = 10,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Defenses/legstarfall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ return {
removewait = true,
subfolder = "CorBuildings/LandDefenceOffence",
techlevel = 2,
stockpileLimit = 1,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Economy/legrampart.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ return {
inheritxpratemultiplier = 1,
childreninheritxp = "DRONE",
parentsinheritxp = "DRONE",
stockpileLimit = 20,
},
sfxtypes = {
pieceexplosiongenerators = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl10.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 5,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 3,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 3,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 3,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 4,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl6.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 4,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl7.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 4,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl8.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 5,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Legion/Legion EvoCom/legcomlvl9.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ return {
minimum_respawn_stun = 5,
distance_stun_multiplier = 1,
fall_damage_multiplier = 5,--this ensures commander dies when it hits the ground so effigies can trigger respawn.
stockpileLimit = 5,
},
featuredefs = {
dead = {
Expand Down
Loading