Hi Clearshot,
I have noticed the plugin has started displaying the wrong grid locations, it's off by one square.
Have wiped config and data to start fresh and still displays wrong location. 4500 size.
I had another plugin(Server Hud) do the same that was recently updated to rectify this, did devs fiddle with gridpos on recent update?
Thanks for the great plugin and your hard work!
Wrong grid positions.
Most plugins will use FP own grid position function. This plugin does as well.
var gridPos = PhoneController.PositionToGridCoord(playerPos);Merged post
You could borrow code from the Grid plugin and see if it fixes the location or not.
Add the following function...
string getGrid(Vector3 pos)
{
char letter = 'A';
var x = Mathf.Floor((pos.x+(ConVar.Server.worldsize/2)) / 146.3f)%26;
var z = (Mathf.Floor(ConVar.Server.worldsize/146.3f))-Mathf.Floor((pos.z+(ConVar.Server.worldsize/2)) / 146.3f);
letter = (char)(((int)letter)+x);
return $"{letter}{z}";
}Then change the plugin code from
var gridPos = PhoneController.PositionToGridCoord(playerPos);To:
string gridPos = getGrid(playerPos); Many thanks for the reply and help.8SecSleeperMost plugins will use FP own grid position function. This plugin does as well.
var gridPos = PhoneController.PositionToGridCoord(playerPos);
Merged postYou could borrow code from the Grid plugin and see if it fixes the location or not.
Add the following function...string getGrid(Vector3 pos) { char letter = 'A'; var x = Mathf.Floor((pos.x+(ConVar.Server.worldsize/2)) / 146.3f)%26; var z = (Mathf.Floor(ConVar.Server.worldsize/146.3f))-Mathf.Floor((pos.z+(ConVar.Server.worldsize/2)) / 146.3f); letter = (char)(((int)letter)+x); return $"{letter}{z}"; }Then change the plugin code from
var gridPos = PhoneController.PositionToGridCoord(playerPos);To:
string gridPos = getGrid(playerPos);
Apologies, it might have seemed like i knew what i was talking about using the term gridpos, but i am extremely new to editing cs files, the furthest i have reached is changing prefabs within the cs.
I've had a play about and can't get it to compile, probably putting it in the completely wrong place/line.
From what i can get from your post is that facepunches own grid system is currently meh.
Everything else works fantastically so i can live with one grid being out.
From what I remember there is no perfect solution for modders to use to get an accurate grid postion. No matter which method you use it will be off by a bit. Its related to the size of the map but I don't remember the specifics.
Clearshot
From what I remember there is no perfect solution for modders to use to get an accurate grid postion. No matter which method you use it will be off by a bit. Its related to the size of the map but I don't remember the specifics.
I was starting to think this myself, hard to accomodate the sheer ammount of sizes you can have, the main thing is that it points you in the correct direction.
Many thanks for the reply and all the hard work put into the latest version!