Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

Remove unnecessary range check for quick stack #2888

Closed bcat closed 1 year ago

bcat commented 1 year ago

Fixes #2885.

As described here, vanilla Terraria already has a range check for quick stacking (packet 85 from the client only lists the inventory slot to quick stack, and the server decides what chests are close enough). As such, removing TShock's check is safe, and it enables quick stacking to the same range as vanilla (~36 tiles) rather than the 32 tiles TShock is limited to with the extra range check.

Example of distance that you couldn't quick stack from before, but can now after this fix:

image

bcat commented 1 year ago

Rebased against HEAD to resolve conflicts (which reset the approval status, sorry!).

Arthri commented 1 year ago

and the server decides what chests are close enough

Where does the server decide this? I don't see range checks in Packet 85's code path

punchready commented 1 year ago

It's right there in Chest.PutItemInNearbyChest 🤔

Vector2 vector = new Vector2(Main.chest[i].x * 16 + 16, Main.chest[i].y * 16 + 16);
if ((vector - position).Length() >= 600f)
{
    continue;
}
Arthri commented 1 year ago

Ahh. Found it