NSWeapon: fix punchangle, add cvar g_infiniteAmmo

This commit is contained in:
Marco Cawthorne 2024-07-26 11:44:51 -07:00
parent 52af82b985
commit 760bc4a8fa
Signed by: eukara
GPG key ID: CE2032F0A2882A22
7 changed files with 16 additions and 3 deletions

View file

@ -47,6 +47,7 @@ entityDef weapon_pistol
"fireRate" ".2" "fireRate" ".2"
"snd_fire" "weapon_pistol.fire"
"actFire" "14,16" "actFire" "14,16"
"actFireLast" "15,17" "actFireLast" "15,17"
"actReload" "8" "actReload" "8"

View file

@ -11,4 +11,3 @@ step_default.right
footstep footstep
sample common/null.wav sample common/null.wav
} }

View file

@ -18,7 +18,9 @@ weapon_bat.miss
weapon_pistol.fire weapon_pistol.fire
{ {
alerts alerts
sample weapons/pl_gun3.wav pitch_min 0.95
pitch_max 1.05
sample weapons/pistol_fire.wav
} }
weapon_frag.bounce weapon_frag.bounce

Binary file not shown.

View file

@ -14,6 +14,9 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* TODO: serverinfo based checks for prediction reasons */
var bool autocvar_g_infiniteAmmo = false;
var bool autocvar_ai_debugNav = false; var bool autocvar_ai_debugNav = false;
void void
_NSNavAI_Log(string className, string functionName, float edictNum, string warnMessage) _NSNavAI_Log(string className, string functionName, float edictNum, string warnMessage)

View file

@ -598,6 +598,10 @@ NSNavAI::GiveAmmo(int ammoType, int ammoAmount)
bool bool
NSNavAI::UseAmmo(int ammoType, int ammoAmount) NSNavAI::UseAmmo(int ammoType, int ammoAmount)
{ {
if (autocvar_g_infiniteAmmo == true) {
return (true);
}
/* bounds check */ /* bounds check */
if (HasAmmo(ammoType, ammoAmount) == false) if (HasAmmo(ammoType, ammoAmount) == false)
return (false); return (false);

View file

@ -680,6 +680,10 @@ NSWeapon::UseAmmo(string fireInfo)
{ {
NSClientPlayer ourOwner = (NSClientPlayer)GetOwner(); NSClientPlayer ourOwner = (NSClientPlayer)GetOwner();
if (autocvar_g_infiniteAmmo == true) {
return (true);
}
if (m_fiAmmoRequired) { if (m_fiAmmoRequired) {
/* this weapon uses a clip/magazine */ /* this weapon uses a clip/magazine */
if (m_iClipSize && m_fiAmmoType == m_primaryAmmoType) { if (m_iClipSize && m_fiAmmoType == m_primaryAmmoType) {
@ -868,7 +872,7 @@ NSWeapon::Attack(string fireInfo)
return; return;
} }
ourOwner.punchangle = m_fiPunchAngle; ourOwner.punchangle += m_fiPunchAngle;
#ifdef SERVER #ifdef SERVER
v_angle = input_angles; v_angle = input_angles;