aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
diff options
context:
space:
mode:
authorErlite <ys.aameziane@gmail.com>2022-10-21 20:42:36 +0200
committerGitHub <noreply@github.com>2022-10-21 19:42:36 +0100
commit74093a1afcf85ac6c66329d47b30f0d9cdadb50b (patch)
tree38bfbc56f1ef57b4bfccca26749da078b8e3e4a2 /Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
parent118f9414326b0af067ee2a925d052c3ee17e4bef (diff)
downloadNorthstarMods-74093a1afcf85ac6c66329d47b30f0d9cdadb50b.tar.gz
NorthstarMods-74093a1afcf85ac6c66329d47b30f0d9cdadb50b.zip
Fix server crash from demigod setting health over max health. (#509)
* Fix server crash from demigod set health > max health * Add the incredible optimization. :^) Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com> * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA. Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com> Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut7
1 files changed, 6 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
index c0e69ba5..3546e3b7 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
@@ -2127,8 +2127,13 @@ void function EntityDemigod_TryAdjustDamageInfo( entity ent, var damageInfo )
return
int bottomLimit = 5
+ // Set it up so that you at least take 1 damage, for hit indicators etc to trigger
if ( ent.GetHealth() <= bottomLimit )
- ent.SetHealth( bottomLimit + 1 ) //Set it up so that you at least take 1 damage, for hit indicators etc to trigger
+ {
+ // Prevent going over max health to avoid a server crash.
+ int newHealth = bottomLimit + 1
+ ent.SetHealth( ent.GetMaxHealth() < newHealth ? ent.GetMaxHealth() : newHealth )
+ }
int health = ent.GetHealth()