Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#3395 closed enhancement (fixed)

[PATCH] Improve unit actions tooltip

Reported by: bb Owned by: elexis
Priority: Nice to Have Milestone: Alpha 20
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

The unit actions tooltip should improve like the stances in ticket #3385.

Attachments (10)

ticket3394unitactions_1.diff (2.7 KB ) - added by bb 9 years ago.
Changes tooltips in unit_action.js
ticket3394unitactions_2.diff (8.5 KB ) - added by bb 9 years ago.
Improved tooltips and added the repair rate in the attack and armor stats.
ticket3394unitactions_3.diff (8.8 KB ) - added by bb 9 years ago.
Some more improvements (thanks elexis) and added a tooltip for "focus on rally point". I can;t
ticket3394unitactions_3.2.diff (8.8 KB ) - added by bb 9 years ago.
Some more improvements (thanks elexis) and added a tooltip for "focus on rally point".
ticket3395unitactions_4.diff (9.1 KB ) - added by bb 8 years ago.
The repairRatio was messed up in previous patch (printing completly wrong number, should have looked at code better :P). This is printing correct one.
ticket3395unitactions_5.diff (9.1 KB ) - added by bb 8 years ago.
unhunking previous patch
ticket3395unitactions_6.diff (4.3 KB ) - added by bb 8 years ago.
display build rate for foundations in tooltip (and renaming "repairtime" to "repairratio" in cleanup of last commit, since that is the correct name)
ticket3395unitactions_7.diff (4.4 KB ) - added by bb 8 years ago.
ratio --> rate, cleanup from previous commit. Last patch needs to be rebased after this one.
ticket3395unitactions_7.2.diff (4.8 KB ) - added by bb 8 years ago.
use GetRepairRate for repair too
ticket3395unitactions_8.diff (5.0 KB ) - added by bb 8 years ago.
rebased version of 6

Download all attachments as: .zip

Change History (28)

by bb, 9 years ago

Changes tooltips in unit_action.js

comment:1 by elexis, 9 years ago

Component: Core engineUI & Simulation
Description: modified (diff)
Keywords: patch added
Milestone: BacklogAlpha 19
Summary: Improve unit actions tooltip[PATCH] Improve unit actions tooltip

I agree that some of those things could use some explanation. Especially the guard tooltip.

But there should be a newline between the title and the description. Also the title should have a different font size, similar to the unit stance tooltip patch mentioned above:

'[font="sans-bold-16"]' + translate("title") + "[/font]\n" + translate("tooltip")

I'm not sure about the phrasing of the tooltips, someone who can commit it should review them.

Guarding has some special behavior, see UnitAI.js: http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js

// if the attacker is a building and we can repair the guarded, repair it rather than attacking
...
"IDLE": {
"enter": function() {
 // If the unit is guarding/escorting, go back to its duty
...
// if nothing better to do, check if the guarded needs to be healed or repaired

...
UnitAI.prototype.ShouldAbandonChase
// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker

...

UnitAI.prototype.ShouldChaseTargetedEntity
// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker

...

Repairing: See #633, you can now repair ships faster than other buildings, as only a few units actually reach the ship. We shouldn't mention the actual repair rates, but at least mention that ships are being repaired faster. Maybe we should mention the exact repair rate in the tooltip of the selected structure (where also attack damage / range etc. are displayed.).

by bb, 9 years ago

Improved tooltips and added the repair rate in the attack and armor stats.

comment:2 by bb, 9 years ago

Keywords: review added

comment:3 by elexis, 9 years ago

Keywords: review removed

getRepairTimeRatioTooltip:

  • the first three variables are not used
  • please quote object keys
  • "Repair Rate" instead of "Repair rate"
  • "Health" instead of "hp"
  • spaces before and after the slash
  • rate should be called unit, especially in that translated string. detail is the actual rate.

Tooltips in unit_actions.js:

  • "faster for ships then for buildings" => "repair rate depends on structure" (as the behavior might change. also use "than" when comparing)
  • The repair rate could be listed in the structure tree too. Maybe not, as it could become crowded.
  • "Make the selected units idle" => "Cancel all existing orders"
  • "Lock selected units inside" => "Lock selected units inside and shoot arrows from warships and defensive buildings"
  • The guard tooltip should be sufficient.

selection_details.js:

  • if ("repairTimeRatio" in entState && entState.repairTimeRatio) => if (entState.repairTimeRatio). The check above that should also be reducible, but didn't test yet.

Thanks for the work, besides those small stylefixes, I think we could commit it this way.

Does the "Unload" button, that seemingly releases one unit actually exist anywhere? If so tell me. If not, we should remove it in another ticket. [The garrisson button for ships is also currently useless (#3412)]

by bb, 9 years ago

Some more improvements (thanks elexis) and added a tooltip for "focus on rally point". I can;t

by bb, 9 years ago

Some more improvements (thanks elexis) and added a tooltip for "focus on rally point".

in reply to:  3 comment:4 by bb, 9 years ago

Replying to elexis:

getRepairTimeRatioTooltip:

  • the first three variables are not used
  • etc.

Tooltips in unit_actions.js:

  • "faster for ships then for buildings" => "repair rate depends on structure" (as the behavior might change. also use "than" when comparing)
  • etc.

selection_details.js:

  • if ("repairTimeRatio" in entState && entState.repairTimeRatio) => if (entState.repairTimeRatio). The check above that should also be reducible, but didn't test yet.

These things should be changed in the new patch.

Does the "Unload" button, that seemingly releases one unit actually exist anywhere? If so tell me. If not, we should remove it in another ticket.

I can't find a button towards this piece of code, did found some functions only called here. By removing the code nothing seems to crash but I only tried with one soldier in a cc. Also the alert tooltips needs to improve, that will be another ticket.

Last edited 9 years ago by bb (previous) (diff)

comment:5 by bb, 9 years ago

Keywords: review added

comment:6 by Itms, 9 years ago

Milestone: Alpha 19Alpha 20

We are now in Feature Freeze for the A19 version, so we will look at this patch after it is out. Thanks for your work ;)

by bb, 8 years ago

The repairRatio was messed up in previous patch (printing completly wrong number, should have looked at code better :P). This is printing correct one.

by bb, 8 years ago

unhunking previous patch

comment:7 by elexis, 8 years ago

In 17515:

Cleanup tooltips and selection details. Refs #3395.

Use let instead of var.
Quote object keys.
Prefix globals with g_.
Remove some unneeded variables.
Use ternary operator and fat arrow functions.

comment:8 by elexis, 8 years ago

In 17516:

GuiInterface cleanup. Refs #3395.

Simplify GetAverageRangeForBuildings and GetFormationInfoFromTemplate.
Use let instead of var.
Quote object keys.
Remove unneeded braces and variables.
Remove unused variable cmpMirage in L414 and numCleared in L1096.
Add missing semicolon in L637.
Use fat-arrow function.

comment:9 by elexis, 8 years ago

Keywords: simple review removed

The problem with the unit action tooltips is that most of them don't add information and use words that are not used anywhere else, so they shouldn't actually be added.

However I think the guard function could use a tooltip, as UnitAI does some specific things in that case and that we might have the tooltip for defensive arrows. Not sure if it'd be good to have only some actions have tooltips. Maybe ask leper for advice.

I don't see a problem with the repair ratio.

Also I committed some of the cleanups, so the next version of the patch will be smaller.

comment:10 by elexis, 8 years ago

In 17518:

Show the repair-ratio in the tooltip of buildings. Patch by bb, refs #3395.

comment:11 by elexis, 8 years ago

Besides checking the UnitAI tooltips, can you also check if you can display the repair rate of foundations?

by bb, 8 years ago

display build rate for foundations in tooltip (and renaming "repairtime" to "repairratio" in cleanup of last commit, since that is the correct name)

comment:12 by bb, 8 years ago

Keywords: review added

by bb, 8 years ago

ratio --> rate, cleanup from previous commit. Last patch needs to be rebased after this one.

by bb, 8 years ago

use GetRepairRate for repair too

comment:13 by elexis, 8 years ago

In 17580:

Repairrate cleanup. Refs #3395, patch by bb.

Rename ratio to rate.
Simplify translation.
Round in GUI, not simulation.
Check for div/0.
Fix wrong variable name in test_GuiInterface.js.

comment:14 by elexis, 8 years ago

Keywords: review removed

attachment:ticket3395unitactions_6.diff which implements the buildrate tooltip needs the same cleanup.

by bb, 8 years ago

rebased version of 6

comment:15 by bb, 8 years ago

Keywords: review added

comment:16 by elexis, 8 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 17609:

Display the buildrate of foundations in the tooltip. Patch by bb, fixes #3395.

comment:17 by elexis, 8 years ago

Keywords: review removed

Thanks for all the work!

comment:18 by elexis, 8 years ago

In 18463:

Tooltip cleanup.

Use toFixed instead of round hacks, refs #3395.
Show one more digit in the speed tooltip.

Note: See TracTickets for help on using tickets.