Merge remote-tracking branch 'agaspace/general-devel' into general-devel
This commit is contained in:
commit
ce056f1ce5
3 changed files with 26 additions and 0 deletions
|
|
@ -2178,6 +2178,7 @@ namespace TShockAPI
|
|||
bool pvp = args.PVP;
|
||||
bool crit = args.Critical;
|
||||
byte direction = args.Direction;
|
||||
PlayerDeathReason reason = args.PlayerDeathReason;
|
||||
|
||||
if (id >= Main.maxPlayers || TShock.Players[id] == null)
|
||||
{
|
||||
|
|
@ -2242,6 +2243,20 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* PlayerDeathReason does not initially contain any information, so all fields have values -1 or null.
|
||||
* We can use this to determine the real cause of death.
|
||||
*
|
||||
* 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 &&
|
||||
(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);
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Bouncer's KillMe hook stops crash exploits from out of bounds values.</summary>
|
||||
|
|
@ -2279,6 +2294,12 @@ namespace TShockAPI
|
|||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
if (TShock.Config.Settings.DisableCustomDeathMessages && playerDeathReason._sourceCustomReason != null)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("Bouncer / OnKillMe rejected custom death message from {0}", args.Player.Name);
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -460,6 +460,10 @@ namespace TShockAPI.Configuration
|
|||
/// <summary>Prohibit the use of Zenith projectile with different objects instead of weapons.</summary>
|
||||
[Description("Prohibit the use of Zenith projectile with different objects instead of weapons.")]
|
||||
public bool DisableModifiedZenith = false;
|
||||
|
||||
/// <summary>Allows you to disable or enable protection against creating custom messages with death. Created for developers who came up with a more original solution to this problem.</summary>
|
||||
[Description("Allows you to disable or enable protection against creating custom messages with death. Created for developers who came up with a more original solution to this problem.")]
|
||||
public bool DisableCustomDeathMessages = true;
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue