Fixes #55 by not letting events play on (dead, world) players.

Fixes a bug in which the bomb would not be removed after the round ends when players killed eachother first.
This commit is contained in:
Marco Cawthorne 2017-11-11 16:13:40 -06:00
parent 3c1f53ac3d
commit 4568b0a31c
6 changed files with 13 additions and 9 deletions

View file

@ -128,20 +128,20 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
if ( fNewArmor > eTarget.armor ) {
fNewArmor = eTarget.armor;
fNewArmor *= (1/0.5);
fNewDmg = iDamage - fNewArmor;
fNewDmg = rint( iDamage - fNewArmor );
eTarget.armor = 0;
eTarget.iEquipment -= EQUIPMENT_KEVLAR;
} else {
if ( fNewArmor < 0 ) {
fNewArmor = 1;
}
eTarget.armor -= fNewArmor;
eTarget.armor = rint( eTarget.armor - fNewArmor );
}
if ( iSkipArmor == TRUE ) {
eTarget.health -= iDamage;
eTarget.health = rint( eTarget.health -= iDamage );
} else {
eTarget.health -= fNewDmg;
eTarget.health = rint( eTarget.health -= fNewDmg );
}
} else {
// No armor

View file

@ -261,7 +261,7 @@ void Player_UseDown( void ) {
traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self);
if ( trace_ent.iUsable ) {
if ( ( trace_ent.classname != "c4bomb" ) && ( trace_ent.classname != "func_pushable" ) ) {
if ( ( trace_ent.weapon == WEAPON_C4BOMB ) && ( trace_ent.classname != "func_pushable" ) ) {
self.flags = ( self.flags - FL_USERELEASED );
sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE );
}

View file

@ -163,9 +163,10 @@ static void WeaponC4BOMB_Think( void ) {
void WeaponC4BOMB_Drop( vector vBombPos ) {
// Do all the dirty entspawning stuff
entity eBomb = spawn();
eBomb.classname = "c4bomb";
eBomb.classname = "remove_me";
eBomb.solid = SOLID_BBOX;
eBomb.weapon = WEAPON_C4BOMB;
setmodel( eBomb, "models/w_c4.mdl" );
setorigin( eBomb, vBombPos );
setsize( eBomb, '-6 -6 0', '6 6 6' );

View file

@ -134,8 +134,9 @@ void Weapon_PrimaryAttack( float fWeapon ) {
#ifdef CSQC
if ( fWeaponEventPlayer != player_localentnum ) {
entity ono = findfloat( world, entnum, fWeaponEventPlayer );
//print( sprintf( "Shooter! Origin: %d %d %d\n", ono.origin_x, ono.origin_y, ono.origin_z ) );
Animation_ShootWeapon( ono );
if ( ono != __NULL__ ) {
Animation_ShootWeapon( ono );
}
return;
}
#endif
@ -176,7 +177,9 @@ void Weapon_Reload( float fWeapon ) {
#ifdef CSQC
if ( fWeaponEventPlayer != player_localentnum ) {
entity ono = findfloat( world, entnum, fWeaponEventPlayer );
Animation_ReloadWeapon( ono );
if ( ono != __NULL__ ) {
Animation_ReloadWeapon( ono );
}
return;
}
#endif

Binary file not shown.

Binary file not shown.