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

Ability to tell if a player can fire his weapon (e.g. after reloading) #193

Open
markus-wa opened this issue Mar 25, 2020 · 4 comments
Open

Comments

@markus-wa
Copy link
Owner

markus-wa commented Mar 25, 2020

Originally requested on Gitter by @skilaren

Hi, I have question, is it possible to retrieve somehow info about moment when player switched weapons and cant shoot yet simply? Or I should figure out it within active weapon and enitites' updates info?

...

would like to see some property of player which is related to this switch animation. didn't found any solution so far except counting ticks after active weapon was changed

Higher goal
Be able to tell if a player had the ability to react to being shot. For instance if a player is getting shot while reloading or planting the bomb he has a limited ability to react.

Describe the solution you'd like
Player.IsAbleToFireWeapon()

Describe alternatives you've considered
Player.IsReloadAnimationComplete()

Additional context
So far we haven't found any property on the player entity giving us this information, any help would be very much appreciated.

@billfreeman44
Copy link
Contributor

billfreeman44 commented Mar 11, 2021

Maybe these values in the weapon table would be it? https://github.com/saul/demofile/blob/1849dba325574b221adac92e8f7f650dbb968a0c/src/sendtabletypes.ts#L2319-L2320 Rather than being attached to the player, it might be attached to the weapon, which makes sense to me I guess.

Though there are a few reasons why someone might not be able to shoot their gun, if you want this to be comprehensive:

  • They are in the process of reloading (ammo in clip not refreshed)
  • They are in the process of reloading (ammo in clip is refreshed)
  • Clip is out of ammo
  • Weapon completely out of ammo
  • The player just shot and needs to wait to shoot again (based on the weapon's fire rate)
  • The player just switched to the weapon and is in the process of pulling the weapon out
  • It is freezetime, end of half, end of the match, or another game state where players can't shoot

I can't think of any more :)

EDIT:

  • taking on/off a silencer
  • toggling burst mode?

@markus-wa
Copy link
Owner Author

cheers @billfreeman44 🙏 those props from demofile might come in handy.
I guess it's just really hard to know at what point all scenarios are covered 🤔

Might just start off with better out-of-the-box support for some of those props and take it from there 😄

@saul
Copy link

saul commented Mar 6, 2022

m_flNextPrimaryAttack should cover:

  • deploying weapon
  • reloading weapon
  • just shot (next shot allowed dependent on fire rate)
  • attaching/removing silencer
  • burst mode

But won't cover being out of ammo/freeze time.

@markus-wa
Copy link
Owner Author

thanks @saul - great input!

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

No branches or pull requests

3 participants