diff --git a/changelog/snippets/balance.6437.md b/changelog/snippets/balance.6437.md new file mode 100644 index 0000000000..c8db082bba --- /dev/null +++ b/changelog/snippets/balance.6437.md @@ -0,0 +1,2 @@ +- (#6437) Automatically rotate Cybran Carrier and Othuum towards their targets when idle or attacking so that all their weapons can fire. + - Units rotate in place while aiming, so formations do not get disrupted. diff --git a/engine/Core/Blueprints/UnitBlueprint.lua b/engine/Core/Blueprints/UnitBlueprint.lua index 8a60a413ca..f994d172a0 100644 --- a/engine/Core/Blueprints/UnitBlueprint.lua +++ b/engine/Core/Blueprints/UnitBlueprint.lua @@ -127,7 +127,9 @@ ---@class UnitBlueprintAI ---- under what angle the unit attacks its target after getting an attack order +--- At what angle (to either side) the unit attacks its target after getting an attack order. +--- If one of the unit's weapons has a target and has `SlavedToBody = true`, it will rotate when idle and attacking. +--- Overrides Weapon `SlavedToBody` and `SlavedToBodyArcRange` behavior. ---@field AttackAngle number --- automatically surface to attack ground targets ---@field AutoSurfaceToAttack boolean diff --git a/engine/Core/Blueprints/WeaponBlueprint.lua b/engine/Core/Blueprints/WeaponBlueprint.lua index 72e96979f5..487f7ec246 100644 --- a/engine/Core/Blueprints/WeaponBlueprint.lua +++ b/engine/Core/Blueprints/WeaponBlueprint.lua @@ -142,10 +142,10 @@ ---@field Flare WeaponBlueprintFlare --- used to force packing up a weapon before being able to fire again ---@field ForceSingleFire? boolean ---- controls what the weapon is allowed to target in reference to the heading of the unit +--- controls what the weapon is allowed to target in reference to the heading of the unit. Defaults to 0 ---@field HeadingArcCenter number --- controls what the weapon is allowed to target in reference to the arc center, ---- this is degrees on either side +--- this is degrees on either side. Defaults to 180 ---@field HeadingArcRange number --- does not consider the weapon when attacking targets if it is disabled ---@field IgnoreIfDisabled? boolean @@ -287,10 +287,12 @@ --- if the weapon goes directly from its `IdleState` to its `RackSalvoFiringState` without --- going through its `RackSalvoFireReadyState` first ---@field SkipReadyState? boolean ---- if the weapon is "slaved" to the unit's body, thus requiring it to face its target to fire +--- If the weapon causes the unit to rotate towards the weapon's target when the target is outside of `SlavedToBodyArcRange`. +--- With multiple slaved weapons, the first slaved weapon in the blueprint that currently has a target is used for turning. +--- If `UnitBlueprintAI.AttackAngle` is true, then this causes the unit to rotate when attacking while idle. ---@field SlavedToBody? boolean ---- Range of arc in both directions to be considered "slaved" to a target. With multiple weapons, ---- the first weapon in the blueprint that currently has a target is used for turning. +--- Degrees to either side of the unit's heading outside of which the weapon will rotate the unit towards the target. +--- Defaults to 1. Behavior gets overriden by `UnitBlueprintAI.AttackAngle`. ---@field SlavedToBodyArcRange? number --- flag to specify to not make the weapon active if the primary weapon has a current target ---@field StopOnPrimaryWeaponBusy? boolean diff --git a/units/URS0303/URS0303_unit.bp b/units/URS0303/URS0303_unit.bp index 105a3c53f7..2967dc1e89 100644 --- a/units/URS0303/URS0303_unit.bp +++ b/units/URS0303/URS0303_unit.bp @@ -248,6 +248,8 @@ UnitBlueprint{ RackSlavedToTurret = true, RangeCategory = "UWRC_AntiAir", RateOfFire = 10/5, --10/integer interval in ticks + SlavedToBody = true, + SlavedToBodyArcRange = 27, TargetPriorities = { "NAVAL MOBILE", "ALLUNITS", @@ -310,6 +312,8 @@ UnitBlueprint{ RackSlavedToTurret = true, RangeCategory = "UWRC_AntiAir", RateOfFire = 10/5, --10/integer interval in ticks + SlavedToBody = true, + SlavedToBodyArcRange = 27, TargetPriorities = { "EXPERIMENTAL", "AIR MOBILE TECH3 BOMBER", @@ -377,6 +381,8 @@ UnitBlueprint{ RackSlavedToTurret = true, RangeCategory = "UWRC_AntiAir", RateOfFire = 10/5, --10/integer interval in ticks + SlavedToBody = true, + SlavedToBodyArcRange = 27, TargetPriorities = { "EXPERIMENTAL", "AIR MOBILE TECH3 BOMBER", @@ -444,6 +450,8 @@ UnitBlueprint{ RackSlavedToTurret = true, RangeCategory = "UWRC_AntiAir", RateOfFire = 10/5, --10/integer interval in ticks + SlavedToBody = true, + SlavedToBodyArcRange = 27, TargetPriorities = { "EXPERIMENTAL", "AIR MOBILE TECH3 BOMBER", diff --git a/units/XSL0303/XSL0303_unit.bp b/units/XSL0303/XSL0303_unit.bp index 643ea273b1..7f65ba3884 100644 --- a/units/XSL0303/XSL0303_unit.bp +++ b/units/XSL0303/XSL0303_unit.bp @@ -248,6 +248,8 @@ UnitBlueprint{ RackSlavedToTurret = false, RangeCategory = "UWRC_DirectFire", RateOfFire = 10/5, --10/integer interval in ticks + SlavedToBody = true, + SlavedToBodyArcRange = 44, TargetPriorities = { "TECH3 MOBILE", "TECH2 MOBILE", @@ -310,6 +312,8 @@ UnitBlueprint{ RackSlavedToTurret = false, RangeCategory = "UWRC_DirectFire", RateOfFire = 10/5, --10/integer interval in ticks + SlavedToBody = true, + SlavedToBodyArcRange = 44, TargetPriorities = { "TECH3 MOBILE", "TECH2 MOBILE", diff --git a/units/XSS0103/XSS0103_unit.bp b/units/XSS0103/XSS0103_unit.bp index dfd19ddadd..63d9a43aba 100644 --- a/units/XSS0103/XSS0103_unit.bp +++ b/units/XSS0103/XSS0103_unit.bp @@ -253,8 +253,6 @@ UnitBlueprint{ FireTargetLayerCapsTable = { Water = "Air" }, FiringRandomness = 0, FiringTolerance = 1, - HeadingArcCenter = 0, - HeadingArcRange = 360, Label = "AntiAir", MaxRadius = 48, MuzzleSalvoDelay = 0,