Fix phantom electrical discharge

Fixed the bug causes electricity to arc across the map for clients out of replication range of the electrocuted player
This commit is contained in:
RGreenlees 2024-04-04 16:00:56 +01:00 committed by pierow
parent 56f992b6fe
commit 44a1072fb3

View file

@ -1226,24 +1226,26 @@ void AvHBaseBuildable::WorldUpdate()
if(theBaseEntity->TakeDamage(this->pev, theAttacker->pev, BALANCE_VAR(kElectricalDamage), DMG_GENERIC) > 0)
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE(TE_BEAMENTPOINT);
WRITE_SHORT(theBaseEntity->entindex());
WRITE_COORD( this->pev->origin.x);
WRITE_COORD( this->pev->origin.y);
WRITE_COORD( this->pev->origin.z);
WRITE_SHORT( this->mElectricalSprite );
WRITE_BYTE( 0 ); // framestart
WRITE_BYTE( (int)15); // framerate
WRITE_BYTE( (int)(2) ); // life
WRITE_BYTE( 60 ); // width
WRITE_BYTE( 15 ); // noise
WRITE_BYTE( (int)this->pev->rendercolor.x ); // r, g, b
WRITE_BYTE( (int)this->pev->rendercolor.y ); // r, g, b
WRITE_BYTE( (int)this->pev->rendercolor.z ); // r, g, b
WRITE_BYTE( 200 ); // brightness
WRITE_BYTE( 10 ); // speed
MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(TE_BEAMPOINTS);
WRITE_COORD(this->pev->origin.x);
WRITE_COORD(this->pev->origin.y);
WRITE_COORD(this->pev->origin.z);
WRITE_COORD(theBaseEntity->pev->origin.x);
WRITE_COORD(theBaseEntity->pev->origin.y);
WRITE_COORD(theBaseEntity->pev->origin.z);
WRITE_SHORT(this->mElectricalSprite);
WRITE_BYTE(0); // framestart
WRITE_BYTE((int)15); // framerate
WRITE_BYTE((int)(2)); // life
WRITE_BYTE(60); // width
WRITE_BYTE(15); // noise
WRITE_BYTE((int)this->pev->rendercolor.x); // r, g, b
WRITE_BYTE((int)this->pev->rendercolor.y); // r, g, b
WRITE_BYTE((int)this->pev->rendercolor.z); // r, g, b
WRITE_BYTE(200); // brightness
WRITE_BYTE(10); // speed
MESSAGE_END();
gSoundListManager.PlaySoundInList(kElectricSparkSoundList, this, CHAN_AUTO, .7f);