garrysmod-issues
garrysmod-issues copied to clipboard
GetNextPrimary/SecondaryFire doesn't update for npcs
It gets set to CurTime() when they spawn but doesn't change when they shoot.
To reproduce:
- Spawn an npc with a weapon.
- Look at it and type "lua_run print(Entity(1):GetEyeTrace().Entity:GetActiveWeapon():GetNextPrimaryFire())" in console before and after it shoots and see that it doesn't change.
It's not a bug, NPCs use an internal "shot regulator" that dictates when they can shoot and how often.
For SWEPs it can be controlled via the GetNPC callbacks, such as: https://wiki.facepunch.com/gmod/WEAPON:GetNPCBulletSpread https://wiki.facepunch.com/gmod/WEAPON:GetNPCBurstSettings https://wiki.facepunch.com/gmod/WEAPON:GetNPCRestTimes
I see
The function could be made to be an alias for the lastshot time + lowest rest time for NPCs.