From 7b7de04a7f76c42dc72774ec7256e3367bbe4b36 Mon Sep 17 00:00:00 2001 From: James Puleo Date: Mon, 13 Mar 2023 01:43:12 -0400 Subject: [PATCH] Relax custom death message restrictions to allow Inferno potions in PvP For some reason, Inferno potions do PvP damage without specifying the source player in the `PlayerDeathReason` -- so special-case the only identifying information being the other index value of `16`. --- TShockAPI/Bouncer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index affa1609..6ff7fd1a 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -2659,9 +2659,12 @@ 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. * + * An exception to this is damage dealt by the Inferno potion to other players -- it is only identified by the other index value of 16, + * even lacking a source player index. + * * 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 && + if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index && reason._sourceOtherIndex != 16 && (reason._sourcePlayerIndex == -1 || reason._sourceNPCIndex != -1 || reason._sourceOtherIndex != -1 || reason._sourceCustomReason != null)) { TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected custom death message from {0}", args.Player.Name));