From cf12afee73505cccce72a2ad35b0fe0d28a8c4bd Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Thu, 7 Sep 2023 18:17:38 +0100 Subject: [PATCH 1/3] prevent client-side crash in MFD --- .../mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut index 659dbb7a3..86d352794 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut @@ -188,9 +188,15 @@ void function UpdateMarksForKill( entity victim, entity attacker, var damageInfo { if ( victim == GetMarked( victim.GetTeam() ) ) { - MessageToAll( eEventNotifications.MarkedForDeathKill, null, victim, attacker.GetEncodedEHandle() ) + // handle suicides. Not sure what the actual message is that vanilla shows for this + // but this will prevent crashing for now + entity actualAttacker = attacker + if ( IsSuicide( victim, attacker, DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) ) + actualAttacker = victim + + MessageToAll( eEventNotifications.MarkedForDeathKill, null, victim, actualAttacker.GetEncodedEHandle() ) svGlobal.levelEnt.Signal( "MarkKilled", { mark = victim } ) - + if ( attacker.IsPlayer() ) attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 ) } From a14044b8602ef33d3e52134043b17606e607d5f6 Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:03:07 +0100 Subject: [PATCH 2/3] ternary operator my beloved --- .../mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut index 86d352794..0916397a0 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut @@ -190,9 +190,7 @@ void function UpdateMarksForKill( entity victim, entity attacker, var damageInfo { // handle suicides. Not sure what the actual message is that vanilla shows for this // but this will prevent crashing for now - entity actualAttacker = attacker - if ( IsSuicide( victim, attacker, DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) ) - actualAttacker = victim + entity actualAttacker = IsSuicide( victim, attacker, DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) ? victim : attacker MessageToAll( eEventNotifications.MarkedForDeathKill, null, victim, actualAttacker.GetEncodedEHandle() ) svGlobal.levelEnt.Signal( "MarkKilled", { mark = victim } ) From 8dc5ffc3f8f6c2c25896ffb1ea72fd8e16d840e8 Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:03:18 +0100 Subject: [PATCH 3/3] dont award score on suicide --- .../mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut index 0916397a0..d36045a61 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut @@ -190,12 +190,13 @@ void function UpdateMarksForKill( entity victim, entity attacker, var damageInfo { // handle suicides. Not sure what the actual message is that vanilla shows for this // but this will prevent crashing for now - entity actualAttacker = IsSuicide( victim, attacker, DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) ? victim : attacker + bool isSuicide = IsSuicide( victim, attacker, DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) + entity actualAttacker = isSuicide ? victim : attacker MessageToAll( eEventNotifications.MarkedForDeathKill, null, victim, actualAttacker.GetEncodedEHandle() ) svGlobal.levelEnt.Signal( "MarkKilled", { mark = victim } ) - if ( attacker.IsPlayer() ) + if ( !isSuicide && attacker.IsPlayer() ) attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 ) } } \ No newline at end of file