feat(warhead)!: Warhead.RemainingCooldown and WarheadStatus.OnCooldown#759
feat(warhead)!: Warhead.RemainingCooldown and WarheadStatus.OnCooldown#759Unbistrackted wants to merge 7 commits intoExMod-Team:devfrom
Warhead.RemainingCooldown and WarheadStatus.OnCooldown#759Conversation
Change from ternary operators for readability Add case for ``WarheadStatus.OnCooldown``
Warhead.RemainingCooldown and WarheadStatus.OnCooldownWarhead.RemainingCooldown and WarheadStatus.OnCooldown
As per @louis1706 recommendation
Warhead.RemainingCooldown and WarheadStatus.OnCooldownWarhead.RemainingCooldown and WarheadStatus.OnCooldown
| @@ -115,6 +142,10 @@ public static WarheadStatus Status | |||
| case WarheadStatus.Detonated: | |||
| Detonate(); | |||
| break; | |||
|
|
|||
| case WarheadStatus.OnCooldown: | |||
| RemainingCooldown = Controller._cooldown; | |||
| break; | |||
| } | |||
There was a problem hiding this comment.
Thx for pointing that out, forgot abt it
btw I'm using the .HasFlagsFast extension, I remember using it once on one my projects, hope this isn't a problem
|
I dont get this, can the warhead be in multiple states or something? If not, why do we have its enum be flags? |
|
The warhead can be armed and on cooldown at the same time for example I think it's better this way, rather than representing a single state Armed, OnCooldown |
|
as was pointed out to me a while ago by somebody I forgot, the setter for warhead actually doesnt work here because if you do something like Warhead.Status = Warhead.Status after nuke blows up, it'd just retrigger the nuke no? You're going to need to check for changes in each flag between the old and new values I think, at that rate though you might want to start using bitwise operators in your if checks like |
Description
Describe the changes
Add
OnCooldownforWarheadStatus, which I implemented it's logic intoWarhead.Status+ changed the ternary operators to if statements so it's more easy to readAdd
Warhead.RemainingCooldownso you don't have to use NetworkTime.time to change the cooldownWhat is the current behavior? (You can also link to an open issue here)
What is the new behavior? (if this is a feature change)
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Other information:
I forgot to add
WarheadStatus.OnCooldownin the last pull requestTypes of changes
Submission checklist
Patches (if there are any changes related to Harmony patches)
Other