diff options
updated to use lastest version of libsl but is currently broke when using SL viewer 1.15.02, due to big changes in the message templates.
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r-- | OpenSim.RegionServer/AgentAssetUpload.cs | 4 | ||||
-rw-r--r-- | OpenSim.RegionServer/OpenSim.RegionServer.csproj | 6 | ||||
-rw-r--r-- | OpenSim.RegionServer/OpenSim.RegionServer.dll.build | 1 | ||||
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 4 | ||||
-rw-r--r-- | OpenSim.RegionServer/RegionInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 8 | ||||
-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 |
10 files changed, 66 insertions, 21 deletions
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs index 258bda0..071ea63 100644 --- a/OpenSim.RegionServer/AgentAssetUpload.cs +++ b/OpenSim.RegionServer/AgentAssetUpload.cs | |||
@@ -196,8 +196,8 @@ namespace OpenSim | |||
196 | if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) | 196 | if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) |
197 | { | 197 | { |
198 | AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; | 198 | AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; |
199 | trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description); | 199 | trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description); |
200 | trans.Asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name); | 200 | trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name); |
201 | trans.Asset.Type = packet.InventoryBlock.Type; | 201 | trans.Asset.Type = packet.InventoryBlock.Type; |
202 | trans.Asset.InvType = packet.InventoryBlock.InvType; | 202 | trans.Asset.InvType = packet.InventoryBlock.InvType; |
203 | if (trans.UploadComplete) | 203 | if (trans.UploadComplete) |
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj index ae391a9..a473a3c 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj | |||
@@ -116,6 +116,12 @@ | |||
116 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 116 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
117 | <Private>False</Private> | 117 | <Private>False</Private> |
118 | </ProjectReference> | 118 | </ProjectReference> |
119 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> | ||
120 | <Name>XMLRPC</Name> | ||
121 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | ||
122 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
123 | <Private>False</Private> | ||
124 | </ProjectReference> | ||
119 | </ItemGroup> | 125 | </ItemGroup> |
120 | <ItemGroup> | 126 | <ItemGroup> |
121 | <Compile Include="AgentAssetUpload.cs"> | 127 | <Compile Include="AgentAssetUpload.cs"> |
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build index abd7776..982f45c 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build +++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build | |||
@@ -58,6 +58,7 @@ | |||
58 | <include name="../bin/OpenSim.GenericConfig.Xml.dll" /> | 58 | <include name="../bin/OpenSim.GenericConfig.Xml.dll" /> |
59 | <include name="../bin/OpenSim.Physics.Manager.dll" /> | 59 | <include name="../bin/OpenSim.Physics.Manager.dll" /> |
60 | <include name="../bin/OpenSim.Servers.dll" /> | 60 | <include name="../bin/OpenSim.Servers.dll" /> |
61 | <include name="../bin/XMLRPC.dll" /> | ||
61 | </references> | 62 | </references> |
62 | </csc> | 63 | </csc> |
63 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | 64 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> |
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index dc6a363..bc062b2 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -374,7 +374,7 @@ namespace OpenSim | |||
374 | this.gridLocalAsset = Convert.ToBoolean(attri); | 374 | this.gridLocalAsset = Convert.ToBoolean(attri); |
375 | } | 375 | } |
376 | 376 | ||
377 | // Grid mode hack to use local asset server | 377 | // Grid mode hack to use local asset server |
378 | attri = ""; | 378 | attri = ""; |
379 | attri = configData.GetAttribute("PhysicsEngine"); | 379 | attri = configData.GetAttribute("PhysicsEngine"); |
380 | if (attri == "") | 380 | if (attri == "") |
@@ -437,6 +437,7 @@ namespace OpenSim | |||
437 | Packet packet = null; | 437 | Packet packet = null; |
438 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | 438 | int numBytes = Server.EndReceiveFrom(result, ref epSender); |
439 | int packetEnd = numBytes - 1; | 439 | int packetEnd = numBytes - 1; |
440 | |||
440 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | 441 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); |
441 | 442 | ||
442 | // This is either a new client or a packet to send to an old one | 443 | // This is either a new client or a packet to send to an old one |
@@ -509,6 +510,7 @@ namespace OpenSim | |||
509 | { // invalid client | 510 | { // invalid client |
510 | Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); | 511 | Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); |
511 | } | 512 | } |
513 | |||
512 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 514 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
513 | } | 515 | } |
514 | 516 | ||
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs index d17e1fd..2f8bfa1 100644 --- a/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -17,6 +17,8 @@ namespace OpenSim | |||
17 | public uint RegionLocX; | 17 | public uint RegionLocX; |
18 | public uint RegionLocY; | 18 | public uint RegionLocY; |
19 | public ulong RegionHandle; | 19 | public ulong RegionHandle; |
20 | public ushort RegionWaterHeight = 20; | ||
21 | public bool RegionTerraform = true; | ||
20 | 22 | ||
21 | public int IPListenPort; | 23 | public int IPListenPort; |
22 | public string IPListenAddr; | 24 | public string IPListenAddr; |
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 9a0a6eb..c5108ac 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -491,7 +491,7 @@ namespace OpenSim | |||
491 | break; | 491 | break; |
492 | case PacketType.CreateInventoryFolder: | 492 | case PacketType.CreateInventoryFolder: |
493 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 493 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; |
494 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Helpers.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 494 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); |
495 | //Console.WriteLine(Pack.ToString()); | 495 | //Console.WriteLine(Pack.ToString()); |
496 | break; | 496 | break; |
497 | case PacketType.CreateInventoryItem: | 497 | case PacketType.CreateInventoryItem: |
@@ -603,7 +603,7 @@ namespace OpenSim | |||
603 | { | 603 | { |
604 | if (ent is OpenSim.world.Primitive) | 604 | if (ent is OpenSim.world.Primitive) |
605 | { | 605 | { |
606 | this.m_world.AddScript(ent, Helpers.FieldToString(assBase.Data)); | 606 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); |
607 | } | 607 | } |
608 | } | 608 | } |
609 | } | 609 | } |
@@ -1081,8 +1081,8 @@ namespace OpenSim | |||
1081 | { | 1081 | { |
1082 | //lets try this out with creating a notecard | 1082 | //lets try this out with creating a notecard |
1083 | AssetBase asset = new AssetBase(); | 1083 | AssetBase asset = new AssetBase(); |
1084 | asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name); | 1084 | asset.Name = Util.FieldToString(packet.InventoryBlock.Name); |
1085 | asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description); | 1085 | asset.Description = Util.FieldToString(packet.InventoryBlock.Description); |
1086 | asset.InvType = packet.InventoryBlock.InvType; | 1086 | asset.InvType = packet.InventoryBlock.InvType; |
1087 | asset.Type = packet.InventoryBlock.Type; | 1087 | asset.Type = packet.InventoryBlock.Type; |
1088 | asset.FullID = LLUUID.Random(); | 1088 | asset.FullID = LLUUID.Random(); |
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 | } |