Skip to content

Commit

Permalink
beyond-all-reason#3959 Refactored stockpile limits into unit custom p…
Browse files Browse the repository at this point in the history
…arams
  • Loading branch information
83N170 authored and 83N170 committed Dec 4, 2024
1 parent eb6b3cf commit 614b93d
Show file tree
Hide file tree
Showing 51 changed files with 53 additions and 65 deletions.
64 changes: 1 addition & 63 deletions luarules/gadgets/unit_stockpile_limit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,75 +19,13 @@ 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,
local isStockpilingUnitNames = { -- number represents maximum stockpile. Use stockpileLimit customParam which overwrites whatever is set in this table
['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 = {}
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
1 change: 1 addition & 0 deletions units/Legion/legcom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ return {
normaltex = "unittextures/leg_normal.dds",
paralyzemultiplier = 0.025,
subfolder = "",
stockpileLimit = 2,
},
featuredefs = {
dead = {
Expand Down
1 change: 1 addition & 0 deletions units/Scavengers/Air/legmost3.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
1 change: 1 addition & 0 deletions units/Scavengers/Bots/legsrailt4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ return {
normaltex = "unittextures/leg_normal.dds",
subfolder = "Legion/gantry",
techlevel = 3,
stockpileLimit = 3,
},
featuredefs = {
dead = {
Expand Down
Loading

0 comments on commit 614b93d

Please sign in to comment.