Change fake parcel ids to allow a Z coordinate. Change TP by lure

to also transmit and use a Z coordinate.
0.6.2-post-fixes
Melanie Thielker 2009-01-13 23:29:54 +00:00
parent 412dd1260b
commit 1c3542303c
2 changed files with 29 additions and 7 deletions

View File

@ -806,8 +806,19 @@ namespace OpenSim.Framework
{ {
(byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24), (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24),
(byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56), (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56),
(byte)x, (byte)(x >> 8), (byte)(x >> 16), (byte)(x >> 24), (byte)x, (byte)(x >> 8), 0, 0,
(byte)y, (byte)(y >> 8), (byte)(y >> 16), (byte)(y >> 24) }; (byte)y, (byte)(y >> 8), 0, 0 };
return new UUID(bytes, 0);
}
public static UUID BuildFakeParcelID(ulong regionHandle, uint x, uint y, uint z)
{
byte[] bytes =
{
(byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24),
(byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56),
(byte)x, (byte)(x >> 8), (byte)z, (byte)(z >> 8),
(byte)y, (byte)(y >> 8), 0, 0 };
return new UUID(bytes, 0); return new UUID(bytes, 0);
} }
@ -815,8 +826,17 @@ namespace OpenSim.Framework
{ {
byte[] bytes = parcelID.GetBytes(); byte[] bytes = parcelID.GetBytes();
regionHandle = Utils.BytesToUInt64(bytes); regionHandle = Utils.BytesToUInt64(bytes);
x = Utils.BytesToUInt(bytes, 8); x = Utils.BytesToUInt(bytes, 8) & 0xffff;
y = Utils.BytesToUInt(bytes, 12); y = Utils.BytesToUInt(bytes, 12) & 0xffff;
}
public static void ParseFakeParcelID(UUID parcelID, out ulong regionHandle, out uint x, out uint y, out uint z)
{
byte[] bytes = parcelID.GetBytes();
regionHandle = Utils.BytesToUInt64(bytes);
x = Utils.BytesToUInt(bytes, 8) & 0xffff;
z = (Utils.BytesToUInt(bytes, 8) & 0xffff0000) >> 16;
y = Utils.BytesToUInt(bytes, 12) & 0xffff;
} }
public static void FakeParcelIDToGlobalPosition(UUID parcelID, out uint x, out uint y) public static void FakeParcelIDToGlobalPosition(UUID parcelID, out uint x, out uint y)

View File

@ -119,7 +119,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Lure
UUID dest = Util.BuildFakeParcelID( UUID dest = Util.BuildFakeParcelID(
scene.RegionInfo.RegionHandle, scene.RegionInfo.RegionHandle,
(uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.X,
(uint)presence.AbsolutePosition.Y); (uint)presence.AbsolutePosition.Y,
(uint)presence.AbsolutePosition.Z);
m_log.DebugFormat("TP invite with message {0}", message); m_log.DebugFormat("TP invite with message {0}", message);
@ -146,13 +147,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Lure
ulong handle = 0; ulong handle = 0;
uint x = 128; uint x = 128;
uint y = 128; uint y = 128;
uint z = 70;
Util.ParseFakeParcelID(lureID, out handle, out x, out y); Util.ParseFakeParcelID(lureID, out handle, out x, out y, out z);
Vector3 position = new Vector3(); Vector3 position = new Vector3();
position.X = (float)x; position.X = (float)x;
position.Y = (float)y; position.Y = (float)y;
position.Z = 0.0f; position.Z = (float)z;
scene.RequestTeleportLocation(client, handle, position, scene.RequestTeleportLocation(client, handle, position,
Vector3.Zero, teleportFlags); Vector3.Zero, teleportFlags);