refactor(Bouncer): remove RangeCheck for ChestOnQuickStack operations and rename method

Players are not able to quick-stack items into out-of-range chests.
This commit is contained in:
Cai 2025-06-17 06:44:28 +08:00
parent 6c500dfa70
commit 0b79a6bee4

View file

@ -137,7 +137,7 @@ namespace TShockAPI
GetDataHandlers.KillMe += OnKillMe; GetDataHandlers.KillMe += OnKillMe;
GetDataHandlers.FishOutNPC += OnFishOutNPC; GetDataHandlers.FishOutNPC += OnFishOutNPC;
GetDataHandlers.FoodPlatterTryPlacing += OnFoodPlatterTryPlacing; GetDataHandlers.FoodPlatterTryPlacing += OnFoodPlatterTryPlacing;
OTAPI.Hooks.Chest.QuickStack += OnChestOnQuickStack; OTAPI.Hooks.Chest.QuickStack += OnQuickStack;
// The following section is based off Player.PlaceThing_Tiles_PlaceIt and Player.PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle. // The following section is based off Player.PlaceThing_Tiles_PlaceIt and Player.PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle.
@ -2877,7 +2877,7 @@ namespace TShockAPI
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="args"></param> /// <param name="args"></param>
internal void OnChestOnQuickStack(object sender, OTAPI.Hooks.Chest.QuickStackEventArgs args) internal void OnQuickStack(object sender, OTAPI.Hooks.Chest.QuickStackEventArgs args)
{ {
var id = args.ChestIndex; var id = args.ChestIndex;
var plr = TShock.Players[args.PlayerId]; var plr = TShock.Players[args.PlayerId];
@ -2901,13 +2901,6 @@ namespace TShockAPI
args.Result = HookResult.Cancel; args.Result = HookResult.Cancel;
return; return;
} }
if (!plr.IsInRange(Main.chest[id].x, Main.chest[id].y, 600/16))
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnQuickStack rejected from range check from {0}", plr.Name));
args.Result = HookResult.Cancel;
return;
}
} }
internal void OnSecondUpdate() internal void OnSecondUpdate()