From 77ded2882625ba1d427853dc3cf3ab8bc5ad930f Mon Sep 17 00:00:00 2001 From: Zoom L1 <46046453+AgaSpace@users.noreply.github.com> Date: Thu, 2 Dec 2021 22:13:25 +0700 Subject: [PATCH 1/2] Corrected customDeathReason in OnPlayerDamage Previously it was called for absolutely any damage from the player. --- TShockAPI/Bouncer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 1d1ccf26..380a40d0 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -2250,7 +2250,7 @@ namespace TShockAPI * If the player was not specified, that is, the player index is -1, then it is definitely a custom cause, as you can only deal damage with a projectile or another player. * This is how everything else works. If an NPC is specified, its value is not -1, which is a custom cause. */ - if (TShock.Config.Settings.DisableCustomDeathMessages && + if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index && (reason._sourcePlayerIndex == -1 || reason._sourceNPCIndex != -1 || reason._sourceOtherIndex != -1 || reason._sourceCustomReason != null)) { TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected custom death message from {0}", args.Player.Name); From 5230598ba3a4200944d380cbe288ab0d29970fdf Mon Sep 17 00:00:00 2001 From: Zoom L1 <46046453+AgaSpace@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:37:16 +0700 Subject: [PATCH 2/2] Comments updated --- TShockAPI/Bouncer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 380a40d0..e15209d4 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -2249,6 +2249,8 @@ namespace TShockAPI * * If the player was not specified, that is, the player index is -1, then it is definitely a custom cause, as you can only deal damage with a projectile or another player. * This is how everything else works. If an NPC is specified, its value is not -1, which is a custom cause. + * + * Checking whether this damage came from the player is necessary, because the damage from the player can come even when it is hit by a NPC */ if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index && (reason._sourcePlayerIndex == -1 || reason._sourceNPCIndex != -1 || reason._sourceOtherIndex != -1 || reason._sourceCustomReason != null))