Skip to content

Commit

Permalink
New medium transports + other transport stuff in proposed_unit_reworks (
Browse files Browse the repository at this point in the history
#3766)

* New transport stats/armordef

* Move proposed_unit_reworks defs to its own file

* Transport speed is constant w modoption

* New file with proposed_unit_reworks stat changes

* Proposed_unit_reworks description

* Make medium trans buildable
  • Loading branch information
Mitvit authored Sep 23, 2024
1 parent 9d4dc6d commit 2a00d4e
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 56 deletions.
39 changes: 2 additions & 37 deletions gamedata/alldefs_post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1052,43 +1052,8 @@ function UnitDef_Post(name, uDef)
end

if modOptions.proposed_unit_reworks == true then
if name == "corbw" then
uDef.weapondefs.bladewing_lyzer.damage.default = 600
uDef.weapons[1].onlytargetcategory = "SURFACE"
end
if name == "armdfly" then
uDef.weapondefs.armdfly_paralyzer.damage.default = 10500
uDef.weapondefs.armdfly_paralyzer.paralyzetime = 6
uDef.weapondefs.armdfly_paralyzer.beamtime = 0.2
uDef.weapons[1].onlytargetcategory = "SURFACE"
end
if name == "armspid" then
uDef.weapons[1].onlytargetcategory = "SURFACE"
end
if name == "corgator" then
uDef.weapondefs.gator_laserx.damage.vtol = 14
end
if name == "corak" then
uDef.weapondefs.gator_laser.damage.vtol = 7
end
if name == "armpw" then
uDef.weapondefs.emg.damage.vtol = 3
end
if name == "armsh" then
uDef.weapondefs.armsh_weapon.damage.vtol = 7
end
if name == "corsh" then
uDef.weapondefs.armsh_weapon.damage.vtol = 7
end
if uDef.customparams.paralyzemultiplier then
if uDef.customparams.paralyzemultiplier < 0.03 then
uDef.customparams.paralyzemultiplier = 0
elseif uDef.customparams.paralyzemultiplier < 0.5 then
uDef.customparams.paralyzemultiplier = 0.2
else
uDef.customparams.paralyzemultiplier = 1
end
end
local proposed_unit_reworks = VFS.Include("unitbasedefs/proposed_unit_reworks_defs.lua")
uDef = proposed_unit_reworks.proposed_unit_reworksTweaks(name, uDef)
end

--Lategame Rebalance
Expand Down
36 changes: 19 additions & 17 deletions luarules/gadgets/unit_transports_air_speed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,29 @@ local function updateAllowedSpeed(transportId)
local tunitdefcustom
local iscom = false
local transportspeedmult = 0.0
if units then
for _,tUnitId in pairs(units) do
tunitdefid = spGetUnitDefID(tUnitId)
tunitdefcustom = UnitDefs[tunitdefid].customParams
if (tunitdefcustom ~=nil) then
transportspeedmult = tunitdefcustom.transportspeedmult ~=nil and tunitdefcustom.transportspeedmult or transportspeedmult--use custom if present (can be tweaked)
iscom = tunitdefcustom.iscommander=='1'
if Spring.GetModOptions().proposed_unit_reworks == false then
if units then
for _,tUnitId in pairs(units) do
tunitdefid = spGetUnitDefID(tUnitId)
tunitdefcustom = UnitDefs[tunitdefid].customParams
if (tunitdefcustom ~=nil) then
transportspeedmult = tunitdefcustom.transportspeedmult ~=nil and tunitdefcustom.transportspeedmult or transportspeedmult--use custom if present (can be tweaked)
iscom = tunitdefcustom.iscommander=='1'
end

currentMassUsage = currentMassUsage + unitMass[tunitdefid]
end

currentMassUsage = currentMassUsage + unitMass[tunitdefid]
end
massUsageFraction = (currentMassUsage / unitTransportMass[uDefID])
massUsageFraction = (currentMassUsage / unitTransportMass[uDefID])

if (iscom) then
if (iscom) then

allowedSpeed = unitSpeed[uDefID] * (1 - massUsageFraction * (TRANSPORTED_MASS_SPEED_PENALTY+transportspeedmult)) / FRAMES_PER_SECOND
else
allowedSpeed = unitSpeed[uDefID] * (1 - massUsageFraction * TRANSPORTED_MASS_SPEED_PENALTY) / FRAMES_PER_SECOND
--Spring.Echo("unit "..transportUnitDef.name.." is air transport at "..(massUsageFraction*100).."%".." load, curSpeed="..vw.." allowedSpeed="..allowedSpeed)
allowedSpeed = unitSpeed[uDefID] * (1 - massUsageFraction * (TRANSPORTED_MASS_SPEED_PENALTY+transportspeedmult)) / FRAMES_PER_SECOND
else
allowedSpeed = unitSpeed[uDefID] * (1 - massUsageFraction * TRANSPORTED_MASS_SPEED_PENALTY) / FRAMES_PER_SECOND
--Spring.Echo("unit "..transportUnitDef.name.." is air transport at "..(massUsageFraction*100).."%".." load, curSpeed="..vw.." allowedSpeed="..allowedSpeed)
end
airTransportMaxSpeeds[transportId] = allowedSpeed
end
airTransportMaxSpeeds[transportId] = allowedSpeed
end
end

Expand Down
4 changes: 2 additions & 2 deletions modoptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1282,9 +1282,9 @@ local options = {
{
key = "proposed_unit_reworks",
name = "Proposed Unit Reworks",
desc = "Modoption used to test and balance unit reworks that are being considered for the base game. Shuriken emp damage is reduced and Abductor emp damage and stuntime are reduced, but accuracy is increased. EMP resist for units is standardized, and units that had low emp resists now take full emp damage.",
desc = "Modoption used to test and balance unit reworks that are being considered for the base game. Shuriken emp damage is reduced and Abductor emp damage and stuntime are reduced, but accuracy is increased. EMP resist for units is standardized, and units that had low emp resists now take full emp damage. Heavier T1 transport added, light T1 transports cheaper but can carry only 750mass units. T2 transports carry only single unit, Skyhook speed/buildtime/LoS buffed. T3 and heavy T2 units mass reduced (now equals their m cost), Liche impulse nerfed.",
type = "bool",
hidden = true,
--hidden = true,
section = "options_experimental",
def = false,
},
Expand Down
85 changes: 85 additions & 0 deletions unitbasedefs/proposed_unit_reworks_defs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
local function proposed_unit_reworksTweaks(name, uDef)
if name == "corbw" then
uDef.weapondefs.bladewing_lyzer.damage.default = 600
uDef.weapons[1].onlytargetcategory = "SURFACE"
end
if name == "armdfly" then
uDef.weapondefs.armdfly_paralyzer.damage.default = 10500
uDef.weapondefs.armdfly_paralyzer.paralyzetime = 6
uDef.weapondefs.armdfly_paralyzer.beamtime = 0.2
uDef.weapons[1].onlytargetcategory = "SURFACE"
end
if name == "armspid" then
uDef.weapons[1].onlytargetcategory = "SURFACE"
end
if name == "corgator" then
uDef.weapondefs.gator_laserx.damage.vtol = 14
end
if name == "corak" then
uDef.weapondefs.gator_laser.damage.vtol = 7
end
if name == "armpw" then
uDef.weapondefs.emg.damage.vtol = 3
end
if name == "armsh" then
uDef.weapondefs.armsh_weapon.damage.vtol = 7
end
if name == "corsh" then
uDef.weapondefs.armsh_weapon.damage.vtol = 7
end
if uDef.customparams.paralyzemultiplier then
if uDef.customparams.paralyzemultiplier < 0.03 then
uDef.customparams.paralyzemultiplier = 0
elseif uDef.customparams.paralyzemultiplier < 0.5 then
uDef.customparams.paralyzemultiplier = 0.2
else
uDef.customparams.paralyzemultiplier = 1
end
end

if uDef.mass == 200000 or uDef.mass == 2000000 or uDef.mass == 100000 or uDef.mass == 999999995904 then
uDef.mass = uDef.metalcost
uDef.cantbetransported = true
end
if uDef.mass then
if uDef.mass > 4899 and uDef.mass < 5002 then
uDef.mass = uDef.metalcost
end
end

if name == "armliche" then
uDef.weapondefs.arm_pidr.impulsefactor = 1
end

if name == "corvalk" then
uDef.transportmass = 750
uDef.energycost = 1450
uDef.buildtime = 4120
end
if name == "armatlas" then
uDef.transportmass = 750
uDef.energycost = 1300
uDef.buildtime = 3850
end
if name == "corseah" then
uDef.speed = 235
uDef.sightdistance = 500
uDef.transportcapacity = 1
uDef.buildtime = 10000
end
if name == "armdfly" then
uDef.transportcapacity = 1
end
if name == "armap" then
uDef.buildoptions[7] = "armhvytrans"
end
if name == "corap" then
uDef.buildoptions[7] = "corhvytrans"
end

return uDef
end

return {
proposed_unit_reworksTweaks = proposed_unit_reworksTweaks,
}

0 comments on commit 2a00d4e

Please sign in to comment.