From 9ed0a8dbad121b64ca8baca78f28ca58602c47ca Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 25 Apr 2007 18:12:06 +0000 Subject: 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. --- OpenSim.RegionServer/world/Avatar.cs | 27 +++++++++++++------- OpenSim.RegionServer/world/Primitive2.cs | 2 +- OpenSim.RegionServer/world/World.cs | 2 +- OpenSim.RegionServer/world/WorldPacketHandlers.cs | 31 ++++++++++++++++++++--- 4 files changed, 48 insertions(+), 14 deletions(-) (limited to 'OpenSim.RegionServer/world') 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 private ulong m_regionHandle; private Dictionary m_clientThreads; private string m_regionName; + private ushort m_regionWaterHeight; + private bool m_regionTerraform; //private bool childShadowAvatar = false; - public Avatar(SimClient TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle) + public Avatar(SimClient TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) { m_world = world; m_clientThreads = clientThreads; m_regionName = regionName; m_regionHandle = regionHandle; + m_regionTerraform = regionTerraform; + m_regionWaterHeight = regionWater; OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; @@ -139,7 +143,7 @@ namespace OpenSim.world public void HandleUpdate(AgentUpdatePacket pack) { - if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) != 0) + if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0) { if (this._physActor.Flying == false) { @@ -160,7 +164,7 @@ namespace OpenSim.world } this._physActor.Flying = false; } - if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) + if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) { Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); if (((movementflag & 1) == 0) || (q != this.bodyRot)) @@ -194,7 +198,7 @@ namespace OpenSim.world this.bodyRot = q; } } - else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying)) + else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying)) { if (((movementflag & 2) == 0) && this._physActor.Flying) { @@ -214,7 +218,7 @@ namespace OpenSim.world movementflag = 2; } } - else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying)) + else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying)) { if (((movementflag & 4) == 0) && this._physActor.Flying) { @@ -235,7 +239,7 @@ namespace OpenSim.world movementflag = 4; } } - else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) != 0) + else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) { Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); if (((movementflag & 8) == 0) || (q != this.bodyRot)) @@ -287,7 +291,7 @@ namespace OpenSim.world } } - //really really should be moved somewhere else + //really really should be moved somewhere else (RegionInfo.cs ?) public void SendRegionHandshake(World RegionInfo) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); @@ -306,8 +310,13 @@ namespace OpenSim.world handshake.RegionInfo.TerrainStartHeight10 = 10; handshake.RegionInfo.TerrainStartHeight11 = 10; handshake.RegionInfo.SimAccess = 13; - handshake.RegionInfo.WaterHeight = 20; - handshake.RegionInfo.RegionFlags = 72458694 - 32; + handshake.RegionInfo.WaterHeight = m_regionWaterHeight; + uint regionFlags = 72458694; + if (this.m_regionTerraform) + { + regionFlags -= 64; + } + handshake.RegionInfo.RegionFlags = regionFlags; handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); 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 PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; objupdate.ObjectData[0].ID = (uint)(localID); - objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); + objupdate.ObjectData[0].FullID = LLUUID.Random(); LLVector3 pos1 = addPacket.ObjectData.RayEnd; //update position 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 try { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle); + Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 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; using OpenSim.Framework.Types; using OpenSim.Framework.Terrain; using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; using OpenSim.Assets; namespace OpenSim.world @@ -44,7 +45,7 @@ namespace OpenSim.world { System.Text.Encoding enc = System.Text.Encoding.ASCII; ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; - if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") + if (Util.FieldToString(inchatpack.ChatData.Message) == "") { //empty message so don't bother with it return true; @@ -53,7 +54,7 @@ namespace OpenSim.world libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); reply.ChatData.Audible = 1; reply.ChatData.Message = inchatpack.ChatData.Message; - reply.ChatData.ChatType = 1; + reply.ChatData.ChatType = inchatpack.ChatData.Type; reply.ChatData.SourceType = 1; reply.ChatData.Position = simClient.ClientAvatar.Pos; reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); @@ -61,7 +62,31 @@ namespace OpenSim.world reply.ChatData.SourceID = simClient.AgentID; foreach (SimClient client in m_clientThreads.Values) { - client.OutPacket(reply); + switch (inchatpack.ChatData.Type) + { + case 0: + int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + if ((dis < 10) && (dis > -10)) + { + client.OutPacket(reply); + } + break; + case 1: + dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + if ((dis < 30) && (dis > -30)) + { + client.OutPacket(reply); + } + break; + case 2: + dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + if ((dis < 100) && (dis > -100)) + { + client.OutPacket(reply); + } + break; + } + } return true; } -- cgit v1.1