-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 attack delay to weapon throwing #34903
base: master
Are you sure you want to change the base?
Add attack delay to weapon throwing #34903
Conversation
Code looks good and works as intended. |
I'm sure a simple "You can't throw this item yet!" or something along those lines would tell the player that the block is intended. |
Having the melee weapon cooldown show up as a doafter circle in the hand slot would work as well, but I think the cooldown is currently using its own implementation for that. |
It's worth noting there are fairly few weapons where you'd consider throwing after hitting, so any overarching attack cooldown changes are probably not necessary. I will look into improving the UX though! |
The do-after is representing the amount of time it really takes to complete an attack. So in-universe the reason you can't throw the weapon should be because you're still mid-swing. Realistically a throw is also an attack, so it makes sense without additional UX, IMO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good; change makes sense.
UX improvement would be nice. Could be added here or separately.
// Give it a l'il spin. | ||
// Give it a li'l spin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely vital change! 😄
I have looked into this further and there are some minor not-so-good feeling stuff with it. E.g. if you swing a crowbar there is a 1 second window before you can throw it, which just doesn't feel good. I tried a pop-up but that honestly didn't seem to solve anything. It's a crowbar, why shouldn't I be able to just throw it? So I am pivoting with the code. Instead of having a general Then I'll add a general |
It was a wee bit trickier than I would've liked (why is Note that I also fixed an imperceptible bug where disarm attempts would fail if the target was experiencing a throw cooldown. Since weapon swings now cause a throw cooldown, this was necessary to change - disarms simply bypass the throw timer check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -213,4 +216,23 @@ private void HandleExamined(EntityUid examinedUid, HandsComponent handsComp, Exa | |||
args.PushMarkup(Loc.GetString(locKey, locUser, locItems)); | |||
} | |||
} | |||
|
|||
/// <summary> | |||
/// Resets the throw cooldown to allow for throwing, and optionally sets a new throw tim if given. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Resets the throw cooldown to allow for throwing, and optionally sets a new throw tim if given. | |
/// Resets the throw cooldown to allow for throwing, and optionally sets a new throw time if given. |
About the PR
This PR restricts melee throwing weapons after using them to melee attack, requiring the user to wait out the melee cooldown before being able to throw.
Unarmed attacks are exempted from this.
Why / Balance
Doing a melee swing and then throwing is a technique most commonly seen used in conjunction with stunbatons, as it reduces the normal 2 second stamcrit time to just 1 second (hit > wait > hit > throw). A 1 second stamcrit is of course too short, so this PR fixes that.
It was kinda annoying to not be able to throw immediately upon missing an unarmed attack, since you might've been trying to pick up the item and misclicked, so it makes an exception for that.
Technical details
At first I just checked the melee swing timer but that ends up being set when you pick up an item, so it added an annoying delay to picking things up from the ground and immediately throwing, which can be important for transporting stuff.
So instead we're subscribing to the
MeleeAttackEvent
and that sets the throw timer instead.Media
Requirements
Breaking changes
Changelog
🆑