Properly fix the rtp position calculator

This commit is contained in:
zontreck 2025-03-07 12:23:08 -07:00
parent 1b6586c9e8
commit 2f1ac319de
2 changed files with 10 additions and 8 deletions

View file

@ -28,13 +28,15 @@ public class RTPFactory
while (tries-- > 0) while (tries-- > 0)
{ {
// Generate random X and Z within max RTP distance int ixMax = (int)vPos.X + maxDistance;
bPos.X = (int)vPos.X + rng.Next(0, maxDistance); int ixMin = (int)vPos.X - maxDistance;
bPos.Z = (int)vPos.Z + rng.Next(0, maxDistance); int izMax = (int)vPos.Z + maxDistance;
bPos.Y = 255; int izMin = (int)vPos.Z - maxDistance;
if (rng.Next(0, 1) == 1) bPos.X = -bPos.X; // Generate random X and Z within max RTP distance
if (rng.Next(0, 1) == 1) bPos.Z = -bPos.Z; bPos.X = (int)vPos.X + rng.Next(ixMin, ixMax);
bPos.Z = (int)vPos.Z + rng.Next(izMin, izMax);
bPos.Y = 255;
Block lastAboveLast = null; Block lastAboveLast = null;
Block lastBlock = null; Block lastBlock = null;

View file

@ -3,8 +3,8 @@
"modid": "ariasserverutils", "modid": "ariasserverutils",
"name": "Aria's Server Utilities", "name": "Aria's Server Utilities",
"authors": ["zontreck"], "authors": ["zontreck"],
"description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 12:09 PM MST", "description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 12:20 PM MST",
"version": "1.0.6-dev.5", "version": "1.0.6-dev.6",
"dependencies": { "dependencies": {
"game": "" "game": ""
} }