diff --git a/changelog/snippets/features.6309.md b/changelog/snippets/features.6309.md new file mode 100644 index 0000000000..8e24f0daa3 --- /dev/null +++ b/changelog/snippets/features.6309.md @@ -0,0 +1,16 @@ +- (#6309) The movement speed of transports now changes based on how many and which types of units they have loaded. + - Units slow down transports based on their `TransportSpeedReduction` stat. If a unit has a `TransportSpeedReduction` of 1, each instance of this unit will slow down the transport's `MaxAirspeed` by 1. The primary implication of this change is that the effectiveness of the currently too oppressive Zthuee drops is reduced in an intuitive way. The effectiveness of ACU drops via Tech 2 transports remains unchanged. + + - TransportSpeedReduction: 0.15 (Tech 1 land units) + - TransportSpeedReduction: 0.3 (Tech 2 land units) + - TransportSpeedReduction: 0.6 (Tech 3 land units) + - TransportSpeedReduction: 1 (ACUs and SACUs) + - TransportSpeedReduction: 1 (Tech 4 land units for compatibility with survival maps) + + - To prevent drops from being overnerfed by this change, the speeds of all transports is increased. + + - MaxAirspeed: 10 --> 10.75 (Tech 1 transports) + - MaxAirspeed: 13.5 --> 14.5 (Tech 2 transports) + - MaxAirspeed: 15 --> 17.5 (The Continental) + +- (#6309) Display the `TransportSpeedReduction` stat in the additional unit details displayed when `Show Armament Detail in Build Menu` is enabled in the settings. diff --git a/loc/US/strings_db.lua b/loc/US/strings_db.lua index 48a22e2e95..011f595e2d 100644 --- a/loc/US/strings_db.lua +++ b/loc/US/strings_db.lua @@ -6761,6 +6761,7 @@ uvd_0013="Vision: %d, Underwater Vision: %d, Regen: %0.1f, Cap Cost: %0.1f" uvd_0014="Damage: %.8g - %.8g, Splash: %.3g - %.3g" uvd_0015="Damage: %.8g x%d, Splash: %.3g" uvd_0016="Enhancements: %d" +uvd_0017="Transport Speed Reduction: %.3g" uvd_DPS="(DPS: %d)" uvd_ManualFire="(Manual Fire)" diff --git a/lua/sim/units/AirTransportUnit.lua b/lua/sim/units/AirTransportUnit.lua index 7cb1c8a951..03d3e2b360 100644 --- a/lua/sim/units/AirTransportUnit.lua +++ b/lua/sim/units/AirTransportUnit.lua @@ -75,12 +75,25 @@ AirTransport = ClassUnit(AirUnit, BaseTransport) { end end, + ---@param self AirTransport + ---@param totalweight CargoWeight + ---@param unit Unit + ReduceTransportSpeed = function(self) + local transportspeed = self.Blueprint.Air.MaxAirspeed + local totalweight = 0 + for _, unit in self:GetCargo() do + totalweight = totalweight + unit.Blueprint.Physics.TransportSpeedReduction + end + self:SetSpeedMult(1 - (totalweight / transportspeed)) + end, + ---@param self AirTransport ---@param attachBone Bone ---@param unit Unit OnTransportAttach = function(self, attachBone, unit) AirUnitOnTransportAttach(self, attachBone, unit) BaseTransportOnTransportAttach(self, attachBone, unit) + self:ReduceTransportSpeed() end, ---@param self AirTransport @@ -89,6 +102,7 @@ AirTransport = ClassUnit(AirUnit, BaseTransport) { OnTransportDetach = function(self, attachBone, unit) AirUnitOnTransportDetach(self, attachBone, unit) BaseTransportOnTransportDetach(self, attachBone, unit) + self:ReduceTransportSpeed() end, OnAttachedKilled = function(self, attached) diff --git a/lua/system/blueprints-units.lua b/lua/system/blueprints-units.lua index a5e458f164..82b27676d4 100644 --- a/lua/system/blueprints-units.lua +++ b/lua/system/blueprints-units.lua @@ -161,6 +161,7 @@ local function PostProcessUnit(unit) local isDummy = unit.CategoriesHash['DUMMYUNIT'] local isLand = unit.CategoriesHash['LAND'] local isAir = unit.CategoriesHash['AIR'] + local isNaval = unit.CategoriesHash['NAVAL'] local isBomber = unit.CategoriesHash['BOMBER'] local isGunship = unit.CategoriesHash['GROUNDATTACK'] and isAir and (not isBomber) local isTransport = unit.CategoriesHash['TRANSPORTATION'] @@ -170,6 +171,8 @@ local function PostProcessUnit(unit) local isTech2 = unit.CategoriesHash['TECH2'] local isTech3 = unit.CategoriesHash['TECH3'] local isExperimental = unit.CategoriesHash['EXPERIMENTAL'] + local isACU = unit.CategoriesHash['COMMAND'] + local isSACU = unit.CategoriesHash['SUBCOMMANDER'] -- do not touch guard scan radius values of engineer-like units, as it is the reason we have -- the factory-reclaim-bug that we're keen in keeping that at this point @@ -543,6 +546,27 @@ local function PostProcessUnit(unit) unit.Interface.HelpText = unit.Description or "" --[[@as string]] end + -- Define a specific TransportSpeedReduction for all land and naval units. + -- Experimentals have a TransportSpeedReduction of 1 due to transports gaining 1 speed and some survival maps loading experimentals into transports. + -- Naval units also gain a TransportSpeedReduction of 1 to ensure mod compatibility. + if not unit.Physics.TransportSpeedReduction and not isStructure then + if isLand and isTech1 then + unit.Physics.TransportSpeedReduction = 0.15 + elseif isLand and isTech2 then + unit.Physics.TransportSpeedReduction = 0.3 + elseif isSACU then + unit.Physics.TransportSpeedReduction = 1 + elseif isLand and isTech3 then + unit.Physics.TransportSpeedReduction = 0.6 + elseif isLand and isExperimental then + unit.Physics.TransportSpeedReduction = 1 + elseif isACU then + unit.Physics.TransportSpeedReduction = 1 + elseif isNaval then + unit.Physics.TransportSpeedReduction = 1 + end + end + --------------------------------------------------------------------------- --#region (Re) apply the ability to land on water diff --git a/lua/ui/game/unitviewDetail.lua b/lua/ui/game/unitviewDetail.lua index 39c2ed50b5..4fedc6fbcf 100644 --- a/lua/ui/game/unitviewDetail.lua +++ b/lua/ui/game/unitviewDetail.lua @@ -722,6 +722,14 @@ function WrapAndPlaceText(bp, builder, descID, control) table.insert(lines, LOCF("Speed: %0.1f, Reverse: %0.1f, Acceleration: %0.1f, Turning: %d", bp.Physics.MaxSpeed, bp.Physics.MaxSpeedReverse, bp.Physics.MaxAcceleration, bp.Physics.TurnRate)) end + + -- Display the TransportSpeedReduction stat in the UI. + -- Naval units and land experimentals also have this stat, but it since it is not relevant for non-modded games, we do not display it by default. + -- If a mod wants to display this stat for naval units or experimentals, this file can be hooked. + if bp.Physics.TransportSpeedReduction and not (bp.CategoriesHash.NAVAL or bp.CategoriesHash.EXPERIMENTAL) then + table.insert(lines, LOCF("Transport Speed Reduction: %.3g", + bp.Physics.TransportSpeedReduction)) + end table.insert(blocks, {color = 'FFB0FFB0', lines = lines}) end diff --git a/units/UAA0104/UAA0104_unit.bp b/units/UAA0104/UAA0104_unit.bp index ec3edc4a40..7549813c98 100644 --- a/units/UAA0104/UAA0104_unit.bp +++ b/units/UAA0104/UAA0104_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 13.5, + MaxAirspeed = 14.5, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/UAA0107/UAA0107_unit.bp b/units/UAA0107/UAA0107_unit.bp index 6adda326de..09de0ac31d 100644 --- a/units/UAA0107/UAA0107_unit.bp +++ b/units/UAA0107/UAA0107_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 10, + MaxAirspeed = 10.75, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/UEA0104/UEA0104_unit.bp b/units/UEA0104/UEA0104_unit.bp index a4c5ada817..e27530dcd8 100644 --- a/units/UEA0104/UEA0104_unit.bp +++ b/units/UEA0104/UEA0104_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 13.5, + MaxAirspeed = 14.5, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/UEA0107/UEA0107_unit.bp b/units/UEA0107/UEA0107_unit.bp index 8770899e36..0731ef2d74 100644 --- a/units/UEA0107/UEA0107_unit.bp +++ b/units/UEA0107/UEA0107_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 10, + MaxAirspeed = 10.75, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/URA0104/URA0104_unit.bp b/units/URA0104/URA0104_unit.bp index 195fa33a40..853c0edb1f 100644 --- a/units/URA0104/URA0104_unit.bp +++ b/units/URA0104/URA0104_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 13.5, + MaxAirspeed = 14.5, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/URA0107/URA0107_unit.bp b/units/URA0107/URA0107_unit.bp index 02b55ff9f2..b895e3377e 100644 --- a/units/URA0107/URA0107_unit.bp +++ b/units/URA0107/URA0107_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 10, + MaxAirspeed = 10.75, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/XEA0306/XEA0306_unit.bp b/units/XEA0306/XEA0306_unit.bp index 606eabe4a5..9978056119 100644 --- a/units/XEA0306/XEA0306_unit.bp +++ b/units/XEA0306/XEA0306_unit.bp @@ -22,7 +22,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 7, - MaxAirspeed = 15, + MaxAirspeed = 17.5, StartTurnDistance = 10, TransportHoverHeight = 6, }, diff --git a/units/XSA0104/XSA0104_unit.bp b/units/XSA0104/XSA0104_unit.bp index d62307cc73..1b8dc6c9a7 100644 --- a/units/XSA0104/XSA0104_unit.bp +++ b/units/XSA0104/XSA0104_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 4, LiftFactor = 8, - MaxAirspeed = 13.5, + MaxAirspeed = 14.5, StartTurnDistance = 10, TransportHoverHeight = 4, }, diff --git a/units/XSA0107/XSA0107_unit.bp b/units/XSA0107/XSA0107_unit.bp index 23cd377e1a..1968500684 100644 --- a/units/XSA0107/XSA0107_unit.bp +++ b/units/XSA0107/XSA0107_unit.bp @@ -21,7 +21,7 @@ UnitBlueprint{ KTurn = 2, KTurnDamping = 2, LiftFactor = 8, - MaxAirspeed = 10, + MaxAirspeed = 10.75, StartTurnDistance = 10, TransportHoverHeight = 4, },