aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDinorush <onparnorthstar@gmail.com>2022-02-14 21:24:26 -0500
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-02-15 23:43:40 +0100
commitb08917da6e2cf01bfac6728b3f8bbcaf0ea64649 (patch)
treefb1b59aeea813916f434cc467fd43422afce1625
parent66a75f222d7137026315dd74d3378445ab5a2329 (diff)
downloadNorthstarMods-b08917da6e2cf01bfac6728b3f8bbcaf0ea64649.tar.gz
NorthstarMods-b08917da6e2cf01bfac6728b3f8bbcaf0ea64649.zip
Fix non-player and invalid ent assist crashes + self-assists
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut5
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut3
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut3
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut3
4 files changed, 13 insertions, 1 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
index 4d3d6612..b27892f7 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
@@ -81,7 +81,10 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
table<int, bool> alreadyAssisted
foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
{
- if( attackerInfo.attacker != attacker && !( attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ) )
+ if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == victim )
+ continue
+
+ if ( attackerInfo.attacker != attacker && !( attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ) )
{
if ( attackerInfo.damageSourceId != eDamageSourceId.melee_pilot_emptyhanded ) {
alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut
index a3ea5172..962549b4 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut
@@ -16,6 +16,9 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage
table<int, bool> alreadyAssisted
foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
{
+ if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == victim )
+ continue
+
bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
{
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
index feca3bd5..18684b05 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
@@ -284,6 +284,9 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
table<int, bool> alreadyAssisted
foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory )
{
+ if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == player )
+ continue
+
bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
{
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
index b7fd4d52..36862d8a 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
@@ -194,6 +194,9 @@ void function ScoreEvent_TitanKilled( entity victim, entity attacker, var damage
table<int, bool> alreadyAssisted
foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
{
+ if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == victim )
+ continue
+
bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
{