From 6056247ac3002808c95d7a1c6671c388920ec2ed Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 16 May 2007 17:12:17 +0000 Subject: * removed unused new-login.dat * cleared up verbose/noverbose/disableOutput douple negation confusion in ConsoleBase * 2d chat radius is now 3d chat sphere * removed unused fast 2d radius calc * added chat type 0xFF : broadcast (no sphere checking) * OpenSimMain now exposes its LocalWorld --- OpenSim.RegionServer/OpenSim.RegionServer.csproj | 11 +----- OpenSim.RegionServer/OpenSimMain.cs | 13 +++++--- OpenSim.RegionServer/world/World.PacketHandlers.cs | 39 ++++++++++++++-------- 3 files changed, 35 insertions(+), 28 deletions(-) (limited to 'OpenSim.RegionServer') diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj index 8b23336..b4868bd 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj @@ -150,24 +150,19 @@ Code - SimClient.cs Code - SimClient.cs - Code - SimClient.cs + Code - Code Code - Code @@ -188,14 +183,12 @@ Code - Avatar.cs Code Code - Avatar.cs Code @@ -217,11 +210,9 @@ Code - World.cs Code - World.cs Code diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index ce49074..6b89bfe 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs @@ -60,7 +60,6 @@ namespace OpenSim //private IGenericConfig remoteConfig; private PhysicsManager physManager; private Grid GridServers; - private World LocalWorld; private AssetCache AssetCache; private InventoryCache InventoryCache; private Dictionary clientCircuits = new Dictionary(); @@ -81,7 +80,7 @@ namespace OpenSim protected ConsoleBase m_console; - public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool verbose, string configFile) + public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) { this.configFileSetup = useConfigFile; m_sandbox = sandBoxMode; @@ -89,10 +88,16 @@ namespace OpenSim m_physicsEngine = physicsEngine; m_config = configFile; - m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, verbose); + m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent); OpenSim.Framework.Console.MainConsole.Instance = m_console; } + private World m_localWorld; + public World LocalWorld + { + get { return m_localWorld; } + } + /// /// Performs initialisation of the world, such as loading configuration from disk. /// @@ -251,7 +256,7 @@ namespace OpenSim m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world"); m_console.componentname = "Region " + regionData.RegionName; - LocalWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); + m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); LocalWorld.InventoryCache = InventoryCache; LocalWorld.AssetCache = AssetCache; diff --git a/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim.RegionServer/world/World.PacketHandlers.cs index 2036bc6..3c3548d 100644 --- a/OpenSim.RegionServer/world/World.PacketHandlers.cs +++ b/OpenSim.RegionServer/world/World.PacketHandlers.cs @@ -51,40 +51,51 @@ namespace OpenSim.world return true; } + string fromName = simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname; + byte[] message = inchatpack.ChatData.Message; + byte type = inchatpack.ChatData.Type; + LLVector3 fromPos = simClient.ClientAvatar.Pos; + LLUUID fromAgentID = simClient.AgentID; + libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); reply.ChatData.Audible = 1; - reply.ChatData.Message = inchatpack.ChatData.Message; - reply.ChatData.ChatType = inchatpack.ChatData.Type; + reply.ChatData.Message = message; + reply.ChatData.ChatType = type; reply.ChatData.SourceType = 1; - reply.ChatData.Position = simClient.ClientAvatar.Pos; - reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); - reply.ChatData.OwnerID = simClient.AgentID; - reply.ChatData.SourceID = simClient.AgentID; + reply.ChatData.Position = fromPos; + reply.ChatData.FromName = enc.GetBytes(fromName + "\0"); + reply.ChatData.OwnerID = fromAgentID; + reply.ChatData.SourceID = fromAgentID; + foreach (SimClient client in m_clientThreads.Values) { + // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(simClient.ClientAvatar.Pos); + 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)); + case 0: // Whisper 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)); + case 1: // Say 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)); + case 2: // Shout if ((dis < 100) && (dis > -100)) { client.OutPacket(reply); } break; + + case 0xff: // Broadcast + client.OutPacket(reply); + break; } } @@ -147,7 +158,7 @@ namespace OpenSim.world //Uncomment when prim/object UUIDs are random or such //2007-03-22 - Randomskk //this._primCount--; - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Deleted UUID " + ent.uuid); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Deleted UUID " + ent.uuid); } } } @@ -216,7 +227,7 @@ namespace OpenSim.world mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000007"); mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX; mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY; - mapReply.Data[0].WaterHeight =(byte) m_regInfo.RegionWaterHeight; + mapReply.Data[0].WaterHeight = (byte)m_regInfo.RegionWaterHeight; mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName); mapReply.Data[0].RegionFlags = 72458694; mapReply.Data[0].Access = 13; -- cgit v1.1