diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/world/Avatar.cs | 27 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/Primitive2.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/WorldPacketHandlers.cs | 31 |
4 files changed, 48 insertions, 14 deletions
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index 54043fc..df7d5ba 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs | |||
@@ -32,14 +32,18 @@ namespace OpenSim.world | |||
32 | private ulong m_regionHandle; | 32 | private ulong m_regionHandle; |
33 | private Dictionary<uint, SimClient> m_clientThreads; | 33 | private Dictionary<uint, SimClient> m_clientThreads; |
34 | private string m_regionName; | 34 | private string m_regionName; |
35 | private ushort m_regionWaterHeight; | ||
36 | private bool m_regionTerraform; | ||
35 | //private bool childShadowAvatar = false; | 37 | //private bool childShadowAvatar = false; |
36 | 38 | ||
37 | public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle) | 39 | public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) |
38 | { | 40 | { |
39 | m_world = world; | 41 | m_world = world; |
40 | m_clientThreads = clientThreads; | 42 | m_clientThreads = clientThreads; |
41 | m_regionName = regionName; | 43 | m_regionName = regionName; |
42 | m_regionHandle = regionHandle; | 44 | m_regionHandle = regionHandle; |
45 | m_regionTerraform = regionTerraform; | ||
46 | m_regionWaterHeight = regionWater; | ||
43 | 47 | ||
44 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); | 48 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); |
45 | ControllingClient = TheClient; | 49 | ControllingClient = TheClient; |
@@ -139,7 +143,7 @@ namespace OpenSim.world | |||
139 | 143 | ||
140 | public void HandleUpdate(AgentUpdatePacket pack) | 144 | public void HandleUpdate(AgentUpdatePacket pack) |
141 | { | 145 | { |
142 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) != 0) | 146 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0) |
143 | { | 147 | { |
144 | if (this._physActor.Flying == false) | 148 | if (this._physActor.Flying == false) |
145 | { | 149 | { |
@@ -160,7 +164,7 @@ namespace OpenSim.world | |||
160 | } | 164 | } |
161 | this._physActor.Flying = false; | 165 | this._physActor.Flying = false; |
162 | } | 166 | } |
163 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) | 167 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) |
164 | { | 168 | { |
165 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | 169 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); |
166 | if (((movementflag & 1) == 0) || (q != this.bodyRot)) | 170 | if (((movementflag & 1) == 0) || (q != this.bodyRot)) |
@@ -194,7 +198,7 @@ namespace OpenSim.world | |||
194 | this.bodyRot = q; | 198 | this.bodyRot = q; |
195 | } | 199 | } |
196 | } | 200 | } |
197 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying)) | 201 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying)) |
198 | { | 202 | { |
199 | if (((movementflag & 2) == 0) && this._physActor.Flying) | 203 | if (((movementflag & 2) == 0) && this._physActor.Flying) |
200 | { | 204 | { |
@@ -214,7 +218,7 @@ namespace OpenSim.world | |||
214 | movementflag = 2; | 218 | movementflag = 2; |
215 | } | 219 | } |
216 | } | 220 | } |
217 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying)) | 221 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying)) |
218 | { | 222 | { |
219 | if (((movementflag & 4) == 0) && this._physActor.Flying) | 223 | if (((movementflag & 4) == 0) && this._physActor.Flying) |
220 | { | 224 | { |
@@ -235,7 +239,7 @@ namespace OpenSim.world | |||
235 | movementflag = 4; | 239 | movementflag = 4; |
236 | } | 240 | } |
237 | } | 241 | } |
238 | else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) != 0) | 242 | else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) |
239 | { | 243 | { |
240 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | 244 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); |
241 | if (((movementflag & 8) == 0) || (q != this.bodyRot)) | 245 | if (((movementflag & 8) == 0) || (q != this.bodyRot)) |
@@ -287,7 +291,7 @@ namespace OpenSim.world | |||
287 | } | 291 | } |
288 | } | 292 | } |
289 | 293 | ||
290 | //really really should be moved somewhere else | 294 | //really really should be moved somewhere else (RegionInfo.cs ?) |
291 | public void SendRegionHandshake(World RegionInfo) | 295 | public void SendRegionHandshake(World RegionInfo) |
292 | { | 296 | { |
293 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); | 297 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); |
@@ -306,8 +310,13 @@ namespace OpenSim.world | |||
306 | handshake.RegionInfo.TerrainStartHeight10 = 10; | 310 | handshake.RegionInfo.TerrainStartHeight10 = 10; |
307 | handshake.RegionInfo.TerrainStartHeight11 = 10; | 311 | handshake.RegionInfo.TerrainStartHeight11 = 10; |
308 | handshake.RegionInfo.SimAccess = 13; | 312 | handshake.RegionInfo.SimAccess = 13; |
309 | handshake.RegionInfo.WaterHeight = 20; | 313 | handshake.RegionInfo.WaterHeight = m_regionWaterHeight; |
310 | handshake.RegionInfo.RegionFlags = 72458694 - 32; | 314 | uint regionFlags = 72458694; |
315 | if (this.m_regionTerraform) | ||
316 | { | ||
317 | regionFlags -= 64; | ||
318 | } | ||
319 | handshake.RegionInfo.RegionFlags = regionFlags; | ||
311 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); | 320 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); |
312 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | 321 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); |
313 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | 322 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); |
diff --git a/OpenSim.RegionServer/world/Primitive2.cs b/OpenSim.RegionServer/world/Primitive2.cs index 34e32f8..24fc6da 100644 --- a/OpenSim.RegionServer/world/Primitive2.cs +++ b/OpenSim.RegionServer/world/Primitive2.cs | |||
@@ -272,7 +272,7 @@ namespace OpenSim.world | |||
272 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; | 272 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; |
273 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | 273 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; |
274 | objupdate.ObjectData[0].ID = (uint)(localID); | 274 | objupdate.ObjectData[0].ID = (uint)(localID); |
275 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); | 275 | objupdate.ObjectData[0].FullID = LLUUID.Random(); |
276 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | 276 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; |
277 | //update position | 277 | //update position |
278 | byte[] pb = pos1.GetBytes(); | 278 | byte[] pb = pos1.GetBytes(); |
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 69a6494..5bada2b 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs | |||
@@ -542,7 +542,7 @@ namespace OpenSim.world | |||
542 | try | 542 | try |
543 | { | 543 | { |
544 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | 544 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); |
545 | Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle); | 545 | Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); |
546 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); | 546 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); |
547 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); | 547 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); |
548 | newAvatar.SendRegionHandshake(this); | 548 | newAvatar.SendRegionHandshake(this); |
diff --git a/OpenSim.RegionServer/world/WorldPacketHandlers.cs b/OpenSim.RegionServer/world/WorldPacketHandlers.cs index 70cbc6b..f4213d0 100644 --- a/OpenSim.RegionServer/world/WorldPacketHandlers.cs +++ b/OpenSim.RegionServer/world/WorldPacketHandlers.cs | |||
@@ -8,6 +8,7 @@ using OpenSim.Framework.Interfaces; | |||
8 | using OpenSim.Framework.Types; | 8 | using OpenSim.Framework.Types; |
9 | using OpenSim.Framework.Terrain; | 9 | using OpenSim.Framework.Terrain; |
10 | using OpenSim.Framework.Inventory; | 10 | using OpenSim.Framework.Inventory; |
11 | using OpenSim.Framework.Utilities; | ||
11 | using OpenSim.Assets; | 12 | using OpenSim.Assets; |
12 | 13 | ||
13 | namespace OpenSim.world | 14 | namespace OpenSim.world |
@@ -44,7 +45,7 @@ namespace OpenSim.world | |||
44 | { | 45 | { |
45 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 46 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
46 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; | 47 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; |
47 | if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") | 48 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") |
48 | { | 49 | { |
49 | //empty message so don't bother with it | 50 | //empty message so don't bother with it |
50 | return true; | 51 | return true; |
@@ -53,7 +54,7 @@ namespace OpenSim.world | |||
53 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | 54 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); |
54 | reply.ChatData.Audible = 1; | 55 | reply.ChatData.Audible = 1; |
55 | reply.ChatData.Message = inchatpack.ChatData.Message; | 56 | reply.ChatData.Message = inchatpack.ChatData.Message; |
56 | reply.ChatData.ChatType = 1; | 57 | reply.ChatData.ChatType = inchatpack.ChatData.Type; |
57 | reply.ChatData.SourceType = 1; | 58 | reply.ChatData.SourceType = 1; |
58 | reply.ChatData.Position = simClient.ClientAvatar.Pos; | 59 | reply.ChatData.Position = simClient.ClientAvatar.Pos; |
59 | reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); | 60 | reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); |
@@ -61,7 +62,31 @@ namespace OpenSim.world | |||
61 | reply.ChatData.SourceID = simClient.AgentID; | 62 | reply.ChatData.SourceID = simClient.AgentID; |
62 | foreach (SimClient client in m_clientThreads.Values) | 63 | foreach (SimClient client in m_clientThreads.Values) |
63 | { | 64 | { |
64 | client.OutPacket(reply); | 65 | switch (inchatpack.ChatData.Type) |
66 | { | ||
67 | case 0: | ||
68 | int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
69 | if ((dis < 10) && (dis > -10)) | ||
70 | { | ||
71 | client.OutPacket(reply); | ||
72 | } | ||
73 | break; | ||
74 | case 1: | ||
75 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
76 | if ((dis < 30) && (dis > -30)) | ||
77 | { | ||
78 | client.OutPacket(reply); | ||
79 | } | ||
80 | break; | ||
81 | case 2: | ||
82 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
83 | if ((dis < 100) && (dis > -100)) | ||
84 | { | ||
85 | client.OutPacket(reply); | ||
86 | } | ||
87 | break; | ||
88 | } | ||
89 | |||
65 | } | 90 | } |
66 | return true; | 91 | return true; |
67 | } | 92 | } |