From c3d40feeb604bb19abd419eea381bd7f2df9bac1 Mon Sep 17 00:00:00 2001 From: gareth Date: Sun, 4 Mar 2007 03:36:08 +0000 Subject: [PATCH] Implemented chat Fixed "sticky borders" bug (avatar can hit side of sim and move away) --- src/OpenSimClient.cs | 23 ++++++++++++++++++++++- src/world/PhysicsEngine.cs | 8 ++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs index 696031d3e3..2e8dbb51b3 100644 --- a/src/OpenSimClient.cs +++ b/src/OpenSimClient.cs @@ -169,7 +169,28 @@ namespace OpenSim case PacketType.AgentUpdate: ClientAvatar.HandleAgentUpdate((AgentUpdatePacket)Pack); break; - } + case PacketType.ChatFromViewer: + ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; + if(Helpers.FieldToString(inchatpack.ChatData.Message)=="") break; + + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); + reply.ChatData.Audible = 1; + reply.ChatData.Message = inchatpack.ChatData.Message; + reply.ChatData.ChatType = 1; + reply.ChatData.SourceType = 1; + reply.ChatData.Position = this.ClientAvatar.position; + reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); + reply.ChatData.OwnerID = this.AgentID; + reply.ChatData.SourceID = this.AgentID; + + + + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(reply); + } + break; + } } private void ResendUnacked() diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs index d9351af07c..4abf1f284f 100644 --- a/src/world/PhysicsEngine.cs +++ b/src/world/PhysicsEngine.cs @@ -20,12 +20,12 @@ namespace OpenSim.world public void DoStuff(World simworld) { foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys) { - if((simworld.Entities[UUID].position.X>0) & (simworld.Entities[UUID].position.X<256) & (simworld.Entities[UUID].position.Y>1) & (simworld.Entities[UUID].position.Y<256)) { simworld.Entities[UUID].position += simworld.Entities[UUID].velocity; simworld.Entities[UUID].position.Z = simworld.LandMap[(int)simworld.Entities[UUID].position.Y * 256 + (int)simworld.Entities[UUID].position.X]+1; - } else { - simworld.Entities[UUID].velocity = new LLVector3(0f,0f,0f); - } + if(simworld.Entities[UUID].position.X<0) simworld.Entities[UUID].position.X=0; + if(simworld.Entities[UUID].position.Y<0) simworld.Entities[UUID].position.Y=0; + if(simworld.Entities[UUID].position.X>255) simworld.Entities[UUID].position.X=255; + if(simworld.Entities[UUID].position.Y>255) simworld.Entities[UUID].position.Y=255; } } }