Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create capture cost reticle #5948

Merged
merged 18 commits into from
May 12, 2024

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Mar 2, 2024

A capture cost reticle that displays the energy cost, energy rate, and time for the current selection's total buildrate when mousing over non-allied, capturable units.
38

Improvements: Would be nice to be able to directly check if a unit is capturable or if it has a capture rate modifier.
Code-wise, not sure why the teleport reticle was attached to the command mode data, but capture isn't always called with a command mode active (mousing over enemy units tries to capture them) so I can't do that anyway.

@Garanas Garanas added the area: ui Anything to do with the User Interface of the Game label Mar 2, 2024
Copy link
Member

@Garanas Garanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really exciting 😃 !

@lL1l1
Copy link
Contributor Author

lL1l1 commented Mar 3, 2024

How difficult would it be to include capturability in the rollover info?


SetCaptureTimeMultiplier
Multiplies the time it takes to capture a unit, defaults to 1.0. Often used by campaign events.

Isn't this incorrect? It seems like it multiplies the capture time of a unit capturing others, not the capture time of a unit being captured.

fa/lua/sim/Unit.lua

Lines 3979 to 3981 in d38a6fa

local time = ((targetBlueprintEconomy.BuildTime or 10) / self:GetBuildRate()) / 2
local energy = targetBlueprintEconomy.BuildCostEnergy or 100
time = time * (self.CaptureTimeMultiplier or 1)

To "multiply the time it takes to capture a unit" it would have to be time = time * (target.CaptureTimeMultiplier or 1).

@Garanas
Copy link
Member

Garanas commented Mar 3, 2024

How difficult would it be to include capturability in the rollover info?

I'm not certain, we'd need to ask @Hdt80bro or @4z0t about that 😃

Isn't this incorrect? It seems like it multiplies the capture time of a unit capturing others, not the capture time of a unit being captured.

It applies to the engineer that is capturing yes, that would be my mistake in the comment.

@lL1l1
Copy link
Contributor Author

lL1l1 commented Mar 20, 2024

What would be the best way to update the selection when it changes? The selection could change by certain UI actions or more commonly by units dying.

@lL1l1 lL1l1 requested a review from Garanas April 18, 2024 11:59
@arch625
Copy link

arch625 commented Apr 19, 2024

Does it update the reticle to the new total leftover time remaining when you add additional build power later on onto the capture target?

@lL1l1
Copy link
Contributor Author

lL1l1 commented Apr 21, 2024

Does it update the reticle to the new total leftover time remaining when you add additional build power later on onto the capture target?

It doesn't.
I looked into it since it's a good idea, but there's no way UI-side to get info about what units are currently capturing an enemy/neutral unit or the capture progress on that unit.

Copy link
Member

@Garanas Garanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a good improvement, apologies that it took this long to review. Looking at this it may also be interesting to have similar reticle's for the reclaim duration when in reclaim mode and for the total damage per second when in attack mode.

@Garanas Garanas merged commit a9771bb into FAForever:deploy/fafdevelop May 12, 2024
5 checks passed
@lL1l1
Copy link
Contributor Author

lL1l1 commented May 12, 2024

I considered a reclaim cursor (it could be immediately useful analytical info) but an implementation would be incomplete:

  • How do I get the mass/energy of a prop under the cursor when in reclaim mode? Reclaim time is highestCost / (5 * buildrate) as far as I know.
  • Units are set to be unreclaimable/have adjusted reclaim values with scenario scripts (on the map Loki).
makeInvincible = function(unit)
	unit:SetDoNotTarget(true)
	unit:SetCanBeKilled(false)
	unit:SetCapturable(false)
	unit:SetReclaimable(false)
	unit:SetDoNotTarget(true)
	unit:SetMaxHealth(1)
	unit:SetHealth(nil,1)
	unit:SetRegenRate(1)
end

makelowmass = function(unit)
	unit:GetBlueprint().Wreckage.MassMult=0.05
end

I tried making a reclaim cursor with just blueprint values but it doesn't update when the Sim modifies the blueprint like this, and SetReclaimable's effects are inaccessible with rollover info (same issue as SetCapturable).

A DPS cursor seems more appropriate for a UI mod because it's not very useful information and doesn't require any Sim code.

@lL1l1
Copy link
Contributor Author

lL1l1 commented May 12, 2024

@Garanas
Copy link
Member

Garanas commented May 12, 2024

Ah, you're right - these are valid issues. Especially when the (map) script adjusts the values then all bets are off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Anything to do with the User Interface of the Game
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants