Skip to content

Commit

Permalink
Display new/more info in unitviewDetail.lua (#6341)
Browse files Browse the repository at this point in the history
1. Improve 'Vision' and 'Speed' column formatting by rounding/removing trailing zeroes/increasing precision.
2. Display 'Scry' and 'Vision Field' abilities of the Eye of Rhianne and Soothsayer and their costs/radius.
3. Show whether a unit can prioritize ACUs via target priorities.
4. Show the `ShieldRechargeTime` stat of personal shields and shield domes.

---------

Co-authored-by: lL1l1 <[email protected]>
  • Loading branch information
Basilisk3 and lL1l1 authored Sep 2, 2024
1 parent 4ecc2ab commit b390029
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
16 changes: 16 additions & 0 deletions changelog/snippets/features.6341.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- (#6341) Improve the formatting of the additional unit details displayed when `Show Armament Detail in Build Menu` is enabled in the settings.

- For example, the Harbinger is now correctly displayed as having a speed of `2.95` instead of `3.0`.

- Additionally, trailing zeroes are removed where possible.

- (#6341) Include more information about unit abilities in the additional unit details displayed when `Show Armament Detail in Build Menu` is enabled in the settings.

- Display the 'Scry' ability of the Eye of Rhianne and the 'Vision' ability of the Soothsayer.

- The radius, activation cost and upkeep of the Eye of Rhianne's 'Scry' ability are now shown.
- The maximum vision radius of the Soothsayer's 'Vision' ability is now shown.

- Display the `ShieldRechargeTime` of personal shields and shield domes. This stat defines the time it takes for shields to recharge after being fully depleted.

- Display whether a unit can prioritize ACUs via the 'Snipemode' feature.
10 changes: 8 additions & 2 deletions loc/US/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3699,6 +3699,7 @@ ability_radar="Radar"
ability_reclaim="Reclaims"
ability_repairs="Repairs"
ability_sacrifice="Sacrifice"
ability_scry="Scry"
ability_shielddome="Shield Dome"
ability_sonar="Sonar"
ability_stealth_sonar="Personal Sonar Stealth"
Expand All @@ -3719,6 +3720,8 @@ ability_flying="Flying"
ability_transportable="Transportable"
ability_building="Building"
ability_capture="Capture"
ability_visionfield="Vision Field"
ability_snipemode_prioritizes_acu="Target Priorities - Can Prioritize ACU"
allyui_0000="Alliance Offer"
build_templates_0000="You may only send build templates with 20 or less buildings."
buildmode_0000="Build Mode"
Expand Down Expand Up @@ -6758,8 +6761,8 @@ uvd_0008="LCH"
uvd_0009="RCH"
uvd_0010="Damage: %.7g, Splash: %.3g"
uvd_0011="Speed: %0.1f, Turning: %0.1f"
uvd_0012="Speed: %0.1f, Reverse: %0.1f, Acceleration: %0.1f, Turning: %d"
uvd_0013="Vision: %d, Underwater Vision: %d, Regen: %0.1f, Cap Cost: %0.1f"
uvd_0012="Speed: %.3g, Reverse: %.3g, Acceleration: %.3g, Turning: %d"
uvd_0013="Vision: %d, Underwater Vision: %d, Regen: %.3g, Cap Cost: %.3g"
uvd_0014="Damage: %.8g - %.8g, Splash: %.3g - %.3g"
uvd_0015="Damage: %.8g x%d, Splash: %.3g"
uvd_0016="Enhancements: %d"
Expand All @@ -6780,10 +6783,13 @@ uvd_UnitSize="Unit Size: %d"
uvd_Capacity="Capacity: "
uvd_RepairRate="Repair Rate: %0.1f"
uvd_Blips="Blips: %d"
uvd_RechargeTime="Recharge Time: %d"
uvd_RegenRate="Regen Rate: %d"
uvd_Delay="Delay: %0.1f"
uvd_basic="Basic"
uvd_upgrades="Upgrades"
uvd_VisionField="Radius: %d"
uvd_Scry="Radius: %d, Activation Cost: %d E, Upkeep: %d E"

at_Default="Default"
at_Normal="Normal"
Expand Down
29 changes: 24 additions & 5 deletions lua/ui/game/unitviewDetail.lua
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ IsAbilityExist = {
ability_omni = function(bp)
return bp.Intel.OmniRadius > 0
end,
ability_visionfield = function(bp)
return bp.Intel.MaxVisionRadius > 0
end,
ability_scry = function(bp)
return bp.Intel.RemoteViewingRadius > 0
and bp.Economy.InitialRemoteViewingEnergyDrain > 0
and bp.Economy.MaintenanceConsumptionPerSecondEnergy > 0
end,
ability_flying = function(bp)
return bp.Air.CanFly
end,
Expand Down Expand Up @@ -334,6 +342,9 @@ IsAbilityExist = {
end,
ability_personal_teleporter = function(bp)
return DecimalToBinary(bp.General.CommandCaps)[12] == 1 -- RULEUCC_Teleport
end,
ability_snipemode_prioritizes_acu = function(bp)
return bp.CategoriesHash.SNIPEMODE
end
}

Expand All @@ -347,6 +358,12 @@ GetAbilityDesc = {
ability_omni = function(bp)
return LOCF('<LOC uvd_Radius>', bp.Intel.OmniRadius)
end,
ability_visionfield = function(bp)
return LOCF('<LOC uvd_VisionField>', bp.Intel.MaxVisionRadius)
end,
ability_scry = function(bp)
return LOCF('<LOC uvd_Scry>', bp.Intel.RemoteViewingRadius, bp.Economy.InitialRemoteViewingEnergyDrain, bp.Economy.MaintenanceConsumptionPerSecondEnergy)
end,
ability_flying = function(bp)
return LOCF("<LOC uvd_0011>Speed: %0.1f, Turning: %0.1f", bp.Air.MaxAirspeed, bp.Air.TurnSpeed)
end,
Expand Down Expand Up @@ -383,11 +400,13 @@ GetAbilityDesc = {
..LOCF('<LOC uvd_Blips>', bp.Intel.JammerBlips)
end,
ability_personalshield = function(bp)
return LOCF('<LOC uvd_RegenRate>', bp.Defense.Shield.ShieldRegenRate)
return LOCF('<LOC uvd_RegenRate>', bp.Defense.Shield.ShieldRegenRate)..', '
..LOCF('<LOC uvd_RechargeTime>', bp.Defense.Shield.ShieldRechargeTime)
end,
ability_shielddome = function(bp)
return LOCF('<LOC uvd_Radius>', bp.Defense.Shield.ShieldSize/2)..', '
..LOCF('<LOC uvd_RegenRate>', bp.Defense.Shield.ShieldRegenRate)
..LOCF('<LOC uvd_RegenRate>', bp.Defense.Shield.ShieldRegenRate)..', '
..LOCF('<LOC uvd_RechargeTime>', bp.Defense.Shield.ShieldRechargeTime)
end,
ability_stealthfield = function(bp)
return LOCF('<LOC uvd_Radius>', bp.Intel.RadarStealthFieldRadius)
Expand Down Expand Up @@ -714,18 +733,18 @@ function WrapAndPlaceText(bp, builder, descID, control)
end
--Other parameters
lines = {}
table.insert(lines, LOCF("<LOC uvd_0013>Vision: %d, Underwater Vision: %d, Regen: %0.1f, Cap Cost: %0.1f",
table.insert(lines, LOCF("<LOC uvd_0013>Vision: %d, Underwater Vision: %d, Regen: %.3g, Cap Cost: %.3g",
bp.Intel.VisionRadius, bp.Intel.WaterVisionRadius, bp.Defense.RegenRate, bp.General.CapCost))

if (bp.Physics.MotionType ~= 'RULEUMT_Air' and bp.Physics.MotionType ~= 'RULEUMT_None')
or (bp.Physics.AltMotionType ~= 'RULEUMT_Air' and bp.Physics.AltMotionType ~= 'RULEUMT_None') then
table.insert(lines, LOCF("<LOC uvd_0012>Speed: %0.1f, Reverse: %0.1f, Acceleration: %0.1f, Turning: %d",
table.insert(lines, LOCF("<LOC uvd_0012>Speed: %.3g, Reverse: %.3g, Acceleration: %.3g, 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 a mod wants to display the TransportSpeedReduction 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("<LOC uvd_0017>Transport Speed Reduction: %.3g",
bp.Physics.TransportSpeedReduction))
Expand Down

0 comments on commit b390029

Please sign in to comment.