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

Add InitialDelay to CashTrickler and add CashTricklerBar #14026

Merged
merged 3 commits into from Oct 6, 2017

Conversation

Projects
None yet
3 participants
@MustaphaTR
Member

MustaphaTR commented Sep 15, 2017

Fixes #14022 and also adds a CashTricklerBar trait.

Show outdated Hide outdated OpenRA.Mods.Common/Traits/CashTrickler.cs Outdated
Show outdated Hide outdated OpenRA.Mods.Common/Traits/CashTrickler.cs Outdated
Show outdated Hide outdated OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs Outdated
Show outdated Hide outdated OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs Outdated
@MustaphaTR

This comment has been minimized.

Show comment
Hide comment
@MustaphaTR

MustaphaTR Sep 16, 2017

Member

Updated.

Member

MustaphaTR commented Sep 16, 2017

Updated.

@MustaphaTR

This comment has been minimized.

Show comment
Hide comment
@MustaphaTR

MustaphaTR Sep 21, 2017

Member

Updated.

Previous code were crashing when all CashTricklers were disabled. I changed CashTrickler to Pausable conditional, disabling it now resets Ticks=, pausing doesn't. CashTricklerBar no longer checks for IsTraitDisabled, as it would return to 0 anyway as Ticks = Interval when CashTrickler is disabled.

Member

MustaphaTR commented Sep 21, 2017

Updated.

Previous code were crashing when all CashTricklers were disabled. I changed CashTrickler to Pausable conditional, disabling it now resets Ticks=, pausing doesn't. CashTricklerBar no longer checks for IsTraitDisabled, as it would return to 0 anyway as Ticks = Interval when CashTrickler is disabled.

@pchote

Works as advertised, and code looks good aside from a couple of minor nits:

Show outdated Hide outdated OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs Outdated
return 0;
var complete = cashTricklers.Min(ct => (float)ct.Ticks / ct.Info.Interval);
return 1 - complete;

This comment has been minimized.

@pchote

pchote Oct 1, 2017

Member

ct.Ticks / ct.Info.Interval is always between 0 and 1, so this can be simplified to return cashTricklers.Max(ct => (float)ct.Ticks / ct.Info.Interval); Scratch that - this is wrong.

@pchote

pchote Oct 1, 2017

Member

ct.Ticks / ct.Info.Interval is always between 0 and 1, so this can be simplified to return cashTricklers.Max(ct => (float)ct.Ticks / ct.Info.Interval); Scratch that - this is wrong.

@reaperrr reaperrr merged commit 2102fad into OpenRA:bleed Oct 6, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@reaperrr

This comment has been minimized.

Show comment
Hide comment
@reaperrr
Contributor

reaperrr commented Oct 6, 2017

@MustaphaTR MustaphaTR deleted the MustaphaTR:cash-trickler-stuff branch Oct 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment