Skip to content

Commit

Permalink
Fixed occasional invalid entity errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Psykotikism committed Dec 26, 2022
1 parent 71784cd commit 3724919
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#### General
- Fixed a potential memory leak caused by fixing the Tank's position when stuck.
- Fixed occasional invalid entity errors. (Thanks to `Mi.Cura` for reporting!)

#### Config Files
- Fixed parsing errors for config files that use one of the other formats.
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/mutant_tanks_updater.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"Notes" "Bug Fixes:"
"Notes" "General:"
"Notes" "- Fixed a potential memory leak caused by fixing the Tank's position when stuck."
"Notes" "- Fixed occasional invalid entity errors. (Thanks to \"Mi.Cura\" for reporting!)"
"Notes" "Config Files:"
"Notes" "- Fixed parsing errors for config files that use one of the other formats."
"Notes" "Abilities:"
Expand Down
Binary file modified addons/sourcemod/plugins/mutant_tanks/mt_abilities.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/mutant_tanks/mt_abilities2.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/mutant_tanks/mutant_tanks.smx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,10 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3

void OnInfectedSpawnPost(int entity)
{
SDKHook(entity, SDKHook_OnTakeDamage, OnShieldTakeDamage);
if (bIsValidEntity(entity))
{
SDKHook(entity, SDKHook_OnTakeDamage, OnShieldTakeDamage);
}
}

Action OnShieldTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
Expand Down
9 changes: 6 additions & 3 deletions addons/sourcemod/scripting/mutant_tanks/mutant_tanks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -15901,9 +15901,12 @@ void OnEffectSpawnPost(int entity)

void OnInfectedSpawnPost(int entity)
{
SDKHook(entity, SDKHook_OnTakeDamage, OnInfectedTakeDamage);
SDKHook(entity, SDKHook_OnTakeDamage, OnPlayerTakeDamage);
SDKHook(entity, SDKHook_OnTakeDamagePost, OnPlayerTakeDamagePost);
if (bIsValidEntity(entity))
{
SDKHook(entity, SDKHook_OnTakeDamage, OnInfectedTakeDamage);
SDKHook(entity, SDKHook_OnTakeDamage, OnPlayerTakeDamage);
SDKHook(entity, SDKHook_OnTakeDamagePost, OnPlayerTakeDamagePost);
}
}

void OnPropSpawnPost(int entity)
Expand Down

0 comments on commit 3724919

Please sign in to comment.