Implemented chat

Fixed "sticky borders" bug (avatar can hit side of sim and move away)
adam
gareth 2007-03-04 03:36:08 +00:00
parent 412d7e098c
commit c3d40feeb6
2 changed files with 26 additions and 5 deletions

View File

@ -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()

View File

@ -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;
}
}
}