Open OnsenManju opened 7 years ago
This was me trying to do coordinates as my first project in TShock plugin development. God bless who even knows the difference between X/Y and TileX/Y when they begin with our lackluster documentation.
X and Y are the "real" coordinates used by the game. TileX and TileY are basically X/Y divided by 16 seeing as Terraria tiles are 16x16 pixels in size.
I believe TShock regions use TileX and TileY for storing coordinates (seeing as it would be silly to store ridiculously big numbers) so InArea probably should use that.
Thanks for the detailed explanation! Now I got it. https://github.com/NyxStudios/TShock/blob/master/TShockAPI/TSPlayer.cs#L545-L559
803e77709689e30f8e195a65a3e462366aa4a54b
It worked as intended on the latest TShock 4.3.22, thanks!
(Sorry to bother you again) Reported here: https://tshock.co/xf/index.php?threads/keychangerssc.2528/page-4#post-47250
Tried debugging.
https://github.com/Enerdy/KeyChanger/blob/master/KeyChanger.cs#L246 Though I don't know much about TShock API, I think it would be better to use TileX,TileY for InArea() rather than raw coordinates(X,Y)...? -->
if (!region.InArea(args.Player.TileX, args.Player.TileY))