From 646bbbc84b8010e0dacbeed5342cdb045f46cc49 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 27 Jun 2007 15:28:52 +0000 Subject: Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces. --- OpenSim/Region/Application/Application.cs | 121 +++ OpenSim/Region/Application/OpenSim.csproj | 181 ++++ OpenSim/Region/Application/OpenSim.csproj.user | 13 + OpenSim/Region/Application/OpenSimMain.cs | 476 ++++++++++ OpenSim/Region/Caches/AssetCache.cs | 670 ++++++++++++++ OpenSim/Region/Caches/OpenSim.Region.Caches.csproj | 97 ++ .../Caches/OpenSim.Region.Caches.csproj.user | 12 + OpenSim/Region/Caches/Properties/AssemblyInfo.cs | 35 + OpenSim/Region/Caps/Caps.cs | 258 ++++++ OpenSim/Region/Caps/LLSDHelpers.cs | 246 ++++++ .../Region/ClientStack/Assets/InventoryCache.cs | 337 +++++++ .../ClientStack/ClientStackNetworkHandler.cs | 46 + OpenSim/Region/ClientStack/ClientView.API.cs | 975 +++++++++++++++++++++ .../ClientStack/ClientView.AgentAssetUpload.cs | 358 ++++++++ .../ClientStack/ClientView.PacketHandlers.cs | 198 +++++ .../ClientStack/ClientView.ProcessPackets.cs | 550 ++++++++++++ OpenSim/Region/ClientStack/ClientView.cs | 273 ++++++ OpenSim/Region/ClientStack/ClientViewBase.cs | 327 +++++++ .../ClientStack/OpenSim.Region.ClientStack.csproj | 173 ++++ .../OpenSim.Region.ClientStack.csproj.user | 12 + OpenSim/Region/ClientStack/PacketServer.cs | 183 ++++ .../Region/ClientStack/RegionApplicationBase.cs | 129 +++ OpenSim/Region/ClientStack/UDPServer.cs | 208 +++++ OpenSim/Region/ClientStack/VersionInfo.cs | 38 + OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 113 +++ OpenSim/Region/Examples/SimpleApp/Program.cs | 128 +++ .../Examples/SimpleApp/Properties/AssemblyInfo.cs | 33 + OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 154 ++++ .../Examples/SimpleApp/SimpleApp.csproj.user | 12 + .../Region/GridInterfaces/Local/AssemblyInfo.cs | 58 ++ .../GridInterfaces/Local/LocalAssetServer.cs | 312 +++++++ .../OpenSim.Region.GridInterfaces.Local.csproj | 107 +++ ...OpenSim.Region.GridInterfaces.Local.csproj.user | 12 + .../Region/GridInterfaces/Remote/AssemblyInfo.cs | 58 ++ .../OpenSim.Region.GridInterfaces.Remote.csproj | 107 +++ ...penSim.Region.GridInterfaces.Remote.csproj.user | 12 + .../GridInterfaces/Remote/RemoteAssetServer.cs | 135 +++ .../LocalCommunications/CommunicationsLocal.cs | 61 ++ .../LocalCommunications/LocalBackEndServices.cs | 209 +++++ .../LocalCommunications/LocalUserServices.cs | 118 +++ .../OpenSim.Region.LocalCommunications.csproj | 121 +++ .../OpenSim.Region.LocalCommunications.csproj.user | 12 + .../LocalCommunications/Properties/AssemblyInfo.cs | 35 + .../Physics/BasicPhysicsPlugin/AssemblyInfo.cs | 58 ++ .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 294 +++++++ ...penSim.Region.Physics.BasicPhysicsPlugin.csproj | 93 ++ ...m.Region.Physics.BasicPhysicsPlugin.csproj.user | 12 + OpenSim/Region/Physics/Manager/AssemblyInfo.cs | 58 ++ .../Manager/OpenSim.Region.Physics.Manager.csproj | 112 +++ .../OpenSim.Region.Physics.Manager.csproj.user | 12 + OpenSim/Region/Physics/Manager/PhysicsActor.cs | 161 ++++ OpenSim/Region/Physics/Manager/PhysicsManager.cs | 117 +++ OpenSim/Region/Physics/Manager/PhysicsScene.cs | 113 +++ OpenSim/Region/Physics/Manager/PhysicsVector.cs | 54 ++ OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs | 58 ++ OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 456 ++++++++++ .../OpenSim.Region.Physics.OdePlugin.csproj | 97 ++ .../OpenSim.Region.Physics.OdePlugin.csproj.user | 12 + OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs | 58 ++ .../OpenSim.Region.Physics.PhysXPlugin.csproj | 97 ++ .../OpenSim.Region.Physics.PhysXPlugin.csproj.user | 12 + OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 424 +++++++++ .../Region/Scripting/Properties/AssemblyInfo.cs | 35 + OpenSim/Region/Scripting/Script.cs | 32 + OpenSim/Region/Scripting/ScriptAccess.cs | 31 + OpenSim/Region/Simulation/Caps.cs | 258 ++++++ OpenSim/Region/Simulation/EstateManager.cs | 301 +++++++ .../Simulation/OpenSim.Region.Simulation.csproj | 211 +++++ .../OpenSim.Region.Simulation.csproj.user | 12 + OpenSim/Region/Simulation/ParcelManager.cs | 892 +++++++++++++++++++ OpenSim/Region/Simulation/RegionManager.cs | 30 + OpenSim/Region/Simulation/Scenes/Entity.cs | 194 ++++ .../Region/Simulation/Scenes/IScenePresenceBody.cs | 19 + OpenSim/Region/Simulation/Scenes/Primitive.cs | 582 ++++++++++++ .../Simulation/Scenes/Scene.PacketHandlers.cs | 305 +++++++ .../Region/Simulation/Scenes/Scene.Scripting.cs | 184 ++++ OpenSim/Region/Simulation/Scenes/Scene.cs | 795 +++++++++++++++++ OpenSim/Region/Simulation/Scenes/SceneBase.cs | 201 +++++ OpenSim/Region/Simulation/Scenes/SceneEvents.cs | 52 ++ OpenSim/Region/Simulation/Scenes/SceneObject.cs | 128 +++ .../Simulation/Scenes/ScenePresence.Animations.cs | 76 ++ .../Region/Simulation/Scenes/ScenePresence.Body.cs | 90 ++ OpenSim/Region/Simulation/Scenes/ScenePresence.cs | 525 +++++++++++ .../Simulation/Scenes/scripting/IScriptContext.cs | 40 + .../Simulation/Scenes/scripting/IScriptEntity.cs | 46 + .../Simulation/Scenes/scripting/IScriptHandler.cs | 126 +++ .../Region/Simulation/Scenes/scripting/Script.cs | 53 ++ .../Simulation/Scenes/scripting/ScriptFactory.cs | 35 + .../Scenes/scripting/Scripts/FollowRandomAvatar.cs | 64 ++ .../LocalStorageBerkeleyDB/BDBLocalStorage.cs | 117 +++ ...im.Region.Storage.LocalStorageBerkeleyDB.csproj | 112 +++ ...gion.Storage.LocalStorageBerkeleyDB.csproj.user | 12 + ...penSim.Storage.LocalStorageBerkeleyDB.dll.build | 46 + .../Storage/LocalStorageDb4o/AssemblyInfo.cs | 58 ++ .../Storage/LocalStorageDb4o/Db4LocalStorage.cs | 271 ++++++ .../Region/Storage/LocalStorageDb4o/MapStorage.cs | 43 + .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 116 +++ ...Sim.Region.Storage.LocalStorageDb4o.csproj.user | 12 + .../Storage/LocalStorageDb4o/UUIDParcelQuery.cs | 52 ++ .../Storage/LocalStorageDb4o/UUIDPrimQuery.cs | 52 ++ ...penSim.Region.Storage.LocalStorageSQLite.csproj | 111 +++ ...m.Region.Storage.LocalStorageSQLite.csproj.user | 12 + .../OpenSim.Storage.LocalStorageSQLite.dll.build | 46 + .../LocalStorageSQLite/Properties/AssemblyInfo.cs | 62 ++ .../LocalStorageSQLite/SQLiteLocalStorage.cs | 198 +++++ .../OpenSim.Region.Terrain.BasicTerrain.csproj | 110 +++ ...OpenSim.Region.Terrain.BasicTerrain.csproj.user | 12 + .../Properties/AssemblyInfo.cs | 62 ++ .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 786 +++++++++++++++++ .../Region/Terrain.BasicTerrain/TerrainFilter.cs | 103 +++ 110 files changed, 17721 insertions(+) create mode 100644 OpenSim/Region/Application/Application.cs create mode 100644 OpenSim/Region/Application/OpenSim.csproj create mode 100644 OpenSim/Region/Application/OpenSim.csproj.user create mode 100644 OpenSim/Region/Application/OpenSimMain.cs create mode 100644 OpenSim/Region/Caches/AssetCache.cs create mode 100644 OpenSim/Region/Caches/OpenSim.Region.Caches.csproj create mode 100644 OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user create mode 100644 OpenSim/Region/Caches/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Caps/Caps.cs create mode 100644 OpenSim/Region/Caps/LLSDHelpers.cs create mode 100644 OpenSim/Region/ClientStack/Assets/InventoryCache.cs create mode 100644 OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs create mode 100644 OpenSim/Region/ClientStack/ClientView.API.cs create mode 100644 OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs create mode 100644 OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs create mode 100644 OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs create mode 100644 OpenSim/Region/ClientStack/ClientView.cs create mode 100644 OpenSim/Region/ClientStack/ClientViewBase.cs create mode 100644 OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj create mode 100644 OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user create mode 100644 OpenSim/Region/ClientStack/PacketServer.cs create mode 100644 OpenSim/Region/ClientStack/RegionApplicationBase.cs create mode 100644 OpenSim/Region/ClientStack/UDPServer.cs create mode 100644 OpenSim/Region/ClientStack/VersionInfo.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/MyWorld.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/Program.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj create mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user create mode 100644 OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs create mode 100644 OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs create mode 100644 OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj create mode 100644 OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user create mode 100644 OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs create mode 100644 OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj create mode 100644 OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user create mode 100644 OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs create mode 100644 OpenSim/Region/LocalCommunications/CommunicationsLocal.cs create mode 100644 OpenSim/Region/LocalCommunications/LocalBackEndServices.cs create mode 100644 OpenSim/Region/LocalCommunications/LocalUserServices.cs create mode 100644 OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj create mode 100644 OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user create mode 100644 OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs create mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs create mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj create mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user create mode 100644 OpenSim/Region/Physics/Manager/AssemblyInfo.cs create mode 100644 OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj create mode 100644 OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user create mode 100644 OpenSim/Region/Physics/Manager/PhysicsActor.cs create mode 100644 OpenSim/Region/Physics/Manager/PhysicsManager.cs create mode 100644 OpenSim/Region/Physics/Manager/PhysicsScene.cs create mode 100644 OpenSim/Region/Physics/Manager/PhysicsVector.cs create mode 100644 OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs create mode 100644 OpenSim/Region/Physics/OdePlugin/OdePlugin.cs create mode 100644 OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj create mode 100644 OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user create mode 100644 OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs create mode 100644 OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj create mode 100644 OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user create mode 100644 OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs create mode 100644 OpenSim/Region/Scripting/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Scripting/Script.cs create mode 100644 OpenSim/Region/Scripting/ScriptAccess.cs create mode 100644 OpenSim/Region/Simulation/Caps.cs create mode 100644 OpenSim/Region/Simulation/EstateManager.cs create mode 100644 OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj create mode 100644 OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user create mode 100644 OpenSim/Region/Simulation/ParcelManager.cs create mode 100644 OpenSim/Region/Simulation/RegionManager.cs create mode 100644 OpenSim/Region/Simulation/Scenes/Entity.cs create mode 100644 OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs create mode 100644 OpenSim/Region/Simulation/Scenes/Primitive.cs create mode 100644 OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs create mode 100644 OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs create mode 100644 OpenSim/Region/Simulation/Scenes/Scene.cs create mode 100644 OpenSim/Region/Simulation/Scenes/SceneBase.cs create mode 100644 OpenSim/Region/Simulation/Scenes/SceneEvents.cs create mode 100644 OpenSim/Region/Simulation/Scenes/SceneObject.cs create mode 100644 OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs create mode 100644 OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs create mode 100644 OpenSim/Region/Simulation/Scenes/ScenePresence.cs create mode 100644 OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs create mode 100644 OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs create mode 100644 OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs create mode 100644 OpenSim/Region/Simulation/Scenes/scripting/Script.cs create mode 100644 OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs create mode 100644 OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs create mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs create mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj create mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user create mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs create mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj create mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user create mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build create mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj create mode 100644 OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user create mode 100644 OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs new file mode 100644 index 0000000..40701b0 --- /dev/null +++ b/OpenSim/Region/Application/Application.cs @@ -0,0 +1,121 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Console; + +namespace OpenSim +{ + public class Application + { + //could move our main function into OpenSimMain and kill this class + [STAThread] + public static void Main(string[] args) + { + Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); + Console.WriteLine("Starting...\n"); + + bool sandBoxMode = false; + bool startLoginServer = false; + string physicsEngine = "basicphysics"; + bool allowFlying = false; + bool userAccounts = false; + bool gridLocalAsset = false; + bool useConfigFile = false; + bool silent = false; + string configFile = "simconfig.xml"; + + for (int i = 0; i < args.Length; i++) + { + if (args[i] == "-sandbox") + { + sandBoxMode = true; + startLoginServer = true; + } + /* + if (args[i] == "-loginserver") + { + startLoginServer = true; + }*/ + if (args[i] == "-accounts") + { + userAccounts = true; + } + if (args[i] == "-realphysx") + { + physicsEngine = "RealPhysX"; + allowFlying = true; + } + if (args[i] == "-ode") + { + physicsEngine = "OpenDynamicsEngine"; + allowFlying = true; + } + if (args[i] == "-localasset") + { + gridLocalAsset = true; + } + if (args[i] == "-configfile") + { + useConfigFile = true; + } + if (args[i] == "-noverbose") + { + silent = true; + } + if (args[i] == "-config") + { + try + { + i++; + configFile = args[i]; + } + catch (Exception e) + { + Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")"); + } + } + } + + OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile); + // OpenSimRoot.Instance.Application = sim; + sim.m_sandbox = sandBoxMode; + sim.user_accounts = userAccounts; + sim.gridLocalAsset = gridLocalAsset; + OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = allowFlying; + + sim.StartUp(); + + while (true) + { + OpenSim.Framework.Console.MainLog.Instance.MainLogPrompt(); + } + } + } +} diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj new file mode 100644 index 0000000..214f2cf --- /dev/null +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -0,0 +1,181 @@ + + + Local + 8.0.50727 + 2.0 + {438A9556-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim + JScript + Grid + IE50 + false + Exe + + OpenSim + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications.OGS1 + {6109024D-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.GenericConfig.Xml + {C74E4A30-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.UserManagement + {586E2916-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.ClientStack + {DC3698B2-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.LocalCommunications + {EB3A1BA8-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Simulation + {C0DAB338-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Terrain.BasicTerrain + {C9E0F891-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Application/OpenSim.csproj.user b/OpenSim/Region/Application/OpenSim.csproj.user new file mode 100644 index 0000000..2ff1c4c --- /dev/null +++ b/OpenSim/Region/Application/OpenSim.csproj.user @@ -0,0 +1,13 @@ + + + Debug + AnyCPU + -loginserver -sandbox -accounts + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs new file mode 100644 index 0000000..7da2263 --- /dev/null +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -0,0 +1,476 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Text; +using System.IO; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.Timers; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Region; +using OpenSim.Region.Scenes; +using OpenSim.Terrain; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework; +using OpenSim.Assets; +using OpenSim.Caches; +using OpenSim.Framework.Console; +using OpenSim.Physics.Manager; +using Nwc.XmlRpc; +using OpenSim.Servers; +using OpenSim.GenericConfig; +using OpenGrid.Framework.Communications; +using OpenSim.LocalCommunications; +using OpenGrid.Framework.Communications.OGS1; + +namespace OpenSim +{ + + public class OpenSimMain : RegionApplicationBase, conscmd_callback + { + // private CheckSumServer checkServer; + protected CommunicationsManager commsManager; + + private bool m_silent; + private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; + + public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) + { + this.configFileSetup = useConfigFile; + m_sandbox = sandBoxMode; + m_loginserver = startLoginServer; + m_physicsEngine = physicsEngine; + m_config = configFile; + m_silent = silent; + } + + /// + /// Performs initialisation of the world, such as loading configuration from disk. + /// + public override void StartUp() + { + this.serversData = new NetworkServersInfo(); + + this.localConfig = new XmlConfig(m_config); + this.localConfig.LoadData(); + + if (this.configFileSetup) + { + this.SetupFromConfigFile(this.localConfig); + } + + m_log = new LogBase(m_logFilename, "Region", this, m_silent); + OpenSim.Framework.Console.MainLog.Instance = m_log; + + m_log.Verbose( "Main.cs:Startup() - Loading configuration"); + this.serversData.InitConfig(this.m_sandbox, this.localConfig); + this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change + + ScenePresence.LoadTextureFile("avatar-texture.dat"); + + ClientView.TerrainManager = new TerrainManager(new SecondLife()); + + CommunicationsLocal sandboxCommunications = null; + if (m_sandbox) + { + this.SetupLocalGridServers(); + // this.checkServer = new CheckSumServer(12036); + // this.checkServer.ServerListener(); + sandboxCommunications = new CommunicationsLocal(this.serversData); + this.commsManager = sandboxCommunications; + } + else + { + this.SetupRemoteGridServers(); + this.commsManager = new GridCommsManager(this.serversData); + } + + startuptime = DateTime.Now; + + this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); + this.physManager.LoadPlugins(); + + this.SetupHttpListener(); + + this.SetupWorld(); + + m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server"); + + + + if (m_sandbox) + { + httpServer.AddXmlRPCHandler("login_to_simulator", sandboxCommunications.UserServices.XmlRpcLoginMethod); + } + + //Start http server + m_log.Verbose( "Main.cs:Startup() - Starting HTTP server"); + httpServer.Start(); + + // Start UDP servers + for (int i = 0; i < m_udpServer.Count; i++) + { + this.m_udpServer[i].ServerListener(); + } + + } + + # region Setup methods + protected override void SetupLocalGridServers() + { + try + { + AssetCache = new AssetCache("OpenSim.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + InventoryCache = new InventoryCache(); + } + catch (Exception e) + { + m_log.Error( e.Message + "\nSorry, could not setup local cache"); + Environment.Exit(1); + } + + } + + protected override void SetupRemoteGridServers() + { + try + { + AssetCache = new AssetCache("OpenSim.GridInterfaces.Remote.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + InventoryCache = new InventoryCache(); + } + catch (Exception e) + { + m_log.Error( e.Message + "\nSorry, could not setup remote cache"); + Environment.Exit(1); + } + } + + protected override void SetupWorld() + { + IGenericConfig regionConfig; + Scene LocalWorld; + UDPServer udpServer; + RegionInfo regionDat = new RegionInfo(); + AuthenticateSessionsBase authenBase; + + string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); + string[] configFiles = Directory.GetFiles(path, "*.xml"); + + if (configFiles.Length == 0) + { + string path2 = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); + string path3 = Path.Combine(path2, "default.xml"); + Console.WriteLine("Creating default region config file"); + //TODO create default region + IGenericConfig defaultConfig = new XmlConfig(path3); + defaultConfig.LoadData(); + defaultConfig.Commit(); + defaultConfig.Close(); + defaultConfig = null; + configFiles = Directory.GetFiles(path, "*.xml"); + } + + for (int i = 0; i < configFiles.Length; i++) + { + regionDat = new RegionInfo(); + if (m_sandbox) + { + AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal(); + this.AuthenticateSessionsHandler.Add(authen); + authenBase = authen; + } + else + { + AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); //new AuthenticateSessionsRemote(); + this.AuthenticateSessionsHandler.Add(authen); + authenBase = authen; + } + Console.WriteLine("Loading region config file"); + regionConfig = new XmlConfig(configFiles[i]); + regionConfig.LoadData(); + regionDat.InitConfig(this.m_sandbox, regionConfig); + regionConfig.Close(); + + udpServer = new UDPServer(regionDat.CommsIPListenPort, this.AssetCache, this.InventoryCache, this.m_log, authenBase); + + m_udpServer.Add(udpServer); + this.regionData.Add(regionDat); + + /* + m_log.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); + m_log.Verbose( "Initialising world"); + m_log.componentname = "Region " + regionData.RegionName; + */ + + LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager, this.AssetCache, httpServer); + this.m_localWorld.Add(LocalWorld); + //LocalWorld.InventoryCache = InventoryCache; + //LocalWorld.AssetCache = AssetCache; + + udpServer.LocalWorld = LocalWorld; + + LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. + LocalWorld.LoadWorldMap(); + + m_log.Verbose( "Main.cs:Startup() - Starting up messaging system"); + LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); + LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); + LocalWorld.LoadPrimsFromStorage(); + LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); + + + LocalWorld.StartTimer(); + } + } + + protected override void SetupHttpListener() + { + httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); + + if (!this.m_sandbox) + { + + // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server + + + httpServer.AddRestHandler("GET", "/simstatus/", + delegate(string request, string path, string param) + { + return "OK"; + }); + } + } + + protected override void ConnectToRemoteGridServer() + { + + } + + #endregion + + private void SetupFromConfigFile(IGenericConfig configData) + { + // Log filename + string attri = ""; + attri = configData.GetAttribute("LogFilename"); + if (String.IsNullOrEmpty(attri)) + { + } + else + { + m_logFilename = attri; + } + + // SandBoxMode + attri = ""; + attri = configData.GetAttribute("SandBox"); + if ((attri == "") || ((attri != "false") && (attri != "true"))) + { + this.m_sandbox = false; + configData.SetAttribute("SandBox", "false"); + } + else + { + this.m_sandbox = Convert.ToBoolean(attri); + } + + // LoginServer + attri = ""; + attri = configData.GetAttribute("LoginServer"); + if ((attri == "") || ((attri != "false") && (attri != "true"))) + { + this.m_loginserver = false; + configData.SetAttribute("LoginServer", "false"); + } + else + { + this.m_loginserver = Convert.ToBoolean(attri); + } + + // Sandbox User accounts + attri = ""; + attri = configData.GetAttribute("UserAccount"); + if ((attri == "") || ((attri != "false") && (attri != "true"))) + { + this.user_accounts = false; + configData.SetAttribute("UserAccounts", "false"); + } + else if (attri == "true") + { + this.user_accounts = Convert.ToBoolean(attri); + } + + // Grid mode hack to use local asset server + attri = ""; + attri = configData.GetAttribute("LocalAssets"); + if ((attri == "") || ((attri != "false") && (attri != "true"))) + { + this.gridLocalAsset = false; + configData.SetAttribute("LocalAssets", "false"); + } + else if (attri == "true") + { + this.gridLocalAsset = Convert.ToBoolean(attri); + } + + + attri = ""; + attri = configData.GetAttribute("PhysicsEngine"); + switch (attri) + { + default: + m_log.Warn( "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); + Environment.Exit(1); + break; + + case "": + this.m_physicsEngine = "basicphysics"; + configData.SetAttribute("PhysicsEngine", "basicphysics"); + OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = false; + break; + + case "basicphysics": + this.m_physicsEngine = "basicphysics"; + configData.SetAttribute("PhysicsEngine", "basicphysics"); + OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = false; + break; + + case "RealPhysX": + this.m_physicsEngine = "RealPhysX"; + OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = true; + break; + + case "OpenDynamicsEngine": + this.m_physicsEngine = "OpenDynamicsEngine"; + OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = true; + break; + } + + configData.Commit(); + + } + + /// + /// Performs any last-minute sanity checking and shuts down the region server + /// + public virtual void Shutdown() + { + m_log.Verbose( "Main.cs:Shutdown() - Closing all threads"); + m_log.Verbose( "Main.cs:Shutdown() - Killing listener thread"); + m_log.Verbose( "Main.cs:Shutdown() - Killing clients"); + // IMPLEMENT THIS + m_log.Verbose( "Main.cs:Shutdown() - Closing console and terminating"); + for (int i = 0; i < m_localWorld.Count; i++) + { + ((Scene)m_localWorld[i]).Close(); + } + m_log.Close(); + Environment.Exit(0); + } + + #region Console Commands + /// + /// Runs commands issued by the server console from the operator + /// + /// The first argument of the parameter (the command) + /// Additional arguments passed to the command + public void RunCmd(string command, string[] cmdparams) + { + switch (command) + { + case "help": + m_log.Error( "show users - show info about connected users"); + m_log.Error( "shutdown - disconnect all clients and shutdown"); + break; + + case "show": + if (cmdparams.Length > 0) + { + Show(cmdparams[0]); + } + break; + + case "terrain": + string result = ""; + for (int i = 0; i < m_localWorld.Count; i++) + { + if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result)) + { + m_log.Error(result); + } + } + break; + + case "shutdown": + Shutdown(); + break; + + default: + m_log.Error( "Unknown command"); + break; + } + } + + /// + /// Outputs to the console information about the region + /// + /// What information to display (valid arguments are "uptime", "users") + public void Show(string ShowWhat) + { + switch (ShowWhat) + { + case "uptime": + m_log.Error( "OpenSim has been running since " + startuptime.ToString()); + m_log.Error( "That is " + (DateTime.Now - startuptime).ToString()); + break; + case "users": + OpenSim.Region.Scenes.ScenePresence TempAv; + m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); + /* foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) + { + if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") + { + TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; + m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); + } + }*/ + break; + } + } + #endregion + } + + +} \ No newline at end of file diff --git a/OpenSim/Region/Caches/AssetCache.cs b/OpenSim/Region/Caches/AssetCache.cs new file mode 100644 index 0000000..d0cc370 --- /dev/null +++ b/OpenSim/Region/Caches/AssetCache.cs @@ -0,0 +1,670 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Reflection; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; + +namespace OpenSim.Caches +{ + public delegate void DownloadComplete(AssetCache.TextureSender sender); + + /// + /// Manages local cache of assets and their sending to viewers. + /// + public class AssetCache : IAssetReceiver + { + public Dictionary Assets; + public Dictionary Textures; + + public List AssetRequests = new List(); //assets ready to be sent to viewers + public List TextureRequests = new List(); //textures ready to be sent + + public Dictionary RequestedAssets = new Dictionary(); //Assets requested from the asset server + public Dictionary RequestedTextures = new Dictionary(); //Textures requested from the asset server + + public Dictionary SendingTextures = new Dictionary(); + private IAssetServer _assetServer; + private Thread _assetCacheThread; + private LLUUID[] textureList = new LLUUID[5]; + + /// + /// + /// + public AssetCache(IAssetServer assetServer) + { + Console.WriteLine("Creating Asset cache"); + _assetServer = assetServer; + _assetServer.SetReceiver(this); + Assets = new Dictionary(); + Textures = new Dictionary(); + this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); + this._assetCacheThread.IsBackground = true; + this._assetCacheThread.Start(); + + } + + public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) + { + Console.WriteLine("Creating Asset cache"); + _assetServer = this.LoadAssetDll(assetServerDLLName); + _assetServer.SetServerInfo(assetServerURL, assetServerKey); + _assetServer.SetReceiver(this); + Assets = new Dictionary(); + Textures = new Dictionary(); + this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); + this._assetCacheThread.IsBackground = true; + this._assetCacheThread.Start(); + + } + + /// + /// + /// + public void RunAssetManager() + { + while (true) + { + try + { + //Console.WriteLine("Asset cache loop"); + this.ProcessAssetQueue(); + this.ProcessTextureQueue(); + Thread.Sleep(500); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + } + + public void LoadDefaultTextureSet() + { + //hack: so we can give each user a set of textures + textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); + textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); + textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003"); + textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004"); + textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005"); + + for (int i = 0; i < textureList.Length; i++) + { + this._assetServer.RequestAsset(textureList[i], true); + } + + } + + public AssetBase[] CreateNewInventorySet(LLUUID agentID) + { + AssetBase[] inventorySet = new AssetBase[this.textureList.Length]; + for (int i = 0; i < textureList.Length; i++) + { + if (this.Textures.ContainsKey(textureList[i])) + { + inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]); + TextureImage image = new TextureImage(inventorySet[i]); + this.Textures.Add(image.FullID, image); + this._assetServer.UploadNewAsset(image); //save the asset to the asset server + } + } + return inventorySet; + } + + public AssetBase GetAsset(LLUUID assetID) + { + AssetBase asset = null; + if (this.Textures.ContainsKey(assetID)) + { + asset = this.Textures[assetID]; + } + else if (this.Assets.ContainsKey(assetID)) + { + asset = this.Assets[assetID]; + } + return asset; + } + + public void AddAsset(AssetBase asset) + { + // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); + if (asset.Type == 0) + { + //Console.WriteLine("which is a texture"); + if (!this.Textures.ContainsKey(asset.FullID)) + { //texture + TextureImage textur = new TextureImage(asset); + this.Textures.Add(textur.FullID, textur); + this._assetServer.UploadNewAsset(asset); + } + } + else + { + if (!this.Assets.ContainsKey(asset.FullID)) + { + AssetInfo assetInf = new AssetInfo(asset); + this.Assets.Add(assetInf.FullID, assetInf); + this._assetServer.UploadNewAsset(asset); + } + } + } + + /// + /// + /// + private void ProcessTextureQueue() + { + if (this.TextureRequests.Count == 0) + { + //no requests waiting + return; + } + int num; + num = this.TextureRequests.Count; + + AssetRequest req; + for (int i = 0; i < num; i++) + { + req = (AssetRequest)this.TextureRequests[i]; + if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) + { + TextureSender sender = new TextureSender(req); + sender.OnComplete += this.TextureSent; + lock (this.SendingTextures) + { + this.SendingTextures.Add(req.ImageInfo.FullID, sender); + } + } + + } + + this.TextureRequests.Clear(); + } + + /// + /// Event handler, called by a TextureSender object to say that texture has been sent + /// + /// + public void TextureSent(AssetCache.TextureSender sender) + { + if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) + { + lock (this.SendingTextures) + { + this.SendingTextures.Remove(sender.request.ImageInfo.FullID); + } + } + } + + public void AssetReceived(AssetBase asset, bool IsTexture) + { + if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server + { + //check if it is a texture or not + //then add to the correct cache list + //then check for waiting requests for this asset/texture (in the Requested lists) + //and move those requests into the Requests list. + if (IsTexture) + { + TextureImage image = new TextureImage(asset); + this.Textures.Add(image.FullID, image); + if (this.RequestedTextures.ContainsKey(image.FullID)) + { + AssetRequest req = this.RequestedTextures[image.FullID]; + req.ImageInfo = image; + if (image.Data.LongLength > 600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000; + } + else + { + req.NumPackets = 1; + } + this.RequestedTextures.Remove(image.FullID); + this.TextureRequests.Add(req); + } + } + else + { + AssetInfo assetInf = new AssetInfo(asset); + this.Assets.Add(assetInf.FullID, assetInf); + if (this.RequestedAssets.ContainsKey(assetInf.FullID)) + { + AssetRequest req = this.RequestedAssets[assetInf.FullID]; + req.AssetInf = assetInf; + if (assetInf.Data.LongLength > 600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; + } + else + { + req.NumPackets = 1; + } + this.RequestedAssets.Remove(assetInf.FullID); + this.AssetRequests.Add(req); + } + } + } + } + + public void AssetNotFound(AssetBase asset) + { + //the asset server had no knowledge of requested asset + + } + + #region Assets + /// + /// + /// + /// + /// + public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest) + { + LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); + //check to see if asset is in local cache, if not we need to request it from asset server. + + if (!this.Assets.ContainsKey(requestID)) + { + //not found asset + // so request from asset server + if (!this.RequestedAssets.ContainsKey(requestID)) + { + AssetRequest request = new AssetRequest(); + request.RequestUser = userInfo; + request.RequestAssetID = requestID; + request.TransferRequestID = transferRequest.TransferInfo.TransferID; + this.RequestedAssets.Add(requestID, request); + this._assetServer.RequestAsset(requestID, false); + } + return; + } + //it is in our cache + AssetInfo asset = this.Assets[requestID]; + + //work out how many packets it should be sent in + // and add to the AssetRequests list + AssetRequest req = new AssetRequest(); + req.RequestUser = userInfo; + req.RequestAssetID = requestID; + req.TransferRequestID = transferRequest.TransferInfo.TransferID; + req.AssetInf = asset; + + if (asset.Data.LongLength > 600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; + } + else + { + req.NumPackets = 1; + } + + this.AssetRequests.Add(req); + } + + /// + /// + /// + private void ProcessAssetQueue() + { + if (this.AssetRequests.Count == 0) + { + //no requests waiting + return; + } + int num; + + if (this.AssetRequests.Count < 5) + { + //lower than 5 so do all of them + num = this.AssetRequests.Count; + } + else + { + num = 5; + } + AssetRequest req; + for (int i = 0; i < num; i++) + { + req = (AssetRequest)this.AssetRequests[i]; + + TransferInfoPacket Transfer = new TransferInfoPacket(); + Transfer.TransferInfo.ChannelType = 2; + Transfer.TransferInfo.Status = 0; + Transfer.TransferInfo.TargetType = 0; + Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); + Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; + Transfer.TransferInfo.TransferID = req.TransferRequestID; + req.RequestUser.OutPacket(Transfer); + + if (req.NumPackets == 1) + { + TransferPacketPacket TransferPacket = new TransferPacketPacket(); + TransferPacket.TransferData.Packet = 0; + TransferPacket.TransferData.ChannelType = 2; + TransferPacket.TransferData.TransferID = req.TransferRequestID; + TransferPacket.TransferData.Data = req.AssetInf.Data; + TransferPacket.TransferData.Status = 1; + req.RequestUser.OutPacket(TransferPacket); + } + else + { + //more than one packet so split file up , for now it can't be bigger than 2000 bytes + TransferPacketPacket TransferPacket = new TransferPacketPacket(); + TransferPacket.TransferData.Packet = 0; + TransferPacket.TransferData.ChannelType = 2; + TransferPacket.TransferData.TransferID = req.TransferRequestID; + byte[] chunk = new byte[1000]; + Array.Copy(req.AssetInf.Data, chunk, 1000); + TransferPacket.TransferData.Data = chunk; + TransferPacket.TransferData.Status = 0; + req.RequestUser.OutPacket(TransferPacket); + + TransferPacket = new TransferPacketPacket(); + TransferPacket.TransferData.Packet = 1; + TransferPacket.TransferData.ChannelType = 2; + TransferPacket.TransferData.TransferID = req.TransferRequestID; + byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)]; + Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); + TransferPacket.TransferData.Data = chunk1; + TransferPacket.TransferData.Status = 1; + req.RequestUser.OutPacket(TransferPacket); + } + + } + + //remove requests that have been completed + for (int i = 0; i < num; i++) + { + this.AssetRequests.RemoveAt(0); + } + + } + + public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset) + { + AssetInfo newAsset = new AssetInfo(); + newAsset.Data = new byte[sourceAsset.Data.Length]; + Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length); + newAsset.FullID = LLUUID.Random(); + newAsset.Type = sourceAsset.Type; + newAsset.InvType = sourceAsset.InvType; + return (newAsset); + } + #endregion + + #region Textures + /// + /// + /// + /// + /// + public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID) + { + //Console.WriteLine("texture request for " + imageID.ToStringHyphenated()); + //check to see if texture is in local cache, if not request from asset server + if (!this.Textures.ContainsKey(imageID)) + { + if (!this.RequestedTextures.ContainsKey(imageID)) + { + //not is cache so request from asset server + AssetRequest request = new AssetRequest(); + request.RequestUser = userInfo; + request.RequestAssetID = imageID; + request.IsTextureRequest = true; + this.RequestedTextures.Add(imageID, request); + this._assetServer.RequestAsset(imageID, true); + } + return; + } + + //Console.WriteLine("texture already in cache"); + TextureImage imag = this.Textures[imageID]; + AssetRequest req = new AssetRequest(); + req.RequestUser = userInfo; + req.RequestAssetID = imageID; + req.IsTextureRequest = true; + req.ImageInfo = imag; + + if (imag.Data.LongLength > 600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000; + } + else + { + req.NumPackets = 1; + } + this.TextureRequests.Add(req); + } + + public TextureImage CloneImage(LLUUID newOwner, TextureImage source) + { + TextureImage newImage = new TextureImage(); + newImage.Data = new byte[source.Data.Length]; + Array.Copy(source.Data, newImage.Data, source.Data.Length); + //newImage.filename = source.filename; + newImage.FullID = LLUUID.Random(); + newImage.Name = source.Name; + return (newImage); + } + #endregion + + private IAssetServer LoadAssetDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + IAssetServer server = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); + + if (typeInterface != null) + { + IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + server = plug.GetAssetServer(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return server; + } + + public class AssetRequest + { + public IClientAPI RequestUser; + public LLUUID RequestAssetID; + public AssetInfo AssetInf; + public TextureImage ImageInfo; + public LLUUID TransferRequestID; + public long DataPointer = 0; + public int NumPackets = 0; + public int PacketCounter = 0; + public bool IsTextureRequest; + //public bool AssetInCache; + //public int TimeRequested; + + public AssetRequest() + { + + } + } + + public class AssetInfo : AssetBase + { + public AssetInfo() + { + + } + + public AssetInfo(AssetBase aBase) + { + Data = aBase.Data; + FullID = aBase.FullID; + Type = aBase.Type; + InvType = aBase.InvType; + Name = aBase.Name; + Description = aBase.Description; + } + } + + public class TextureImage : AssetBase + { + public TextureImage() + { + + } + + public TextureImage(AssetBase aBase) + { + Data = aBase.Data; + FullID = aBase.FullID; + Type = aBase.Type; + InvType = aBase.InvType; + Name = aBase.Name; + Description = aBase.Description; + } + } + + public class TextureSender + { + public AssetRequest request; + public event DownloadComplete OnComplete; + Thread m_thread; + public TextureSender(AssetRequest req) + { + request = req; + //Console.WriteLine("creating worker thread for texture " + req.ImageInfo.FullID.ToStringHyphenated()); + //Console.WriteLine("texture data length is " + req.ImageInfo.Data.Length); + // Console.WriteLine("in " + req.NumPackets + " packets"); + //ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object()); + + //need some sort of custom threadpool here, as using the .net one, overloads it and stops the handling of incoming packets etc + //but don't really want to create a thread for every texture download + m_thread = new Thread(new ThreadStart(SendTexture)); + m_thread.IsBackground = true; + m_thread.Start(); + } + + public void SendTexture() + { + //Console.WriteLine("starting to send sending texture " + request.ImageInfo.FullID.ToStringHyphenated()); + while (request.PacketCounter != request.NumPackets) + { + SendPacket(); + Thread.Sleep(500); + } + + //Console.WriteLine("finished sending texture " + request.ImageInfo.FullID.ToStringHyphenated()); + if (OnComplete != null) + { + OnComplete(this); + } + } + + public void SendPacket() + { + AssetRequest req = request; + // Console.WriteLine("sending " + req.ImageInfo.FullID); + + // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) + if (req.PacketCounter == 0) + { + //first time for this request so send imagedata packet + if (req.NumPackets == 1) + { + //only one packet so send whole file + ImageDataPacket im = new ImageDataPacket(); + im.ImageID.Packets = 1; + im.ImageID.ID = req.ImageInfo.FullID; + im.ImageID.Size = (uint)req.ImageInfo.Data.Length; + im.ImageData.Data = req.ImageInfo.Data; + im.ImageID.Codec = 2; + req.RequestUser.OutPacket(im); + req.PacketCounter++; + //req.ImageInfo.l= time; + //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID); + // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); + } + else + { + //more than one packet so split file up + ImageDataPacket im = new ImageDataPacket(); + im.ImageID.Packets = (ushort)req.NumPackets; + im.ImageID.ID = req.ImageInfo.FullID; + im.ImageID.Size = (uint)req.ImageInfo.Data.Length; + im.ImageData.Data = new byte[600]; + Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); + im.ImageID.Codec = 2; + req.RequestUser.OutPacket(im); + req.PacketCounter++; + //req.ImageInfo.last_used = time; + //System.Console.WriteLine("sent first packet of texture: + // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); + } + } + else + { + //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated()); + //send imagepacket + //more than one packet so split file up + ImagePacketPacket im = new ImagePacketPacket(); + im.ImageID.Packet = (ushort)req.PacketCounter; + im.ImageID.ID = req.ImageInfo.FullID; + int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1); + if (size > 1000) size = 1000; + im.ImageData.Data = new byte[size]; + Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size); + req.RequestUser.OutPacket(im); + req.PacketCounter++; + //req.ImageInfo.last_used = time; + //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); + } + + } + } + } +} + diff --git a/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj b/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj new file mode 100644 index 0000000..4a73d08 --- /dev/null +++ b/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj @@ -0,0 +1,97 @@ + + + Local + 8.0.50727 + 2.0 + {61FCCDB3-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Caches + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Caches + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user b/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..00f5dfe --- /dev/null +++ b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Caches")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Caches")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2b15ddbf-0341-49a6-85c0-cece268a4518")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Caps/Caps.cs b/OpenSim/Region/Caps/Caps.cs new file mode 100644 index 0000000..13a351d --- /dev/null +++ b/OpenSim/Region/Caps/Caps.cs @@ -0,0 +1,258 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using OpenSim.Servers; +using OpenSim.Framework; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Types; +using OpenSim.Caches; +using libsecondlife; + +namespace OpenSim.Region +{ + public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); + + public class Caps + { + private string httpListenerAddress; + private uint httpListenPort; + private string capsObjectPath = "00001-"; + private string requestPath = "0000/"; + private string mapLayerPath = "0001/"; + private string newInventory = "0002/"; + private string requestTexture = "0003/"; + private string eventQueue = "0100/"; + private BaseHttpServer httpListener; + private LLUUID agentID; + private AssetCache assetCache; + private int eventQueueCount = 1; + private Queue CapsEventQueue = new Queue(); + + public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) + { + assetCache = assetCach; + capsObjectPath = capsPath; + httpListener = httpServer; + httpListenerAddress = httpListen; + httpListenPort = httpPort; + agentID = agent; + } + + /// + /// + /// + public void RegisterHandlers() + { + Console.WriteLine("registering CAPS handlers"); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); + } + + /// + /// + /// + /// + /// + /// + /// + public string CapsRequest(string request, string path, string param) + { + // Console.WriteLine("Caps Request " + request); + string result = ""; + result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); + return result; + } + + /// + /// + /// + /// + protected LLSDCapsDetails GetCapabilities() + { + /* string capURLS = ""; + capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; + capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; + //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; + //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; + return capURLS;*/ + + LLSDCapsDetails caps = new LLSDCapsDetails(); + caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; + caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; + return caps; + } + + /// + /// + /// + /// + /// + /// + /// + public string MapLayer(string request, string path, string param) + { + Encoding _enc = System.Text.Encoding.UTF8; + Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); + LLSDMapRequest mapReq = new LLSDMapRequest(); + LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); + + LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); + + //Console.WriteLine(" Maplayer response is " + res); + + return res; + } + + /// + /// + /// + /// + protected LLSDMapLayer BuildLLSDMapLayerResponse() + { + LLSDMapLayer mapLayer = new LLSDMapLayer(); + mapLayer.Right = 5000; + mapLayer.Top = 5000; + mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); + + return mapLayer; + } + + public string ProcessEventQueue(string request, string path, string param) + { + // Console.WriteLine("event queue request " + request); + string res = ""; + int timer = 0; + + /*while ((timer < 200) || (this.CapsEventQueue.Count < 1)) + { + timer++; + }*/ + if (this.CapsEventQueue.Count > 0) + { + lock (this.CapsEventQueue) + { + string item = CapsEventQueue.Dequeue(); + res = item; + } + } + else + { + res = this.CreateEmptyEventResponse(); + } + return res; + } + + public string CreateEstablishAgentComms(string caps, string ipAddressPort) + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += "messageEstablishAgentCommunication"; + res += "body"; + res += "sim-ip-and-port" + ipAddressPort + ""; + res += "seed-capability" + caps + ""; + res += "agent-id" + this.agentID.ToStringHyphenated() + ""; + res += ""; + res += ""; + res += ""; + eventQueueCount++; + this.CapsEventQueue.Enqueue(res); + return res; + } + + public string CreateEmptyEventResponse() + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + + public string NewAgentInventory(string request, string path, string param) + { + //Console.WriteLine("received upload request:"+ request); + string res = ""; + LLUUID newAsset = LLUUID.Random(); + LLUUID newInvItem = LLUUID.Random(); + string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); + AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); + httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); + string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; + //Console.WriteLine("uploader url is " + uploaderURL); + res += ""; + res += "uploader" + uploaderURL + ""; + //res += "successtrue"; + res += "stateupload"; + res += ""; + uploader.OnUpLoad += this.UploadHandler; + return res; + } + + public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) + { + // Console.WriteLine("upload handler called"); + AssetBase asset; + asset = new AssetBase(); + asset.FullID = assetID; + asset.Type = 0; + asset.InvType = 0; + asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = data; + this.assetCache.AddAsset(asset); + } + + public class AssetUploader + { + public event UpLoadedTexture OnUpLoad; + + private string uploaderPath = ""; + private LLUUID newAssetID; + private LLUUID inventoryItemID; + private BaseHttpServer httpListener; + public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) + { + newAssetID = assetID; + inventoryItemID = inventoryItem; + uploaderPath = path; + httpListener = httpServer; + + } + + public string uploaderCaps(string request, string path, string param) + { + Encoding _enc = System.Text.Encoding.UTF8; + byte[] data = _enc.GetBytes(request); + //Console.WriteLine("recieved upload " + Util.FieldToString(data)); + LLUUID inv = this.inventoryItemID; + string res = ""; + res += ""; + res += "new_asset" + newAssetID.ToStringHyphenated() + ""; + res += "new_inventory_item" + inv.ToStringHyphenated() + ""; + res += "statecomplete"; + res += ""; + + // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); + httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); + if (OnUpLoad != null) + { + OnUpLoad(newAssetID, inv, data); + } + + /*FileStream fs = File.Create("upload.jp2"); + BinaryWriter bw = new BinaryWriter(fs); + bw.Write(data); + bw.Close(); + fs.Close();*/ + return res; + } + } + } +} diff --git a/OpenSim/Region/Caps/LLSDHelpers.cs b/OpenSim/Region/Caps/LLSDHelpers.cs new file mode 100644 index 0000000..051520c --- /dev/null +++ b/OpenSim/Region/Caps/LLSDHelpers.cs @@ -0,0 +1,246 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using libsecondlife; + +namespace OpenSim.Framework +{ + public class LLSDHelpers + { + public static string SerialiseLLSDReply(object obj) + { + StringWriter sw = new StringWriter(); + XmlTextWriter writer = new XmlTextWriter(sw); + writer.Formatting = Formatting.None; + writer.WriteStartElement(String.Empty, "llsd", String.Empty); + LLSDHelpers.SerializeLLSDType(writer, obj); + writer.WriteEndElement(); + writer.Close(); + return sw.ToString(); + } + + public static void SerializeLLSDType(XmlTextWriter writer, object obj) + { + Type myType = obj.GetType(); + LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); + if (llsdattributes.Length > 0) + { + switch (llsdattributes[0].ObjectType) + { + case "MAP": + writer.WriteStartElement(String.Empty, "map", String.Empty); + System.Reflection.FieldInfo[] fields = myType.GetFields(); + for (int i = 0; i < fields.Length; i++) + { + object fieldValue = fields[i].GetValue(obj); + LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); + if (fieldAttributes.Length > 0) + { + writer.WriteStartElement(String.Empty, "key", String.Empty); + writer.WriteString(fields[i].Name); + writer.WriteEndElement(); + SerializeLLSDType(writer, fieldValue); + } + else + { + //Console.WriteLine("LLSD field name" + fields[i].Name + " , " + fields[i].GetValue(obj).GetType()); + writer.WriteStartElement(String.Empty, "key", String.Empty); + writer.WriteString(fields[i].Name); + writer.WriteEndElement(); + LLSD.LLSDWriteOne(writer, fieldValue); + } + } + writer.WriteEndElement(); + break; + case "ARRAY": + // LLSDArray arrayObject = obj as LLSDArray; + // ArrayList a = arrayObject.Array; + ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); + writer.WriteStartElement(String.Empty, "array", String.Empty); + foreach (object item in a) + { + SerializeLLSDType(writer, item); + } + writer.WriteEndElement(); + break; + } + } + else + { + LLSD.LLSDWriteOne(writer, obj); + } + } + + public static object DeserialiseLLSDMap(Hashtable llsd, object obj) + { + Type myType = obj.GetType(); + LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); + if (llsdattributes.Length > 0) + { + switch (llsdattributes[0].ObjectType) + { + case "MAP": + IDictionaryEnumerator enumerator = llsd.GetEnumerator(); + while (enumerator.MoveNext()) + { + System.Reflection.FieldInfo field = myType.GetField((string)enumerator.Key); + if (field != null) + { + if (enumerator.Value is Hashtable) + { + object fieldValue = field.GetValue(obj); + DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); + } + else if (enumerator.Value is ArrayList) + { + object fieldValue = field.GetValue(obj); + fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); + //TODO + // the LLSD map/array types in the array need to be deserialised + // but first we need to know the right class to deserialise them into. + } + else + { + field.SetValue(obj, enumerator.Value); + } + } + } + break; + } + } + return obj; + } + } + + [LLSDType("MAP")] + public class LLSDMapLayerResponse + { + public LLSDMapRequest AgentData = new LLSDMapRequest(); + public LLSDArray LayerData = new LLSDArray(); + + public LLSDMapLayerResponse() + { + + } + } + + [LLSDType("MAP")] + public class LLSDCapsDetails + { + public string MapLayer = ""; + public string NewFileAgentInventory = ""; + //public string EventQueueGet = ""; + + public LLSDCapsDetails() + { + + } + } + + [LLSDType("MAP")] + public class LLSDMapLayer + { + public int Left = 0; + public int Right = 0; + public int Top = 0; + public int Bottom = 0; + public LLUUID ImageID = LLUUID.Zero; + + public LLSDMapLayer() + { + + } + } + + [LLSDType("ARRAY")] + public class LLSDArray + { + public ArrayList Array = new ArrayList(); + + public LLSDArray() + { + + } + } + + [LLSDType("MAP")] + public class LLSDMapRequest + { + public int Flags = 0; + + public LLSDMapRequest() + { + + } + } + + [LLSDType("MAP")] + public class LLSDUploadReply + { + public string new_asset = ""; + public LLUUID new_inventory_item = LLUUID.Zero; + public string state = ""; + + public LLSDUploadReply() + { + + } + } + + [LLSDType("MAP")] + public class LLSDCapEvent + { + public int id = 0; + public LLSDArray events = new LLSDArray(); + + public LLSDCapEvent() + { + + } + } + + [LLSDType("MAP")] + public class LLSDEmpty + { + public LLSDEmpty() + { + + } + } + + [LLSDType("MAP")] + public class LLSDTest + { + public int Test1 = 20; + public int Test2 = 10; + + public LLSDTest() + { + + } + } + + + [AttributeUsage(AttributeTargets.Class)] + public class LLSDType : Attribute + { + private string myType; + + public LLSDType(string type) + { + myType = type; + + } + + public string ObjectType + { + get + { + return myType; + } + } + } +} diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs new file mode 100644 index 0000000..5d5021c --- /dev/null +++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs @@ -0,0 +1,337 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Collections.Generic; +using libsecondlife; +using OpenSim; +using libsecondlife.Packets; +//using OpenSim.GridServers; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; +using OpenSim.Framework.Interfaces; + +namespace OpenSim.Assets +{ + /// + /// Description of InventoryManager. + /// + public class InventoryCache + { + private Dictionary _agentsInventory; + private List _serverRequests; //list of requests made to user server. + private System.Text.Encoding _enc = System.Text.Encoding.ASCII; + private const uint FULL_MASK_PERMISSIONS = 2147483647; + + public InventoryCache() + { + _agentsInventory = new Dictionary(); + _serverRequests = new List(); + } + + public void AddNewAgentsInventory(AgentInventory agentInventory) + { + if (!this._agentsInventory.ContainsKey(agentInventory.AgentID)) + { + this._agentsInventory.Add(agentInventory.AgentID, agentInventory); + } + } + + public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver) + { + AgentInventory res = null; + if (!this._agentsInventory.ContainsKey(agentID)) + { + res = userserver.RequestAgentsInventory(agentID); + this._agentsInventory.Add(agentID,res); + } + return res; + } + + public AgentInventory GetAgentsInventory(LLUUID agentID) + { + if (this._agentsInventory.ContainsKey(agentID)) + { + return this._agentsInventory[agentID]; + } + + return null; + } + + public void ClientLeaving(LLUUID clientID, IUserServer userserver) + { + if (this._agentsInventory.ContainsKey(clientID)) + { + if (userserver != null) + { + userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]); + } + this._agentsInventory.Remove(clientID); + } + } + + public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID) + { + return this.CreateNewInventoryFolder(remoteClient, folderID, 0); + } + + public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type) + { + bool res = false; + if (folderID != LLUUID.Zero) //don't create a folder with a zero id + { + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); + } + } + return res; + } + + public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent) + { + bool res = false; + if (folderID != LLUUID.Zero) //don't create a folder with a zero id + { + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent); + } + } + return res; + } + + public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, OpenSim.Framework.Types.AssetBase asset) + { + LLUUID newItem = null; + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset); + if (newItem != null) + { + InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem]; + this.SendItemUpdateCreate(remoteClient, Item); + } + } + + return newItem; + } + public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID) + { + bool res = false; + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID); + if (res) + { + RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); + remove.AgentData.AgentID = remoteClient.AgentID; + remove.AgentData.SessionID = remoteClient.SessionID; + remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; + remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); + remove.InventoryData[0].ItemID = itemID; + remoteClient.OutPacket(remove); + } + } + + return res; + } + + public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, OpenSim.Framework.Types.AssetBase asset) + { + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset); + if (res) + { + InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; + this.SendItemUpdateCreate(remoteClient, Item); + } + return res; + } + + return false; + } + + public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) + { + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet); + if (res) + { + InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; + this.SendItemUpdateCreate(remoteClient, Item); + } + return res; + } + + return false; + } + + public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend) + { + if (this._agentsInventory.ContainsKey(userInfo.AgentID)) + { + AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; + if (FetchDescend.InventoryData.FetchItems) + { + if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID)) + { + InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID]; + InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); + Descend.AgentData.AgentID = userInfo.AgentID; + Descend.AgentData.OwnerID = Folder.OwnerID; + Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; + Descend.AgentData.Descendents = Folder.Items.Count; + Descend.AgentData.Version = Folder.Items.Count; + + + Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; + for (int i = 0; i < Folder.Items.Count; i++) + { + + InventoryItem Item = Folder.Items[i]; + Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); + Descend.ItemData[i].ItemID = Item.ItemID; + Descend.ItemData[i].AssetID = Item.AssetID; + Descend.ItemData[i].CreatorID = Item.CreatorID; + Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; + Descend.ItemData[i].CreationDate = 1000; + Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0"); + Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; + Descend.ItemData[i].Flags = 1; + Descend.ItemData[i].FolderID = Item.FolderID; + Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); + Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; + Descend.ItemData[i].InvType = Item.InvType; + Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0"); + Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; + Descend.ItemData[i].OwnerID = Item.OwnerID; + Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; + Descend.ItemData[i].SalePrice = 100; + Descend.ItemData[i].SaleType = 0; + Descend.ItemData[i].Type = Item.Type; + Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + } + + userInfo.OutPacket(Descend); + + } + } + else + { + Console.WriteLine("fetch subfolders"); + } + } + } + + public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems) + { + if (this._agentsInventory.ContainsKey(userInfo.AgentID)) + { + AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; + + for (int i = 0; i < FetchItems.InventoryData.Length; i++) + { + if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID)) + { + InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID]; + FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); + InventoryReply.AgentData.AgentID = userInfo.AgentID; + InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; + InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); + InventoryReply.InventoryData[0].ItemID = Item.ItemID; + InventoryReply.InventoryData[0].AssetID = Item.AssetID; + InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; + InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); + InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].Flags = 0; + InventoryReply.InventoryData[0].FolderID = Item.FolderID; + InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); + InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].InvType = Item.InvType; + InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); + InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; + InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].SalePrice = 100; + InventoryReply.InventoryData[0].SaleType = 0; + InventoryReply.InventoryData[0].Type = Item.Type; + InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + userInfo.OutPacket(InventoryReply); + } + } + } + } + + private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item) + { + + UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); + InventoryReply.AgentData.AgentID = remoteClient.AgentID; + InventoryReply.AgentData.SimApproved = true; + InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; + InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); + InventoryReply.InventoryData[0].ItemID = Item.ItemID; + InventoryReply.InventoryData[0].AssetID = Item.AssetID; + InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; + InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].CreationDate = 1000; + InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); + InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].Flags = 0; + InventoryReply.InventoryData[0].FolderID = Item.FolderID; + InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); + InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].InvType = Item.InvType; + InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); + InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; + InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; + InventoryReply.InventoryData[0].SalePrice = 100; + InventoryReply.InventoryData[0].SaleType = 0; + InventoryReply.InventoryData[0].Type = Item.Type; + InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + + remoteClient.OutPacket(InventoryReply); + } + } + + + + public class UserServerRequest + { + public UserServerRequest() + { + + } + } +} diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs new file mode 100644 index 0000000..7552195 --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.Net; +using System.Net.Sockets; +using libsecondlife; + + +namespace OpenSim +{ + + public interface ClientStackNetworkHandler + { + void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); + void RemoveClientCircuit(uint circuitcode); + void RegisterPacketServer(PacketServer server); + } + +} diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs new file mode 100644 index 0000000..902f3c7 --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -0,0 +1,975 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; + +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim +{ + partial class ClientView + { + public event ChatFromViewer OnChatFromViewer; + public event RezObject OnRezObject; + public event GenericCall4 OnDeRezObject; + public event ModifyTerrain OnModifyTerrain; + public event GenericCall OnRegionHandShakeReply; + public event GenericCall OnRequestWearables; + public event SetAppearance OnSetAppearance; + public event GenericCall2 OnCompleteMovementToRegion; + public event UpdateAgent OnAgentUpdate; + public event StartAnim OnStartAnim; + public event GenericCall OnRequestAvatarsData; + public event LinkObjects OnLinkObjects; + public event UpdateVector OnGrapObject; + public event ObjectSelect OnDeGrapObject; + public event MoveObject OnGrapUpdate; + public event GenericCall4 OnAddPrim; + public event UpdateShape OnUpdatePrimShape; + public event ObjectSelect OnObjectSelect; + public event UpdatePrimFlags OnUpdatePrimFlags; + public event UpdatePrimTexture OnUpdatePrimTexture; + public event UpdateVector OnUpdatePrimPosition; + public event UpdatePrimRotation OnUpdatePrimRotation; + public event UpdateVector OnUpdatePrimScale; + public event StatusChange OnChildAgentStatus; + public event GenericCall2 OnStopMovement; + public event NewAvatar OnNewAvatar; + public event GenericCall6 OnRemoveAvatar; + public event RequestMapBlocks OnRequestMapBlocks; + public event TeleportLocationRequest OnTeleportLocationRequest; + + public event ParcelPropertiesRequest OnParcelPropertiesRequest; + public event ParcelDivideRequest OnParcelDivideRequest; + public event ParcelJoinRequest OnParcelJoinRequest; + public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + + public event EstateOwnerMessageRequest OnEstateOwnerMessage; + + /// + /// + /// + public LLVector3 StartPos + { + get + { + return startpos; + } + set + { + startpos = value; + } + } + + /// + /// + /// + public LLUUID AgentId + { + get + { + return this.AgentID; + } + } + + /// + /// + /// + public string FirstName + { + get + { + return this.firstName; + } + + } + + /// + /// + /// + public string LastName + { + get + { + return this.lastName; + } + } + + #region World/Avatar to Client + + /// + /// + /// + /// + public void SendRegionHandshake(RegionInfo regionInfo) + { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + RegionHandshakePacket handshake = new RegionHandshakePacket(); + + handshake.RegionInfo.BillableFactor = regionInfo.estateSettings.billableFactor; + handshake.RegionInfo.IsEstateManager = false; + handshake.RegionInfo.TerrainHeightRange00 = regionInfo.estateSettings.terrainHeightRange0; + handshake.RegionInfo.TerrainHeightRange01 = regionInfo.estateSettings.terrainHeightRange1; + handshake.RegionInfo.TerrainHeightRange10 = regionInfo.estateSettings.terrainHeightRange2; + handshake.RegionInfo.TerrainHeightRange11 = regionInfo.estateSettings.terrainHeightRange3; + handshake.RegionInfo.TerrainStartHeight00 = regionInfo.estateSettings.terrainStartHeight0; + handshake.RegionInfo.TerrainStartHeight01 = regionInfo.estateSettings.terrainStartHeight1; + handshake.RegionInfo.TerrainStartHeight10 = regionInfo.estateSettings.terrainStartHeight2; + handshake.RegionInfo.TerrainStartHeight11 = regionInfo.estateSettings.terrainStartHeight3; + handshake.RegionInfo.SimAccess = (byte)regionInfo.estateSettings.simAccess; + handshake.RegionInfo.WaterHeight = regionInfo.estateSettings.waterHeight; + + + handshake.RegionInfo.RegionFlags = (uint)regionInfo.estateSettings.regionFlags; + + handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); + handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; + handshake.RegionInfo.TerrainBase0 = regionInfo.estateSettings.terrainBase0; + handshake.RegionInfo.TerrainBase1 = regionInfo.estateSettings.terrainBase1; + handshake.RegionInfo.TerrainBase2 = regionInfo.estateSettings.terrainBase2; + handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3; + handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0; + handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1; + handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2; + handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3; + handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? + + this.OutPacket(handshake); + } + + /// + /// + /// + /// + public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) + { + AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); + mov.AgentData.SessionID = this.SessionID; + mov.AgentData.AgentID = this.AgentID; + mov.Data.RegionHandle = regInfo.RegionHandle; + mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this + + if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) + { + mov.Data.Position = this.startpos; + } + else + { + mov.Data.Position = pos; + } + mov.Data.LookAt = look; + + OutPacket(mov); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + System.Text.Encoding enc = System.Text.Encoding.ASCII; + libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); + reply.ChatData.Audible = 1; + reply.ChatData.Message = message; + reply.ChatData.ChatType = type; + reply.ChatData.SourceType = 1; + reply.ChatData.Position = fromPos; + reply.ChatData.FromName = enc.GetBytes(fromName + "\0"); + reply.ChatData.OwnerID = fromAgentID; + reply.ChatData.SourceID = fromAgentID; + + this.OutPacket(reply); + } + + + /// + /// Send the region heightmap to the client + /// + /// heightmap + public virtual void SendLayerData(float[] map) + { + try + { + int[] patches = new int[4]; + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x = x + 4) + { + patches[0] = x + 0 + y * 16; + patches[1] = x + 1 + y * 16; + patches[2] = x + 2 + y * 16; + patches[3] = x + 3 + y * 16; + + Packet layerpack = TerrainManager.CreateLandPacket(map, patches); + OutPacket(layerpack); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); + } + } + + /// + /// Sends a specified patch to a client + /// + /// Patch coordinate (x) 0..16 + /// Patch coordinate (y) 0..16 + /// heightmap + public void SendLayerData(int px, int py, float[] map) + { + try + { + int[] patches = new int[1]; + int patchx, patchy; + patchx = px / 16; + patchy = py / 16; + + patches[0] = patchx + 0 + patchy * 16; + + Packet layerpack = TerrainManager.CreateLandPacket(map, patches); + OutPacket(layerpack); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); + } + } + + /// + /// + /// + /// + /// + /// + public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) + { + EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); + enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); + enablesimpacket.SimulatorInfo.Handle = neighbourHandle; + + byte[] byteIP = neighbourIP.GetAddressBytes(); + enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; + enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; + enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; + enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; + enablesimpacket.SimulatorInfo.Port = neighbourPort; + OutPacket(enablesimpacket); + } + + /// + /// + /// + /// + public AgentCircuitData RequestClientInfo() + { + AgentCircuitData agentData = new AgentCircuitData(); + agentData.AgentID = this.AgentId; + agentData.SessionID = this.SessionID; + agentData.SecureSessionID = this.SecureSessionID; + agentData.circuitcode = this.CircuitCode; + agentData.child = false; + agentData.firstname = this.firstName; + agentData.lastname = this.lastName; + + return agentData; + } + + public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort) + { + LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); + + CrossedRegionPacket newSimPack = new CrossedRegionPacket(); + newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); + newSimPack.AgentData.AgentID = this.AgentID; + newSimPack.AgentData.SessionID = this.SessionID; + newSimPack.Info = new CrossedRegionPacket.InfoBlock(); + newSimPack.Info.Position = pos; + newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! + newSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); + newSimPack.RegionData.RegionHandle = newRegionHandle; + byte[] byteIP = newRegionIP.GetAddressBytes(); + newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; + newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; + newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; + newSimPack.RegionData.SimIP += (uint)byteIP[0]; + newSimPack.RegionData.SimPort = newRegionPort; + newSimPack.RegionData.SeedCapability = new byte[0]; + + this.OutPacket(newSimPack); + //this.DowngradeClient(); + } + + public void SendMapBlock(List mapBlocks) + { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + + MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); + mapReply.AgentData.AgentID = this.AgentID; + mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; + mapReply.AgentData.Flags = 0; + + for (int i = 0; i < mapBlocks.Count; i++) + { + mapReply.Data[i] = new MapBlockReplyPacket.DataBlock(); + mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId; + mapReply.Data[i].X = mapBlocks[i].X; + mapReply.Data[i].Y = mapBlocks[i].Y; + mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight; + mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name); + mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags; + mapReply.Data[i].Access = mapBlocks[i].Access; + mapReply.Data[i].Agents = mapBlocks[i].Agents; + } + this.OutPacket(mapReply); + } + + public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) + { + TeleportLocalPacket tpLocal = new TeleportLocalPacket(); + tpLocal.Info.AgentID = this.AgentID; + tpLocal.Info.TeleportFlags = flags; + tpLocal.Info.LocationID = 2; + tpLocal.Info.LookAt = lookAt; + tpLocal.Info.Position = position; + OutPacket(tpLocal); + } + + public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags) + { + TeleportFinishPacket teleport = new TeleportFinishPacket(); + teleport.Info.AgentID = this.AgentID; + teleport.Info.RegionHandle = regionHandle; + teleport.Info.SimAccess = simAccess; + teleport.Info.SeedCapability = new byte[0]; + + System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress); + byte[] byteIP = oIP.GetAddressBytes(); + uint ip = (uint)byteIP[3] << 24; + ip += (uint)byteIP[2] << 16; + ip += (uint)byteIP[1] << 8; + ip += (uint)byteIP[0]; + + teleport.Info.SimIP = ip; + teleport.Info.SimPort = ipPort; + teleport.Info.LocationID = 4; + teleport.Info.TeleportFlags = 1 << 4; + OutPacket(teleport); + } + + /// + /// + /// + public void SendTeleportCancel() + { + TeleportCancelPacket tpCancel = new TeleportCancelPacket(); + tpCancel.Info.SessionID = this.SessionID; + tpCancel.Info.AgentID = this.AgentID; + + OutPacket(tpCancel); + } + + /// + /// + /// + public void SendTeleportLocationStart() + { + TeleportStartPacket tpStart = new TeleportStartPacket(); + tpStart.Info.TeleportFlags = 16; // Teleport via location + OutPacket(tpStart); + } + + public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) + { + MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); + money.MoneyData.AgentID = this.AgentID; + money.MoneyData.TransactionID = transaction; + money.MoneyData.TransactionSuccess = success; + money.MoneyData.Description = description; + money.MoneyData.MoneyBalance = balance; + OutPacket(money); + } + + #region Appearance/ Wearables Methods + + /// + /// + /// + /// + public void SendWearables(AvatarWearable[] wearables) + { + AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); + aw.AgentData.AgentID = this.AgentID; + aw.AgentData.SerialNum = 0; + aw.AgentData.SessionID = this.SessionID; + + aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; + AgentWearablesUpdatePacket.WearableDataBlock awb; + for (int i = 0; i < wearables.Length; i++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte)i; + awb.AssetID = wearables[i].AssetID; + awb.ItemID = wearables[i].ItemID; + aw.WearableData[i] = awb; + } + + this.OutPacket(aw); + } + + /// + /// + /// + /// + /// + /// + public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) + { + AvatarAppearancePacket avp = new AvatarAppearancePacket(); + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.ObjectData.TextureEntry = textureEntry; + + AvatarAppearancePacket.VisualParamBlock avblock = null; + for (int i = 0; i < visualParams.Length; i++) + { + avblock = new AvatarAppearancePacket.VisualParamBlock(); + avblock.ParamValue = visualParams[i]; + avp.VisualParam[i] = avblock; + } + + avp.Sender.IsTrial = false; + avp.Sender.ID = agentID; + OutPacket(avp); + } + + #endregion + + #region Avatar Packet/data sending Methods + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) + { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + //send a objectupdate packet with information about the clients avatar + + ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); + objupdate.RegionData.RegionHandle = regionHandle; + objupdate.RegionData.TimeDilation = 64096; + objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; + objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry); + //give this avatar object a local id and assign the user a name + + objupdate.ObjectData[0].ID = avatarLocalID; + objupdate.ObjectData[0].FullID = avatarID; + objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName + " \0"); + libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); + byte[] pb = pos2.GetBytes(); + Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); + + OutPacket(objupdate); + + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) + { + ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity); + ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); + terse.RegionData.RegionHandle = regionHandle; + terse.RegionData.TimeDilation = timeDilation; + terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + terse.ObjectData[0] = terseBlock; + + this.OutPacket(terse); + } + + #endregion + + #region Primitive Packet/data Sending Methods + + /// + /// + /// + /// + /// + /// + public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) + { + ObjectAttachPacket attach = new ObjectAttachPacket(); + attach.AgentData.AgentID = this.AgentID; + attach.AgentData.SessionID = this.SessionID; + attach.AgentData.AttachmentPoint = attachPoint; + attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; + attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); + attach.ObjectData[0].ObjectLocalID = localID; + attach.ObjectData[0].Rotation = rotation; + + this.OutPacket(attach); + } + + /// + /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive + /// or big changes to a existing primitive. + /// + /// + /// + /// + /// + /// + /// + /// + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) + { + ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); + outPacket.RegionData.RegionHandle = regionHandle; + outPacket.RegionData.TimeDilation = timeDilation; + outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags); + outPacket.ObjectData[0].ID = localID; + outPacket.ObjectData[0].FullID = primData.FullID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); + byte[] rot = rotation.GetBytes(); + Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length); + OutPacket(outPacket); + } + + /// + /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive + /// or big changes to a existing primitive. + /// Uses default rotation + /// + /// + /// + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID , uint flags) + { + ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); + outPacket.RegionData.RegionHandle = regionHandle; + outPacket.RegionData.TimeDilation = timeDilation; + outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags); + outPacket.ObjectData[0].ID = localID; + outPacket.ObjectData[0].FullID = primData.FullID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); + + OutPacket(outPacket); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) + { + ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); + terse.RegionData.RegionHandle = regionHandle; + terse.RegionData.TimeDilation = timeDilation; + terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); + + this.OutPacket(terse); + } + + #endregion + + #endregion + + #region Helper Methods + + protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity) + { + byte[] bytes = new byte[60]; + int i = 0; + ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); + + dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; + + uint ID = localID; + + bytes[i++] = (byte)(ID % 256); + bytes[i++] = (byte)((ID >> 8) % 256); + bytes[i++] = (byte)((ID >> 16) % 256); + bytes[i++] = (byte)((ID >> 24) % 256); + bytes[i++] = 0; + bytes[i++] = 1; + i += 14; + bytes[i++] = 128; + bytes[i++] = 63; + + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, bytes, i, pb.Length); + i += 12; + ushort InternVelocityX; + ushort InternVelocityY; + ushort InternVelocityZ; + Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); + + internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z); + + internDirec = internDirec / 128.0f; + internDirec.x += 1; + internDirec.y += 1; + internDirec.z += 1; + + InternVelocityX = (ushort)(32768 * internDirec.x); + InternVelocityY = (ushort)(32768 * internDirec.y); + InternVelocityZ = (ushort)(32768 * internDirec.z); + + ushort ac = 32767; + bytes[i++] = (byte)(InternVelocityX % 256); + bytes[i++] = (byte)((InternVelocityX >> 8) % 256); + bytes[i++] = (byte)(InternVelocityY % 256); + bytes[i++] = (byte)((InternVelocityY >> 8) % 256); + bytes[i++] = (byte)(InternVelocityZ % 256); + bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); + + //accel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + //rot + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + //rotation vel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + dat.Data = bytes; + return (dat); + } + + /// + /// + /// + /// + /// + /// + /// + protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) + { + uint ID = localID; + byte[] bytes = new byte[60]; + + int i = 0; + ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); + dat.TextureEntry = new byte[0]; + bytes[i++] = (byte)(ID % 256); + bytes[i++] = (byte)((ID >> 8) % 256); + bytes[i++] = (byte)((ID >> 16) % 256); + bytes[i++] = (byte)((ID >> 24) % 256); + bytes[i++] = 0; + bytes[i++] = 0; + + byte[] pb = position.GetBytes(); + Array.Copy(pb, 0, bytes, i, pb.Length); + i += 12; + ushort ac = 32767; + + //vel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + //accel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + ushort rw, rx, ry, rz; + rw = (ushort)(32768 * (rotation.W + 1)); + rx = (ushort)(32768 * (rotation.X + 1)); + ry = (ushort)(32768 * (rotation.Y + 1)); + rz = (ushort)(32768 * (rotation.Z + 1)); + + //rot + bytes[i++] = (byte)(rx % 256); + bytes[i++] = (byte)((rx >> 8) % 256); + bytes[i++] = (byte)(ry % 256); + bytes[i++] = (byte)((ry >> 8) % 256); + bytes[i++] = (byte)(rz % 256); + bytes[i++] = (byte)((rz >> 8) % 256); + bytes[i++] = (byte)(rw % 256); + bytes[i++] = (byte)((rw >> 8) % 256); + + //rotation vel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + dat.Data = bytes; + return dat; + } + + + /// + /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) + /// + /// + /// + protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimData primData, LLUUID textureID, uint flags) + { + ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); + this.SetDefaultPrimPacketValues(objupdate); + objupdate.UpdateFlags = flags; + this.SetPrimPacketShapeData(objupdate, primData, textureID); + + return objupdate; + } + + /// + /// Copy the data from a PrimData object to a ObjectUpdatePacket + /// + /// + /// + protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimData primData, LLUUID textureID) + { + LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID); + objectData.TextureEntry = ntex.ToBytes(); + objectData.OwnerID = primData.OwnerID; + objectData.PCode = primData.PCode; + objectData.PathBegin = primData.PathBegin; + objectData.PathEnd = primData.PathEnd; + objectData.PathScaleX = primData.PathScaleX; + objectData.PathScaleY = primData.PathScaleY; + objectData.PathShearX = primData.PathShearX; + objectData.PathShearY = primData.PathShearY; + objectData.PathSkew = primData.PathSkew; + objectData.ProfileBegin = primData.ProfileBegin; + objectData.ProfileEnd = primData.ProfileEnd; + objectData.Scale = primData.Scale; + objectData.PathCurve = primData.PathCurve; + objectData.ProfileCurve = primData.ProfileCurve; + objectData.ParentID = primData.ParentID; + objectData.ProfileHollow = primData.ProfileHollow; + objectData.PathRadiusOffset = primData.PathRadiusOffset; + objectData.PathRevolutions = primData.PathRevolutions; + objectData.PathTaperX = primData.PathTaperX; + objectData.PathTaperY = primData.PathTaperY; + objectData.PathTwist = primData.PathTwist; + objectData.PathTwistBegin = primData.PathTwistBegin; + } + + /// + /// Set some default values in a ObjectUpdatePacket + /// + /// + protected void SetDefaultPrimPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) + { + objdata.PSBlock = new byte[0]; + objdata.ExtraParams = new byte[1]; + objdata.MediaURL = new byte[0]; + objdata.NameValue = new byte[0]; + objdata.Text = new byte[0]; + objdata.TextColor = new byte[4]; + objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); + objdata.JointPivot = new LLVector3(0, 0, 0); + objdata.Material = 3; + objdata.TextureAnim = new byte[0]; + objdata.Sound = LLUUID.Zero; + objdata.State = 0; + objdata.Data = new byte[0]; + + objdata.ObjectData = new byte[60]; + objdata.ObjectData[46] = 128; + objdata.ObjectData[47] = 63; + } + + + /// + /// + /// + /// + protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) + { + libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); + + SetDefaultAvatarPacketValues(ref objdata); + objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); + objdata.PathCurve = 16; + objdata.ProfileCurve = 1; + objdata.PathScaleX = 100; + objdata.PathScaleY = 100; + objdata.ParentID = 0; + objdata.OwnerID = LLUUID.Zero; + objdata.Scale = new LLVector3(1, 1, 1); + objdata.PCode = 47; + if (textureEntry != null) + { + objdata.TextureEntry = textureEntry; + } + System.Text.Encoding enc = System.Text.Encoding.ASCII; + libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); + pos.X = 100f; + objdata.ID = 8880000; + objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); + libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f); + //objdata.FullID=user.AgentID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); + + return objdata; + } + + /// + /// + /// + /// + protected void SetDefaultAvatarPacketValues(ref ObjectUpdatePacket.ObjectDataBlock objdata) + { + objdata.PSBlock = new byte[0]; + objdata.ExtraParams = new byte[1]; + objdata.MediaURL = new byte[0]; + objdata.NameValue = new byte[0]; + objdata.Text = new byte[0]; + objdata.TextColor = new byte[4]; + objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); + objdata.JointPivot = new LLVector3(0, 0, 0); + objdata.Material = 4; + objdata.TextureAnim = new byte[0]; + objdata.Sound = LLUUID.Zero; + LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + objdata.TextureEntry = ntex.ToBytes(); + objdata.State = 0; + objdata.Data = new byte[0]; + + objdata.ObjectData = new byte[76]; + objdata.ObjectData[15] = 128; + objdata.ObjectData[16] = 63; + objdata.ObjectData[56] = 128; + objdata.ObjectData[61] = 102; + objdata.ObjectData[62] = 40; + objdata.ObjectData[63] = 61; + objdata.ObjectData[64] = 189; + } + + /// + /// + /// + /// + /// + protected PrimData CreatePrimFromObjectAdd(ObjectAddPacket addPacket) + { + PrimData PData = new PrimData(); + PData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + PData.PCode = addPacket.ObjectData.PCode; + PData.PathBegin = addPacket.ObjectData.PathBegin; + PData.PathEnd = addPacket.ObjectData.PathEnd; + PData.PathScaleX = addPacket.ObjectData.PathScaleX; + PData.PathScaleY = addPacket.ObjectData.PathScaleY; + PData.PathShearX = addPacket.ObjectData.PathShearX; + PData.PathShearY = addPacket.ObjectData.PathShearY; + PData.PathSkew = addPacket.ObjectData.PathSkew; + PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; + PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; + PData.Scale = addPacket.ObjectData.Scale; + PData.PathCurve = addPacket.ObjectData.PathCurve; + PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; + PData.ParentID = 0; + PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; + PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; + PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; + PData.PathTaperX = addPacket.ObjectData.PathTaperX; + PData.PathTaperY = addPacket.ObjectData.PathTaperY; + PData.PathTwist = addPacket.ObjectData.PathTwist; + PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; + + return PData; + } + #endregion + + } +} diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs new file mode 100644 index 0000000..914c38a --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs @@ -0,0 +1,358 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Assets; +using OpenSim.Framework.Types; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Utilities; +using OpenSim.Caches; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim +{ + partial class ClientView + { + public class AgentAssetUpload + { + private Dictionary transactions = new Dictionary(); + private ClientView ourClient; + private AssetCache m_assetCache; + private InventoryCache m_inventoryCache; + + public AgentAssetUpload(ClientView client, AssetCache assetCache, InventoryCache inventoryCache) + { + this.ourClient = client; + m_assetCache = assetCache; + m_inventoryCache = inventoryCache; + } + + public void AddUpload(LLUUID transactionID, AssetBase asset) + { + AssetTransaction upload = new AssetTransaction(); + lock (this.transactions) + { + upload.Asset = asset; + upload.TransactionID = transactionID; + this.transactions.Add(transactionID, upload); + } + if (upload.Asset.Data.Length > 2) + { + //is complete + upload.UploadComplete = true; + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = asset.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID); + this.ourClient.OutPacket(response); + m_assetCache.AddAsset(asset); + } + else + { + upload.UploadComplete = false; + upload.XferID = Util.GetNextXferID(); + RequestXferPacket xfer = new RequestXferPacket(); + xfer.XferID.ID = upload.XferID; + xfer.XferID.VFileType = upload.Asset.Type; + xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID); + xfer.XferID.FilePath = 0; + xfer.XferID.Filename = new byte[0]; + this.ourClient.OutPacket(xfer); + } + + } + + public AssetBase GetUpload(LLUUID transactionID) + { + if (this.transactions.ContainsKey(transactionID)) + { + return this.transactions[transactionID].Asset; + } + + return null; + } + + public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) + { + // Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString()); + AssetBase asset = null; + if (pack.AssetBlock.Type == 0) + { + + //first packet for transaction + asset = new AssetBase(); + asset.FullID = assetID; + asset.Type = pack.AssetBlock.Type; + asset.InvType = asset.Type; + asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = pack.AssetBlock.AssetData; + + + } + else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7) + { + + asset = new AssetBase(); + asset.FullID = assetID; + // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated()); + asset.Type = pack.AssetBlock.Type; + asset.InvType = asset.Type; + asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = pack.AssetBlock.AssetData; + + + } + + if (asset != null) + { + this.AddUpload(pack.AssetBlock.TransactionID, asset); + } + else + { + + //currently we don't support this asset type + //so lets just tell the client that the upload is complete + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = pack.AssetBlock.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID); + this.ourClient.OutPacket(response); + } + + } + + #region Xfer packet system for larger uploads + + public void HandleXferPacket(SendXferPacketPacket xferPacket) + { + lock (this.transactions) + { + foreach (AssetTransaction trans in this.transactions.Values) + { + if (trans.XferID == xferPacket.XferID.ID) + { + if (trans.Asset.Data.Length > 1) + { + byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length]; + Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length); + Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length); + trans.Asset.Data = newArray; + } + else + { + byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4]; + Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4); + trans.Asset.Data = newArray; + } + + if ((xferPacket.XferID.Packet & 2147483648) != 0) + { + //end of transfer + trans.UploadComplete = true; + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = trans.Asset.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID); + this.ourClient.OutPacket(response); + + m_assetCache.AddAsset(trans.Asset); + //check if we should add it to inventory + if (trans.AddToInventory) + { + // m_assetCache.AddAsset(trans.Asset); + m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); + } + + + } + break; + } + + } + } + + ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); + confirmXfer.XferID.ID = xferPacket.XferID.ID; + confirmXfer.XferID.Packet = xferPacket.XferID.Packet; + this.ourClient.OutPacket(confirmXfer); + } + + #endregion + + public AssetBase AddUploadToAssetCache(LLUUID transactionID) + { + AssetBase asset = null; + if (this.transactions.ContainsKey(transactionID)) + { + AssetTransaction trans = this.transactions[transactionID]; + if (trans.UploadComplete) + { + m_assetCache.AddAsset(trans.Asset); + asset = trans.Asset; + } + } + + return asset; + } + + public void CreateInventoryItem(CreateInventoryItemPacket packet) + { + if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) + { + AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; + trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description); + trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name); + trans.Asset.Type = packet.InventoryBlock.Type; + trans.Asset.InvType = packet.InventoryBlock.InvType; + if (trans.UploadComplete) + { + //already complete so we can add it to the inventory + //m_assetCache.AddAsset(trans.Asset); + m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); + } + else + { + trans.AddToInventory = true; + trans.InventFolder = packet.InventoryBlock.FolderID; + } + } + } + + private class AssetTransaction + { + public uint XferID; + public AssetBase Asset; + public bool AddToInventory; + public LLUUID InventFolder = LLUUID.Zero; + public bool UploadComplete = false; + public LLUUID TransactionID = LLUUID.Zero; + + public AssetTransaction() + { + + } + } + + //new class , not currently used. + public class AssetXferUploader + { + private IClientAPI ourClient; + + public bool UploadComplete = false; + + public bool AddToInventory; + public LLUUID InventFolder = LLUUID.Zero; + + public uint XferID; + public AssetBase Asset; + public LLUUID TransactionID = LLUUID.Zero; + + + public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data) + { + ourClient = remoteClient; + Asset = new AssetBase(); + Asset.FullID = assetID; + Asset.InvType = type; + Asset.Type = type; + Asset.Data = data; + Asset.Name = "blank"; + Asset.Description = "empty"; + TransactionID = transaction; + + if (Asset.Data.Length > 2) + { + //data block should only have data in it, if there is no more data to be uploaded + this.SendCompleteMessage(); + } + else + { + this.ReqestStartXfer(); + } + } + + protected void SendCompleteMessage() + { + UploadComplete = true; + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = Asset.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = Asset.FullID; + this.ourClient.OutPacket(response); + + //TODO trigger event + } + + protected void ReqestStartXfer() + { + UploadComplete = false; + XferID = Util.GetNextXferID(); + RequestXferPacket xfer = new RequestXferPacket(); + xfer.XferID.ID = XferID; + xfer.XferID.VFileType = Asset.Type; + xfer.XferID.VFileID = Asset.FullID; + xfer.XferID.FilePath = 0; + xfer.XferID.Filename = new byte[0]; + this.ourClient.OutPacket(xfer); + } + + public void HandleXferPacket(uint xferID, uint packetID, byte[] data) + { + if (XferID == xferID) + { + if (Asset.Data.Length > 1) + { + byte[] newArray = new byte[Asset.Data.Length + data.Length]; + Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length); + Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length); + Asset.Data = newArray; + } + else + { + byte[] newArray = new byte[data.Length - 4]; + Array.Copy(data, 4, newArray, 0, data.Length - 4); + Asset.Data = newArray; + } + + ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); + confirmXfer.XferID.ID = xferID; + confirmXfer.XferID.Packet = packetID; + this.ourClient.OutPacket(confirmXfer); + + if ((packetID & 2147483648) != 0) + { + this.SendCompleteMessage(); + } + } + } + } + } + } +} diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs new file mode 100644 index 0000000..32aed02 --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -0,0 +1,198 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using Nwc.XmlRpc; +using System.Net; +using System.Net.Sockets; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; +using OpenSim.Assets; + +namespace OpenSim +{ + public partial class ClientView + { + protected virtual void RegisterLocalPacketHandlers() + { + this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); + this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); + this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); + } + + protected virtual bool Logout(ClientView simClient, Packet packet) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); + //send reply to let the client logout + LogoutReplyPacket logReply = new LogoutReplyPacket(); + logReply.AgentData.AgentID = this.AgentID; + logReply.AgentData.SessionID = this.SessionID; + logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; + logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); + logReply.InventoryData[0].ItemID = LLUUID.Zero; + OutPacket(logReply); + //tell all clients to kill our object + KillObjectPacket kill = new KillObjectPacket(); + kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; + kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); + // kill.ObjectData[0].ID = this.ClientAvatar.localid; + foreach (ClientView client in m_clientThreads.Values) + { + client.OutPacket(kill); + } + + this.m_inventoryCache.ClientLeaving(this.AgentID, null); + + + // m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); + /*lock (m_world.Entities) + { + m_world.Entities.Remove(this.AgentID); + }*/ + // m_world.RemoveViewerAgent(this); + //need to do other cleaning up here too + m_clientThreads.Remove(this.CircuitCode); + m_networkServer.RemoveClientCircuit(this.CircuitCode); + this.ClientThread.Abort(); + return true; + } + + protected bool AgentTextureCached(ClientView simclient, Packet packet) + { + // Console.WriteLine(packet.ToString()); + AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; + AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); + cachedresp.AgentData.AgentID = this.AgentID; + cachedresp.AgentData.SessionID = this.SessionID; + cachedresp.AgentData.SerialNum = this.cachedtextureserial; + this.cachedtextureserial++; + cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; + for (int i = 0; i < chechedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = LLUUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; + } + this.OutPacket(cachedresp); + return true; + } + + protected bool MultipleObjUpdate(ClientView simClient, Packet packet) + { + MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; + for (int i = 0; i < multipleupdate.ObjectData.Length; i++) + { + if (multipleupdate.ObjectData[i].Type == 9) //change position + { + if (OnUpdatePrimPosition != null) + { + libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + } + //should update stored position of the prim + } + else if (multipleupdate.ObjectData[i].Type == 10)//rotation + { + if (OnUpdatePrimRotation != null) + { + libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + } + } + else if (multipleupdate.ObjectData[i].Type == 13)//scale + { + if (OnUpdatePrimScale != null) + { + libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + } + } + } + return true; + } + + public void RequestMapLayer() + { + //should be getting the map layer from the grid server + //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) + MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); + mapReply.AgentData.AgentID = this.AgentID; + mapReply.AgentData.Flags = 0; + mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; + mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); + mapReply.LayerData[0].Bottom = 0; + mapReply.LayerData[0].Left = 0; + mapReply.LayerData[0].Top = 30000; + mapReply.LayerData[0].Right = 30000; + mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); + this.OutPacket(mapReply); + } + + public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) + { + /* + IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY); + MapBlockReplyPacket mbReply = new MapBlockReplyPacket(); + mbReply.AgentData.AgentID = this.AgentID; + int len; + if (simMapProfiles == null) + len = 0; + else + len = simMapProfiles.Count; + + mbReply.Data = new MapBlockReplyPacket.DataBlock[len]; + int iii; + for (iii = 0; iii < len; iii++) + { + Hashtable mp = (Hashtable)simMapProfiles[iii]; + mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock(); + mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]); + mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]); + mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]); + mbReply.Data[iii].MapImageID = new LLUUID((string)mp["map-image-id"]); + mbReply.Data[iii].RegionFlags = System.Convert.ToUInt32(mp["region-flags"]); + mbReply.Data[iii].WaterHeight = System.Convert.ToByte(mp["water-height"]); + mbReply.Data[iii].X = System.Convert.ToUInt16(mp["x"]); + mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]); + } + this.OutPacket(mbReply); + */ + } + + + } +} diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs new file mode 100644 index 0000000..191ef21 --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -0,0 +1,550 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using Nwc.XmlRpc; +using System.Net; +using System.Net.Sockets; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; +using OpenSim.Assets; + +namespace OpenSim +{ + public partial class ClientView + { + protected override void ProcessInPacket(Packet Pack) + { + ack_pack(Pack); + if (debug) + { + if (Pack.Type != PacketType.AgentUpdate) + { + Console.WriteLine(Pack.Type.ToString()); + } + } + + if (this.ProcessPacketMethod(Pack)) + { + //there is a handler registered that handled this packet type + return; + } + else + { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + + switch (Pack.Type) + { + case PacketType.ViewerEffect: + ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; + foreach (ClientView client in m_clientThreads.Values) + { + if (client.AgentID != this.AgentID) + { + viewer.AgentData.AgentID = client.AgentID; + viewer.AgentData.SessionID = client.SessionID; + client.OutPacket(viewer); + } + } + break; + + #region World/Avatar + case PacketType.ChatFromViewer: + ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; + if (Util.FieldToString(inchatpack.ChatData.Message) == "") + { + //empty message so don't bother with it + break; + } + string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; + byte[] message = inchatpack.ChatData.Message; + byte type = inchatpack.ChatData.Type; + LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; + LLUUID fromAgentID = AgentID; + if (OnChatFromViewer != null) + { + this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); + } + break; + case PacketType.RezObject: + RezObjectPacket rezPacket = (RezObjectPacket)Pack; + AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); + if (inven != null) + { + if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) + { + AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); + if (asset != null) + { + if (OnRezObject != null) + { + this.OnRezObject(asset, rezPacket.RezData.RayEnd); + this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID); + } + } + } + } + break; + case PacketType.DeRezObject: + if (OnDeRezObject != null) + { + OnDeRezObject(Pack, this); + } + break; + case PacketType.ModifyLand: + ModifyLandPacket modify = (ModifyLandPacket)Pack; + if (modify.ParcelData.Length > 0) + { + if (OnModifyTerrain != null) + { + OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, + modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); + } + } + break; + case PacketType.RegionHandshakeReply: + if (OnRegionHandShakeReply != null) + { + OnRegionHandShakeReply(this); + } + break; + case PacketType.AgentWearablesRequest: + if (OnRequestWearables != null) + { + OnRequestWearables(this); + } + if (OnRequestAvatarsData != null) + { + OnRequestAvatarsData(this); + } + break; + case PacketType.AgentSetAppearance: + AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; + if (OnSetAppearance != null) + { + OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); + } + break; + case PacketType.CompleteAgentMovement: + if (OnCompleteMovementToRegion != null) + { + OnCompleteMovementToRegion(); + } + break; + case PacketType.AgentUpdate: + if (OnAgentUpdate != null) + { + AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; + OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation ); + } + break; + case PacketType.AgentAnimation: + if (!m_child) + { + AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; + for (int i = 0; i < AgentAni.AnimationList.Length; i++) + { + if (AgentAni.AnimationList[i].StartAnim) + { + if (OnStartAnim != null) + { + OnStartAnim(AgentAni.AnimationList[i].AnimID, 1); + } + } + } + } + break; + + #endregion + + #region Objects/Prims + case PacketType.ObjectLink: + // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); + ObjectLinkPacket link = (ObjectLinkPacket)Pack; + uint parentprimid = 0; + List childrenprims = new List(); + if (link.ObjectData.Length > 1) + { + parentprimid = link.ObjectData[0].ObjectLocalID; + + for (int i = 1; i < link.ObjectData.Length; i++) + { + childrenprims.Add(link.ObjectData[i].ObjectLocalID); + } + } + if (OnLinkObjects != null) + { + OnLinkObjects(parentprimid, childrenprims); + } + break; + case PacketType.ObjectAdd: + // m_world.AddNewPrim((ObjectAddPacket)Pack, this); + if (OnAddPrim != null) + { + OnAddPrim(Pack, this); + } + break; + case PacketType.ObjectShape: + ObjectShapePacket shape = (ObjectShapePacket)Pack; + for (int i = 0; i < shape.ObjectData.Length; i++) + { + if (OnUpdatePrimShape != null) + { + OnUpdatePrimShape(shape.ObjectData[i].ObjectLocalID, shape.ObjectData[i]); + } + } + break; + case PacketType.ObjectSelect: + ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; + for (int i = 0; i < incomingselect.ObjectData.Length; i++) + { + if (OnObjectSelect != null) + { + OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); + } + } + break; + case PacketType.ObjectFlagUpdate: + ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; + if (OnUpdatePrimFlags != null) + { + OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); + } + break; + case PacketType.ObjectImage: + ObjectImagePacket imagePack = (ObjectImagePacket)Pack; + for (int i = 0; i < imagePack.ObjectData.Length; i++) + { + if (OnUpdatePrimTexture != null) + { + OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); + } + } + break; + case PacketType.ObjectGrab: + ObjectGrabPacket grap = (ObjectGrabPacket)Pack; + if (OnGrapObject != null) + { + OnGrapObject(grap.ObjectData.LocalID, grap.ObjectData.GrabOffset, this); + } + break; + case PacketType.ObjectGrabUpdate: + ObjectGrabUpdatePacket grapUpdate = (ObjectGrabUpdatePacket)Pack; + if (OnGrapUpdate != null) + { + OnGrapUpdate(grapUpdate.ObjectData.ObjectID, grapUpdate.ObjectData.GrabOffsetInitial, grapUpdate.ObjectData.GrabPosition, this); + } + break; + case PacketType.ObjectDeGrab: + ObjectDeGrabPacket deGrap = (ObjectDeGrabPacket)Pack; + if (OnDeGrapObject != null) + { + OnDeGrapObject(deGrap.ObjectData.LocalID, this); + } + break; + #endregion + + #region Inventory/Asset/Other related packets + case PacketType.RequestImage: + RequestImagePacket imageRequest = (RequestImagePacket)Pack; + for (int i = 0; i < imageRequest.RequestImage.Length; i++) + { + m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); + } + break; + case PacketType.TransferRequest: + //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); + TransferRequestPacket transfer = (TransferRequestPacket)Pack; + m_assetCache.AddAssetRequest(this, transfer); + break; + case PacketType.AssetUploadRequest: + AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; + this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); + break; + case PacketType.RequestXfer: + //Console.WriteLine(Pack.ToString()); + break; + case PacketType.SendXferPacket: + this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); + break; + case PacketType.CreateInventoryFolder: + CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; + m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); + //Console.WriteLine(Pack.ToString()); + break; + case PacketType.CreateInventoryItem: + //Console.WriteLine(Pack.ToString()); + CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; + if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) + { + this.UploadAssets.CreateInventoryItem(createItem); + } + else + { + // Console.Write(Pack.ToString()); + this.CreateInventoryItem(createItem); + } + break; + case PacketType.FetchInventory: + //Console.WriteLine("fetch item packet"); + FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; + m_inventoryCache.FetchInventory(this, FetchInventory); + break; + case PacketType.FetchInventoryDescendents: + FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; + m_inventoryCache.FetchInventoryDescendents(this, Fetch); + break; + case PacketType.UpdateInventoryItem: + UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; + //Console.WriteLine(Pack.ToString()); + for (int i = 0; i < update.InventoryData.Length; i++) + { + if (update.InventoryData[i].TransactionID != LLUUID.Zero) + { + AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); + if (asset != null) + { + // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); + m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); + } + else + { + asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); + if (asset != null) + { + //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); + m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); + } + else + { + //Console.WriteLine("trying to update inventory item, but asset is null"); + } + } + } + else + { + m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; + } + } + break; + case PacketType.RequestTaskInventory: + // Console.WriteLine(Pack.ToString()); + RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; + ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); + bool foundent = false; + /* foreach (Entity ent in m_world.Entities.Values) + { + if (ent.localid == requesttask.InventoryData.LocalID) + { + replytask.InventoryData.TaskID = ent.uuid; + replytask.InventoryData.Serial = 0; + replytask.InventoryData.Filename = new byte[0]; + foundent = true; + } + } + if (foundent) + { + this.OutPacket(replytask); + }*/ + break; + case PacketType.UpdateTaskInventory: + // Console.WriteLine(Pack.ToString()); + UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; + AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); + /*if (myinventory != null) + { + if (updatetask.UpdateData.Key == 0) + { + if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null) + { + if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7) + { + LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID; + AssetBase assBase = this.m_assetCache.GetAsset(noteaid); + if (assBase != null) + { + foreach (Entity ent in m_world.Entities.Values) + { + if (ent.localid == updatetask.UpdateData.LocalID) + { + if (ent is OpenSim.world.Primitive) + { + this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); + } + } + } + } + } + } + } + }*/ + break; + case PacketType.MapLayerRequest: + this.RequestMapLayer(); + break; + case PacketType.MapBlockRequest: + MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; + if (OnRequestMapBlocks != null) + { + OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); + } + break; + case PacketType.TeleportLandmarkRequest: + TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; + + TeleportStartPacket tpStart = new TeleportStartPacket(); + tpStart.Info.TeleportFlags = 8; // tp via lm + this.OutPacket(tpStart); + + TeleportProgressPacket tpProgress = new TeleportProgressPacket(); + tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark"); + tpProgress.Info.TeleportFlags = 8; + tpProgress.AgentData.AgentID = tpReq.Info.AgentID; + this.OutPacket(tpProgress); + + // Fetch landmark + LLUUID lmid = tpReq.Info.LandmarkID; + AssetBase lma = this.m_assetCache.GetAsset(lmid); + if (lma != null) + { + AssetLandmark lm = new AssetLandmark(lma); + + if (lm.RegionID == m_regionData.SimUUID) + { + TeleportLocalPacket tpLocal = new TeleportLocalPacket(); + + tpLocal.Info.AgentID = tpReq.Info.AgentID; + tpLocal.Info.TeleportFlags = 8; // Teleport via landmark + tpLocal.Info.LocationID = 2; + tpLocal.Info.Position = lm.Position; + OutPacket(tpLocal); + } + else + { + TeleportCancelPacket tpCancel = new TeleportCancelPacket(); + tpCancel.Info.AgentID = tpReq.Info.AgentID; + tpCancel.Info.SessionID = tpReq.Info.SessionID; + OutPacket(tpCancel); + } + } + else + { + Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); + + TeleportCancelPacket tpCancel = new TeleportCancelPacket(); + tpCancel.Info.AgentID = tpReq.Info.AgentID; + tpCancel.Info.SessionID = tpReq.Info.SessionID; + OutPacket(tpCancel); + } + break; + case PacketType.TeleportLocationRequest: + TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; + // Console.WriteLine(tpLocReq.ToString()); + + if (OnTeleportLocationRequest != null) + { + OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); + } + else + { + //no event handler so cancel request + TeleportCancelPacket tpCancel = new TeleportCancelPacket(); + tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; + tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; + OutPacket(tpCancel); + } + break; + #endregion + + case PacketType.MoneyBalanceRequest: + this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000); + break; + + #region Parcel related packets + case PacketType.ParcelPropertiesRequest: + ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; + if (OnParcelPropertiesRequest != null) + { + OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); + } + break; + case PacketType.ParcelDivide: + ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; + if (OnParcelDivideRequest != null) + { + OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this); + } + break; + case PacketType.ParcelJoin: + ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; + if (OnParcelJoinRequest != null) + { + OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this); + } + break; + case PacketType.ParcelPropertiesUpdate: + ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; + if (OnParcelPropertiesUpdateRequest != null) + { + OnParcelPropertiesUpdateRequest(updatePacket, this); + } + break; + #endregion + + #region Estate Packets + case PacketType.EstateOwnerMessage: + EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; + if (OnEstateOwnerMessage != null) + { + OnEstateOwnerMessage(messagePacket, this); + } + break; + #endregion + + #region unimplemented handlers + case PacketType.AgentIsNowWearing: + // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; + //Console.WriteLine(Pack.ToString()); + break; + case PacketType.ObjectScale: + //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); + break; + #endregion + } + } + } + } +} diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs new file mode 100644 index 0000000..312da9d --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -0,0 +1,273 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using Nwc.XmlRpc; +using System.Net; +using System.Net.Sockets; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; +using OpenSim.Assets; +using OpenSim.Caches; + +namespace OpenSim +{ + public delegate bool PacketMethod(ClientView simClient, Packet packet); + + /// + /// Handles new client connections + /// Constructor takes a single Packet and authenticates everything + /// + public partial class ClientView : ClientViewBase, IClientAPI + { + public static TerrainManager TerrainManager; + + protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients + protected Dictionary m_packetHandlers = new Dictionary(); //local handlers for this instance + + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID SecureSessionID = LLUUID.Zero; + public string firstName; + public string lastName; + public bool m_child = false; + private UseCircuitCodePacket cirpack; + public Thread ClientThread; + public LLVector3 startpos; + + private AgentAssetUpload UploadAssets; + private LLUUID newAssetFolder = LLUUID.Zero; + private bool debug = false; + protected IWorld m_world; + private Dictionary m_clientThreads; + private AssetCache m_assetCache; + private InventoryCache m_inventoryCache; + private int cachedtextureserial = 0; + private RegionInfo m_regionData; + protected AuthenticateSessionsBase m_authenticateSessionsHandler; + + public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) + { + m_world = world; + m_clientThreads = clientThreads; + m_assetCache = assetCache; + + m_networkServer = packServer; + m_inventoryCache = inventoryCache; + m_authenticateSessionsHandler = authenSessions; + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); + cirpack = initialcirpack; + userEP = remoteEP; + + this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); + + PacketQueue = new BlockingQueue(); + + this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); + AckTimer = new System.Timers.Timer(500); + AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); + AckTimer.Start(); + + this.RegisterLocalPacketHandlers(); + + ClientThread = new Thread(new ThreadStart(AuthUser)); + ClientThread.IsBackground = true; + ClientThread.Start(); + } + + # region Client Methods + + public void KillClient() + { + KillObjectPacket kill = new KillObjectPacket(); + kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; + kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); + //kill.ObjectData[0].ID = this.ClientAvatar.localid; + foreach (ClientView client in m_clientThreads.Values) + { + client.OutPacket(kill); + } + + this.m_inventoryCache.ClientLeaving(this.AgentID, null); + m_world.RemoveClient(this.AgentId); + + m_clientThreads.Remove(this.CircuitCode); + m_networkServer.RemoveClientCircuit(this.CircuitCode); + this.ClientThread.Abort(); + } + #endregion + + # region Packet Handling + public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) + { + bool result = false; + lock (PacketHandlers) + { + if (!PacketHandlers.ContainsKey(packetType)) + { + PacketHandlers.Add(packetType, handler); + result = true; + } + } + return result; + } + + public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler) + { + bool result = false; + lock (m_packetHandlers) + { + if (!m_packetHandlers.ContainsKey(packetType)) + { + m_packetHandlers.Add(packetType, handler); + result = true; + } + } + return result; + } + + protected virtual bool ProcessPacketMethod(Packet packet) + { + bool result = false; + bool found = false; + PacketMethod method; + if (m_packetHandlers.TryGetValue(packet.Type, out method)) + { + //there is a local handler for this packet type + result = method(this, packet); + } + else + { + //there is not a local handler so see if there is a Global handler + lock (PacketHandlers) + { + found = PacketHandlers.TryGetValue(packet.Type, out method); + } + if (found) + { + result = method(this, packet); + } + } + return result; + } + + protected virtual void ClientLoop() + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); + while (true) + { + QueItem nextPacket = PacketQueue.Dequeue(); + if (nextPacket.Incoming) + { + //is a incoming packet + ProcessInPacket(nextPacket.Packet); + } + else + { + //is a out going packet + ProcessOutPacket(nextPacket.Packet); + } + } + } + # endregion + + # region Setup + + protected virtual void InitNewClient() + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); + this.m_world.AddNewClient(this, this.AgentID, false); + } + + protected virtual void AuthUser() + { + // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); + AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); + if (!sessionInfo.Authorised) + { + //session/circuit not authorised + OpenSim.Framework.Console.MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); + ClientThread.Abort(); + } + else + { + OpenSim.Framework.Console.MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); + //session is authorised + this.AgentID = cirpack.CircuitCode.ID; + this.SessionID = cirpack.CircuitCode.SessionID; + this.CircuitCode = cirpack.CircuitCode.Code; + this.firstName = sessionInfo.LoginInfo.First; + this.lastName = sessionInfo.LoginInfo.Last; + + if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) + { + this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; + } + InitNewClient(); + + ClientLoop(); + } + } + # endregion + + + protected override void KillThread() + { + this.ClientThread.Abort(); + } + + #region Inventory Creation + private void SetupInventory(AuthenticateResponse sessionInfo) + { + + } + private AgentInventory CreateInventory(LLUUID baseFolder) + { + AgentInventory inventory = null; + + return inventory; + } + + private void CreateInventoryItem(CreateInventoryItemPacket packet) + { + + } + #endregion + + } +} diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs new file mode 100644 index 0000000..8b503f0 --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -0,0 +1,327 @@ + +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using System.Net; +using System.Net.Sockets; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Interfaces; + +namespace OpenSim +{ + public class ClientViewBase + { + protected BlockingQueue PacketQueue; + protected Dictionary PendingAcks = new Dictionary(); + protected Dictionary NeedAck = new Dictionary(); + + protected System.Timers.Timer AckTimer; + protected uint Sequence = 0; + protected object SequenceLock = new object(); + protected const int MAX_APPENDED_ACKS = 10; + protected const int RESEND_TIMEOUT = 4000; + protected const int MAX_SEQUENCE = 0xFFFFFF; + + public uint CircuitCode; + public EndPoint userEP; + + protected PacketServer m_networkServer; + + public ClientViewBase() + { + + } + + protected virtual void ProcessInPacket(Packet Pack) + { + + } + + protected virtual void ProcessOutPacket(Packet Pack) + { + // Keep track of when this packet was sent out + Pack.TickCount = Environment.TickCount; + + if (!Pack.Header.Resent) + { + // Set the sequence number + lock (SequenceLock) + { + if (Sequence >= MAX_SEQUENCE) + Sequence = 1; + else + Sequence++; + Pack.Header.Sequence = Sequence; + } + + if (Pack.Header.Reliable) //DIRTY HACK + { + lock (NeedAck) + { + if (!NeedAck.ContainsKey(Pack.Header.Sequence)) + { + try + { + NeedAck.Add(Pack.Header.Sequence, Pack); + } + catch (Exception e) // HACKY + { + e.ToString(); + // Ignore + // Seems to throw a exception here occasionally + // of 'duplicate key' despite being locked. + // !?!?!? + } + } + else + { + // Client.Log("Attempted to add a duplicate sequence number (" + + // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + + // packet.Type.ToString(), Helpers.LogLevel.Warning); + } + } + + // Don't append ACKs to resent packets, in case that's what was causing the + // delivery to fail + if (!Pack.Header.Resent) + { + // Append any ACKs that need to be sent out to this packet + lock (PendingAcks) + { + if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && + Pack.Type != PacketType.PacketAck && + Pack.Type != PacketType.LogoutRequest) + { + Pack.Header.AckList = new uint[PendingAcks.Count]; + int i = 0; + + foreach (uint ack in PendingAcks.Values) + { + Pack.Header.AckList[i] = ack; + i++; + } + + PendingAcks.Clear(); + Pack.Header.AppendedAcks = true; + } + } + } + } + } + + byte[] ZeroOutBuffer = new byte[4096]; + byte[] sendbuffer; + sendbuffer = Pack.ToBytes(); + + try + { + if (Pack.Header.Zerocoded) + { + int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); + m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP); + } + else + { + m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP); + } + } + catch (Exception) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); + this.KillThread(); + } + + } + + public virtual void InPacket(Packet NewPack) + { + // Handle appended ACKs + if (NewPack.Header.AppendedAcks) + { + lock (NeedAck) + { + foreach (uint ack in NewPack.Header.AckList) + { + NeedAck.Remove(ack); + } + } + } + + // Handle PacketAck packets + if (NewPack.Type == PacketType.PacketAck) + { + PacketAckPacket ackPacket = (PacketAckPacket)NewPack; + + lock (NeedAck) + { + foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) + { + NeedAck.Remove(block.ID); + } + } + } + else if ((NewPack.Type == PacketType.StartPingCheck)) + { + //reply to pingcheck + libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; + libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); + endPing.PingID.PingID = startPing.PingID.PingID; + OutPacket(endPing); + } + else + { + QueItem item = new QueItem(); + item.Packet = NewPack; + item.Incoming = true; + this.PacketQueue.Enqueue(item); + } + + } + + public virtual void OutPacket(Packet NewPack) + { + QueItem item = new QueItem(); + item.Packet = NewPack; + item.Incoming = false; + this.PacketQueue.Enqueue(item); + } + + # region Low Level Packet Methods + + protected void ack_pack(Packet Pack) + { + if (Pack.Header.Reliable) + { + libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); + ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; + ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); + ack_it.Packets[0].ID = Pack.Header.Sequence; + ack_it.Header.Reliable = false; + + OutPacket(ack_it); + + } + /* + if (Pack.Header.Reliable) + { + lock (PendingAcks) + { + uint sequence = (uint)Pack.Header.Sequence; + if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } + } + }*/ + } + + protected void ResendUnacked() + { + int now = Environment.TickCount; + + lock (NeedAck) + { + foreach (Packet packet in NeedAck.Values) + { + if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + + (now - packet.TickCount) + "ms have passed"); + + packet.Header.Resent = true; + OutPacket(packet); + } + } + } + } + + protected void SendAcks() + { + lock (PendingAcks) + { + if (PendingAcks.Count > 0) + { + if (PendingAcks.Count > 250) + { + // FIXME: Handle the odd case where we have too many pending ACKs queued up + OpenSim.Framework.Console.MainLog.Instance.Verbose( "Too many ACKs queued up!"); + return; + } + + //OpenSim.Framework.Console.MainLog.Instance.WriteLine("Sending PacketAck"); + + + int i = 0; + PacketAckPacket acks = new PacketAckPacket(); + acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; + + foreach (uint ack in PendingAcks.Values) + { + acks.Packets[i] = new PacketAckPacket.PacketsBlock(); + acks.Packets[i].ID = ack; + i++; + } + + acks.Header.Reliable = false; + OutPacket(acks); + + PendingAcks.Clear(); + } + } + } + + protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) + { + SendAcks(); + ResendUnacked(); + } + #endregion + + protected virtual void KillThread() + { + + } + + #region Nested Classes + + public class QueItem + { + public QueItem() + { + } + + public Packet Packet; + public bool Incoming; + } + #endregion + } +} diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj new file mode 100644 index 0000000..0b19359 --- /dev/null +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -0,0 +1,173 @@ + + + Local + 8.0.50727 + 2.0 + {DC3698B2-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.ClientStack + JScript + Grid + IE50 + false + Library + + OpenSim.Region.ClientStack + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + OpenSim.FrameworkGenericConfig.Xml.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Terrain.BasicTerrain + {C9E0F891-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs new file mode 100644 index 0000000..229570c --- /dev/null +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -0,0 +1,183 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework; +using System.Net; +using System.Net.Sockets; +using OpenSim.Assets; +using OpenSim.Caches; + +namespace OpenSim +{ + public class PacketServer + { + private ClientStackNetworkHandler _networkHandler; + private IWorld _localWorld; + public Dictionary ClientThreads = new Dictionary(); + public Dictionary ClientAPIs = new Dictionary(); + protected uint serverPort; + + public PacketServer(ClientStackNetworkHandler networkHandler, uint port) + { + _networkHandler = networkHandler; + this.serverPort = port; + _networkHandler.RegisterPacketServer(this); + } + + public IWorld LocalWorld + { + set + { + this._localWorld = value; + } + } + + /// + /// + /// + /// + /// + public virtual void ClientInPacket(uint circuitCode, Packet packet) + { + if (this.ClientThreads.ContainsKey(circuitCode)) + { + ClientThreads[circuitCode].InPacket(packet); + } + } + + /// + /// + /// + /// + /// + public virtual bool AddNewCircuitCodeClient(uint circuitCode) + { + return false; + } + + /// + /// + /// + /// + public virtual void SendPacketToAllClients(Packet packet) + { + + } + + /// + /// + /// + /// + /// + public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient) + { + + } + + /// + /// + /// + /// + /// + public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler) + { + + } + + /// + /// + /// + public virtual void RegisterClientPacketHandlers() + { + + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) + { + return new ClientView(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions ); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass) + { + ClientView newuser = + CreateNewClient(epSender, useCircuit, ClientThreads, _localWorld, assetCache, this, inventoryCache, + authenticateSessionsClass); + + this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); + this.ClientAPIs.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); + + return true; + } + + /// + /// + /// + /// + /// + /// + /// + public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) + { + this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode); + } + + /// + /// + /// + /// + public virtual void RemoveClientCircuit(uint circuitcode) + { + this._networkHandler.RemoveClientCircuit(circuitcode); + } + } +} diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs new file mode 100644 index 0000000..b421fbd --- /dev/null +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -0,0 +1,129 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Text; +using System.IO; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.Timers; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Terrain; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework; +using OpenSim.Assets; +using OpenSim.Caches; +using OpenSim.Framework.Console; +using OpenSim.Physics.Manager; +using Nwc.XmlRpc; +using OpenSim.Framework.Servers; +using OpenSim.Framework.GenericConfig; + +namespace OpenSim +{ + public class RegionApplicationBase + { + protected IGenericConfig localConfig; + protected PhysicsManager physManager; + protected AssetCache AssetCache; + protected InventoryCache InventoryCache; + protected Dictionary clientCircuits = new Dictionary(); + protected DateTime startuptime; + protected NetworkServersInfo serversData; + + public string m_physicsEngine; + public bool m_sandbox = false; + public bool m_loginserver; + public bool user_accounts = false; + public bool gridLocalAsset = false; + protected bool configFileSetup = false; + public string m_config; + + protected List m_udpServer = new List(); + protected List regionData = new List(); + protected List m_localWorld = new List(); + protected BaseHttpServer httpServer; + protected List AuthenticateSessionsHandler = new List(); + + protected LogBase m_log; + + public RegionApplicationBase() + { + + } + + public RegionApplicationBase(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) + { + this.configFileSetup = useConfigFile; + m_sandbox = sandBoxMode; + m_loginserver = startLoginServer; + m_physicsEngine = physicsEngine; + m_config = configFile; + } + + /*protected World m_localWorld; + public World LocalWorld + { + get { return m_localWorld; } + }*/ + + /// + /// Performs initialisation of the world, such as loading configuration from disk. + /// + public virtual void StartUp() + { + } + + protected virtual void SetupLocalGridServers() + { + } + + protected virtual void SetupRemoteGridServers() + { + + } + + protected virtual void SetupWorld() + { + } + + protected virtual void SetupHttpListener() + { + } + + protected virtual void ConnectToRemoteGridServer() + { + + } + } +} diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs new file mode 100644 index 0000000..f2a02d9 --- /dev/null +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -0,0 +1,208 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Text; +using System.IO; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.Timers; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Terrain; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Assets; +using OpenSim.Caches; +using OpenSim.Framework.Console; +using OpenSim.Framework; +using Nwc.XmlRpc; +using OpenSim.Servers; +using OpenSim.GenericConfig; + +namespace OpenSim +{ + + public class UDPServer : ClientStackNetworkHandler + { + protected Dictionary clientCircuits = new Dictionary(); + public Socket Server; + protected IPEndPoint ServerIncoming; + protected byte[] RecvBuffer = new byte[4096]; + protected byte[] ZeroBuffer = new byte[8192]; + protected IPEndPoint ipeSender; + protected EndPoint epSender; + protected AsyncCallback ReceivedData; + protected PacketServer _packetServer; + + protected int listenPort; + protected IWorld m_localWorld; + protected AssetCache m_assetCache; + protected InventoryCache m_inventoryCache; + protected LogBase m_log; + protected AuthenticateSessionsBase m_authenticateSessionsClass; + + public PacketServer PacketServer + { + get + { + return _packetServer; + } + set + { + _packetServer = value; + } + } + + public IWorld LocalWorld + { + set + { + this.m_localWorld = value; + this._packetServer.LocalWorld = this.m_localWorld; + } + } + + public UDPServer() + { + } + + public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, LogBase console, AuthenticateSessionsBase authenticateClass) + { + listenPort = port; + this.m_assetCache = assetCache; + this.m_inventoryCache = inventoryCache; + this.m_log = console; + this.m_authenticateSessionsClass = authenticateClass; + this.CreatePacketServer(); + + } + + protected virtual void CreatePacketServer() + { + PacketServer packetServer = new PacketServer(this, (uint) listenPort); + } + + protected virtual void OnReceivedData(IAsyncResult result) + { + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + Packet packet = null; + int numBytes = Server.EndReceiveFrom(result, ref epSender); + int packetEnd = numBytes - 1; + + packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); + + // do we already have a circuit for this endpoint + if (this.clientCircuits.ContainsKey(epSender)) + { + //if so then send packet to the packetserver + this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet); + } + else if (packet.Type == PacketType.UseCircuitCode) + { + // new client + this.AddNewClient(packet); + } + else + { // invalid client + m_log.Warn("UDPServer.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); + } + + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + } + + protected virtual void AddNewClient(Packet packet) + { + UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; + this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); + + this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass); + } + + public void ServerListener() + { + m_log.Status("UDPServer.cs:ServerListener() - Opening UDP socket on " + listenPort); + + ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); + Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + Server.Bind(ServerIncoming); + + m_log.Verbose("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); + + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + ReceivedData = new AsyncCallback(this.OnReceivedData); + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + + m_log.Verbose("UDPServer.cs:ServerListener() - Listening..."); + + } + + public virtual void RegisterPacketServer(PacketServer server) + { + this._packetServer = server; + } + + public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) + { + // find the endpoint for this circuit + EndPoint sendto = null; + foreach (KeyValuePair p in this.clientCircuits) + { + if (p.Value == circuitcode) + { + sendto = p.Key; + break; + } + } + if (sendto != null) + { + //we found the endpoint so send the packet to it + this.Server.SendTo(buffer, size, flags, sendto); + } + } + + public virtual void RemoveClientCircuit(uint circuitcode) + { + foreach (KeyValuePair p in this.clientCircuits) + { + if (p.Value == circuitcode) + { + this.clientCircuits.Remove(p.Key); + break; + } + } + } + + + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/VersionInfo.cs b/OpenSim/Region/ClientStack/VersionInfo.cs new file mode 100644 index 0000000..5d1354e --- /dev/null +++ b/OpenSim/Region/ClientStack/VersionInfo.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; + +namespace OpenSim +{ + /// + /// + public class VersionInfo + { + public static string Version = "0.3, SVN build "; + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs new file mode 100644 index 0000000..01e0c59 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Console; +using libsecondlife; +using OpenSim.Region; +using Avatar=OpenSim.Region.Scenes.ScenePresence; +using OpenSim.Region.Scenes; +using OpenSim.Framework; +using OpenSim.Caches; +using OpenGrid.Framework.Communications; +using OpenSim.Servers; + +namespace SimpleApp +{ + public class MyWorld : Scene + { + private RegionInfo m_regionInfo; + private List m_avatars; + + public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) + { + m_regionInfo = regionInfo; + m_avatars = new List(); + } + + public override void SendLayerData(IClientAPI remoteClient) + { + float[] map = new float[65536]; + + for (int i = 0; i < 65536; i++) + { + int x = i % 256; + int y = i / 256; + + map[i] = (float)(x + y / 2); + } + + remoteClient.SendLayerData(map); + } + + #region IWorld Members + + override public void AddNewClient(IClientAPI client, LLUUID agentID, bool child) + + { + LLVector3 pos = new LLVector3(128, 128, 128); + + client.OnRegionHandShakeReply += SendLayerData; + client.OnChatFromViewer += + delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + // Echo it (so you know what you typed) + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); + }; + + client.OnRequestWearables += SendWearables; + + client.OnCompleteMovementToRegion += delegate() + { + client.MoveAgentIntoRegion(m_regionInfo, pos, LLVector3.Zero ); + }; + + client.OnCompleteMovementToRegion += delegate() + { + client.SendAvatarData(m_regionInfo.RegionHandle, client.FirstName, + client.LastName, client.AgentId, 0, + pos, null); + + client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); + }; + + client.SendRegionHandshake(m_regionInfo); + + OpenSim.Region.Scenes.ScenePresence avatar = new Avatar( client, this, m_regionInfo ); + + } + + private void SendWearables( IClientAPI client ) + { + client.SendWearables( AvatarWearable.DefaultWearables ); + } + + + override public void RemoveClient(LLUUID agentID) + { + + } + + public RegionInfo RegionInfo + { + get { return m_regionInfo; } + } + + public object SyncRoot + { + get { return this; } + } + + private uint m_nextLocalId = 1; + + public uint NextLocalId + { + get { return m_nextLocalId++; } + } + + #endregion + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs new file mode 100644 index 0000000..e1465d1 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim; +using OpenSim.GridInterfaces.Local; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Console; +using OpenSim.Assets; +using libsecondlife; +using OpenSim.Servers; +using OpenSim.Framework; +using OpenSim.Caches; +using OpenGrid.Framework.Communications; +using OpenSim.LocalCommunications; + +namespace SimpleApp +{ + class Program : IAssetReceiver, conscmd_callback + { + private LogBase m_log; + AuthenticateSessionsBase m_circuitManager; + + private void Run() + { + m_log = new LogBase(null, "SimpleApp", this, false); + MainLog.Instance = m_log; + + // CheckSumServer checksumServer = new CheckSumServer(12036); + // checksumServer.ServerListener(); + + string simAddr = "127.0.0.1"; + int simPort = 9000; + /* + LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false ); + loginServer.Startup(); + loginServer.SetSessionHandler( AddNewSessionHandler );*/ + + m_circuitManager = new AuthenticateSessionsBase(); + + InventoryCache inventoryCache = new InventoryCache(); + + LocalAssetServer assetServer = new LocalAssetServer(); + assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); + assetServer.SetReceiver(this); + + AssetCache assetCache = new AssetCache(assetServer); + + UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_log, m_circuitManager ); + PacketServer packetServer = new PacketServer( udpServer, (uint) simPort ); + udpServer.ServerListener(); + + ClientView.TerrainManager = new TerrainManager(new SecondLife()); + + CommunicationsManager communicationsManager = new CommunicationsLocal(null); + + RegionInfo regionInfo = new RegionInfo( ); + BaseHttpServer httpServer = new BaseHttpServer(simPort); + udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer ); + + // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo); + // PhysicsScene physicsScene = new NullPhysicsScene(); + // world.PhysicsScene = physicsScene; + // udpServer.LocalWorld = world; + + // httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); + httpServer.Start(); + + m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); + m_log.ReadLine(); + } + + private bool AddNewSessionHandler(ulong regionHandle, Login loginData) + { + m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); + + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + + m_circuitManager.AddNewCircuit(agent.circuitcode, agent); + + return true; + } + + #region IAssetReceiver Members + + public void AssetReceived( AssetBase asset, bool IsTexture) + { + throw new Exception("The method or operation is not implemented."); + } + + public void AssetNotFound( AssetBase asset) + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion + + #region conscmd_callback Members + + public void RunCmd(string cmd, string[] cmdparams) + { + throw new Exception("The method or operation is not implemented."); + } + + public void Show(string ShowWhat) + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion + + static void Main(string[] args) + { + Program app = new Program(); + + app.Run(); + } + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0f9bf0f --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SimpleApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Playahead AB")] +[assembly: AssemblyProduct("SimpleApp")] +[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj new file mode 100644 index 0000000..5129be2 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -0,0 +1,154 @@ + + + Local + 8.0.50727 + 2.0 + {24B12448-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + SimpleApp + JScript + Grid + IE50 + false + Exe + + SimpleApp + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\libsecondlife.dll + False + + + OpenSim.Servers.dll + False + + + System.dll + False + + + ..\..\..\..\bin\System.Data.dll + False + + + System.Xml.dll + False + + + ..\..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.ClientStack + {DC3698B2-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.GridInterfaces.Local + {241A8CDD-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.LocalCommunications + {EB3A1BA8-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Simulation + {C0DAB338-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs new file mode 100644 index 0000000..52ecd6b --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("LocalGridServers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LocalGridServers")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs new file mode 100644 index 0000000..87eff49 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs @@ -0,0 +1,312 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.IO; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; +using libsecondlife; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; + +namespace OpenSim.GridInterfaces.Local +{ + public class LocalAssetPlugin : IAssetPlugin + { + public LocalAssetPlugin() + { + + } + + public IAssetServer GetAssetServer() + { + return (new LocalAssetServer()); + } + } + + public class LocalAssetServer : IAssetServer + { + private IAssetReceiver _receiver; + private BlockingQueue _assetRequests; + private IObjectContainer db; + private Thread _localAssetServerThread; + + public LocalAssetServer() + { + bool yapfile; + this._assetRequests = new BlockingQueue(); + yapfile = System.IO.File.Exists("assets.yap"); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "Local Asset Server class created"); + try + { + db = Db4oFactory.OpenFile("assets.yap"); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "Db4 Asset database creation"); + } + catch (Exception e) + { + db.Close(); + OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured"); + OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + } + if (!yapfile) + { + this.SetUpAssetDatabase(); + } + this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); + this._localAssetServerThread.IsBackground = true; + this._localAssetServerThread.Start(); + + } + + public void SetReceiver(IAssetReceiver receiver) + { + this._receiver = receiver; + } + + public void RequestAsset(LLUUID assetID, bool isTexture) + { + ARequest req = new ARequest(); + req.AssetID = assetID; + req.IsTexture = isTexture; + this._assetRequests.Enqueue(req); + } + + public void UpdateAsset(AssetBase asset) + { + + } + + public void UploadNewAsset(AssetBase asset) + { + AssetStorage store = new AssetStorage(); + store.Data = asset.Data; + store.Name = asset.Name; + store.UUID = asset.FullID; + db.Set(store); + db.Commit(); + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + + } + public void Close() + { + if (db != null) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "Closing local asset server database"); + db.Close(); + } + } + + private void RunRequests() + { + while (true) + { + byte[] idata = null; + bool found = false; + AssetStorage foundAsset = null; + ARequest req = this._assetRequests.Dequeue(); + IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); + if (result.Count > 0) + { + foundAsset = (AssetStorage)result.Next(); + found = true; + } + + AssetBase asset = new AssetBase(); + if (found) + { + asset.FullID = foundAsset.UUID; + asset.Type = foundAsset.Type; + asset.InvType = foundAsset.Type; + asset.Name = foundAsset.Name; + idata = foundAsset.Data; + } + else + { + asset.FullID = LLUUID.Zero; + } + asset.Data = idata; + _receiver.AssetReceived(asset, req.IsTexture); + } + + } + + private void SetUpAssetDatabase() + { + try + { + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "Setting up asset database"); + + AssetBase Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); + Image.Name = "Bricks"; + this.LoadAsset(Image, true, "bricks.jp2"); + AssetStorage store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); + Image.Name = "Plywood"; + this.LoadAsset(Image, true, "plywood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); + Image.Name = "Rocks"; + this.LoadAsset(Image, true, "rocks.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); + Image.Name = "Granite"; + this.LoadAsset(Image, true, "granite.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); + Image.Name = "Hardwood"; + this.LoadAsset(Image, true, "hardwood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); + Image.Name = "Prim Base Texture"; + this.LoadAsset(Image, true, "plywood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); + Image.Name = "Map Base Texture"; + this.LoadAsset(Image, true, "map_base.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); + Image.Name = "Map Texture"; + this.LoadAsset(Image, true, "map1.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + Image.Name = "Shape"; + this.LoadAsset(Image, false, "base_shape.dat"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + + } + + private void LoadAsset(AssetBase info, bool image, string filename) + { + //should request Asset from storage manager + //but for now read from file + + string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; + string fileName = Path.Combine(dataPath, filename); + FileInfo fInfo = new FileInfo(fileName); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); + byte[] idata = new byte[numBytes]; + BinaryReader br = new BinaryReader(fStream); + idata = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + info.Data = idata; + //info.loaded=true; + } + } + public class AssetUUIDQuery : Predicate + { + private LLUUID _findID; + + public AssetUUIDQuery(LLUUID find) + { + _findID = find; + } + public bool Match(AssetStorage asset) + { + return (asset.UUID == _findID); + } + } + +} diff --git a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj new file mode 100644 index 0000000..484a205 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj @@ -0,0 +1,107 @@ + + + Local + 8.0.50727 + 2.0 + {241A8CDD-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.GridInterfaces.Local + JScript + Grid + IE50 + false + Library + + OpenSim.Region.GridInterfaces.Local + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs new file mode 100644 index 0000000..51596d0 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("RemoteGridServers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RemoteGridServers")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj new file mode 100644 index 0000000..793fde2 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj @@ -0,0 +1,107 @@ + + + Local + 8.0.50727 + 2.0 + {98C7B681-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.GridInterfaces.Remote + JScript + Grid + IE50 + false + Library + + OpenSim.Region.GridInterfaces.Remote + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs new file mode 100644 index 0000000..ca01c68 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs @@ -0,0 +1,135 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.IO; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; + +namespace OpenSim.GridInterfaces.Remote +{ + public class RemoteAssetServer : IAssetServer + { + private IAssetReceiver _receiver; + private BlockingQueue _assetRequests; + private Thread _remoteAssetServerThread; + private string AssetServerUrl; + private string AssetSendKey; + + public RemoteAssetServer() + { + this._assetRequests = new BlockingQueue(); + this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); + this._remoteAssetServerThread.IsBackground = true; + this._remoteAssetServerThread.Start(); + OpenSim.Framework.Console.MainLog.Instance.Verbose("Remote Asset Server class created"); + } + + public void SetReceiver(IAssetReceiver receiver) + { + this._receiver = receiver; + } + + public void RequestAsset(LLUUID assetID, bool isTexture) + { + ARequest req = new ARequest(); + req.AssetID = assetID; + req.IsTexture = isTexture; + this._assetRequests.Enqueue(req); + } + + public void UpdateAsset(AssetBase asset) + { + + } + + public void UploadNewAsset(AssetBase asset) + { + Encoding Windows1252Encoding = Encoding.GetEncoding(1252); + string ret = Windows1252Encoding.GetString(asset.Data); + byte[] buffer = Windows1252Encoding.GetBytes(ret); + WebClient client = new WebClient(); + client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer); + + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + this.AssetServerUrl = ServerUrl; + this.AssetSendKey = ServerKey; + } + + private void RunRequests() + { + while (true) + { + //we need to add support for the asset server not knowing about a requested asset + // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM + ARequest req = this._assetRequests.Dequeue(); + LLUUID assetID = req.AssetID; + // OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID); + WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID); + WebResponse AssetResponse = AssetLoad.GetResponse(); + byte[] idata = new byte[(int)AssetResponse.ContentLength]; + BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); + idata = br.ReadBytes((int)AssetResponse.ContentLength); + br.Close(); + + AssetBase asset = new AssetBase(); + asset.FullID = assetID; + asset.Data = idata; + _receiver.AssetReceived(asset, req.IsTexture); + } + } + + public void Close() + { + + } + } + + public class RemoteAssetPlugin : IAssetPlugin + { + public RemoteAssetPlugin() + { + + } + + public IAssetServer GetAssetServer() + { + return (new RemoteAssetServer()); + } + } + +} diff --git a/OpenSim/Region/LocalCommunications/CommunicationsLocal.cs b/OpenSim/Region/LocalCommunications/CommunicationsLocal.cs new file mode 100644 index 0000000..743b9b4 --- /dev/null +++ b/OpenSim/Region/LocalCommunications/CommunicationsLocal.cs @@ -0,0 +1,61 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenGrid.Framework.Communications; + + +namespace OpenSim.LocalCommunications +{ + public class CommunicationsLocal : CommunicationsManager + { + public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); + public LocalUserServices UserServices; + + public CommunicationsLocal(NetworkServersInfo serversInfo) + : base(serversInfo) + { + UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY); + UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll"); + UserServer = UserServices; + GridServer = SandBoxServices; + InterRegion = SandBoxServices; + } + + internal void InformRegionOfLogin(ulong regionHandle, Login login) + { + this.SandBoxServices.AddNewSession(regionHandle, login); + } + } +} diff --git a/OpenSim/Region/LocalCommunications/LocalBackEndServices.cs b/OpenSim/Region/LocalCommunications/LocalBackEndServices.cs new file mode 100644 index 0000000..ce48c6e --- /dev/null +++ b/OpenSim/Region/LocalCommunications/LocalBackEndServices.cs @@ -0,0 +1,209 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Communications; +using libsecondlife; +using OpenSim.Framework.Types; +using OpenSim.Framework; + +namespace OpenSim.LocalCommunications +{ + + public class LocalBackEndServices : IGridServices, IInterRegionCommunications + { + protected Dictionary regions = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); + + public LocalBackEndServices() + { + + } + + /// + /// Register a region method with the BackEnd Services. + /// + /// + /// + public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + { + //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); + this.regions.Add(regionInfo.RegionHandle, regionInfo); + RegionCommsListener regionHost = new RegionCommsListener(); + this.regionHosts.Add(regionInfo.RegionHandle, regionHost); + + return regionHost; + } + + //already in our list of regions so for now lets return null + return null; + } + + /// + /// + /// + /// + public List RequestNeighbours(RegionInfo regionInfo) + { + // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); + List neighbours = new List(); + + foreach (RegionInfo reg in this.regions.Values) + { + // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); + if (reg.RegionHandle != regionInfo.RegionHandle) + { + //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); + if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) + { + if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) + { + neighbours.Add(reg); + } + } + } + } + return neighbours; + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + if (this.regions.ContainsKey(regionHandle)) + { + return this.regions[regionHandle]; + } + return null; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + List mapBlocks = new List(); + foreach(RegionInfo regInfo in this.regions.Values) + { + if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) + { + MapBlockData map = new MapBlockData(); + map.Name = regInfo.RegionName; + map.X = (ushort)regInfo.RegionLocX; + map.Y = (ushort)regInfo.RegionLocY; + map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; + map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); + map.Agents = 1; + map.RegionFlags = 72458694; + map.Access = 13; + mapBlocks.Add(map); + } + } + return mapBlocks; + } + + /// + /// + /// + /// + /// + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect child agent"); + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + /// + /// + /// + /// + /// + /// + /// + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); + this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + + /// + /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session + /// + /// + /// + /// + public bool AddNewSession(ulong regionHandle, Login loginData) + { + //Console.WriteLine(" comms manager been told to expect new user"); + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + agent.CapsPath = loginData.CapsPath; + + if (this.regionHosts.ContainsKey(regionHandle)) + { + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); + return true; + } + + // region not found + return false; + } + } +} + diff --git a/OpenSim/Region/LocalCommunications/LocalUserServices.cs b/OpenSim/Region/LocalCommunications/LocalUserServices.cs new file mode 100644 index 0000000..a7f7aa4 --- /dev/null +++ b/OpenSim/Region/LocalCommunications/LocalUserServices.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +using OpenGrid.Framework.Communications; +//using OpenSim.Framework.User; +using OpenGrid.Framework.UserManagement; +using OpenGrid.Framework.Data; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; + +using libsecondlife; + +namespace OpenSim.LocalCommunications +{ + public class LocalUserServices : UserManagerBase, IUserServices + { + private CommunicationsLocal m_Parent; + + private uint defaultHomeX ; + private uint defaultHomeY; + public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) + { + m_Parent = parent; + defaultHomeX = defHomeX; + defaultHomeY = defHomeY; + } + + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return GetUserProfile(firstName + " " + lastName); + } + + public UserProfileData GetUserProfile(string name) + { + return this.getUserProfile(name); + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + return this.getUserProfile(avatarID); + } + + /// + /// + /// + /// + public override string GetMessage() + { + return "Welcome to OpenSim"; + } + + public override UserProfileData GetTheUser(string firstname, string lastname) + { + UserProfileData profile = getUserProfile(firstname, lastname); + if (profile != null) + { + + return profile; + } + + //no current user account so make one + Console.WriteLine("No User account found so creating a new one "); + this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); + + profile = getUserProfile(firstname, lastname); + + return profile; + } + + public override bool AuthenticateUser(ref UserProfileData profile, string password) + { + //for now we will accept any password in sandbox mode + Console.WriteLine("authorising user"); + return true; + } + + public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) + { + ulong currentRegion = theUser.currentAgent.currentHandle; + RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); + + + if (reg != null) + { + response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; + string capsPath = Util.GetRandomCapsPath(); + response.SimAddress = reg.CommsIPListenAddr; + response.SimPort = (Int32)reg.CommsIPListenPort; + response.RegionX = reg.RegionLocX ; + response.RegionY = reg.RegionLocY ; + response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/"; + theUser.currentAgent.currentRegion = reg.SimUUID; + theUser.currentAgent.currentHandle = reg.RegionHandle; + + Login _login = new Login(); + //copy data to login object + _login.First = response.Firstname; + _login.Last = response.Lastname; + _login.Agent = response.AgentID; + _login.Session = response.SessionID; + _login.SecureSession = response.SecureSessionID; + _login.CircuitCode = (uint)response.CircuitCode; + _login.CapsPath = capsPath; + + m_Parent.InformRegionOfLogin(currentRegion, _login); + } + else + { + Console.WriteLine("not found region " + currentRegion); + } + + } + + } +} diff --git a/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj b/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj new file mode 100644 index 0000000..6b2b78c --- /dev/null +++ b/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj @@ -0,0 +1,121 @@ + + + Local + 8.0.50727 + 2.0 + {EB3A1BA8-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.LocalCommunications + JScript + Grid + IE50 + false + Library + + OpenSim.Region.LocalCommunications + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Data + {36B72A9B-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.UserManagement + {586E2916-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user b/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs b/OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8e6e711 --- /dev/null +++ b/OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.LocalCommunications")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.LocalCommunications")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs new file mode 100644 index 0000000..177c49d --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PhysXplugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PhysXplugin")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs new file mode 100644 index 0000000..dcb8f3b --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -0,0 +1,294 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using OpenSim.Physics.Manager; + +namespace OpenSim.Region.Physics.BasicPhysicsPlugin +{ + /// + /// Will be the PhysX plugin but for now will be a very basic physics engine + /// + public class BasicPhysicsPlugin : IPhysicsPlugin + { + private BasicScene _mScene; + + public BasicPhysicsPlugin() + { + + } + + public bool Init() + { + return true; + } + + public PhysicsScene GetScene() + { + return new BasicScene(); + } + + public string GetName() + { + return("basicphysics"); + } + + public void Dispose() + { + + } + } + + public class BasicScene :PhysicsScene + { + private List _actors = new List(); + private float[] _heightMap; + + public BasicScene() + { + + } + + public override PhysicsActor AddAvatar(PhysicsVector position) + { + BasicActor act = new BasicActor(); + act.Position = position; + _actors.Add(act); + return act; + } + + public override void RemoveAvatar(PhysicsActor actor) + { + BasicActor act = (BasicActor)actor; + if(_actors.Contains(act)) + { + _actors.Remove(act); + } + + } + + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) + { + return null; + } + + public override void Simulate(float timeStep) + { + foreach (BasicActor actor in _actors) + { + actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); + actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); + actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); + /*if(actor.Flying) + { + actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); + } + else + { + actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); + } + if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) + {*/ + if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) + { + actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1; + } + else + { + if (actor.Position.Y < 0) + { + actor.Position.Y = 0; + } + else if (actor.Position.Y > 256) + { + actor.Position.Y = 256; + } + + if (actor.Position.X < 0) + { + actor.Position.X = 0; + } + if (actor.Position.X > 256) + { + actor.Position.X = 256; + } + } + //} + + + + // This code needs sorting out - border crossings etc +/* if(actor.Position.X<0) + { + ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); + actor.Position.X = 0; + actor.Velocity.X = 0; + } + if(actor.Position.Y < 0) + { + ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); + actor.Position.Y = 0; + actor.Velocity.Y = 0; + } + if(actor.Position.X > 255) + { + ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); + actor.Position.X = 255; + actor.Velocity.X = 0; + } + if(actor.Position.Y > 255) + { + ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); + actor.Position.Y = 255; + actor.Velocity.X = 0; + }*/ + } + } + + public override void GetResults() + { + + } + + public override bool IsThreaded + { + get + { + return(false); // for now we won't be multithreaded + } + } + + public override void SetTerrain(float[] heightMap) + { + this._heightMap = heightMap; + } + + public override void DeleteTerrain() + { + + } + } + + public class BasicActor : PhysicsActor + { + private PhysicsVector _position; + private PhysicsVector _velocity; + private PhysicsVector _acceleration; + private bool flying; + public BasicActor() + { + _velocity = new PhysicsVector(); + _position = new PhysicsVector(); + _acceleration = new PhysicsVector(); + } + + public override bool Flying + { + get + { + return false; + } + set + { + flying= value; + } + } + + public override PhysicsVector Position + { + get + { + return _position; + } + set + { + _position = value; + } + } + + public override PhysicsVector Velocity + { + get + { + return _velocity; + } + set + { + _velocity = value; + } + } + + public override Axiom.MathLib.Quaternion Orientation + { + get + { + return Axiom.MathLib.Quaternion.Identity; + } + set + { + + } + } + + public override PhysicsVector Acceleration + { + get + { + return _acceleration; + } + + } + + public override bool Kinematic + { + get + { + return true; + } + set + { + + } + } + public void SetAcceleration (PhysicsVector accel) + { + this._acceleration = accel; + } + + public override void AddForce(PhysicsVector force) + { + + } + + public override void SetMomentum(PhysicsVector momentum) + { + + } + } + +} diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj new file mode 100644 index 0000000..7dad533 --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj @@ -0,0 +1,93 @@ + + + Local + 8.0.50727 + 2.0 + {15B4FEF3-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Physics.BasicPhysicsPlugin + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Physics.BasicPhysicsPlugin + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\Physics\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\Physics\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Axiom.MathLib.dll + False + + + System.dll + False + + + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs new file mode 100644 index 0000000..132f64a --- /dev/null +++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PhysicsManager")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PhysicsManager")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj new file mode 100644 index 0000000..f340400 --- /dev/null +++ b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj @@ -0,0 +1,112 @@ + + + Local + 8.0.50727 + 2.0 + {F4FF31EB-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Physics.Manager + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Physics.Manager + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Axiom.MathLib.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs new file mode 100644 index 0000000..6366fb8 --- /dev/null +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -0,0 +1,161 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Physics.Manager +{ + public abstract class PhysicsActor + { + public static PhysicsActor Null + { + get + { + return new NullPhysicsActor(); + } + } + + public abstract PhysicsVector Position + { + get; + set; + } + + public abstract PhysicsVector Velocity + { + get; + set; + } + + public abstract PhysicsVector Acceleration + { + get; + } + + public abstract Axiom.MathLib.Quaternion Orientation + { + get; + set; + } + + public abstract bool Flying + { + get; + set; + } + + public abstract bool Kinematic + { + get; + set; + } + + public abstract void AddForce(PhysicsVector force); + + public abstract void SetMomentum(PhysicsVector momentum); + } + + public class NullPhysicsActor : PhysicsActor + { + public override PhysicsVector Position + { + get + { + return PhysicsVector.Zero; + } + set + { + return; + } + } + + public override PhysicsVector Velocity + { + get + { + return PhysicsVector.Zero; + } + set + { + return; + } + } + + public override Axiom.MathLib.Quaternion Orientation + { + get + { + return Axiom.MathLib.Quaternion.Identity; + } + set + { + + } + } + + public override PhysicsVector Acceleration + { + get { return PhysicsVector.Zero; } + } + + public override bool Flying + { + get + { + return false; + } + set + { + return; + } + } + + public override bool Kinematic + { + get + { + return true; + } + set + { + return; + } + } + + public override void AddForce(PhysicsVector force) + { + return; + } + + public override void SetMomentum(PhysicsVector momentum) + { + return; + } + } +} diff --git a/OpenSim/Region/Physics/Manager/PhysicsManager.cs b/OpenSim/Region/Physics/Manager/PhysicsManager.cs new file mode 100644 index 0000000..efccb36 --- /dev/null +++ b/OpenSim/Region/Physics/Manager/PhysicsManager.cs @@ -0,0 +1,117 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Collections; +using System.IO; +using System.Reflection; +using Axiom.MathLib; +using OpenSim.Framework.Console; + +namespace OpenSim.Physics.Manager +{ + /// + /// Description of MyClass. + /// + public class PhysicsManager + { + private Dictionary _plugins=new Dictionary(); + + public PhysicsManager() + { + + } + + public PhysicsScene GetPhysicsScene(string engineName) + { + if (String.IsNullOrEmpty(engineName)) + { + return new NullPhysicsScene(); + } + + if(_plugins.ContainsKey(engineName)) + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName); + return _plugins[engineName].GetScene(); + } + else + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName); + throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); + } + } + + public void LoadPlugins() + { + string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); + string[] pluginFiles = Directory.GetFiles(path, "*.dll"); + + + for(int i= 0; i + /// ODE plugin + /// + public class OdePlugin : IPhysicsPlugin + { + private OdeScene _mScene; + + public OdePlugin() + { + + } + + public bool Init() + { + return true; + } + + public PhysicsScene GetScene() + { + if (_mScene == null) + { + _mScene = new OdeScene(); + } + return (_mScene); + } + + public string GetName() + { + return ("OpenDynamicsEngine"); + } + + public void Dispose() + { + + } + } + + public class OdeScene : PhysicsScene + { + static public IntPtr world; + static public IntPtr space; + static private IntPtr contactgroup; + static private IntPtr LandGeom; + //static private IntPtr Land; + private double[] _heightmap; + static private d.NearCallback nearCallback = near; + private List _characters = new List(); + private static d.ContactGeom[] contacts = new d.ContactGeom[30]; + private static d.Contact contact; + + public OdeScene() + { + contact.surface.mode = d.ContactFlags.Bounce | d.ContactFlags.SoftCFM; + contact.surface.mu = d.Infinity; + contact.surface.mu2 = 0.0f; + contact.surface.bounce = 0.1f; + contact.surface.bounce_vel = 0.1f; + contact.surface.soft_cfm = 0.01f; + + world = d.WorldCreate(); + space = d.HashSpaceCreate(IntPtr.Zero); + contactgroup = d.JointGroupCreate(0); + d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f); + //d.WorldSetCFM(world, 1e-5f); + d.WorldSetAutoDisableFlag(world, false); + d.WorldSetContactSurfaceLayer(world, 0.001f); + // d.CreatePlane(space, 0, 0, 1, 0); + this._heightmap = new double[65536]; + } + + // This function blatantly ripped off from BoxStack.cs + static private void near(IntPtr space, IntPtr g1, IntPtr g2) + { + IntPtr b1 = d.GeomGetBody(g1); + IntPtr b2 = d.GeomGetBody(g2); + if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) + return; + + int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf); + for (int i = 0; i < count; ++i) + { + contact.geom = contacts[i]; + IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); + d.JointAttach(joint, b1, b2); + } + + } + + public override PhysicsActor AddAvatar(PhysicsVector position) + { + PhysicsVector pos = new PhysicsVector(); + pos.X = position.X; + pos.Y = position.Y; + pos.Z = position.Z + 20; + OdeCharacter newAv = new OdeCharacter(this, pos); + this._characters.Add(newAv); + return newAv; + } + + public override void RemoveAvatar(PhysicsActor actor) + { + + } + + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) + { + PhysicsVector pos = new PhysicsVector(); + pos.X = position.X; + pos.Y = position.Y; + pos.Z = position.Z; + PhysicsVector siz = new PhysicsVector(); + siz.X = size.X; + siz.Y = size.Y; + siz.Z = size.Z; + return new OdePrim(); + } + + public override void Simulate(float timeStep) + { + foreach (OdeCharacter actor in _characters) + { + actor.Move(timeStep * 5f); + } + d.SpaceCollide(space, IntPtr.Zero, nearCallback); + d.WorldQuickStep(world, timeStep * 5f); + d.JointGroupEmpty(contactgroup); + foreach (OdeCharacter actor in _characters) + { + actor.UpdatePosition(); + } + + } + + public override void GetResults() + { + + } + + public override bool IsThreaded + { + get + { + return (false); // for now we won't be multithreaded + } + } + + public override void SetTerrain(float[] heightMap) + { + for (int i = 0; i < 65536; i++) + { + // this._heightmap[i] = (double)heightMap[i]; + // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) + int x = i & 0xff; + int y = i >> 8; + this._heightmap[i] = (double)heightMap[x * 256 + y]; + } + IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); + d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); + d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); + LandGeom = d.CreateHeightfield(space, HeightmapData, 1); + d.Matrix3 R = new d.Matrix3(); + + Axiom.MathLib.Quaternion q1 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(1,0,0)); + Axiom.MathLib.Quaternion q2 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(0,1,0)); + //Axiom.MathLib.Quaternion q3 = Axiom.MathLib.Quaternion.FromAngleAxis(3.14f, new Axiom.MathLib.Vector3(0, 0, 1)); + + q1 = q1 * q2; + //q1 = q1 * q3; + Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(); + float angle = 0; + q1.ToAngleAxis(ref angle, ref v3); + + d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); + d.GeomSetRotation(LandGeom, ref R); + d.GeomSetPosition(LandGeom, 128, 128, 0); + } + + public override void DeleteTerrain() + { + + } + } + + public class OdeCharacter : PhysicsActor + { + private PhysicsVector _position; + private PhysicsVector _velocity; + private PhysicsVector _acceleration; + private bool flying; + //private float gravityAccel; + private IntPtr BoundingCapsule; + IntPtr capsule_geom; + d.Mass capsule_mass; + + public OdeCharacter(OdeScene parent_scene, PhysicsVector pos) + { + _velocity = new PhysicsVector(); + _position = pos; + _acceleration = new PhysicsVector(); + d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f); + capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f); + this.BoundingCapsule = d.BodyCreate(OdeScene.world); + d.BodySetMass(BoundingCapsule, ref capsule_mass); + d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); + d.GeomSetBody(capsule_geom, BoundingCapsule); + } + + public override bool Flying + { + get + { + return flying; + } + set + { + flying = value; + } + } + + public override PhysicsVector Position + { + get + { + return _position; + } + set + { + _position = value; + } + } + + public override PhysicsVector Velocity + { + get + { + return _velocity; + } + set + { + _velocity = value; + } + } + + public override bool Kinematic + { + get + { + return false; + } + set + { + + } + } + + public override Axiom.MathLib.Quaternion Orientation + { + get + { + return Axiom.MathLib.Quaternion.Identity; + } + set + { + + } + } + + public override PhysicsVector Acceleration + { + get + { + return _acceleration; + } + + } + public void SetAcceleration(PhysicsVector accel) + { + this._acceleration = accel; + } + + public override void AddForce(PhysicsVector force) + { + + } + + public override void SetMomentum(PhysicsVector momentum) + { + + } + + public void Move(float timeStep) + { + PhysicsVector vec = new PhysicsVector(); + vec.X = this._velocity.X * timeStep; + vec.Y = this._velocity.Y * timeStep; + if (flying) + { + vec.Z = (this._velocity.Z + 0.5f) * timeStep; + } + d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z); + } + + public void UpdatePosition() + { + d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); + this._position.X = vec.X; + this._position.Y = vec.Y; + this._position.Z = vec.Z+1.0f; + } + } + + public class OdePrim : PhysicsActor + { + private PhysicsVector _position; + private PhysicsVector _velocity; + private PhysicsVector _acceleration; + + public OdePrim() + { + _velocity = new PhysicsVector(); + _position = new PhysicsVector(); + _acceleration = new PhysicsVector(); + } + public override bool Flying + { + get + { + return false; //no flying prims for you + } + set + { + + } + } + public override PhysicsVector Position + { + get + { + PhysicsVector pos = new PhysicsVector(); + // PhysicsVector vec = this._prim.Position; + //pos.X = vec.X; + //pos.Y = vec.Y; + //pos.Z = vec.Z; + return pos; + + } + set + { + /*PhysicsVector vec = value; + PhysicsVector pos = new PhysicsVector(); + pos.X = vec.X; + pos.Y = vec.Y; + pos.Z = vec.Z; + this._prim.Position = pos;*/ + } + } + + public override PhysicsVector Velocity + { + get + { + return _velocity; + } + set + { + _velocity = value; + } + } + + public override bool Kinematic + { + get + { + return false; + //return this._prim.Kinematic; + } + set + { + //this._prim.Kinematic = value; + } + } + + public override Axiom.MathLib.Quaternion Orientation + { + get + { + Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); + return res; + } + set + { + + } + } + + public override PhysicsVector Acceleration + { + get + { + return _acceleration; + } + + } + public void SetAcceleration(PhysicsVector accel) + { + this._acceleration = accel; + } + + public override void AddForce(PhysicsVector force) + { + + } + + public override void SetMomentum(PhysicsVector momentum) + { + + } + + + } + +} diff --git a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj new file mode 100644 index 0000000..490c681 --- /dev/null +++ b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj @@ -0,0 +1,97 @@ + + + Local + 8.0.50727 + 2.0 + {90620634-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Physics.OdePlugin + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Physics.OdePlugin + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\Physics\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\Physics\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\..\bin\Ode.NET.dll + False + + + System.dll + False + + + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs new file mode 100644 index 0000000..b49c8da --- /dev/null +++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("RealPhysXplugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RealPhysXplugin")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj new file mode 100644 index 0000000..77da908 --- /dev/null +++ b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj @@ -0,0 +1,97 @@ + + + Local + 8.0.50727 + 2.0 + {A6D191D8-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Physics.PhysXPlugin + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Physics.PhysXPlugin + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\Physics\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\Physics\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\..\bin\PhysX_Wrapper_Dotnet.dll + False + + + System.dll + False + + + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs new file mode 100644 index 0000000..8bf794b --- /dev/null +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -0,0 +1,424 @@ +/*/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using OpenSim.Physics.Manager; +using PhysXWrapper; + +namespace OpenSim.Region.Physics.PhysXPlugin +{ + /// + /// Will be the PhysX plugin but for now will be a very basic physics engine + /// + public class PhysXPlugin : IPhysicsPlugin + { + private PhysXScene _mScene; + + public PhysXPlugin() + { + + } + + public bool Init() + { + return true; + } + + public PhysicsScene GetScene() + { + if(_mScene == null) + { + _mScene = new PhysXScene(); + } + return(_mScene); + } + + public string GetName() + { + return("RealPhysX"); + } + + public void Dispose() + { + + } + } + + public class PhysXScene :PhysicsScene + { + private List _characters = new List(); + private List _prims = new List(); + private float[] _heightMap = null; + private NxPhysicsSDK mySdk; + private NxScene scene; + + public PhysXScene() + { + mySdk = NxPhysicsSDK.CreateSDK(); + Console.WriteLine("Sdk created - now creating scene"); + scene = mySdk.CreateScene(); + + } + + public override PhysicsActor AddAvatar(PhysicsVector position) + { + Vec3 pos = new Vec3(); + pos.X = position.X; + pos.Y = position.Y; + pos.Z = position.Z; + PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); + act.Position = position; + _characters.Add(act); + return act; + } + + public override void RemoveAvatar(PhysicsActor actor) + { + + } + + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) + { + Vec3 pos = new Vec3(); + pos.X = position.X; + pos.Y = position.Y; + pos.Z = position.Z; + Vec3 siz = new Vec3(); + siz.X = size.X; + siz.Y = size.Y; + siz.Z = size.Z; + PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); + _prims.Add(act); + return act; + } + public override void Simulate(float timeStep) + { + try + { + foreach (PhysXCharacter actor in _characters) + { + actor.Move(timeStep); + } + scene.Simulate(timeStep); + scene.FetchResults(); + scene.UpdateControllers(); + + foreach (PhysXCharacter actor in _characters) + { + actor.UpdatePosition(); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + + } + + public override void GetResults() + { + + } + + public override bool IsThreaded + { + get + { + return(false); // for now we won't be multithreaded + } + } + + public override void SetTerrain(float[] heightMap) + { + if (this._heightMap != null) + { + Console.WriteLine("PhysX - deleting old terrain"); + this.scene.DeleteTerrain(); + } + this._heightMap = heightMap; + this.scene.AddTerrain(heightMap); + } + + public override void DeleteTerrain() + { + this.scene.DeleteTerrain(); + } + } + + public class PhysXCharacter : PhysicsActor + { + private PhysicsVector _position; + private PhysicsVector _velocity; + private PhysicsVector _acceleration; + private NxCharacter _character; + private bool flying; + private float gravityAccel; + + public PhysXCharacter(NxCharacter character) + { + _velocity = new PhysicsVector(); + _position = new PhysicsVector(); + _acceleration = new PhysicsVector(); + _character = character; + } + + public override bool Flying + { + get + { + return flying; + } + set + { + flying = value; + } + } + + public override PhysicsVector Position + { + get + { + return _position; + } + set + { + _position = value; + Vec3 ps = new Vec3(); + ps.X = value.X; + ps.Y = value.Y; + ps.Z = value.Z; + this._character.Position = ps; + } + } + + public override PhysicsVector Velocity + { + get + { + return _velocity; + } + set + { + _velocity = value; + } + } + + public override bool Kinematic + { + get + { + return false; + } + set + { + + } + } + + public override Axiom.MathLib.Quaternion Orientation + { + get + { + return Axiom.MathLib.Quaternion.Identity; + } + set + { + + } + } + + public override PhysicsVector Acceleration + { + get + { + return _acceleration; + } + + } + public void SetAcceleration (PhysicsVector accel) + { + this._acceleration = accel; + } + + public override void AddForce(PhysicsVector force) + { + + } + + public override void SetMomentum(PhysicsVector momentum) + { + + } + + public void Move(float timeStep) + { + Vec3 vec = new Vec3(); + vec.X = this._velocity.X * timeStep; + vec.Y = this._velocity.Y * timeStep; + if(flying) + { + vec.Z = ( this._velocity.Z) * timeStep; + } + else + { + gravityAccel+= -9.8f; + vec.Z = (gravityAccel + this._velocity.Z) * timeStep; + } + int res = this._character.Move(vec); + if(res == 1) + { + gravityAccel = 0; + } + } + + public void UpdatePosition() + { + Vec3 vec = this._character.Position; + this._position.X = vec.X; + this._position.Y = vec.Y; + this._position.Z = vec.Z; + } + } + + public class PhysXPrim : PhysicsActor + { + private PhysicsVector _position; + private PhysicsVector _velocity; + private PhysicsVector _acceleration; + private NxActor _prim; + + public PhysXPrim(NxActor prim) + { + _velocity = new PhysicsVector(); + _position = new PhysicsVector(); + _acceleration = new PhysicsVector(); + _prim = prim; + } + public override bool Flying + { + get + { + return false; //no flying prims for you + } + set + { + + } + } + public override PhysicsVector Position + { + get + { + PhysicsVector pos = new PhysicsVector(); + Vec3 vec = this._prim.Position; + pos.X = vec.X; + pos.Y = vec.Y; + pos.Z = vec.Z; + return pos; + + } + set + { + PhysicsVector vec = value; + Vec3 pos = new Vec3(); + pos.X = vec.X; + pos.Y = vec.Y; + pos.Z = vec.Z; + this._prim.Position = pos; + } + } + + public override PhysicsVector Velocity + { + get + { + return _velocity; + } + set + { + _velocity = value; + } + } + + public override bool Kinematic + { + get + { + return this._prim.Kinematic; + } + set + { + this._prim.Kinematic = value; + } + } + + public override Axiom.MathLib.Quaternion Orientation + { + get + { + Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); + PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); + res.w = quat.W; + res.x = quat.X; + res.y = quat.Y; + res.z = quat.Z; + return res; + } + set + { + + } + } + + public override PhysicsVector Acceleration + { + get + { + return _acceleration; + } + + } + public void SetAcceleration (PhysicsVector accel) + { + this._acceleration = accel; + } + + public override void AddForce(PhysicsVector force) + { + + } + + public override void SetMomentum(PhysicsVector momentum) + { + + } + + + } + +} diff --git a/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs b/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f5da4c0 --- /dev/null +++ b/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Scripting")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Scripting")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("61eae1ad-82aa-4c77-8bc5-b5a8c9522b18")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Scripting/Script.cs b/OpenSim/Region/Scripting/Script.cs new file mode 100644 index 0000000..0f4af00 --- /dev/null +++ b/OpenSim/Region/Scripting/Script.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework.Console; +using OpenSim.Framework; +using OpenSim.Region; +using OpenSim.Region.Scenes; + +namespace OpenSim.Scripting +{ + public interface IScript + { + void Initialise(ScriptInfo scriptInfo); + } + + public class TestScript : IScript + { + ScriptInfo script; + + public void Initialise(ScriptInfo scriptInfo) + { + script = scriptInfo; + script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame); + } + + void events_OnFrame() + { + script.logger.Verbose("Hello World!"); + } + } +} diff --git a/OpenSim/Region/Scripting/ScriptAccess.cs b/OpenSim/Region/Scripting/ScriptAccess.cs new file mode 100644 index 0000000..a9fede5 --- /dev/null +++ b/OpenSim/Region/Scripting/ScriptAccess.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Scenes; +using OpenSim.Framework.Console; + +namespace OpenSim.Scripting +{ + /// + /// Class which provides access to the world + /// + public class ScriptInfo + { + // Reference to world.eventsManager provided for convenience + public EventManager events; + + // The main world + public Scene world; + + // The console + public LogBase logger; + + public ScriptInfo(Scene scene) + { + world = scene; + events = world.eventManager; + logger = OpenSim.Framework.Console.MainLog.Instance; + } + } +} diff --git a/OpenSim/Region/Simulation/Caps.cs b/OpenSim/Region/Simulation/Caps.cs new file mode 100644 index 0000000..13a351d --- /dev/null +++ b/OpenSim/Region/Simulation/Caps.cs @@ -0,0 +1,258 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using OpenSim.Servers; +using OpenSim.Framework; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Types; +using OpenSim.Caches; +using libsecondlife; + +namespace OpenSim.Region +{ + public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); + + public class Caps + { + private string httpListenerAddress; + private uint httpListenPort; + private string capsObjectPath = "00001-"; + private string requestPath = "0000/"; + private string mapLayerPath = "0001/"; + private string newInventory = "0002/"; + private string requestTexture = "0003/"; + private string eventQueue = "0100/"; + private BaseHttpServer httpListener; + private LLUUID agentID; + private AssetCache assetCache; + private int eventQueueCount = 1; + private Queue CapsEventQueue = new Queue(); + + public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) + { + assetCache = assetCach; + capsObjectPath = capsPath; + httpListener = httpServer; + httpListenerAddress = httpListen; + httpListenPort = httpPort; + agentID = agent; + } + + /// + /// + /// + public void RegisterHandlers() + { + Console.WriteLine("registering CAPS handlers"); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); + } + + /// + /// + /// + /// + /// + /// + /// + public string CapsRequest(string request, string path, string param) + { + // Console.WriteLine("Caps Request " + request); + string result = ""; + result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); + return result; + } + + /// + /// + /// + /// + protected LLSDCapsDetails GetCapabilities() + { + /* string capURLS = ""; + capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; + capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; + //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; + //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; + return capURLS;*/ + + LLSDCapsDetails caps = new LLSDCapsDetails(); + caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; + caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; + return caps; + } + + /// + /// + /// + /// + /// + /// + /// + public string MapLayer(string request, string path, string param) + { + Encoding _enc = System.Text.Encoding.UTF8; + Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); + LLSDMapRequest mapReq = new LLSDMapRequest(); + LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); + + LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); + + //Console.WriteLine(" Maplayer response is " + res); + + return res; + } + + /// + /// + /// + /// + protected LLSDMapLayer BuildLLSDMapLayerResponse() + { + LLSDMapLayer mapLayer = new LLSDMapLayer(); + mapLayer.Right = 5000; + mapLayer.Top = 5000; + mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); + + return mapLayer; + } + + public string ProcessEventQueue(string request, string path, string param) + { + // Console.WriteLine("event queue request " + request); + string res = ""; + int timer = 0; + + /*while ((timer < 200) || (this.CapsEventQueue.Count < 1)) + { + timer++; + }*/ + if (this.CapsEventQueue.Count > 0) + { + lock (this.CapsEventQueue) + { + string item = CapsEventQueue.Dequeue(); + res = item; + } + } + else + { + res = this.CreateEmptyEventResponse(); + } + return res; + } + + public string CreateEstablishAgentComms(string caps, string ipAddressPort) + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += "messageEstablishAgentCommunication"; + res += "body"; + res += "sim-ip-and-port" + ipAddressPort + ""; + res += "seed-capability" + caps + ""; + res += "agent-id" + this.agentID.ToStringHyphenated() + ""; + res += ""; + res += ""; + res += ""; + eventQueueCount++; + this.CapsEventQueue.Enqueue(res); + return res; + } + + public string CreateEmptyEventResponse() + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + + public string NewAgentInventory(string request, string path, string param) + { + //Console.WriteLine("received upload request:"+ request); + string res = ""; + LLUUID newAsset = LLUUID.Random(); + LLUUID newInvItem = LLUUID.Random(); + string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); + AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); + httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); + string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; + //Console.WriteLine("uploader url is " + uploaderURL); + res += ""; + res += "uploader" + uploaderURL + ""; + //res += "successtrue"; + res += "stateupload"; + res += ""; + uploader.OnUpLoad += this.UploadHandler; + return res; + } + + public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) + { + // Console.WriteLine("upload handler called"); + AssetBase asset; + asset = new AssetBase(); + asset.FullID = assetID; + asset.Type = 0; + asset.InvType = 0; + asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = data; + this.assetCache.AddAsset(asset); + } + + public class AssetUploader + { + public event UpLoadedTexture OnUpLoad; + + private string uploaderPath = ""; + private LLUUID newAssetID; + private LLUUID inventoryItemID; + private BaseHttpServer httpListener; + public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) + { + newAssetID = assetID; + inventoryItemID = inventoryItem; + uploaderPath = path; + httpListener = httpServer; + + } + + public string uploaderCaps(string request, string path, string param) + { + Encoding _enc = System.Text.Encoding.UTF8; + byte[] data = _enc.GetBytes(request); + //Console.WriteLine("recieved upload " + Util.FieldToString(data)); + LLUUID inv = this.inventoryItemID; + string res = ""; + res += ""; + res += "new_asset" + newAssetID.ToStringHyphenated() + ""; + res += "new_inventory_item" + inv.ToStringHyphenated() + ""; + res += "statecomplete"; + res += ""; + + // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); + httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); + if (OnUpLoad != null) + { + OnUpLoad(newAssetID, inv, data); + } + + /*FileStream fs = File.Create("upload.jp2"); + BinaryWriter bw = new BinaryWriter(fs); + bw.Write(data); + bw.Close(); + fs.Close();*/ + return res; + } + } + } +} diff --git a/OpenSim/Region/Simulation/EstateManager.cs b/OpenSim/Region/Simulation/EstateManager.cs new file mode 100644 index 0000000..dcb5564 --- /dev/null +++ b/OpenSim/Region/Simulation/EstateManager.cs @@ -0,0 +1,301 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Interfaces; +using OpenSim.Region; +using OpenSim.Region.Scenes; +using OpenSim; +using libsecondlife; +using libsecondlife.Packets; +using Avatar = OpenSim.Region.Scenes.ScenePresence; + + +namespace OpenSim.Region +{ + + /// + /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings + /// + public class EstateManager + { + private Scene m_world; + private RegionInfo m_regInfo; + + public EstateManager(Scene world,RegionInfo reginfo) + { + m_world = world; //Estate settings found at world.m_regInfo.estateSettings + m_regInfo = reginfo; + } + + private bool convertParamStringToBool(byte[] field) + { + string s = Helpers.FieldToUTF8String(field); + if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") + { + return true; + } + return false; + } + + public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) + { + if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID) + { + switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) + { + case "getinfo": + Console.WriteLine("GETINFO Requested"); + this.sendRegionInfoPacketToAll(); + + break; + case "setregioninfo": + if (packet.ParamList.Length != 9) + { + OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); + } + else + { + m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None; + + if (convertParamStringToBool(packet.ParamList[0].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform; + } + + if (convertParamStringToBool(packet.ParamList[1].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly; + } + + if (convertParamStringToBool(packet.ParamList[2].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage; + } + + if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell; + } + + + int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); + m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; + + float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); + m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; + + int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); + m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel; + + + if (convertParamStringToBool(packet.ParamList[7].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject; + } + + if (convertParamStringToBool(packet.ParamList[8].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges; + } + + sendRegionInfoPacketToAll(); + + } + break; + case "texturebase": + foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + { + string s = Helpers.FieldToUTF8String(block.Parameter); + string[] splitField = s.Split(' '); + if (splitField.Length == 2) + { + LLUUID tempUUID = new LLUUID(splitField[1]); + switch (Convert.ToInt16(splitField[0])) + { + case 0: + m_regInfo.estateSettings.terrainBase0 = tempUUID; + break; + case 1: + m_regInfo.estateSettings.terrainBase1 = tempUUID; + break; + case 2: + m_regInfo.estateSettings.terrainBase2 = tempUUID; + break; + case 3: + m_regInfo.estateSettings.terrainBase3 = tempUUID; + break; + } + } + } + break; + case "texturedetail": + foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + { + + string s = Helpers.FieldToUTF8String(block.Parameter); + string[] splitField = s.Split(' '); + if (splitField.Length == 2) + { + LLUUID tempUUID = new LLUUID(splitField[1]); + switch (Convert.ToInt16(splitField[0])) + { + case 0: + m_regInfo.estateSettings.terrainDetail0 = tempUUID; + break; + case 1: + m_regInfo.estateSettings.terrainDetail1 = tempUUID; + break; + case 2: + m_regInfo.estateSettings.terrainDetail2 = tempUUID; + break; + case 3: + m_regInfo.estateSettings.terrainDetail3 = tempUUID; + break; + } + } + } + break; + case "textureheights": + foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + { + + string s = Helpers.FieldToUTF8String(block.Parameter); + string[] splitField = s.Split(' '); + if (splitField.Length == 3) + { + + float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); + float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); + + switch (Convert.ToInt16(splitField[0])) + { + case 0: + m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; + break; + case 1: + m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; + break; + case 2: + m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; + break; + case 3: + m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; + break; + } + } + } + break; + case "texturecommit": + sendRegionHandshakeToAll(); + break; + case "setregionterrain": + if (packet.ParamList.Length != 9) + { + OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); + } + else + { + m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); + m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); + m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); + m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); + m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); + + sendRegionInfoPacketToAll(); + } + break; + default: + OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); + break; + } + } + } + + public void sendRegionInfoPacketToAll() + { + List avatars = m_world.RequestAvatarList(); + + for (int i = 0; i < avatars.Count; i++) + { + this.sendRegionInfoPacket(avatars[i].ControllingClient); + } + } + + public void sendRegionHandshakeToAll() + { + List avatars = m_world.RequestAvatarList(); + + for (int i = 0; i < avatars.Count; i++) + { + this.sendRegionHandshake(avatars[i].ControllingClient); + } + } + + public void sendRegionInfoPacket(IClientAPI remote_client) + { + Encoding _enc = System.Text.Encoding.ASCII; + + AgentCircuitData circuitData = remote_client.RequestClientInfo(); + + RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); + regionInfoPacket.AgentData.AgentID = circuitData.AgentID; + regionInfoPacket.AgentData.SessionID = circuitData.SessionID; + regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor; + regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID; + regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents; + regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor; + regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID; + regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; + regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; + regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; + regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; + regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; + regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName); + regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; + regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; + regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; + regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun; + regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight; + + remote_client.OutPacket(regionInfoPacket); + } + + public void sendRegionHandshake(IClientAPI remoteClient) + { + remoteClient.SendRegionHandshake(m_regInfo); + } + + } +} diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj b/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj new file mode 100644 index 0000000..7811a55 --- /dev/null +++ b/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj @@ -0,0 +1,211 @@ + + + Local + 8.0.50727 + 2.0 + {C0DAB338-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Simulation + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Simulation + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.GenericConfig.Xml + {C74E4A30-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Terrain.BasicTerrain + {C9E0F891-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user b/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Simulation/ParcelManager.cs b/OpenSim/Region/Simulation/ParcelManager.cs new file mode 100644 index 0000000..d15d77d --- /dev/null +++ b/OpenSim/Region/Simulation/ParcelManager.cs @@ -0,0 +1,892 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Region.Scenes; +using Avatar = OpenSim.Region.Scenes.ScenePresence; + +namespace OpenSim.Region +{ + + + #region ParcelManager Class + /// + /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) + /// + public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver + { + + #region Constants + //Parcel types set with flags in ParcelOverlay. + //Only one of these can be used. + public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 + public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 + public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 + public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 + public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 + public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 + + + //Flags that when set, a border on the given side will be placed + //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) + //This took forever to figure out -- jeesh. /blame LL for even having to send these + public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 + public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 + + //RequestResults (I think these are right, they seem to work): + public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel + public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel + + //These are other constants. Yay! + public const int START_PARCEL_LOCAL_ID = 1; + #endregion + + #region Member Variables + public Dictionary parcelList = new Dictionary(); + private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; + private int[,] parcelIDList = new int[64, 64]; + + private Scene m_world; + private RegionInfo m_regInfo; + + #endregion + + #region Constructors + public ParcelManager(Scene world, RegionInfo reginfo) + { + + m_world = world; + m_regInfo = reginfo; + parcelIDList.Initialize(); + + } + #endregion + + #region Member Functions + + #region Parcel From Storage Functions + public void ParcelFromStorage(ParcelData data) + { + Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); + new_parcel.parcelData = data.Copy(); + new_parcel.setParcelBitmapFromByteArray(); + addParcel(new_parcel); + + } + + public void NoParcelDataFromStorage() + { + resetSimParcels(); + } + #endregion + + #region Parcel Add/Remove/Get/Create + /// + /// Creates a basic Parcel object without an owner (a zeroed key) + /// + /// + public Parcel createBaseParcel() + { + return new Parcel(new LLUUID(), false, m_world); + } + + /// + /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own + /// + /// The parcel being added + public void addParcel(Parcel new_parcel) + { + lastParcelLocalID++; + new_parcel.parcelData.localID = lastParcelLocalID; + parcelList.Add(lastParcelLocalID, new_parcel.Copy()); + + + bool[,] parcelBitmap = new_parcel.getParcelBitmap(); + int x, y; + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelBitmap[x, y]) + { + parcelIDList[x, y] = lastParcelLocalID; + } + } + } + parcelList[lastParcelLocalID].forceUpdateParcelInfo(); + + + } + /// + /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList + /// + /// Parcel.localID of the parcel to remove. + public void removeParcel(int local_id) + { + int x, y; + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelIDList[x, y] == local_id) + { + throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y); + } + } + } + m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData); + parcelList.Remove(local_id); + } + + private void performFinalParcelJoin(Parcel master, Parcel slave) + { + int x, y; + bool[,] parcelBitmapSlave = slave.getParcelBitmap(); + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelBitmapSlave[x, y]) + { + parcelIDList[x, y] = master.parcelData.localID; + } + } + } + removeParcel(slave.parcelData.localID); + } + /// + /// Get the parcel at the specified point + /// + /// Value between 0 - 256 on the x axis of the point + /// Value between 0 - 256 on the y axis of the point + /// Parcel at the point supplied + public Parcel getParcel(int x, int y) + { + if (x > 256 || y > 256 || x < 0 || y < 0) + { + throw new Exception("Error: Parcel not found at point " + x + ", " + y); + } + else + { + return parcelList[parcelIDList[x / 4, y / 4]]; + } + + } + #endregion + + #region Parcel Modification + /// + /// Subdivides a parcel + /// + /// West Point + /// South Point + /// East Point + /// North Point + /// LLUUID of user who is trying to subdivide + /// Returns true if successful + private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) + { + //First, lets loop through the points and make sure they are all in the same parcel + //Get the parcel at start + Parcel startParcel = getParcel(start_x, start_y); + if (startParcel == null) return false; //No such parcel at the beginning + + //Loop through the points + try + { + int totalX = end_x - start_x; + int totalY = end_y - start_y; + int x, y; + for (y = 0; y < totalY; y++) + { + for (x = 0; x < totalX; x++) + { + Parcel tempParcel = getParcel(start_x + x, start_y + y); + if (tempParcel == null) return false; //No such parcel at that point + if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no + } + } + } + catch (Exception) + { + return false; //Exception. For now, lets skip subdivision + } + + //If we are still here, then they are subdividing within one parcel + //Check owner + if (startParcel.parcelData.ownerID != attempting_user_id) + { + return false; //They cant do this! + } + + //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) + Parcel newParcel = startParcel.Copy(); + newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; + newParcel.parcelData.globalID = LLUUID.Random(); + + newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); + + //Now, lets set the subdivision area of the original to false + int startParcelIndex = startParcel.parcelData.localID; + parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); + parcelList[startParcelIndex].forceUpdateParcelInfo(); + + + //Now add the new parcel + addParcel(newParcel); + + + + + + return true; + } + /// + /// Join 2 parcels together + /// + /// x value in first parcel + /// y value in first parcel + /// x value in second parcel + /// y value in second parcel + /// LLUUID of the avatar trying to join the parcels + /// Returns true if successful + private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) + { + end_x -= 4; + end_y -= 4; + + //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! + //This should be fixed later -- somewhat "incomplete code" --Ming + Parcel startParcel, endParcel; + + try + { + startParcel = getParcel(start_x, start_y); + endParcel = getParcel(end_x, end_y); + } + catch (Exception) + { + return false; //Error occured when trying to get the start and end parcels + } + if (startParcel == endParcel) + { + return false; //Subdivision of the same parcel is not allowed + } + + //Check the parcel owners: + if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) + { + return false; + } + if (startParcel.parcelData.ownerID != attempting_user_id) + { + //TODO: Group editing stuff. Avatar owner support for now + return false; + } + + //Same owners! Lets join them + //Merge them to startParcel + parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); + performFinalParcelJoin(startParcel, endParcel); + + return true; + + + + } + #endregion + + #region Parcel Updating + /// + /// Where we send the ParcelOverlay packet to the client + /// + /// The object representing the client + public void sendParcelOverlay(IClientAPI remote_client) + { + const int PARCEL_BLOCKS_PER_PACKET = 1024; + int x, y = 0; + byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; + int byteArrayCount = 0; + int sequenceID = 0; + ParcelOverlayPacket packet; + + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + byte tempByte = (byte)0; //This represents the byte for the current 4x4 + Parcel currentParcelBlock = getParcel(x * 4, y * 4); + + if (currentParcelBlock.parcelData.ownerID == remote_client.AgentId) + { + //Owner Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER); + } + else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentId)) + { + //Sale Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE); + } + else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero) + { + //Public Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC); + } + else + { + //Other Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER); + } + + + //Now for border control + if (x == 0) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); + } + else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); + } + + if (y == 0) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); + } + else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); + } + + byteArray[byteArrayCount] = tempByte; + byteArrayCount++; + if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET) + { + byteArrayCount = 0; + packet = new ParcelOverlayPacket(); + packet.ParcelData.Data = byteArray; + packet.ParcelData.SequenceID = sequenceID; + remote_client.OutPacket((Packet)packet); + sequenceID++; + byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; + } + } + } + + packet = new ParcelOverlayPacket(); + packet.ParcelData.Data = byteArray; + packet.ParcelData.SequenceID = sequenceID; //Eh? + remote_client.OutPacket((Packet)packet); + } + + public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) + { + //Get the parcels within the bounds + List temp = new List(); + int x, y, i; + int inc_x = end_x - start_x; + int inc_y = end_y - start_y; + for (x = 0; x < inc_x; x++) + { + for (y = 0; y < inc_y; y++) + { + OpenSim.Region.Parcel currentParcel = getParcel(start_x + x, start_y + y); + if (!temp.Contains(currentParcel)) + { + currentParcel.forceUpdateParcelInfo(); + temp.Add(currentParcel); + } + } + } + + int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL; + if (temp.Count > 1) + { + requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; + } + + for (i = 0; i < temp.Count; i++) + { + temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); + } + + + sendParcelOverlay(remote_client); + } + + public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) + { + if (parcelList.ContainsKey(packet.ParcelData.LocalID)) + { + parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); + } + } + public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) + { + subdivide(west, south, east, north, remote_client.AgentId); + } + public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) + { + join(west, south, east, north, remote_client.AgentId); + + } + #endregion + + /// + /// Resets the sim to the default parcel (full sim parcel owned by the default user) + /// + public void resetSimParcels() + { + //Remove all the parcels in the sim and add a blank, full sim parcel set to public + parcelList.Clear(); + lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; + parcelIDList.Initialize(); + + Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); + + fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); + fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; + fullSimParcel.parcelData.parcelDesc = ""; + + fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID; + fullSimParcel.parcelData.salePrice = 1; + fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; + fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; + + addParcel(fullSimParcel); + + } + #endregion + } + #endregion + + + #region Parcel Class + /// + /// Keeps track of a specific parcel's information + /// + public class Parcel + { + #region Member Variables + public ParcelData parcelData = new ParcelData(); + public Scene m_world; + + private bool[,] parcelBitmap = new bool[64, 64]; + + #endregion + + + #region Constructors + public Parcel(LLUUID owner_id, bool is_group_owned, Scene world) + { + m_world = world; + parcelData.ownerID = owner_id; + parcelData.isGroupOwned = is_group_owned; + + } + #endregion + + + #region Member Functions + + #region General Functions + /// + /// Checks to see if this parcel contains a point + /// + /// + /// + /// Returns true if the parcel contains the specified point + public bool containsPoint(int x, int y) + { + if (x >= 0 && y >= 0 && x <= 256 && x <= 256) + { + return (parcelBitmap[x / 4, y / 4] == true); + } + else + { + return false; + } + } + + public Parcel Copy() + { + Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); + + //Place all new variables here! + newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); + newParcel.parcelData = parcelData.Copy(); + + return newParcel; + } + + #endregion + + + #region Packet Request Handling + /// + /// Sends parcel properties as requested + /// + /// ID sent by client for them to keep track of + /// Bool sent by client for them to use + /// Object representing the client + public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) + { + + ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); + updatePacket.ParcelData.AABBMax = parcelData.AABBMax; + updatePacket.ParcelData.AABBMin = parcelData.AABBMin; + updatePacket.ParcelData.Area = parcelData.area; + updatePacket.ParcelData.AuctionID = parcelData.auctionID; + updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented + + updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; + + updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); + updatePacket.ParcelData.Category = (byte)parcelData.category; + updatePacket.ParcelData.ClaimDate = parcelData.claimDate; + updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; + updatePacket.ParcelData.GroupID = parcelData.groupID; + updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; + updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; + updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; + updatePacket.ParcelData.LocalID = parcelData.localID; + updatePacket.ParcelData.MaxPrims = 1000; //unemplemented + updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; + updatePacket.ParcelData.MediaID = parcelData.mediaID; + updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); + updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL); + updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); + updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented + updatePacket.ParcelData.OtherCount = 0; //unemplemented + updatePacket.ParcelData.OtherPrims = 0; //unemplented + updatePacket.ParcelData.OwnerID = parcelData.ownerID; + updatePacket.ParcelData.OwnerPrims = 0; //unemplemented + updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented + updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented + updatePacket.ParcelData.PassHours = parcelData.passHours; + updatePacket.ParcelData.PassPrice = parcelData.passPrice; + updatePacket.ParcelData.PublicCount = 0; //unemplemented + updatePacket.ParcelData.RegionDenyAnonymous = false; //unemplemented + updatePacket.ParcelData.RegionDenyIdentified = false; //unemplemented + updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented + updatePacket.ParcelData.RegionPushOverride = true; //unemplemented + updatePacket.ParcelData.RentPrice = 0; //?? + updatePacket.ParcelData.RequestResult = request_result; + updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented + updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented + updatePacket.ParcelData.SelfCount = 0;//unemplemented + updatePacket.ParcelData.SequenceID = sequence_id; + updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented + updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented + updatePacket.ParcelData.SnapSelection = snap_selection; + updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; + updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; + updatePacket.ParcelData.TotalPrims = 0; //unemplemented + updatePacket.ParcelData.UserLocation = parcelData.userLocation; + updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; + remote_client.OutPacket((Packet)updatePacket); + } + + public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) + { + if (remote_client.AgentId == parcelData.ownerID) + { + //Needs later group support + parcelData.authBuyerID = packet.ParcelData.AuthBuyerID; + parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; + parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); + parcelData.groupID = packet.ParcelData.GroupID; + parcelData.landingType = packet.ParcelData.LandingType; + parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale; + parcelData.mediaID = packet.ParcelData.MediaID; + parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); + parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); + parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name); + parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags; + parcelData.passHours = packet.ParcelData.PassHours; + parcelData.passPrice = packet.ParcelData.PassPrice; + parcelData.salePrice = packet.ParcelData.SalePrice; + parcelData.snapshotID = packet.ParcelData.SnapshotID; + parcelData.userLocation = packet.ParcelData.UserLocation; + parcelData.userLookAt = packet.ParcelData.UserLookAt; + + List avatars = m_world.RequestAvatarList(); + + for (int i = 0; i < avatars.Count; i++) + { + Parcel over = m_world.parcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y)); + if (over == this) + { + sendParcelProperties(0, false, 0, avatars[i].ControllingClient); + } + } + + } + } + #endregion + + + #region Update Functions + /// + /// Updates the AABBMin and AABBMax values after area/shape modification of parcel + /// + private void updateAABBAndAreaValues() + { + int min_x = 64; + int min_y = 64; + int max_x = 0; + int max_y = 0; + int tempArea = 0; + int x, y; + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelBitmap[x, y] == true) + { + if (min_x > x) min_x = x; + if (min_y > y) min_y = y; + if (max_x < x) max_x = x; + if (max_y < y) max_y = y; + tempArea += 16; //16sqm parcel + } + } + } + parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); + parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); + parcelData.area = tempArea; + } + + public void updateParcelBitmapByteArray() + { + parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); + } + + /// + /// Update all settings in parcel such as area, bitmap byte array, etc + /// + public void forceUpdateParcelInfo() + { + this.updateAABBAndAreaValues(); + this.updateParcelBitmapByteArray(); + } + + public void setParcelBitmapFromByteArray() + { + parcelBitmap = convertBytesToParcelBitmap(); + } + #endregion + + + #region Parcel Bitmap Functions + /// + /// Sets the parcel's bitmap manually + /// + /// 64x64 block representing where this parcel is on a map + public void setParcelBitmap(bool[,] bitmap) + { + if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap"); + } + else + { + //Valid: Lets set it + parcelBitmap = bitmap; + forceUpdateParcelInfo(); + + } + } + /// + /// Gets the parcels bitmap manually + /// + /// + public bool[,] getParcelBitmap() + { + return parcelBitmap; + } + /// + /// Converts the parcel bitmap to a packet friendly byte array + /// + /// + private byte[] convertParcelBitmapToBytes() + { + byte[] tempConvertArr = new byte[512]; + byte tempByte = 0; + int x, y, i, byteNum = 0; + i = 0; + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8)); + if (i % 8 == 0) + { + tempConvertArr[byteNum] = tempByte; + tempByte = (byte)0; + i = 0; + byteNum++; + } + } + } + return tempConvertArr; + } + + private bool[,] convertBytesToParcelBitmap() + { + bool[,] tempConvertMap = new bool[64, 64]; + tempConvertMap.Initialize(); + byte tempByte = 0; + int x = 0, y = 0, i = 0, bitNum = 0; + for (i = 0; i < 512; i++) + { + tempByte = parcelData.parcelBitmapByteArray[i]; + for (bitNum = 0; bitNum < 8; bitNum++) + { + bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); + tempConvertMap[x, y] = bit; + x++; + if (x > 63) + { + x = 0; + y++; + } + + } + + } + return tempConvertMap; + } + /// + /// Full sim parcel creation + /// + /// + public static bool[,] basicFullRegionParcelBitmap() + { + return getSquareParcelBitmap(0, 0, 256, 256); + } + + /// + /// Used to modify the bitmap between the x and y points. Points use 64 scale + /// + /// + /// + /// + /// + /// + public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y) + { + + bool[,] tempBitmap = new bool[64, 64]; + tempBitmap.Initialize(); + + tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); + return tempBitmap; + } + + /// + /// Change a parcel's bitmap at within a square and set those points to a specific value + /// + /// + /// + /// + /// + /// + /// + /// + public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) + { + if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()"); + } + + int x, y; + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + if (x >= start_x / 4 && x < end_x / 4 + && y >= start_y / 4 && y < end_y / 4) + { + parcel_bitmap[x, y] = set_value; + } + } + } + return parcel_bitmap; + } + /// + /// Join the true values of 2 bitmaps together + /// + /// + /// + /// + public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) + { + if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps"); + } + if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); + + } + + int x, y; + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + if (bitmap_add[x, y]) + { + bitmap_base[x, y] = true; + } + } + } + return bitmap_base; + } + #endregion + + #endregion + + + } + #endregion + + +} diff --git a/OpenSim/Region/Simulation/RegionManager.cs b/OpenSim/Region/Simulation/RegionManager.cs new file mode 100644 index 0000000..a317f0f --- /dev/null +++ b/OpenSim/Region/Simulation/RegionManager.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Communications; +using OpenSim.Framework; +using OpenSim.Framework.Types; +using OpenSim.Servers; + +namespace OpenSim.Region +{ + public class RegionManager //needs renaming , but first we need to rename the namespace + { + protected AuthenticateSessionsBase authenticateHandler; + protected RegionCommsListener regionCommsHost; + protected CommunicationsManager commsManager; + protected List capsHandlers = new List(); + protected BaseHttpServer httpListener; + + protected Scenes.Scene m_Scene; + + public ParcelManager parcelManager; + public EstateManager estateManager; + + public RegionManager() + { + + } + + } +} diff --git a/OpenSim/Region/Simulation/Scenes/Entity.cs b/OpenSim/Region/Simulation/Scenes/Entity.cs new file mode 100644 index 0000000..f8754f5 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/Entity.cs @@ -0,0 +1,194 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using Axiom.MathLib; +using OpenSim.Physics.Manager; +using libsecondlife; +using OpenSim.Region.Scripting; + +namespace OpenSim.Region.Scenes +{ + public abstract class Entity : IScriptReadonlyEntity + { + public libsecondlife.LLUUID uuid; + public Quaternion rotation; + protected List children; + + protected PhysicsActor _physActor; + protected Scene m_world; + protected string m_name; + + /// + /// + /// + public virtual string Name + { + get { return m_name; } + } + + protected LLVector3 m_pos; + /// + /// + /// + public virtual LLVector3 Pos + { + get + { + if (this._physActor != null) + { + m_pos.X = _physActor.Position.X; + m_pos.Y = _physActor.Position.Y; + m_pos.Z = _physActor.Position.Z; + } + + return m_pos; + } + set + { + if (this._physActor != null) + { + try + { + lock (this.m_world.SyncRoot) + { + + this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + + m_pos = value; + } + } + + public LLVector3 velocity; + + /// + /// + /// + public virtual LLVector3 Velocity + { + get + { + if (this._physActor != null) + { + velocity.X = _physActor.Velocity.X; + velocity.Y = _physActor.Velocity.Y; + velocity.Z = _physActor.Velocity.Z; + } + + return velocity; + } + set + { + if (this._physActor != null) + { + try + { + lock (this.m_world.SyncRoot) + { + + this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + + velocity = value; + } + } + + protected uint m_localId; + + public uint LocalId + { + get { return m_localId; } + } + + /// + /// Creates a new Entity (should not occur on it's own) + /// + public Entity() + { + uuid = new libsecondlife.LLUUID(); + + m_pos = new LLVector3(); + velocity = new LLVector3(); + rotation = new Quaternion(); + m_name = "(basic entity)"; + children = new List(); + } + + /// + /// + /// + public virtual void updateMovement() + { + foreach (Entity child in children) + { + child.updateMovement(); + } + } + + /// + /// Performs any updates that need to be done at each frame. This function is overridable from it's children. + /// + public virtual void update() { + // Do any per-frame updates needed that are applicable to every type of entity + foreach (Entity child in children) + { + child.update(); + } + } + + /// + /// Called at a set interval to inform entities that they should back themsleves up to the DB + /// + public virtual void BackUp() + { + + } + + /// + /// Infoms the entity that the land (heightmap) has changed + /// + public virtual void LandRenegerated() + { + + } + } +} diff --git a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs new file mode 100644 index 0000000..65077e6 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Region.Scenes +{ + public interface IScenePresenceBody + { + void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); + void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); + void SendOurAppearance(IClientAPI OurClient); + void SendAppearanceToOtherAgent(ScenePresence avatarInfo); + } +} diff --git a/OpenSim/Region/Simulation/Scenes/Primitive.cs b/OpenSim/Region/Simulation/Scenes/Primitive.cs new file mode 100644 index 0000000..e04c711 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/Primitive.cs @@ -0,0 +1,582 @@ + +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; + +namespace OpenSim.Region.Scenes +{ + public class Primitive : Entity + { + internal PrimData primData; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + // private Dictionary m_clientThreads; + private ulong m_regionHandle; + private const uint FULL_MASK_PERMISSIONS = 2147483647; + private bool physicsEnabled = false; + private byte updateFlag = 0; + private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; + + private Dictionary inventoryItems; + + #region Properties + + public LLVector3 Scale + { + set + { + this.primData.Scale = value; + //this.dirtyFlag = true; + } + get + { + return this.primData.Scale; + } + } + + public PhysicsActor PhysActor + { + set + { + this._physActor = value; + } + } + + public override LLVector3 Pos + { + get + { + return base.Pos; + } + set + { + base.Pos = value; + } + } + #endregion + + /// + /// + /// + /// + /// + /// + public Primitive( ulong regionHandle, Scene world) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.CreateFromPacket(addPacket, ownerID, localID); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = new PrimData(); + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + this.primData.OwnerID = owner; + this.primData.FullID = this.uuid = fullID; + this.primData.LocalID = m_localId = localID; + } + + /// + /// Constructor to create a default cube + /// + /// + /// + /// + /// + /// + /// + public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position) + { + //m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = PrimData.DefaultCube(); + this.primData.OwnerID = owner; + this.primData.LocalID = m_localId = localID; + this.Pos = this.primData.Position = position; + + this.updateFlag = 1; + } + + /// + /// + /// + /// + public byte[] GetByteArray() + { + byte[] result = null; + List dataArrays = new List(); + dataArrays.Add(primData.ToBytes()); + foreach (Entity child in children) + { + if (child is OpenSim.Region.Scenes.Primitive) + { + dataArrays.Add(((OpenSim.Region.Scenes.Primitive)child).GetByteArray()); + } + } + byte[] primstart = Helpers.StringToField(""); + byte[] primend = Helpers.StringToField(""); + int totalLength = primstart.Length + primend.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + totalLength += dataArrays[i].Length; + } + + result = new byte[totalLength]; + int arraypos = 0; + Array.Copy(primstart, 0, result, 0, primstart.Length); + arraypos += primstart.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); + arraypos += dataArrays[i].Length; + } + Array.Copy(primend, 0, result, arraypos, primend.Length); + + return result; + } + + #region Overridden Methods + + /// + /// + /// + public override void update() + { + if (this.updateFlag == 1) // is a new prim just been created/reloaded + { + this.SendFullUpdateToAllClients(); + this.updateFlag = 0; + } + if (this.updateFlag == 2) //some change has been made so update the clients + { + this.SendTerseUpdateToALLClients(); + this.updateFlag = 0; + } + } + + /// + /// + /// + public override void BackUp() + { + + } + + #endregion + + #region Packet handlers + + /// + /// + /// + /// + public void UpdatePosition(LLVector3 pos) + { + this.Pos = new LLVector3(pos.X, pos.Y, pos.Z); + this.updateFlag = 2; + } + + /// + /// + /// + /// + public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) + { + this.primData.PathBegin = updatePacket.PathBegin; + this.primData.PathEnd = updatePacket.PathEnd; + this.primData.PathScaleX = updatePacket.PathScaleX; + this.primData.PathScaleY = updatePacket.PathScaleY; + this.primData.PathShearX = updatePacket.PathShearX; + this.primData.PathShearY = updatePacket.PathShearY; + this.primData.PathSkew = updatePacket.PathSkew; + this.primData.ProfileBegin = updatePacket.ProfileBegin; + this.primData.ProfileEnd = updatePacket.ProfileEnd; + this.primData.PathCurve = updatePacket.PathCurve; + this.primData.ProfileCurve = updatePacket.ProfileCurve; + this.primData.ProfileHollow = updatePacket.ProfileHollow; + this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset; + this.primData.PathRevolutions = updatePacket.PathRevolutions; + this.primData.PathTaperX = updatePacket.PathTaperX; + this.primData.PathTaperY = updatePacket.PathTaperY; + this.primData.PathTwist = updatePacket.PathTwist; + this.primData.PathTwistBegin = updatePacket.PathTwistBegin; + } + + /// + /// + /// + /// + public void UpdateTexture(byte[] tex) + { + this.primData.TextureEntry = tex; + } + + /// + /// + /// + /// + public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) + { + + } + + /// + /// + /// + /// + public void AssignToParent(Primitive prim) + { + + } + + #endregion + + # region Inventory Methods + /// + /// + /// + /// + /// + public bool AddToInventory(InventoryItem item) + { + return false; + } + + /// + /// + /// + /// + /// + public InventoryItem RemoveFromInventory(LLUUID itemID) + { + return null; + } + + /// + /// + /// + /// + /// + public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) + { + + } + + /// + /// + /// + /// + /// + public void RequestXferInventory(IClientAPI simClient, ulong xferID) + { + //will only currently work if the total size of the inventory data array is under about 1000 bytes + SendXferPacketPacket send = new SendXferPacketPacket(); + + send.XferID.ID = xferID; + send.XferID.Packet = 1 + 2147483648; + send.DataPacket.Data = this.ConvertInventoryToBytes(); + + simClient.OutPacket(send); + } + + /// + /// + /// + /// + public byte[] ConvertInventoryToBytes() + { + System.Text.Encoding enc = System.Text.Encoding.ASCII; + byte[] result = new byte[0]; + List inventoryData = new List(); + int totallength = 0; + foreach (InventoryItem invItem in inventoryItems.Values) + { + byte[] data = enc.GetBytes(invItem.ExportString()); + inventoryData.Add(data); + totallength += data.Length; + } + //TODO: copy arrays into the single result array + + return result; + } + + /// + /// + /// + /// + public void CreateInventoryFromBytes(byte[] data) + { + + } + + #endregion + + #region Update viewers Methods + + /// + /// + /// + /// + public void SendFullUpdateForAllChildren(IClientAPI remoteClient) + { + this.SendFullUpdateToClient(remoteClient); + for (int i = 0; i < this.children.Count; i++) + { + if (this.children[i] is Primitive) + { + ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient); + } + } + } + + /// + /// + /// + /// + public void SendFullUpdateToClient(IClientAPI remoteClient) + { + LLVector3 lPos; + if (this._physActor != null && this.physicsEnabled) + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + } + else + { + lPos = this.Pos; + } + + remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); + } + + /// + /// + /// + public void SendFullUpdateToAllClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendFullUpdateToClient(avatars[i].ControllingClient); + } + } + + /// + /// + /// + /// + public void SendTerseUpdateToClient(IClientAPI RemoteClient) + { + LLVector3 lPos; + Axiom.MathLib.Quaternion lRot; + if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + lRot = this._physActor.Orientation; + } + else + { + lPos = this.Pos; + lRot = this.rotation; + } + LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); + RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); + } + + /// + /// + /// + public void SendTerseUpdateToALLClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendTerseUpdateToClient(avatars[i].ControllingClient); + } + } + + #endregion + + #region Create Methods + + /// + /// + /// + /// + /// + /// + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + PrimData PData = new PrimData(); + this.primData = PData; + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + + PData.OwnerID = ownerID; + PData.PCode = addPacket.ObjectData.PCode; + PData.PathBegin = addPacket.ObjectData.PathBegin; + PData.PathEnd = addPacket.ObjectData.PathEnd; + PData.PathScaleX = addPacket.ObjectData.PathScaleX; + PData.PathScaleY = addPacket.ObjectData.PathScaleY; + PData.PathShearX = addPacket.ObjectData.PathShearX; + PData.PathShearY = addPacket.ObjectData.PathShearY; + PData.PathSkew = addPacket.ObjectData.PathSkew; + PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; + PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; + PData.Scale = addPacket.ObjectData.Scale; + PData.PathCurve = addPacket.ObjectData.PathCurve; + PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; + PData.ParentID = 0; + PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; + PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; + PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; + PData.PathTaperX = addPacket.ObjectData.PathTaperX; + PData.PathTaperY = addPacket.ObjectData.PathTaperY; + PData.PathTwist = addPacket.ObjectData.PathTwist; + PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; + LLVector3 pos1 = addPacket.ObjectData.RayEnd; + this.primData.FullID = this.uuid = LLUUID.Random(); + this.primData.LocalID = m_localId = (uint)(localID); + this.primData.Position = this.Pos = pos1; + + this.updateFlag = 1; + } + + /// + /// + /// + /// + public void CreateFromBytes(byte[] data) + { + + } + + /// + /// + /// + /// + public void CreateFromPrimData(PrimData primData) + { + this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); + } + + /// + /// + /// + /// + /// + /// + /// + public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) + { + + } + + public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) + { + // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z); + this.Pos = pos; + this.SendTerseUpdateToALLClients(); + } + + public void GetProperites(IClientAPI client) + { + //needs changing + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; + proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); + proper.ObjectData[0].ItemID = LLUUID.Zero; + proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate; + proper.ObjectData[0].CreatorID = primData.OwnerID; + proper.ObjectData[0].FolderID = LLUUID.Zero; + proper.ObjectData[0].FromTaskID = LLUUID.Zero; + proper.ObjectData[0].GroupID = LLUUID.Zero; + proper.ObjectData[0].InventorySerial = 0; + proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].ObjectID = this.uuid; + proper.ObjectData[0].OwnerID = primData.OwnerID; + proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TextureID = new byte[0]; + proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].Name = new byte[0]; + proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].OwnerMask = primData.OwnerMask; + proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask; + proper.ObjectData[0].GroupMask = primData.GroupMask; + proper.ObjectData[0].EveryoneMask = primData.EveryoneMask; + proper.ObjectData[0].BaseMask = primData.BaseMask; + + client.OutPacket(proper); + + } + + #endregion + + } +} diff --git a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs new file mode 100644 index 0000000..d1a2717 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs @@ -0,0 +1,305 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; + +namespace OpenSim.Region.Scenes +{ + public partial class Scene + { + /// + /// Modifies terrain using the specified information + /// + /// The height at which the user started modifying the terrain + /// The number of seconds the modify button was pressed + /// The size of the brush used + /// The action to be performed + /// Distance from the north border where the cursor is located + /// Distance from the west border where the cursor is located + public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west) + { + // Shiny. + double size = (double)(1 << brushsize); + + switch (action) + { + case 0: + // flatten terrain + Terrain.flatten(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 1: + // raise terrain + Terrain.raise(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 2: + //lower terrain + Terrain.lower(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 3: + // smooth terrain + Terrain.smooth(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 4: + // noise + Terrain.noise(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 5: + // revert + Terrain.revert(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + + // CLIENT EXTENSIONS GO HERE + case 128: + // erode-thermal + break; + case 129: + // erode-aerobic + break; + case 130: + // erode-hydraulic + break; + } + return; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + Console.WriteLine("Chat message"); + ScenePresence avatar = null; + foreach (IClientAPI client in m_clientThreads.Values) + { + int dis = -1000; + if (this.Avatars.ContainsKey(client.AgentId)) + { + + avatar = this.Avatars[client.AgentId]; + // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + dis= (int)avatar.Pos.GetDistanceTo(fromPos); + Console.WriteLine("found avatar at " +dis); + + } + + switch (type) + { + case 0: // Whisper + if ((dis < 10) && (dis > -10)) + { + //should change so the message is sent through the avatar rather than direct to the ClientView + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + } + break; + case 1: // Say + if ((dis < 30) && (dis > -30)) + { + Console.WriteLine("sending chat"); + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + } + break; + case 2: // Shout + if ((dis < 100) && (dis > -100)) + { + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + } + break; + + case 0xff: // Broadcast + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + break; + } + + } + } + + /// + /// + /// + /// + /// + public void RezObject(AssetBase primAsset, LLVector3 pos) + { + + } + + /// + /// + /// + /// + /// + public void DeRezObject(Packet packet, IClientAPI simClient) + { + + } + + /// + /// + /// + /// + public void SendAvatarsToClient(IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + public void LinkObjects(uint parentPrim, List childPrims) + { + + + } + + /// + /// + /// + /// + /// + public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) + { + + } + + /// + /// + /// + /// + /// + public void SelectPrim(uint primLocalID, IClientAPI remoteClient) + { + foreach (Entity ent in Entities.Values) + { + if (ent.LocalId == primLocalID) + { + ((OpenSim.Region.Scenes.Primitive)ent).GetProperites(remoteClient); + break; + } + } + } + + public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) + { + if (this.Entities.ContainsKey(objectID)) + { + ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); + } + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) + { + foreach (Entity ent in Entities.Values) + { + if (ent.LocalId == localID) + { + ((OpenSim.Region.Scenes.Primitive)ent).UpdatePosition(pos); + break; + } + } + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) + { + } + + /// + /// Sends prims to a client + /// + /// Client to send to + public void GetInitialPrims(IClientAPI RemoteClient) + { + + } + } +} diff --git a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs b/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs new file mode 100644 index 0000000..7b53388 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs @@ -0,0 +1,184 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Reflection; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using libsecondlife; + +namespace OpenSim.Region.Scenes +{ + public partial class Scene + { + private Dictionary scriptEngines = new Dictionary(); + + /// + /// + /// + private void LoadScriptEngines() + { + this.LoadScriptPlugins(); + } + + /// + /// + /// + public void LoadScriptPlugins() + { + string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); + string[] pluginFiles = Directory.GetFiles(path, "*.dll"); + + + for (int i = 0; i < pluginFiles.Length; i++) + { + this.AddPlugin(pluginFiles[i]); + } + } + + /// + /// + /// + /// + private void AddPlugin(string FileName) + { + Assembly pluginAssembly = Assembly.LoadFrom(FileName); + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IScriptEngine", true); + + if (typeInterface != null) + { + IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Init(this); + this.scriptEngines.Add(plug.GetName(), plug); + + } + + typeInterface = null; + } + } + } + + pluginAssembly = null; + } + + /// + /// + /// + /// + /// + /// + /// + public void LoadScript(string scriptType, string scriptName, string script, Entity ent) + { + if(this.scriptEngines.ContainsKey(scriptType)) + { + this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.LocalId); + } + } + + #region IScriptAPI Methods + + /// + /// + /// + /// + /// + public LLVector3 GetEntityPosition(uint localID) + { + LLVector3 res = new LLVector3(); + // Console.WriteLine("script- getting entity " + localID + " position"); + foreach (Entity entity in this.Entities.Values) + { + if (entity.LocalId == localID) + { + res.X = entity.Pos.X; + res.Y = entity.Pos.Y; + res.Z = entity.Pos.Z; + } + } + return res; + } + + /// + /// + /// + /// + /// + /// + /// + public void SetEntityPosition(uint localID, float x , float y, float z) + { + foreach (Entity entity in this.Entities.Values) + { + if (entity.LocalId == localID && entity is Primitive) + { + LLVector3 pos = entity.Pos; + pos.X = x; + pos.Y = y; + Primitive prim = entity as Primitive; + // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. + //prim.UpdatePosition(pos); + // Console.WriteLine("script- setting entity " + localID + " positon"); + } + } + + } + + /// + /// + /// + /// + public uint GetRandomAvatarID() + { + //Console.WriteLine("script- getting random avatar id"); + uint res = 0; + foreach (Entity entity in this.Entities.Values) + { + if (entity is ScenePresence) + { + res = entity.LocalId; + } + } + return res; + } + + #endregion + + + } +} diff --git a/OpenSim/Region/Simulation/Scenes/Scene.cs b/OpenSim/Region/Simulation/Scenes/Scene.cs new file mode 100644 index 0000000..bf2244e --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/Scene.cs @@ -0,0 +1,795 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections.Generic; +using System.Text; +using System.Reflection; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework; +using OpenSim.Region.Scripting; +using OpenSim.Terrain; +using OpenGrid.Framework.Communications; +using OpenSim.Caches; +using OpenSim.Region; +using OpenSim.Servers; + +namespace OpenSim.Region.Scenes +{ + public delegate bool FilterAvatarList(ScenePresence avatar); + + public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI + { + protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); + protected Dictionary Avatars; + protected Dictionary Prims; + private PhysicsScene phyScene; + private float timeStep = 0.1f; + private Random Rand = new Random(); + private uint _primCount = 702000; + private int storageCount; + private Dictionary m_scriptHandlers; + private Dictionary m_scripts; + private Mutex updateLock; + + protected AuthenticateSessionsBase authenticateHandler; + protected RegionCommsListener regionCommsHost; + protected CommunicationsManager commsManager; + + protected Dictionary capsHandlers = new Dictionary(); + protected BaseHttpServer httpListener; + + public ParcelManager parcelManager; + public EstateManager estateManager; + public EventManager eventManager; + + #region Properties + /// + /// + /// + public PhysicsScene PhysScene + { + set + { + this.phyScene = value; + } + get + { + return (this.phyScene); + } + } + + #endregion + + #region Constructors + /// + /// Creates a new World class, and a region to go with it. + /// + /// Dictionary to contain client threads + /// Region Handle for this region + /// Region Name for this region + public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + { + try + { + updateLock = new Mutex(false); + this.authenticateHandler = authen; + this.commsManager = commsMan; + this.assetCache = assetCach; + m_clientThreads = clientThreads; + m_regInfo = regInfo; + m_regionHandle = m_regInfo.RegionHandle; + m_regionName = m_regInfo.RegionName; + this.m_datastore = m_regInfo.DataStore; + this.RegisterRegionWithComms(); + + parcelManager = new ParcelManager(this, this.m_regInfo); + estateManager = new EstateManager(this, this.m_regInfo); + + eventManager = new EventManager(); + + m_scriptHandlers = new Dictionary(); + m_scripts = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); + Entities = new Dictionary(); + Avatars = new Dictionary(); + Prims = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); + Terrain = new TerrainEngine(); + + ScenePresence.LoadAnims(); + this.httpListener = httpServer; + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); + } + } + #endregion + + /// + /// + /// + public void StartTimer() + { + m_heartbeatTimer.Enabled = true; + m_heartbeatTimer.Interval = 100; + m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); + } + + + #region Update Methods + + + /// + /// Performs per-frame updates regularly + /// + /// + /// + void Heartbeat(object sender, System.EventArgs e) + { + this.Update(); + } + + /// + /// Performs per-frame updates on the world, this should be the central world loop + /// + public override void Update() + { + updateLock.WaitOne(); + try + { + if (this.phyScene.IsThreaded) + { + this.phyScene.GetResults(); + + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].updateMovement(); + } + + lock (this.m_syncRoot) + { + this.phyScene.Simulate(timeStep); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].update(); + } + + // New + eventManager.TriggerOnFrame(); + + // TODO: Obsolete - Phase out + foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) + { + scriptHandler.OnFrame(); + } + foreach (IScriptEngine scripteng in this.scriptEngines.Values) + { + scripteng.OnFrame(); + } + + //backup world data + this.storageCount++; + if (storageCount > 1200) //set to how often you want to backup + { + this.Backup(); + storageCount = 0; + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); + } + updateLock.ReleaseMutex(); + + } + + /// + /// + /// + /// + public bool Backup() + { + /* + try + { + // Terrain backup routines + if (Terrain.tainted > 0) + { + Terrain.tainted = 0; + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); + localStorage.SaveMap(Terrain.getHeights1D()); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); + lock (this.m_syncRoot) + { + phyScene.SetTerrain(Terrain.getHeights1D()); + } + } + + // Primitive backup routines + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].BackUp(); + } + + //Parcel backup routines + ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; + int i = 0; + foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) + { + parcels[i] = parcel.parcelData; + i++; + } + localStorage.SaveParcels(parcels); + + // Backup successful + return true; + } + catch (Exception e) + { + // Backup failed + OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); + return false; + } + */ + return true; + } + #endregion + + #region Regenerate Terrain + + /// + /// Rebuilds the terrain using a procedural algorithm + /// + public void RegenerateTerrain() + { + try + { + Terrain.hills(); + + lock (this.m_syncRoot) + { + this.phyScene.SetTerrain(Terrain.getHeights1D()); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(client); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + /// + /// Rebuilds the terrain using a 2D float array + /// + /// 256,256 float array containing heights + public void RegenerateTerrain(float[,] newMap) + { + try + { + this.Terrain.setHeights2D(newMap); + lock (this.m_syncRoot) + { + this.phyScene.SetTerrain(this.Terrain.getHeights1D()); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(client); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + /// + /// Rebuilds the terrain assuming changes occured at a specified point[?] + /// + /// ??? + /// ??? + /// ??? + public void RegenerateTerrain(bool changes, int pointx, int pointy) + { + try + { + if (changes) + { + /* Dont save here, rely on tainting system instead */ + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(pointx, pointy, client); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + #endregion + + #region Load Terrain + /// + /// Loads the World heightmap + /// + /// + public override void LoadWorldMap() + { + try + { + float[] map = this.localStorage.LoadWorld(); + if (map == null) + { + if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) + { + Console.WriteLine("No default terrain, procedurally generating..."); + this.Terrain.hills(); + + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + else + { + try + { + this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); + this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; + } + catch + { + Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); + Terrain.hills(); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + } + else + { + this.Terrain.setHeights1D(map); + } + + CreateTerrainTexture(); + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); + } + } + + /// + /// + /// + private void CreateTerrainTexture() + { + //create a texture asset of the terrain + byte[] data = this.Terrain.exportJpegImage("defaultstripe.png"); + this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); + AssetBase asset = new AssetBase(); + asset.FullID = this.m_regInfo.estateSettings.terrainImageID; + asset.Data = data; + asset.Name = "terrainImage"; + asset.Type = 0; + this.assetCache.AddAsset(asset); + } + #endregion + + #region Primitives Methods + + + /// + /// Loads the World's objects + /// + public void LoadPrimsFromStorage() + { + try + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); + this.localStorage.LoadPrimitives(this); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); + } + } + + /// + /// Loads a specific object from storage + /// + /// The object to load + public void PrimFromStorage(PrimData prim) + { + + } + + /// + /// + /// + /// + /// + public void AddNewPrim(Packet addPacket, IClientAPI agentClient) + { + AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); + } + + /// + /// + /// + /// + /// + public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) + { + try + { + Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); + + this.Entities.Add(prim.uuid, prim); + this._primCount++; + + // Trigger event for listeners + eventManager.TriggerOnNewPrimitive(prim); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); + } + } + + #endregion + + #region Add/Remove Avatar Methods + + /// + /// + /// + /// + /// + public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) + { + remoteClient.OnRegionHandShakeReply += this.SendLayerData; + //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); + remoteClient.OnChatFromViewer += this.SimChat; + remoteClient.OnRequestWearables += this.InformClientOfNeighbours; + remoteClient.OnAddPrim += this.AddNewPrim; + remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; + remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; + remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; + //remoteClient.OnObjectSelect += this.SelectPrim; + remoteClient.OnGrapUpdate += this.MoveObject; + + /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); + remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); + remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); + remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); + remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); + */ + + ScenePresence newAvatar = null; + try + { + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); + + //newAvatar.SendRegionHandshake(); + this.estateManager.sendRegionHandshake(remoteClient); + + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + lock (this.m_syncRoot) + { + newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + } + + lock (Entities) + { + if (!Entities.ContainsKey(agentID)) + { + this.Entities.Add(agentID, newAvatar); + } + else + { + Entities[agentID] = newAvatar; + } + } + lock (Avatars) + { + if (Avatars.ContainsKey(agentID)) + { + Avatars[agentID] = newAvatar; + } + else + { + this.Avatars.Add(agentID, newAvatar); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); + } + return; + } + + + + /// + /// + /// + /// + public override void RemoveClient(LLUUID agentID) + { + eventManager.TriggerOnRemovePresence(agentID); + + return; + } + #endregion + + #region Request Avatars List Methods + //The idea is to have a group of method that return a list of avatars meeting some requirement + // ie it could be all Avatars within a certain range of the calling prim/avatar. + + /// + /// Request a List of all Avatars in this World + /// + /// + public List RequestAvatarList() + { + List result = new List(); + + foreach (ScenePresence avatar in Avatars.Values) + { + result.Add(avatar); + } + + return result; + } + + /// + /// Request a filtered list of Avatars in this World + /// + /// + public List RequestAvatarList(FilterAvatarList filter) + { + List result = new List(); + + foreach (ScenePresence avatar in Avatars.Values) + { + if (filter(avatar)) + { + result.Add(avatar); + } + } + + return result; + } + + /// + /// Request a Avatar by UUID + /// + /// + /// + public ScenePresence RequestAvatar(LLUUID avatarID) + { + if (this.Avatars.ContainsKey(avatarID)) + { + return Avatars[avatarID]; + } + return null; + } + #endregion + + + #region RegionCommsHost + + /// + /// + /// + public void RegisterRegionWithComms() + { + GridInfo gridSettings = new GridInfo(); + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); + if (this.regionCommsHost != null) + { + this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); + this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); + } + } + + /// + /// + /// + /// + /// + public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) + { + // Console.WriteLine("World.cs - add new user connection"); + //should just check that its meant for this region + if (regionHandle == this.m_regInfo.RegionHandle) + { + if (agent.CapsPath != "") + { + //Console.WriteLine("new user, so creating caps handler for it"); + Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + cap.RegisterHandlers(); + this.capsHandlers.Add(agent.AgentID, cap); + } + this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); + } + } + + public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (regionHandle == this.m_regInfo.RegionHandle) + { + if (this.Avatars.ContainsKey(agentID)) + { + this.Avatars[agentID].MakeAvatar(position); + } + } + } + + /// + /// + /// + public void InformClientOfNeighbours(IClientAPI remoteClient) + { + // Console.WriteLine("informing client of neighbouring regions"); + List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); + + //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); + if (neighbours != null) + { + for (int i = 0; i < neighbours.Count; i++) + { + // Console.WriteLine("sending neighbours data"); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); + //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); + } + } + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) + { + return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); + } + + /// + /// + /// + /// + /// + /// + /// + public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) + { + List mapBlocks; + mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); + remoteClient.SendMapBlock(mapBlocks); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) + { + if (regionHandle == this.m_regionHandle) + { + if (this.Avatars.ContainsKey(remoteClient.AgentId)) + { + remoteClient.SendTeleportLocationStart(); + remoteClient.SendLocalTeleport(position, lookAt, flags); + this.Avatars[remoteClient.AgentId].Teleport(position); + } + } + else + { + RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle); + if (reg != null) + { + remoteClient.SendTeleportLocationStart(); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); + this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.CommsIPListenAddr, (ushort)reg.CommsIPListenPort, 4, (1 << 4)); + } + //remoteClient.SendTeleportCancel(); + } + } + + /// + /// + /// + /// + /// + /// + public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) + { + return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); + } + + #endregion + } +} diff --git a/OpenSim/Region/Simulation/Scenes/SceneBase.cs b/OpenSim/Region/Simulation/Scenes/SceneBase.cs new file mode 100644 index 0000000..4dbd374 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/SceneBase.cs @@ -0,0 +1,201 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections.Generic; +using System.Text; +using System.Reflection; +using System.IO; +using System.Threading; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Region.Scripting; +using OpenSim.Terrain; +using OpenSim.Caches; + +namespace OpenSim.Region.Scenes +{ + public abstract class SceneBase : IWorld + { + public Dictionary Entities; + protected Dictionary m_clientThreads; + protected ulong m_regionHandle; + protected string m_regionName; + protected RegionInfo m_regInfo; + + public TerrainEngine Terrain; + + public string m_datastore; + public ILocalStorage localStorage; + + protected object m_syncRoot = new object(); + private uint m_nextLocalId = 8880000; + protected AssetCache assetCache; + + #region Update Methods + /// + /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) + /// + public abstract void Update(); + + #endregion + + #region Terrain Methods + + /// + /// Loads the World heightmap + /// + public abstract void LoadWorldMap(); + + /// + /// Loads a new storage subsystem from a named library + /// + /// Storage Library + /// Successful or not + public bool LoadStorageDLL(string dllName) + { + try + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + ILocalStorage store = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("ILocalStorage", true); + + if (typeInterface != null) + { + ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + store = plug; + + store.Initialise(this.m_datastore); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + this.localStorage = store; + return (store == null); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); + return false; + } + } + + + /// + /// Send the region heightmap to the client + /// + /// Client to send to + public virtual void SendLayerData(IClientAPI RemoteClient) + { + RemoteClient.SendLayerData(Terrain.getHeights1D()); + } + + /// + /// Sends a specified patch to a client + /// + /// Patch coordinate (x) 0..16 + /// Patch coordinate (y) 0..16 + /// The client to send to + public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) + { + RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); + } + + #endregion + + #region Add/Remove Agent/Avatar + /// + /// + /// + /// + /// + /// + public abstract void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child); + + /// + /// + /// + /// + public abstract void RemoveClient(LLUUID agentID); + + #endregion + + /// + /// + /// + /// + public virtual RegionInfo RegionInfo + { + get { return this.m_regInfo; } + } + + public object SyncRoot + { + get { return m_syncRoot; } + } + + public uint NextLocalId + { + get { return m_nextLocalId++; } + } + + #region Shutdown + /// + /// Tidy before shutdown + /// + public virtual void Close() + { + try + { + this.localStorage.ShutDown(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); + } + } + + #endregion + + + } +} diff --git a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs b/OpenSim/Region/Simulation/Scenes/SceneEvents.cs new file mode 100644 index 0000000..2898578 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/SceneEvents.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Scenes +{ + /// + /// A class for triggering remote scene events. + /// + public class EventManager + { + public delegate void OnFrameDelegate(); + public event OnFrameDelegate OnFrame; + + public delegate void OnNewPresenceDelegate(ScenePresence presence); + public event OnNewPresenceDelegate OnNewPresence; + + public delegate void OnNewPrimitiveDelegate(Primitive prim); + public event OnNewPrimitiveDelegate OnNewPrimitive; + + public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); + public event OnRemovePresenceDelegate OnRemovePresence; + + public void TriggerOnFrame() + { + if (OnFrame != null) + { + OnFrame(); + } + } + + public void TriggerOnNewPrimitive(Primitive prim) + { + if (OnNewPrimitive != null) + OnNewPrimitive(prim); + } + + public void TriggerOnNewPresence(ScenePresence presence) + { + if (OnNewPresence != null) + OnNewPresence(presence); + } + + public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid) + { + if (OnRemovePresence != null) + { + OnRemovePresence(uuid); + } + } + } +} diff --git a/OpenSim/Region/Simulation/Scenes/SceneObject.cs b/OpenSim/Region/Simulation/Scenes/SceneObject.cs new file mode 100644 index 0000000..5df87bf --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/SceneObject.cs @@ -0,0 +1,128 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; + +namespace OpenSim.Region.Scenes +{ + public class SceneObject : Entity + { + private LLUUID rootUUID; + //private Dictionary ChildPrimitives = new Dictionary(); + protected Primitive rootPrimitive; + private Scene m_world; + protected ulong regionHandle; + + /// + /// + /// + public SceneObject() + { + + } + + /// + /// + /// + /// + /// + /// + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) + { + this.rootPrimitive = new Primitive( this.regionHandle, this.m_world, addPacket, agentID, localID); + } + + /// + /// + /// + /// + public void CreateFromBytes(byte[] data) + { + + } + + /// + /// + /// + public override void update() + { + + } + + /// + /// + /// + public override void BackUp() + { + + } + + /// + /// + /// + /// + public void GetProperites(IClientAPI client) + { + //needs changing + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; + proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); + proper.ObjectData[0].ItemID = LLUUID.Zero; + proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate; + proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID; + proper.ObjectData[0].FolderID = LLUUID.Zero; + proper.ObjectData[0].FromTaskID = LLUUID.Zero; + proper.ObjectData[0].GroupID = LLUUID.Zero; + proper.ObjectData[0].InventorySerial = 0; + proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].ObjectID = this.uuid; + proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID; + proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TextureID = new byte[0]; + proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].Name = new byte[0]; + proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask; + proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask; + proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask; + proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask; + proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask; + + client.OutPacket(proper); + + } + + } +} diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs new file mode 100644 index 0000000..f0a8721 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs @@ -0,0 +1,76 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using System.Xml; + +namespace OpenSim.Region.Scenes +{ + partial class ScenePresence + { + public class AvatarAnimations + { + + public Dictionary AnimsLLUUID = new Dictionary(); + public Dictionary AnimsNames = new Dictionary(); + + public AvatarAnimations() + { + } + + public void LoadAnims() + { + //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); + XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); + + XmlDocument doc = new XmlDocument(); + doc.Load(reader); + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) + { + + if (nod.Attributes["name"] != null) + { + AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); + } + + } + + reader.Close(); + + // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); + + foreach (KeyValuePair kp in OpenSim.Region.Scenes.ScenePresence.Animations.AnimsLLUUID) + { + AnimsNames.Add(kp.Value, kp.Key); + } + } + } + } +} diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs new file mode 100644 index 0000000..d21b11f --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs @@ -0,0 +1,90 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Region.Scenes +{ + partial class ScenePresence + { + public class Avatar : IScenePresenceBody + { + public Avatar() + { + + } + + public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) + { + } + + public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) + { + } + + public void SendOurAppearance(IClientAPI OurClient) + { + } + + public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) + { + } + } + + public class ChildAgent : IScenePresenceBody //is a ghost + { + public ChildAgent() + { + + } + + public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) + { + } + + public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) + { + } + + public void SendOurAppearance(IClientAPI OurClient) + { + } + + public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) + { + } + } + } + +} diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.cs new file mode 100644 index 0000000..45d3fed --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/ScenePresence.cs @@ -0,0 +1,525 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using Axiom.MathLib; + +namespace OpenSim.Region.Scenes +{ + public partial class ScenePresence : Entity + { + public static bool PhysicsEngineFlying = false; + public static AvatarAnimations Animations; + public static byte[] DefaultTexture; + public string firstname; + public string lastname; + public IClientAPI ControllingClient; + public LLUUID current_anim; + public int anim_seq; + private bool updateflag = false; + private byte movementflag = 0; + private List forcesList = new List(); + private short _updateCount = 0; + private Axiom.MathLib.Quaternion bodyRot; + private LLObject.TextureEntry avatarAppearanceTexture = null; + private byte[] visualParams; + private AvatarWearable[] Wearables; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + private ulong m_regionHandle; + private bool childAgent = false; + private bool newForce = false; + private bool newAvatar = false; + private IScenePresenceBody m_body; + + protected RegionInfo m_regionInfo; + + #region Properties + /// + /// + /// + public PhysicsActor PhysActor + { + set + { + this._physActor = value; + } + get + { + return _physActor; + } + } + #endregion + + #region Constructor(s) + /// + /// + /// + /// + /// + /// + /// + public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) + { + + m_world = world; + this.uuid = theClient.AgentId; + + m_regionInfo = reginfo; + m_regionHandle = reginfo.RegionHandle; + OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs "); + ControllingClient = theClient; + this.firstname = ControllingClient.FirstName; + this.lastname = ControllingClient.LastName; + m_localId = m_world.NextLocalId; + Pos = ControllingClient.StartPos; + visualParams = new byte[218]; + for (int i = 0; i < 218; i++) + { + visualParams[i] = 100; + } + + Wearables = AvatarWearable.DefaultWearables; + + this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + + //register for events + ControllingClient.OnRequestWearables += this.SendOurAppearance; + //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); + ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; + ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; + ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; + // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); + // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); + //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); + + } + #endregion + + #region Status Methods + /// + /// Not Used, most likely can be deleted + /// + /// + public void ChildStatusChange(bool status) + { + this.childAgent = status; + + if (this.childAgent == true) + { + this.Velocity = new LLVector3(0, 0, 0); + this.Pos = new LLVector3(128, 128, 70); + + } + } + + /// + /// + /// + /// + public void MakeAvatar(LLVector3 pos) + { + //this.childAvatar = false; + this.Pos = pos; + this.newAvatar = true; + this.childAgent = false; + } + + protected void MakeChildAgent() + { + this.Velocity = new LLVector3(0, 0, 0); + this.Pos = new LLVector3(128, 128, 70); + this.childAgent = true; + } + + /// + /// + /// + /// + public void Teleport(LLVector3 pos) + { + this.Pos = pos; + this.SendTerseUpdateToALLClients(); + } + + /// + /// + /// + public void StopMovement() + { + + } + #endregion + + #region Event Handlers + /// + /// + /// + /// + /// + public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) + { + + } + + /// + /// Complete Avatar's movement into the region + /// + public void CompleteMovement() + { + LLVector3 look = this.Velocity; + if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) + { + look = new LLVector3(0.99f, 0.042f, 0); + } + this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); + if (this.childAgent) + { + this.childAgent = false; + } + } + + /// + /// + /// + /// + public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) + { + if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) + { + Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + if (((movementflag & 1) == 0) || (q != this.bodyRot)) + { + Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); + this.AddNewMovement(v3, q); + movementflag = 1; + this.bodyRot = q; + } + } + else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) + { + Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + if (((movementflag & 2) == 0) || (q != this.bodyRot)) + { + Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); + this.AddNewMovement(v3, q); + movementflag = 2; + this.bodyRot = q; + } + } + else + { + if ((movementflag) != 0) + { + NewForce newVelocity = new NewForce(); + newVelocity.X = 0; + newVelocity.Y = 0; + newVelocity.Z = 0; + this.forcesList.Add(newVelocity); + movementflag = 0; + } + } + + } + + protected void AddNewMovement(Axiom.MathLib.Vector3 vec, Axiom.MathLib.Quaternion rotation) + { + NewForce newVelocity = new NewForce(); + Axiom.MathLib.Vector3 direc = rotation * vec; + direc.Normalize(); + + direc = direc * ((0.03f) * 128f); + if (this._physActor.Flying) + direc *= 4; + + newVelocity.X = direc.x; + newVelocity.Y = direc.y; + newVelocity.Z = direc.z; + this.forcesList.Add(newVelocity); + } + + #endregion + + #region Overridden Methods + /// + /// + /// + public override void LandRenegerated() + { + + } + + /// + /// + /// + public override void update() + { + if (this.childAgent == false) + { + if (this.newForce) + { + this.SendTerseUpdateToALLClients(); + _updateCount = 0; + } + else if (movementflag != 0) + { + _updateCount++; + if (_updateCount > 3) + { + this.SendTerseUpdateToALLClients(); + _updateCount = 0; + } + } + + this.CheckForBorderCrossing(); + } + } + #endregion + + #region Update Client(s) + /// + /// + /// + /// + public void SendTerseUpdateToClient(IClientAPI RemoteClient) + { + LLVector3 pos = this.Pos; + LLVector3 vel = this.Velocity; + RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); + } + + /// + /// + /// + public void SendTerseUpdateToALLClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendTerseUpdateToClient(avatars[i].ControllingClient); + } + } + + /// + /// + /// + /// + public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) + { + remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); + } + + /// + /// + /// + public void SendInitialData() + { + this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); + if (this.newAvatar) + { + this.m_world.InformClientOfNeighbours(this.ControllingClient); + this.newAvatar = false; + } + } + + /// + /// + /// + /// + public void SendOurAppearance(IClientAPI OurClient) + { + this.ControllingClient.SendWearables(this.Wearables); + } + + /// + /// + /// + /// + public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) + { + + } + + /// + /// + /// + /// + /// + public void SendAnimPack(LLUUID animID, int seq) + { + + + } + + /// + /// + /// + public void SendAnimPack() + { + + } + #endregion + + #region Border Crossing Methods + /// + /// + /// + protected void CheckForBorderCrossing() + { + LLVector3 pos2 = this.Pos; + LLVector3 vel = this.Velocity; + + float timeStep = 0.2f; + pos2.X = pos2.X + (vel.X * timeStep); + pos2.Y = pos2.Y + (vel.Y * timeStep); + pos2.Z = pos2.Z + (vel.Z * timeStep); + + if ((pos2.X < 0) || (pos2.X > 256)) + { + this.CrossToNewRegion(); + } + + if ((pos2.Y < 0) || (pos2.Y > 256)) + { + this.CrossToNewRegion(); + } + } + + /// + /// + /// + protected void CrossToNewRegion() + { + LLVector3 pos = this.Pos; + LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); + uint neighbourx = this.m_regionInfo.RegionLocX; + uint neighboury = this.m_regionInfo.RegionLocY; + + if (pos.X < 2) + { + neighbourx -= 1; + newpos.X = 254; + } + if (pos.X > 253) + { + neighbourx += 1; + newpos.X = 1; + } + if (pos.Y < 2) + { + neighboury -= 1; + newpos.Y = 254; + } + if (pos.Y > 253) + { + neighboury += 1; + newpos.Y = 1; + } + + LLVector3 vel = this.velocity; + ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); + RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); + if (neighbourRegion != null) + { + bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); + if (res) + { + this.MakeChildAgent(); + this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.CommsIPListenAddr), (ushort)neighbourRegion.CommsIPListenPort); + } + } + } + #endregion + + /// + /// + /// + public static void LoadAnims() + { + + } + + /// + /// + /// + public override void updateMovement() + { + newForce = false; + lock (this.forcesList) + { + if (this.forcesList.Count > 0) + { + for (int i = 0; i < this.forcesList.Count; i++) + { + NewForce force = this.forcesList[i]; + + this.updateflag = true; + this.Velocity = new LLVector3(force.X, force.Y, force.Z); + this.newForce = true; + } + for (int i = 0; i < this.forcesList.Count; i++) + { + this.forcesList.RemoveAt(0); + } + } + } + } + + public static void LoadTextureFile(string name) + { + FileInfo fInfo = new FileInfo(name); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); + BinaryReader br = new BinaryReader(fStream); + byte[] data1 = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + DefaultTexture = data1; + } + + public class NewForce + { + public float X; + public float Y; + public float Z; + + public NewForce() + { + + } + } + } + +} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs new file mode 100644 index 0000000..daa1b92 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs @@ -0,0 +1,40 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Scripting +{ + public interface IScriptContext + { + IScriptEntity Entity { get; } + bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); + } +} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs new file mode 100644 index 0000000..44b886f --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Scripting +{ + public interface IScriptReadonlyEntity + { + LLVector3 Pos { get; } + string Name { get; } + } + + public interface IScriptEntity + { + LLVector3 Pos { get; set; } + string Name { get; } + } +} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs new file mode 100644 index 0000000..797998d --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs @@ -0,0 +1,126 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Physics.Manager; +using OpenSim.Region; +using OpenSim.Region.Scenes; +using Avatar=OpenSim.Region.Scenes.ScenePresence; +using Primitive = OpenSim.Region.Scenes.Primitive; + +namespace OpenSim.Region.Scripting +{ + public delegate void ScriptEventHandler(IScriptContext context); + + public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity + { + private Scene m_world; + private Script m_script; + private Entity m_entity; + + public LLUUID ScriptId + { + get + { + return m_script.ScriptId; + } + } + + public void OnFrame() + { + m_script.OnFrame(this); + } + + public ScriptHandler(Script script, Entity entity, Scene world) + { + m_script = script; + m_entity = entity; + m_world = world; + } + + #region IScriptContext Members + + IScriptEntity IScriptContext.Entity + { + get + { + return this; + } + } + + bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) + { + foreach (Entity entity in m_world.Entities.Values ) + { + if( entity is Avatar ) + { + avatar = entity; + return true; + } + } + + avatar = null; + return false; + } + + #endregion + + #region IScriptEntity and IScriptReadonlyEntity Members + + public string Name + { + get + { + return m_entity.Name; + } + } + + public LLVector3 Pos + { + get + { + return m_entity.Pos; + } + + set + { + if (m_entity is Primitive) + { + Primitive prim = m_entity as Primitive; + // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. + // prim.UpdatePosition( value ); + } + } + } + + #endregion + } + +} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs b/OpenSim/Region/Simulation/Scenes/scripting/Script.cs new file mode 100644 index 0000000..1d01f3c --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/scripting/Script.cs @@ -0,0 +1,53 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Scripting +{ + public class Script + { + private LLUUID m_scriptId; + public virtual LLUUID ScriptId + { + get + { + return m_scriptId; + } + } + + public Script( LLUUID scriptId ) + { + m_scriptId = scriptId; + } + + public ScriptEventHandler OnFrame; + } +} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs b/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs new file mode 100644 index 0000000..32ef046 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Scripting +{ + public delegate Script ScriptFactory(); +} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs new file mode 100644 index 0000000..21f07a8 --- /dev/null +++ b/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs @@ -0,0 +1,64 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Scripting +{ + public class FollowRandomAvatar : Script + { + public FollowRandomAvatar() + : base(LLUUID.Random()) + { + OnFrame += MyOnFrame; + } + + private void MyOnFrame(IScriptContext context) + { + LLVector3 pos = context.Entity.Pos; + + IScriptReadonlyEntity avatar; + + if (context.TryGetRandomAvatar(out avatar)) + { + LLVector3 avatarPos = avatar.Pos; + + float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; + float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; + + LLVector3 newPos = new LLVector3(x, y, pos.Z); + + context.Entity.Pos = newPos; + } + } + } + + +} diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs new file mode 100644 index 0000000..ab3c34c --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs @@ -0,0 +1,117 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +// BDB Support +// Apparently broken on Mono + +using System; +using System.Collections.Generic; +using System.Data; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using BerkeleyDb; +using Kds.Serialization; +using Kds.Serialization.Buffer; + +namespace OpenSim.Storage.LocalStorageBDB +{ + public class BDBLocalStorage : ILocalStorage + { + const string simDbName = "localsim.db"; + + DbHash sim; + Db DB; + //BEFormatter formatter; + + public BDBLocalStorage() + { + DB = new Db(DbCreateFlags.None); + sim = (DbHash)DB.Open(null, simDbName, null, BerkeleyDb.DbType.Hash, Db.OpenFlags.Create, 0); + //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0); + } + + public void Initialise(string file) + { + // Blank + } + + public void StorePrim(PrimData prim) + { + DbEntry key = new DbEntry(); + DbEntry data = new DbEntry(); + lock (sim) + { + sim.PutUnique(null, ref key, ref data, DbFile.WriteFlags.AutoCommit); + } + } + public void RemovePrim(LLUUID primID) + { + + } + public void LoadPrimitives(ILocalStorageReceiver receiver) + { + + } + public float[] LoadWorld() + { + return new float[65536]; + } + public void SaveMap(float[] heightmap) + { + + } + + public void SaveParcels(ParcelData[] parcel_data) + { + } + + public void SaveParcel(ParcelData parcel) + { + } + + public void RemoveParcel(ParcelData parcel) + { + } + + public void RemoveAllParcels() + { + } + + public void LoadParcels(ILocalStorageParcelReceiver recv) + { + recv.NoParcelDataFromStorage(); + } + + public void ShutDown() + { + sim.GetDb().Close(); + DB.Close(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj new file mode 100644 index 0000000..b956c9b --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj @@ -0,0 +1,112 @@ + + + Local + 8.0.50727 + 2.0 + {A4691E59-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Storage.LocalStorageBerkeleyDB + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Storage.LocalStorageBerkeleyDB + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Kds.Serialization.dll + False + + + ..\..\..\..\bin\libdb_dotNET43.dll + False + + + ..\..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build new file mode 100644 index 0000000..bc2d8ec --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs new file mode 100644 index 0000000..ea2b62e --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("Db4LocalStorage")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Db4LocalStorage")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs new file mode 100644 index 0000000..8e6b04d --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs @@ -0,0 +1,271 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; + +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Console; + + +namespace OpenSim.Storage.LocalStorageDb4o +{ + /// + /// + /// + public class Db4LocalStorage : ILocalStorage + { + private IObjectContainer db; + private string datastore; + + public Db4LocalStorage() + { + + } + + public void Initialise(string dfile) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("Db4LocalStorage Opening " + dfile); + datastore = dfile; + try + { + db = Db4oFactory.OpenFile(datastore); + OpenSim.Framework.Console.MainLog.Instance.Verbose("Db4LocalStorage creation"); + } + catch (Exception e) + { + db.Close(); + OpenSim.Framework.Console.MainLog.Instance.Warn("Db4LocalStorage :Constructor - Exception occured"); + OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + } + } + + public void StorePrim(PrimData prim) + { + IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID)); + if (result.Count > 0) + { + //prim already in storage + //so update it + PrimData found = (PrimData)result.Next(); + found.PathBegin = prim.PathBegin; + found.PathCurve = prim.PathCurve; + found.PathEnd = prim.PathEnd; + found.PathRadiusOffset = prim.PathRadiusOffset; + found.PathRevolutions = prim.PathRevolutions; + found.PathScaleX = prim.PathScaleX; + found.PathScaleY = prim.PathScaleY; + found.PathShearX = prim.PathShearX; + found.PathShearY = prim.PathShearY; + found.PathSkew = prim.PathSkew; + found.PathTaperX = prim.PathTaperX; + found.PathTaperY = prim.PathTaperY; + found.PathTwist = prim.PathTwist; + found.PathTwistBegin = prim.PathTwistBegin; + found.PCode = prim.PCode; + found.ProfileBegin = prim.ProfileBegin; + found.ProfileCurve = prim.ProfileCurve; + found.ProfileEnd = prim.ProfileEnd; + found.ProfileHollow = prim.ProfileHollow; + found.Position = prim.Position; + found.Rotation = prim.Rotation; + found.TextureEntry = prim.TextureEntry; + db.Set(found); + db.Commit(); + } + else + { + //not in storage + db.Set(prim); + db.Commit(); + } + } + + public void RemovePrim(LLUUID primID) + { + IObjectSet result = db.Query(new UUIDPrimQuery(primID)); + if (result.Count > 0) + { + PrimData found = (PrimData)result.Next(); + db.Delete(found); + } + } + + + public void LoadPrimitives(ILocalStorageReceiver receiver) + { + IObjectSet result = db.Get(typeof(PrimData)); + OpenSim.Framework.Console.MainLog.Instance.Verbose("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is " + result.Count); + foreach (PrimData prim in result) + { + receiver.PrimFromStorage(prim); + } + } + + public float[] LoadWorld() + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("LoadWorld() - Loading world...."); + float[] heightmap = null; + OpenSim.Framework.Console.MainLog.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); + IObjectSet world_result = db.Get(typeof(MapStorage)); + if (world_result.Count > 0) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("LoadWorld() - Found a heightmap in local database, loading"); + MapStorage map = (MapStorage)world_result.Next(); + //blank.LandMap = map.Map; + heightmap = map.Map; + } + return heightmap; + } + + public void SaveMap(float[] heightmap) + { + IObjectSet world_result = db.Get(typeof(MapStorage)); + if (world_result.Count > 0) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("SaveWorld() - updating saved copy of heightmap in local database"); + MapStorage map = (MapStorage)world_result.Next(); + db.Delete(map); + } + MapStorage map1 = new MapStorage(); + map1.Map = heightmap; //OpenSim_Main.local_world.LandMap; + db.Set(map1); + db.Commit(); + } + + public void SaveParcel(ParcelData parcel) + { + IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); + if (result.Count > 0) + { + //Old Parcel + ParcelData updateParcel = (ParcelData)result.Next(); + updateParcel.AABBMax = parcel.AABBMax; + updateParcel.AABBMin = parcel.AABBMin; + updateParcel.area = parcel.area; + updateParcel.auctionID = parcel.auctionID; + updateParcel.authBuyerID = parcel.authBuyerID; + updateParcel.category = parcel.category; + updateParcel.claimDate = parcel.claimDate; + updateParcel.claimPrice = parcel.claimPrice; + updateParcel.groupID = parcel.groupID; + updateParcel.groupPrims = parcel.groupPrims; + updateParcel.isGroupOwned = parcel.isGroupOwned; + updateParcel.landingType = parcel.landingType; + updateParcel.mediaAutoScale = parcel.mediaAutoScale; + updateParcel.mediaID = parcel.mediaID; + updateParcel.mediaURL = parcel.mediaURL; + updateParcel.musicURL = parcel.musicURL; + updateParcel.localID = parcel.localID; + updateParcel.ownerID = parcel.ownerID; + updateParcel.passHours = parcel.passHours; + updateParcel.passPrice = parcel.passPrice; + updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone(); + updateParcel.parcelDesc = parcel.parcelDesc; + updateParcel.parcelFlags = parcel.parcelFlags; + updateParcel.parcelName = parcel.parcelName; + updateParcel.parcelStatus = parcel.parcelStatus; + updateParcel.salePrice = parcel.salePrice; + updateParcel.snapshotID = parcel.snapshotID; + updateParcel.userLocation = parcel.userLocation; + updateParcel.userLookAt = parcel.userLookAt; + + db.Set(updateParcel); + } + else + { + db.Set(parcel); + } + db.Commit(); + } + + public void SaveParcels(ParcelData[] parcel_data) + { + MainLog.Instance.Notice("Parcel Backup: Saving Parcels..."); + int i; + for (i = 0; i < parcel_data.GetLength(0); i++) + { + + SaveParcel(parcel_data[i]); + + } + MainLog.Instance.Notice("Parcel Backup: Parcel Save Complete"); + } + + public void RemoveParcel(ParcelData parcel) + { + IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); + if (result.Count > 0) + { + db.Delete(result[0]); + } + db.Commit(); + } + public void RemoveAllParcels() + { + MainLog.Instance.Notice("Parcel Backup: Removing all parcels..."); + IObjectSet result = db.Get(typeof(ParcelData)); + if (result.Count > 0) + { + foreach (ParcelData parcelData in result) + { + RemoveParcel(parcelData); + } + } + } + + public void LoadParcels(ILocalStorageParcelReceiver recv) + { + MainLog.Instance.Notice("Parcel Backup: Loading Parcels..."); + IObjectSet result = db.Get(typeof(ParcelData)); + if (result.Count > 0) + { + MainLog.Instance.Notice("Parcel Backup: Parcels exist in database."); + foreach (ParcelData parcelData in result) + { + + recv.ParcelFromStorage(parcelData); + } + } + else + { + MainLog.Instance.Notice("Parcel Backup: No parcels exist. Creating basic parcel."); + recv.NoParcelDataFromStorage(); + } + MainLog.Instance.Notice("Parcel Backup: Parcels Restored"); + } + public void ShutDown() + { + db.Commit(); + db.Close(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs new file mode 100644 index 0000000..56387ac --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs @@ -0,0 +1,43 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Storage.LocalStorageDb4o +{ + public class MapStorage + { + public float[] Map; + + public MapStorage() + { + + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj new file mode 100644 index 0000000..147158c --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -0,0 +1,116 @@ + + + Local + 8.0.50727 + 2.0 + {43DB702D-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Storage.LocalStorageDb4o + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Storage.LocalStorageDb4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs new file mode 100644 index 0000000..d24fb5f --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs @@ -0,0 +1,52 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Storage.LocalStorageDb4o +{ + public class UUIDParcelQuery : Predicate + { + private LLUUID globalIDSearch; + + public UUIDParcelQuery(LLUUID find) + { + globalIDSearch = find; + } + public bool Match(ParcelData parcel) + { + return (parcel.globalID == globalIDSearch); + } + } +} diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs new file mode 100644 index 0000000..b2e8a91 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs @@ -0,0 +1,52 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Storage.LocalStorageDb4o +{ + public class UUIDPrimQuery : Predicate + { + private LLUUID _findID; + + public UUIDPrimQuery(LLUUID find) + { + _findID = find; + } + public bool Match(PrimData prim) + { + return (prim.FullID == _findID); + } + } +} diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj new file mode 100644 index 0000000..d1353a5 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj @@ -0,0 +1,111 @@ + + + Local + 8.0.50727 + 2.0 + {477B9270-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Storage.LocalStorageSQLite + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Storage.LocalStorageSQLite + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Data.dll + False + + + ..\..\..\..\bin\System.Data.SQLite.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build new file mode 100644 index 0000000..bd4c731 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b45debf --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs @@ -0,0 +1,62 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Storage.LocalStorageSQLite")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Storage.LocalStorageSQLite")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ecd6e0c1-7909-413e-9e3f-659678ac3bc3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.*")] +[assembly: AssemblyFileVersion("1.0.0.*")] diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs new file mode 100644 index 0000000..8a7893e --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs @@ -0,0 +1,198 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +// SQLite Support +// A bad idea, but the IRC people told me to! + +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SQLite; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Storage.LocalStorageSQLite +{ + public class SQLiteLocalStorage : ILocalStorage + { + IDbConnection db; + + public SQLiteLocalStorage() + { + try + { + string connectionstring = "URI=file:localsim.sdb"; + db = (IDbConnection)new SQLiteConnection(connectionstring); + db.Open(); + } + catch (Exception e) + { + db.Close(); + OpenSim.Framework.Console.MainLog.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured"); + OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + } + } + + public void Initialise(string file) + { + // Blank + } + + public void StorePrim(PrimData prim) + { + IDbCommand cmd = db.CreateCommand(); + + //SECURITY WARNING: + // These parameters wont produce SQL injections since they are all integer based, however. + // if inserting strings such as name or description, you will need to use appropriate + // measures to prevent SQL injection (although the value of SQL injection in this is limited). + + string sql = "REPLACE INTO prim (OwnerID,PCode,PathBegin,PathEnd,PathScaleX,PathScaleY,PathShearX,PathShearY,PathSkew,ProfileBegin,ProfileEnd,Scale,PathCurve,ProfileCurve,ParentID,ProfileHollow,PathRadiusOffset,PathRevolutions,PathTaperX,PathTaperY,PathTwist,PathTwistBegin,Texture,CreationDate,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,Position,Rotation,LocalID,FullID) "; + sql += "VALUES ("; + sql += "\"" + prim.OwnerID.ToStringHyphenated() + "\","; // KILL ME NOW! + sql += "\"" + prim.PCode.ToString() + "\","; + sql += "\"" + prim.PathBegin.ToString() + "\","; + sql += "\"" + prim.PathEnd.ToString() + "\","; + sql += "\"" + prim.PathScaleX.ToString() + "\","; + sql += "\"" + prim.PathScaleY.ToString() + "\","; + sql += "\"" + prim.PathShearX.ToString() + "\","; + sql += "\"" + prim.PathShearY.ToString() + "\","; + sql += "\"" + prim.PathSkew.ToString() + "\","; + sql += "\"" + prim.ProfileBegin.ToString() + "\","; + sql += "\"" + prim.ProfileEnd.ToString() + "\","; + sql += "\"" + prim.Scale.ToString() + "\","; + sql += "\"" + prim.PathCurve.ToString() + "\","; + sql += "\"" + prim.ProfileCurve.ToString() + "\","; + sql += "\"" + prim.ParentID.ToString() + "\","; + sql += "\"" + prim.ProfileHollow.ToString() + "\","; + sql += "\"" + prim.PathRadiusOffset.ToString() + "\","; + sql += "\"" + prim.PathRevolutions.ToString() + "\","; + sql += "\"" + prim.PathTaperX.ToString() + "\","; + sql += "\"" + prim.PathTaperY.ToString() + "\","; + sql += "\"" + prim.PathTwist.ToString() + "\","; + sql += "\"" + prim.PathTwistBegin.ToString() + "\","; + sql += "\"" + prim.TextureEntry.ToString() + "\","; + sql += "\"" + prim.CreationDate.ToString() + "\","; + sql += "\"" + prim.OwnerMask.ToString() + "\","; + sql += "\"" + prim.NextOwnerMask.ToString() + "\","; + sql += "\"" + prim.GroupMask.ToString() + "\","; + sql += "\"" + prim.EveryoneMask.ToString() + "\","; + sql += "\"" + prim.BaseMask.ToString() + "\","; + sql += "\"" + prim.Position.ToString() + "\","; + sql += "\"" + prim.Rotation.ToString() + "\","; + sql += "\"" + prim.LocalID.ToString() + "\","; + sql += "\"" + prim.FullID.ToString() + "\")"; + + cmd.CommandText = sql; + + try + { + cmd.ExecuteNonQuery(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured"); + OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + } + + cmd.Dispose(); + cmd = null; + } + + public void RemovePrim(LLUUID primID) + { + IDbCommand cmd = db.CreateCommand(); + + //SECURITY WARNING: + // These parameters wont produce SQL injections since they are all integer based, however. + // if inserting strings such as name or description, you will need to use appropriate + // measures to prevent SQL injection (although the value of SQL injection in this is limited). + + string sql = "DELETE FROM prim WHERE FullID = \"" + primID.ToStringHyphenated() + "\""; + + cmd.CommandText = sql; + + try + { + cmd.ExecuteNonQuery(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured"); + OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + } + + cmd.Dispose(); + cmd = null; + } + + public void LoadPrimitives(ILocalStorageReceiver receiver) + { + + } + + public float[] LoadWorld() + { + return new float[65536]; + } + + public void SaveMap(float[] heightmap) + { + + } + + public void SaveParcels(ParcelData[] parcel_manager) + { + + } + + public void SaveParcel(ParcelData parcel) + { + } + + public void RemoveParcel(ParcelData parcel) + { + } + + public void RemoveAllParcels() + { + } + + public void LoadParcels(ILocalStorageParcelReceiver recv) + { + recv.NoParcelDataFromStorage(); + } + + public void ShutDown() + { + db.Close(); + db = null; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj new file mode 100644 index 0000000..24667e5 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj @@ -0,0 +1,110 @@ + + + Local + 8.0.50727 + 2.0 + {C9E0F891-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Terrain.BasicTerrain + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Terrain.BasicTerrain + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\libTerrain-BSD.dll + False + + + Microsoft.JScript.dll + False + + + ..\..\..\bin\openjpegnet.dll + False + + + System.dll + False + + + System.Data.dll + False + + + System.Drawing.dll + False + + + System.Xml.dll + False + + + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..827c68f --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs @@ -0,0 +1,62 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Terrain.BasicTerrain")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Terrain.BasicTerrain")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs new file mode 100644 index 0000000..4f989fa --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -0,0 +1,786 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; +using libTerrain; +using OpenJPEGNet; + +namespace OpenSim.Terrain +{ + public class TerrainCommand + { + public virtual bool run(string[] cmdargs, ref string output) + { + return false; + } + + public string args; + public string help; + } + + public class TerrainEngine + { + /// + /// Plugin library for scripts + /// + public FilterHost customFilters = new FilterHost(); + + /// + /// A [normally] 256x256 heightmap + /// + public Channel heightmap; + + /// + /// A copy of heightmap at the last save point (for reverting) + /// + public Channel revertmap; + + /// + /// Water heightmap (needs clientside mods to work) + /// + public Channel watermap; + + /// + /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. + /// Counts the number of modifications since the last save. (0 = Untainted) + /// + public int tainted; + + int w, h; + + /// + /// Generate a new TerrainEngine instance and creates a new heightmap + /// + public TerrainEngine() + { + w = 256; + h = 256; + heightmap = new Channel(w, h); + + tainted++; + } + + /// + /// Converts the heightmap to a 65536 value 1D floating point array + /// + /// A float[65536] array containing the heightmap + public float[] getHeights1D() + { + float[] heights = new float[w * h]; + int i; + + for (i = 0; i < w * h; i++) + { + heights[i] = (float)heightmap.map[i / w, i % w]; + } + + return heights; + } + + /// + /// Converts the heightmap to a 256x256 value 2D floating point array. + /// + /// An array of 256,256 values containing the heightmap + public float[,] getHeights2D() + { + float[,] heights = new float[w, h]; + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + heights[x, y] = (float)heightmap.map[x, y]; + } + } + return heights; + } + + /// + /// Imports a 1D floating point array into the 2D heightmap array + /// + /// The array to import (must have 65536 members) + public void setHeights1D(float[] heights) + { + int i; + for (i = 0; i < w * h; i++) + { + heightmap.map[i / w, i % w] = heights[i]; + } + + tainted++; + } + + /// + /// Loads a 2D array of values into the heightmap + /// + /// An array of 256,256 float values + public void setHeights2D(float[,] heights) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + heightmap.set(x, y, (double)heights[x, y]); + } + } + tainted++; + } + + /// + /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) + /// + public void swapRevertMaps() + { + Channel backup = heightmap.copy(); + heightmap = revertmap; + revertmap = backup; + } + + /// + /// Saves the current heightmap into the revertmap + /// + public void saveRevertMap() + { + revertmap = heightmap.copy(); + } + + /// + /// Processes a terrain-specific command + /// + /// Commandline arguments (space seperated) + /// Reference that returns error or help text if returning false + /// If the operation was successful (if not, the error is placed into resultText) + public bool RunTerrainCmd(string[] args, ref string resultText) + { + string command = args[0]; + + try + { + + switch (command) + { + case "help": + resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; + resultText += "terrain voronoi - generates a worley fractal with X points per block"; + resultText += "terrain seed - sets the random seed value to \n"; + resultText += "terrain load - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; + resultText += "terrain save - saves a terrain to disk, type can be 'F32', 'F64' or 'PNG'\n"; + resultText += "terrain save grdmap - creates a PNG snapshot of the region using a named gradient map\n"; + resultText += "terrain rescale - rescales a terrain to be between and meters high\n"; + resultText += "terrain erode aerobic \n"; + resultText += "terrain erode thermal \n"; + resultText += "terrain multiply - multiplies a terrain by \n"; + resultText += "terrain revert - reverts the terrain to the stored original\n"; + resultText += "terrain bake - saves the current terrain into the revert map\n"; + resultText += "terrain csfilter - loads a new filter from the specified .cs file\n"; + resultText += "terrain jsfilter - loads a new filter from the specified .js file\n"; + foreach (KeyValuePair filter in customFilters.filters) + { + resultText += filter.Value.Help(); + } + + return false; + + case "revert": + swapRevertMaps(); + saveRevertMap(); + break; + + case "bake": + saveRevertMap(); + break; + + case "seed": + setSeed(Convert.ToInt32(args[1])); + break; + + case "erode": + return consoleErosion(args, ref resultText); + + case "voronoi": + double[] c = new double[2]; + c[0] = -1; + c[1] = 1; + heightmap.voronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c); + break; + + case "hills": + return consoleHills(args, ref resultText); + + case "regenerate": + hills(); + break; + + case "rescale": + setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); + break; + + case "multiply": + heightmap *= Convert.ToDouble(args[1]); + break; + + case "load": + switch (args[1].ToLower()) + { + case "f32": + loadFromFileF32(args[2]); + break; + + case "f64": + loadFromFileF64(args[2]); + break; + + case "raw": + loadFromFileSLRAW(args[2]); + break; + + case "img": + heightmap.loadImage(args[2]); + return false; + + default: + resultText = "Unknown image or data format"; + return false; + } + break; + + case "save": + switch (args[1].ToLower()) + { + case "f32": + writeToFileF32(args[2]); + break; + + case "f64": + writeToFileF64(args[2]); + break; + + case "grdmap": + exportImage(args[2], args[3]); + break; + + case "png": + heightmap.saveImage(args[2]); + break; + + default: + resultText = "Unknown image or data format"; + return false; + } + break; + + case "csfilter": + customFilters.LoadFilterCSharp(args[1]); + break; + case "jsfilter": + customFilters.LoadFilterJScript(args[1]); + break; + + default: + // Run any custom registered filters + if (customFilters.filters.ContainsKey(command)) + { + customFilters.filters[command].Filter(heightmap, args); + break; + } + else + { + resultText = "Unknown terrain command"; + return false; + } + } + return true; + } + catch (Exception e) + { + resultText = "Error running terrain command: " + e.ToString(); + return false; + } + } + + private bool consoleErosion(string[] args, ref string resultText) + { + switch (args[1].ToLower()) + { + case "aerobic": + // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest + heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7])); + break; + case "thermal": + heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); + break; + default: + resultText = "Unknown erosion type"; + return false; + } + return true; + } + + private bool consoleHills(string[] args, ref string resultText) + { + int count; + double sizeMin; + double sizeRange; + bool island; + bool additive; + bool noisy; + + if (args.GetLength(0) > 2) + { + count = Convert.ToInt32(args[2]); + sizeMin = Convert.ToDouble(args[3]); + sizeRange = Convert.ToDouble(args[4]); + island = Convert.ToBoolean(args[5]); + additive = Convert.ToBoolean(args[6]); + noisy = Convert.ToBoolean(args[7]); + } + else + { + count = 200; + sizeMin = 20; + sizeRange = 40; + island = true; + additive = true; + noisy = false; + } + + switch (args[1].ToLower()) + { + case "blocks": + heightmap.hillsBlocks(count, sizeMin, sizeRange, island, additive, noisy); + break; + case "cones": + heightmap.hillsCones(count, sizeMin, sizeRange, island, additive, noisy); + break; + case "spheres": + heightmap.hillsSpheres(count, sizeMin, sizeRange, island, additive, noisy); + break; + case "squared": + heightmap.hillsSquared(count, sizeMin, sizeRange, island, additive, noisy); + break; + default: + resultText = "Unknown hills type"; + return false; + } + return true; + } + + /// + /// Renormalises the array between min and max + /// + /// Minimum value of the new array + /// Maximum value of the new array + public void setRange(float min, float max) + { + heightmap.normalise((double)min, (double)max); + tainted++; + } + + /// + /// Loads a file consisting of 256x256 doubles and imports it as an array into the map. + /// + /// TODO: Move this to libTerrain itself + /// The filename of the double array to import + public void loadFromFileF64(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); + System.IO.BinaryReader bs = new System.IO.BinaryReader(s); + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + heightmap.map[x, y] = bs.ReadDouble(); + } + } + + bs.Close(); + s.Close(); + + tainted++; + } + + /// + /// Loads a file consisting of 256x256 floats and imports it as an array into the map. + /// + /// TODO: Move this to libTerrain itself + /// The filename of the float array to import + public void loadFromFileF32(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); + System.IO.BinaryReader bs = new System.IO.BinaryReader(s); + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + heightmap.map[x, y] = (double)bs.ReadSingle(); + } + } + + bs.Close(); + s.Close(); + + tainted++; + } + + /// + /// Loads a file formatted in the SL .RAW Format used on the main grid + /// + /// This file format stinks and is best avoided. + /// A path to the .RAW format + public void loadFromFileSLRAW(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); + System.IO.BinaryReader bs = new System.IO.BinaryReader(s); + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + heightmap.map[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0); + bs.ReadBytes(11); // Advance the stream to next bytes. + } + } + + bs.Close(); + s.Close(); + + tainted++; + } + + /// + /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array. + /// + /// The desired output filename + public void writeToFileF64(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); + System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + bs.Write(heightmap.get(x, y)); + } + } + + bs.Close(); + s.Close(); + } + + /// + /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array + /// + /// The desired output filename + public void writeToFileF32(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); + System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + bs.Write((float)heightmap.get(x, y)); + } + } + + bs.Close(); + s.Close(); + } + + /// + /// Sets the random seed to be used by procedural functions which involve random numbers. + /// + /// The desired seed + public void setSeed(int val) + { + heightmap.seed = val; + } + + /// + /// Raises land in a sphere around the specified coordinates + /// + /// Center of the sphere on the X axis + /// Center of the sphere on the Y axis + /// The radius of the sphere + /// Scale the height of the sphere by this amount (recommended 0..2) + public void raise(double rx, double ry, double size, double amount) + { + lock (heightmap) + { + heightmap.raise(rx, ry, size, amount); + } + + tainted++; + } + + /// + /// Lowers the land in a sphere around the specified coordinates + /// + /// The center of the sphere at the X axis + /// The center of the sphere at the Y axis + /// The radius of the sphere in meters + /// Scale the height of the sphere by this amount (recommended 0..2) + public void lower(double rx, double ry, double size, double amount) + { + lock (heightmap) + { + heightmap.lower(rx, ry, size, amount); + } + + tainted++; + } + + /// + /// Flattens the land under the brush of specified coordinates (spherical mask) + /// + /// Center of sphere + /// Center of sphere + /// Radius of the sphere + /// Thickness of the mask (0..2 recommended) + public void flatten(double rx, double ry, double size, double amount) + { + lock (heightmap) + { + heightmap.flatten(rx, ry, size, amount); + } + + tainted++; + } + + /// + /// Creates noise within the specified bounds + /// + /// Center of the bounding sphere + /// Center of the bounding sphere + /// The radius of the sphere + /// Strength of the mask (0..2) recommended + public void noise(double rx, double ry, double size, double amount) + { + lock (heightmap) + { + Channel smoothed = new Channel(); + smoothed.noise(); + + Channel mask = new Channel(); + mask.raise(rx, ry, size, amount); + + heightmap.blend(smoothed, mask); + } + + tainted++; + } + + /// + /// Reverts land within the specified bounds + /// + /// Center of the bounding sphere + /// Center of the bounding sphere + /// The radius of the sphere + /// Strength of the mask (0..2) recommended + public void revert(double rx, double ry, double size, double amount) + { + lock (heightmap) + { + Channel mask = new Channel(); + mask.raise(rx, ry, size, amount); + + heightmap.blend(revertmap, mask); + } + + tainted++; + } + + /// + /// Smooths land under the brush of specified coordinates (spherical mask) + /// + /// Center of the sphere + /// Center of the sphere + /// Radius of the sphere + /// Thickness of the mask (0..2 recommended) + public void smooth(double rx, double ry, double size, double amount) + { + lock (heightmap) + { + Channel smoothed = heightmap.copy(); + smoothed.smooth(amount); + + Channel mask = new Channel(); + mask.raise(rx,ry,size,amount); + + heightmap.blend(smoothed, mask); + } + + tainted++; + } + + /// + /// Generates a simple set of hills in the shape of an island + /// + public void hills() + { + lock (heightmap) + { + heightmap.hillsSpheres(200, 20, 40, true, true, false); + heightmap.normalise(); + heightmap *= 60.0; // Raise to 60m + } + + tainted++; + } + + /// + /// Multiplies the heightfield by val + /// + /// The heightfield + /// The multiplier + /// + public static TerrainEngine operator *(TerrainEngine meep, Double val) + { + meep.heightmap *= val; + meep.tainted++; + return meep; + } + + /// + /// Returns the height at the coordinates x,y + /// + /// X Coordinate + /// Y Coordinate + /// + public float this[int x, int y] + { + get + { + return (float)heightmap.get(x, y); + } + set + { + tainted++; + heightmap.set(x, y, (double)value); + } + } + + /// + /// Exports the current heightmap to a PNG file + /// + /// The destination filename for the image + /// A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal. + public void exportImage(string filename, string gradientmap) + { + try + { + Bitmap gradientmapLd = new Bitmap(gradientmap); + + int pallete = gradientmapLd.Height; + + Bitmap bmp = new Bitmap(heightmap.w, heightmap.h); + Color[] colours = new Color[pallete]; + + for (int i = 0; i < pallete; i++) + { + colours[i] = gradientmapLd.GetPixel(0, i); + } + + Channel copy = heightmap.copy(); + for (int x = 0; x < copy.w; x++) + { + for (int y = 0; y < copy.h; y++) + { + // 512 is the largest possible height before colours clamp + int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * pallete); + bmp.SetPixel(x, y, colours[colorindex]); + } + } + + bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png); + } + catch (Exception e) + { + Console.WriteLine("Failed generating terrain map: " + e.ToString()); + } + } + + /// + /// Exports the current heightmap in Jpeg2000 format to a byte[] + /// + /// A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal. + public byte[] exportJpegImage(string gradientmap) + { + byte[] imageData = null; + try + { + Bitmap gradientmapLd = new Bitmap(gradientmap); + + int pallete = gradientmapLd.Height; + + Bitmap bmp = new Bitmap(heightmap.w, heightmap.h); + Color[] colours = new Color[pallete]; + + for (int i = 0; i < pallete; i++) + { + colours[i] = gradientmapLd.GetPixel(0, i); + } + + Channel copy = heightmap.copy(); + for (int x = 0; x < copy.w; x++) + { + for (int y = 0; y < copy.h; y++) + { + // 512 is the largest possible height before colours clamp + int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.h - y, x) / 512.0), 0.0) * pallete); + bmp.SetPixel(x, y, colours[colorindex]); + } + } + + //bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png); + imageData = OpenJPEGNet.OpenJPEG.EncodeFromImage(bmp, "map"); + + } + catch (Exception e) + { + Console.WriteLine("Failed generating terrain map: " + e.ToString()); + } + + return imageData; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs new file mode 100644 index 0000000..689375d --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using System.CodeDom.Compiler; +using System.CodeDom; +using Microsoft.CSharp; +using Microsoft.JScript; + +using libTerrain; + +namespace OpenSim.Terrain +{ + public interface ITerrainFilter + { + void Filter(Channel heightmap, string[] args); + string Register(); + string Help(); + } + + public class TestFilter : ITerrainFilter + { + public void Filter(Channel heightmap, string[] args) + { + Console.WriteLine("Hello world"); + } + + public string Register() + { + return "demofilter"; + } + + public string Help() + { + return "demofilter - Does nothing"; + } + } + + public class FilterHost + { + public Dictionary filters = new Dictionary(); + + private void LoadFilter(ICodeCompiler compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("libTerrain-BSD.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Terrain.BasicTerrain.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + Console.WriteLine("Compile errors:"); + foreach (CompilerError error in compilerResults.Errors) + { + Console.WriteLine(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("ITerrainFilter",true); + + if (testInterface != null) + { + ITerrainFilter filter = (ITerrainFilter)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string filterName = filter.Register(); + Console.WriteLine("Plugin: " + filterName + " loaded."); + + if (!filters.ContainsKey(filterName)) + { + filters.Add(filterName, filter); + } + else + { + filters[filterName] = filter; + } + } + } + } + + } + + public void LoadFilterCSharp(string filename) + { + CSharpCodeProvider compiler = new CSharpCodeProvider(); + LoadFilter(compiler.CreateCompiler(), filename); + } + + public void LoadFilterJScript(string filename) + { + JScriptCodeProvider compiler = new JScriptCodeProvider(); + LoadFilter(compiler.CreateCompiler(), filename); + } + } +} -- cgit v1.1 From e41eedc9aeba3eb36cdba4fcdf1e57bea976cab4 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 16:39:11 +0000 Subject: *Some more restructuring/fixing -- should compile, but high chance I forgot to add/remove something --- OpenSim/Region/Application/Application.cs | 3 +- OpenSim/Region/Application/OpenSim.csproj | 79 ++++---- OpenSim/Region/Application/OpenSimMain.cs | 28 +-- OpenSim/Region/Caches/AssetCache.cs | 2 +- OpenSim/Region/Caches/Properties/AssemblyInfo.cs | 4 +- .../Region/ClientStack/Assets/InventoryCache.cs | 1 + .../ClientStack/ClientStackNetworkHandler.cs | 2 +- OpenSim/Region/ClientStack/ClientView.API.cs | 2 +- .../ClientStack/ClientView.AgentAssetUpload.cs | 4 +- .../ClientStack/ClientView.PacketHandlers.cs | 2 +- .../ClientStack/ClientView.ProcessPackets.cs | 2 +- OpenSim/Region/ClientStack/ClientView.cs | 4 +- OpenSim/Region/ClientStack/ClientViewBase.cs | 2 +- OpenSim/Region/ClientStack/PacketServer.cs | 4 +- .../Region/ClientStack/RegionApplicationBase.cs | 5 +- OpenSim/Region/ClientStack/UDPServer.cs | 7 +- OpenSim/Region/ClientStack/VersionInfo.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 16 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 9 +- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 71 +++---- .../LocalCommunications/CommunicationsLocal.cs | 61 ------ .../LocalCommunications/LocalBackEndServices.cs | 209 -------------------- .../LocalCommunications/LocalUserServices.cs | 118 ----------- .../OpenSim.Region.LocalCommunications.csproj | 121 ------------ .../OpenSim.Region.LocalCommunications.csproj.user | 12 -- .../LocalCommunications/Properties/AssemblyInfo.cs | 35 ---- OpenSim/Region/Simulation/Caps.cs | 6 +- OpenSim/Region/Simulation/EstateManager.cs | 8 +- .../Simulation/OpenSim.Region.Environment.csproj | 218 +++++++++++++++++++++ .../Simulation/OpenSim.Region.Simulation.csproj | 211 -------------------- .../OpenSim.Region.Simulation.csproj.user | 12 -- OpenSim/Region/Simulation/ParcelManager.cs | 8 +- OpenSim/Region/Simulation/RegionManager.cs | 6 +- OpenSim/Region/Simulation/Scenes/Entity.cs | 4 +- .../Region/Simulation/Scenes/IScenePresenceBody.cs | 2 +- OpenSim/Region/Simulation/Scenes/Primitive.cs | 6 +- .../Simulation/Scenes/Scene.PacketHandlers.cs | 6 +- .../Region/Simulation/Scenes/Scene.Scripting.cs | 2 +- OpenSim/Region/Simulation/Scenes/Scene.cs | 14 +- OpenSim/Region/Simulation/Scenes/SceneBase.cs | 6 +- OpenSim/Region/Simulation/Scenes/SceneEvents.cs | 2 +- OpenSim/Region/Simulation/Scenes/SceneObject.cs | 2 +- .../Simulation/Scenes/ScenePresence.Animations.cs | 4 +- .../Region/Simulation/Scenes/ScenePresence.Body.cs | 2 +- OpenSim/Region/Simulation/Scenes/ScenePresence.cs | 2 +- .../Simulation/Scenes/scripting/IScriptContext.cs | 2 +- .../Simulation/Scenes/scripting/IScriptEntity.cs | 2 +- .../Simulation/Scenes/scripting/IScriptHandler.cs | 10 +- .../Region/Simulation/Scenes/scripting/Script.cs | 2 +- .../Simulation/Scenes/scripting/ScriptFactory.cs | 2 +- .../Scenes/scripting/Scripts/FollowRandomAvatar.cs | 2 +- .../LocalStorageBerkeleyDB/BDBLocalStorage.cs | 2 +- .../Storage/LocalStorageDb4o/Db4LocalStorage.cs | 2 +- .../Region/Storage/LocalStorageDb4o/MapStorage.cs | 2 +- .../Storage/LocalStorageDb4o/UUIDParcelQuery.cs | 2 +- .../Storage/LocalStorageDb4o/UUIDPrimQuery.cs | 2 +- .../LocalStorageSQLite/Properties/AssemblyInfo.cs | 4 +- .../LocalStorageSQLite/SQLiteLocalStorage.cs | 2 +- 58 files changed, 406 insertions(+), 956 deletions(-) delete mode 100644 OpenSim/Region/LocalCommunications/CommunicationsLocal.cs delete mode 100644 OpenSim/Region/LocalCommunications/LocalBackEndServices.cs delete mode 100644 OpenSim/Region/LocalCommunications/LocalUserServices.cs delete mode 100644 OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj delete mode 100644 OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user delete mode 100644 OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj delete mode 100644 OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj delete mode 100644 OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 40701b0..1dcd99b 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Text; using OpenSim.Framework.Console; +using OpenSim.Region.ClientStack; namespace OpenSim { @@ -108,7 +109,7 @@ namespace OpenSim sim.m_sandbox = sandBoxMode; sim.user_accounts = userAccounts; sim.gridLocalAsset = gridLocalAsset; - OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = allowFlying; + OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = allowFlying; sim.StartUp(); diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index 214f2cf..fcde555 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {438A9556-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim @@ -15,9 +16,11 @@ IE50 false Exe - + + OpenSim - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,30 +61,31 @@ False False 4 - + + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -88,79 +95,75 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications.OGS1 - {6109024D-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.UserManagement {586E2916-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.ClientStack {DC3698B2-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - - OpenSim.Region.LocalCommunications + {EB3A1BA8-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + OpenSim.Region.Communications.Local + + + {6109024D-0000-0000-0000-000000000000} + OpenSim.Region.Communications.OGS1 OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - - OpenSim.Region.Simulation + + OpenSim.Region.Environment {C0DAB338-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -178,4 +181,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 7da2263..db4185c 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -38,22 +38,24 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Region; -using OpenSim.Region.Scenes; +using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework; using OpenSim.Assets; -using OpenSim.Caches; +using OpenSim.Region.Caches; using OpenSim.Framework.Console; using OpenSim.Physics.Manager; using Nwc.XmlRpc; -using OpenSim.Servers; +using OpenSim.Framework.Servers; using OpenSim.GenericConfig; -using OpenGrid.Framework.Communications; -using OpenSim.LocalCommunications; -using OpenGrid.Framework.Communications.OGS1; +using OpenSim.Framework.Communications; +using OpenSim.Region.Communications.OGS1; +using OpenSim.Region.Communications.Local; + +using OpenSim.Region.ClientStack; namespace OpenSim { @@ -241,7 +243,7 @@ namespace OpenSim udpServer.LocalWorld = LocalWorld; - LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. + LocalWorld.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. LocalWorld.LoadWorldMap(); m_log.Verbose( "Main.cs:Startup() - Starting up messaging system"); @@ -358,23 +360,23 @@ namespace OpenSim case "": this.m_physicsEngine = "basicphysics"; configData.SetAttribute("PhysicsEngine", "basicphysics"); - OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = false; + OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = false; break; case "basicphysics": this.m_physicsEngine = "basicphysics"; configData.SetAttribute("PhysicsEngine", "basicphysics"); - OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = false; + OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = false; break; case "RealPhysX": this.m_physicsEngine = "RealPhysX"; - OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = true; + OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = true; break; case "OpenDynamicsEngine": this.m_physicsEngine = "OpenDynamicsEngine"; - OpenSim.Region.Scenes.ScenePresence.PhysicsEngineFlying = true; + OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = true; break; } @@ -456,7 +458,7 @@ namespace OpenSim m_log.Error( "That is " + (DateTime.Now - startuptime).ToString()); break; case "users": - OpenSim.Region.Scenes.ScenePresence TempAv; + OpenSim.Region.Environment.Scenes.ScenePresence TempAv; m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); /* foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) { diff --git a/OpenSim/Region/Caches/AssetCache.cs b/OpenSim/Region/Caches/AssetCache.cs index d0cc370..6cf921b 100644 --- a/OpenSim/Region/Caches/AssetCache.cs +++ b/OpenSim/Region/Caches/AssetCache.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; -namespace OpenSim.Caches +namespace OpenSim.Region.Caches { public delegate void DownloadComplete(AssetCache.TextureSender sender); diff --git a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs index 00f5dfe..5e6ecbb 100644 --- a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Caches")] +[assembly: AssemblyTitle("OpenSim.Region.Caches")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Caches")] +[assembly: AssemblyProduct("OpenSim.Region.Caches")] [assembly: AssemblyCopyright("Copyright © 2007")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs index 5d5021c..da74f85 100644 --- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs +++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs @@ -35,6 +35,7 @@ using libsecondlife.Packets; using OpenSim.Framework.Inventory; using OpenSim.Framework.Types; using OpenSim.Framework.Interfaces; +using OpenSim.Region.ClientStack; namespace OpenSim.Assets { diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs index 7552195..f99cf79 100644 --- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs +++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs @@ -33,7 +33,7 @@ using System.Net.Sockets; using libsecondlife; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public interface ClientStackNetworkHandler diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 902f3c7..5e346fb 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -35,7 +35,7 @@ using OpenSim.Framework.Types; using libsecondlife; using libsecondlife.Packets; -namespace OpenSim +namespace OpenSim.Region.ClientStack { partial class ClientView { diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs index 914c38a..bc6cc21 100644 --- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs +++ b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs @@ -32,11 +32,11 @@ using OpenSim.Assets; using OpenSim.Framework.Types; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Utilities; -using OpenSim.Caches; +using OpenSim.Region.Caches; using libsecondlife; using libsecondlife.Packets; -namespace OpenSim +namespace OpenSim.Region.ClientStack { partial class ClientView { diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 32aed02..cbd10dc 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -42,7 +42,7 @@ using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; using OpenSim.Assets; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public partial class ClientView { diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 191ef21..51981b8 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -42,7 +42,7 @@ using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; using OpenSim.Assets; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public partial class ClientView { diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 312da9d..9c4462d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -42,9 +42,9 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; using OpenSim.Assets; -using OpenSim.Caches; +using OpenSim.Region.Caches; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public delegate bool PacketMethod(ClientView simClient, Packet packet); diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index 8b503f0..7d39405 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -39,7 +39,7 @@ using System.Timers; using OpenSim.Framework.Utilities; using OpenSim.Framework.Interfaces; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public class ClientViewBase { diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 229570c..ffd254e 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -34,9 +34,9 @@ using OpenSim.Framework; using System.Net; using System.Net.Sockets; using OpenSim.Assets; -using OpenSim.Caches; +using OpenSim.Region.Caches; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public class PacketServer { diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index b421fbd..d39adb5 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -42,14 +42,13 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework; using OpenSim.Assets; -using OpenSim.Caches; +using OpenSim.Region.Caches; using OpenSim.Framework.Console; using OpenSim.Physics.Manager; using Nwc.XmlRpc; using OpenSim.Framework.Servers; -using OpenSim.Framework.GenericConfig; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public class RegionApplicationBase { diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index f2a02d9..33097ed 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -41,14 +41,13 @@ using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Assets; -using OpenSim.Caches; +using OpenSim.Region.Caches; using OpenSim.Framework.Console; using OpenSim.Framework; using Nwc.XmlRpc; -using OpenSim.Servers; -using OpenSim.GenericConfig; +using OpenSim.Framework.Servers; -namespace OpenSim +namespace OpenSim.Region.ClientStack { public class UDPServer : ClientStackNetworkHandler diff --git a/OpenSim/Region/ClientStack/VersionInfo.cs b/OpenSim/Region/ClientStack/VersionInfo.cs index 5d1354e..249ca94 100644 --- a/OpenSim/Region/ClientStack/VersionInfo.cs +++ b/OpenSim/Region/ClientStack/VersionInfo.cs @@ -27,7 +27,7 @@ */ using System; -namespace OpenSim +namespace OpenSim.Region.ClientStack { /// /// diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 01e0c59..89f39d3 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -5,20 +5,20 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Console; using libsecondlife; -using OpenSim.Region; -using Avatar=OpenSim.Region.Scenes.ScenePresence; -using OpenSim.Region.Scenes; +using OpenSim.Region.Environment; +using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; +using OpenSim.Region.Environment.Scenes; using OpenSim.Framework; -using OpenSim.Caches; -using OpenGrid.Framework.Communications; -using OpenSim.Servers; +using OpenSim.Region.Caches; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers; namespace SimpleApp { public class MyWorld : Scene { private RegionInfo m_regionInfo; - private List m_avatars; + private List m_avatars; public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) @@ -76,7 +76,7 @@ namespace SimpleApp client.SendRegionHandshake(m_regionInfo); - OpenSim.Region.Scenes.ScenePresence avatar = new Avatar( client, this, m_regionInfo ); + OpenSim.Region.Environment.Scenes.ScenePresence avatar = new Avatar( client, this, m_regionInfo ); } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index e1465d1..8c1e965 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -6,13 +6,14 @@ using OpenSim.GridInterfaces.Local; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Assets; using libsecondlife; -using OpenSim.Servers; using OpenSim.Framework; -using OpenSim.Caches; -using OpenGrid.Framework.Communications; -using OpenSim.LocalCommunications; +using OpenSim.Region.Caches; +using OpenSim.Framework.Communications; +using OpenSim.Region.Communications.Local; +using OpenSim.Region.ClientStack; namespace SimpleApp { diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 5129be2..8a62af4 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {24B12448-0000-0000-0000-000000000000} Debug AnyCPU - + + SimpleApp @@ -15,9 +16,11 @@ IE50 false Exe - + + SimpleApp - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,30 +61,27 @@ False False 4 - + + - + ..\..\..\..\bin\libsecondlife.dll False - - OpenSim.Servers.dll - False - - + System.dll False - + ..\..\..\..\bin\System.Data.dll False - + System.Xml.dll False - + ..\..\..\..\bin\XMLRPC.dll False @@ -88,49 +91,51 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + + + {2CC71860-0000-0000-0000-000000000000} + OpenSim.Framework.Servers OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.ClientStack {DC3698B2-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + + + {EB3A1BA8-0000-0000-0000-000000000000} + OpenSim.Region.Communications.Local OpenSim.Region.GridInterfaces.Local {241A8CDD-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.LocalCommunications - {EB3A1BA8-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - - OpenSim.Region.Simulation + + OpenSim.Region.Environment {C0DAB338-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -151,4 +156,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Region/LocalCommunications/CommunicationsLocal.cs b/OpenSim/Region/LocalCommunications/CommunicationsLocal.cs deleted file mode 100644 index 743b9b4..0000000 --- a/OpenSim/Region/LocalCommunications/CommunicationsLocal.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenGrid.Framework.Communications; - - -namespace OpenSim.LocalCommunications -{ - public class CommunicationsLocal : CommunicationsManager - { - public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); - public LocalUserServices UserServices; - - public CommunicationsLocal(NetworkServersInfo serversInfo) - : base(serversInfo) - { - UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY); - UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll"); - UserServer = UserServices; - GridServer = SandBoxServices; - InterRegion = SandBoxServices; - } - - internal void InformRegionOfLogin(ulong regionHandle, Login login) - { - this.SandBoxServices.AddNewSession(regionHandle, login); - } - } -} diff --git a/OpenSim/Region/LocalCommunications/LocalBackEndServices.cs b/OpenSim/Region/LocalCommunications/LocalBackEndServices.cs deleted file mode 100644 index ce48c6e..0000000 --- a/OpenSim/Region/LocalCommunications/LocalBackEndServices.cs +++ /dev/null @@ -1,209 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenGrid.Framework.Communications; -using libsecondlife; -using OpenSim.Framework.Types; -using OpenSim.Framework; - -namespace OpenSim.LocalCommunications -{ - - public class LocalBackEndServices : IGridServices, IInterRegionCommunications - { - protected Dictionary regions = new Dictionary(); - protected Dictionary regionHosts = new Dictionary(); - - public LocalBackEndServices() - { - - } - - /// - /// Register a region method with the BackEnd Services. - /// - /// - /// - public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) - { - //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); - if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) - { - //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); - this.regions.Add(regionInfo.RegionHandle, regionInfo); - RegionCommsListener regionHost = new RegionCommsListener(); - this.regionHosts.Add(regionInfo.RegionHandle, regionHost); - - return regionHost; - } - - //already in our list of regions so for now lets return null - return null; - } - - /// - /// - /// - /// - public List RequestNeighbours(RegionInfo regionInfo) - { - // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); - List neighbours = new List(); - - foreach (RegionInfo reg in this.regions.Values) - { - // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); - if (reg.RegionHandle != regionInfo.RegionHandle) - { - //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); - if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) - { - if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) - { - neighbours.Add(reg); - } - } - } - } - return neighbours; - } - - /// - /// - /// - /// - /// - public RegionInfo RequestNeighbourInfo(ulong regionHandle) - { - if (this.regions.ContainsKey(regionHandle)) - { - return this.regions[regionHandle]; - } - return null; - } - - /// - /// - /// - /// - /// - /// - /// - /// - public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) - { - List mapBlocks = new List(); - foreach(RegionInfo regInfo in this.regions.Values) - { - if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) - { - MapBlockData map = new MapBlockData(); - map.Name = regInfo.RegionName; - map.X = (ushort)regInfo.RegionLocX; - map.Y = (ushort)regInfo.RegionLocY; - map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; - map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); - map.Agents = 1; - map.RegionFlags = 72458694; - map.Access = 13; - mapBlocks.Add(map); - } - } - return mapBlocks; - } - - /// - /// - /// - /// - /// - public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData - { - //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); - if (this.regionHosts.ContainsKey(regionHandle)) - { - // Console.WriteLine("CommsManager- Informing a region to expect child agent"); - this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); - return true; - } - return false; - } - - /// - /// - /// - /// - /// - /// - /// - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) - { - if (this.regionHosts.ContainsKey(regionHandle)) - { - // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); - this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); - return true; - } - return false; - } - - /// - /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session - /// - /// - /// - /// - public bool AddNewSession(ulong regionHandle, Login loginData) - { - //Console.WriteLine(" comms manager been told to expect new user"); - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = loginData.Agent; - agent.firstname = loginData.First; - agent.lastname = loginData.Last; - agent.SessionID = loginData.Session; - agent.SecureSessionID = loginData.SecureSession; - agent.circuitcode = loginData.CircuitCode; - agent.BaseFolder = loginData.BaseFolder; - agent.InventoryFolder = loginData.InventoryFolder; - agent.startpos = new LLVector3(128, 128, 70); - agent.CapsPath = loginData.CapsPath; - - if (this.regionHosts.ContainsKey(regionHandle)) - { - this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); - return true; - } - - // region not found - return false; - } - } -} - diff --git a/OpenSim/Region/LocalCommunications/LocalUserServices.cs b/OpenSim/Region/LocalCommunications/LocalUserServices.cs deleted file mode 100644 index a7f7aa4..0000000 --- a/OpenSim/Region/LocalCommunications/LocalUserServices.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; - -using OpenGrid.Framework.Communications; -//using OpenSim.Framework.User; -using OpenGrid.Framework.UserManagement; -using OpenGrid.Framework.Data; -using OpenSim.Framework.Types; -using OpenSim.Framework.Utilities; - -using libsecondlife; - -namespace OpenSim.LocalCommunications -{ - public class LocalUserServices : UserManagerBase, IUserServices - { - private CommunicationsLocal m_Parent; - - private uint defaultHomeX ; - private uint defaultHomeY; - public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) - { - m_Parent = parent; - defaultHomeX = defHomeX; - defaultHomeY = defHomeY; - } - - public UserProfileData GetUserProfile(string firstName, string lastName) - { - return GetUserProfile(firstName + " " + lastName); - } - - public UserProfileData GetUserProfile(string name) - { - return this.getUserProfile(name); - } - public UserProfileData GetUserProfile(LLUUID avatarID) - { - return this.getUserProfile(avatarID); - } - - /// - /// - /// - /// - public override string GetMessage() - { - return "Welcome to OpenSim"; - } - - public override UserProfileData GetTheUser(string firstname, string lastname) - { - UserProfileData profile = getUserProfile(firstname, lastname); - if (profile != null) - { - - return profile; - } - - //no current user account so make one - Console.WriteLine("No User account found so creating a new one "); - this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); - - profile = getUserProfile(firstname, lastname); - - return profile; - } - - public override bool AuthenticateUser(ref UserProfileData profile, string password) - { - //for now we will accept any password in sandbox mode - Console.WriteLine("authorising user"); - return true; - } - - public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) - { - ulong currentRegion = theUser.currentAgent.currentHandle; - RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); - - - if (reg != null) - { - response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + - "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + - "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; - string capsPath = Util.GetRandomCapsPath(); - response.SimAddress = reg.CommsIPListenAddr; - response.SimPort = (Int32)reg.CommsIPListenPort; - response.RegionX = reg.RegionLocX ; - response.RegionY = reg.RegionLocY ; - response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/"; - theUser.currentAgent.currentRegion = reg.SimUUID; - theUser.currentAgent.currentHandle = reg.RegionHandle; - - Login _login = new Login(); - //copy data to login object - _login.First = response.Firstname; - _login.Last = response.Lastname; - _login.Agent = response.AgentID; - _login.Session = response.SessionID; - _login.SecureSession = response.SecureSessionID; - _login.CircuitCode = (uint)response.CircuitCode; - _login.CapsPath = capsPath; - - m_Parent.InformRegionOfLogin(currentRegion, _login); - } - else - { - Console.WriteLine("not found region " + currentRegion); - } - - } - - } -} diff --git a/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj b/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj deleted file mode 100644 index 6b2b78c..0000000 --- a/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj +++ /dev/null @@ -1,121 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {EB3A1BA8-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.LocalCommunications - JScript - Grid - IE50 - false - Library - - OpenSim.Region.LocalCommunications - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Data - {36B72A9B-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.UserManagement - {586E2916-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user b/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/LocalCommunications/OpenSim.Region.LocalCommunications.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs b/OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs deleted file mode 100644 index 8e6e711..0000000 --- a/OpenSim/Region/LocalCommunications/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.LocalCommunications")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.LocalCommunications")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Simulation/Caps.cs b/OpenSim/Region/Simulation/Caps.cs index 13a351d..9edbd54 100644 --- a/OpenSim/Region/Simulation/Caps.cs +++ b/OpenSim/Region/Simulation/Caps.cs @@ -4,14 +4,14 @@ using System.Collections.Generic; using System.Text; using System.IO; using System.Xml; -using OpenSim.Servers; +using OpenSim.Framework.Servers; using OpenSim.Framework; using OpenSim.Framework.Utilities; using OpenSim.Framework.Types; -using OpenSim.Caches; +using OpenSim.Region.Caches; using libsecondlife; -namespace OpenSim.Region +namespace OpenSim.Region.Environment { public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); diff --git a/OpenSim/Region/Simulation/EstateManager.cs b/OpenSim/Region/Simulation/EstateManager.cs index dcb5564..c2c1ecf 100644 --- a/OpenSim/Region/Simulation/EstateManager.cs +++ b/OpenSim/Region/Simulation/EstateManager.cs @@ -30,15 +30,15 @@ using System.Collections.Generic; using System.Text; using OpenSim.Framework.Types; using OpenSim.Framework.Interfaces; -using OpenSim.Region; -using OpenSim.Region.Scenes; +using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; using OpenSim; using libsecondlife; using libsecondlife.Packets; -using Avatar = OpenSim.Region.Scenes.ScenePresence; +using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; -namespace OpenSim.Region +namespace OpenSim.Region.Environment { /// diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj new file mode 100644 index 0000000..0597857 --- /dev/null +++ b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj @@ -0,0 +1,218 @@ + + + Local + 8.0.50727 + 2.0 + {C0DAB338-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + OpenSim.Region.Environment + JScript + Grid + IE50 + false + Library + + + OpenSim.Region.Environment + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + + ..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.GenericConfig.Xml + {C74E4A30-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Terrain.BasicTerrain + {C9E0F891-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + \ No newline at end of file diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj b/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj deleted file mode 100644 index 7811a55..0000000 --- a/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj +++ /dev/null @@ -1,211 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {C0DAB338-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Simulation - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Simulation - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.GenericConfig.Xml - {C74E4A30-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Terrain.BasicTerrain - {C9E0F891-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user b/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Simulation/OpenSim.Region.Simulation.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Simulation/ParcelManager.cs b/OpenSim/Region/Simulation/ParcelManager.cs index d15d77d..1cab4ab 100644 --- a/OpenSim/Region/Simulation/ParcelManager.cs +++ b/OpenSim/Region/Simulation/ParcelManager.cs @@ -32,10 +32,10 @@ using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Region.Scenes; -using Avatar = OpenSim.Region.Scenes.ScenePresence; +using OpenSim.Region.Environment.Scenes; +using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; -namespace OpenSim.Region +namespace OpenSim.Region.Environment { @@ -420,7 +420,7 @@ namespace OpenSim.Region { for (y = 0; y < inc_y; y++) { - OpenSim.Region.Parcel currentParcel = getParcel(start_x + x, start_y + y); + OpenSim.Region.Environment.Parcel currentParcel = getParcel(start_x + x, start_y + y); if (!temp.Contains(currentParcel)) { currentParcel.forceUpdateParcelInfo(); diff --git a/OpenSim/Region/Simulation/RegionManager.cs b/OpenSim/Region/Simulation/RegionManager.cs index a317f0f..17d9aad 100644 --- a/OpenSim/Region/Simulation/RegionManager.cs +++ b/OpenSim/Region/Simulation/RegionManager.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Text; -using OpenGrid.Framework.Communications; +using OpenSim.Framework.Communications; using OpenSim.Framework; using OpenSim.Framework.Types; -using OpenSim.Servers; +using OpenSim.Framework.Servers; -namespace OpenSim.Region +namespace OpenSim.Region.Environment { public class RegionManager //needs renaming , but first we need to rename the namespace { diff --git a/OpenSim/Region/Simulation/Scenes/Entity.cs b/OpenSim/Region/Simulation/Scenes/Entity.cs index f8754f5..bbba34d 100644 --- a/OpenSim/Region/Simulation/Scenes/Entity.cs +++ b/OpenSim/Region/Simulation/Scenes/Entity.cs @@ -31,9 +31,9 @@ using System.Text; using Axiom.MathLib; using OpenSim.Physics.Manager; using libsecondlife; -using OpenSim.Region.Scripting; +using OpenSim.Region.Environment.Scripting; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public abstract class Entity : IScriptReadonlyEntity { diff --git a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs index 65077e6..36023d0 100644 --- a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs +++ b/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs @@ -7,7 +7,7 @@ using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public interface IScenePresenceBody { diff --git a/OpenSim/Region/Simulation/Scenes/Primitive.cs b/OpenSim/Region/Simulation/Scenes/Primitive.cs index e04c711..0f649b2 100644 --- a/OpenSim/Region/Simulation/Scenes/Primitive.cs +++ b/OpenSim/Region/Simulation/Scenes/Primitive.cs @@ -36,7 +36,7 @@ using OpenSim.Physics.Manager; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public class Primitive : Entity { @@ -174,9 +174,9 @@ namespace OpenSim.Region.Scenes dataArrays.Add(primData.ToBytes()); foreach (Entity child in children) { - if (child is OpenSim.Region.Scenes.Primitive) + if (child is OpenSim.Region.Environment.Scenes.Primitive) { - dataArrays.Add(((OpenSim.Region.Scenes.Primitive)child).GetByteArray()); + dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray()); } } byte[] primstart = Helpers.StringToField(""); diff --git a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs index d1a2717..1d55c4d 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public partial class Scene { @@ -218,7 +218,7 @@ namespace OpenSim.Region.Scenes { if (ent.LocalId == primLocalID) { - ((OpenSim.Region.Scenes.Primitive)ent).GetProperites(remoteClient); + ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient); break; } } @@ -266,7 +266,7 @@ namespace OpenSim.Region.Scenes { if (ent.LocalId == localID) { - ((OpenSim.Region.Scenes.Primitive)ent).UpdatePosition(pos); + ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos); break; } } diff --git a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs b/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs index 7b53388..2249c3d 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs +++ b/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs @@ -35,7 +35,7 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using libsecondlife; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public partial class Scene { diff --git a/OpenSim/Region/Simulation/Scenes/Scene.cs b/OpenSim/Region/Simulation/Scenes/Scene.cs index bf2244e..7e56296 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.cs +++ b/OpenSim/Region/Simulation/Scenes/Scene.cs @@ -39,14 +39,14 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework; -using OpenSim.Region.Scripting; +using OpenSim.Region.Environment.Scripting; using OpenSim.Terrain; -using OpenGrid.Framework.Communications; -using OpenSim.Caches; -using OpenSim.Region; -using OpenSim.Servers; +using OpenSim.Framework.Communications; +using OpenSim.Region.Caches; +using OpenSim.Region.Environment; +using OpenSim.Framework.Servers; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public delegate bool FilterAvatarList(ScenePresence avatar); @@ -256,7 +256,7 @@ namespace OpenSim.Region.Scenes //Parcel backup routines ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; int i = 0; - foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) + foreach (OpenSim.Region.Environment.Parcel parcel in parcelManager.parcelList.Values) { parcels[i] = parcel.parcelData; i++; diff --git a/OpenSim/Region/Simulation/Scenes/SceneBase.cs b/OpenSim/Region/Simulation/Scenes/SceneBase.cs index 4dbd374..ecd14de 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneBase.cs +++ b/OpenSim/Region/Simulation/Scenes/SceneBase.cs @@ -37,11 +37,11 @@ using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; -using OpenSim.Region.Scripting; +using OpenSim.Region.Environment.Scripting; using OpenSim.Terrain; -using OpenSim.Caches; +using OpenSim.Region.Caches; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public abstract class SceneBase : IWorld { diff --git a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs b/OpenSim/Region/Simulation/Scenes/SceneEvents.cs index 2898578..fa1bacb 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Simulation/Scenes/SceneEvents.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { /// /// A class for triggering remote scene events. diff --git a/OpenSim/Region/Simulation/Scenes/SceneObject.cs b/OpenSim/Region/Simulation/Scenes/SceneObject.cs index 5df87bf..88fb160 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneObject.cs +++ b/OpenSim/Region/Simulation/Scenes/SceneObject.cs @@ -35,7 +35,7 @@ using OpenSim.Physics.Manager; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public class SceneObject : Entity { diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs index f0a8721..2caabc2 100644 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs +++ b/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs @@ -31,7 +31,7 @@ using System.Text; using libsecondlife; using System.Xml; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { partial class ScenePresence { @@ -66,7 +66,7 @@ namespace OpenSim.Region.Scenes // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); - foreach (KeyValuePair kp in OpenSim.Region.Scenes.ScenePresence.Animations.AnimsLLUUID) + foreach (KeyValuePair kp in OpenSim.Region.Environment.Scenes.ScenePresence.Animations.AnimsLLUUID) { AnimsNames.Add(kp.Value, kp.Key); } diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs index d21b11f..2c81d2a 100644 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs +++ b/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs @@ -34,7 +34,7 @@ using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { partial class ScenePresence { diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.cs index 45d3fed..96e5c94 100644 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Simulation/Scenes/ScenePresence.cs @@ -37,7 +37,7 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using Axiom.MathLib; -namespace OpenSim.Region.Scenes +namespace OpenSim.Region.Environment.Scenes { public partial class ScenePresence : Entity { diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs index daa1b92..eb8a117 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs +++ b/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Text; using libsecondlife; -namespace OpenSim.Region.Scripting +namespace OpenSim.Region.Environment.Scripting { public interface IScriptContext { diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs index 44b886f..e813626 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs +++ b/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Text; using libsecondlife; -namespace OpenSim.Region.Scripting +namespace OpenSim.Region.Environment.Scripting { public interface IScriptReadonlyEntity { diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs index 797998d..115b4f4 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs +++ b/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs @@ -30,12 +30,12 @@ using System.Collections.Generic; using System.Text; using libsecondlife; using OpenSim.Physics.Manager; -using OpenSim.Region; -using OpenSim.Region.Scenes; -using Avatar=OpenSim.Region.Scenes.ScenePresence; -using Primitive = OpenSim.Region.Scenes.Primitive; +using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; +using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; +using Primitive = OpenSim.Region.Environment.Scenes.Primitive; -namespace OpenSim.Region.Scripting +namespace OpenSim.Region.Environment.Scripting { public delegate void ScriptEventHandler(IScriptContext context); diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs b/OpenSim/Region/Simulation/Scenes/scripting/Script.cs index 1d01f3c..5d398b0 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs +++ b/OpenSim/Region/Simulation/Scenes/scripting/Script.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Text; using libsecondlife; -namespace OpenSim.Region.Scripting +namespace OpenSim.Region.Environment.Scripting { public class Script { diff --git a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs b/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs index 32ef046..0ce65ea 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs +++ b/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Region.Scripting +namespace OpenSim.Region.Environment.Scripting { public delegate Script ScriptFactory(); } diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs index 21f07a8..90c79e3 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs +++ b/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Text; using libsecondlife; -namespace OpenSim.Region.Scripting +namespace OpenSim.Region.Environment.Scripting { public class FollowRandomAvatar : Script { diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs index ab3c34c..3bc6f25 100644 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs @@ -39,7 +39,7 @@ using BerkeleyDb; using Kds.Serialization; using Kds.Serialization.Buffer; -namespace OpenSim.Storage.LocalStorageBDB +namespace OpenSim.Region.Storage.LocalStorageBDB { public class BDBLocalStorage : ILocalStorage { diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs index 8e6b04d..5cb4861 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Console; -namespace OpenSim.Storage.LocalStorageDb4o +namespace OpenSim.Region.Storage.LocalStorageDb4o { /// /// diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs index 56387ac..22f3392 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Storage.LocalStorageDb4o +namespace OpenSim.Region.Storage.LocalStorageDb4o { public class MapStorage { diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs index d24fb5f..dcbe639 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs @@ -34,7 +34,7 @@ using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -namespace OpenSim.Storage.LocalStorageDb4o +namespace OpenSim.Region.Storage.LocalStorageDb4o { public class UUIDParcelQuery : Predicate { diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs index b2e8a91..23de6dd 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs @@ -34,7 +34,7 @@ using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -namespace OpenSim.Storage.LocalStorageDb4o +namespace OpenSim.Region.Storage.LocalStorageDb4o { public class UUIDPrimQuery : Predicate { diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs index b45debf..80158d5 100644 --- a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs @@ -32,11 +32,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Storage.LocalStorageSQLite")] +[assembly: AssemblyTitle("OpenSim.Region.Storage.LocalStorageSQLite")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Storage.LocalStorageSQLite")] +[assembly: AssemblyProduct("OpenSim.Region.Storage.LocalStorageSQLite")] [assembly: AssemblyCopyright("Copyright © 2007")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs index 8a7893e..b407be4 100644 --- a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs @@ -37,7 +37,7 @@ using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -namespace OpenSim.Storage.LocalStorageSQLite +namespace OpenSim.Region.Storage.LocalStorageSQLite { public class SQLiteLocalStorage : ILocalStorage { -- cgit v1.1 From e392e222a83ee04ee25c00e26dfad5f47ffa69b8 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 16:55:27 +0000 Subject: *Added some missing files I forgot to add...OpenSim.sln should compile now --- .../Communications/Local/CommunicationsLocal.cs | 61 +++++ .../Communications/Local/LocalBackEndServices.cs | 209 +++++++++++++++++ .../Communications/Local/LocalUserServices.cs | 118 ++++++++++ .../OpenSim.Region.Communications.Local.csproj | 128 +++++++++++ .../Local/Properties/AssemblyInfo.cs | 35 +++ .../Region/Communications/OGS1/GridCommsManager.cs | 18 ++ .../Region/Communications/OGS1/OGS1GridServices.cs | 248 +++++++++++++++++++++ .../Region/Communications/OGS1/OGSInterSimComms.cs | 70 ++++++ .../Region/Communications/OGS1/OGSUserServices.cs | 25 +++ .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 149 +++++++++++++ .../Communications/OGS1/Properties/AssemblyInfo.cs | 35 +++ 11 files changed, 1096 insertions(+) create mode 100644 OpenSim/Region/Communications/Local/CommunicationsLocal.cs create mode 100644 OpenSim/Region/Communications/Local/LocalBackEndServices.cs create mode 100644 OpenSim/Region/Communications/Local/LocalUserServices.cs create mode 100644 OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj create mode 100644 OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Communications/OGS1/GridCommsManager.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGS1GridServices.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGSUserServices.cs create mode 100644 OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj create mode 100644 OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs new file mode 100644 index 0000000..c98cd11 --- /dev/null +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -0,0 +1,61 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; + + +namespace OpenSim.Region.Communications.Local +{ + public class CommunicationsLocal : CommunicationsManager + { + public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); + public LocalUserServices UserServices; + + public CommunicationsLocal(NetworkServersInfo serversInfo) + : base(serversInfo) + { + UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY); + UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll"); + UserServer = UserServices; + GridServer = SandBoxServices; + InterRegion = SandBoxServices; + } + + internal void InformRegionOfLogin(ulong regionHandle, Login login) + { + this.SandBoxServices.AddNewSession(regionHandle, login); + } + } +} diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs new file mode 100644 index 0000000..ae47890 --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -0,0 +1,209 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Types; +using OpenSim.Framework; +using OpenSim.Framework.Communications; + +namespace OpenSim.Region.Communications.Local +{ + + public class LocalBackEndServices : IGridServices, IInterRegionCommunications + { + protected Dictionary regions = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); + + public LocalBackEndServices() + { + + } + + /// + /// Register a region method with the BackEnd Services. + /// + /// + /// + public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + { + //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); + this.regions.Add(regionInfo.RegionHandle, regionInfo); + RegionCommsListener regionHost = new RegionCommsListener(); + this.regionHosts.Add(regionInfo.RegionHandle, regionHost); + + return regionHost; + } + + //already in our list of regions so for now lets return null + return null; + } + + /// + /// + /// + /// + public List RequestNeighbours(RegionInfo regionInfo) + { + // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); + List neighbours = new List(); + + foreach (RegionInfo reg in this.regions.Values) + { + // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); + if (reg.RegionHandle != regionInfo.RegionHandle) + { + //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); + if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) + { + if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) + { + neighbours.Add(reg); + } + } + } + } + return neighbours; + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + if (this.regions.ContainsKey(regionHandle)) + { + return this.regions[regionHandle]; + } + return null; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + List mapBlocks = new List(); + foreach(RegionInfo regInfo in this.regions.Values) + { + if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) + { + MapBlockData map = new MapBlockData(); + map.Name = regInfo.RegionName; + map.X = (ushort)regInfo.RegionLocX; + map.Y = (ushort)regInfo.RegionLocY; + map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; + map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); + map.Agents = 1; + map.RegionFlags = 72458694; + map.Access = 13; + mapBlocks.Add(map); + } + } + return mapBlocks; + } + + /// + /// + /// + /// + /// + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect child agent"); + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + /// + /// + /// + /// + /// + /// + /// + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); + this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + + /// + /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session + /// + /// + /// + /// + public bool AddNewSession(ulong regionHandle, Login loginData) + { + //Console.WriteLine(" comms manager been told to expect new user"); + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + agent.CapsPath = loginData.CapsPath; + + if (this.regionHosts.ContainsKey(regionHandle)) + { + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); + return true; + } + + // region not found + return false; + } + } +} + diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs new file mode 100644 index 0000000..1eb574c --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework.Communications; +//using OpenSim.Framework.User; +using OpenSim.Framework.UserManagement; +using OpenSim.Framework.Data; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; + +using libsecondlife; + +namespace OpenSim.Region.Communications.Local +{ + public class LocalUserServices : UserManagerBase, IUserServices + { + private CommunicationsLocal m_Parent; + + private uint defaultHomeX ; + private uint defaultHomeY; + public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) + { + m_Parent = parent; + defaultHomeX = defHomeX; + defaultHomeY = defHomeY; + } + + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return GetUserProfile(firstName + " " + lastName); + } + + public UserProfileData GetUserProfile(string name) + { + return this.getUserProfile(name); + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + return this.getUserProfile(avatarID); + } + + /// + /// + /// + /// + public override string GetMessage() + { + return "Welcome to OpenSim"; + } + + public override UserProfileData GetTheUser(string firstname, string lastname) + { + UserProfileData profile = getUserProfile(firstname, lastname); + if (profile != null) + { + + return profile; + } + + //no current user account so make one + Console.WriteLine("No User account found so creating a new one "); + this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); + + profile = getUserProfile(firstname, lastname); + + return profile; + } + + public override bool AuthenticateUser(ref UserProfileData profile, string password) + { + //for now we will accept any password in sandbox mode + Console.WriteLine("authorising user"); + return true; + } + + public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) + { + ulong currentRegion = theUser.currentAgent.currentHandle; + RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); + + + if (reg != null) + { + response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; + string capsPath = Util.GetRandomCapsPath(); + response.SimAddress = reg.CommsIPListenAddr; + response.SimPort = (Int32)reg.CommsIPListenPort; + response.RegionX = reg.RegionLocX ; + response.RegionY = reg.RegionLocY ; + response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/"; + theUser.currentAgent.currentRegion = reg.SimUUID; + theUser.currentAgent.currentHandle = reg.RegionHandle; + + Login _login = new Login(); + //copy data to login object + _login.First = response.Firstname; + _login.Last = response.Lastname; + _login.Agent = response.AgentID; + _login.Session = response.SessionID; + _login.SecureSession = response.SecureSessionID; + _login.CircuitCode = (uint)response.CircuitCode; + _login.CapsPath = capsPath; + + m_Parent.InformRegionOfLogin(currentRegion, _login); + } + else + { + Console.WriteLine("not found region " + currentRegion); + } + + } + + } +} diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj new file mode 100644 index 0000000..1a20965 --- /dev/null +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -0,0 +1,128 @@ + + + Local + 8.0.50727 + 2.0 + {EB3A1BA8-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + OpenSim.Region.Communications.Local + JScript + Grid + IE50 + false + Library + + + OpenSim.Region.Communications.Local + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Data + {36B72A9B-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.UserManagement + {586E2916-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1eb7107 --- /dev/null +++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Region.Communications.Local")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Region.Communications.Local")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Communications/OGS1/GridCommsManager.cs b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs new file mode 100644 index 0000000..77848fa --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +namespace OpenSim.Region.Communications.OGS1 +{ + public class GridCommsManager : CommunicationsManager + { + private OGS1GridServices gridInterComms = new OGS1GridServices(); + public GridCommsManager(NetworkServersInfo serversInfo) :base(serversInfo) + { + GridServer = gridInterComms; + InterRegion = gridInterComms; + UserServer = new OGSUserServices(); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs new file mode 100644 index 0000000..5f0c80c --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; + +using OpenSim.Framework.Servers; +using OpenSim.Framework; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; + +using Nwc.XmlRpc; +using libsecondlife; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1GridServices : IGridServices, IInterRegionCommunications + { + public Dictionary listeners = new Dictionary(); + public GridInfo grid; + public BaseHttpServer httpListener; + private bool initialised = false; + + public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + { + Hashtable GridParams = new Hashtable(); + + grid = gridInfo; + + // Login / Authentication + GridParams["authkey"] = gridInfo.GridServerSendKey; + GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); + GridParams["sim_ip"] = regionInfo.CommsExternalAddress; + GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString(); + + // Package into an XMLRPC Request + ArrayList SendParams = new ArrayList(); + SendParams.Add(GridParams); + + // Send Request + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); + XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); + Hashtable GridRespData = (Hashtable)GridResp.Value; + Hashtable griddatahash = GridRespData; + + // Process Response + if (GridRespData.ContainsKey("error")) + { + string errorstring = (string)GridRespData["error"]; + OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); + return null; + } + + if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) + { + // initialised = true; + httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort); + httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); + httpListener.Start(); + } + + // Initialise the background listeners + listeners[regionInfo.RegionHandle] = new RegionCommsListener(); + + return listeners[regionInfo.RegionHandle]; + } + + public List RequestNeighbours(RegionInfo regionInfo) + { + Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); + + List neighbours = new List(); + + foreach (Hashtable n in (Hashtable)respData.Values) + { + RegionInfo neighbour = new RegionInfo(); + + //OGS1 + neighbour.RegionHandle = (ulong)n["regionhandle"]; + neighbour.RegionLocX = (uint)n["x"]; + neighbour.RegionLocY = (uint)n["y"]; + neighbour.RegionName = (string)n["name"]; + + //OGS1+ + neighbour.CommsIPListenAddr = (string)n["sim_ip"]; + neighbour.CommsIPListenPort = (int)n["sim_port"]; + neighbour.CommsExternalAddress = (string)n["sim_uri"]; + neighbour.SimUUID = (string)n["uuid"]; + + neighbours.Add(neighbour); + } + + return neighbours; + } + + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); + return null; + } + + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY); + + List neighbours = new List(); + + foreach (Hashtable n in (Hashtable)respData.Values) + { + MapBlockData neighbour = new MapBlockData(); + + neighbour.X = (ushort)n["x"]; + neighbour.Y = (ushort)n["y"]; + + neighbour.Name = (string)n["name"]; + neighbour.Access = (byte)n["access"]; + neighbour.RegionFlags = (uint)n["region-flags"]; + neighbour.WaterHeight = (byte)n["water-height"]; + neighbour.MapImageId = (string)n["map-image-id"]; + + neighbours.Add(neighbour); + } + + return neighbours; + } + + /// + /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates + /// + /// REDUNDANT - OGS1 is to be phased out in favour of OGS2 + /// Minimum X value + /// Minimum Y value + /// Maximum X value + /// Maximum Y value + /// Hashtable of hashtables containing map data elements + private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) + { + Hashtable param = new Hashtable(); + param["xmin"] = minX; + param["ymin"] = minY; + param["xmax"] = maxX; + param["ymax"] = maxY; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); + XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000); + Hashtable respData = (Hashtable)resp.Value; + return respData; + } + + // Grid Request Processing + public XmlRpcResponse ExpectUser(XmlRpcRequest request) + { + Hashtable requestData = (Hashtable)request.Params[0]; + AgentCircuitData agentData = new AgentCircuitData(); + agentData.SessionID = new LLUUID((string)requestData["session_id"]); + agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); + agentData.firstname = (string)requestData["firstname"]; + agentData.lastname = (string)requestData["lastname"]; + agentData.AgentID = new LLUUID((string)requestData["agent_id"]); + agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); + if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) + { + agentData.child = true; + } + else + { + agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); + agentData.child = false; + + } + + if (listeners.ContainsKey((ulong)requestData["regionhandle"])) + { + this.listeners[(ulong)requestData["regionhandle"]].TriggerExpectUser((ulong)requestData["regionhandle"], agentData); + } + else + { + OpenSim.Framework.Console.MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); + } + + return new XmlRpcResponse(); + } + + #region InterRegion Comms + private void StartRemoting() + { + TcpChannel ch = new TcpChannel(8895); + ChannelServices.RegisterChannel(ch); + + WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); + RemotingConfiguration.RegisterWellKnownServiceType(wellType); + InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; + InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; + } + + #region Methods called by regions in this instance + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + #endregion + + #region Methods triggered by calls from external instances + public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + #endregion + #endregion + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs new file mode 100644 index 0000000..51b33e9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +namespace OpenSim.Region.Communications.OGS1 +{ + public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); + public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); + + public sealed class InterRegionSingleton + { + static readonly InterRegionSingleton instance = new InterRegionSingleton(); + + public event InformRegionChild OnChildAgent; + public event ExpectArrival OnArrival; + + static InterRegionSingleton() + { + } + + InterRegionSingleton() + { + } + + public static InterRegionSingleton Instance + { + get + { + return instance; + } + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (OnChildAgent != null) + { + return OnChildAgent(regionHandle, agentData); + } + return false; + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (OnArrival != null) + { + return OnArrival(regionHandle, agentID, position); + } + return false; + } + } + + public class OGS1InterRegionRemoting : MarshalByRefObject + { + + public OGS1InterRegionRemoting() + { + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs new file mode 100644 index 0000000..012774d --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; +using libsecondlife; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGSUserServices :IUserServices + { + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return null; + } + public UserProfileData GetUserProfile(string name) + { + return null; + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + return null; + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj new file mode 100644 index 0000000..4bda6c9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -0,0 +1,149 @@ + + + Local + 8.0.50727 + 2.0 + {6109024D-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + OpenSim.Region.Communications.OGS1 + JScript + Grid + IE50 + false + Library + + + OpenSim.Region.Communications.OGS1 + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + + False + ..\..\..\..\bin\libsecondlife.dll + + + System.dll + False + + + System.Data.dll + False + + + System.Runtime.Remoting.dll + False + + + System.Xml.dll + False + + + False + ..\..\..\..\bin\XMLRPC.dll + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Data + {36B72A9B-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0c6f965 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.1 From fe120533efd0ec6b2248d96b9a1f8b7637c5dadd Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 17:12:32 +0000 Subject: *Updated prebuild.xml and ran prebuild again *Removed .user, .suo, and unneccessary files in /bin/Physics/ *OpenSim.sln should compile with nant and on windows now --- OpenSim/Region/Application/OpenSim.csproj | 75 +++++++++++----------- OpenSim/Region/Application/OpenSim.csproj.user | 13 ---- .../Caches/OpenSim.Region.Caches.csproj.user | 12 ---- .../ClientStack/OpenSim.Region.ClientStack.csproj | 18 +++--- .../OpenSim.Region.ClientStack.csproj.user | 12 ---- .../OpenSim.Region.Communications.Local.csproj | 45 ++++++------- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 55 +++++++--------- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 61 +++++++++--------- .../Examples/SimpleApp/SimpleApp.csproj.user | 12 ---- ...OpenSim.Region.GridInterfaces.Local.csproj.user | 12 ---- ...penSim.Region.GridInterfaces.Remote.csproj.user | 12 ---- ...m.Region.Physics.BasicPhysicsPlugin.csproj.user | 12 ---- .../OpenSim.Region.Physics.Manager.csproj.user | 12 ---- .../OpenSim.Region.Physics.OdePlugin.csproj.user | 12 ---- .../OpenSim.Region.Physics.PhysXPlugin.csproj.user | 12 ---- ...gion.Storage.LocalStorageBerkeleyDB.csproj.user | 12 ---- .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +- ...Sim.Region.Storage.LocalStorageDb4o.csproj.user | 12 ---- ...m.Region.Storage.LocalStorageSQLite.csproj.user | 12 ---- ...OpenSim.Region.Terrain.BasicTerrain.csproj.user | 12 ---- 20 files changed, 120 insertions(+), 309 deletions(-) delete mode 100644 OpenSim/Region/Application/OpenSim.csproj.user delete mode 100644 OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user delete mode 100644 OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user delete mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user delete mode 100644 OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user delete mode 100644 OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user delete mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user delete mode 100644 OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user delete mode 100644 OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user delete mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user delete mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user delete mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index fcde555..d5730a4 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {438A9556-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim @@ -16,11 +15,9 @@ IE50 false Exe - - + OpenSim - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,31 +55,30 @@ False False 4 - - + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -95,82 +88,86 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.UserManagement {586E2916-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.ClientStack {DC3698B2-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - {EB3A1BA8-0000-0000-0000-000000000000} OpenSim.Region.Communications.Local + {BFB5D807-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False - {6109024D-0000-0000-0000-000000000000} OpenSim.Region.Communications.OGS1 + {4806E378-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - - OpenSim.Region.Environment + + OpenSim.Region.Simulation {C0DAB338-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - + Code - + Code @@ -181,4 +178,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Application/OpenSim.csproj.user b/OpenSim/Region/Application/OpenSim.csproj.user deleted file mode 100644 index 2ff1c4c..0000000 --- a/OpenSim/Region/Application/OpenSim.csproj.user +++ /dev/null @@ -1,13 +0,0 @@ - - - Debug - AnyCPU - -loginserver -sandbox -accounts - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user b/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 0b19359..4b5f2a7 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -126,37 +126,37 @@ - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index 1a20965..0a15a49 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -1,13 +1,12 @@ - + Local 8.0.50727 2.0 - {EB3A1BA8-0000-0000-0000-000000000000} + {BFB5D807-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region.Communications.Local @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region.Communications.Local - - + @@ -31,18 +28,16 @@ TRACE;DEBUG - - + True 4096 False - ..\..\..\bin\ + ..\..\..\..\bin\ False False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,19 +55,18 @@ False False 4 - - + - - ..\..\..\bin\libsecondlife.dll + + ..\..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False @@ -83,25 +76,25 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Data {36B72A9B-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.UserManagement {586E2916-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -125,4 +118,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 4bda6c9..8cc5641 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -1,13 +1,12 @@ - + Local 8.0.50727 2.0 - {6109024D-0000-0000-0000-000000000000} + {4806E378-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region.Communications.OGS1 @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region.Communications.OGS1 - - + @@ -31,18 +28,16 @@ TRACE;DEBUG - - + True 4096 False - ..\..\..\bin\ + ..\..\..\..\bin\ False False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,33 +55,32 @@ False False 4 - - + - - False + ..\..\..\..\bin\libsecondlife.dll + False - + System.dll False - + System.Data.dll False - + System.Runtime.Remoting.dll False - + System.Xml.dll False - - False + ..\..\..\..\bin\XMLRPC.dll + False @@ -95,31 +88,31 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Data {36B72A9B-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -146,4 +139,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 8a62af4..03805ae 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {24B12448-0000-0000-0000-000000000000} Debug AnyCPU - - + SimpleApp @@ -16,11 +15,9 @@ IE50 false Exe - - + SimpleApp - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,27 +55,26 @@ False False 4 - - + - + ..\..\..\..\bin\libsecondlife.dll False - + System.dll False - + ..\..\..\..\bin\System.Data.dll False - + System.Xml.dll False - + ..\..\..\..\bin\XMLRPC.dll False @@ -91,51 +84,55 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - {2CC71860-0000-0000-0000-000000000000} OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.ClientStack {DC3698B2-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - {EB3A1BA8-0000-0000-0000-000000000000} OpenSim.Region.Communications.Local + {BFB5D807-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False OpenSim.Region.GridInterfaces.Local {241A8CDD-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - - OpenSim.Region.Environment + + OpenSim.Region.Simulation {C0DAB338-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -156,4 +153,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 147158c..716fd57 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,9 +93,6 @@ Code - - Code - Code @@ -105,6 +102,9 @@ Code + + Code + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - -- cgit v1.1 From 1dcc814b703771c4dd96592b73727db2b54028a3 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 17:20:45 +0000 Subject: *More compile fixes (should be it on OpenSim.sln) --- OpenSim/Region/Application/OpenSim.csproj | 12 +-- .../OpenSim.Region.Communications.Local.csproj | 6 +- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 6 +- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 12 +-- .../Simulation/OpenSim.Region.Environment.csproj | 87 ++++++++++------------ 5 files changed, 58 insertions(+), 65 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index d5730a4..8e50e92 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -144,15 +144,15 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} + + OpenSim.Region.Environment + {DCBA491C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - - OpenSim.Region.Simulation - {C0DAB338-0000-0000-0000-000000000000} + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index 0a15a49..f9f6b7d 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,13 +98,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 8cc5641..1aa7019 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,16 +116,16 @@ - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 03805ae..2eb5ac0 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -122,15 +122,15 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - - OpenSim.Region.GridInterfaces.Local - {241A8CDD-0000-0000-0000-000000000000} + + OpenSim.Region.Environment + {DCBA491C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - - OpenSim.Region.Simulation - {C0DAB338-0000-0000-0000-000000000000} + + OpenSim.Region.GridInterfaces.Local + {241A8CDD-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj index 0597857..60305bd 100644 --- a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj @@ -1,13 +1,12 @@ - + Local 8.0.50727 2.0 - {C0DAB338-0000-0000-0000-000000000000} + {DCBA491C-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region.Environment @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region.Environment - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,31 +55,30 @@ False False 4 - - + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -95,53 +88,53 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - + Code @@ -150,58 +143,58 @@ Code - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code @@ -215,4 +208,4 @@ - \ No newline at end of file + -- cgit v1.1 From 9eaecabdd0884cfe17d249440badce1ecdbcc142 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 19:04:23 +0000 Subject: *Moved VersionInfo.cs to its correct place in OpenSim.csproj *Added OpenSim.Region.Caps *Updated prebuild.xml and ran prebuild --- OpenSim/Region/Application/OpenSim.csproj | 7 ++-- OpenSim/Region/Application/OpenSimMain.cs | 2 +- OpenSim/Region/Application/VersionInfo.cs | 38 ++++++++++++++++++++++ OpenSim/Region/Caps/Caps.cs | 4 +-- .../ClientStack/OpenSim.Region.ClientStack.csproj | 11 +++---- .../Region/ClientStack/RegionApplicationBase.cs | 2 +- OpenSim/Region/ClientStack/UDPServer.cs | 2 +- OpenSim/Region/ClientStack/VersionInfo.cs | 38 ---------------------- .../Simulation/OpenSim.Region.Environment.csproj | 10 +++--- OpenSim/Region/Simulation/Scenes/Scene.cs | 2 +- OpenSim/Region/Simulation/Scenes/SceneBase.cs | 2 +- .../OpenSim.Region.Terrain.BasicTerrain.csproj | 4 +-- .../Properties/AssemblyInfo.cs | 4 +-- .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 2 +- .../Region/Terrain.BasicTerrain/TerrainFilter.cs | 4 +-- 15 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 OpenSim/Region/Application/VersionInfo.cs delete mode 100644 OpenSim/Region/ClientStack/VersionInfo.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index 8e50e92..8960664 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -164,10 +164,13 @@ - + Code - + + Code + + Code diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index db4185c..e06d38c 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -40,7 +40,7 @@ using libsecondlife; using libsecondlife.Packets; using OpenSim.Region.Environment; using OpenSim.Region.Environment.Scenes; -using OpenSim.Terrain; +using OpenSim.Region.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework; diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs new file mode 100644 index 0000000..5d1354e --- /dev/null +++ b/OpenSim/Region/Application/VersionInfo.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; + +namespace OpenSim +{ + /// + /// + public class VersionInfo + { + public static string Version = "0.3, SVN build "; + } +} diff --git a/OpenSim/Region/Caps/Caps.cs b/OpenSim/Region/Caps/Caps.cs index 13a351d..414828a 100644 --- a/OpenSim/Region/Caps/Caps.cs +++ b/OpenSim/Region/Caps/Caps.cs @@ -4,11 +4,11 @@ using System.Collections.Generic; using System.Text; using System.IO; using System.Xml; -using OpenSim.Servers; +using OpenSim.Framework.Servers; using OpenSim.Framework; using OpenSim.Framework.Utilities; using OpenSim.Framework.Types; -using OpenSim.Caches; +using OpenSim.Region.Caches; using libsecondlife; namespace OpenSim.Region diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 4b5f2a7..cca7c71 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -135,9 +135,6 @@ Code - - Code - Code @@ -147,16 +144,16 @@ Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index d39adb5..94db8ee 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -37,7 +37,7 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Terrain; +using OpenSim.Region.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework; diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 33097ed..259352c 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -37,7 +37,7 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Terrain; +using OpenSim.Region.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Assets; diff --git a/OpenSim/Region/ClientStack/VersionInfo.cs b/OpenSim/Region/ClientStack/VersionInfo.cs deleted file mode 100644 index 249ca94..0000000 --- a/OpenSim/Region/ClientStack/VersionInfo.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; - -namespace OpenSim.Region.ClientStack -{ - /// - /// - public class VersionInfo - { - public static string Version = "0.3, SVN build "; - } -} diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj index 60305bd..3f8b60d 100644 --- a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj @@ -149,9 +149,6 @@ Code - - Code - Code @@ -176,10 +173,13 @@ Code - + Code - + + Code + + Code diff --git a/OpenSim/Region/Simulation/Scenes/Scene.cs b/OpenSim/Region/Simulation/Scenes/Scene.cs index 7e56296..e71f601 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.cs +++ b/OpenSim/Region/Simulation/Scenes/Scene.cs @@ -40,7 +40,7 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework; using OpenSim.Region.Environment.Scripting; -using OpenSim.Terrain; +using OpenSim.Region.Terrain; using OpenSim.Framework.Communications; using OpenSim.Region.Caches; using OpenSim.Region.Environment; diff --git a/OpenSim/Region/Simulation/Scenes/SceneBase.cs b/OpenSim/Region/Simulation/Scenes/SceneBase.cs index ecd14de..3d8f522 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneBase.cs +++ b/OpenSim/Region/Simulation/Scenes/SceneBase.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Region.Environment.Scripting; -using OpenSim.Terrain; +using OpenSim.Region.Terrain; using OpenSim.Region.Caches; namespace OpenSim.Region.Environment.Scenes diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj index 24667e5..60a2d2b 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj +++ b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj @@ -90,10 +90,10 @@ - + Code - + Code diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs index 827c68f..7d10ae3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs @@ -32,11 +32,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Terrain.BasicTerrain")] +[assembly: AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Terrain.BasicTerrain")] +[assembly: AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")] [assembly: AssemblyCopyright("Copyright © 2007")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 4f989fa..c2d7e86 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -32,7 +32,7 @@ using System.Drawing; using libTerrain; using OpenJPEGNet; -namespace OpenSim.Terrain +namespace OpenSim.Region.Terrain { public class TerrainCommand { diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs index 689375d..f04ac56 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs @@ -9,7 +9,7 @@ using Microsoft.JScript; using libTerrain; -namespace OpenSim.Terrain +namespace OpenSim.Region.Terrain { public interface ITerrainFilter { @@ -48,7 +48,7 @@ namespace OpenSim.Terrain compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("libTerrain-BSD.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Terrain.BasicTerrain.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Terrain.BasicTerrain.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); -- cgit v1.1 From 0232f01a58a3c0a88e95c22589efec21f502f081 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 19:43:46 +0000 Subject: *Moved all the classes into their own file from LLSDHelpers.cs *Some folder renaming to follow project Name *Updated prebuild.xml --- OpenSim/Region/Application/OpenSim.csproj | 2 +- OpenSim/Region/Capabilities/Caps.cs | 279 +++++++ OpenSim/Region/Capabilities/LLSDArray.cs | 45 ++ OpenSim/Region/Capabilities/LLSDCapEvent.cs | 45 ++ OpenSim/Region/Capabilities/LLSDCapsDetails.cs | 19 + OpenSim/Region/Capabilities/LLSDEmpty.cs | 42 + OpenSim/Region/Capabilities/LLSDHelpers.cs | 163 ++++ OpenSim/Region/Capabilities/LLSDMapLayer.cs | 50 ++ .../Region/Capabilities/LLSDMapLayerResponse.cs | 45 ++ OpenSim/Region/Capabilities/LLSDMapRequest.cs | 17 + OpenSim/Region/Capabilities/LLSDTest.cs | 45 ++ OpenSim/Region/Capabilities/LLSDType.cs | 53 ++ OpenSim/Region/Capabilities/LLSDUploadReply.cs | 47 ++ .../OpenSim.Region.Capabilities.csproj | 151 ++++ OpenSim/Region/Caps/Caps.cs | 258 ------ OpenSim/Region/Caps/LLSDHelpers.cs | 246 ------ .../ClientStack/OpenSim.Region.ClientStack.csproj | 4 - OpenSim/Region/Environment/EstateManager.cs | 301 +++++++ .../Environment/OpenSim.Region.Environment.csproj | 214 +++++ OpenSim/Region/Environment/ParcelManager.cs | 892 +++++++++++++++++++++ OpenSim/Region/Environment/RegionManager.cs | 31 + OpenSim/Region/Environment/Scenes/Entity.cs | 194 +++++ .../Environment/Scenes/IScenePresenceBody.cs | 19 + OpenSim/Region/Environment/Scenes/Primitive.cs | 582 ++++++++++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 305 +++++++ .../Region/Environment/Scenes/Scene.Scripting.cs | 184 +++++ OpenSim/Region/Environment/Scenes/Scene.cs | 795 ++++++++++++++++++ OpenSim/Region/Environment/Scenes/SceneBase.cs | 201 +++++ OpenSim/Region/Environment/Scenes/SceneEvents.cs | 52 ++ OpenSim/Region/Environment/Scenes/SceneObject.cs | 128 +++ .../Environment/Scenes/ScenePresence.Animations.cs | 76 ++ .../Environment/Scenes/ScenePresence.Body.cs | 90 +++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 525 ++++++++++++ .../Environment/Scenes/scripting/IScriptContext.cs | 40 + .../Environment/Scenes/scripting/IScriptEntity.cs | 46 ++ .../Environment/Scenes/scripting/IScriptHandler.cs | 126 +++ .../Region/Environment/Scenes/scripting/Script.cs | 53 ++ .../Environment/Scenes/scripting/ScriptFactory.cs | 35 + .../Scenes/scripting/Scripts/FollowRandomAvatar.cs | 64 ++ OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 2 +- OpenSim/Region/Simulation/Caps.cs | 258 ------ OpenSim/Region/Simulation/EstateManager.cs | 301 ------- .../Simulation/OpenSim.Region.Environment.csproj | 211 ----- OpenSim/Region/Simulation/ParcelManager.cs | 892 --------------------- OpenSim/Region/Simulation/RegionManager.cs | 30 - OpenSim/Region/Simulation/Scenes/Entity.cs | 194 ----- .../Region/Simulation/Scenes/IScenePresenceBody.cs | 19 - OpenSim/Region/Simulation/Scenes/Primitive.cs | 582 -------------- .../Simulation/Scenes/Scene.PacketHandlers.cs | 305 ------- .../Region/Simulation/Scenes/Scene.Scripting.cs | 184 ----- OpenSim/Region/Simulation/Scenes/Scene.cs | 795 ------------------ OpenSim/Region/Simulation/Scenes/SceneBase.cs | 201 ----- OpenSim/Region/Simulation/Scenes/SceneEvents.cs | 52 -- OpenSim/Region/Simulation/Scenes/SceneObject.cs | 128 --- .../Simulation/Scenes/ScenePresence.Animations.cs | 76 -- .../Region/Simulation/Scenes/ScenePresence.Body.cs | 90 --- OpenSim/Region/Simulation/Scenes/ScenePresence.cs | 525 ------------ .../Simulation/Scenes/scripting/IScriptContext.cs | 40 - .../Simulation/Scenes/scripting/IScriptEntity.cs | 46 -- .../Simulation/Scenes/scripting/IScriptHandler.cs | 126 --- .../Region/Simulation/Scenes/scripting/Script.cs | 53 -- .../Simulation/Scenes/scripting/ScriptFactory.cs | 35 - .../Scenes/scripting/Scripts/FollowRandomAvatar.cs | 64 -- 63 files changed, 5956 insertions(+), 5717 deletions(-) create mode 100644 OpenSim/Region/Capabilities/Caps.cs create mode 100644 OpenSim/Region/Capabilities/LLSDArray.cs create mode 100644 OpenSim/Region/Capabilities/LLSDCapEvent.cs create mode 100644 OpenSim/Region/Capabilities/LLSDCapsDetails.cs create mode 100644 OpenSim/Region/Capabilities/LLSDEmpty.cs create mode 100644 OpenSim/Region/Capabilities/LLSDHelpers.cs create mode 100644 OpenSim/Region/Capabilities/LLSDMapLayer.cs create mode 100644 OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs create mode 100644 OpenSim/Region/Capabilities/LLSDMapRequest.cs create mode 100644 OpenSim/Region/Capabilities/LLSDTest.cs create mode 100644 OpenSim/Region/Capabilities/LLSDType.cs create mode 100644 OpenSim/Region/Capabilities/LLSDUploadReply.cs create mode 100644 OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj delete mode 100644 OpenSim/Region/Caps/Caps.cs delete mode 100644 OpenSim/Region/Caps/LLSDHelpers.cs create mode 100644 OpenSim/Region/Environment/EstateManager.cs create mode 100644 OpenSim/Region/Environment/OpenSim.Region.Environment.csproj create mode 100644 OpenSim/Region/Environment/ParcelManager.cs create mode 100644 OpenSim/Region/Environment/RegionManager.cs create mode 100644 OpenSim/Region/Environment/Scenes/Entity.cs create mode 100644 OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs create mode 100644 OpenSim/Region/Environment/Scenes/Primitive.cs create mode 100644 OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs create mode 100644 OpenSim/Region/Environment/Scenes/Scene.Scripting.cs create mode 100644 OpenSim/Region/Environment/Scenes/Scene.cs create mode 100644 OpenSim/Region/Environment/Scenes/SceneBase.cs create mode 100644 OpenSim/Region/Environment/Scenes/SceneEvents.cs create mode 100644 OpenSim/Region/Environment/Scenes/SceneObject.cs create mode 100644 OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs create mode 100644 OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs create mode 100644 OpenSim/Region/Environment/Scenes/ScenePresence.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Script.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs delete mode 100644 OpenSim/Region/Simulation/Caps.cs delete mode 100644 OpenSim/Region/Simulation/EstateManager.cs delete mode 100644 OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj delete mode 100644 OpenSim/Region/Simulation/ParcelManager.cs delete mode 100644 OpenSim/Region/Simulation/RegionManager.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/Entity.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/Primitive.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/Scene.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/SceneBase.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/SceneEvents.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/SceneObject.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/ScenePresence.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/scripting/Script.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs delete mode 100644 OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index 8960664..3801067 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -144,7 +144,7 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - + OpenSim.Region.Environment {DCBA491C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs new file mode 100644 index 0000000..416a6bc --- /dev/null +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -0,0 +1,279 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using OpenSim.Framework.Servers; +using OpenSim.Framework; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Types; +using OpenSim.Region.Caches; +using libsecondlife; + +namespace OpenSim.Region.Capabilities +{ + public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); + + public class Caps + { + private string httpListenerAddress; + private uint httpListenPort; + private string capsObjectPath = "00001-"; + private string requestPath = "0000/"; + private string mapLayerPath = "0001/"; + private string newInventory = "0002/"; + private string requestTexture = "0003/"; + private string eventQueue = "0100/"; + private BaseHttpServer httpListener; + private LLUUID agentID; + private AssetCache assetCache; + private int eventQueueCount = 1; + private Queue CapsEventQueue = new Queue(); + + public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) + { + assetCache = assetCach; + capsObjectPath = capsPath; + httpListener = httpServer; + httpListenerAddress = httpListen; + httpListenPort = httpPort; + agentID = agent; + } + + /// + /// + /// + public void RegisterHandlers() + { + Console.WriteLine("registering CAPS handlers"); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); + } + + /// + /// + /// + /// + /// + /// + /// + public string CapsRequest(string request, string path, string param) + { + // Console.WriteLine("Caps Request " + request); + string result = ""; + result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); + return result; + } + + /// + /// + /// + /// + protected LLSDCapsDetails GetCapabilities() + { + /* string capURLS = ""; + capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; + capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; + //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; + //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; + return capURLS;*/ + + LLSDCapsDetails caps = new LLSDCapsDetails(); + caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; + caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; + return caps; + } + + /// + /// + /// + /// + /// + /// + /// + public string MapLayer(string request, string path, string param) + { + Encoding _enc = System.Text.Encoding.UTF8; + Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); + LLSDMapRequest mapReq = new LLSDMapRequest(); + LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); + + LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); + + //Console.WriteLine(" Maplayer response is " + res); + + return res; + } + + /// + /// + /// + /// + protected LLSDMapLayer BuildLLSDMapLayerResponse() + { + LLSDMapLayer mapLayer = new LLSDMapLayer(); + mapLayer.Right = 5000; + mapLayer.Top = 5000; + mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); + + return mapLayer; + } + + public string ProcessEventQueue(string request, string path, string param) + { + string res = ""; + + if (this.CapsEventQueue.Count > 0) + { + lock (this.CapsEventQueue) + { + string item = CapsEventQueue.Dequeue(); + res = item; + } + } + else + { + res = this.CreateEmptyEventResponse(); + } + return res; + } + + public string CreateEstablishAgentComms(string caps, string ipAddressPort) + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += "messageEstablishAgentCommunication"; + res += "body"; + res += "sim-ip-and-port" + ipAddressPort + ""; + res += "seed-capability" + caps + ""; + res += "agent-id" + this.agentID.ToStringHyphenated() + ""; + res += ""; + res += ""; + res += ""; + eventQueueCount++; + this.CapsEventQueue.Enqueue(res); + return res; + } + + public string CreateEmptyEventResponse() + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + + public string NewAgentInventory(string request, string path, string param) + { + //Console.WriteLine("received upload request:"+ request); + string res = ""; + LLUUID newAsset = LLUUID.Random(); + LLUUID newInvItem = LLUUID.Random(); + string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); + AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); + httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); + string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; + //Console.WriteLine("uploader url is " + uploaderURL); + res += ""; + res += "uploader" + uploaderURL + ""; + //res += "successtrue"; + res += "stateupload"; + res += ""; + uploader.OnUpLoad += this.UploadHandler; + return res; + } + + public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) + { + // Console.WriteLine("upload handler called"); + AssetBase asset; + asset = new AssetBase(); + asset.FullID = assetID; + asset.Type = 0; + asset.InvType = 0; + asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = data; + this.assetCache.AddAsset(asset); + } + + public class AssetUploader + { + public event UpLoadedTexture OnUpLoad; + + private string uploaderPath = ""; + private LLUUID newAssetID; + private LLUUID inventoryItemID; + private BaseHttpServer httpListener; + public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) + { + newAssetID = assetID; + inventoryItemID = inventoryItem; + uploaderPath = path; + httpListener = httpServer; + + } + + public string uploaderCaps(string request, string path, string param) + { + Encoding _enc = System.Text.Encoding.UTF8; + byte[] data = _enc.GetBytes(request); + //Console.WriteLine("recieved upload " + Util.FieldToString(data)); + LLUUID inv = this.inventoryItemID; + string res = ""; + res += ""; + res += "new_asset" + newAssetID.ToStringHyphenated() + ""; + res += "new_inventory_item" + inv.ToStringHyphenated() + ""; + res += "statecomplete"; + res += ""; + + // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); + httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); + if (OnUpLoad != null) + { + OnUpLoad(newAssetID, inv, data); + } + + /*FileStream fs = File.Create("upload.jp2"); + BinaryWriter bw = new BinaryWriter(fs); + bw.Write(data); + bw.Close(); + fs.Close();*/ + return res; + } + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDArray.cs b/OpenSim/Region/Capabilities/LLSDArray.cs new file mode 100644 index 0000000..76d5a2c --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDArray.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("ARRAY")] + public class LLSDArray + { + public ArrayList Array = new ArrayList(); + + public LLSDArray() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDCapEvent.cs b/OpenSim/Region/Capabilities/LLSDCapEvent.cs new file mode 100644 index 0000000..d47d25c --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDCapEvent.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDCapEvent + { + public int id = 0; + public LLSDArray events = new LLSDArray(); + + public LLSDCapEvent() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs new file mode 100644 index 0000000..d6db606 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDCapsDetails + { + public string MapLayer = ""; + public string NewFileAgentInventory = ""; + //public string EventQueueGet = ""; + + public LLSDCapsDetails() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDEmpty.cs b/OpenSim/Region/Capabilities/LLSDEmpty.cs new file mode 100644 index 0000000..68f1ce9 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDEmpty.cs @@ -0,0 +1,42 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDEmpty + { + public LLSDEmpty() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs new file mode 100644 index 0000000..80916b4 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDHelpers.cs @@ -0,0 +1,163 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using libsecondlife; + +namespace OpenSim.Region.Capabilities +{ + public class LLSDHelpers + { + public static string SerialiseLLSDReply(object obj) + { + StringWriter sw = new StringWriter(); + XmlTextWriter writer = new XmlTextWriter(sw); + writer.Formatting = Formatting.None; + writer.WriteStartElement(String.Empty, "llsd", String.Empty); + LLSDHelpers.SerializeLLSDType(writer, obj); + writer.WriteEndElement(); + writer.Close(); + return sw.ToString(); + } + + public static void SerializeLLSDType(XmlTextWriter writer, object obj) + { + Type myType = obj.GetType(); + LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); + if (llsdattributes.Length > 0) + { + switch (llsdattributes[0].ObjectType) + { + case "MAP": + writer.WriteStartElement(String.Empty, "map", String.Empty); + System.Reflection.FieldInfo[] fields = myType.GetFields(); + for (int i = 0; i < fields.Length; i++) + { + object fieldValue = fields[i].GetValue(obj); + LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); + if (fieldAttributes.Length > 0) + { + writer.WriteStartElement(String.Empty, "key", String.Empty); + writer.WriteString(fields[i].Name); + writer.WriteEndElement(); + SerializeLLSDType(writer, fieldValue); + } + else + { + //Console.WriteLine("LLSD field name" + fields[i].Name + " , " + fields[i].GetValue(obj).GetType()); + writer.WriteStartElement(String.Empty, "key", String.Empty); + writer.WriteString(fields[i].Name); + writer.WriteEndElement(); + LLSD.LLSDWriteOne(writer, fieldValue); + } + } + writer.WriteEndElement(); + break; + case "ARRAY": + // LLSDArray arrayObject = obj as LLSDArray; + // ArrayList a = arrayObject.Array; + ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); + writer.WriteStartElement(String.Empty, "array", String.Empty); + foreach (object item in a) + { + SerializeLLSDType(writer, item); + } + writer.WriteEndElement(); + break; + } + } + else + { + LLSD.LLSDWriteOne(writer, obj); + } + } + + public static object DeserialiseLLSDMap(Hashtable llsd, object obj) + { + Type myType = obj.GetType(); + LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); + if (llsdattributes.Length > 0) + { + switch (llsdattributes[0].ObjectType) + { + case "MAP": + IDictionaryEnumerator enumerator = llsd.GetEnumerator(); + while (enumerator.MoveNext()) + { + System.Reflection.FieldInfo field = myType.GetField((string)enumerator.Key); + if (field != null) + { + if (enumerator.Value is Hashtable) + { + object fieldValue = field.GetValue(obj); + DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); + } + else if (enumerator.Value is ArrayList) + { + object fieldValue = field.GetValue(obj); + fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); + //TODO + // the LLSD map/array types in the array need to be deserialised + // but first we need to know the right class to deserialise them into. + } + else + { + field.SetValue(obj, enumerator.Value); + } + } + } + break; + } + } + return obj; + } + } + + + + + + + + + + + + + + + + + + + +} diff --git a/OpenSim/Region/Capabilities/LLSDMapLayer.cs b/OpenSim/Region/Capabilities/LLSDMapLayer.cs new file mode 100644 index 0000000..b097ec3 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDMapLayer.cs @@ -0,0 +1,50 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +using libsecondlife; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDMapLayer + { + public int Left = 0; + public int Right = 0; + public int Top = 0; + public int Bottom = 0; + public LLUUID ImageID = LLUUID.Zero; + + public LLSDMapLayer() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs new file mode 100644 index 0000000..ee37a5b --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDMapLayerResponse + { + public LLSDMapRequest AgentData = new LLSDMapRequest(); + public LLSDArray LayerData = new LLSDArray(); + + public LLSDMapLayerResponse() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDMapRequest.cs b/OpenSim/Region/Capabilities/LLSDMapRequest.cs new file mode 100644 index 0000000..b15f1be --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDMapRequest.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDMapRequest + { + public int Flags = 0; + + public LLSDMapRequest() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDTest.cs b/OpenSim/Region/Capabilities/LLSDTest.cs new file mode 100644 index 0000000..3948f2c --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDTest.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDTest + { + public int Test1 = 20; + public int Test2 = 10; + + public LLSDTest() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Region/Capabilities/LLSDType.cs new file mode 100644 index 0000000..7da5861 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDType.cs @@ -0,0 +1,53 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + [AttributeUsage(AttributeTargets.Class)] + public class LLSDType : Attribute + { + private string myType; + + public LLSDType(string type) + { + myType = type; + + } + + public string ObjectType + { + get + { + return myType; + } + } + } +} diff --git a/OpenSim/Region/Capabilities/LLSDUploadReply.cs b/OpenSim/Region/Capabilities/LLSDUploadReply.cs new file mode 100644 index 0000000..83cf166 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDUploadReply.cs @@ -0,0 +1,47 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +using libsecondlife; +namespace OpenSim.Region.Capabilities +{ + [LLSDType("MAP")] + public class LLSDUploadReply + { + public string new_asset = ""; + public LLUUID new_inventory_item = LLUUID.Zero; + public string state = ""; + + public LLSDUploadReply() + { + + } + } +} diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj new file mode 100644 index 0000000..0d8fac5 --- /dev/null +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -0,0 +1,151 @@ + + + Local + 8.0.50727 + 2.0 + {39038E85-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Capabilities + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Capabilities + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\libsecondlife.dll + False + + + OpenSim.Framework.Types.dll + False + + + OpenSim.Framework.Utilities.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Caps/Caps.cs b/OpenSim/Region/Caps/Caps.cs deleted file mode 100644 index 414828a..0000000 --- a/OpenSim/Region/Caps/Caps.cs +++ /dev/null @@ -1,258 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using OpenSim.Framework.Servers; -using OpenSim.Framework; -using OpenSim.Framework.Utilities; -using OpenSim.Framework.Types; -using OpenSim.Region.Caches; -using libsecondlife; - -namespace OpenSim.Region -{ - public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); - - public class Caps - { - private string httpListenerAddress; - private uint httpListenPort; - private string capsObjectPath = "00001-"; - private string requestPath = "0000/"; - private string mapLayerPath = "0001/"; - private string newInventory = "0002/"; - private string requestTexture = "0003/"; - private string eventQueue = "0100/"; - private BaseHttpServer httpListener; - private LLUUID agentID; - private AssetCache assetCache; - private int eventQueueCount = 1; - private Queue CapsEventQueue = new Queue(); - - public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) - { - assetCache = assetCach; - capsObjectPath = capsPath; - httpListener = httpServer; - httpListenerAddress = httpListen; - httpListenPort = httpPort; - agentID = agent; - } - - /// - /// - /// - public void RegisterHandlers() - { - Console.WriteLine("registering CAPS handlers"); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); - } - - /// - /// - /// - /// - /// - /// - /// - public string CapsRequest(string request, string path, string param) - { - // Console.WriteLine("Caps Request " + request); - string result = ""; - result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); - return result; - } - - /// - /// - /// - /// - protected LLSDCapsDetails GetCapabilities() - { - /* string capURLS = ""; - capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; - capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; - //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; - //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; - return capURLS;*/ - - LLSDCapsDetails caps = new LLSDCapsDetails(); - caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; - caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; - return caps; - } - - /// - /// - /// - /// - /// - /// - /// - public string MapLayer(string request, string path, string param) - { - Encoding _enc = System.Text.Encoding.UTF8; - Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); - LLSDMapRequest mapReq = new LLSDMapRequest(); - LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); - - LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); - mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); - string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); - - //Console.WriteLine(" Maplayer response is " + res); - - return res; - } - - /// - /// - /// - /// - protected LLSDMapLayer BuildLLSDMapLayerResponse() - { - LLSDMapLayer mapLayer = new LLSDMapLayer(); - mapLayer.Right = 5000; - mapLayer.Top = 5000; - mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); - - return mapLayer; - } - - public string ProcessEventQueue(string request, string path, string param) - { - // Console.WriteLine("event queue request " + request); - string res = ""; - int timer = 0; - - /*while ((timer < 200) || (this.CapsEventQueue.Count < 1)) - { - timer++; - }*/ - if (this.CapsEventQueue.Count > 0) - { - lock (this.CapsEventQueue) - { - string item = CapsEventQueue.Dequeue(); - res = item; - } - } - else - { - res = this.CreateEmptyEventResponse(); - } - return res; - } - - public string CreateEstablishAgentComms(string caps, string ipAddressPort) - { - string res = "id" + eventQueueCount + ""; - res += "events"; - res += "messageEstablishAgentCommunication"; - res += "body"; - res += "sim-ip-and-port" + ipAddressPort + ""; - res += "seed-capability" + caps + ""; - res += "agent-id" + this.agentID.ToStringHyphenated() + ""; - res += ""; - res += ""; - res += ""; - eventQueueCount++; - this.CapsEventQueue.Enqueue(res); - return res; - } - - public string CreateEmptyEventResponse() - { - string res = "id" + eventQueueCount + ""; - res += "events"; - res += ""; - res += ""; - eventQueueCount++; - return res; - } - - public string NewAgentInventory(string request, string path, string param) - { - //Console.WriteLine("received upload request:"+ request); - string res = ""; - LLUUID newAsset = LLUUID.Random(); - LLUUID newInvItem = LLUUID.Random(); - string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); - httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); - string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; - //Console.WriteLine("uploader url is " + uploaderURL); - res += ""; - res += "uploader" + uploaderURL + ""; - //res += "successtrue"; - res += "stateupload"; - res += ""; - uploader.OnUpLoad += this.UploadHandler; - return res; - } - - public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) - { - // Console.WriteLine("upload handler called"); - AssetBase asset; - asset = new AssetBase(); - asset.FullID = assetID; - asset.Type = 0; - asset.InvType = 0; - asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); - asset.Data = data; - this.assetCache.AddAsset(asset); - } - - public class AssetUploader - { - public event UpLoadedTexture OnUpLoad; - - private string uploaderPath = ""; - private LLUUID newAssetID; - private LLUUID inventoryItemID; - private BaseHttpServer httpListener; - public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) - { - newAssetID = assetID; - inventoryItemID = inventoryItem; - uploaderPath = path; - httpListener = httpServer; - - } - - public string uploaderCaps(string request, string path, string param) - { - Encoding _enc = System.Text.Encoding.UTF8; - byte[] data = _enc.GetBytes(request); - //Console.WriteLine("recieved upload " + Util.FieldToString(data)); - LLUUID inv = this.inventoryItemID; - string res = ""; - res += ""; - res += "new_asset" + newAssetID.ToStringHyphenated() + ""; - res += "new_inventory_item" + inv.ToStringHyphenated() + ""; - res += "statecomplete"; - res += ""; - - // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); - httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); - if (OnUpLoad != null) - { - OnUpLoad(newAssetID, inv, data); - } - - /*FileStream fs = File.Create("upload.jp2"); - BinaryWriter bw = new BinaryWriter(fs); - bw.Write(data); - bw.Close(); - fs.Close();*/ - return res; - } - } - } -} diff --git a/OpenSim/Region/Caps/LLSDHelpers.cs b/OpenSim/Region/Caps/LLSDHelpers.cs deleted file mode 100644 index 051520c..0000000 --- a/OpenSim/Region/Caps/LLSDHelpers.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using libsecondlife; - -namespace OpenSim.Framework -{ - public class LLSDHelpers - { - public static string SerialiseLLSDReply(object obj) - { - StringWriter sw = new StringWriter(); - XmlTextWriter writer = new XmlTextWriter(sw); - writer.Formatting = Formatting.None; - writer.WriteStartElement(String.Empty, "llsd", String.Empty); - LLSDHelpers.SerializeLLSDType(writer, obj); - writer.WriteEndElement(); - writer.Close(); - return sw.ToString(); - } - - public static void SerializeLLSDType(XmlTextWriter writer, object obj) - { - Type myType = obj.GetType(); - LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); - if (llsdattributes.Length > 0) - { - switch (llsdattributes[0].ObjectType) - { - case "MAP": - writer.WriteStartElement(String.Empty, "map", String.Empty); - System.Reflection.FieldInfo[] fields = myType.GetFields(); - for (int i = 0; i < fields.Length; i++) - { - object fieldValue = fields[i].GetValue(obj); - LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); - if (fieldAttributes.Length > 0) - { - writer.WriteStartElement(String.Empty, "key", String.Empty); - writer.WriteString(fields[i].Name); - writer.WriteEndElement(); - SerializeLLSDType(writer, fieldValue); - } - else - { - //Console.WriteLine("LLSD field name" + fields[i].Name + " , " + fields[i].GetValue(obj).GetType()); - writer.WriteStartElement(String.Empty, "key", String.Empty); - writer.WriteString(fields[i].Name); - writer.WriteEndElement(); - LLSD.LLSDWriteOne(writer, fieldValue); - } - } - writer.WriteEndElement(); - break; - case "ARRAY": - // LLSDArray arrayObject = obj as LLSDArray; - // ArrayList a = arrayObject.Array; - ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); - writer.WriteStartElement(String.Empty, "array", String.Empty); - foreach (object item in a) - { - SerializeLLSDType(writer, item); - } - writer.WriteEndElement(); - break; - } - } - else - { - LLSD.LLSDWriteOne(writer, obj); - } - } - - public static object DeserialiseLLSDMap(Hashtable llsd, object obj) - { - Type myType = obj.GetType(); - LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); - if (llsdattributes.Length > 0) - { - switch (llsdattributes[0].ObjectType) - { - case "MAP": - IDictionaryEnumerator enumerator = llsd.GetEnumerator(); - while (enumerator.MoveNext()) - { - System.Reflection.FieldInfo field = myType.GetField((string)enumerator.Key); - if (field != null) - { - if (enumerator.Value is Hashtable) - { - object fieldValue = field.GetValue(obj); - DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); - } - else if (enumerator.Value is ArrayList) - { - object fieldValue = field.GetValue(obj); - fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); - //TODO - // the LLSD map/array types in the array need to be deserialised - // but first we need to know the right class to deserialise them into. - } - else - { - field.SetValue(obj, enumerator.Value); - } - } - } - break; - } - } - return obj; - } - } - - [LLSDType("MAP")] - public class LLSDMapLayerResponse - { - public LLSDMapRequest AgentData = new LLSDMapRequest(); - public LLSDArray LayerData = new LLSDArray(); - - public LLSDMapLayerResponse() - { - - } - } - - [LLSDType("MAP")] - public class LLSDCapsDetails - { - public string MapLayer = ""; - public string NewFileAgentInventory = ""; - //public string EventQueueGet = ""; - - public LLSDCapsDetails() - { - - } - } - - [LLSDType("MAP")] - public class LLSDMapLayer - { - public int Left = 0; - public int Right = 0; - public int Top = 0; - public int Bottom = 0; - public LLUUID ImageID = LLUUID.Zero; - - public LLSDMapLayer() - { - - } - } - - [LLSDType("ARRAY")] - public class LLSDArray - { - public ArrayList Array = new ArrayList(); - - public LLSDArray() - { - - } - } - - [LLSDType("MAP")] - public class LLSDMapRequest - { - public int Flags = 0; - - public LLSDMapRequest() - { - - } - } - - [LLSDType("MAP")] - public class LLSDUploadReply - { - public string new_asset = ""; - public LLUUID new_inventory_item = LLUUID.Zero; - public string state = ""; - - public LLSDUploadReply() - { - - } - } - - [LLSDType("MAP")] - public class LLSDCapEvent - { - public int id = 0; - public LLSDArray events = new LLSDArray(); - - public LLSDCapEvent() - { - - } - } - - [LLSDType("MAP")] - public class LLSDEmpty - { - public LLSDEmpty() - { - - } - } - - [LLSDType("MAP")] - public class LLSDTest - { - public int Test1 = 20; - public int Test2 = 10; - - public LLSDTest() - { - - } - } - - - [AttributeUsage(AttributeTargets.Class)] - public class LLSDType : Attribute - { - private string myType; - - public LLSDType(string type) - { - myType = type; - - } - - public string ObjectType - { - get - { - return myType; - } - } - } -} diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index cca7c71..40cd4f0 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -70,10 +70,6 @@ ..\..\..\bin\libsecondlife.dll False - - OpenSim.FrameworkGenericConfig.Xml.dll - False - System.dll False diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs new file mode 100644 index 0000000..c2c1ecf --- /dev/null +++ b/OpenSim/Region/Environment/EstateManager.cs @@ -0,0 +1,301 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; +using OpenSim; +using libsecondlife; +using libsecondlife.Packets; +using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; + + +namespace OpenSim.Region.Environment +{ + + /// + /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings + /// + public class EstateManager + { + private Scene m_world; + private RegionInfo m_regInfo; + + public EstateManager(Scene world,RegionInfo reginfo) + { + m_world = world; //Estate settings found at world.m_regInfo.estateSettings + m_regInfo = reginfo; + } + + private bool convertParamStringToBool(byte[] field) + { + string s = Helpers.FieldToUTF8String(field); + if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") + { + return true; + } + return false; + } + + public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) + { + if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID) + { + switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) + { + case "getinfo": + Console.WriteLine("GETINFO Requested"); + this.sendRegionInfoPacketToAll(); + + break; + case "setregioninfo": + if (packet.ParamList.Length != 9) + { + OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); + } + else + { + m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None; + + if (convertParamStringToBool(packet.ParamList[0].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform; + } + + if (convertParamStringToBool(packet.ParamList[1].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly; + } + + if (convertParamStringToBool(packet.ParamList[2].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage; + } + + if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell; + } + + + int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); + m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; + + float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); + m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; + + int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); + m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel; + + + if (convertParamStringToBool(packet.ParamList[7].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject; + } + + if (convertParamStringToBool(packet.ParamList[8].Parameter)) + { + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges; + } + + sendRegionInfoPacketToAll(); + + } + break; + case "texturebase": + foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + { + string s = Helpers.FieldToUTF8String(block.Parameter); + string[] splitField = s.Split(' '); + if (splitField.Length == 2) + { + LLUUID tempUUID = new LLUUID(splitField[1]); + switch (Convert.ToInt16(splitField[0])) + { + case 0: + m_regInfo.estateSettings.terrainBase0 = tempUUID; + break; + case 1: + m_regInfo.estateSettings.terrainBase1 = tempUUID; + break; + case 2: + m_regInfo.estateSettings.terrainBase2 = tempUUID; + break; + case 3: + m_regInfo.estateSettings.terrainBase3 = tempUUID; + break; + } + } + } + break; + case "texturedetail": + foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + { + + string s = Helpers.FieldToUTF8String(block.Parameter); + string[] splitField = s.Split(' '); + if (splitField.Length == 2) + { + LLUUID tempUUID = new LLUUID(splitField[1]); + switch (Convert.ToInt16(splitField[0])) + { + case 0: + m_regInfo.estateSettings.terrainDetail0 = tempUUID; + break; + case 1: + m_regInfo.estateSettings.terrainDetail1 = tempUUID; + break; + case 2: + m_regInfo.estateSettings.terrainDetail2 = tempUUID; + break; + case 3: + m_regInfo.estateSettings.terrainDetail3 = tempUUID; + break; + } + } + } + break; + case "textureheights": + foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + { + + string s = Helpers.FieldToUTF8String(block.Parameter); + string[] splitField = s.Split(' '); + if (splitField.Length == 3) + { + + float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); + float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); + + switch (Convert.ToInt16(splitField[0])) + { + case 0: + m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; + break; + case 1: + m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; + break; + case 2: + m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; + break; + case 3: + m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; + m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; + break; + } + } + } + break; + case "texturecommit": + sendRegionHandshakeToAll(); + break; + case "setregionterrain": + if (packet.ParamList.Length != 9) + { + OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); + } + else + { + m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); + m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); + m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); + m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); + m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); + + sendRegionInfoPacketToAll(); + } + break; + default: + OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); + break; + } + } + } + + public void sendRegionInfoPacketToAll() + { + List avatars = m_world.RequestAvatarList(); + + for (int i = 0; i < avatars.Count; i++) + { + this.sendRegionInfoPacket(avatars[i].ControllingClient); + } + } + + public void sendRegionHandshakeToAll() + { + List avatars = m_world.RequestAvatarList(); + + for (int i = 0; i < avatars.Count; i++) + { + this.sendRegionHandshake(avatars[i].ControllingClient); + } + } + + public void sendRegionInfoPacket(IClientAPI remote_client) + { + Encoding _enc = System.Text.Encoding.ASCII; + + AgentCircuitData circuitData = remote_client.RequestClientInfo(); + + RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); + regionInfoPacket.AgentData.AgentID = circuitData.AgentID; + regionInfoPacket.AgentData.SessionID = circuitData.SessionID; + regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor; + regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID; + regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents; + regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor; + regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID; + regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; + regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; + regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; + regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; + regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; + regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName); + regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; + regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; + regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; + regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun; + regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight; + + remote_client.OutPacket(regionInfoPacket); + } + + public void sendRegionHandshake(IClientAPI remoteClient) + { + remoteClient.SendRegionHandshake(m_regInfo); + } + + } +} diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj new file mode 100644 index 0000000..6f07969 --- /dev/null +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -0,0 +1,214 @@ + + + Local + 8.0.50727 + 2.0 + {DCBA491C-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Region.Environment + JScript + Grid + IE50 + false + Library + + OpenSim.Region.Environment + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\Axiom.MathLib.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.GenericConfig.Xml + {C74E4A30-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Capabilities + {39038E85-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Terrain.BasicTerrain + {C9E0F891-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs new file mode 100644 index 0000000..1cab4ab --- /dev/null +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -0,0 +1,892 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Region.Environment.Scenes; +using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; + +namespace OpenSim.Region.Environment +{ + + + #region ParcelManager Class + /// + /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) + /// + public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver + { + + #region Constants + //Parcel types set with flags in ParcelOverlay. + //Only one of these can be used. + public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 + public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 + public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 + public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 + public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 + public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 + + + //Flags that when set, a border on the given side will be placed + //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) + //This took forever to figure out -- jeesh. /blame LL for even having to send these + public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 + public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 + + //RequestResults (I think these are right, they seem to work): + public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel + public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel + + //These are other constants. Yay! + public const int START_PARCEL_LOCAL_ID = 1; + #endregion + + #region Member Variables + public Dictionary parcelList = new Dictionary(); + private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; + private int[,] parcelIDList = new int[64, 64]; + + private Scene m_world; + private RegionInfo m_regInfo; + + #endregion + + #region Constructors + public ParcelManager(Scene world, RegionInfo reginfo) + { + + m_world = world; + m_regInfo = reginfo; + parcelIDList.Initialize(); + + } + #endregion + + #region Member Functions + + #region Parcel From Storage Functions + public void ParcelFromStorage(ParcelData data) + { + Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); + new_parcel.parcelData = data.Copy(); + new_parcel.setParcelBitmapFromByteArray(); + addParcel(new_parcel); + + } + + public void NoParcelDataFromStorage() + { + resetSimParcels(); + } + #endregion + + #region Parcel Add/Remove/Get/Create + /// + /// Creates a basic Parcel object without an owner (a zeroed key) + /// + /// + public Parcel createBaseParcel() + { + return new Parcel(new LLUUID(), false, m_world); + } + + /// + /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own + /// + /// The parcel being added + public void addParcel(Parcel new_parcel) + { + lastParcelLocalID++; + new_parcel.parcelData.localID = lastParcelLocalID; + parcelList.Add(lastParcelLocalID, new_parcel.Copy()); + + + bool[,] parcelBitmap = new_parcel.getParcelBitmap(); + int x, y; + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelBitmap[x, y]) + { + parcelIDList[x, y] = lastParcelLocalID; + } + } + } + parcelList[lastParcelLocalID].forceUpdateParcelInfo(); + + + } + /// + /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList + /// + /// Parcel.localID of the parcel to remove. + public void removeParcel(int local_id) + { + int x, y; + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelIDList[x, y] == local_id) + { + throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y); + } + } + } + m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData); + parcelList.Remove(local_id); + } + + private void performFinalParcelJoin(Parcel master, Parcel slave) + { + int x, y; + bool[,] parcelBitmapSlave = slave.getParcelBitmap(); + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelBitmapSlave[x, y]) + { + parcelIDList[x, y] = master.parcelData.localID; + } + } + } + removeParcel(slave.parcelData.localID); + } + /// + /// Get the parcel at the specified point + /// + /// Value between 0 - 256 on the x axis of the point + /// Value between 0 - 256 on the y axis of the point + /// Parcel at the point supplied + public Parcel getParcel(int x, int y) + { + if (x > 256 || y > 256 || x < 0 || y < 0) + { + throw new Exception("Error: Parcel not found at point " + x + ", " + y); + } + else + { + return parcelList[parcelIDList[x / 4, y / 4]]; + } + + } + #endregion + + #region Parcel Modification + /// + /// Subdivides a parcel + /// + /// West Point + /// South Point + /// East Point + /// North Point + /// LLUUID of user who is trying to subdivide + /// Returns true if successful + private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) + { + //First, lets loop through the points and make sure they are all in the same parcel + //Get the parcel at start + Parcel startParcel = getParcel(start_x, start_y); + if (startParcel == null) return false; //No such parcel at the beginning + + //Loop through the points + try + { + int totalX = end_x - start_x; + int totalY = end_y - start_y; + int x, y; + for (y = 0; y < totalY; y++) + { + for (x = 0; x < totalX; x++) + { + Parcel tempParcel = getParcel(start_x + x, start_y + y); + if (tempParcel == null) return false; //No such parcel at that point + if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no + } + } + } + catch (Exception) + { + return false; //Exception. For now, lets skip subdivision + } + + //If we are still here, then they are subdividing within one parcel + //Check owner + if (startParcel.parcelData.ownerID != attempting_user_id) + { + return false; //They cant do this! + } + + //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) + Parcel newParcel = startParcel.Copy(); + newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; + newParcel.parcelData.globalID = LLUUID.Random(); + + newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); + + //Now, lets set the subdivision area of the original to false + int startParcelIndex = startParcel.parcelData.localID; + parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); + parcelList[startParcelIndex].forceUpdateParcelInfo(); + + + //Now add the new parcel + addParcel(newParcel); + + + + + + return true; + } + /// + /// Join 2 parcels together + /// + /// x value in first parcel + /// y value in first parcel + /// x value in second parcel + /// y value in second parcel + /// LLUUID of the avatar trying to join the parcels + /// Returns true if successful + private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) + { + end_x -= 4; + end_y -= 4; + + //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! + //This should be fixed later -- somewhat "incomplete code" --Ming + Parcel startParcel, endParcel; + + try + { + startParcel = getParcel(start_x, start_y); + endParcel = getParcel(end_x, end_y); + } + catch (Exception) + { + return false; //Error occured when trying to get the start and end parcels + } + if (startParcel == endParcel) + { + return false; //Subdivision of the same parcel is not allowed + } + + //Check the parcel owners: + if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) + { + return false; + } + if (startParcel.parcelData.ownerID != attempting_user_id) + { + //TODO: Group editing stuff. Avatar owner support for now + return false; + } + + //Same owners! Lets join them + //Merge them to startParcel + parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); + performFinalParcelJoin(startParcel, endParcel); + + return true; + + + + } + #endregion + + #region Parcel Updating + /// + /// Where we send the ParcelOverlay packet to the client + /// + /// The object representing the client + public void sendParcelOverlay(IClientAPI remote_client) + { + const int PARCEL_BLOCKS_PER_PACKET = 1024; + int x, y = 0; + byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; + int byteArrayCount = 0; + int sequenceID = 0; + ParcelOverlayPacket packet; + + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + byte tempByte = (byte)0; //This represents the byte for the current 4x4 + Parcel currentParcelBlock = getParcel(x * 4, y * 4); + + if (currentParcelBlock.parcelData.ownerID == remote_client.AgentId) + { + //Owner Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER); + } + else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentId)) + { + //Sale Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE); + } + else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero) + { + //Public Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC); + } + else + { + //Other Flag + tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER); + } + + + //Now for border control + if (x == 0) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); + } + else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); + } + + if (y == 0) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); + } + else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) + { + tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); + } + + byteArray[byteArrayCount] = tempByte; + byteArrayCount++; + if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET) + { + byteArrayCount = 0; + packet = new ParcelOverlayPacket(); + packet.ParcelData.Data = byteArray; + packet.ParcelData.SequenceID = sequenceID; + remote_client.OutPacket((Packet)packet); + sequenceID++; + byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; + } + } + } + + packet = new ParcelOverlayPacket(); + packet.ParcelData.Data = byteArray; + packet.ParcelData.SequenceID = sequenceID; //Eh? + remote_client.OutPacket((Packet)packet); + } + + public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) + { + //Get the parcels within the bounds + List temp = new List(); + int x, y, i; + int inc_x = end_x - start_x; + int inc_y = end_y - start_y; + for (x = 0; x < inc_x; x++) + { + for (y = 0; y < inc_y; y++) + { + OpenSim.Region.Environment.Parcel currentParcel = getParcel(start_x + x, start_y + y); + if (!temp.Contains(currentParcel)) + { + currentParcel.forceUpdateParcelInfo(); + temp.Add(currentParcel); + } + } + } + + int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL; + if (temp.Count > 1) + { + requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; + } + + for (i = 0; i < temp.Count; i++) + { + temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); + } + + + sendParcelOverlay(remote_client); + } + + public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) + { + if (parcelList.ContainsKey(packet.ParcelData.LocalID)) + { + parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); + } + } + public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) + { + subdivide(west, south, east, north, remote_client.AgentId); + } + public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) + { + join(west, south, east, north, remote_client.AgentId); + + } + #endregion + + /// + /// Resets the sim to the default parcel (full sim parcel owned by the default user) + /// + public void resetSimParcels() + { + //Remove all the parcels in the sim and add a blank, full sim parcel set to public + parcelList.Clear(); + lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; + parcelIDList.Initialize(); + + Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); + + fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); + fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; + fullSimParcel.parcelData.parcelDesc = ""; + + fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID; + fullSimParcel.parcelData.salePrice = 1; + fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; + fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; + + addParcel(fullSimParcel); + + } + #endregion + } + #endregion + + + #region Parcel Class + /// + /// Keeps track of a specific parcel's information + /// + public class Parcel + { + #region Member Variables + public ParcelData parcelData = new ParcelData(); + public Scene m_world; + + private bool[,] parcelBitmap = new bool[64, 64]; + + #endregion + + + #region Constructors + public Parcel(LLUUID owner_id, bool is_group_owned, Scene world) + { + m_world = world; + parcelData.ownerID = owner_id; + parcelData.isGroupOwned = is_group_owned; + + } + #endregion + + + #region Member Functions + + #region General Functions + /// + /// Checks to see if this parcel contains a point + /// + /// + /// + /// Returns true if the parcel contains the specified point + public bool containsPoint(int x, int y) + { + if (x >= 0 && y >= 0 && x <= 256 && x <= 256) + { + return (parcelBitmap[x / 4, y / 4] == true); + } + else + { + return false; + } + } + + public Parcel Copy() + { + Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); + + //Place all new variables here! + newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); + newParcel.parcelData = parcelData.Copy(); + + return newParcel; + } + + #endregion + + + #region Packet Request Handling + /// + /// Sends parcel properties as requested + /// + /// ID sent by client for them to keep track of + /// Bool sent by client for them to use + /// Object representing the client + public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) + { + + ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); + updatePacket.ParcelData.AABBMax = parcelData.AABBMax; + updatePacket.ParcelData.AABBMin = parcelData.AABBMin; + updatePacket.ParcelData.Area = parcelData.area; + updatePacket.ParcelData.AuctionID = parcelData.auctionID; + updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented + + updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; + + updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); + updatePacket.ParcelData.Category = (byte)parcelData.category; + updatePacket.ParcelData.ClaimDate = parcelData.claimDate; + updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; + updatePacket.ParcelData.GroupID = parcelData.groupID; + updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; + updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; + updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; + updatePacket.ParcelData.LocalID = parcelData.localID; + updatePacket.ParcelData.MaxPrims = 1000; //unemplemented + updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; + updatePacket.ParcelData.MediaID = parcelData.mediaID; + updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); + updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL); + updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); + updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented + updatePacket.ParcelData.OtherCount = 0; //unemplemented + updatePacket.ParcelData.OtherPrims = 0; //unemplented + updatePacket.ParcelData.OwnerID = parcelData.ownerID; + updatePacket.ParcelData.OwnerPrims = 0; //unemplemented + updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented + updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented + updatePacket.ParcelData.PassHours = parcelData.passHours; + updatePacket.ParcelData.PassPrice = parcelData.passPrice; + updatePacket.ParcelData.PublicCount = 0; //unemplemented + updatePacket.ParcelData.RegionDenyAnonymous = false; //unemplemented + updatePacket.ParcelData.RegionDenyIdentified = false; //unemplemented + updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented + updatePacket.ParcelData.RegionPushOverride = true; //unemplemented + updatePacket.ParcelData.RentPrice = 0; //?? + updatePacket.ParcelData.RequestResult = request_result; + updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented + updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented + updatePacket.ParcelData.SelfCount = 0;//unemplemented + updatePacket.ParcelData.SequenceID = sequence_id; + updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented + updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented + updatePacket.ParcelData.SnapSelection = snap_selection; + updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; + updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; + updatePacket.ParcelData.TotalPrims = 0; //unemplemented + updatePacket.ParcelData.UserLocation = parcelData.userLocation; + updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; + remote_client.OutPacket((Packet)updatePacket); + } + + public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) + { + if (remote_client.AgentId == parcelData.ownerID) + { + //Needs later group support + parcelData.authBuyerID = packet.ParcelData.AuthBuyerID; + parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; + parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); + parcelData.groupID = packet.ParcelData.GroupID; + parcelData.landingType = packet.ParcelData.LandingType; + parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale; + parcelData.mediaID = packet.ParcelData.MediaID; + parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); + parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); + parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name); + parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags; + parcelData.passHours = packet.ParcelData.PassHours; + parcelData.passPrice = packet.ParcelData.PassPrice; + parcelData.salePrice = packet.ParcelData.SalePrice; + parcelData.snapshotID = packet.ParcelData.SnapshotID; + parcelData.userLocation = packet.ParcelData.UserLocation; + parcelData.userLookAt = packet.ParcelData.UserLookAt; + + List avatars = m_world.RequestAvatarList(); + + for (int i = 0; i < avatars.Count; i++) + { + Parcel over = m_world.parcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y)); + if (over == this) + { + sendParcelProperties(0, false, 0, avatars[i].ControllingClient); + } + } + + } + } + #endregion + + + #region Update Functions + /// + /// Updates the AABBMin and AABBMax values after area/shape modification of parcel + /// + private void updateAABBAndAreaValues() + { + int min_x = 64; + int min_y = 64; + int max_x = 0; + int max_y = 0; + int tempArea = 0; + int x, y; + for (x = 0; x < 64; x++) + { + for (y = 0; y < 64; y++) + { + if (parcelBitmap[x, y] == true) + { + if (min_x > x) min_x = x; + if (min_y > y) min_y = y; + if (max_x < x) max_x = x; + if (max_y < y) max_y = y; + tempArea += 16; //16sqm parcel + } + } + } + parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); + parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); + parcelData.area = tempArea; + } + + public void updateParcelBitmapByteArray() + { + parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); + } + + /// + /// Update all settings in parcel such as area, bitmap byte array, etc + /// + public void forceUpdateParcelInfo() + { + this.updateAABBAndAreaValues(); + this.updateParcelBitmapByteArray(); + } + + public void setParcelBitmapFromByteArray() + { + parcelBitmap = convertBytesToParcelBitmap(); + } + #endregion + + + #region Parcel Bitmap Functions + /// + /// Sets the parcel's bitmap manually + /// + /// 64x64 block representing where this parcel is on a map + public void setParcelBitmap(bool[,] bitmap) + { + if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap"); + } + else + { + //Valid: Lets set it + parcelBitmap = bitmap; + forceUpdateParcelInfo(); + + } + } + /// + /// Gets the parcels bitmap manually + /// + /// + public bool[,] getParcelBitmap() + { + return parcelBitmap; + } + /// + /// Converts the parcel bitmap to a packet friendly byte array + /// + /// + private byte[] convertParcelBitmapToBytes() + { + byte[] tempConvertArr = new byte[512]; + byte tempByte = 0; + int x, y, i, byteNum = 0; + i = 0; + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8)); + if (i % 8 == 0) + { + tempConvertArr[byteNum] = tempByte; + tempByte = (byte)0; + i = 0; + byteNum++; + } + } + } + return tempConvertArr; + } + + private bool[,] convertBytesToParcelBitmap() + { + bool[,] tempConvertMap = new bool[64, 64]; + tempConvertMap.Initialize(); + byte tempByte = 0; + int x = 0, y = 0, i = 0, bitNum = 0; + for (i = 0; i < 512; i++) + { + tempByte = parcelData.parcelBitmapByteArray[i]; + for (bitNum = 0; bitNum < 8; bitNum++) + { + bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); + tempConvertMap[x, y] = bit; + x++; + if (x > 63) + { + x = 0; + y++; + } + + } + + } + return tempConvertMap; + } + /// + /// Full sim parcel creation + /// + /// + public static bool[,] basicFullRegionParcelBitmap() + { + return getSquareParcelBitmap(0, 0, 256, 256); + } + + /// + /// Used to modify the bitmap between the x and y points. Points use 64 scale + /// + /// + /// + /// + /// + /// + public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y) + { + + bool[,] tempBitmap = new bool[64, 64]; + tempBitmap.Initialize(); + + tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); + return tempBitmap; + } + + /// + /// Change a parcel's bitmap at within a square and set those points to a specific value + /// + /// + /// + /// + /// + /// + /// + /// + public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) + { + if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()"); + } + + int x, y; + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + if (x >= start_x / 4 && x < end_x / 4 + && y >= start_y / 4 && y < end_y / 4) + { + parcel_bitmap[x, y] = set_value; + } + } + } + return parcel_bitmap; + } + /// + /// Join the true values of 2 bitmaps together + /// + /// + /// + /// + public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) + { + if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps"); + } + if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) + { + //Throw an exception - The bitmap is not 64x64 + throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); + + } + + int x, y; + for (y = 0; y < 64; y++) + { + for (x = 0; x < 64; x++) + { + if (bitmap_add[x, y]) + { + bitmap_base[x, y] = true; + } + } + } + return bitmap_base; + } + #endregion + + #endregion + + + } + #endregion + + +} diff --git a/OpenSim/Region/Environment/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs new file mode 100644 index 0000000..4ff55a8 --- /dev/null +++ b/OpenSim/Region/Environment/RegionManager.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Communications; +using OpenSim.Framework; +using OpenSim.Framework.Types; +using OpenSim.Framework.Servers; +using OpenSim.Region.Capabilities; + +namespace OpenSim.Region.Environment +{ + public class RegionManager //needs renaming , but first we need to rename the namespace + { + protected AuthenticateSessionsBase authenticateHandler; + protected RegionCommsListener regionCommsHost; + protected CommunicationsManager commsManager; + protected List capsHandlers = new List(); + protected BaseHttpServer httpListener; + + protected Scenes.Scene m_Scene; + + public ParcelManager parcelManager; + public EstateManager estateManager; + + public RegionManager() + { + + } + + } +} diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs new file mode 100644 index 0000000..bbba34d --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -0,0 +1,194 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using Axiom.MathLib; +using OpenSim.Physics.Manager; +using libsecondlife; +using OpenSim.Region.Environment.Scripting; + +namespace OpenSim.Region.Environment.Scenes +{ + public abstract class Entity : IScriptReadonlyEntity + { + public libsecondlife.LLUUID uuid; + public Quaternion rotation; + protected List children; + + protected PhysicsActor _physActor; + protected Scene m_world; + protected string m_name; + + /// + /// + /// + public virtual string Name + { + get { return m_name; } + } + + protected LLVector3 m_pos; + /// + /// + /// + public virtual LLVector3 Pos + { + get + { + if (this._physActor != null) + { + m_pos.X = _physActor.Position.X; + m_pos.Y = _physActor.Position.Y; + m_pos.Z = _physActor.Position.Z; + } + + return m_pos; + } + set + { + if (this._physActor != null) + { + try + { + lock (this.m_world.SyncRoot) + { + + this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + + m_pos = value; + } + } + + public LLVector3 velocity; + + /// + /// + /// + public virtual LLVector3 Velocity + { + get + { + if (this._physActor != null) + { + velocity.X = _physActor.Velocity.X; + velocity.Y = _physActor.Velocity.Y; + velocity.Z = _physActor.Velocity.Z; + } + + return velocity; + } + set + { + if (this._physActor != null) + { + try + { + lock (this.m_world.SyncRoot) + { + + this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + + velocity = value; + } + } + + protected uint m_localId; + + public uint LocalId + { + get { return m_localId; } + } + + /// + /// Creates a new Entity (should not occur on it's own) + /// + public Entity() + { + uuid = new libsecondlife.LLUUID(); + + m_pos = new LLVector3(); + velocity = new LLVector3(); + rotation = new Quaternion(); + m_name = "(basic entity)"; + children = new List(); + } + + /// + /// + /// + public virtual void updateMovement() + { + foreach (Entity child in children) + { + child.updateMovement(); + } + } + + /// + /// Performs any updates that need to be done at each frame. This function is overridable from it's children. + /// + public virtual void update() { + // Do any per-frame updates needed that are applicable to every type of entity + foreach (Entity child in children) + { + child.update(); + } + } + + /// + /// Called at a set interval to inform entities that they should back themsleves up to the DB + /// + public virtual void BackUp() + { + + } + + /// + /// Infoms the entity that the land (heightmap) has changed + /// + public virtual void LandRenegerated() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs new file mode 100644 index 0000000..36023d0 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Region.Environment.Scenes +{ + public interface IScenePresenceBody + { + void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); + void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); + void SendOurAppearance(IClientAPI OurClient); + void SendAppearanceToOtherAgent(ScenePresence avatarInfo); + } +} diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs new file mode 100644 index 0000000..0f649b2 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -0,0 +1,582 @@ + +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; + +namespace OpenSim.Region.Environment.Scenes +{ + public class Primitive : Entity + { + internal PrimData primData; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + // private Dictionary m_clientThreads; + private ulong m_regionHandle; + private const uint FULL_MASK_PERMISSIONS = 2147483647; + private bool physicsEnabled = false; + private byte updateFlag = 0; + private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; + + private Dictionary inventoryItems; + + #region Properties + + public LLVector3 Scale + { + set + { + this.primData.Scale = value; + //this.dirtyFlag = true; + } + get + { + return this.primData.Scale; + } + } + + public PhysicsActor PhysActor + { + set + { + this._physActor = value; + } + } + + public override LLVector3 Pos + { + get + { + return base.Pos; + } + set + { + base.Pos = value; + } + } + #endregion + + /// + /// + /// + /// + /// + /// + public Primitive( ulong regionHandle, Scene world) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.CreateFromPacket(addPacket, ownerID, localID); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = new PrimData(); + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + this.primData.OwnerID = owner; + this.primData.FullID = this.uuid = fullID; + this.primData.LocalID = m_localId = localID; + } + + /// + /// Constructor to create a default cube + /// + /// + /// + /// + /// + /// + /// + public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position) + { + //m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = PrimData.DefaultCube(); + this.primData.OwnerID = owner; + this.primData.LocalID = m_localId = localID; + this.Pos = this.primData.Position = position; + + this.updateFlag = 1; + } + + /// + /// + /// + /// + public byte[] GetByteArray() + { + byte[] result = null; + List dataArrays = new List(); + dataArrays.Add(primData.ToBytes()); + foreach (Entity child in children) + { + if (child is OpenSim.Region.Environment.Scenes.Primitive) + { + dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray()); + } + } + byte[] primstart = Helpers.StringToField(""); + byte[] primend = Helpers.StringToField(""); + int totalLength = primstart.Length + primend.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + totalLength += dataArrays[i].Length; + } + + result = new byte[totalLength]; + int arraypos = 0; + Array.Copy(primstart, 0, result, 0, primstart.Length); + arraypos += primstart.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); + arraypos += dataArrays[i].Length; + } + Array.Copy(primend, 0, result, arraypos, primend.Length); + + return result; + } + + #region Overridden Methods + + /// + /// + /// + public override void update() + { + if (this.updateFlag == 1) // is a new prim just been created/reloaded + { + this.SendFullUpdateToAllClients(); + this.updateFlag = 0; + } + if (this.updateFlag == 2) //some change has been made so update the clients + { + this.SendTerseUpdateToALLClients(); + this.updateFlag = 0; + } + } + + /// + /// + /// + public override void BackUp() + { + + } + + #endregion + + #region Packet handlers + + /// + /// + /// + /// + public void UpdatePosition(LLVector3 pos) + { + this.Pos = new LLVector3(pos.X, pos.Y, pos.Z); + this.updateFlag = 2; + } + + /// + /// + /// + /// + public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) + { + this.primData.PathBegin = updatePacket.PathBegin; + this.primData.PathEnd = updatePacket.PathEnd; + this.primData.PathScaleX = updatePacket.PathScaleX; + this.primData.PathScaleY = updatePacket.PathScaleY; + this.primData.PathShearX = updatePacket.PathShearX; + this.primData.PathShearY = updatePacket.PathShearY; + this.primData.PathSkew = updatePacket.PathSkew; + this.primData.ProfileBegin = updatePacket.ProfileBegin; + this.primData.ProfileEnd = updatePacket.ProfileEnd; + this.primData.PathCurve = updatePacket.PathCurve; + this.primData.ProfileCurve = updatePacket.ProfileCurve; + this.primData.ProfileHollow = updatePacket.ProfileHollow; + this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset; + this.primData.PathRevolutions = updatePacket.PathRevolutions; + this.primData.PathTaperX = updatePacket.PathTaperX; + this.primData.PathTaperY = updatePacket.PathTaperY; + this.primData.PathTwist = updatePacket.PathTwist; + this.primData.PathTwistBegin = updatePacket.PathTwistBegin; + } + + /// + /// + /// + /// + public void UpdateTexture(byte[] tex) + { + this.primData.TextureEntry = tex; + } + + /// + /// + /// + /// + public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) + { + + } + + /// + /// + /// + /// + public void AssignToParent(Primitive prim) + { + + } + + #endregion + + # region Inventory Methods + /// + /// + /// + /// + /// + public bool AddToInventory(InventoryItem item) + { + return false; + } + + /// + /// + /// + /// + /// + public InventoryItem RemoveFromInventory(LLUUID itemID) + { + return null; + } + + /// + /// + /// + /// + /// + public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) + { + + } + + /// + /// + /// + /// + /// + public void RequestXferInventory(IClientAPI simClient, ulong xferID) + { + //will only currently work if the total size of the inventory data array is under about 1000 bytes + SendXferPacketPacket send = new SendXferPacketPacket(); + + send.XferID.ID = xferID; + send.XferID.Packet = 1 + 2147483648; + send.DataPacket.Data = this.ConvertInventoryToBytes(); + + simClient.OutPacket(send); + } + + /// + /// + /// + /// + public byte[] ConvertInventoryToBytes() + { + System.Text.Encoding enc = System.Text.Encoding.ASCII; + byte[] result = new byte[0]; + List inventoryData = new List(); + int totallength = 0; + foreach (InventoryItem invItem in inventoryItems.Values) + { + byte[] data = enc.GetBytes(invItem.ExportString()); + inventoryData.Add(data); + totallength += data.Length; + } + //TODO: copy arrays into the single result array + + return result; + } + + /// + /// + /// + /// + public void CreateInventoryFromBytes(byte[] data) + { + + } + + #endregion + + #region Update viewers Methods + + /// + /// + /// + /// + public void SendFullUpdateForAllChildren(IClientAPI remoteClient) + { + this.SendFullUpdateToClient(remoteClient); + for (int i = 0; i < this.children.Count; i++) + { + if (this.children[i] is Primitive) + { + ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient); + } + } + } + + /// + /// + /// + /// + public void SendFullUpdateToClient(IClientAPI remoteClient) + { + LLVector3 lPos; + if (this._physActor != null && this.physicsEnabled) + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + } + else + { + lPos = this.Pos; + } + + remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); + } + + /// + /// + /// + public void SendFullUpdateToAllClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendFullUpdateToClient(avatars[i].ControllingClient); + } + } + + /// + /// + /// + /// + public void SendTerseUpdateToClient(IClientAPI RemoteClient) + { + LLVector3 lPos; + Axiom.MathLib.Quaternion lRot; + if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + lRot = this._physActor.Orientation; + } + else + { + lPos = this.Pos; + lRot = this.rotation; + } + LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); + RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); + } + + /// + /// + /// + public void SendTerseUpdateToALLClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendTerseUpdateToClient(avatars[i].ControllingClient); + } + } + + #endregion + + #region Create Methods + + /// + /// + /// + /// + /// + /// + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + PrimData PData = new PrimData(); + this.primData = PData; + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + + PData.OwnerID = ownerID; + PData.PCode = addPacket.ObjectData.PCode; + PData.PathBegin = addPacket.ObjectData.PathBegin; + PData.PathEnd = addPacket.ObjectData.PathEnd; + PData.PathScaleX = addPacket.ObjectData.PathScaleX; + PData.PathScaleY = addPacket.ObjectData.PathScaleY; + PData.PathShearX = addPacket.ObjectData.PathShearX; + PData.PathShearY = addPacket.ObjectData.PathShearY; + PData.PathSkew = addPacket.ObjectData.PathSkew; + PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; + PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; + PData.Scale = addPacket.ObjectData.Scale; + PData.PathCurve = addPacket.ObjectData.PathCurve; + PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; + PData.ParentID = 0; + PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; + PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; + PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; + PData.PathTaperX = addPacket.ObjectData.PathTaperX; + PData.PathTaperY = addPacket.ObjectData.PathTaperY; + PData.PathTwist = addPacket.ObjectData.PathTwist; + PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; + LLVector3 pos1 = addPacket.ObjectData.RayEnd; + this.primData.FullID = this.uuid = LLUUID.Random(); + this.primData.LocalID = m_localId = (uint)(localID); + this.primData.Position = this.Pos = pos1; + + this.updateFlag = 1; + } + + /// + /// + /// + /// + public void CreateFromBytes(byte[] data) + { + + } + + /// + /// + /// + /// + public void CreateFromPrimData(PrimData primData) + { + this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); + } + + /// + /// + /// + /// + /// + /// + /// + public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) + { + + } + + public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) + { + // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z); + this.Pos = pos; + this.SendTerseUpdateToALLClients(); + } + + public void GetProperites(IClientAPI client) + { + //needs changing + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; + proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); + proper.ObjectData[0].ItemID = LLUUID.Zero; + proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate; + proper.ObjectData[0].CreatorID = primData.OwnerID; + proper.ObjectData[0].FolderID = LLUUID.Zero; + proper.ObjectData[0].FromTaskID = LLUUID.Zero; + proper.ObjectData[0].GroupID = LLUUID.Zero; + proper.ObjectData[0].InventorySerial = 0; + proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].ObjectID = this.uuid; + proper.ObjectData[0].OwnerID = primData.OwnerID; + proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TextureID = new byte[0]; + proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].Name = new byte[0]; + proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].OwnerMask = primData.OwnerMask; + proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask; + proper.ObjectData[0].GroupMask = primData.GroupMask; + proper.ObjectData[0].EveryoneMask = primData.EveryoneMask; + proper.ObjectData[0].BaseMask = primData.BaseMask; + + client.OutPacket(proper); + + } + + #endregion + + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs new file mode 100644 index 0000000..1d55c4d --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -0,0 +1,305 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; + +namespace OpenSim.Region.Environment.Scenes +{ + public partial class Scene + { + /// + /// Modifies terrain using the specified information + /// + /// The height at which the user started modifying the terrain + /// The number of seconds the modify button was pressed + /// The size of the brush used + /// The action to be performed + /// Distance from the north border where the cursor is located + /// Distance from the west border where the cursor is located + public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west) + { + // Shiny. + double size = (double)(1 << brushsize); + + switch (action) + { + case 0: + // flatten terrain + Terrain.flatten(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 1: + // raise terrain + Terrain.raise(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 2: + //lower terrain + Terrain.lower(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 3: + // smooth terrain + Terrain.smooth(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 4: + // noise + Terrain.noise(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + case 5: + // revert + Terrain.revert(north, west, size, (double)seconds / 100.0); + RegenerateTerrain(true, (int)north, (int)west); + break; + + // CLIENT EXTENSIONS GO HERE + case 128: + // erode-thermal + break; + case 129: + // erode-aerobic + break; + case 130: + // erode-hydraulic + break; + } + return; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + Console.WriteLine("Chat message"); + ScenePresence avatar = null; + foreach (IClientAPI client in m_clientThreads.Values) + { + int dis = -1000; + if (this.Avatars.ContainsKey(client.AgentId)) + { + + avatar = this.Avatars[client.AgentId]; + // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + dis= (int)avatar.Pos.GetDistanceTo(fromPos); + Console.WriteLine("found avatar at " +dis); + + } + + switch (type) + { + case 0: // Whisper + if ((dis < 10) && (dis > -10)) + { + //should change so the message is sent through the avatar rather than direct to the ClientView + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + } + break; + case 1: // Say + if ((dis < 30) && (dis > -30)) + { + Console.WriteLine("sending chat"); + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + } + break; + case 2: // Shout + if ((dis < 100) && (dis > -100)) + { + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + } + break; + + case 0xff: // Broadcast + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + break; + } + + } + } + + /// + /// + /// + /// + /// + public void RezObject(AssetBase primAsset, LLVector3 pos) + { + + } + + /// + /// + /// + /// + /// + public void DeRezObject(Packet packet, IClientAPI simClient) + { + + } + + /// + /// + /// + /// + public void SendAvatarsToClient(IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + public void LinkObjects(uint parentPrim, List childPrims) + { + + + } + + /// + /// + /// + /// + /// + public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) + { + + } + + /// + /// + /// + /// + /// + public void SelectPrim(uint primLocalID, IClientAPI remoteClient) + { + foreach (Entity ent in Entities.Values) + { + if (ent.LocalId == primLocalID) + { + ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient); + break; + } + } + } + + public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) + { + if (this.Entities.ContainsKey(objectID)) + { + ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); + } + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) + { + foreach (Entity ent in Entities.Values) + { + if (ent.LocalId == localID) + { + ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos); + break; + } + } + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) + { + + } + + /// + /// + /// + /// + /// + /// + public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) + { + } + + /// + /// Sends prims to a client + /// + /// Client to send to + public void GetInitialPrims(IClientAPI RemoteClient) + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs b/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs new file mode 100644 index 0000000..2249c3d --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs @@ -0,0 +1,184 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Reflection; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scenes +{ + public partial class Scene + { + private Dictionary scriptEngines = new Dictionary(); + + /// + /// + /// + private void LoadScriptEngines() + { + this.LoadScriptPlugins(); + } + + /// + /// + /// + public void LoadScriptPlugins() + { + string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); + string[] pluginFiles = Directory.GetFiles(path, "*.dll"); + + + for (int i = 0; i < pluginFiles.Length; i++) + { + this.AddPlugin(pluginFiles[i]); + } + } + + /// + /// + /// + /// + private void AddPlugin(string FileName) + { + Assembly pluginAssembly = Assembly.LoadFrom(FileName); + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IScriptEngine", true); + + if (typeInterface != null) + { + IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Init(this); + this.scriptEngines.Add(plug.GetName(), plug); + + } + + typeInterface = null; + } + } + } + + pluginAssembly = null; + } + + /// + /// + /// + /// + /// + /// + /// + public void LoadScript(string scriptType, string scriptName, string script, Entity ent) + { + if(this.scriptEngines.ContainsKey(scriptType)) + { + this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.LocalId); + } + } + + #region IScriptAPI Methods + + /// + /// + /// + /// + /// + public LLVector3 GetEntityPosition(uint localID) + { + LLVector3 res = new LLVector3(); + // Console.WriteLine("script- getting entity " + localID + " position"); + foreach (Entity entity in this.Entities.Values) + { + if (entity.LocalId == localID) + { + res.X = entity.Pos.X; + res.Y = entity.Pos.Y; + res.Z = entity.Pos.Z; + } + } + return res; + } + + /// + /// + /// + /// + /// + /// + /// + public void SetEntityPosition(uint localID, float x , float y, float z) + { + foreach (Entity entity in this.Entities.Values) + { + if (entity.LocalId == localID && entity is Primitive) + { + LLVector3 pos = entity.Pos; + pos.X = x; + pos.Y = y; + Primitive prim = entity as Primitive; + // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. + //prim.UpdatePosition(pos); + // Console.WriteLine("script- setting entity " + localID + " positon"); + } + } + + } + + /// + /// + /// + /// + public uint GetRandomAvatarID() + { + //Console.WriteLine("script- getting random avatar id"); + uint res = 0; + foreach (Entity entity in this.Entities.Values) + { + if (entity is ScenePresence) + { + res = entity.LocalId; + } + } + return res; + } + + #endregion + + + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs new file mode 100644 index 0000000..ff54efa --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -0,0 +1,795 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections.Generic; +using System.Text; +using System.Reflection; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework; +using OpenSim.Region.Environment.Scripting; +using OpenSim.Region.Terrain; +using OpenSim.Framework.Communications; +using OpenSim.Region.Caches; +using OpenSim.Region.Environment; +using OpenSim.Framework.Servers; + +namespace OpenSim.Region.Environment.Scenes +{ + public delegate bool FilterAvatarList(ScenePresence avatar); + + public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI + { + protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); + protected Dictionary Avatars; + protected Dictionary Prims; + private PhysicsScene phyScene; + private float timeStep = 0.1f; + private Random Rand = new Random(); + private uint _primCount = 702000; + private int storageCount; + private Dictionary m_scriptHandlers; + private Dictionary m_scripts; + private Mutex updateLock; + + protected AuthenticateSessionsBase authenticateHandler; + protected RegionCommsListener regionCommsHost; + protected CommunicationsManager commsManager; + + protected Dictionary capsHandlers = new Dictionary(); + protected BaseHttpServer httpListener; + + public ParcelManager parcelManager; + public EstateManager estateManager; + public EventManager eventManager; + + #region Properties + /// + /// + /// + public PhysicsScene PhysScene + { + set + { + this.phyScene = value; + } + get + { + return (this.phyScene); + } + } + + #endregion + + #region Constructors + /// + /// Creates a new World class, and a region to go with it. + /// + /// Dictionary to contain client threads + /// Region Handle for this region + /// Region Name for this region + public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + { + try + { + updateLock = new Mutex(false); + this.authenticateHandler = authen; + this.commsManager = commsMan; + this.assetCache = assetCach; + m_clientThreads = clientThreads; + m_regInfo = regInfo; + m_regionHandle = m_regInfo.RegionHandle; + m_regionName = m_regInfo.RegionName; + this.m_datastore = m_regInfo.DataStore; + this.RegisterRegionWithComms(); + + parcelManager = new ParcelManager(this, this.m_regInfo); + estateManager = new EstateManager(this, this.m_regInfo); + + eventManager = new EventManager(); + + m_scriptHandlers = new Dictionary(); + m_scripts = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); + Entities = new Dictionary(); + Avatars = new Dictionary(); + Prims = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); + Terrain = new TerrainEngine(); + + ScenePresence.LoadAnims(); + this.httpListener = httpServer; + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); + } + } + #endregion + + /// + /// + /// + public void StartTimer() + { + m_heartbeatTimer.Enabled = true; + m_heartbeatTimer.Interval = 100; + m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); + } + + + #region Update Methods + + + /// + /// Performs per-frame updates regularly + /// + /// + /// + void Heartbeat(object sender, System.EventArgs e) + { + this.Update(); + } + + /// + /// Performs per-frame updates on the world, this should be the central world loop + /// + public override void Update() + { + updateLock.WaitOne(); + try + { + if (this.phyScene.IsThreaded) + { + this.phyScene.GetResults(); + + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].updateMovement(); + } + + lock (this.m_syncRoot) + { + this.phyScene.Simulate(timeStep); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].update(); + } + + // New + eventManager.TriggerOnFrame(); + + // TODO: Obsolete - Phase out + foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) + { + scriptHandler.OnFrame(); + } + foreach (IScriptEngine scripteng in this.scriptEngines.Values) + { + scripteng.OnFrame(); + } + + //backup world data + this.storageCount++; + if (storageCount > 1200) //set to how often you want to backup + { + this.Backup(); + storageCount = 0; + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); + } + updateLock.ReleaseMutex(); + + } + + /// + /// + /// + /// + public bool Backup() + { + /* + try + { + // Terrain backup routines + if (Terrain.tainted > 0) + { + Terrain.tainted = 0; + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); + localStorage.SaveMap(Terrain.getHeights1D()); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); + lock (this.m_syncRoot) + { + phyScene.SetTerrain(Terrain.getHeights1D()); + } + } + + // Primitive backup routines + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].BackUp(); + } + + //Parcel backup routines + ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; + int i = 0; + foreach (OpenSim.Region.Environment.Parcel parcel in parcelManager.parcelList.Values) + { + parcels[i] = parcel.parcelData; + i++; + } + localStorage.SaveParcels(parcels); + + // Backup successful + return true; + } + catch (Exception e) + { + // Backup failed + OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); + return false; + } + */ + return true; + } + #endregion + + #region Regenerate Terrain + + /// + /// Rebuilds the terrain using a procedural algorithm + /// + public void RegenerateTerrain() + { + try + { + Terrain.hills(); + + lock (this.m_syncRoot) + { + this.phyScene.SetTerrain(Terrain.getHeights1D()); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(client); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + /// + /// Rebuilds the terrain using a 2D float array + /// + /// 256,256 float array containing heights + public void RegenerateTerrain(float[,] newMap) + { + try + { + this.Terrain.setHeights2D(newMap); + lock (this.m_syncRoot) + { + this.phyScene.SetTerrain(this.Terrain.getHeights1D()); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(client); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + /// + /// Rebuilds the terrain assuming changes occured at a specified point[?] + /// + /// ??? + /// ??? + /// ??? + public void RegenerateTerrain(bool changes, int pointx, int pointy) + { + try + { + if (changes) + { + /* Dont save here, rely on tainting system instead */ + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(pointx, pointy, client); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + #endregion + + #region Load Terrain + /// + /// Loads the World heightmap + /// + /// + public override void LoadWorldMap() + { + try + { + float[] map = this.localStorage.LoadWorld(); + if (map == null) + { + if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) + { + Console.WriteLine("No default terrain, procedurally generating..."); + this.Terrain.hills(); + + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + else + { + try + { + this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); + this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; + } + catch + { + Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); + Terrain.hills(); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + } + else + { + this.Terrain.setHeights1D(map); + } + + CreateTerrainTexture(); + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); + } + } + + /// + /// + /// + private void CreateTerrainTexture() + { + //create a texture asset of the terrain + byte[] data = this.Terrain.exportJpegImage("defaultstripe.png"); + this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); + AssetBase asset = new AssetBase(); + asset.FullID = this.m_regInfo.estateSettings.terrainImageID; + asset.Data = data; + asset.Name = "terrainImage"; + asset.Type = 0; + this.assetCache.AddAsset(asset); + } + #endregion + + #region Primitives Methods + + + /// + /// Loads the World's objects + /// + public void LoadPrimsFromStorage() + { + try + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); + this.localStorage.LoadPrimitives(this); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); + } + } + + /// + /// Loads a specific object from storage + /// + /// The object to load + public void PrimFromStorage(PrimData prim) + { + + } + + /// + /// + /// + /// + /// + public void AddNewPrim(Packet addPacket, IClientAPI agentClient) + { + AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); + } + + /// + /// + /// + /// + /// + public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) + { + try + { + Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); + + this.Entities.Add(prim.uuid, prim); + this._primCount++; + + // Trigger event for listeners + eventManager.TriggerOnNewPrimitive(prim); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); + } + } + + #endregion + + #region Add/Remove Avatar Methods + + /// + /// + /// + /// + /// + public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) + { + remoteClient.OnRegionHandShakeReply += this.SendLayerData; + //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); + remoteClient.OnChatFromViewer += this.SimChat; + remoteClient.OnRequestWearables += this.InformClientOfNeighbours; + remoteClient.OnAddPrim += this.AddNewPrim; + remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; + remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; + remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; + //remoteClient.OnObjectSelect += this.SelectPrim; + remoteClient.OnGrapUpdate += this.MoveObject; + + /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); + remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); + remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); + remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); + remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); + */ + + ScenePresence newAvatar = null; + try + { + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); + + //newAvatar.SendRegionHandshake(); + this.estateManager.sendRegionHandshake(remoteClient); + + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + lock (this.m_syncRoot) + { + newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + } + + lock (Entities) + { + if (!Entities.ContainsKey(agentID)) + { + this.Entities.Add(agentID, newAvatar); + } + else + { + Entities[agentID] = newAvatar; + } + } + lock (Avatars) + { + if (Avatars.ContainsKey(agentID)) + { + Avatars[agentID] = newAvatar; + } + else + { + this.Avatars.Add(agentID, newAvatar); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); + } + return; + } + + + + /// + /// + /// + /// + public override void RemoveClient(LLUUID agentID) + { + eventManager.TriggerOnRemovePresence(agentID); + + return; + } + #endregion + + #region Request Avatars List Methods + //The idea is to have a group of method that return a list of avatars meeting some requirement + // ie it could be all Avatars within a certain range of the calling prim/avatar. + + /// + /// Request a List of all Avatars in this World + /// + /// + public List RequestAvatarList() + { + List result = new List(); + + foreach (ScenePresence avatar in Avatars.Values) + { + result.Add(avatar); + } + + return result; + } + + /// + /// Request a filtered list of Avatars in this World + /// + /// + public List RequestAvatarList(FilterAvatarList filter) + { + List result = new List(); + + foreach (ScenePresence avatar in Avatars.Values) + { + if (filter(avatar)) + { + result.Add(avatar); + } + } + + return result; + } + + /// + /// Request a Avatar by UUID + /// + /// + /// + public ScenePresence RequestAvatar(LLUUID avatarID) + { + if (this.Avatars.ContainsKey(avatarID)) + { + return Avatars[avatarID]; + } + return null; + } + #endregion + + + #region RegionCommsHost + + /// + /// + /// + public void RegisterRegionWithComms() + { + GridInfo gridSettings = new GridInfo(); + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); + if (this.regionCommsHost != null) + { + this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); + this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); + } + } + + /// + /// + /// + /// + /// + public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) + { + // Console.WriteLine("World.cs - add new user connection"); + //should just check that its meant for this region + if (regionHandle == this.m_regInfo.RegionHandle) + { + if (agent.CapsPath != "") + { + //Console.WriteLine("new user, so creating caps handler for it"); + Capabilities.Caps cap = new Capabilities.Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + cap.RegisterHandlers(); + this.capsHandlers.Add(agent.AgentID, cap); + } + this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); + } + } + + public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (regionHandle == this.m_regInfo.RegionHandle) + { + if (this.Avatars.ContainsKey(agentID)) + { + this.Avatars[agentID].MakeAvatar(position); + } + } + } + + /// + /// + /// + public void InformClientOfNeighbours(IClientAPI remoteClient) + { + // Console.WriteLine("informing client of neighbouring regions"); + List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); + + //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); + if (neighbours != null) + { + for (int i = 0; i < neighbours.Count; i++) + { + // Console.WriteLine("sending neighbours data"); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); + //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); + } + } + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) + { + return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); + } + + /// + /// + /// + /// + /// + /// + /// + public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) + { + List mapBlocks; + mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); + remoteClient.SendMapBlock(mapBlocks); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) + { + if (regionHandle == this.m_regionHandle) + { + if (this.Avatars.ContainsKey(remoteClient.AgentId)) + { + remoteClient.SendTeleportLocationStart(); + remoteClient.SendLocalTeleport(position, lookAt, flags); + this.Avatars[remoteClient.AgentId].Teleport(position); + } + } + else + { + RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle); + if (reg != null) + { + remoteClient.SendTeleportLocationStart(); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); + this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.CommsIPListenAddr, (ushort)reg.CommsIPListenPort, 4, (1 << 4)); + } + //remoteClient.SendTeleportCancel(); + } + } + + /// + /// + /// + /// + /// + /// + public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) + { + return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); + } + + #endregion + } +} diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs new file mode 100644 index 0000000..3d8f522 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -0,0 +1,201 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections.Generic; +using System.Text; +using System.Reflection; +using System.IO; +using System.Threading; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Region.Environment.Scripting; +using OpenSim.Region.Terrain; +using OpenSim.Region.Caches; + +namespace OpenSim.Region.Environment.Scenes +{ + public abstract class SceneBase : IWorld + { + public Dictionary Entities; + protected Dictionary m_clientThreads; + protected ulong m_regionHandle; + protected string m_regionName; + protected RegionInfo m_regInfo; + + public TerrainEngine Terrain; + + public string m_datastore; + public ILocalStorage localStorage; + + protected object m_syncRoot = new object(); + private uint m_nextLocalId = 8880000; + protected AssetCache assetCache; + + #region Update Methods + /// + /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) + /// + public abstract void Update(); + + #endregion + + #region Terrain Methods + + /// + /// Loads the World heightmap + /// + public abstract void LoadWorldMap(); + + /// + /// Loads a new storage subsystem from a named library + /// + /// Storage Library + /// Successful or not + public bool LoadStorageDLL(string dllName) + { + try + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + ILocalStorage store = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("ILocalStorage", true); + + if (typeInterface != null) + { + ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + store = plug; + + store.Initialise(this.m_datastore); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + this.localStorage = store; + return (store == null); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); + return false; + } + } + + + /// + /// Send the region heightmap to the client + /// + /// Client to send to + public virtual void SendLayerData(IClientAPI RemoteClient) + { + RemoteClient.SendLayerData(Terrain.getHeights1D()); + } + + /// + /// Sends a specified patch to a client + /// + /// Patch coordinate (x) 0..16 + /// Patch coordinate (y) 0..16 + /// The client to send to + public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) + { + RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); + } + + #endregion + + #region Add/Remove Agent/Avatar + /// + /// + /// + /// + /// + /// + public abstract void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child); + + /// + /// + /// + /// + public abstract void RemoveClient(LLUUID agentID); + + #endregion + + /// + /// + /// + /// + public virtual RegionInfo RegionInfo + { + get { return this.m_regInfo; } + } + + public object SyncRoot + { + get { return m_syncRoot; } + } + + public uint NextLocalId + { + get { return m_nextLocalId++; } + } + + #region Shutdown + /// + /// Tidy before shutdown + /// + public virtual void Close() + { + try + { + this.localStorage.ShutDown(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); + } + } + + #endregion + + + } +} diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs new file mode 100644 index 0000000..fa1bacb --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Environment.Scenes +{ + /// + /// A class for triggering remote scene events. + /// + public class EventManager + { + public delegate void OnFrameDelegate(); + public event OnFrameDelegate OnFrame; + + public delegate void OnNewPresenceDelegate(ScenePresence presence); + public event OnNewPresenceDelegate OnNewPresence; + + public delegate void OnNewPrimitiveDelegate(Primitive prim); + public event OnNewPrimitiveDelegate OnNewPrimitive; + + public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); + public event OnRemovePresenceDelegate OnRemovePresence; + + public void TriggerOnFrame() + { + if (OnFrame != null) + { + OnFrame(); + } + } + + public void TriggerOnNewPrimitive(Primitive prim) + { + if (OnNewPrimitive != null) + OnNewPrimitive(prim); + } + + public void TriggerOnNewPresence(ScenePresence presence) + { + if (OnNewPresence != null) + OnNewPresence(presence); + } + + public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid) + { + if (OnRemovePresence != null) + { + OnRemovePresence(uuid); + } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs new file mode 100644 index 0000000..88fb160 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -0,0 +1,128 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; + +namespace OpenSim.Region.Environment.Scenes +{ + public class SceneObject : Entity + { + private LLUUID rootUUID; + //private Dictionary ChildPrimitives = new Dictionary(); + protected Primitive rootPrimitive; + private Scene m_world; + protected ulong regionHandle; + + /// + /// + /// + public SceneObject() + { + + } + + /// + /// + /// + /// + /// + /// + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) + { + this.rootPrimitive = new Primitive( this.regionHandle, this.m_world, addPacket, agentID, localID); + } + + /// + /// + /// + /// + public void CreateFromBytes(byte[] data) + { + + } + + /// + /// + /// + public override void update() + { + + } + + /// + /// + /// + public override void BackUp() + { + + } + + /// + /// + /// + /// + public void GetProperites(IClientAPI client) + { + //needs changing + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; + proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); + proper.ObjectData[0].ItemID = LLUUID.Zero; + proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate; + proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID; + proper.ObjectData[0].FolderID = LLUUID.Zero; + proper.ObjectData[0].FromTaskID = LLUUID.Zero; + proper.ObjectData[0].GroupID = LLUUID.Zero; + proper.ObjectData[0].InventorySerial = 0; + proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].ObjectID = this.uuid; + proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID; + proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TextureID = new byte[0]; + proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].Name = new byte[0]; + proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask; + proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask; + proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask; + proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask; + proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask; + + client.OutPacket(proper); + + } + + } +} diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs new file mode 100644 index 0000000..2caabc2 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs @@ -0,0 +1,76 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using System.Xml; + +namespace OpenSim.Region.Environment.Scenes +{ + partial class ScenePresence + { + public class AvatarAnimations + { + + public Dictionary AnimsLLUUID = new Dictionary(); + public Dictionary AnimsNames = new Dictionary(); + + public AvatarAnimations() + { + } + + public void LoadAnims() + { + //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); + XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); + + XmlDocument doc = new XmlDocument(); + doc.Load(reader); + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) + { + + if (nod.Attributes["name"] != null) + { + AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); + } + + } + + reader.Close(); + + // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); + + foreach (KeyValuePair kp in OpenSim.Region.Environment.Scenes.ScenePresence.Animations.AnimsLLUUID) + { + AnimsNames.Add(kp.Value, kp.Key); + } + } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs new file mode 100644 index 0000000..2c81d2a --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs @@ -0,0 +1,90 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Region.Environment.Scenes +{ + partial class ScenePresence + { + public class Avatar : IScenePresenceBody + { + public Avatar() + { + + } + + public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) + { + } + + public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) + { + } + + public void SendOurAppearance(IClientAPI OurClient) + { + } + + public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) + { + } + } + + public class ChildAgent : IScenePresenceBody //is a ghost + { + public ChildAgent() + { + + } + + public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) + { + } + + public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) + { + } + + public void SendOurAppearance(IClientAPI OurClient) + { + } + + public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) + { + } + } + } + +} diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs new file mode 100644 index 0000000..96e5c94 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -0,0 +1,525 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using Axiom.MathLib; + +namespace OpenSim.Region.Environment.Scenes +{ + public partial class ScenePresence : Entity + { + public static bool PhysicsEngineFlying = false; + public static AvatarAnimations Animations; + public static byte[] DefaultTexture; + public string firstname; + public string lastname; + public IClientAPI ControllingClient; + public LLUUID current_anim; + public int anim_seq; + private bool updateflag = false; + private byte movementflag = 0; + private List forcesList = new List(); + private short _updateCount = 0; + private Axiom.MathLib.Quaternion bodyRot; + private LLObject.TextureEntry avatarAppearanceTexture = null; + private byte[] visualParams; + private AvatarWearable[] Wearables; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + private ulong m_regionHandle; + private bool childAgent = false; + private bool newForce = false; + private bool newAvatar = false; + private IScenePresenceBody m_body; + + protected RegionInfo m_regionInfo; + + #region Properties + /// + /// + /// + public PhysicsActor PhysActor + { + set + { + this._physActor = value; + } + get + { + return _physActor; + } + } + #endregion + + #region Constructor(s) + /// + /// + /// + /// + /// + /// + /// + public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) + { + + m_world = world; + this.uuid = theClient.AgentId; + + m_regionInfo = reginfo; + m_regionHandle = reginfo.RegionHandle; + OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs "); + ControllingClient = theClient; + this.firstname = ControllingClient.FirstName; + this.lastname = ControllingClient.LastName; + m_localId = m_world.NextLocalId; + Pos = ControllingClient.StartPos; + visualParams = new byte[218]; + for (int i = 0; i < 218; i++) + { + visualParams[i] = 100; + } + + Wearables = AvatarWearable.DefaultWearables; + + this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + + //register for events + ControllingClient.OnRequestWearables += this.SendOurAppearance; + //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); + ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; + ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; + ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; + // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); + // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); + //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); + + } + #endregion + + #region Status Methods + /// + /// Not Used, most likely can be deleted + /// + /// + public void ChildStatusChange(bool status) + { + this.childAgent = status; + + if (this.childAgent == true) + { + this.Velocity = new LLVector3(0, 0, 0); + this.Pos = new LLVector3(128, 128, 70); + + } + } + + /// + /// + /// + /// + public void MakeAvatar(LLVector3 pos) + { + //this.childAvatar = false; + this.Pos = pos; + this.newAvatar = true; + this.childAgent = false; + } + + protected void MakeChildAgent() + { + this.Velocity = new LLVector3(0, 0, 0); + this.Pos = new LLVector3(128, 128, 70); + this.childAgent = true; + } + + /// + /// + /// + /// + public void Teleport(LLVector3 pos) + { + this.Pos = pos; + this.SendTerseUpdateToALLClients(); + } + + /// + /// + /// + public void StopMovement() + { + + } + #endregion + + #region Event Handlers + /// + /// + /// + /// + /// + public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) + { + + } + + /// + /// Complete Avatar's movement into the region + /// + public void CompleteMovement() + { + LLVector3 look = this.Velocity; + if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) + { + look = new LLVector3(0.99f, 0.042f, 0); + } + this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); + if (this.childAgent) + { + this.childAgent = false; + } + } + + /// + /// + /// + /// + public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) + { + if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) + { + Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + if (((movementflag & 1) == 0) || (q != this.bodyRot)) + { + Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); + this.AddNewMovement(v3, q); + movementflag = 1; + this.bodyRot = q; + } + } + else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) + { + Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + if (((movementflag & 2) == 0) || (q != this.bodyRot)) + { + Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); + this.AddNewMovement(v3, q); + movementflag = 2; + this.bodyRot = q; + } + } + else + { + if ((movementflag) != 0) + { + NewForce newVelocity = new NewForce(); + newVelocity.X = 0; + newVelocity.Y = 0; + newVelocity.Z = 0; + this.forcesList.Add(newVelocity); + movementflag = 0; + } + } + + } + + protected void AddNewMovement(Axiom.MathLib.Vector3 vec, Axiom.MathLib.Quaternion rotation) + { + NewForce newVelocity = new NewForce(); + Axiom.MathLib.Vector3 direc = rotation * vec; + direc.Normalize(); + + direc = direc * ((0.03f) * 128f); + if (this._physActor.Flying) + direc *= 4; + + newVelocity.X = direc.x; + newVelocity.Y = direc.y; + newVelocity.Z = direc.z; + this.forcesList.Add(newVelocity); + } + + #endregion + + #region Overridden Methods + /// + /// + /// + public override void LandRenegerated() + { + + } + + /// + /// + /// + public override void update() + { + if (this.childAgent == false) + { + if (this.newForce) + { + this.SendTerseUpdateToALLClients(); + _updateCount = 0; + } + else if (movementflag != 0) + { + _updateCount++; + if (_updateCount > 3) + { + this.SendTerseUpdateToALLClients(); + _updateCount = 0; + } + } + + this.CheckForBorderCrossing(); + } + } + #endregion + + #region Update Client(s) + /// + /// + /// + /// + public void SendTerseUpdateToClient(IClientAPI RemoteClient) + { + LLVector3 pos = this.Pos; + LLVector3 vel = this.Velocity; + RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); + } + + /// + /// + /// + public void SendTerseUpdateToALLClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendTerseUpdateToClient(avatars[i].ControllingClient); + } + } + + /// + /// + /// + /// + public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) + { + remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); + } + + /// + /// + /// + public void SendInitialData() + { + this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); + if (this.newAvatar) + { + this.m_world.InformClientOfNeighbours(this.ControllingClient); + this.newAvatar = false; + } + } + + /// + /// + /// + /// + public void SendOurAppearance(IClientAPI OurClient) + { + this.ControllingClient.SendWearables(this.Wearables); + } + + /// + /// + /// + /// + public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) + { + + } + + /// + /// + /// + /// + /// + public void SendAnimPack(LLUUID animID, int seq) + { + + + } + + /// + /// + /// + public void SendAnimPack() + { + + } + #endregion + + #region Border Crossing Methods + /// + /// + /// + protected void CheckForBorderCrossing() + { + LLVector3 pos2 = this.Pos; + LLVector3 vel = this.Velocity; + + float timeStep = 0.2f; + pos2.X = pos2.X + (vel.X * timeStep); + pos2.Y = pos2.Y + (vel.Y * timeStep); + pos2.Z = pos2.Z + (vel.Z * timeStep); + + if ((pos2.X < 0) || (pos2.X > 256)) + { + this.CrossToNewRegion(); + } + + if ((pos2.Y < 0) || (pos2.Y > 256)) + { + this.CrossToNewRegion(); + } + } + + /// + /// + /// + protected void CrossToNewRegion() + { + LLVector3 pos = this.Pos; + LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); + uint neighbourx = this.m_regionInfo.RegionLocX; + uint neighboury = this.m_regionInfo.RegionLocY; + + if (pos.X < 2) + { + neighbourx -= 1; + newpos.X = 254; + } + if (pos.X > 253) + { + neighbourx += 1; + newpos.X = 1; + } + if (pos.Y < 2) + { + neighboury -= 1; + newpos.Y = 254; + } + if (pos.Y > 253) + { + neighboury += 1; + newpos.Y = 1; + } + + LLVector3 vel = this.velocity; + ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); + RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); + if (neighbourRegion != null) + { + bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); + if (res) + { + this.MakeChildAgent(); + this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.CommsIPListenAddr), (ushort)neighbourRegion.CommsIPListenPort); + } + } + } + #endregion + + /// + /// + /// + public static void LoadAnims() + { + + } + + /// + /// + /// + public override void updateMovement() + { + newForce = false; + lock (this.forcesList) + { + if (this.forcesList.Count > 0) + { + for (int i = 0; i < this.forcesList.Count; i++) + { + NewForce force = this.forcesList[i]; + + this.updateflag = true; + this.Velocity = new LLVector3(force.X, force.Y, force.Z); + this.newForce = true; + } + for (int i = 0; i < this.forcesList.Count; i++) + { + this.forcesList.RemoveAt(0); + } + } + } + } + + public static void LoadTextureFile(string name) + { + FileInfo fInfo = new FileInfo(name); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); + BinaryReader br = new BinaryReader(fStream); + byte[] data1 = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + DefaultTexture = data1; + } + + public class NewForce + { + public float X; + public float Y; + public float Z; + + public NewForce() + { + + } + } + } + +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs new file mode 100644 index 0000000..eb8a117 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs @@ -0,0 +1,40 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scripting +{ + public interface IScriptContext + { + IScriptEntity Entity { get; } + bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs new file mode 100644 index 0000000..e813626 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scripting +{ + public interface IScriptReadonlyEntity + { + LLVector3 Pos { get; } + string Name { get; } + } + + public interface IScriptEntity + { + LLVector3 Pos { get; set; } + string Name { get; } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs new file mode 100644 index 0000000..115b4f4 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs @@ -0,0 +1,126 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Physics.Manager; +using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; +using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; +using Primitive = OpenSim.Region.Environment.Scenes.Primitive; + +namespace OpenSim.Region.Environment.Scripting +{ + public delegate void ScriptEventHandler(IScriptContext context); + + public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity + { + private Scene m_world; + private Script m_script; + private Entity m_entity; + + public LLUUID ScriptId + { + get + { + return m_script.ScriptId; + } + } + + public void OnFrame() + { + m_script.OnFrame(this); + } + + public ScriptHandler(Script script, Entity entity, Scene world) + { + m_script = script; + m_entity = entity; + m_world = world; + } + + #region IScriptContext Members + + IScriptEntity IScriptContext.Entity + { + get + { + return this; + } + } + + bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) + { + foreach (Entity entity in m_world.Entities.Values ) + { + if( entity is Avatar ) + { + avatar = entity; + return true; + } + } + + avatar = null; + return false; + } + + #endregion + + #region IScriptEntity and IScriptReadonlyEntity Members + + public string Name + { + get + { + return m_entity.Name; + } + } + + public LLVector3 Pos + { + get + { + return m_entity.Pos; + } + + set + { + if (m_entity is Primitive) + { + Primitive prim = m_entity as Primitive; + // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. + // prim.UpdatePosition( value ); + } + } + } + + #endregion + } + +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs new file mode 100644 index 0000000..5d398b0 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs @@ -0,0 +1,53 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scripting +{ + public class Script + { + private LLUUID m_scriptId; + public virtual LLUUID ScriptId + { + get + { + return m_scriptId; + } + } + + public Script( LLUUID scriptId ) + { + m_scriptId = scriptId; + } + + public ScriptEventHandler OnFrame; + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs new file mode 100644 index 0000000..0ce65ea --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Environment.Scripting +{ + public delegate Script ScriptFactory(); +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs new file mode 100644 index 0000000..90c79e3 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs @@ -0,0 +1,64 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scripting +{ + public class FollowRandomAvatar : Script + { + public FollowRandomAvatar() + : base(LLUUID.Random()) + { + OnFrame += MyOnFrame; + } + + private void MyOnFrame(IScriptContext context) + { + LLVector3 pos = context.Entity.Pos; + + IScriptReadonlyEntity avatar; + + if (context.TryGetRandomAvatar(out avatar)) + { + LLVector3 avatarPos = avatar.Pos; + + float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; + float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; + + LLVector3 newPos = new LLVector3(x, y, pos.Z); + + context.Entity.Pos = newPos; + } + } + } + + +} diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 2eb5ac0..0a82172 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -122,7 +122,7 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - + OpenSim.Region.Environment {DCBA491C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/OpenSim/Region/Simulation/Caps.cs b/OpenSim/Region/Simulation/Caps.cs deleted file mode 100644 index 9edbd54..0000000 --- a/OpenSim/Region/Simulation/Caps.cs +++ /dev/null @@ -1,258 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using OpenSim.Framework.Servers; -using OpenSim.Framework; -using OpenSim.Framework.Utilities; -using OpenSim.Framework.Types; -using OpenSim.Region.Caches; -using libsecondlife; - -namespace OpenSim.Region.Environment -{ - public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); - - public class Caps - { - private string httpListenerAddress; - private uint httpListenPort; - private string capsObjectPath = "00001-"; - private string requestPath = "0000/"; - private string mapLayerPath = "0001/"; - private string newInventory = "0002/"; - private string requestTexture = "0003/"; - private string eventQueue = "0100/"; - private BaseHttpServer httpListener; - private LLUUID agentID; - private AssetCache assetCache; - private int eventQueueCount = 1; - private Queue CapsEventQueue = new Queue(); - - public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) - { - assetCache = assetCach; - capsObjectPath = capsPath; - httpListener = httpServer; - httpListenerAddress = httpListen; - httpListenPort = httpPort; - agentID = agent; - } - - /// - /// - /// - public void RegisterHandlers() - { - Console.WriteLine("registering CAPS handlers"); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); - } - - /// - /// - /// - /// - /// - /// - /// - public string CapsRequest(string request, string path, string param) - { - // Console.WriteLine("Caps Request " + request); - string result = ""; - result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); - return result; - } - - /// - /// - /// - /// - protected LLSDCapsDetails GetCapabilities() - { - /* string capURLS = ""; - capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; - capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; - //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; - //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; - return capURLS;*/ - - LLSDCapsDetails caps = new LLSDCapsDetails(); - caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; - caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; - return caps; - } - - /// - /// - /// - /// - /// - /// - /// - public string MapLayer(string request, string path, string param) - { - Encoding _enc = System.Text.Encoding.UTF8; - Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); - LLSDMapRequest mapReq = new LLSDMapRequest(); - LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); - - LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); - mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); - string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); - - //Console.WriteLine(" Maplayer response is " + res); - - return res; - } - - /// - /// - /// - /// - protected LLSDMapLayer BuildLLSDMapLayerResponse() - { - LLSDMapLayer mapLayer = new LLSDMapLayer(); - mapLayer.Right = 5000; - mapLayer.Top = 5000; - mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); - - return mapLayer; - } - - public string ProcessEventQueue(string request, string path, string param) - { - // Console.WriteLine("event queue request " + request); - string res = ""; - int timer = 0; - - /*while ((timer < 200) || (this.CapsEventQueue.Count < 1)) - { - timer++; - }*/ - if (this.CapsEventQueue.Count > 0) - { - lock (this.CapsEventQueue) - { - string item = CapsEventQueue.Dequeue(); - res = item; - } - } - else - { - res = this.CreateEmptyEventResponse(); - } - return res; - } - - public string CreateEstablishAgentComms(string caps, string ipAddressPort) - { - string res = "id" + eventQueueCount + ""; - res += "events"; - res += "messageEstablishAgentCommunication"; - res += "body"; - res += "sim-ip-and-port" + ipAddressPort + ""; - res += "seed-capability" + caps + ""; - res += "agent-id" + this.agentID.ToStringHyphenated() + ""; - res += ""; - res += ""; - res += ""; - eventQueueCount++; - this.CapsEventQueue.Enqueue(res); - return res; - } - - public string CreateEmptyEventResponse() - { - string res = "id" + eventQueueCount + ""; - res += "events"; - res += ""; - res += ""; - eventQueueCount++; - return res; - } - - public string NewAgentInventory(string request, string path, string param) - { - //Console.WriteLine("received upload request:"+ request); - string res = ""; - LLUUID newAsset = LLUUID.Random(); - LLUUID newInvItem = LLUUID.Random(); - string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); - httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); - string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; - //Console.WriteLine("uploader url is " + uploaderURL); - res += ""; - res += "uploader" + uploaderURL + ""; - //res += "successtrue"; - res += "stateupload"; - res += ""; - uploader.OnUpLoad += this.UploadHandler; - return res; - } - - public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) - { - // Console.WriteLine("upload handler called"); - AssetBase asset; - asset = new AssetBase(); - asset.FullID = assetID; - asset.Type = 0; - asset.InvType = 0; - asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); - asset.Data = data; - this.assetCache.AddAsset(asset); - } - - public class AssetUploader - { - public event UpLoadedTexture OnUpLoad; - - private string uploaderPath = ""; - private LLUUID newAssetID; - private LLUUID inventoryItemID; - private BaseHttpServer httpListener; - public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) - { - newAssetID = assetID; - inventoryItemID = inventoryItem; - uploaderPath = path; - httpListener = httpServer; - - } - - public string uploaderCaps(string request, string path, string param) - { - Encoding _enc = System.Text.Encoding.UTF8; - byte[] data = _enc.GetBytes(request); - //Console.WriteLine("recieved upload " + Util.FieldToString(data)); - LLUUID inv = this.inventoryItemID; - string res = ""; - res += ""; - res += "new_asset" + newAssetID.ToStringHyphenated() + ""; - res += "new_inventory_item" + inv.ToStringHyphenated() + ""; - res += "statecomplete"; - res += ""; - - // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); - httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); - if (OnUpLoad != null) - { - OnUpLoad(newAssetID, inv, data); - } - - /*FileStream fs = File.Create("upload.jp2"); - BinaryWriter bw = new BinaryWriter(fs); - bw.Write(data); - bw.Close(); - fs.Close();*/ - return res; - } - } - } -} diff --git a/OpenSim/Region/Simulation/EstateManager.cs b/OpenSim/Region/Simulation/EstateManager.cs deleted file mode 100644 index c2c1ecf..0000000 --- a/OpenSim/Region/Simulation/EstateManager.cs +++ /dev/null @@ -1,301 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; -using OpenSim.Framework.Interfaces; -using OpenSim.Region.Environment; -using OpenSim.Region.Environment.Scenes; -using OpenSim; -using libsecondlife; -using libsecondlife.Packets; -using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; - - -namespace OpenSim.Region.Environment -{ - - /// - /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings - /// - public class EstateManager - { - private Scene m_world; - private RegionInfo m_regInfo; - - public EstateManager(Scene world,RegionInfo reginfo) - { - m_world = world; //Estate settings found at world.m_regInfo.estateSettings - m_regInfo = reginfo; - } - - private bool convertParamStringToBool(byte[] field) - { - string s = Helpers.FieldToUTF8String(field); - if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") - { - return true; - } - return false; - } - - public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) - { - if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID) - { - switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) - { - case "getinfo": - Console.WriteLine("GETINFO Requested"); - this.sendRegionInfoPacketToAll(); - - break; - case "setregioninfo": - if (packet.ParamList.Length != 9) - { - OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); - } - else - { - m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None; - - if (convertParamStringToBool(packet.ParamList[0].Parameter)) - { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform; - } - - if (convertParamStringToBool(packet.ParamList[1].Parameter)) - { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly; - } - - if (convertParamStringToBool(packet.ParamList[2].Parameter)) - { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage; - } - - if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) - { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell; - } - - - int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); - m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; - - float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); - m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; - - int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); - m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel; - - - if (convertParamStringToBool(packet.ParamList[7].Parameter)) - { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject; - } - - if (convertParamStringToBool(packet.ParamList[8].Parameter)) - { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges; - } - - sendRegionInfoPacketToAll(); - - } - break; - case "texturebase": - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) - { - string s = Helpers.FieldToUTF8String(block.Parameter); - string[] splitField = s.Split(' '); - if (splitField.Length == 2) - { - LLUUID tempUUID = new LLUUID(splitField[1]); - switch (Convert.ToInt16(splitField[0])) - { - case 0: - m_regInfo.estateSettings.terrainBase0 = tempUUID; - break; - case 1: - m_regInfo.estateSettings.terrainBase1 = tempUUID; - break; - case 2: - m_regInfo.estateSettings.terrainBase2 = tempUUID; - break; - case 3: - m_regInfo.estateSettings.terrainBase3 = tempUUID; - break; - } - } - } - break; - case "texturedetail": - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) - { - - string s = Helpers.FieldToUTF8String(block.Parameter); - string[] splitField = s.Split(' '); - if (splitField.Length == 2) - { - LLUUID tempUUID = new LLUUID(splitField[1]); - switch (Convert.ToInt16(splitField[0])) - { - case 0: - m_regInfo.estateSettings.terrainDetail0 = tempUUID; - break; - case 1: - m_regInfo.estateSettings.terrainDetail1 = tempUUID; - break; - case 2: - m_regInfo.estateSettings.terrainDetail2 = tempUUID; - break; - case 3: - m_regInfo.estateSettings.terrainDetail3 = tempUUID; - break; - } - } - } - break; - case "textureheights": - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) - { - - string s = Helpers.FieldToUTF8String(block.Parameter); - string[] splitField = s.Split(' '); - if (splitField.Length == 3) - { - - float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); - float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); - - switch (Convert.ToInt16(splitField[0])) - { - case 0: - m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; - m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; - break; - case 1: - m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; - m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; - break; - case 2: - m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; - m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; - break; - case 3: - m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; - m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; - break; - } - } - } - break; - case "texturecommit": - sendRegionHandshakeToAll(); - break; - case "setregionterrain": - if (packet.ParamList.Length != 9) - { - OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); - } - else - { - m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); - m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); - m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); - m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); - m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); - - sendRegionInfoPacketToAll(); - } - break; - default: - OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); - break; - } - } - } - - public void sendRegionInfoPacketToAll() - { - List avatars = m_world.RequestAvatarList(); - - for (int i = 0; i < avatars.Count; i++) - { - this.sendRegionInfoPacket(avatars[i].ControllingClient); - } - } - - public void sendRegionHandshakeToAll() - { - List avatars = m_world.RequestAvatarList(); - - for (int i = 0; i < avatars.Count; i++) - { - this.sendRegionHandshake(avatars[i].ControllingClient); - } - } - - public void sendRegionInfoPacket(IClientAPI remote_client) - { - Encoding _enc = System.Text.Encoding.ASCII; - - AgentCircuitData circuitData = remote_client.RequestClientInfo(); - - RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); - regionInfoPacket.AgentData.AgentID = circuitData.AgentID; - regionInfoPacket.AgentData.SessionID = circuitData.SessionID; - regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor; - regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID; - regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents; - regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor; - regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID; - regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; - regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; - regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; - regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; - regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; - regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName); - regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; - regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; - regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; - regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun; - regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight; - - remote_client.OutPacket(regionInfoPacket); - } - - public void sendRegionHandshake(IClientAPI remoteClient) - { - remoteClient.SendRegionHandshake(m_regInfo); - } - - } -} diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj b/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj deleted file mode 100644 index 3f8b60d..0000000 --- a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj +++ /dev/null @@ -1,211 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {DCBA491C-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Environment - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Environment - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.GenericConfig.Xml - {C74E4A30-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Terrain.BasicTerrain - {C9E0F891-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Simulation/ParcelManager.cs b/OpenSim/Region/Simulation/ParcelManager.cs deleted file mode 100644 index 1cab4ab..0000000 --- a/OpenSim/Region/Simulation/ParcelManager.cs +++ /dev/null @@ -1,892 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Region.Environment.Scenes; -using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; - -namespace OpenSim.Region.Environment -{ - - - #region ParcelManager Class - /// - /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) - /// - public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver - { - - #region Constants - //Parcel types set with flags in ParcelOverlay. - //Only one of these can be used. - public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 - public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 - public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 - public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 - public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 - public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 - - - //Flags that when set, a border on the given side will be placed - //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) - //This took forever to figure out -- jeesh. /blame LL for even having to send these - public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 - public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 - - //RequestResults (I think these are right, they seem to work): - public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel - public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel - - //These are other constants. Yay! - public const int START_PARCEL_LOCAL_ID = 1; - #endregion - - #region Member Variables - public Dictionary parcelList = new Dictionary(); - private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; - private int[,] parcelIDList = new int[64, 64]; - - private Scene m_world; - private RegionInfo m_regInfo; - - #endregion - - #region Constructors - public ParcelManager(Scene world, RegionInfo reginfo) - { - - m_world = world; - m_regInfo = reginfo; - parcelIDList.Initialize(); - - } - #endregion - - #region Member Functions - - #region Parcel From Storage Functions - public void ParcelFromStorage(ParcelData data) - { - Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); - new_parcel.parcelData = data.Copy(); - new_parcel.setParcelBitmapFromByteArray(); - addParcel(new_parcel); - - } - - public void NoParcelDataFromStorage() - { - resetSimParcels(); - } - #endregion - - #region Parcel Add/Remove/Get/Create - /// - /// Creates a basic Parcel object without an owner (a zeroed key) - /// - /// - public Parcel createBaseParcel() - { - return new Parcel(new LLUUID(), false, m_world); - } - - /// - /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own - /// - /// The parcel being added - public void addParcel(Parcel new_parcel) - { - lastParcelLocalID++; - new_parcel.parcelData.localID = lastParcelLocalID; - parcelList.Add(lastParcelLocalID, new_parcel.Copy()); - - - bool[,] parcelBitmap = new_parcel.getParcelBitmap(); - int x, y; - for (x = 0; x < 64; x++) - { - for (y = 0; y < 64; y++) - { - if (parcelBitmap[x, y]) - { - parcelIDList[x, y] = lastParcelLocalID; - } - } - } - parcelList[lastParcelLocalID].forceUpdateParcelInfo(); - - - } - /// - /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList - /// - /// Parcel.localID of the parcel to remove. - public void removeParcel(int local_id) - { - int x, y; - for (x = 0; x < 64; x++) - { - for (y = 0; y < 64; y++) - { - if (parcelIDList[x, y] == local_id) - { - throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y); - } - } - } - m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData); - parcelList.Remove(local_id); - } - - private void performFinalParcelJoin(Parcel master, Parcel slave) - { - int x, y; - bool[,] parcelBitmapSlave = slave.getParcelBitmap(); - for (x = 0; x < 64; x++) - { - for (y = 0; y < 64; y++) - { - if (parcelBitmapSlave[x, y]) - { - parcelIDList[x, y] = master.parcelData.localID; - } - } - } - removeParcel(slave.parcelData.localID); - } - /// - /// Get the parcel at the specified point - /// - /// Value between 0 - 256 on the x axis of the point - /// Value between 0 - 256 on the y axis of the point - /// Parcel at the point supplied - public Parcel getParcel(int x, int y) - { - if (x > 256 || y > 256 || x < 0 || y < 0) - { - throw new Exception("Error: Parcel not found at point " + x + ", " + y); - } - else - { - return parcelList[parcelIDList[x / 4, y / 4]]; - } - - } - #endregion - - #region Parcel Modification - /// - /// Subdivides a parcel - /// - /// West Point - /// South Point - /// East Point - /// North Point - /// LLUUID of user who is trying to subdivide - /// Returns true if successful - private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) - { - //First, lets loop through the points and make sure they are all in the same parcel - //Get the parcel at start - Parcel startParcel = getParcel(start_x, start_y); - if (startParcel == null) return false; //No such parcel at the beginning - - //Loop through the points - try - { - int totalX = end_x - start_x; - int totalY = end_y - start_y; - int x, y; - for (y = 0; y < totalY; y++) - { - for (x = 0; x < totalX; x++) - { - Parcel tempParcel = getParcel(start_x + x, start_y + y); - if (tempParcel == null) return false; //No such parcel at that point - if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no - } - } - } - catch (Exception) - { - return false; //Exception. For now, lets skip subdivision - } - - //If we are still here, then they are subdividing within one parcel - //Check owner - if (startParcel.parcelData.ownerID != attempting_user_id) - { - return false; //They cant do this! - } - - //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) - Parcel newParcel = startParcel.Copy(); - newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; - newParcel.parcelData.globalID = LLUUID.Random(); - - newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); - - //Now, lets set the subdivision area of the original to false - int startParcelIndex = startParcel.parcelData.localID; - parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); - parcelList[startParcelIndex].forceUpdateParcelInfo(); - - - //Now add the new parcel - addParcel(newParcel); - - - - - - return true; - } - /// - /// Join 2 parcels together - /// - /// x value in first parcel - /// y value in first parcel - /// x value in second parcel - /// y value in second parcel - /// LLUUID of the avatar trying to join the parcels - /// Returns true if successful - private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) - { - end_x -= 4; - end_y -= 4; - - //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! - //This should be fixed later -- somewhat "incomplete code" --Ming - Parcel startParcel, endParcel; - - try - { - startParcel = getParcel(start_x, start_y); - endParcel = getParcel(end_x, end_y); - } - catch (Exception) - { - return false; //Error occured when trying to get the start and end parcels - } - if (startParcel == endParcel) - { - return false; //Subdivision of the same parcel is not allowed - } - - //Check the parcel owners: - if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) - { - return false; - } - if (startParcel.parcelData.ownerID != attempting_user_id) - { - //TODO: Group editing stuff. Avatar owner support for now - return false; - } - - //Same owners! Lets join them - //Merge them to startParcel - parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); - performFinalParcelJoin(startParcel, endParcel); - - return true; - - - - } - #endregion - - #region Parcel Updating - /// - /// Where we send the ParcelOverlay packet to the client - /// - /// The object representing the client - public void sendParcelOverlay(IClientAPI remote_client) - { - const int PARCEL_BLOCKS_PER_PACKET = 1024; - int x, y = 0; - byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; - int byteArrayCount = 0; - int sequenceID = 0; - ParcelOverlayPacket packet; - - for (y = 0; y < 64; y++) - { - for (x = 0; x < 64; x++) - { - byte tempByte = (byte)0; //This represents the byte for the current 4x4 - Parcel currentParcelBlock = getParcel(x * 4, y * 4); - - if (currentParcelBlock.parcelData.ownerID == remote_client.AgentId) - { - //Owner Flag - tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER); - } - else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentId)) - { - //Sale Flag - tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE); - } - else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero) - { - //Public Flag - tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC); - } - else - { - //Other Flag - tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER); - } - - - //Now for border control - if (x == 0) - { - tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); - } - else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) - { - tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); - } - - if (y == 0) - { - tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); - } - else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) - { - tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); - } - - byteArray[byteArrayCount] = tempByte; - byteArrayCount++; - if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET) - { - byteArrayCount = 0; - packet = new ParcelOverlayPacket(); - packet.ParcelData.Data = byteArray; - packet.ParcelData.SequenceID = sequenceID; - remote_client.OutPacket((Packet)packet); - sequenceID++; - byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; - } - } - } - - packet = new ParcelOverlayPacket(); - packet.ParcelData.Data = byteArray; - packet.ParcelData.SequenceID = sequenceID; //Eh? - remote_client.OutPacket((Packet)packet); - } - - public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) - { - //Get the parcels within the bounds - List temp = new List(); - int x, y, i; - int inc_x = end_x - start_x; - int inc_y = end_y - start_y; - for (x = 0; x < inc_x; x++) - { - for (y = 0; y < inc_y; y++) - { - OpenSim.Region.Environment.Parcel currentParcel = getParcel(start_x + x, start_y + y); - if (!temp.Contains(currentParcel)) - { - currentParcel.forceUpdateParcelInfo(); - temp.Add(currentParcel); - } - } - } - - int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL; - if (temp.Count > 1) - { - requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; - } - - for (i = 0; i < temp.Count; i++) - { - temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); - } - - - sendParcelOverlay(remote_client); - } - - public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) - { - if (parcelList.ContainsKey(packet.ParcelData.LocalID)) - { - parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); - } - } - public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) - { - subdivide(west, south, east, north, remote_client.AgentId); - } - public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) - { - join(west, south, east, north, remote_client.AgentId); - - } - #endregion - - /// - /// Resets the sim to the default parcel (full sim parcel owned by the default user) - /// - public void resetSimParcels() - { - //Remove all the parcels in the sim and add a blank, full sim parcel set to public - parcelList.Clear(); - lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; - parcelIDList.Initialize(); - - Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); - - fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); - fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; - fullSimParcel.parcelData.parcelDesc = ""; - - fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID; - fullSimParcel.parcelData.salePrice = 1; - fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; - fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; - - addParcel(fullSimParcel); - - } - #endregion - } - #endregion - - - #region Parcel Class - /// - /// Keeps track of a specific parcel's information - /// - public class Parcel - { - #region Member Variables - public ParcelData parcelData = new ParcelData(); - public Scene m_world; - - private bool[,] parcelBitmap = new bool[64, 64]; - - #endregion - - - #region Constructors - public Parcel(LLUUID owner_id, bool is_group_owned, Scene world) - { - m_world = world; - parcelData.ownerID = owner_id; - parcelData.isGroupOwned = is_group_owned; - - } - #endregion - - - #region Member Functions - - #region General Functions - /// - /// Checks to see if this parcel contains a point - /// - /// - /// - /// Returns true if the parcel contains the specified point - public bool containsPoint(int x, int y) - { - if (x >= 0 && y >= 0 && x <= 256 && x <= 256) - { - return (parcelBitmap[x / 4, y / 4] == true); - } - else - { - return false; - } - } - - public Parcel Copy() - { - Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); - - //Place all new variables here! - newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); - newParcel.parcelData = parcelData.Copy(); - - return newParcel; - } - - #endregion - - - #region Packet Request Handling - /// - /// Sends parcel properties as requested - /// - /// ID sent by client for them to keep track of - /// Bool sent by client for them to use - /// Object representing the client - public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) - { - - ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); - updatePacket.ParcelData.AABBMax = parcelData.AABBMax; - updatePacket.ParcelData.AABBMin = parcelData.AABBMin; - updatePacket.ParcelData.Area = parcelData.area; - updatePacket.ParcelData.AuctionID = parcelData.auctionID; - updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented - - updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; - - updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); - updatePacket.ParcelData.Category = (byte)parcelData.category; - updatePacket.ParcelData.ClaimDate = parcelData.claimDate; - updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; - updatePacket.ParcelData.GroupID = parcelData.groupID; - updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; - updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; - updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; - updatePacket.ParcelData.LocalID = parcelData.localID; - updatePacket.ParcelData.MaxPrims = 1000; //unemplemented - updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; - updatePacket.ParcelData.MediaID = parcelData.mediaID; - updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); - updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL); - updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); - updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented - updatePacket.ParcelData.OtherCount = 0; //unemplemented - updatePacket.ParcelData.OtherPrims = 0; //unemplented - updatePacket.ParcelData.OwnerID = parcelData.ownerID; - updatePacket.ParcelData.OwnerPrims = 0; //unemplemented - updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented - updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented - updatePacket.ParcelData.PassHours = parcelData.passHours; - updatePacket.ParcelData.PassPrice = parcelData.passPrice; - updatePacket.ParcelData.PublicCount = 0; //unemplemented - updatePacket.ParcelData.RegionDenyAnonymous = false; //unemplemented - updatePacket.ParcelData.RegionDenyIdentified = false; //unemplemented - updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented - updatePacket.ParcelData.RegionPushOverride = true; //unemplemented - updatePacket.ParcelData.RentPrice = 0; //?? - updatePacket.ParcelData.RequestResult = request_result; - updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented - updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented - updatePacket.ParcelData.SelfCount = 0;//unemplemented - updatePacket.ParcelData.SequenceID = sequence_id; - updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented - updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented - updatePacket.ParcelData.SnapSelection = snap_selection; - updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; - updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; - updatePacket.ParcelData.TotalPrims = 0; //unemplemented - updatePacket.ParcelData.UserLocation = parcelData.userLocation; - updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; - remote_client.OutPacket((Packet)updatePacket); - } - - public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) - { - if (remote_client.AgentId == parcelData.ownerID) - { - //Needs later group support - parcelData.authBuyerID = packet.ParcelData.AuthBuyerID; - parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; - parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); - parcelData.groupID = packet.ParcelData.GroupID; - parcelData.landingType = packet.ParcelData.LandingType; - parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale; - parcelData.mediaID = packet.ParcelData.MediaID; - parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); - parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); - parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name); - parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags; - parcelData.passHours = packet.ParcelData.PassHours; - parcelData.passPrice = packet.ParcelData.PassPrice; - parcelData.salePrice = packet.ParcelData.SalePrice; - parcelData.snapshotID = packet.ParcelData.SnapshotID; - parcelData.userLocation = packet.ParcelData.UserLocation; - parcelData.userLookAt = packet.ParcelData.UserLookAt; - - List avatars = m_world.RequestAvatarList(); - - for (int i = 0; i < avatars.Count; i++) - { - Parcel over = m_world.parcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y)); - if (over == this) - { - sendParcelProperties(0, false, 0, avatars[i].ControllingClient); - } - } - - } - } - #endregion - - - #region Update Functions - /// - /// Updates the AABBMin and AABBMax values after area/shape modification of parcel - /// - private void updateAABBAndAreaValues() - { - int min_x = 64; - int min_y = 64; - int max_x = 0; - int max_y = 0; - int tempArea = 0; - int x, y; - for (x = 0; x < 64; x++) - { - for (y = 0; y < 64; y++) - { - if (parcelBitmap[x, y] == true) - { - if (min_x > x) min_x = x; - if (min_y > y) min_y = y; - if (max_x < x) max_x = x; - if (max_y < y) max_y = y; - tempArea += 16; //16sqm parcel - } - } - } - parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); - parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); - parcelData.area = tempArea; - } - - public void updateParcelBitmapByteArray() - { - parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); - } - - /// - /// Update all settings in parcel such as area, bitmap byte array, etc - /// - public void forceUpdateParcelInfo() - { - this.updateAABBAndAreaValues(); - this.updateParcelBitmapByteArray(); - } - - public void setParcelBitmapFromByteArray() - { - parcelBitmap = convertBytesToParcelBitmap(); - } - #endregion - - - #region Parcel Bitmap Functions - /// - /// Sets the parcel's bitmap manually - /// - /// 64x64 block representing where this parcel is on a map - public void setParcelBitmap(bool[,] bitmap) - { - if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) - { - //Throw an exception - The bitmap is not 64x64 - throw new Exception("Error: Invalid Parcel Bitmap"); - } - else - { - //Valid: Lets set it - parcelBitmap = bitmap; - forceUpdateParcelInfo(); - - } - } - /// - /// Gets the parcels bitmap manually - /// - /// - public bool[,] getParcelBitmap() - { - return parcelBitmap; - } - /// - /// Converts the parcel bitmap to a packet friendly byte array - /// - /// - private byte[] convertParcelBitmapToBytes() - { - byte[] tempConvertArr = new byte[512]; - byte tempByte = 0; - int x, y, i, byteNum = 0; - i = 0; - for (y = 0; y < 64; y++) - { - for (x = 0; x < 64; x++) - { - tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8)); - if (i % 8 == 0) - { - tempConvertArr[byteNum] = tempByte; - tempByte = (byte)0; - i = 0; - byteNum++; - } - } - } - return tempConvertArr; - } - - private bool[,] convertBytesToParcelBitmap() - { - bool[,] tempConvertMap = new bool[64, 64]; - tempConvertMap.Initialize(); - byte tempByte = 0; - int x = 0, y = 0, i = 0, bitNum = 0; - for (i = 0; i < 512; i++) - { - tempByte = parcelData.parcelBitmapByteArray[i]; - for (bitNum = 0; bitNum < 8; bitNum++) - { - bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); - tempConvertMap[x, y] = bit; - x++; - if (x > 63) - { - x = 0; - y++; - } - - } - - } - return tempConvertMap; - } - /// - /// Full sim parcel creation - /// - /// - public static bool[,] basicFullRegionParcelBitmap() - { - return getSquareParcelBitmap(0, 0, 256, 256); - } - - /// - /// Used to modify the bitmap between the x and y points. Points use 64 scale - /// - /// - /// - /// - /// - /// - public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y) - { - - bool[,] tempBitmap = new bool[64, 64]; - tempBitmap.Initialize(); - - tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); - return tempBitmap; - } - - /// - /// Change a parcel's bitmap at within a square and set those points to a specific value - /// - /// - /// - /// - /// - /// - /// - /// - public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) - { - if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2) - { - //Throw an exception - The bitmap is not 64x64 - throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()"); - } - - int x, y; - for (y = 0; y < 64; y++) - { - for (x = 0; x < 64; x++) - { - if (x >= start_x / 4 && x < end_x / 4 - && y >= start_y / 4 && y < end_y / 4) - { - parcel_bitmap[x, y] = set_value; - } - } - } - return parcel_bitmap; - } - /// - /// Join the true values of 2 bitmaps together - /// - /// - /// - /// - public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) - { - if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) - { - //Throw an exception - The bitmap is not 64x64 - throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps"); - } - if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) - { - //Throw an exception - The bitmap is not 64x64 - throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); - - } - - int x, y; - for (y = 0; y < 64; y++) - { - for (x = 0; x < 64; x++) - { - if (bitmap_add[x, y]) - { - bitmap_base[x, y] = true; - } - } - } - return bitmap_base; - } - #endregion - - #endregion - - - } - #endregion - - -} diff --git a/OpenSim/Region/Simulation/RegionManager.cs b/OpenSim/Region/Simulation/RegionManager.cs deleted file mode 100644 index 17d9aad..0000000 --- a/OpenSim/Region/Simulation/RegionManager.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Communications; -using OpenSim.Framework; -using OpenSim.Framework.Types; -using OpenSim.Framework.Servers; - -namespace OpenSim.Region.Environment -{ - public class RegionManager //needs renaming , but first we need to rename the namespace - { - protected AuthenticateSessionsBase authenticateHandler; - protected RegionCommsListener regionCommsHost; - protected CommunicationsManager commsManager; - protected List capsHandlers = new List(); - protected BaseHttpServer httpListener; - - protected Scenes.Scene m_Scene; - - public ParcelManager parcelManager; - public EstateManager estateManager; - - public RegionManager() - { - - } - - } -} diff --git a/OpenSim/Region/Simulation/Scenes/Entity.cs b/OpenSim/Region/Simulation/Scenes/Entity.cs deleted file mode 100644 index bbba34d..0000000 --- a/OpenSim/Region/Simulation/Scenes/Entity.cs +++ /dev/null @@ -1,194 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; -using OpenSim.Physics.Manager; -using libsecondlife; -using OpenSim.Region.Environment.Scripting; - -namespace OpenSim.Region.Environment.Scenes -{ - public abstract class Entity : IScriptReadonlyEntity - { - public libsecondlife.LLUUID uuid; - public Quaternion rotation; - protected List children; - - protected PhysicsActor _physActor; - protected Scene m_world; - protected string m_name; - - /// - /// - /// - public virtual string Name - { - get { return m_name; } - } - - protected LLVector3 m_pos; - /// - /// - /// - public virtual LLVector3 Pos - { - get - { - if (this._physActor != null) - { - m_pos.X = _physActor.Position.X; - m_pos.Y = _physActor.Position.Y; - m_pos.Z = _physActor.Position.Z; - } - - return m_pos; - } - set - { - if (this._physActor != null) - { - try - { - lock (this.m_world.SyncRoot) - { - - this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - } - - m_pos = value; - } - } - - public LLVector3 velocity; - - /// - /// - /// - public virtual LLVector3 Velocity - { - get - { - if (this._physActor != null) - { - velocity.X = _physActor.Velocity.X; - velocity.Y = _physActor.Velocity.Y; - velocity.Z = _physActor.Velocity.Z; - } - - return velocity; - } - set - { - if (this._physActor != null) - { - try - { - lock (this.m_world.SyncRoot) - { - - this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - } - - velocity = value; - } - } - - protected uint m_localId; - - public uint LocalId - { - get { return m_localId; } - } - - /// - /// Creates a new Entity (should not occur on it's own) - /// - public Entity() - { - uuid = new libsecondlife.LLUUID(); - - m_pos = new LLVector3(); - velocity = new LLVector3(); - rotation = new Quaternion(); - m_name = "(basic entity)"; - children = new List(); - } - - /// - /// - /// - public virtual void updateMovement() - { - foreach (Entity child in children) - { - child.updateMovement(); - } - } - - /// - /// Performs any updates that need to be done at each frame. This function is overridable from it's children. - /// - public virtual void update() { - // Do any per-frame updates needed that are applicable to every type of entity - foreach (Entity child in children) - { - child.update(); - } - } - - /// - /// Called at a set interval to inform entities that they should back themsleves up to the DB - /// - public virtual void BackUp() - { - - } - - /// - /// Infoms the entity that the land (heightmap) has changed - /// - public virtual void LandRenegerated() - { - - } - } -} diff --git a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs deleted file mode 100644 index 36023d0..0000000 --- a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; - -namespace OpenSim.Region.Environment.Scenes -{ - public interface IScenePresenceBody - { - void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); - void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); - void SendOurAppearance(IClientAPI OurClient); - void SendAppearanceToOtherAgent(ScenePresence avatarInfo); - } -} diff --git a/OpenSim/Region/Simulation/Scenes/Primitive.cs b/OpenSim/Region/Simulation/Scenes/Primitive.cs deleted file mode 100644 index 0f649b2..0000000 --- a/OpenSim/Region/Simulation/Scenes/Primitive.cs +++ /dev/null @@ -1,582 +0,0 @@ - -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; - -namespace OpenSim.Region.Environment.Scenes -{ - public class Primitive : Entity - { - internal PrimData primData; - private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); - // private Dictionary m_clientThreads; - private ulong m_regionHandle; - private const uint FULL_MASK_PERMISSIONS = 2147483647; - private bool physicsEnabled = false; - private byte updateFlag = 0; - private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; - - private Dictionary inventoryItems; - - #region Properties - - public LLVector3 Scale - { - set - { - this.primData.Scale = value; - //this.dirtyFlag = true; - } - get - { - return this.primData.Scale; - } - } - - public PhysicsActor PhysActor - { - set - { - this._physActor = value; - } - } - - public override LLVector3 Pos - { - get - { - return base.Pos; - } - set - { - base.Pos = value; - } - } - #endregion - - /// - /// - /// - /// - /// - /// - public Primitive( ulong regionHandle, Scene world) - { - // m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - } - - /// - /// - /// - /// - /// - /// - /// - /// - public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) - { - // m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - this.CreateFromPacket(addPacket, ownerID, localID); - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID) - { - // m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - this.primData = new PrimData(); - this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - this.primData.OwnerID = owner; - this.primData.FullID = this.uuid = fullID; - this.primData.LocalID = m_localId = localID; - } - - /// - /// Constructor to create a default cube - /// - /// - /// - /// - /// - /// - /// - public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position) - { - //m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - this.primData = PrimData.DefaultCube(); - this.primData.OwnerID = owner; - this.primData.LocalID = m_localId = localID; - this.Pos = this.primData.Position = position; - - this.updateFlag = 1; - } - - /// - /// - /// - /// - public byte[] GetByteArray() - { - byte[] result = null; - List dataArrays = new List(); - dataArrays.Add(primData.ToBytes()); - foreach (Entity child in children) - { - if (child is OpenSim.Region.Environment.Scenes.Primitive) - { - dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray()); - } - } - byte[] primstart = Helpers.StringToField(""); - byte[] primend = Helpers.StringToField(""); - int totalLength = primstart.Length + primend.Length; - for (int i = 0; i < dataArrays.Count; i++) - { - totalLength += dataArrays[i].Length; - } - - result = new byte[totalLength]; - int arraypos = 0; - Array.Copy(primstart, 0, result, 0, primstart.Length); - arraypos += primstart.Length; - for (int i = 0; i < dataArrays.Count; i++) - { - Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); - arraypos += dataArrays[i].Length; - } - Array.Copy(primend, 0, result, arraypos, primend.Length); - - return result; - } - - #region Overridden Methods - - /// - /// - /// - public override void update() - { - if (this.updateFlag == 1) // is a new prim just been created/reloaded - { - this.SendFullUpdateToAllClients(); - this.updateFlag = 0; - } - if (this.updateFlag == 2) //some change has been made so update the clients - { - this.SendTerseUpdateToALLClients(); - this.updateFlag = 0; - } - } - - /// - /// - /// - public override void BackUp() - { - - } - - #endregion - - #region Packet handlers - - /// - /// - /// - /// - public void UpdatePosition(LLVector3 pos) - { - this.Pos = new LLVector3(pos.X, pos.Y, pos.Z); - this.updateFlag = 2; - } - - /// - /// - /// - /// - public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) - { - this.primData.PathBegin = updatePacket.PathBegin; - this.primData.PathEnd = updatePacket.PathEnd; - this.primData.PathScaleX = updatePacket.PathScaleX; - this.primData.PathScaleY = updatePacket.PathScaleY; - this.primData.PathShearX = updatePacket.PathShearX; - this.primData.PathShearY = updatePacket.PathShearY; - this.primData.PathSkew = updatePacket.PathSkew; - this.primData.ProfileBegin = updatePacket.ProfileBegin; - this.primData.ProfileEnd = updatePacket.ProfileEnd; - this.primData.PathCurve = updatePacket.PathCurve; - this.primData.ProfileCurve = updatePacket.ProfileCurve; - this.primData.ProfileHollow = updatePacket.ProfileHollow; - this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset; - this.primData.PathRevolutions = updatePacket.PathRevolutions; - this.primData.PathTaperX = updatePacket.PathTaperX; - this.primData.PathTaperY = updatePacket.PathTaperY; - this.primData.PathTwist = updatePacket.PathTwist; - this.primData.PathTwistBegin = updatePacket.PathTwistBegin; - } - - /// - /// - /// - /// - public void UpdateTexture(byte[] tex) - { - this.primData.TextureEntry = tex; - } - - /// - /// - /// - /// - public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) - { - - } - - /// - /// - /// - /// - public void AssignToParent(Primitive prim) - { - - } - - #endregion - - # region Inventory Methods - /// - /// - /// - /// - /// - public bool AddToInventory(InventoryItem item) - { - return false; - } - - /// - /// - /// - /// - /// - public InventoryItem RemoveFromInventory(LLUUID itemID) - { - return null; - } - - /// - /// - /// - /// - /// - public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) - { - - } - - /// - /// - /// - /// - /// - public void RequestXferInventory(IClientAPI simClient, ulong xferID) - { - //will only currently work if the total size of the inventory data array is under about 1000 bytes - SendXferPacketPacket send = new SendXferPacketPacket(); - - send.XferID.ID = xferID; - send.XferID.Packet = 1 + 2147483648; - send.DataPacket.Data = this.ConvertInventoryToBytes(); - - simClient.OutPacket(send); - } - - /// - /// - /// - /// - public byte[] ConvertInventoryToBytes() - { - System.Text.Encoding enc = System.Text.Encoding.ASCII; - byte[] result = new byte[0]; - List inventoryData = new List(); - int totallength = 0; - foreach (InventoryItem invItem in inventoryItems.Values) - { - byte[] data = enc.GetBytes(invItem.ExportString()); - inventoryData.Add(data); - totallength += data.Length; - } - //TODO: copy arrays into the single result array - - return result; - } - - /// - /// - /// - /// - public void CreateInventoryFromBytes(byte[] data) - { - - } - - #endregion - - #region Update viewers Methods - - /// - /// - /// - /// - public void SendFullUpdateForAllChildren(IClientAPI remoteClient) - { - this.SendFullUpdateToClient(remoteClient); - for (int i = 0; i < this.children.Count; i++) - { - if (this.children[i] is Primitive) - { - ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient); - } - } - } - - /// - /// - /// - /// - public void SendFullUpdateToClient(IClientAPI remoteClient) - { - LLVector3 lPos; - if (this._physActor != null && this.physicsEnabled) - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); - } - else - { - lPos = this.Pos; - } - - remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); - } - - /// - /// - /// - public void SendFullUpdateToAllClients() - { - List avatars = this.m_world.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - this.SendFullUpdateToClient(avatars[i].ControllingClient); - } - } - - /// - /// - /// - /// - public void SendTerseUpdateToClient(IClientAPI RemoteClient) - { - LLVector3 lPos; - Axiom.MathLib.Quaternion lRot; - if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); - lRot = this._physActor.Orientation; - } - else - { - lPos = this.Pos; - lRot = this.rotation; - } - LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); - RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); - } - - /// - /// - /// - public void SendTerseUpdateToALLClients() - { - List avatars = this.m_world.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - this.SendTerseUpdateToClient(avatars[i].ControllingClient); - } - } - - #endregion - - #region Create Methods - - /// - /// - /// - /// - /// - /// - public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) - { - PrimData PData = new PrimData(); - this.primData = PData; - this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - - PData.OwnerID = ownerID; - PData.PCode = addPacket.ObjectData.PCode; - PData.PathBegin = addPacket.ObjectData.PathBegin; - PData.PathEnd = addPacket.ObjectData.PathEnd; - PData.PathScaleX = addPacket.ObjectData.PathScaleX; - PData.PathScaleY = addPacket.ObjectData.PathScaleY; - PData.PathShearX = addPacket.ObjectData.PathShearX; - PData.PathShearY = addPacket.ObjectData.PathShearY; - PData.PathSkew = addPacket.ObjectData.PathSkew; - PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; - PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; - PData.Scale = addPacket.ObjectData.Scale; - PData.PathCurve = addPacket.ObjectData.PathCurve; - PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; - PData.ParentID = 0; - PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; - PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; - PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; - PData.PathTaperX = addPacket.ObjectData.PathTaperX; - PData.PathTaperY = addPacket.ObjectData.PathTaperY; - PData.PathTwist = addPacket.ObjectData.PathTwist; - PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; - LLVector3 pos1 = addPacket.ObjectData.RayEnd; - this.primData.FullID = this.uuid = LLUUID.Random(); - this.primData.LocalID = m_localId = (uint)(localID); - this.primData.Position = this.Pos = pos1; - - this.updateFlag = 1; - } - - /// - /// - /// - /// - public void CreateFromBytes(byte[] data) - { - - } - - /// - /// - /// - /// - public void CreateFromPrimData(PrimData primData) - { - this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); - } - - /// - /// - /// - /// - /// - /// - /// - public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) - { - - } - - public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) - { - // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z); - this.Pos = pos; - this.SendTerseUpdateToALLClients(); - } - - public void GetProperites(IClientAPI client) - { - //needs changing - ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate; - proper.ObjectData[0].CreatorID = primData.OwnerID; - proper.ObjectData[0].FolderID = LLUUID.Zero; - proper.ObjectData[0].FromTaskID = LLUUID.Zero; - proper.ObjectData[0].GroupID = LLUUID.Zero; - proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = LLUUID.Zero; - proper.ObjectData[0].ObjectID = this.uuid; - proper.ObjectData[0].OwnerID = primData.OwnerID; - proper.ObjectData[0].TouchName = new byte[0]; - proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[0]; - proper.ObjectData[0].OwnerMask = primData.OwnerMask; - proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask; - proper.ObjectData[0].GroupMask = primData.GroupMask; - proper.ObjectData[0].EveryoneMask = primData.EveryoneMask; - proper.ObjectData[0].BaseMask = primData.BaseMask; - - client.OutPacket(proper); - - } - - #endregion - - } -} diff --git a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs deleted file mode 100644 index 1d55c4d..0000000 --- a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs +++ /dev/null @@ -1,305 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Utilities; - -namespace OpenSim.Region.Environment.Scenes -{ - public partial class Scene - { - /// - /// Modifies terrain using the specified information - /// - /// The height at which the user started modifying the terrain - /// The number of seconds the modify button was pressed - /// The size of the brush used - /// The action to be performed - /// Distance from the north border where the cursor is located - /// Distance from the west border where the cursor is located - public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west) - { - // Shiny. - double size = (double)(1 << brushsize); - - switch (action) - { - case 0: - // flatten terrain - Terrain.flatten(north, west, size, (double)seconds / 100.0); - RegenerateTerrain(true, (int)north, (int)west); - break; - case 1: - // raise terrain - Terrain.raise(north, west, size, (double)seconds / 100.0); - RegenerateTerrain(true, (int)north, (int)west); - break; - case 2: - //lower terrain - Terrain.lower(north, west, size, (double)seconds / 100.0); - RegenerateTerrain(true, (int)north, (int)west); - break; - case 3: - // smooth terrain - Terrain.smooth(north, west, size, (double)seconds / 100.0); - RegenerateTerrain(true, (int)north, (int)west); - break; - case 4: - // noise - Terrain.noise(north, west, size, (double)seconds / 100.0); - RegenerateTerrain(true, (int)north, (int)west); - break; - case 5: - // revert - Terrain.revert(north, west, size, (double)seconds / 100.0); - RegenerateTerrain(true, (int)north, (int)west); - break; - - // CLIENT EXTENSIONS GO HERE - case 128: - // erode-thermal - break; - case 129: - // erode-aerobic - break; - case 130: - // erode-hydraulic - break; - } - return; - } - - /// - /// - /// - /// - /// - /// - /// - /// - public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) - { - Console.WriteLine("Chat message"); - ScenePresence avatar = null; - foreach (IClientAPI client in m_clientThreads.Values) - { - int dis = -1000; - if (this.Avatars.ContainsKey(client.AgentId)) - { - - avatar = this.Avatars[client.AgentId]; - // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); - dis= (int)avatar.Pos.GetDistanceTo(fromPos); - Console.WriteLine("found avatar at " +dis); - - } - - switch (type) - { - case 0: // Whisper - if ((dis < 10) && (dis > -10)) - { - //should change so the message is sent through the avatar rather than direct to the ClientView - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 1: // Say - if ((dis < 30) && (dis > -30)) - { - Console.WriteLine("sending chat"); - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 2: // Shout - if ((dis < 100) && (dis > -100)) - { - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - - case 0xff: // Broadcast - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - break; - } - - } - } - - /// - /// - /// - /// - /// - public void RezObject(AssetBase primAsset, LLVector3 pos) - { - - } - - /// - /// - /// - /// - /// - public void DeRezObject(Packet packet, IClientAPI simClient) - { - - } - - /// - /// - /// - /// - public void SendAvatarsToClient(IClientAPI remoteClient) - { - - } - - /// - /// - /// - /// - /// - public void LinkObjects(uint parentPrim, List childPrims) - { - - - } - - /// - /// - /// - /// - /// - public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) - { - - } - - /// - /// - /// - /// - /// - public void SelectPrim(uint primLocalID, IClientAPI remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.LocalId == primLocalID) - { - ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient); - break; - } - } - } - - public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) - { - if (this.Entities.ContainsKey(objectID)) - { - ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); - } - } - - /// - /// - /// - /// - /// - /// - public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) - { - - } - - /// - /// - /// - /// - /// - /// - public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) - { - - } - - /// - /// - /// - /// - /// - /// - public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.LocalId == localID) - { - ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos); - break; - } - } - } - - /// - /// - /// - /// - /// - /// - public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) - { - - } - - /// - /// - /// - /// - /// - /// - public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) - { - } - - /// - /// Sends prims to a client - /// - /// Client to send to - public void GetInitialPrims(IClientAPI RemoteClient) - { - - } - } -} diff --git a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs b/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs deleted file mode 100644 index 2249c3d..0000000 --- a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs +++ /dev/null @@ -1,184 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Reflection; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scenes -{ - public partial class Scene - { - private Dictionary scriptEngines = new Dictionary(); - - /// - /// - /// - private void LoadScriptEngines() - { - this.LoadScriptPlugins(); - } - - /// - /// - /// - public void LoadScriptPlugins() - { - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); - string[] pluginFiles = Directory.GetFiles(path, "*.dll"); - - - for (int i = 0; i < pluginFiles.Length; i++) - { - this.AddPlugin(pluginFiles[i]); - } - } - - /// - /// - /// - /// - private void AddPlugin(string FileName) - { - Assembly pluginAssembly = Assembly.LoadFrom(FileName); - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IScriptEngine", true); - - if (typeInterface != null) - { - IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(this); - this.scriptEngines.Add(plug.GetName(), plug); - - } - - typeInterface = null; - } - } - } - - pluginAssembly = null; - } - - /// - /// - /// - /// - /// - /// - /// - public void LoadScript(string scriptType, string scriptName, string script, Entity ent) - { - if(this.scriptEngines.ContainsKey(scriptType)) - { - this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.LocalId); - } - } - - #region IScriptAPI Methods - - /// - /// - /// - /// - /// - public LLVector3 GetEntityPosition(uint localID) - { - LLVector3 res = new LLVector3(); - // Console.WriteLine("script- getting entity " + localID + " position"); - foreach (Entity entity in this.Entities.Values) - { - if (entity.LocalId == localID) - { - res.X = entity.Pos.X; - res.Y = entity.Pos.Y; - res.Z = entity.Pos.Z; - } - } - return res; - } - - /// - /// - /// - /// - /// - /// - /// - public void SetEntityPosition(uint localID, float x , float y, float z) - { - foreach (Entity entity in this.Entities.Values) - { - if (entity.LocalId == localID && entity is Primitive) - { - LLVector3 pos = entity.Pos; - pos.X = x; - pos.Y = y; - Primitive prim = entity as Primitive; - // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - //prim.UpdatePosition(pos); - // Console.WriteLine("script- setting entity " + localID + " positon"); - } - } - - } - - /// - /// - /// - /// - public uint GetRandomAvatarID() - { - //Console.WriteLine("script- getting random avatar id"); - uint res = 0; - foreach (Entity entity in this.Entities.Values) - { - if (entity is ScenePresence) - { - res = entity.LocalId; - } - } - return res; - } - - #endregion - - - } -} diff --git a/OpenSim/Region/Simulation/Scenes/Scene.cs b/OpenSim/Region/Simulation/Scenes/Scene.cs deleted file mode 100644 index e71f601..0000000 --- a/OpenSim/Region/Simulation/Scenes/Scene.cs +++ /dev/null @@ -1,795 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; -using System.Threading; -using System.Timers; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; -using OpenSim.Framework; -using OpenSim.Region.Environment.Scripting; -using OpenSim.Region.Terrain; -using OpenSim.Framework.Communications; -using OpenSim.Region.Caches; -using OpenSim.Region.Environment; -using OpenSim.Framework.Servers; - -namespace OpenSim.Region.Environment.Scenes -{ - public delegate bool FilterAvatarList(ScenePresence avatar); - - public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI - { - protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); - protected Dictionary Avatars; - protected Dictionary Prims; - private PhysicsScene phyScene; - private float timeStep = 0.1f; - private Random Rand = new Random(); - private uint _primCount = 702000; - private int storageCount; - private Dictionary m_scriptHandlers; - private Dictionary m_scripts; - private Mutex updateLock; - - protected AuthenticateSessionsBase authenticateHandler; - protected RegionCommsListener regionCommsHost; - protected CommunicationsManager commsManager; - - protected Dictionary capsHandlers = new Dictionary(); - protected BaseHttpServer httpListener; - - public ParcelManager parcelManager; - public EstateManager estateManager; - public EventManager eventManager; - - #region Properties - /// - /// - /// - public PhysicsScene PhysScene - { - set - { - this.phyScene = value; - } - get - { - return (this.phyScene); - } - } - - #endregion - - #region Constructors - /// - /// Creates a new World class, and a region to go with it. - /// - /// Dictionary to contain client threads - /// Region Handle for this region - /// Region Name for this region - public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) - { - try - { - updateLock = new Mutex(false); - this.authenticateHandler = authen; - this.commsManager = commsMan; - this.assetCache = assetCach; - m_clientThreads = clientThreads; - m_regInfo = regInfo; - m_regionHandle = m_regInfo.RegionHandle; - m_regionName = m_regInfo.RegionName; - this.m_datastore = m_regInfo.DataStore; - this.RegisterRegionWithComms(); - - parcelManager = new ParcelManager(this, this.m_regInfo); - estateManager = new EstateManager(this, this.m_regInfo); - - eventManager = new EventManager(); - - m_scriptHandlers = new Dictionary(); - m_scripts = new Dictionary(); - - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); - Entities = new Dictionary(); - Avatars = new Dictionary(); - Prims = new Dictionary(); - - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); - Terrain = new TerrainEngine(); - - ScenePresence.LoadAnims(); - this.httpListener = httpServer; - - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); - } - } - #endregion - - /// - /// - /// - public void StartTimer() - { - m_heartbeatTimer.Enabled = true; - m_heartbeatTimer.Interval = 100; - m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); - } - - - #region Update Methods - - - /// - /// Performs per-frame updates regularly - /// - /// - /// - void Heartbeat(object sender, System.EventArgs e) - { - this.Update(); - } - - /// - /// Performs per-frame updates on the world, this should be the central world loop - /// - public override void Update() - { - updateLock.WaitOne(); - try - { - if (this.phyScene.IsThreaded) - { - this.phyScene.GetResults(); - - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].updateMovement(); - } - - lock (this.m_syncRoot) - { - this.phyScene.Simulate(timeStep); - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].update(); - } - - // New - eventManager.TriggerOnFrame(); - - // TODO: Obsolete - Phase out - foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) - { - scriptHandler.OnFrame(); - } - foreach (IScriptEngine scripteng in this.scriptEngines.Values) - { - scripteng.OnFrame(); - } - - //backup world data - this.storageCount++; - if (storageCount > 1200) //set to how often you want to backup - { - this.Backup(); - storageCount = 0; - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); - } - updateLock.ReleaseMutex(); - - } - - /// - /// - /// - /// - public bool Backup() - { - /* - try - { - // Terrain backup routines - if (Terrain.tainted > 0) - { - Terrain.tainted = 0; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); - localStorage.SaveMap(Terrain.getHeights1D()); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); - lock (this.m_syncRoot) - { - phyScene.SetTerrain(Terrain.getHeights1D()); - } - } - - // Primitive backup routines - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].BackUp(); - } - - //Parcel backup routines - ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; - int i = 0; - foreach (OpenSim.Region.Environment.Parcel parcel in parcelManager.parcelList.Values) - { - parcels[i] = parcel.parcelData; - i++; - } - localStorage.SaveParcels(parcels); - - // Backup successful - return true; - } - catch (Exception e) - { - // Backup failed - OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); - return false; - } - */ - return true; - } - #endregion - - #region Regenerate Terrain - - /// - /// Rebuilds the terrain using a procedural algorithm - /// - public void RegenerateTerrain() - { - try - { - Terrain.hills(); - - lock (this.m_syncRoot) - { - this.phyScene.SetTerrain(Terrain.getHeights1D()); - } - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(client); - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].LandRenegerated(); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); - } - } - - /// - /// Rebuilds the terrain using a 2D float array - /// - /// 256,256 float array containing heights - public void RegenerateTerrain(float[,] newMap) - { - try - { - this.Terrain.setHeights2D(newMap); - lock (this.m_syncRoot) - { - this.phyScene.SetTerrain(this.Terrain.getHeights1D()); - } - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(client); - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].LandRenegerated(); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); - } - } - - /// - /// Rebuilds the terrain assuming changes occured at a specified point[?] - /// - /// ??? - /// ??? - /// ??? - public void RegenerateTerrain(bool changes, int pointx, int pointy) - { - try - { - if (changes) - { - /* Dont save here, rely on tainting system instead */ - - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(pointx, pointy, client); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); - } - } - - #endregion - - #region Load Terrain - /// - /// Loads the World heightmap - /// - /// - public override void LoadWorldMap() - { - try - { - float[] map = this.localStorage.LoadWorld(); - if (map == null) - { - if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) - { - Console.WriteLine("No default terrain, procedurally generating..."); - this.Terrain.hills(); - - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - } - else - { - try - { - this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); - this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; - } - catch - { - Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); - Terrain.hills(); - } - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - } - } - else - { - this.Terrain.setHeights1D(map); - } - - CreateTerrainTexture(); - - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); - } - } - - /// - /// - /// - private void CreateTerrainTexture() - { - //create a texture asset of the terrain - byte[] data = this.Terrain.exportJpegImage("defaultstripe.png"); - this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); - AssetBase asset = new AssetBase(); - asset.FullID = this.m_regInfo.estateSettings.terrainImageID; - asset.Data = data; - asset.Name = "terrainImage"; - asset.Type = 0; - this.assetCache.AddAsset(asset); - } - #endregion - - #region Primitives Methods - - - /// - /// Loads the World's objects - /// - public void LoadPrimsFromStorage() - { - try - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); - this.localStorage.LoadPrimitives(this); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); - } - } - - /// - /// Loads a specific object from storage - /// - /// The object to load - public void PrimFromStorage(PrimData prim) - { - - } - - /// - /// - /// - /// - /// - public void AddNewPrim(Packet addPacket, IClientAPI agentClient) - { - AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); - } - - /// - /// - /// - /// - /// - public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) - { - try - { - Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); - - this.Entities.Add(prim.uuid, prim); - this._primCount++; - - // Trigger event for listeners - eventManager.TriggerOnNewPrimitive(prim); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); - } - } - - #endregion - - #region Add/Remove Avatar Methods - - /// - /// - /// - /// - /// - public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) - { - remoteClient.OnRegionHandShakeReply += this.SendLayerData; - //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); - remoteClient.OnChatFromViewer += this.SimChat; - remoteClient.OnRequestWearables += this.InformClientOfNeighbours; - remoteClient.OnAddPrim += this.AddNewPrim; - remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; - remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; - remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; - //remoteClient.OnObjectSelect += this.SelectPrim; - remoteClient.OnGrapUpdate += this.MoveObject; - - /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); - remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); - remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); - remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); - remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); - */ - - ScenePresence newAvatar = null; - try - { - - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); - - //newAvatar.SendRegionHandshake(); - this.estateManager.sendRegionHandshake(remoteClient); - - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); - lock (this.m_syncRoot) - { - newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); - } - - lock (Entities) - { - if (!Entities.ContainsKey(agentID)) - { - this.Entities.Add(agentID, newAvatar); - } - else - { - Entities[agentID] = newAvatar; - } - } - lock (Avatars) - { - if (Avatars.ContainsKey(agentID)) - { - Avatars[agentID] = newAvatar; - } - else - { - this.Avatars.Add(agentID, newAvatar); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); - } - return; - } - - - - /// - /// - /// - /// - public override void RemoveClient(LLUUID agentID) - { - eventManager.TriggerOnRemovePresence(agentID); - - return; - } - #endregion - - #region Request Avatars List Methods - //The idea is to have a group of method that return a list of avatars meeting some requirement - // ie it could be all Avatars within a certain range of the calling prim/avatar. - - /// - /// Request a List of all Avatars in this World - /// - /// - public List RequestAvatarList() - { - List result = new List(); - - foreach (ScenePresence avatar in Avatars.Values) - { - result.Add(avatar); - } - - return result; - } - - /// - /// Request a filtered list of Avatars in this World - /// - /// - public List RequestAvatarList(FilterAvatarList filter) - { - List result = new List(); - - foreach (ScenePresence avatar in Avatars.Values) - { - if (filter(avatar)) - { - result.Add(avatar); - } - } - - return result; - } - - /// - /// Request a Avatar by UUID - /// - /// - /// - public ScenePresence RequestAvatar(LLUUID avatarID) - { - if (this.Avatars.ContainsKey(avatarID)) - { - return Avatars[avatarID]; - } - return null; - } - #endregion - - - #region RegionCommsHost - - /// - /// - /// - public void RegisterRegionWithComms() - { - GridInfo gridSettings = new GridInfo(); - this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); - if (this.regionCommsHost != null) - { - this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); - this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); - } - } - - /// - /// - /// - /// - /// - public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) - { - // Console.WriteLine("World.cs - add new user connection"); - //should just check that its meant for this region - if (regionHandle == this.m_regInfo.RegionHandle) - { - if (agent.CapsPath != "") - { - //Console.WriteLine("new user, so creating caps handler for it"); - Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); - cap.RegisterHandlers(); - this.capsHandlers.Add(agent.AgentID, cap); - } - this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); - } - } - - public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) - { - if (regionHandle == this.m_regInfo.RegionHandle) - { - if (this.Avatars.ContainsKey(agentID)) - { - this.Avatars[agentID].MakeAvatar(position); - } - } - } - - /// - /// - /// - public void InformClientOfNeighbours(IClientAPI remoteClient) - { - // Console.WriteLine("informing client of neighbouring regions"); - List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); - - //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); - if (neighbours != null) - { - for (int i = 0; i < neighbours.Count; i++) - { - // Console.WriteLine("sending neighbours data"); - AgentCircuitData agent = remoteClient.RequestClientInfo(); - agent.BaseFolder = LLUUID.Zero; - agent.InventoryFolder = LLUUID.Zero; - agent.startpos = new LLVector3(128, 128, 70); - agent.child = true; - this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); - //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); - } - } - } - - /// - /// - /// - /// - /// - public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) - { - return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); - } - - /// - /// - /// - /// - /// - /// - /// - public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) - { - List mapBlocks; - mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); - remoteClient.SendMapBlock(mapBlocks); - } - - /// - /// - /// - /// - /// - /// - /// - /// - public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) - { - if (regionHandle == this.m_regionHandle) - { - if (this.Avatars.ContainsKey(remoteClient.AgentId)) - { - remoteClient.SendTeleportLocationStart(); - remoteClient.SendLocalTeleport(position, lookAt, flags); - this.Avatars[remoteClient.AgentId].Teleport(position); - } - } - else - { - RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle); - if (reg != null) - { - remoteClient.SendTeleportLocationStart(); - AgentCircuitData agent = remoteClient.RequestClientInfo(); - agent.BaseFolder = LLUUID.Zero; - agent.InventoryFolder = LLUUID.Zero; - agent.startpos = new LLVector3(128, 128, 70); - agent.child = true; - this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); - this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); - remoteClient.SendRegionTeleport(regionHandle, 13, reg.CommsIPListenAddr, (ushort)reg.CommsIPListenPort, 4, (1 << 4)); - } - //remoteClient.SendTeleportCancel(); - } - } - - /// - /// - /// - /// - /// - /// - public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) - { - return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); - } - - #endregion - } -} diff --git a/OpenSim/Region/Simulation/Scenes/SceneBase.cs b/OpenSim/Region/Simulation/Scenes/SceneBase.cs deleted file mode 100644 index 3d8f522..0000000 --- a/OpenSim/Region/Simulation/Scenes/SceneBase.cs +++ /dev/null @@ -1,201 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; -using System.Threading; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; -using OpenSim.Region.Environment.Scripting; -using OpenSim.Region.Terrain; -using OpenSim.Region.Caches; - -namespace OpenSim.Region.Environment.Scenes -{ - public abstract class SceneBase : IWorld - { - public Dictionary Entities; - protected Dictionary m_clientThreads; - protected ulong m_regionHandle; - protected string m_regionName; - protected RegionInfo m_regInfo; - - public TerrainEngine Terrain; - - public string m_datastore; - public ILocalStorage localStorage; - - protected object m_syncRoot = new object(); - private uint m_nextLocalId = 8880000; - protected AssetCache assetCache; - - #region Update Methods - /// - /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) - /// - public abstract void Update(); - - #endregion - - #region Terrain Methods - - /// - /// Loads the World heightmap - /// - public abstract void LoadWorldMap(); - - /// - /// Loads a new storage subsystem from a named library - /// - /// Storage Library - /// Successful or not - public bool LoadStorageDLL(string dllName) - { - try - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - ILocalStorage store = null; - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("ILocalStorage", true); - - if (typeInterface != null) - { - ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - store = plug; - - store.Initialise(this.m_datastore); - break; - } - - typeInterface = null; - } - } - } - pluginAssembly = null; - this.localStorage = store; - return (store == null); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); - return false; - } - } - - - /// - /// Send the region heightmap to the client - /// - /// Client to send to - public virtual void SendLayerData(IClientAPI RemoteClient) - { - RemoteClient.SendLayerData(Terrain.getHeights1D()); - } - - /// - /// Sends a specified patch to a client - /// - /// Patch coordinate (x) 0..16 - /// Patch coordinate (y) 0..16 - /// The client to send to - public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) - { - RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); - } - - #endregion - - #region Add/Remove Agent/Avatar - /// - /// - /// - /// - /// - /// - public abstract void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child); - - /// - /// - /// - /// - public abstract void RemoveClient(LLUUID agentID); - - #endregion - - /// - /// - /// - /// - public virtual RegionInfo RegionInfo - { - get { return this.m_regInfo; } - } - - public object SyncRoot - { - get { return m_syncRoot; } - } - - public uint NextLocalId - { - get { return m_nextLocalId++; } - } - - #region Shutdown - /// - /// Tidy before shutdown - /// - public virtual void Close() - { - try - { - this.localStorage.ShutDown(); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); - } - } - - #endregion - - - } -} diff --git a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs b/OpenSim/Region/Simulation/Scenes/SceneEvents.cs deleted file mode 100644 index fa1bacb..0000000 --- a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Environment.Scenes -{ - /// - /// A class for triggering remote scene events. - /// - public class EventManager - { - public delegate void OnFrameDelegate(); - public event OnFrameDelegate OnFrame; - - public delegate void OnNewPresenceDelegate(ScenePresence presence); - public event OnNewPresenceDelegate OnNewPresence; - - public delegate void OnNewPrimitiveDelegate(Primitive prim); - public event OnNewPrimitiveDelegate OnNewPrimitive; - - public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); - public event OnRemovePresenceDelegate OnRemovePresence; - - public void TriggerOnFrame() - { - if (OnFrame != null) - { - OnFrame(); - } - } - - public void TriggerOnNewPrimitive(Primitive prim) - { - if (OnNewPrimitive != null) - OnNewPrimitive(prim); - } - - public void TriggerOnNewPresence(ScenePresence presence) - { - if (OnNewPresence != null) - OnNewPresence(presence); - } - - public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid) - { - if (OnRemovePresence != null) - { - OnRemovePresence(uuid); - } - } - } -} diff --git a/OpenSim/Region/Simulation/Scenes/SceneObject.cs b/OpenSim/Region/Simulation/Scenes/SceneObject.cs deleted file mode 100644 index 88fb160..0000000 --- a/OpenSim/Region/Simulation/Scenes/SceneObject.cs +++ /dev/null @@ -1,128 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; - -namespace OpenSim.Region.Environment.Scenes -{ - public class SceneObject : Entity - { - private LLUUID rootUUID; - //private Dictionary ChildPrimitives = new Dictionary(); - protected Primitive rootPrimitive; - private Scene m_world; - protected ulong regionHandle; - - /// - /// - /// - public SceneObject() - { - - } - - /// - /// - /// - /// - /// - /// - public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) - { - this.rootPrimitive = new Primitive( this.regionHandle, this.m_world, addPacket, agentID, localID); - } - - /// - /// - /// - /// - public void CreateFromBytes(byte[] data) - { - - } - - /// - /// - /// - public override void update() - { - - } - - /// - /// - /// - public override void BackUp() - { - - } - - /// - /// - /// - /// - public void GetProperites(IClientAPI client) - { - //needs changing - ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate; - proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID; - proper.ObjectData[0].FolderID = LLUUID.Zero; - proper.ObjectData[0].FromTaskID = LLUUID.Zero; - proper.ObjectData[0].GroupID = LLUUID.Zero; - proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = LLUUID.Zero; - proper.ObjectData[0].ObjectID = this.uuid; - proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID; - proper.ObjectData[0].TouchName = new byte[0]; - proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[0]; - proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask; - proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask; - proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask; - proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask; - proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask; - - client.OutPacket(proper); - - } - - } -} diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs deleted file mode 100644 index 2caabc2..0000000 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using System.Xml; - -namespace OpenSim.Region.Environment.Scenes -{ - partial class ScenePresence - { - public class AvatarAnimations - { - - public Dictionary AnimsLLUUID = new Dictionary(); - public Dictionary AnimsNames = new Dictionary(); - - public AvatarAnimations() - { - } - - public void LoadAnims() - { - //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); - XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); - - XmlDocument doc = new XmlDocument(); - doc.Load(reader); - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - - if (nod.Attributes["name"] != null) - { - AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); - } - - } - - reader.Close(); - - // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); - - foreach (KeyValuePair kp in OpenSim.Region.Environment.Scenes.ScenePresence.Animations.AnimsLLUUID) - { - AnimsNames.Add(kp.Value, kp.Key); - } - } - } - } -} diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs deleted file mode 100644 index 2c81d2a..0000000 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; - -namespace OpenSim.Region.Environment.Scenes -{ - partial class ScenePresence - { - public class Avatar : IScenePresenceBody - { - public Avatar() - { - - } - - public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) - { - } - - public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) - { - } - - public void SendOurAppearance(IClientAPI OurClient) - { - } - - public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) - { - } - } - - public class ChildAgent : IScenePresenceBody //is a ghost - { - public ChildAgent() - { - - } - - public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) - { - } - - public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) - { - } - - public void SendOurAppearance(IClientAPI OurClient) - { - } - - public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) - { - } - } - } - -} diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs b/OpenSim/Region/Simulation/Scenes/ScenePresence.cs deleted file mode 100644 index 96e5c94..0000000 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs +++ /dev/null @@ -1,525 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using Axiom.MathLib; - -namespace OpenSim.Region.Environment.Scenes -{ - public partial class ScenePresence : Entity - { - public static bool PhysicsEngineFlying = false; - public static AvatarAnimations Animations; - public static byte[] DefaultTexture; - public string firstname; - public string lastname; - public IClientAPI ControllingClient; - public LLUUID current_anim; - public int anim_seq; - private bool updateflag = false; - private byte movementflag = 0; - private List forcesList = new List(); - private short _updateCount = 0; - private Axiom.MathLib.Quaternion bodyRot; - private LLObject.TextureEntry avatarAppearanceTexture = null; - private byte[] visualParams; - private AvatarWearable[] Wearables; - private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); - private ulong m_regionHandle; - private bool childAgent = false; - private bool newForce = false; - private bool newAvatar = false; - private IScenePresenceBody m_body; - - protected RegionInfo m_regionInfo; - - #region Properties - /// - /// - /// - public PhysicsActor PhysActor - { - set - { - this._physActor = value; - } - get - { - return _physActor; - } - } - #endregion - - #region Constructor(s) - /// - /// - /// - /// - /// - /// - /// - public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) - { - - m_world = world; - this.uuid = theClient.AgentId; - - m_regionInfo = reginfo; - m_regionHandle = reginfo.RegionHandle; - OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs "); - ControllingClient = theClient; - this.firstname = ControllingClient.FirstName; - this.lastname = ControllingClient.LastName; - m_localId = m_world.NextLocalId; - Pos = ControllingClient.StartPos; - visualParams = new byte[218]; - for (int i = 0; i < 218; i++) - { - visualParams[i] = 100; - } - - Wearables = AvatarWearable.DefaultWearables; - - this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); - - //register for events - ControllingClient.OnRequestWearables += this.SendOurAppearance; - //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); - ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; - ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; - ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; - // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); - // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); - //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); - - } - #endregion - - #region Status Methods - /// - /// Not Used, most likely can be deleted - /// - /// - public void ChildStatusChange(bool status) - { - this.childAgent = status; - - if (this.childAgent == true) - { - this.Velocity = new LLVector3(0, 0, 0); - this.Pos = new LLVector3(128, 128, 70); - - } - } - - /// - /// - /// - /// - public void MakeAvatar(LLVector3 pos) - { - //this.childAvatar = false; - this.Pos = pos; - this.newAvatar = true; - this.childAgent = false; - } - - protected void MakeChildAgent() - { - this.Velocity = new LLVector3(0, 0, 0); - this.Pos = new LLVector3(128, 128, 70); - this.childAgent = true; - } - - /// - /// - /// - /// - public void Teleport(LLVector3 pos) - { - this.Pos = pos; - this.SendTerseUpdateToALLClients(); - } - - /// - /// - /// - public void StopMovement() - { - - } - #endregion - - #region Event Handlers - /// - /// - /// - /// - /// - public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) - { - - } - - /// - /// Complete Avatar's movement into the region - /// - public void CompleteMovement() - { - LLVector3 look = this.Velocity; - if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) - { - look = new LLVector3(0.99f, 0.042f, 0); - } - this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); - if (this.childAgent) - { - this.childAgent = false; - } - } - - /// - /// - /// - /// - public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) - { - if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) - { - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); - if (((movementflag & 1) == 0) || (q != this.bodyRot)) - { - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); - this.AddNewMovement(v3, q); - movementflag = 1; - this.bodyRot = q; - } - } - else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) - { - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); - if (((movementflag & 2) == 0) || (q != this.bodyRot)) - { - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); - this.AddNewMovement(v3, q); - movementflag = 2; - this.bodyRot = q; - } - } - else - { - if ((movementflag) != 0) - { - NewForce newVelocity = new NewForce(); - newVelocity.X = 0; - newVelocity.Y = 0; - newVelocity.Z = 0; - this.forcesList.Add(newVelocity); - movementflag = 0; - } - } - - } - - protected void AddNewMovement(Axiom.MathLib.Vector3 vec, Axiom.MathLib.Quaternion rotation) - { - NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 direc = rotation * vec; - direc.Normalize(); - - direc = direc * ((0.03f) * 128f); - if (this._physActor.Flying) - direc *= 4; - - newVelocity.X = direc.x; - newVelocity.Y = direc.y; - newVelocity.Z = direc.z; - this.forcesList.Add(newVelocity); - } - - #endregion - - #region Overridden Methods - /// - /// - /// - public override void LandRenegerated() - { - - } - - /// - /// - /// - public override void update() - { - if (this.childAgent == false) - { - if (this.newForce) - { - this.SendTerseUpdateToALLClients(); - _updateCount = 0; - } - else if (movementflag != 0) - { - _updateCount++; - if (_updateCount > 3) - { - this.SendTerseUpdateToALLClients(); - _updateCount = 0; - } - } - - this.CheckForBorderCrossing(); - } - } - #endregion - - #region Update Client(s) - /// - /// - /// - /// - public void SendTerseUpdateToClient(IClientAPI RemoteClient) - { - LLVector3 pos = this.Pos; - LLVector3 vel = this.Velocity; - RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); - } - - /// - /// - /// - public void SendTerseUpdateToALLClients() - { - List avatars = this.m_world.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - this.SendTerseUpdateToClient(avatars[i].ControllingClient); - } - } - - /// - /// - /// - /// - public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) - { - remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); - } - - /// - /// - /// - public void SendInitialData() - { - this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); - if (this.newAvatar) - { - this.m_world.InformClientOfNeighbours(this.ControllingClient); - this.newAvatar = false; - } - } - - /// - /// - /// - /// - public void SendOurAppearance(IClientAPI OurClient) - { - this.ControllingClient.SendWearables(this.Wearables); - } - - /// - /// - /// - /// - public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) - { - - } - - /// - /// - /// - /// - /// - public void SendAnimPack(LLUUID animID, int seq) - { - - - } - - /// - /// - /// - public void SendAnimPack() - { - - } - #endregion - - #region Border Crossing Methods - /// - /// - /// - protected void CheckForBorderCrossing() - { - LLVector3 pos2 = this.Pos; - LLVector3 vel = this.Velocity; - - float timeStep = 0.2f; - pos2.X = pos2.X + (vel.X * timeStep); - pos2.Y = pos2.Y + (vel.Y * timeStep); - pos2.Z = pos2.Z + (vel.Z * timeStep); - - if ((pos2.X < 0) || (pos2.X > 256)) - { - this.CrossToNewRegion(); - } - - if ((pos2.Y < 0) || (pos2.Y > 256)) - { - this.CrossToNewRegion(); - } - } - - /// - /// - /// - protected void CrossToNewRegion() - { - LLVector3 pos = this.Pos; - LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); - uint neighbourx = this.m_regionInfo.RegionLocX; - uint neighboury = this.m_regionInfo.RegionLocY; - - if (pos.X < 2) - { - neighbourx -= 1; - newpos.X = 254; - } - if (pos.X > 253) - { - neighbourx += 1; - newpos.X = 1; - } - if (pos.Y < 2) - { - neighboury -= 1; - newpos.Y = 254; - } - if (pos.Y > 253) - { - neighboury += 1; - newpos.Y = 1; - } - - LLVector3 vel = this.velocity; - ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); - RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); - if (neighbourRegion != null) - { - bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); - if (res) - { - this.MakeChildAgent(); - this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.CommsIPListenAddr), (ushort)neighbourRegion.CommsIPListenPort); - } - } - } - #endregion - - /// - /// - /// - public static void LoadAnims() - { - - } - - /// - /// - /// - public override void updateMovement() - { - newForce = false; - lock (this.forcesList) - { - if (this.forcesList.Count > 0) - { - for (int i = 0; i < this.forcesList.Count; i++) - { - NewForce force = this.forcesList[i]; - - this.updateflag = true; - this.Velocity = new LLVector3(force.X, force.Y, force.Z); - this.newForce = true; - } - for (int i = 0; i < this.forcesList.Count; i++) - { - this.forcesList.RemoveAt(0); - } - } - } - } - - public static void LoadTextureFile(string name) - { - FileInfo fInfo = new FileInfo(name); - long numBytes = fInfo.Length; - FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); - BinaryReader br = new BinaryReader(fStream); - byte[] data1 = br.ReadBytes((int)numBytes); - br.Close(); - fStream.Close(); - DefaultTexture = data1; - } - - public class NewForce - { - public float X; - public float Y; - public float Z; - - public NewForce() - { - - } - } - } - -} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs deleted file mode 100644 index eb8a117..0000000 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public interface IScriptContext - { - IScriptEntity Entity { get; } - bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); - } -} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs deleted file mode 100644 index e813626..0000000 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public interface IScriptReadonlyEntity - { - LLVector3 Pos { get; } - string Name { get; } - } - - public interface IScriptEntity - { - LLVector3 Pos { get; set; } - string Name { get; } - } -} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs b/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs deleted file mode 100644 index 115b4f4..0000000 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs +++ /dev/null @@ -1,126 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Physics.Manager; -using OpenSim.Region.Environment; -using OpenSim.Region.Environment.Scenes; -using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; -using Primitive = OpenSim.Region.Environment.Scenes.Primitive; - -namespace OpenSim.Region.Environment.Scripting -{ - public delegate void ScriptEventHandler(IScriptContext context); - - public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity - { - private Scene m_world; - private Script m_script; - private Entity m_entity; - - public LLUUID ScriptId - { - get - { - return m_script.ScriptId; - } - } - - public void OnFrame() - { - m_script.OnFrame(this); - } - - public ScriptHandler(Script script, Entity entity, Scene world) - { - m_script = script; - m_entity = entity; - m_world = world; - } - - #region IScriptContext Members - - IScriptEntity IScriptContext.Entity - { - get - { - return this; - } - } - - bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) - { - foreach (Entity entity in m_world.Entities.Values ) - { - if( entity is Avatar ) - { - avatar = entity; - return true; - } - } - - avatar = null; - return false; - } - - #endregion - - #region IScriptEntity and IScriptReadonlyEntity Members - - public string Name - { - get - { - return m_entity.Name; - } - } - - public LLVector3 Pos - { - get - { - return m_entity.Pos; - } - - set - { - if (m_entity is Primitive) - { - Primitive prim = m_entity as Primitive; - // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - // prim.UpdatePosition( value ); - } - } - } - - #endregion - } - -} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs b/OpenSim/Region/Simulation/Scenes/scripting/Script.cs deleted file mode 100644 index 5d398b0..0000000 --- a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public class Script - { - private LLUUID m_scriptId; - public virtual LLUUID ScriptId - { - get - { - return m_scriptId; - } - } - - public Script( LLUUID scriptId ) - { - m_scriptId = scriptId; - } - - public ScriptEventHandler OnFrame; - } -} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs b/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs deleted file mode 100644 index 0ce65ea..0000000 --- a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Environment.Scripting -{ - public delegate Script ScriptFactory(); -} diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs deleted file mode 100644 index 90c79e3..0000000 --- a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public class FollowRandomAvatar : Script - { - public FollowRandomAvatar() - : base(LLUUID.Random()) - { - OnFrame += MyOnFrame; - } - - private void MyOnFrame(IScriptContext context) - { - LLVector3 pos = context.Entity.Pos; - - IScriptReadonlyEntity avatar; - - if (context.TryGetRandomAvatar(out avatar)) - { - LLVector3 avatarPos = avatar.Pos; - - float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; - float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; - - LLVector3 newPos = new LLVector3(x, y, pos.Z); - - context.Entity.Pos = newPos; - } - } - } - - -} -- cgit v1.1 From 440bb4a358cdc01559f624dbcbb7391d260616e0 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 02:07:59 +0000 Subject: *Fixed UserServer and OpenSim so now they start without crashing. --- OpenSim/Region/Application/OpenSimMain.cs | 4 ++-- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs | 2 +- OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e06d38c..7bf6b8d 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -154,7 +154,7 @@ namespace OpenSim { try { - AssetCache = new AssetCache("OpenSim.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); InventoryCache = new InventoryCache(); } catch (Exception e) @@ -169,7 +169,7 @@ namespace OpenSim { try { - AssetCache = new AssetCache("OpenSim.GridInterfaces.Remote.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Remote.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); InventoryCache = new InventoryCache(); } catch (Exception e) diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 8c1e965..4060d68 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; using OpenSim; -using OpenSim.GridInterfaces.Local; +using OpenSim.Region.GridInterfaces.Local; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Console; diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index 87eff49..95d03f1 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs @@ -38,7 +38,7 @@ using libsecondlife; using Db4objects.Db4o; using Db4objects.Db4o.Query; -namespace OpenSim.GridInterfaces.Local +namespace OpenSim.Region.GridInterfaces.Local { public class LocalAssetPlugin : IAssetPlugin { diff --git a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs index ca01c68..4652f70 100644 --- a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs @@ -37,7 +37,7 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; -namespace OpenSim.GridInterfaces.Remote +namespace OpenSim.Region.GridInterfaces.Remote { public class RemoteAssetServer : IAssetServer { -- cgit v1.1 From 14ea54b44158a68aed767bbf5cc3497b4f64850c Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 11:54:51 +0000 Subject: should now work. --- OpenSim/Region/Communications/Local/CommunicationsLocal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index c98cd11..8837bdb 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Communications.Local : base(serversInfo) { UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY); - UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll"); + UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); UserServer = UserServices; GridServer = SandBoxServices; InterRegion = SandBoxServices; -- cgit v1.1 From 3456d951d89fbc83f742d40ca8ca2a1a79d414eb Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 13:13:17 +0000 Subject: Imported the scripting changes, so now should be up to date with sugilite. --- OpenSim/Region/Application/OpenSim.csproj | 4 +- OpenSim/Region/Application/OpenSim.exe.build | 59 ++++++++++ .../Region/Caches/OpenSim.Region.Caches.dll.build | 43 +++++++ .../OpenSim.Region.Capabilities.csproj | 26 ++--- .../OpenSim.Region.Capabilities.dll.build | 56 +++++++++ .../ClientStack/OpenSim.Region.ClientStack.csproj | 12 +- .../OpenSim.Region.ClientStack.dll.build | 60 ++++++++++ .../Communications/Local/CommunicationsLocal.cs | 1 - .../OpenSim.Region.Communications.Local.csproj | 6 +- .../OpenSim.Region.Communications.Local.dll.build | 48 ++++++++ .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 6 +- .../OpenSim.Region.Communications.OGS1.dll.build | 53 +++++++++ .../Environment/OpenSim.Region.Environment.csproj | 42 ++++--- .../OpenSim.Region.Environment.dll.build | 75 ++++++++++++ OpenSim/Region/Environment/Scenes/Entity.cs | 3 +- OpenSim/Region/Environment/Scenes/Scene.cs | 30 ++--- OpenSim/Region/Environment/Scenes/SceneBase.cs | 1 - .../Scenes/scripting/Engines/CSharpScriptEngine.cs | 104 +++++++++++++++++ .../Scenes/scripting/Engines/JScriptEngine.cs | 104 +++++++++++++++++ .../Scenes/scripting/Engines/JSharpScriptEngine.cs | 104 +++++++++++++++++ .../Environment/Scenes/scripting/IScriptContext.cs | 40 ------- .../Environment/Scenes/scripting/IScriptEntity.cs | 46 -------- .../Environment/Scenes/scripting/IScriptHandler.cs | 126 --------------------- .../Region/Environment/Scenes/scripting/Script.cs | 53 --------- .../Environment/Scenes/scripting/ScriptFactory.cs | 35 ------ .../Environment/Scenes/scripting/ScriptInfo.cs | 58 ++++++++++ .../Environment/Scenes/scripting/ScriptManager.cs | 99 ++++++++++++++++ .../Scenes/scripting/Scripts/FollowRandomAvatar.cs | 64 ----------- .../Region/Examples/SimpleApp/SimpleApp.exe.build | 54 +++++++++ .../OpenSim.Region.GridInterfaces.Local.dll.build | 45 ++++++++ .../OpenSim.Region.GridInterfaces.Remote.dll.build | 45 ++++++++ ...Sim.Region.Physics.BasicPhysicsPlugin.dll.build | 42 +++++++ .../OpenSim.Region.Physics.Manager.dll.build | 47 ++++++++ .../OpenSim.Region.Physics.OdePlugin.dll.build | 43 +++++++ .../OpenSim.Region.Physics.PhysXPlugin.dll.build | 43 +++++++ ...Region.Storage.LocalStorageBerkeleyDB.dll.build | 46 ++++++++ .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 48 ++++++++ ...Sim.Region.Storage.LocalStorageSQLite.dll.build | 46 ++++++++ .../OpenSim.Region.Terrain.BasicTerrain.csproj | 4 +- .../OpenSim.Region.Terrain.BasicTerrain.dll.build | 47 ++++++++ .../Region/Terrain.BasicTerrain/TerrainFilter.cs | 29 ++++- 42 files changed, 1460 insertions(+), 443 deletions(-) create mode 100644 OpenSim/Region/Application/OpenSim.exe.build create mode 100644 OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build create mode 100644 OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build create mode 100644 OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build create mode 100644 OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build create mode 100644 OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build create mode 100644 OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Script.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build create mode 100644 OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build create mode 100644 OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build create mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build create mode 100644 OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build create mode 100644 OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build create mode 100644 OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build create mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build create mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build create mode 100644 OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index 3801067..5cefa96 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -167,10 +167,10 @@ Code - + Code - + Code diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build new file mode 100644 index 0000000..74eee5b --- /dev/null +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build b/OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build new file mode 100644 index 0000000..3ca89e8 --- /dev/null +++ b/OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index 0d8fac5..4667d52 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -62,14 +62,6 @@ ..\..\..\bin\libsecondlife.dll False - - OpenSim.Framework.Types.dll - False - - - OpenSim.Framework.Utilities.dll - False - System.dll False @@ -104,15 +96,6 @@ - - Code - - - Code - - - Code - Code @@ -122,6 +105,9 @@ Code + + Code + Code @@ -131,6 +117,12 @@ Code + + Code + + + Code + Code diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build new file mode 100644 index 0000000..a091b5c --- /dev/null +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 40cd4f0..3093eb0 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,19 +122,19 @@ - + Code - + Code - + Code - + Code - + Code @@ -143,7 +143,7 @@ Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build new file mode 100644 index 0000000..f76a4c8 --- /dev/null +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 8837bdb..f5aa8ae 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -35,7 +35,6 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Communications; - namespace OpenSim.Region.Communications.Local { public class CommunicationsLocal : CommunicationsManager diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index f9f6b7d..0a15a49 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,15 +98,15 @@ - - Code - Code Code + + Code + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build new file mode 100644 index 0000000..3cac9d3 --- /dev/null +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 1aa7019..8cc5641 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,16 +116,16 @@ - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build new file mode 100644 index 0000000..21bb15c --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 6f07969..efde96c 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -70,6 +70,10 @@ ..\..\..\bin\libsecondlife.dll False + + Microsoft.JScript.dll + False + System.dll False @@ -78,6 +82,10 @@ System.Xml.dll False + + VJSharpCodeProvider.dll + False + ..\..\..\bin\XMLRPC.dll False @@ -152,55 +160,55 @@ Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build new file mode 100644 index 0000000..da73c8c --- /dev/null +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index bbba34d..db5070d 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -31,11 +31,10 @@ using System.Text; using Axiom.MathLib; using OpenSim.Physics.Manager; using libsecondlife; -using OpenSim.Region.Environment.Scripting; namespace OpenSim.Region.Environment.Scenes { - public abstract class Entity : IScriptReadonlyEntity + public abstract class Entity { public libsecondlife.LLUUID uuid; public Quaternion rotation; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ff54efa..b345c0c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -39,12 +39,14 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework; -using OpenSim.Region.Environment.Scripting; using OpenSim.Region.Terrain; using OpenSim.Framework.Communications; using OpenSim.Region.Caches; using OpenSim.Region.Environment; using OpenSim.Framework.Servers; +using OpenSim.Scripting; +using OpenSim.Region.Capabilities; +using Caps = OpenSim.Region.Capabilities.Caps; namespace OpenSim.Region.Environment.Scenes { @@ -60,20 +62,19 @@ namespace OpenSim.Region.Environment.Scenes private Random Rand = new Random(); private uint _primCount = 702000; private int storageCount; - private Dictionary m_scriptHandlers; - private Dictionary m_scripts; private Mutex updateLock; protected AuthenticateSessionsBase authenticateHandler; protected RegionCommsListener regionCommsHost; protected CommunicationsManager commsManager; - protected Dictionary capsHandlers = new Dictionary(); + protected Dictionary capsHandlers = new Dictionary(); protected BaseHttpServer httpListener; public ParcelManager parcelManager; public EstateManager estateManager; public EventManager eventManager; + public ScriptManager scriptManager; #region Properties /// @@ -117,12 +118,9 @@ namespace OpenSim.Region.Environment.Scenes parcelManager = new ParcelManager(this, this.m_regInfo); estateManager = new EstateManager(this, this.m_regInfo); - + scriptManager = new ScriptManager(this); eventManager = new EventManager(); - m_scriptHandlers = new Dictionary(); - m_scripts = new Dictionary(); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); Entities = new Dictionary(); Avatars = new Dictionary(); @@ -195,19 +193,9 @@ namespace OpenSim.Region.Environment.Scenes Entities[UUID].update(); } - // New + // General purpose event manager eventManager.TriggerOnFrame(); - // TODO: Obsolete - Phase out - foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) - { - scriptHandler.OnFrame(); - } - foreach (IScriptEngine scripteng in this.scriptEngines.Values) - { - scripteng.OnFrame(); - } - //backup world data this.storageCount++; if (storageCount > 1200) //set to how often you want to backup @@ -256,7 +244,7 @@ namespace OpenSim.Region.Environment.Scenes //Parcel backup routines ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; int i = 0; - foreach (OpenSim.Region.Environment.Parcel parcel in parcelManager.parcelList.Values) + foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) { parcels[i] = parcel.parcelData; i++; @@ -672,7 +660,7 @@ namespace OpenSim.Region.Environment.Scenes if (agent.CapsPath != "") { //Console.WriteLine("new user, so creating caps handler for it"); - Capabilities.Caps cap = new Capabilities.Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); cap.RegisterHandlers(); this.capsHandlers.Add(agent.AgentID, cap); } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 3d8f522..50d3b82 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -37,7 +37,6 @@ using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; -using OpenSim.Region.Environment.Scripting; using OpenSim.Region.Terrain; using OpenSim.Region.Caches; diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs new file mode 100644 index 0000000..870303f --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs @@ -0,0 +1,104 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +// Compilation stuff +using System.CodeDom; +using System.CodeDom.Compiler; +using Microsoft.CSharp; + +namespace OpenSim.Scripting +{ + public class CSharpScriptEngine : IScriptCompiler + { + public string FileExt() + { + return ".cs"; + } + + private Dictionary LoadDotNetScript(ICodeCompiler compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); + compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors"); + foreach (CompilerError error in compilerResults.Errors) + { + OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + Dictionary scripts = new Dictionary(); + + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("IScript", true); + + if (testInterface != null) + { + IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string scriptName = "C#/" + script.getName(); + Console.WriteLine("Script: " + scriptName + " loaded."); + + if (!scripts.ContainsKey(scriptName)) + { + scripts.Add(scriptName, script); + } + else + { + scripts[scriptName] = script; + } + } + } + return scripts; + } + return null; + } + + public Dictionary compile(string filename) + { + CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); + return LoadDotNetScript(csharpProvider.CreateCompiler(), filename); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs new file mode 100644 index 0000000..ffae1d7 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs @@ -0,0 +1,104 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +// Compilation stuff +using System.CodeDom; +using System.CodeDom.Compiler; +using Microsoft.JScript; + +namespace OpenSim.Scripting +{ + public class JScriptEngine : IScriptCompiler + { + public string FileExt() + { + return ".js"; + } + + private Dictionary LoadDotNetScript(ICodeCompiler compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); + compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors"); + foreach (CompilerError error in compilerResults.Errors) + { + OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + Dictionary scripts = new Dictionary(); + + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("IScript", true); + + if (testInterface != null) + { + IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string scriptName = "JS.NET/" + script.getName(); + Console.WriteLine("Script: " + scriptName + " loaded."); + + if (!scripts.ContainsKey(scriptName)) + { + scripts.Add(scriptName, script); + } + else + { + scripts[scriptName] = script; + } + } + } + return scripts; + } + return null; + } + + public Dictionary compile(string filename) + { + JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); + return LoadDotNetScript(jscriptProvider.CreateCompiler(), filename); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs new file mode 100644 index 0000000..b33b55d --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs @@ -0,0 +1,104 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +// Compilation stuff +using System.CodeDom; +using System.CodeDom.Compiler; +using Microsoft.VJSharp; + +namespace OpenSim.Scripting +{ + public class JSharpScriptEngine : IScriptCompiler + { + public string FileExt() + { + return ".jsl"; + } + + private Dictionary LoadDotNetScript(ICodeCompiler compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); + compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors"); + foreach (CompilerError error in compilerResults.Errors) + { + OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + Dictionary scripts = new Dictionary(); + + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("IScript", true); + + if (testInterface != null) + { + IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string scriptName = "J#/" + script.getName(); + Console.WriteLine("Script: " + scriptName + " loaded."); + + if (!scripts.ContainsKey(scriptName)) + { + scripts.Add(scriptName, script); + } + else + { + scripts[scriptName] = script; + } + } + } + return scripts; + } + return null; + } + + public Dictionary compile(string filename) + { + VJSharpCodeProvider jsharpProvider = new VJSharpCodeProvider(); + return LoadDotNetScript(jsharpProvider.CreateCompiler(), filename); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs deleted file mode 100644 index eb8a117..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public interface IScriptContext - { - IScriptEntity Entity { get; } - bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs deleted file mode 100644 index e813626..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public interface IScriptReadonlyEntity - { - LLVector3 Pos { get; } - string Name { get; } - } - - public interface IScriptEntity - { - LLVector3 Pos { get; set; } - string Name { get; } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs deleted file mode 100644 index 115b4f4..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs +++ /dev/null @@ -1,126 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Physics.Manager; -using OpenSim.Region.Environment; -using OpenSim.Region.Environment.Scenes; -using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; -using Primitive = OpenSim.Region.Environment.Scenes.Primitive; - -namespace OpenSim.Region.Environment.Scripting -{ - public delegate void ScriptEventHandler(IScriptContext context); - - public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity - { - private Scene m_world; - private Script m_script; - private Entity m_entity; - - public LLUUID ScriptId - { - get - { - return m_script.ScriptId; - } - } - - public void OnFrame() - { - m_script.OnFrame(this); - } - - public ScriptHandler(Script script, Entity entity, Scene world) - { - m_script = script; - m_entity = entity; - m_world = world; - } - - #region IScriptContext Members - - IScriptEntity IScriptContext.Entity - { - get - { - return this; - } - } - - bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) - { - foreach (Entity entity in m_world.Entities.Values ) - { - if( entity is Avatar ) - { - avatar = entity; - return true; - } - } - - avatar = null; - return false; - } - - #endregion - - #region IScriptEntity and IScriptReadonlyEntity Members - - public string Name - { - get - { - return m_entity.Name; - } - } - - public LLVector3 Pos - { - get - { - return m_entity.Pos; - } - - set - { - if (m_entity is Primitive) - { - Primitive prim = m_entity as Primitive; - // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - // prim.UpdatePosition( value ); - } - } - } - - #endregion - } - -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs deleted file mode 100644 index 5d398b0..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Script.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public class Script - { - private LLUUID m_scriptId; - public virtual LLUUID ScriptId - { - get - { - return m_scriptId; - } - } - - public Script( LLUUID scriptId ) - { - m_scriptId = scriptId; - } - - public ScriptEventHandler OnFrame; - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs deleted file mode 100644 index 0ce65ea..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Environment.Scripting -{ - public delegate Script ScriptFactory(); -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs new file mode 100644 index 0000000..57df4c4 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Environment.Scenes; +using OpenSim.Framework.Console; + +namespace OpenSim.Scripting +{ + /// + /// Class which provides access to the world + /// + public class ScriptInfo + { + // Reference to world.eventsManager provided for convenience + public EventManager events; + + // The main world + public Scene world; + + // The console + public LogBase logger; + + public ScriptInfo(Scene scene) + { + world = scene; + events = world.eventManager; + logger = OpenSim.Framework.Console.MainLog.Instance; + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs new file mode 100644 index 0000000..5d1d188 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -0,0 +1,99 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting +{ + public class ScriptManager + { + List scripts = new List(); + OpenSim.Region.Environment.Scenes.Scene scene; + Dictionary compilers = new Dictionary(); + + private void LoadFromCompiler(Dictionary compiledscripts) + { + foreach (KeyValuePair script in compiledscripts) + { + ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. + OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading " + script.Key); + script.Value.Initialise(scriptInfo); + scripts.Add(script.Value); + } + OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); + } + + public ScriptManager(OpenSim.Region.Environment.Scenes.Scene world) + { + scene = world; + + // Default Engines + CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); + compilers.Add(csharpCompiler.FileExt(),csharpCompiler); + + JScriptEngine jscriptCompiler = new JScriptEngine(); + compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); + + JSharpScriptEngine jsharpCompiler = new JSharpScriptEngine(); + compilers.Add(jsharpCompiler.FileExt(), jsharpCompiler); + } + + public void Compile(string filename) + { + foreach (KeyValuePair compiler in compilers) + { + if (filename.EndsWith(compiler.Key)) + { + LoadFromCompiler(compiler.Value.compile(filename)); + break; + } + } + } + + public void RunScriptCmd(string[] args) + { + switch (args[0]) + { + case "load": + Compile(args[1]); + break; + + default: + OpenSim.Framework.Console.MainLog.Instance.Error("Unknown script command"); + break; + } + } + } + + interface IScriptCompiler + { + Dictionary compile(string filename); + string FileExt(); + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs deleted file mode 100644 index 90c79e3..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scripting -{ - public class FollowRandomAvatar : Script - { - public FollowRandomAvatar() - : base(LLUUID.Random()) - { - OnFrame += MyOnFrame; - } - - private void MyOnFrame(IScriptContext context) - { - LLVector3 pos = context.Entity.Pos; - - IScriptReadonlyEntity avatar; - - if (context.TryGetRandomAvatar(out avatar)) - { - LLVector3 avatarPos = avatar.Pos; - - float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; - float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; - - LLVector3 newPos = new LLVector3(x, y, pos.Z); - - context.Entity.Pos = newPos; - } - } - } - - -} diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build new file mode 100644 index 0000000..f8896fa --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build new file mode 100644 index 0000000..4770e6d --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build new file mode 100644 index 0000000..0bf1b86 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build new file mode 100644 index 0000000..6cf26ca --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build new file mode 100644 index 0000000..4b7ce81 --- /dev/null +++ b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build new file mode 100644 index 0000000..07b9386 --- /dev/null +++ b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build new file mode 100644 index 0000000..c1a9608 --- /dev/null +++ b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build new file mode 100644 index 0000000..20f5171 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 716fd57..147158c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,6 +93,9 @@ Code + + Code + Code @@ -102,9 +105,6 @@ Code - - Code - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build new file mode 100644 index 0000000..fc9f055 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build new file mode 100644 index 0000000..9d12c33 --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj index 60a2d2b..24667e5 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj +++ b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj @@ -90,10 +90,10 @@ - + Code - + Code diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build new file mode 100644 index 0000000..dc7203a --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs index f04ac56..e0ae586 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs @@ -1,3 +1,30 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ using System; using System.Collections.Generic; using System.Text; @@ -48,7 +75,7 @@ namespace OpenSim.Region.Terrain compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("libTerrain-BSD.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Terrain.BasicTerrain.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Terrain.BasicTerrain.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); -- cgit v1.1 From 561db23e5fbfcd110423c6a408ac0a11bebbedac Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 14:10:05 +0000 Subject: Finished removing the old scripting code, Scene.Scripting.cs and OpenSim.Framework.Interfaces.Scripting. --- .../Environment/OpenSim.Region.Environment.csproj | 3 - .../OpenSim.Region.Environment.dll.build | 1 - .../Region/Environment/Scenes/Scene.Scripting.cs | 184 --------------------- OpenSim/Region/Environment/Scenes/Scene.cs | 4 +- .../Scenes/scripting/Engines/CSharpScriptEngine.cs | 2 +- .../Scenes/scripting/Engines/JScriptEngine.cs | 2 +- .../Scenes/scripting/Engines/JSharpScriptEngine.cs | 2 +- .../Region/Environment/Scenes/scripting/Script.cs | 71 ++++++++ .../Environment/Scenes/scripting/ScriptInfo.cs | 2 +- .../Environment/Scenes/scripting/ScriptManager.cs | 2 +- 10 files changed, 78 insertions(+), 195 deletions(-) delete mode 100644 OpenSim/Region/Environment/Scenes/Scene.Scripting.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Script.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index efde96c..4069454 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -172,9 +172,6 @@ Code - - Code - Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index da73c8c..51924d5 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -19,7 +19,6 @@ - diff --git a/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs b/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs deleted file mode 100644 index 2249c3d..0000000 --- a/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs +++ /dev/null @@ -1,184 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Reflection; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using libsecondlife; - -namespace OpenSim.Region.Environment.Scenes -{ - public partial class Scene - { - private Dictionary scriptEngines = new Dictionary(); - - /// - /// - /// - private void LoadScriptEngines() - { - this.LoadScriptPlugins(); - } - - /// - /// - /// - public void LoadScriptPlugins() - { - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); - string[] pluginFiles = Directory.GetFiles(path, "*.dll"); - - - for (int i = 0; i < pluginFiles.Length; i++) - { - this.AddPlugin(pluginFiles[i]); - } - } - - /// - /// - /// - /// - private void AddPlugin(string FileName) - { - Assembly pluginAssembly = Assembly.LoadFrom(FileName); - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IScriptEngine", true); - - if (typeInterface != null) - { - IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(this); - this.scriptEngines.Add(plug.GetName(), plug); - - } - - typeInterface = null; - } - } - } - - pluginAssembly = null; - } - - /// - /// - /// - /// - /// - /// - /// - public void LoadScript(string scriptType, string scriptName, string script, Entity ent) - { - if(this.scriptEngines.ContainsKey(scriptType)) - { - this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.LocalId); - } - } - - #region IScriptAPI Methods - - /// - /// - /// - /// - /// - public LLVector3 GetEntityPosition(uint localID) - { - LLVector3 res = new LLVector3(); - // Console.WriteLine("script- getting entity " + localID + " position"); - foreach (Entity entity in this.Entities.Values) - { - if (entity.LocalId == localID) - { - res.X = entity.Pos.X; - res.Y = entity.Pos.Y; - res.Z = entity.Pos.Z; - } - } - return res; - } - - /// - /// - /// - /// - /// - /// - /// - public void SetEntityPosition(uint localID, float x , float y, float z) - { - foreach (Entity entity in this.Entities.Values) - { - if (entity.LocalId == localID && entity is Primitive) - { - LLVector3 pos = entity.Pos; - pos.X = x; - pos.Y = y; - Primitive prim = entity as Primitive; - // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - //prim.UpdatePosition(pos); - // Console.WriteLine("script- setting entity " + localID + " positon"); - } - } - - } - - /// - /// - /// - /// - public uint GetRandomAvatarID() - { - //Console.WriteLine("script- getting random avatar id"); - uint res = 0; - foreach (Entity entity in this.Entities.Values) - { - if (entity is ScenePresence) - { - res = entity.LocalId; - } - } - return res; - } - - #endregion - - - } -} diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b345c0c..f1de803 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -44,7 +44,7 @@ using OpenSim.Framework.Communications; using OpenSim.Region.Caches; using OpenSim.Region.Environment; using OpenSim.Framework.Servers; -using OpenSim.Scripting; +using OpenSim.Region.Enviorment.Scripting; using OpenSim.Region.Capabilities; using Caps = OpenSim.Region.Capabilities.Caps; @@ -52,7 +52,7 @@ namespace OpenSim.Region.Environment.Scenes { public delegate bool FilterAvatarList(ScenePresence avatar); - public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI + public partial class Scene : SceneBase, ILocalStorageReceiver { protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); protected Dictionary Avatars; diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs index 870303f..a232b65 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs @@ -34,7 +34,7 @@ using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.CSharp; -namespace OpenSim.Scripting +namespace OpenSim.Region.Enviorment.Scripting { public class CSharpScriptEngine : IScriptCompiler { diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs index ffae1d7..2d44223 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs @@ -34,7 +34,7 @@ using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.JScript; -namespace OpenSim.Scripting +namespace OpenSim.Region.Enviorment.Scripting { public class JScriptEngine : IScriptCompiler { diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs index b33b55d..51b1512 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs @@ -34,7 +34,7 @@ using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.VJSharp; -namespace OpenSim.Scripting +namespace OpenSim.Region.Enviorment.Scripting { public class JSharpScriptEngine : IScriptCompiler { diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs new file mode 100644 index 0000000..1e64675 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs @@ -0,0 +1,71 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework.Console; +using OpenSim.Framework; +using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Region.Enviorment.Scripting +{ + public interface IScript + { + void Initialise(ScriptInfo scriptInfo); + string getName(); + } + + public class TestScript : IScript + { + ScriptInfo script; + + public string getName() + { + return "TestScript 0.1"; + } + + public void Initialise(ScriptInfo scriptInfo) + { + script = scriptInfo; + script.events.OnFrame += new OpenSim.Region.Environment.Scenes.EventManager.OnFrameDelegate(events_OnFrame); + script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); + } + + void events_OnNewPresence(ScenePresence presence) + { + script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); + } + + void events_OnFrame() + { + //script.logger.Verbose("Hello World!"); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs index 57df4c4..522a572 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs @@ -32,7 +32,7 @@ using System.Text; using OpenSim.Region.Environment.Scenes; using OpenSim.Framework.Console; -namespace OpenSim.Scripting +namespace OpenSim.Region.Enviorment.Scripting { /// /// Class which provides access to the world diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 5d1d188..576b7a5 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Scripting +namespace OpenSim.Region.Enviorment.Scripting { public class ScriptManager { -- cgit v1.1 From bee543300fc812277e9a9478dc05b986e00ed44e Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 14:45:46 +0000 Subject: *User Profile requests on OGS UserServer now uses XMLRPC instead of REST *Added base support for setting up a master user --- .../Communications/Local/LocalUserServices.cs | 25 ++++++++++++++++++++++ .../Region/Communications/OGS1/OGSUserServices.cs | 17 ++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 1eb574c..2097870 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -114,5 +114,30 @@ namespace OpenSim.Region.Communications.Local } + public UserProfileData SetupMasterUser(string firstName, string lastName) + { + return SetupMasterUser(firstName, lastName, ""); + } + public UserProfileData SetupMasterUser(string firstName, string lastName, string password) + { + UserProfileData profile = getUserProfile(firstName, lastName); + if (profile != null) + { + + return profile; + } + + Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); + this.AddUserProfile(firstName, lastName, password, defaultHomeX, defaultHomeY); + + profile = getUserProfile(firstName, lastName); + + if (profile == null) + { + Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here."); + } + + return profile; + } } } diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs index 012774d..48d3018 100644 --- a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs @@ -11,7 +11,7 @@ namespace OpenSim.Region.Communications.OGS1 { public UserProfileData GetUserProfile(string firstName, string lastName) { - return null; + return GetUserProfile(firstName + " " + lastName); } public UserProfileData GetUserProfile(string name) { @@ -21,5 +21,20 @@ namespace OpenSim.Region.Communications.OGS1 { return null; } + + public UserProfileData SetupMasterUser(string firstName, string lastName) + { + return SetupMasterUser(firstName, lastName, ""); + } + + public UserProfileData SetupMasterUser(string firstName, string lastName, string password) + { + UserProfileData profile = GetUserProfile(firstName, lastName); + if (profile == null) + { + Console.WriteLine("Unknown Master User. Grid Mode: No clue what I should do. Probably would choose the grid owner UUID when that is implemented"); + } + return null; + } } } -- cgit v1.1 From e1ebfaef637acd6916b519e053c1eb808c98b3c5 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 15:56:24 +0000 Subject: Applied ScenePresence movement patch from Darok. --- OpenSim/Region/Capabilities/LLSDHelpers.cs | 12 ++-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 81 ++++++++++++++-------- 2 files changed, 60 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs index 80916b4..76d9345 100644 --- a/OpenSim/Region/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Region/Capabilities/LLSDHelpers.cs @@ -73,7 +73,6 @@ namespace OpenSim.Region.Capabilities } else { - //Console.WriteLine("LLSD field name" + fields[i].Name + " , " + fields[i].GetValue(obj).GetType()); writer.WriteStartElement(String.Empty, "key", String.Empty); writer.WriteString(fields[i].Name); writer.WriteEndElement(); @@ -86,12 +85,15 @@ namespace OpenSim.Region.Capabilities // LLSDArray arrayObject = obj as LLSDArray; // ArrayList a = arrayObject.Array; ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); - writer.WriteStartElement(String.Empty, "array", String.Empty); - foreach (object item in a) + if (a != null) { - SerializeLLSDType(writer, item); + writer.WriteStartElement(String.Empty, "array", String.Empty); + foreach (object item in a) + { + SerializeLLSDType(writer, item); + } + writer.WriteEndElement(); } - writer.WriteEndElement(); break; } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 96e5c94..23434a0 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -66,6 +66,17 @@ namespace OpenSim.Region.Environment.Scenes protected RegionInfo m_regionInfo; + private Vector3[] Dir_Vectors = new Vector3[6]; + private enum Dir_ControlFlags + { + DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, + DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG, + DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS, + DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG, + DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, + DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG + } + #region Properties /// /// @@ -125,6 +136,13 @@ namespace OpenSim.Region.Environment.Scenes // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); + Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD + Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK + Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT + Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT + Dir_Vectors[4] = new Vector3(0, 0, 1); //UP + Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN + } #endregion @@ -216,40 +234,47 @@ namespace OpenSim.Region.Environment.Scenes /// /// public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) - { - if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) + { + int i = 0; + bool update_movementflag = false; + bool update_rotation = false; + bool DCFlagKeyPressed = false; + Vector3 agent_control_v3 = new Vector3(0, 0, 0); + Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + + + // this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); + + if (q != this.bodyRot) { - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); - if (((movementflag & 1) == 0) || (q != this.bodyRot)) - { - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); - this.AddNewMovement(v3, q); - movementflag = 1; - this.bodyRot = q; - } + this.bodyRot = q; + update_rotation = true; } - else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) + foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) { - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); - if (((movementflag & 2) == 0) || (q != this.bodyRot)) - { - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); - this.AddNewMovement(v3, q); - movementflag = 2; - this.bodyRot = q; + if ((flags & (uint)DCF) != 0) + { + DCFlagKeyPressed = true; + agent_control_v3 += Dir_Vectors[i]; + if ((movementflag & (uint)DCF) == 0) + { + movementflag += (byte)(uint)DCF; + update_movementflag = true; + } } - } - else - { - if ((movementflag) != 0) + else { - NewForce newVelocity = new NewForce(); - newVelocity.X = 0; - newVelocity.Y = 0; - newVelocity.Z = 0; - this.forcesList.Add(newVelocity); - movementflag = 0; + if ((movementflag & (uint)DCF) != 0) + { + movementflag -= (byte)(uint)DCF; + update_movementflag = true; + } } + i++; + } + if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) + { + this.AddNewMovement(agent_control_v3, q); } } -- cgit v1.1 From 108d89f89436556c8f4662197903c374db943f7d Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 16:17:20 +0000 Subject: *Master User is now set up *Added support for getting user profile information from remote grid server (untested) *Updated prebuild.xml --- OpenSim/Region/Application/OpenSim.csproj | 12 +++-- OpenSim/Region/Application/OpenSim.exe.build | 3 +- OpenSim/Region/Application/OpenSimMain.cs | 11 +++- .../OpenSim.Region.Capabilities.csproj | 20 +++---- .../OpenSim.Region.Capabilities.dll.build | 16 +++--- .../ClientStack/OpenSim.Region.ClientStack.csproj | 18 +++---- .../OpenSim.Region.ClientStack.dll.build | 12 ++--- .../Communications/Local/CommunicationsLocal.cs | 2 +- .../OpenSim.Region.Communications.Local.csproj | 6 +-- .../OpenSim.Region.Communications.Local.dll.build | 2 +- .../Region/Communications/OGS1/GridCommsManager.cs | 2 +- .../Region/Communications/OGS1/OGSUserServices.cs | 63 ++++++++++++++++++++++ .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 4 +- .../OpenSim.Region.Communications.OGS1.dll.build | 4 +- .../Environment/OpenSim.Region.Environment.csproj | 34 ++++++------ .../OpenSim.Region.Environment.dll.build | 26 ++++----- .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +-- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 2 +- 18 files changed, 161 insertions(+), 82 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index 5cefa96..f5da23d 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -102,6 +102,12 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False + + OpenSim.Framework.Data + {36B72A9B-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} @@ -164,13 +170,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build index 74eee5b..9890cfa 100644 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -11,9 +11,9 @@ + - @@ -26,6 +26,7 @@ + diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 7bf6b8d..6e600b8 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -42,6 +42,8 @@ using OpenSim.Region.Environment; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Terrain; using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Data; + using OpenSim.Framework.Types; using OpenSim.Framework; using OpenSim.Assets; @@ -250,7 +252,14 @@ namespace OpenSim LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); LocalWorld.LoadPrimsFromStorage(); - LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); + + //Master Avatar Setup + UserProfileData masterAvatar = commsManager.UserServer.SetupMasterUser(LocalWorld.RegionInfo.MasterAvatarFirstName, LocalWorld.RegionInfo.MasterAvatarLastName, LocalWorld.RegionInfo.MasterAvatarSandboxPassword); + if (masterAvatar != null) + { + LocalWorld.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; + LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); + } LocalWorld.StartTimer(); diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index 4667d52..1ed28d2 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -96,40 +96,40 @@ - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build index a091b5c..dd853e7 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -11,18 +11,18 @@ - - - + - - - - - + + + + + + + diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 3093eb0..2e1d8e2 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,34 +122,34 @@ - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index f76a4c8..1c791d3 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -11,16 +11,16 @@ - - - + + + + - - - + + diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index f5aa8ae..bacaa3e 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Communications.Local public CommunicationsLocal(NetworkServersInfo serversInfo) : base(serversInfo) { - UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY); + UserServices = new LocalUserServices(this,this.ServersInfo.DefaultHomeLocX,this.ServersInfo.DefaultHomeLocY); UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); UserServer = UserServices; GridServer = SandBoxServices; diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index 0a15a49..200fa3a 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,15 +98,15 @@ - - Code - Code Code + + Code + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build index 3cac9d3..60a90bd 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -11,9 +11,9 @@ - + diff --git a/OpenSim/Region/Communications/OGS1/GridCommsManager.cs b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs index 77848fa..2bf9536 100644 --- a/OpenSim/Region/Communications/OGS1/GridCommsManager.cs +++ b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs @@ -12,7 +12,7 @@ namespace OpenSim.Region.Communications.OGS1 { GridServer = gridInterComms; InterRegion = gridInterComms; - UserServer = new OGSUserServices(); + UserServer = new OGSUserServices(this); } } } diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs index 48d3018..d41bdaf 100644 --- a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs @@ -1,24 +1,87 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Text; +using OpenSim.Framework.Types; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; using libsecondlife; +using Nwc.XmlRpc; + namespace OpenSim.Region.Communications.OGS1 { public class OGSUserServices :IUserServices { + GridCommsManager m_parent; + public OGSUserServices(GridCommsManager parent) + { + m_parent = parent; + } + + public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) + { + UserProfileData userData = new UserProfileData(); + userData.username = (string)data["firstname"]; + userData.surname = (string)data["lastname"]; + userData.UUID = new LLUUID((string)data["uuid"]); + userData.userInventoryURI = (string)data["server_inventory"]; + userData.userAssetURI = (string)data["server_asset"]; + userData.profileFirstText = (string)data["profile_firstlife_about"]; + userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); + userData.profileCanDoMask = (uint)data["profile_can_do"]; + userData.profileWantDoMask = (uint)data["profile_want_do"]; + userData.profileImage = new LLUUID((string)data["profile_image"]); + userData.lastLogin = (int)data["profile_lastlogin"]; + userData.homeLocation = new LLVector3(); + userData.homeLookAt = new LLVector3(); + + return userData; + } public UserProfileData GetUserProfile(string firstName, string lastName) { return GetUserProfile(firstName + " " + lastName); } public UserProfileData GetUserProfile(string name) { + + try + { + Hashtable param = new Hashtable(); + param["avatar_name"] = name; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); + XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (Exception e) + { + Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); + } return null; } public UserProfileData GetUserProfile(LLUUID avatarID) { + try + { + + Hashtable param = new Hashtable(); + param["avatar_uuid"] = avatarID.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); + XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (Exception e) + { + Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); + } return null; } diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 8cc5641..2124bd9 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,13 +116,13 @@ - + Code Code - + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 21bb15c..1a7cf69 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,9 +11,9 @@ - - + + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 4069454..9f8d2c3 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -148,64 +148,64 @@ - + Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code Code - + Code - + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index 51924d5..667f1d7 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -11,26 +11,26 @@ + - - - - - - - - - - + - - + + + + + + + + + + - + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 147158c..716fd57 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,9 +93,6 @@ Code - - Code - Code @@ -105,6 +102,9 @@ Code + + Code + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build index fc9f055..112ff1c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -12,10 +12,10 @@ - + -- cgit v1.1 From d3363bbc28442d70ea8c196e47e6c734f4c01a92 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 17:03:09 +0000 Subject: *Renamed GridCommsManager to CommunicationsOGS1 to match CommunicationsLocal -- its sandbox mode counterpart --- OpenSim/Region/Application/OpenSimMain.cs | 2 +- .../Communications/OGS1/CommunicationsOGS1.cs | 18 ++++++++ .../Region/Communications/OGS1/GridCommsManager.cs | 18 -------- .../Region/Communications/OGS1/OGSUserServices.cs | 4 +- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 49 ++++++++++++---------- 5 files changed, 49 insertions(+), 42 deletions(-) create mode 100644 OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs delete mode 100644 OpenSim/Region/Communications/OGS1/GridCommsManager.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 6e600b8..a5150e6 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -118,7 +118,7 @@ namespace OpenSim else { this.SetupRemoteGridServers(); - this.commsManager = new GridCommsManager(this.serversData); + this.commsManager = new CommunicationsOGS1(this.serversData); } startuptime = DateTime.Now; diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs new file mode 100644 index 0000000..f2b3b92 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +namespace OpenSim.Region.Communications.OGS1 +{ + public class CommunicationsOGS1 : CommunicationsManager + { + private OGS1GridServices gridInterComms = new OGS1GridServices(); + public CommunicationsOGS1(NetworkServersInfo serversInfo) :base(serversInfo) + { + GridServer = gridInterComms; + InterRegion = gridInterComms; + UserServer = new OGSUserServices(this); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/GridCommsManager.cs b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs deleted file mode 100644 index 2bf9536..0000000 --- a/OpenSim/Region/Communications/OGS1/GridCommsManager.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; -using OpenSim.Framework.Communications; -namespace OpenSim.Region.Communications.OGS1 -{ - public class GridCommsManager : CommunicationsManager - { - private OGS1GridServices gridInterComms = new OGS1GridServices(); - public GridCommsManager(NetworkServersInfo serversInfo) :base(serversInfo) - { - GridServer = gridInterComms; - InterRegion = gridInterComms; - UserServer = new OGSUserServices(this); - } - } -} diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs index d41bdaf..56a7837 100644 --- a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs @@ -13,8 +13,8 @@ namespace OpenSim.Region.Communications.OGS1 { public class OGSUserServices :IUserServices { - GridCommsManager m_parent; - public OGSUserServices(GridCommsManager parent) + CommunicationsOGS1 m_parent; + public OGSUserServices(CommunicationsOGS1 parent) { m_parent = parent; } diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 2124bd9..b03ac7e 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {4806E378-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Region.Communications.OGS1 @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Region.Communications.OGS1 - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,30 +61,31 @@ False False 4 - + + - + ..\..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Data.dll False - + System.Runtime.Remoting.dll False - + System.Xml.dll False - + ..\..\..\..\bin\XMLRPC.dll False @@ -88,31 +95,31 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Data {36B72A9B-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -122,7 +129,7 @@ Code - + Code @@ -139,4 +146,4 @@ - + \ No newline at end of file -- cgit v1.1 From 41f26668d93dd871056ba506a306cd23e8573503 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 17:48:45 +0000 Subject: enabled physics plugin flying flags. --- OpenSim/Region/Communications/Local/LocalUserServices.cs | 2 ++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 2097870..508a3f9 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -36,6 +36,7 @@ namespace OpenSim.Region.Communications.Local { return this.getUserProfile(name); } + public UserProfileData GetUserProfile(LLUUID avatarID) { return this.getUserProfile(avatarID); @@ -118,6 +119,7 @@ namespace OpenSim.Region.Communications.Local { return SetupMasterUser(firstName, lastName, ""); } + public UserProfileData SetupMasterUser(string firstName, string lastName, string password) { UserProfileData profile = getUserProfile(firstName, lastName); diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 23434a0..b90004e 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -242,8 +242,7 @@ namespace OpenSim.Region.Environment.Scenes Vector3 agent_control_v3 = new Vector3(0, 0, 0); Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); - - // this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); + this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); if (q != this.bodyRot) { -- cgit v1.1 From fe0528b98cfc13d26ac7f1bf6bc23655be1f52e5 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 19:09:50 +0000 Subject: *Added UUIDNameRequest packet support (untested, but should work -- at least in sandbox mode) *Various small renamings --- OpenSim/Region/Application/OpenSimMain.cs | 8 +- .../OpenSim.Region.Capabilities.csproj | 6 +- .../OpenSim.Region.Capabilities.dll.build | 2 +- OpenSim/Region/ClientStack/ClientView.API.cs | 3 +- .../ClientStack/ClientView.PacketHandlers.cs | 2 - .../ClientStack/ClientView.ProcessPackets.cs | 8 +- .../ClientStack/OpenSim.Region.ClientStack.csproj | 10 +- .../OpenSim.Region.ClientStack.dll.build | 6 +- .../Communications/OGS1/CommunicationsOGS1.cs | 2 +- .../Communications/OGS1/OGS1InterSimComms.cs | 70 +++++++++++++ .../Region/Communications/OGS1/OGS1UserServices.cs | 109 +++++++++++++++++++++ .../Region/Communications/OGS1/OGSInterSimComms.cs | 70 ------------- .../Region/Communications/OGS1/OGSUserServices.cs | 103 ------------------- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 51 +++++----- .../OpenSim.Region.Communications.OGS1.dll.build | 6 +- .../Environment/OpenSim.Region.Environment.csproj | 6 +- .../OpenSim.Region.Environment.dll.build | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 3 +- 18 files changed, 235 insertions(+), 232 deletions(-) create mode 100644 OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGS1UserServices.cs delete mode 100644 OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs delete mode 100644 OpenSim/Region/Communications/OGS1/OGSUserServices.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index a5150e6..fcb2493 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -64,8 +64,8 @@ namespace OpenSim public class OpenSimMain : RegionApplicationBase, conscmd_callback { - // private CheckSumServer checkServer; protected CommunicationsManager commsManager; + // private CheckSumServer checkServer; private bool m_silent; private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; @@ -106,14 +106,12 @@ namespace OpenSim ClientView.TerrainManager = new TerrainManager(new SecondLife()); - CommunicationsLocal sandboxCommunications = null; if (m_sandbox) { this.SetupLocalGridServers(); // this.checkServer = new CheckSumServer(12036); // this.checkServer.ServerListener(); - sandboxCommunications = new CommunicationsLocal(this.serversData); - this.commsManager = sandboxCommunications; + this.commsManager = new CommunicationsLocal(this.serversData); } else { @@ -136,7 +134,7 @@ namespace OpenSim if (m_sandbox) { - httpServer.AddXmlRPCHandler("login_to_simulator", sandboxCommunications.UserServices.XmlRpcLoginMethod); + httpServer.AddXmlRPCHandler("login_to_simulator", ((CommunicationsLocal)this.commsManager).UserServices.XmlRpcLoginMethod); } //Start http server diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index 1ed28d2..bb21365 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -114,9 +114,6 @@ Code - - Code - Code @@ -132,6 +129,9 @@ Code + + Code + diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build index dd853e7..817e5b0 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -17,12 +17,12 @@ - + diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 5e346fb..9650b42 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -68,6 +68,8 @@ namespace OpenSim.Region.ClientStack public event GenericCall6 OnRemoveAvatar; public event RequestMapBlocks OnRequestMapBlocks; public event TeleportLocationRequest OnTeleportLocationRequest; + + public event UUIDNameRequest OnNameFromUUIDRequest; public event ParcelPropertiesRequest OnParcelPropertiesRequest; public event ParcelDivideRequest OnParcelDivideRequest; @@ -75,7 +77,6 @@ namespace OpenSim.Region.ClientStack public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event EstateOwnerMessageRequest OnEstateOwnerMessage; - /// /// /// diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index cbd10dc..0456e3c 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -192,7 +192,5 @@ namespace OpenSim.Region.ClientStack this.OutPacket(mbReply); */ } - - } } diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 51981b8..794ce79 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -492,7 +492,13 @@ namespace OpenSim.Region.ClientStack case PacketType.MoneyBalanceRequest: this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000); break; - + case PacketType.UUIDNameRequest: + UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; + foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) + { + OnNameFromUUIDRequest(UUIDBlock.ID, this); + } + break; #region Parcel related packets case PacketType.ParcelPropertiesRequest: ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 2e1d8e2..e679174 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -134,22 +134,22 @@ Code - + Code - + Code - + Code Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index 1c791d3..95422c8 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -15,12 +15,12 @@ + + + - - - diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index f2b3b92..870f577 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -12,7 +12,7 @@ namespace OpenSim.Region.Communications.OGS1 { GridServer = gridInterComms; InterRegion = gridInterComms; - UserServer = new OGSUserServices(this); + UserServer = new OGS1UserServices(this); } } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs new file mode 100644 index 0000000..51b33e9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +namespace OpenSim.Region.Communications.OGS1 +{ + public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); + public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); + + public sealed class InterRegionSingleton + { + static readonly InterRegionSingleton instance = new InterRegionSingleton(); + + public event InformRegionChild OnChildAgent; + public event ExpectArrival OnArrival; + + static InterRegionSingleton() + { + } + + InterRegionSingleton() + { + } + + public static InterRegionSingleton Instance + { + get + { + return instance; + } + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (OnChildAgent != null) + { + return OnChildAgent(regionHandle, agentData); + } + return false; + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (OnArrival != null) + { + return OnArrival(regionHandle, agentID, position); + } + return false; + } + } + + public class OGS1InterRegionRemoting : MarshalByRefObject + { + + public OGS1InterRegionRemoting() + { + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs new file mode 100644 index 0000000..856c447 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; +using libsecondlife; + +using Nwc.XmlRpc; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1UserServices :IUserServices + { + CommunicationsOGS1 m_parent; + public OGS1UserServices(CommunicationsOGS1 parent) + { + m_parent = parent; + } + + public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) + { + if (data.Contains("error_type")) + { + Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); + return null; + } + + UserProfileData userData = new UserProfileData(); + userData.username = (string)data["firstname"]; + userData.surname = (string)data["lastname"]; + userData.UUID = new LLUUID((string)data["uuid"]); + userData.userInventoryURI = (string)data["server_inventory"]; + userData.userAssetURI = (string)data["server_asset"]; + userData.profileFirstText = (string)data["profile_firstlife_about"]; + userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); + userData.profileCanDoMask = (uint)data["profile_can_do"]; + userData.profileWantDoMask = (uint)data["profile_want_do"]; + userData.profileImage = new LLUUID((string)data["profile_image"]); + userData.lastLogin = (int)data["profile_lastlogin"]; + userData.homeLocation = new LLVector3(); + userData.homeLookAt = new LLVector3(); + + return userData; + } + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return GetUserProfile(firstName + " " + lastName); + } + public UserProfileData GetUserProfile(string name) + { + + try + { + Hashtable param = new Hashtable(); + param["avatar_name"] = name; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); + XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (Exception e) + { + Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); + } + return null; + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + try + { + + Hashtable param = new Hashtable(); + param["avatar_uuid"] = avatarID.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); + XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (Exception e) + { + Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); + } + return null; + } + + public UserProfileData SetupMasterUser(string firstName, string lastName) + { + return SetupMasterUser(firstName, lastName, ""); + } + + public UserProfileData SetupMasterUser(string firstName, string lastName, string password) + { + UserProfileData profile = GetUserProfile(firstName, lastName); + if (profile == null) + { + Console.WriteLine("Unknown Master User. Grid Mode: No clue what I should do. Probably would choose the grid owner UUID when that is implemented"); + } + return null; + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs deleted file mode 100644 index 51b33e9..0000000 --- a/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; -using OpenSim.Framework.Communications; -namespace OpenSim.Region.Communications.OGS1 -{ - public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); - public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); - - public sealed class InterRegionSingleton - { - static readonly InterRegionSingleton instance = new InterRegionSingleton(); - - public event InformRegionChild OnChildAgent; - public event ExpectArrival OnArrival; - - static InterRegionSingleton() - { - } - - InterRegionSingleton() - { - } - - public static InterRegionSingleton Instance - { - get - { - return instance; - } - } - - public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) - { - if (OnChildAgent != null) - { - return OnChildAgent(regionHandle, agentData); - } - return false; - } - - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) - { - if (OnArrival != null) - { - return OnArrival(regionHandle, agentID, position); - } - return false; - } - } - - public class OGS1InterRegionRemoting : MarshalByRefObject - { - - public OGS1InterRegionRemoting() - { - } - - public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) - { - return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); - } - - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) - { - return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); - } - } -} diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs deleted file mode 100644 index 56a7837..0000000 --- a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Data; -using libsecondlife; - -using Nwc.XmlRpc; - -namespace OpenSim.Region.Communications.OGS1 -{ - public class OGSUserServices :IUserServices - { - CommunicationsOGS1 m_parent; - public OGSUserServices(CommunicationsOGS1 parent) - { - m_parent = parent; - } - - public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) - { - UserProfileData userData = new UserProfileData(); - userData.username = (string)data["firstname"]; - userData.surname = (string)data["lastname"]; - userData.UUID = new LLUUID((string)data["uuid"]); - userData.userInventoryURI = (string)data["server_inventory"]; - userData.userAssetURI = (string)data["server_asset"]; - userData.profileFirstText = (string)data["profile_firstlife_about"]; - userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); - userData.profileCanDoMask = (uint)data["profile_can_do"]; - userData.profileWantDoMask = (uint)data["profile_want_do"]; - userData.profileImage = new LLUUID((string)data["profile_image"]); - userData.lastLogin = (int)data["profile_lastlogin"]; - userData.homeLocation = new LLVector3(); - userData.homeLookAt = new LLVector3(); - - return userData; - } - public UserProfileData GetUserProfile(string firstName, string lastName) - { - return GetUserProfile(firstName + " " + lastName); - } - public UserProfileData GetUserProfile(string name) - { - - try - { - Hashtable param = new Hashtable(); - param["avatar_name"] = name; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); - XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - catch (Exception e) - { - Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); - } - return null; - } - public UserProfileData GetUserProfile(LLUUID avatarID) - { - try - { - - Hashtable param = new Hashtable(); - param["avatar_uuid"] = avatarID.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); - XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - catch (Exception e) - { - Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); - } - return null; - } - - public UserProfileData SetupMasterUser(string firstName, string lastName) - { - return SetupMasterUser(firstName, lastName, ""); - } - - public UserProfileData SetupMasterUser(string firstName, string lastName, string password) - { - UserProfileData profile = GetUserProfile(firstName, lastName); - if (profile == null) - { - Console.WriteLine("Unknown Master User. Grid Mode: No clue what I should do. Probably would choose the grid owner UUID when that is implemented"); - } - return null; - } - } -} diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index b03ac7e..0a9e5fb 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {4806E378-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region.Communications.OGS1 @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region.Communications.OGS1 - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,31 +55,30 @@ False False 4 - - + - + ..\..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Data.dll False - + System.Runtime.Remoting.dll False - + System.Xml.dll False - + ..\..\..\..\bin\XMLRPC.dll False @@ -95,35 +88,35 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Data {36B72A9B-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False - + Code @@ -132,7 +125,7 @@ Code - + Code @@ -146,4 +139,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 1a7cf69..2176b14 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,10 +11,10 @@ - + - - + + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 9f8d2c3..0cfeda9 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -163,9 +163,6 @@ Code - - Code - Code @@ -187,6 +184,9 @@ Code + + Code + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index 667f1d7..fcfc623 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -16,7 +16,6 @@ - @@ -24,6 +23,7 @@ + diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f1de803..8c912d0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -505,6 +505,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; //remoteClient.OnObjectSelect += this.SelectPrim; remoteClient.OnGrapUpdate += this.MoveObject; + remoteClient.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -512,7 +513,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); */ - + ScenePresence newAvatar = null; try { -- cgit v1.1 From 135e9b1f538ae77dfd8bf68139c960fb8e016c16 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 28 Jun 2007 19:35:20 +0000 Subject: * Removed J# language support because it has issues with Mono. --- OpenSim/Region/Application/OpenSim.csproj | 6 +- OpenSim/Region/Application/OpenSim.exe.build | 2 +- .../OpenSim.Region.Capabilities.csproj | 22 ++--- .../OpenSim.Region.Capabilities.dll.build | 16 ++-- .../ClientStack/OpenSim.Region.ClientStack.csproj | 20 ++-- .../OpenSim.Region.ClientStack.dll.build | 12 +-- .../OpenSim.Region.Communications.Local.csproj | 6 +- .../OpenSim.Region.Communications.Local.dll.build | 2 +- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 4 +- .../OpenSim.Region.Communications.OGS1.dll.build | 4 +- .../Environment/OpenSim.Region.Environment.csproj | 39 ++++---- .../OpenSim.Region.Environment.dll.build | 24 +++-- .../Scenes/scripting/Engines/JSharpScriptEngine.cs | 104 --------------------- .../Environment/Scenes/scripting/ScriptManager.cs | 3 - .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 2 +- 16 files changed, 78 insertions(+), 194 deletions(-) delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index f5da23d..bec85cc 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -170,15 +170,15 @@ - - Code - Code Code + + Code + diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build index 9890cfa..6c7d7ac 100644 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -11,9 +11,9 @@ - + diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index bb21365..4667d52 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -96,40 +96,40 @@ - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build index 817e5b0..a091b5c 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -11,18 +11,18 @@ - + + + + + + + - - - - - - - + diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index e679174..3093eb0 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,34 +122,34 @@ - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index 95422c8..f76a4c8 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -11,16 +11,16 @@ - - - - + + - - + + + + diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index 200fa3a..0a15a49 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,13 +98,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build index 60a90bd..3cac9d3 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -11,9 +11,9 @@ + - diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 0a9e5fb..d6abd13 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,13 +116,13 @@ - + Code Code - + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 2176b14..04d61b9 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,9 +11,9 @@ - - + + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 0cfeda9..428f381 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -82,10 +82,6 @@ System.Xml.dll False - - VJSharpCodeProvider.dll - False - ..\..\..\bin\XMLRPC.dll False @@ -148,61 +144,58 @@ - - Code - Code Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index fcfc623..2fa5e76 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -11,25 +11,24 @@ - - - - - - - - + + + + + + + + + - - - + + - @@ -52,7 +51,6 @@ - diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs deleted file mode 100644 index 51b1512..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JSharpScriptEngine.cs +++ /dev/null @@ -1,104 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -// Compilation stuff -using System.CodeDom; -using System.CodeDom.Compiler; -using Microsoft.VJSharp; - -namespace OpenSim.Region.Enviorment.Scripting -{ - public class JSharpScriptEngine : IScriptCompiler - { - public string FileExt() - { - return ".jsl"; - } - - private Dictionary LoadDotNetScript(ICodeCompiler compiler, string filename) - { - CompilerParameters compilerParams = new CompilerParameters(); - CompilerResults compilerResults; - compilerParams.GenerateExecutable = false; - compilerParams.GenerateInMemory = true; - compilerParams.IncludeDebugInformation = false; - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); - compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); - compilerParams.ReferencedAssemblies.Add("System.dll"); - - compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); - - if (compilerResults.Errors.Count > 0) - { - OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors"); - foreach (CompilerError error in compilerResults.Errors) - { - OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); - } - } - else - { - Dictionary scripts = new Dictionary(); - - foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) - { - Type testInterface = pluginType.GetInterface("IScript", true); - - if (testInterface != null) - { - IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); - - string scriptName = "J#/" + script.getName(); - Console.WriteLine("Script: " + scriptName + " loaded."); - - if (!scripts.ContainsKey(scriptName)) - { - scripts.Add(scriptName, script); - } - else - { - scripts[scriptName] = script; - } - } - } - return scripts; - } - return null; - } - - public Dictionary compile(string filename) - { - VJSharpCodeProvider jsharpProvider = new VJSharpCodeProvider(); - return LoadDotNetScript(jsharpProvider.CreateCompiler(), filename); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 576b7a5..eb1c1d9 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -59,9 +59,6 @@ namespace OpenSim.Region.Enviorment.Scripting JScriptEngine jscriptCompiler = new JScriptEngine(); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); - - JSharpScriptEngine jsharpCompiler = new JSharpScriptEngine(); - compilers.Add(jsharpCompiler.FileExt(), jsharpCompiler); } public void Compile(string filename) diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 716fd57..147158c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,6 +93,9 @@ Code + + Code + Code @@ -102,9 +105,6 @@ Code - - Code - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build index 112ff1c..fc9f055 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -12,10 +12,10 @@ + - -- cgit v1.1 From 90b01ba80ccaa69bf7cf76be6ce0a6ca05717d6c Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 29 Jun 2007 01:58:16 +0000 Subject: *Hopefully fixed the empty dialog box error on client when logging in on sandbox mode --- OpenSim/Region/Communications/Local/LocalBackEndServices.cs | 1 - OpenSim/Region/Communications/Local/LocalUserServices.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index ae47890..26834be 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -182,7 +182,6 @@ namespace OpenSim.Region.Communications.Local /// public bool AddNewSession(ulong regionHandle, Login loginData) { - //Console.WriteLine(" comms manager been told to expect new user"); AgentCircuitData agent = new AgentCircuitData(); agent.AgentID = loginData.Agent; agent.firstname = loginData.First; diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 508a3f9..6cf254b 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.Communications.Local "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; string capsPath = Util.GetRandomCapsPath(); - response.SimAddress = reg.CommsIPListenAddr; + response.SimAddress = reg.CommsExternalAddress; response.SimPort = (Int32)reg.CommsIPListenPort; response.RegionX = reg.RegionLocX ; response.RegionY = reg.RegionLocY ; -- cgit v1.1 From 6b3777d3db323f2054aeff1ba4be3e78edef21b8 Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 29 Jun 2007 16:43:48 +0000 Subject: *Deleted Logger.cs from OpenSim.Framework --- OpenSim/Region/Application/OpenSim.csproj | 6 ++--- OpenSim/Region/Application/OpenSim.exe.build | 2 +- .../OpenSim.Region.Capabilities.csproj | 20 ++++++++-------- .../OpenSim.Region.Capabilities.dll.build | 16 ++++++------- .../ClientStack/OpenSim.Region.ClientStack.csproj | 18 +++++++------- .../OpenSim.Region.ClientStack.dll.build | 12 +++++----- .../OpenSim.Region.Communications.Local.csproj | 6 ++--- .../OpenSim.Region.Communications.Local.dll.build | 2 +- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 6 ++--- .../OpenSim.Region.Communications.OGS1.dll.build | 2 +- .../Environment/OpenSim.Region.Environment.csproj | 28 +++++++++++----------- .../OpenSim.Region.Environment.dll.build | 20 ++++++++-------- .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 ++--- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 2 +- 14 files changed, 73 insertions(+), 73 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index bec85cc..13619eb 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -170,15 +170,15 @@ - - Code - Code Code + + Code + diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build index 6c7d7ac..355092b 100644 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -11,9 +11,9 @@ - + diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index 4667d52..1ed28d2 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -96,40 +96,40 @@ - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build index a091b5c..dd853e7 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -11,18 +11,18 @@ - - - + - - - - - + + + + + + + diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 3093eb0..2e1d8e2 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,34 +122,34 @@ - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index f76a4c8..1c791d3 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -11,16 +11,16 @@ - - - + + + + - - - + + diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index 0a15a49..f9f6b7d 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,13 +98,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build index 3cac9d3..bfefabf 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -11,9 +11,9 @@ + - diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index d6abd13..90a01b6 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,6 +116,9 @@ + + Code + Code @@ -125,9 +128,6 @@ Code - - Code - Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 04d61b9..960a84a 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,10 +11,10 @@ + - diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 428f381..6dabd05 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -144,55 +144,55 @@ - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index 2fa5e76..eb26ea0 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -11,23 +11,23 @@ + - - - - - - - - + - - + + + + + + + + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 147158c..716fd57 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,9 +93,6 @@ Code - - Code - Code @@ -105,6 +102,9 @@ Code + + Code + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build index fc9f055..112ff1c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -12,10 +12,10 @@ - + -- cgit v1.1 From cc1c4c034c788b9e2f48d398b12b40ed8d363f40 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 29 Jun 2007 18:37:26 +0000 Subject: * Applying Danx0r's BasicPhysics update. --- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index dcb8f3b..e3f34da 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -101,22 +101,29 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin { foreach (BasicActor actor in _actors) { - actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); - actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); - actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); - /*if(actor.Flying) - { - actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); - } - else - { - actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); - } - if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) - {*/ if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) { - actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1; + float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; + actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); + actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); + if (actor.Flying) + { + if (actor.Position.Z + (actor.Velocity.Z * timeStep) < + _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2) + { + actor.Position.Z = height; + actor.Velocity.Z = 0; + } + else + { + actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); + } + } + else + { + actor.Position.Z = height; + actor.Velocity.Z = 0; + } } else { @@ -167,7 +174,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin actor.Position.Y = 255; actor.Velocity.X = 0; }*/ - } + } } public override void GetResults() @@ -211,7 +218,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin { get { - return false; + return flying; } set { -- cgit v1.1 From 72cd28be1b743a61c739d7d13f933cf41e948fdf Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 29 Jun 2007 20:09:29 +0000 Subject: * Experimental patch: Replaced IPAddress.Any with IPAddress.Parse("0.0.0.0") to force IPv4 --- OpenSim/Region/ClientStack/UDPServer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 259352c..b764519 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -112,7 +112,7 @@ namespace OpenSim.Region.ClientStack protected virtual void OnReceivedData(IAsyncResult result) { - ipeSender = new IPEndPoint(IPAddress.Any, 0); + ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); epSender = (EndPoint)ipeSender; Packet packet = null; int numBytes = Server.EndReceiveFrom(result, ref epSender); @@ -151,13 +151,13 @@ namespace OpenSim.Region.ClientStack { m_log.Status("UDPServer.cs:ServerListener() - Opening UDP socket on " + listenPort); - ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); + ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); Server.Bind(ServerIncoming); m_log.Verbose("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); - ipeSender = new IPEndPoint(IPAddress.Any, 0); + ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); epSender = (EndPoint)ipeSender; ReceivedData = new AsyncCallback(this.OnReceivedData); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); -- cgit v1.1 From 31649aa1d53b68ce8e5cc5a298f57e530309ab04 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 1 Jul 2007 11:24:50 +0000 Subject: * Fixed scripting engine with a few minor updated namespace issues. --- .../Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs | 1 + OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs | 1 + 2 files changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs index a232b65..fc193f5 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.Enviorment.Scripting compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs index 2d44223..e6d66eb 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.Enviorment.Scripting compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); -- cgit v1.1 From 5e805656db1215518a344d6d5364629a4997fd47 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 13:17:27 +0000 Subject: Fixed SimpleApp - aka thankgoditssundaycommit * Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins --- OpenSim/Region/Application/OpenSim.csproj | 6 +-- OpenSim/Region/Application/OpenSim.exe.build | 2 +- .../OpenSim.Region.Capabilities.csproj | 20 +++---- .../OpenSim.Region.Capabilities.dll.build | 16 +++--- OpenSim/Region/ClientStack/ClientView.cs | 2 +- .../ClientStack/OpenSim.Region.ClientStack.csproj | 18 +++---- .../OpenSim.Region.ClientStack.dll.build | 12 ++--- .../Communications/Local/LocalUserServices.cs | 4 +- .../OpenSim.Region.Communications.Local.csproj | 6 +-- .../OpenSim.Region.Communications.Local.dll.build | 2 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 10 ++-- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 6 +-- .../OpenSim.Region.Communications.OGS1.dll.build | 2 +- .../Environment/OpenSim.Region.Environment.csproj | 28 +++++----- .../OpenSim.Region.Environment.dll.build | 20 +++---- OpenSim/Region/Environment/Scenes/Scene.cs | 61 ++++++++++------------ OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 18 +++---- OpenSim/Region/Examples/SimpleApp/Program.cs | 24 ++++----- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 18 +++++++ .../Region/Examples/SimpleApp/SimpleApp.exe.build | 3 ++ .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +-- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 2 +- 23 files changed, 148 insertions(+), 140 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index 13619eb..bec85cc 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -170,13 +170,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build index 355092b..6c7d7ac 100644 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -11,9 +11,9 @@ + - diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index 1ed28d2..4667d52 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -96,40 +96,40 @@ - + Code Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build index dd853e7..a091b5c 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -11,18 +11,18 @@ - + + + - - - - - - - + + + + + diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 9c4462d..402a3ca 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -211,7 +211,7 @@ namespace OpenSim.Region.ClientStack protected virtual void InitNewClient() { OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); - this.m_world.AddNewClient(this, this.AgentID, false); + this.m_world.AddNewClient(this, false); } protected virtual void AuthUser() diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 2e1d8e2..3093eb0 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,34 +122,34 @@ - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index 1c791d3..f76a4c8 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -11,16 +11,16 @@ - - - - + + + - - + + + diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 6cf254b..5a2a5c8 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -69,14 +69,14 @@ namespace OpenSim.Region.Communications.Local return profile; } - public override bool AuthenticateUser(ref UserProfileData profile, string password) + public override bool AuthenticateUser(UserProfileData profile, string password) { //for now we will accept any password in sandbox mode Console.WriteLine("authorising user"); return true; } - public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) + public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) { ulong currentRegion = theUser.currentAgent.currentHandle; RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index f9f6b7d..0a15a49 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,15 +98,15 @@ - - Code - Code Code + + Code + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build index bfefabf..3cac9d3 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -11,9 +11,9 @@ - + diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 5f0c80c..2ac7297 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -75,18 +75,14 @@ namespace OpenSim.Region.Communications.OGS1 foreach (Hashtable n in (Hashtable)respData.Values) { - RegionInfo neighbour = new RegionInfo(); + RegionInfo neighbour = new RegionInfo( (uint)n["x"], (uint)n["y"], (string)n["sim_ip"], (int)n["sim_port"], (string)n["sim_uri"] ); //OGS1 - neighbour.RegionHandle = (ulong)n["regionhandle"]; - neighbour.RegionLocX = (uint)n["x"]; - neighbour.RegionLocY = (uint)n["y"]; + //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally + neighbour.RegionName = (string)n["name"]; //OGS1+ - neighbour.CommsIPListenAddr = (string)n["sim_ip"]; - neighbour.CommsIPListenPort = (int)n["sim_port"]; - neighbour.CommsExternalAddress = (string)n["sim_uri"]; neighbour.SimUUID = (string)n["uuid"]; neighbours.Add(neighbour); diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 90a01b6..d6abd13 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,9 +116,6 @@ - - Code - Code @@ -128,6 +125,9 @@ Code + + Code + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 960a84a..04d61b9 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,10 +11,10 @@ - + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 6dabd05..428f381 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -144,55 +144,55 @@ - - Code - Code Code + + Code + Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index eb26ea0..2fa5e76 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -11,23 +11,23 @@ - + + + - - - - - - - - - + + + + + + + diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8c912d0..d5406b6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -493,19 +493,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// - public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) + public override void AddNewClient(IClientAPI client, bool child) { - remoteClient.OnRegionHandShakeReply += this.SendLayerData; + client.OnRegionHandShakeReply += this.SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); - remoteClient.OnChatFromViewer += this.SimChat; - remoteClient.OnRequestWearables += this.InformClientOfNeighbours; - remoteClient.OnAddPrim += this.AddNewPrim; - remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; - remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; - remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; + client.OnChatFromViewer += this.SimChat; + client.OnRequestWearables += this.InformClientOfNeighbours; + client.OnAddPrim += this.AddNewPrim; + client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnRequestMapBlocks += this.RequestMapBlocks; + client.OnTeleportLocationRequest += this.RequestTeleportLocation; //remoteClient.OnObjectSelect += this.SelectPrim; - remoteClient.OnGrapUpdate += this.MoveObject; - remoteClient.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnGrapUpdate += this.MoveObject; + client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -513,19 +513,21 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); */ - + this.estateManager.sendRegionHandshake(client); + + CreateAndAddScenePresence(client); + return; + } + + protected void CreateAndAddScenePresence(IClientAPI client) + { ScenePresence newAvatar = null; - try - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(client, this, this.m_regInfo); OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); - //newAvatar.SendRegionHandshake(); - this.estateManager.sendRegionHandshake(remoteClient); - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.m_syncRoot) { @@ -534,36 +536,29 @@ namespace OpenSim.Region.Environment.Scenes lock (Entities) { - if (!Entities.ContainsKey(agentID)) + if (!Entities.ContainsKey(client.AgentId)) { - this.Entities.Add(agentID, newAvatar); + this.Entities.Add(client.AgentId, newAvatar); } else { - Entities[agentID] = newAvatar; + Entities[client.AgentId] = newAvatar; } } lock (Avatars) { - if (Avatars.ContainsKey(agentID)) + if (Avatars.ContainsKey(client.AgentId)) { - Avatars[agentID] = newAvatar; + Avatars[client.AgentId] = newAvatar; } else { - this.Avatars.Add(agentID, newAvatar); + this.Avatars.Add(client.AgentId, newAvatar); } } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); - } - return; } - /// /// /// @@ -642,8 +637,8 @@ namespace OpenSim.Region.Environment.Scenes this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); if (this.regionCommsHost != null) { - this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); - this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); + this.regionCommsHost.OnExpectUser += this.NewUserConnection; + this.regionCommsHost.OnAvatarCrossingIntoRegion += this.AgentCrossing; } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 50d3b82..e06acbd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public abstract void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child); + public abstract void AddNewClient(IClientAPI client, bool child); /// /// diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 89f39d3..fe1fc16 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -44,7 +44,7 @@ namespace SimpleApp #region IWorld Members - override public void AddNewClient(IClientAPI client, LLUUID agentID, bool child) + override public void AddNewClient(IClientAPI client, bool child) { LLVector3 pos = new LLVector3(128, 128, 128); @@ -59,7 +59,13 @@ namespace SimpleApp }; client.OnRequestWearables += SendWearables; - + client.OnAddPrim += AddNewPrim; + client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnRequestMapBlocks += this.RequestMapBlocks; + client.OnTeleportLocationRequest += this.RequestTeleportLocation; + client.OnGrapUpdate += this.MoveObject; + client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnCompleteMovementToRegion += delegate() { client.MoveAgentIntoRegion(m_regionInfo, pos, LLVector3.Zero ); @@ -76,7 +82,7 @@ namespace SimpleApp client.SendRegionHandshake(m_regionInfo); - OpenSim.Region.Environment.Scenes.ScenePresence avatar = new Avatar( client, this, m_regionInfo ); + CreateAndAddScenePresence(client); } @@ -85,12 +91,6 @@ namespace SimpleApp client.SendWearables( AvatarWearable.DefaultWearables ); } - - override public void RemoveClient(LLUUID agentID) - { - - } - public RegionInfo RegionInfo { get { return m_regionInfo; } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 4060d68..0d5b4b3 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -14,6 +14,7 @@ using OpenSim.Region.Caches; using OpenSim.Framework.Communications; using OpenSim.Region.Communications.Local; using OpenSim.Region.ClientStack; +using OpenSim.Region.Physics.BasicPhysicsPlugin; namespace SimpleApp { @@ -32,11 +33,7 @@ namespace SimpleApp string simAddr = "127.0.0.1"; int simPort = 9000; - /* - LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false ); - loginServer.Startup(); - loginServer.SetSessionHandler( AddNewSessionHandler );*/ - + m_circuitManager = new AuthenticateSessionsBase(); InventoryCache inventoryCache = new InventoryCache(); @@ -53,18 +50,17 @@ namespace SimpleApp ClientView.TerrainManager = new TerrainManager(new SecondLife()); - CommunicationsManager communicationsManager = new CommunicationsLocal(null); + NetworkServersInfo serverInfo = new NetworkServersInfo(); + CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo); + + RegionInfo regionInfo = new RegionInfo( 1000, 1000, simAddr, simPort, simAddr ); - RegionInfo regionInfo = new RegionInfo( ); BaseHttpServer httpServer = new BaseHttpServer(simPort); - udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer ); - - // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo); - // PhysicsScene physicsScene = new NullPhysicsScene(); - // world.PhysicsScene = physicsScene; - // udpServer.LocalWorld = world; + MyWorld world = new MyWorld(packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); + world.PhysScene = new BasicScene(); + udpServer.LocalWorld = world; - // httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); + httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod ); httpServer.Start(); m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 0a82172..d39d091 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -104,6 +104,12 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False + + OpenSim.Framework.UserManagement + {586E2916-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} @@ -134,6 +140,18 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False + + OpenSim.Region.Physics.BasicPhysicsPlugin + {15B4FEF3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Physics.Manager + {F4FF31EB-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build index f8896fa..db44992 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -25,11 +25,14 @@ + + + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 716fd57..147158c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,6 +93,9 @@ Code + + Code + Code @@ -102,9 +105,6 @@ Code - - Code - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build index 112ff1c..fc9f055 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -12,10 +12,10 @@ + - -- cgit v1.1 From 06a8c132005b4ab804f25d54c0c0f899fc98e3a1 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 16:07:41 +0000 Subject: MAJOR IP RESTRUCTURING * moving towards IPEndPoints all over the place * trying to make the internal/external division --- OpenSim/Region/Application/OpenSimMain.cs | 2 +- OpenSim/Region/Capabilities/Caps.cs | 17 ++++++++++------- OpenSim/Region/ClientStack/ClientView.API.cs | 18 +++++++++++------- OpenSim/Region/ClientStack/PacketServer.cs | 4 +--- OpenSim/Region/ClientStack/UDPServer.cs | 2 +- .../Region/Communications/Local/LocalUserServices.cs | 6 +++--- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 18 ++++++++++++++---- OpenSim/Region/Environment/Scenes/Scene.cs | 6 +++--- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 16 ++++++++-------- 10 files changed, 53 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index fcb2493..32faed8 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -225,7 +225,7 @@ namespace OpenSim regionDat.InitConfig(this.m_sandbox, regionConfig); regionConfig.Close(); - udpServer = new UDPServer(regionDat.CommsIPListenPort, this.AssetCache, this.InventoryCache, this.m_log, authenBase); + udpServer = new UDPServer(regionDat.InternalEndPoint.Port, this.AssetCache, this.InventoryCache, this.m_log, authenBase); m_udpServer.Add(udpServer); this.regionData.Add(regionDat); diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 416a6bc..2bbf656 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -44,8 +44,8 @@ namespace OpenSim.Region.Capabilities public class Caps { - private string httpListenerAddress; - private uint httpListenPort; + private string httpListenerHostName; + private int httpListenPort; private string capsObjectPath = "00001-"; private string requestPath = "0000/"; private string mapLayerPath = "0001/"; @@ -58,12 +58,12 @@ namespace OpenSim.Region.Capabilities private int eventQueueCount = 1; private Queue CapsEventQueue = new Queue(); - public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) + public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) { assetCache = assetCach; capsObjectPath = capsPath; httpListener = httpServer; - httpListenerAddress = httpListen; + httpListenerHostName = httpListen; httpListenPort = httpPort; agentID = agent; } @@ -109,8 +109,11 @@ namespace OpenSim.Region.Capabilities return capURLS;*/ LLSDCapsDetails caps = new LLSDCapsDetails(); - caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; - caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; + string capsBaseUrl = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath; + + caps.MapLayer = capsBaseUrl + mapLayerPath; + caps.NewFileAgentInventory = capsBaseUrl + newInventory; + return caps; } @@ -206,7 +209,7 @@ namespace OpenSim.Region.Capabilities string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); - string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; + string uploaderURL = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; //Console.WriteLine("uploader url is " + uploaderURL); res += ""; res += "uploader" + uploaderURL + ""; diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 9650b42..e683db2 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -34,6 +34,7 @@ using OpenSim.Framework.Types; using libsecondlife; using libsecondlife.Packets; +using System.Net; namespace OpenSim.Region.ClientStack { @@ -293,8 +294,11 @@ namespace OpenSim.Region.ClientStack /// /// /// - public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) + public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint ) { + System.Net.IPAddress neighbourIP = neighbourEndPoint.Address; + ushort neighbourPort = (ushort) neighbourEndPoint.Port; + EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); enablesimpacket.SimulatorInfo.Handle = neighbourHandle; @@ -326,7 +330,7 @@ namespace OpenSim.Region.ClientStack return agentData; } - public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort) + public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint) { LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); @@ -339,12 +343,12 @@ namespace OpenSim.Region.ClientStack newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! newSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); newSimPack.RegionData.RegionHandle = newRegionHandle; - byte[] byteIP = newRegionIP.GetAddressBytes(); + byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; newSimPack.RegionData.SimIP += (uint)byteIP[0]; - newSimPack.RegionData.SimPort = newRegionPort; + newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; newSimPack.RegionData.SeedCapability = new byte[0]; this.OutPacket(newSimPack); @@ -386,7 +390,7 @@ namespace OpenSim.Region.ClientStack OutPacket(tpLocal); } - public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags) + public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags) { TeleportFinishPacket teleport = new TeleportFinishPacket(); teleport.Info.AgentID = this.AgentID; @@ -394,7 +398,7 @@ namespace OpenSim.Region.ClientStack teleport.Info.SimAccess = simAccess; teleport.Info.SeedCapability = new byte[0]; - System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress); + IPAddress oIP = newRegionEndPoint.Address; byte[] byteIP = oIP.GetAddressBytes(); uint ip = (uint)byteIP[3] << 24; ip += (uint)byteIP[2] << 16; @@ -402,7 +406,7 @@ namespace OpenSim.Region.ClientStack ip += (uint)byteIP[0]; teleport.Info.SimIP = ip; - teleport.Info.SimPort = ipPort; + teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; teleport.Info.LocationID = 4; teleport.Info.TeleportFlags = 1 << 4; OutPacket(teleport); diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index ffd254e..6f20413 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -44,12 +44,10 @@ namespace OpenSim.Region.ClientStack private IWorld _localWorld; public Dictionary ClientThreads = new Dictionary(); public Dictionary ClientAPIs = new Dictionary(); - protected uint serverPort; - public PacketServer(ClientStackNetworkHandler networkHandler, uint port) + public PacketServer(ClientStackNetworkHandler networkHandler) { _networkHandler = networkHandler; - this.serverPort = port; _networkHandler.RegisterPacketServer(this); } diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index b764519..8ad5332 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.ClientStack protected virtual void CreatePacketServer() { - PacketServer packetServer = new PacketServer(this, (uint) listenPort); + PacketServer packetServer = new PacketServer(this); } protected virtual void OnReceivedData(IAsyncResult result) diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 5a2a5c8..db9d9b9 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -88,11 +88,11 @@ namespace OpenSim.Region.Communications.Local "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; string capsPath = Util.GetRandomCapsPath(); - response.SimAddress = reg.CommsExternalAddress; - response.SimPort = (Int32)reg.CommsIPListenPort; + response.SimAddress = reg.ExternalEndPoint.Address.ToString(); + response.SimPort = (Int32)reg.ExternalEndPoint.Port; response.RegionX = reg.RegionLocX ; response.RegionY = reg.RegionLocY ; - response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/"; + response.SeedCapability = "http://" + reg.ExternalHostName + ":" + reg.ExternalEndPoint.Port.ToString() + "/CAPS/" + capsPath + "0000/"; theUser.currentAgent.currentRegion = reg.SimUUID; theUser.currentAgent.currentHandle = reg.RegionHandle; diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 2ac7297..977b131 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -13,6 +13,7 @@ using OpenSim.Framework.Communications; using Nwc.XmlRpc; using libsecondlife; +using System.Net; namespace OpenSim.Region.Communications.OGS1 { @@ -32,13 +33,15 @@ namespace OpenSim.Region.Communications.OGS1 // Login / Authentication GridParams["authkey"] = gridInfo.GridServerSendKey; GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); - GridParams["sim_ip"] = regionInfo.CommsExternalAddress; - GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString(); + GridParams["sim_ip"] = regionInfo.InternalEndPoint.Address.ToString(); + GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); // Package into an XMLRPC Request ArrayList SendParams = new ArrayList(); SendParams.Add(GridParams); + + // Send Request XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); @@ -56,7 +59,7 @@ namespace OpenSim.Region.Communications.OGS1 if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) { // initialised = true; - httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort); + httpListener = new BaseHttpServer( regionInfo.InternalEndPoint.Port ); httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); httpListener.Start(); } @@ -75,7 +78,14 @@ namespace OpenSim.Region.Communications.OGS1 foreach (Hashtable n in (Hashtable)respData.Values) { - RegionInfo neighbour = new RegionInfo( (uint)n["x"], (uint)n["y"], (string)n["sim_ip"], (int)n["sim_port"], (string)n["sim_uri"] ); + string internalIpStr = (string)n["sim_ip"]; + int port = (int)n["sim_port"]; + string externalUri = (string)n["sim_uri"]; + + IPEndPoint neighbourInternalEndPoint = new IPEndPoint( IPAddress.Parse( internalIpStr ), port); + string neighbourExternalUri = externalUri; + + RegionInfo neighbour = new RegionInfo((uint)n["x"], (uint)n["y"], neighbourInternalEndPoint, neighbourExternalUri ); //OGS1 //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d5406b6..dbf385d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -656,7 +656,7 @@ namespace OpenSim.Region.Environment.Scenes if (agent.CapsPath != "") { //Console.WriteLine("new user, so creating caps handler for it"); - Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.ExternalHostName, this.m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); cap.RegisterHandlers(); this.capsHandlers.Add(agent.AgentID, cap); } @@ -695,7 +695,7 @@ namespace OpenSim.Region.Environment.Scenes agent.startpos = new LLVector3(128, 128, 70); agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint ); //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); } } @@ -757,7 +757,7 @@ namespace OpenSim.Region.Environment.Scenes agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); - remoteClient.SendRegionTeleport(regionHandle, 13, reg.CommsIPListenAddr, (ushort)reg.CommsIPListenPort, 4, (1 << 4)); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); } //remoteClient.SendTeleportCancel(); } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b90004e..8a8f5ae 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -481,7 +481,7 @@ namespace OpenSim.Region.Environment.Scenes if (res) { this.MakeChildAgent(); - this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.CommsIPListenAddr), (ushort)neighbourRegion.CommsIPListenPort); + this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.InternalEndPoint ); } } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 0d5b4b3..f5c6999 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -15,6 +15,7 @@ using OpenSim.Framework.Communications; using OpenSim.Region.Communications.Local; using OpenSim.Region.ClientStack; using OpenSim.Region.Physics.BasicPhysicsPlugin; +using System.Net; namespace SimpleApp { @@ -31,9 +32,8 @@ namespace SimpleApp // CheckSumServer checksumServer = new CheckSumServer(12036); // checksumServer.ServerListener(); - string simAddr = "127.0.0.1"; - int simPort = 9000; - + IPEndPoint internalEndPoint = new IPEndPoint( IPAddress.Parse( "127.0.0.1" ), 9000 ); + m_circuitManager = new AuthenticateSessionsBase(); InventoryCache inventoryCache = new InventoryCache(); @@ -44,8 +44,8 @@ namespace SimpleApp AssetCache assetCache = new AssetCache(assetServer); - UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_log, m_circuitManager ); - PacketServer packetServer = new PacketServer( udpServer, (uint) simPort ); + UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager ); + PacketServer packetServer = new PacketServer(udpServer); udpServer.ServerListener(); ClientView.TerrainManager = new TerrainManager(new SecondLife()); @@ -53,9 +53,9 @@ namespace SimpleApp NetworkServersInfo serverInfo = new NetworkServersInfo(); CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo); - RegionInfo regionInfo = new RegionInfo( 1000, 1000, simAddr, simPort, simAddr ); - - BaseHttpServer httpServer = new BaseHttpServer(simPort); + RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "localhost" ); + + BaseHttpServer httpServer = new BaseHttpServer( internalEndPoint.Port ); MyWorld world = new MyWorld(packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); world.PhysScene = new BasicScene(); udpServer.LocalWorld = world; -- cgit v1.1 From 7cafe7f6d98ddd28af7c9272640c141732d455c8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 16:19:47 +0000 Subject: * now saves ExternalHostName in config --- OpenSim/Region/Application/OpenSimMain.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 32faed8..102ff76 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -230,12 +230,6 @@ namespace OpenSim m_udpServer.Add(udpServer); this.regionData.Add(regionDat); - /* - m_log.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); - m_log.Verbose( "Initialising world"); - m_log.componentname = "Region " + regionData.RegionName; - */ - LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager, this.AssetCache, httpServer); this.m_localWorld.Add(LocalWorld); //LocalWorld.InventoryCache = InventoryCache; -- cgit v1.1 From 9800c05c1b3c7804466d6f3a9c38a739156625fd Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 17:26:33 +0000 Subject: Started change to having SceneObject and then that having child Primitives which in turn have a Shape object (currently PrimitiveBaseShape). The plan is only for the SceneObject to interface with the physics engines. As a physics Entity should be able to have mulitple shapes connected to it. --- OpenSim/Region/ClientStack/ClientView.API.cs | 76 +++ .../ClientStack/ClientView.ProcessPackets.cs | 1 - .../Communications/Local/CommunicationsLocal.cs | 2 +- .../Communications/Local/LocalUserServices.cs | 13 +- .../Environment/OpenSim.Region.Environment.csproj | 6 + .../OpenSim.Region.Environment.dll.build | 2 + OpenSim/Region/Environment/Scenes/Entity.cs | 85 +-- OpenSim/Region/Environment/Scenes/EntityBase.cs | 133 +++++ OpenSim/Region/Environment/Scenes/Primitive.cs | 532 ++++--------------- OpenSim/Region/Environment/Scenes/PrimitiveOld.cs | 582 +++++++++++++++++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 16 +- OpenSim/Region/Environment/Scenes/Scene.cs | 131 ++--- OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Environment/Scenes/SceneEvents.cs | 4 +- OpenSim/Region/Environment/Scenes/SceneObject.cs | 80 ++- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 8 + 16 files changed, 1036 insertions(+), 637 deletions(-) create mode 100644 OpenSim/Region/Environment/Scenes/EntityBase.cs create mode 100644 OpenSim/Region/Environment/Scenes/PrimitiveOld.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index e683db2..5056f41 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -626,6 +626,39 @@ namespace OpenSim.Region.ClientStack OutPacket(outPacket); } + + public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID) + { + ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); + outPacket.RegionData.RegionHandle = regionHandle; + outPacket.RegionData.TimeDilation = timeDilation; + outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, textureID, flags); + outPacket.ObjectData[0].ID = localID; + outPacket.ObjectData[0].FullID = objectID; + outPacket.ObjectData[0].OwnerID = ownerID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); + byte[] rot = rotation.GetBytes(); + Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length); + OutPacket(outPacket); + } + + public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID) + { + ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); + outPacket.RegionData.RegionHandle = regionHandle; + outPacket.RegionData.TimeDilation = timeDilation; + outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, textureID, flags); + outPacket.ObjectData[0].ID = localID; + outPacket.ObjectData[0].FullID = objectID; + outPacket.ObjectData[0].OwnerID = ownerID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); + + OutPacket(outPacket); + } /// /// /// @@ -816,6 +849,22 @@ namespace OpenSim.Region.ClientStack } /// + /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) + /// + /// + /// + protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, LLUUID textureID, uint flags) + { + ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); + this.SetDefaultPrimPacketValues(objupdate); + objupdate.UpdateFlags = flags; + this.SetPrimPacketShapeData(objupdate, primShape, textureID); + + return objupdate; + } + + + /// /// Copy the data from a PrimData object to a ObjectUpdatePacket /// /// @@ -848,6 +897,33 @@ namespace OpenSim.Region.ClientStack objectData.PathTwistBegin = primData.PathTwistBegin; } + protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData, LLUUID textureID) + { + LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID); + objectData.TextureEntry = ntex.ToBytes(); + objectData.PCode = primData.PCode; + objectData.PathBegin = primData.PathBegin; + objectData.PathEnd = primData.PathEnd; + objectData.PathScaleX = primData.PathScaleX; + objectData.PathScaleY = primData.PathScaleY; + objectData.PathShearX = primData.PathShearX; + objectData.PathShearY = primData.PathShearY; + objectData.PathSkew = primData.PathSkew; + objectData.ProfileBegin = primData.ProfileBegin; + objectData.ProfileEnd = primData.ProfileEnd; + objectData.Scale = primData.Scale; + objectData.PathCurve = primData.PathCurve; + objectData.ProfileCurve = primData.ProfileCurve; + objectData.ParentID = primData.ParentID; + objectData.ProfileHollow = primData.ProfileHollow; + objectData.PathRadiusOffset = primData.PathRadiusOffset; + objectData.PathRevolutions = primData.PathRevolutions; + objectData.PathTaperX = primData.PathTaperX; + objectData.PathTaperY = primData.PathTaperY; + objectData.PathTwist = primData.PathTwist; + objectData.PathTwistBegin = primData.PathTwistBegin; + } + /// /// Set some default values in a ObjectUpdatePacket /// diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 794ce79..0d90968 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -211,7 +211,6 @@ namespace OpenSim.Region.ClientStack } break; case PacketType.ObjectAdd: - // m_world.AddNewPrim((ObjectAddPacket)Pack, this); if (OnAddPrim != null) { OnAddPrim(Pack, this); diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index bacaa3e..7c7c389 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Communications.Local public CommunicationsLocal(NetworkServersInfo serversInfo) : base(serversInfo) { - UserServices = new LocalUserServices(this,this.ServersInfo.DefaultHomeLocX,this.ServersInfo.DefaultHomeLocY); + UserServices = new LocalUserServices(this, serversInfo); UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); UserServer = UserServices; GridServer = SandBoxServices; diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index db9d9b9..b441a8d 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -18,13 +18,15 @@ namespace OpenSim.Region.Communications.Local { private CommunicationsLocal m_Parent; + private NetworkServersInfo serversInfo; private uint defaultHomeX ; private uint defaultHomeY; - public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) + public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData) { m_Parent = parent; - defaultHomeX = defHomeX; - defaultHomeY = defHomeY; + this.serversInfo = serversData; + defaultHomeX = this.serversInfo.DefaultHomeLocX; + defaultHomeY = this.serversInfo.DefaultHomeLocY; } public UserProfileData GetUserProfile(string firstName, string lastName) @@ -81,7 +83,6 @@ namespace OpenSim.Region.Communications.Local ulong currentRegion = theUser.currentAgent.currentHandle; RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); - if (reg != null) { response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + @@ -92,7 +93,9 @@ namespace OpenSim.Region.Communications.Local response.SimPort = (Int32)reg.ExternalEndPoint.Port; response.RegionX = reg.RegionLocX ; response.RegionY = reg.RegionLocY ; - response.SeedCapability = "http://" + reg.ExternalHostName + ":" + reg.ExternalEndPoint.Port.ToString() + "/CAPS/" + capsPath + "0000/"; + + //following port needs changing as we don't want a http listener for every region (or do we?) + response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; theUser.currentAgent.currentRegion = reg.SimUUID; theUser.currentAgent.currentHandle = reg.RegionHandle; diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 428f381..9e9405e 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -156,12 +156,18 @@ Code + + Code + Code Code + + Code + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index 2fa5e76..d4b163e 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -15,8 +15,10 @@ + + diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index db5070d..9603f7f 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -34,29 +34,14 @@ using libsecondlife; namespace OpenSim.Region.Environment.Scenes { - public abstract class Entity - { - public libsecondlife.LLUUID uuid; - public Quaternion rotation; - protected List children; - + public abstract class Entity :EntityBase //will be phased out + { protected PhysicsActor _physActor; - protected Scene m_world; - protected string m_name; /// /// /// - public virtual string Name - { - get { return m_name; } - } - - protected LLVector3 m_pos; - /// - /// - /// - public virtual LLVector3 Pos + public override LLVector3 Pos { get { @@ -91,12 +76,11 @@ namespace OpenSim.Region.Environment.Scenes } } - public LLVector3 velocity; - + /// /// /// - public virtual LLVector3 Velocity + public override LLVector3 Velocity { get { @@ -130,64 +114,5 @@ namespace OpenSim.Region.Environment.Scenes velocity = value; } } - - protected uint m_localId; - - public uint LocalId - { - get { return m_localId; } - } - - /// - /// Creates a new Entity (should not occur on it's own) - /// - public Entity() - { - uuid = new libsecondlife.LLUUID(); - - m_pos = new LLVector3(); - velocity = new LLVector3(); - rotation = new Quaternion(); - m_name = "(basic entity)"; - children = new List(); - } - - /// - /// - /// - public virtual void updateMovement() - { - foreach (Entity child in children) - { - child.updateMovement(); - } - } - - /// - /// Performs any updates that need to be done at each frame. This function is overridable from it's children. - /// - public virtual void update() { - // Do any per-frame updates needed that are applicable to every type of entity - foreach (Entity child in children) - { - child.update(); - } - } - - /// - /// Called at a set interval to inform entities that they should back themsleves up to the DB - /// - public virtual void BackUp() - { - - } - - /// - /// Infoms the entity that the land (heightmap) has changed - /// - public virtual void LandRenegerated() - { - - } } } diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs new file mode 100644 index 0000000..edd72c5 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Axiom.MathLib; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scenes +{ + public abstract class EntityBase + { + public libsecondlife.LLUUID uuid; + + protected List children; + + protected Scene m_world; + protected string m_name; + + /// + /// + /// + public virtual string Name + { + get { return m_name; } + } + + protected LLVector3 m_pos; + /// + /// + /// + public virtual LLVector3 Pos + { + get + { + return m_pos; + } + set + { + m_pos = value; + } + } + + public LLVector3 velocity; + + /// + /// + /// + public virtual LLVector3 Velocity + { + get + { + return velocity; + } + set + { + velocity = value; + } + } + + public Quaternion _rotation; + + public virtual Quaternion rotation + { + get + { + return _rotation; + } + set + { + _rotation = value; + } + } + + protected uint m_localId; + + public uint LocalId + { + get { return m_localId; } + } + + /// + /// Creates a new Entity (should not occur on it's own) + /// + public EntityBase() + { + uuid = new libsecondlife.LLUUID(); + + m_pos = new LLVector3(); + velocity = new LLVector3(); + rotation = new Quaternion(); + m_name = "(basic entity)"; + children = new List(); + } + + /// + /// + /// + public virtual void updateMovement() + { + foreach (EntityBase child in children) + { + child.updateMovement(); + } + } + + /// + /// Performs any updates that need to be done at each frame. This function is overridable from it's children. + /// + public virtual void update() + { + // Do any per-frame updates needed that are applicable to every type of entity + foreach (EntityBase child in children) + { + child.update(); + } + } + + /// + /// Called at a set interval to inform entities that they should back themsleves up to the DB + /// + public virtual void BackUp() + { + + } + + /// + /// Infoms the entity that the land (heightmap) has changed + /// + public virtual void LandRenegerated() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 0f649b2..497196d 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -1,31 +1,3 @@ - -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ using System; using System.Collections.Generic; using System.Text; @@ -38,175 +10,66 @@ using OpenSim.Framework.Inventory; namespace OpenSim.Region.Environment.Scenes { - public class Primitive : Entity + public class Primitive : EntityBase { - internal PrimData primData; + private const uint FULL_MASK_PERMISSIONS = 2147483647; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); - // private Dictionary m_clientThreads; private ulong m_regionHandle; - private const uint FULL_MASK_PERMISSIONS = 2147483647; - private bool physicsEnabled = false; private byte updateFlag = 0; private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; private Dictionary inventoryItems; - #region Properties + public LLUUID OwnerID; + public Int32 CreationDate; + public uint OwnerMask = FULL_MASK_PERMISSIONS; + public uint NextOwnerMask = FULL_MASK_PERMISSIONS; + public uint GroupMask = FULL_MASK_PERMISSIONS; + public uint EveryoneMask = FULL_MASK_PERMISSIONS; + public uint BaseMask = FULL_MASK_PERMISSIONS; - public LLVector3 Scale - { - set - { - this.primData.Scale = value; - //this.dirtyFlag = true; - } - get - { - return this.primData.Scale; - } - } + private PrimitiveBaseShape m_Shape; - public PhysicsActor PhysActor - { - set - { - this._physActor = value; - } - } + private SceneObject m_RootParent; + private bool isRootPrim; + private EntityBase m_Parent; public override LLVector3 Pos { get { - return base.Pos; + if (isRootPrim) + { + return this.m_pos + m_Parent.Pos; + } + else + { + return this.m_pos; + } } set { - base.Pos = value; + this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position } - } - #endregion - /// - /// - /// - /// - /// - /// - public Primitive( ulong regionHandle, Scene world) - { - // m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); } - /// - /// - /// - /// - /// - /// - /// - /// - public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject) { - // m_clientThreads = clientThreads; m_regionHandle = regionHandle; m_world = world; inventoryItems = new Dictionary(); + this.m_Parent = parent; + this.isRootPrim = isRoot; + this.m_RootParent = rootObject; this.CreateFromPacket(addPacket, ownerID, localID); } /// /// /// - /// - /// - /// - /// - /// - /// - public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID) - { - // m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - this.primData = new PrimData(); - this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - this.primData.OwnerID = owner; - this.primData.FullID = this.uuid = fullID; - this.primData.LocalID = m_localId = localID; - } - - /// - /// Constructor to create a default cube - /// - /// - /// - /// - /// - /// - /// - public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position) - { - //m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - this.primData = PrimData.DefaultCube(); - this.primData.OwnerID = owner; - this.primData.LocalID = m_localId = localID; - this.Pos = this.primData.Position = position; - - this.updateFlag = 1; - } - - /// - /// - /// - /// - public byte[] GetByteArray() - { - byte[] result = null; - List dataArrays = new List(); - dataArrays.Add(primData.ToBytes()); - foreach (Entity child in children) - { - if (child is OpenSim.Region.Environment.Scenes.Primitive) - { - dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray()); - } - } - byte[] primstart = Helpers.StringToField(""); - byte[] primend = Helpers.StringToField(""); - int totalLength = primstart.Length + primend.Length; - for (int i = 0; i < dataArrays.Count; i++) - { - totalLength += dataArrays[i].Length; - } - - result = new byte[totalLength]; - int arraypos = 0; - Array.Copy(primstart, 0, result, 0, primstart.Length); - arraypos += primstart.Length; - for (int i = 0; i < dataArrays.Count; i++) - { - Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); - arraypos += dataArrays[i].Length; - } - Array.Copy(primend, 0, result, arraypos, primend.Length); - - return result; - } - - #region Overridden Methods - - /// - /// - /// - public override void update() + public override void update() { if (this.updateFlag == 1) // is a new prim just been created/reloaded { @@ -218,112 +81,53 @@ namespace OpenSim.Region.Environment.Scenes this.SendTerseUpdateToALLClients(); this.updateFlag = 0; } - } - - /// - /// - /// - public override void BackUp() - { - } - - #endregion - - #region Packet handlers - - /// - /// - /// - /// - public void UpdatePosition(LLVector3 pos) - { - this.Pos = new LLVector3(pos.X, pos.Y, pos.Z); - this.updateFlag = 2; + base.update(); } /// /// /// /// - public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) - { - this.primData.PathBegin = updatePacket.PathBegin; - this.primData.PathEnd = updatePacket.PathEnd; - this.primData.PathScaleX = updatePacket.PathScaleX; - this.primData.PathScaleY = updatePacket.PathScaleY; - this.primData.PathShearX = updatePacket.PathShearX; - this.primData.PathShearY = updatePacket.PathShearY; - this.primData.PathSkew = updatePacket.PathSkew; - this.primData.ProfileBegin = updatePacket.ProfileBegin; - this.primData.ProfileEnd = updatePacket.ProfileEnd; - this.primData.PathCurve = updatePacket.PathCurve; - this.primData.ProfileCurve = updatePacket.ProfileCurve; - this.primData.ProfileHollow = updatePacket.ProfileHollow; - this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset; - this.primData.PathRevolutions = updatePacket.PathRevolutions; - this.primData.PathTaperX = updatePacket.PathTaperX; - this.primData.PathTaperY = updatePacket.PathTaperY; - this.primData.PathTwist = updatePacket.PathTwist; - this.primData.PathTwistBegin = updatePacket.PathTwistBegin; - } - - /// - /// - /// - /// - public void UpdateTexture(byte[] tex) - { - this.primData.TextureEntry = tex; - } - - /// - /// - /// - /// - public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) - { - - } - - /// - /// - /// - /// - public void AssignToParent(Primitive prim) - { - - } - - #endregion - - # region Inventory Methods - /// - /// - /// - /// - /// - public bool AddToInventory(InventoryItem item) + /// + /// + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) { - return false; - } + this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + this.OwnerID = ownerID; + this.Pos = addPacket.ObjectData.RayEnd; + this.uuid = LLUUID.Random(); + this.m_localId = (uint)(localID); + + PrimitiveBaseShape pShape = new PrimitiveBaseShape(); + this.m_Shape = pShape; + + pShape.PCode = addPacket.ObjectData.PCode; + pShape.PathBegin = addPacket.ObjectData.PathBegin; + pShape.PathEnd = addPacket.ObjectData.PathEnd; + pShape.PathScaleX = addPacket.ObjectData.PathScaleX; + pShape.PathScaleY = addPacket.ObjectData.PathScaleY; + pShape.PathShearX = addPacket.ObjectData.PathShearX; + pShape.PathShearY = addPacket.ObjectData.PathShearY; + pShape.PathSkew = addPacket.ObjectData.PathSkew; + pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin; + pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd; + pShape.Scale = addPacket.ObjectData.Scale; + pShape.PathCurve = addPacket.ObjectData.PathCurve; + pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve; + pShape.ParentID = 0; + pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow; + pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; + pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions; + pShape.PathTaperX = addPacket.ObjectData.PathTaperX; + pShape.PathTaperY = addPacket.ObjectData.PathTaperY; + pShape.PathTwist = addPacket.ObjectData.PathTwist; + pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; - /// - /// - /// - /// - /// - public InventoryItem RemoveFromInventory(LLUUID itemID) - { - return null; + this.updateFlag = 1; } - /// - /// - /// - /// - /// - public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) + public void AddToChildren(SceneObject linkObject) { } @@ -331,53 +135,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// - /// - public void RequestXferInventory(IClientAPI simClient, ulong xferID) - { - //will only currently work if the total size of the inventory data array is under about 1000 bytes - SendXferPacketPacket send = new SendXferPacketPacket(); - - send.XferID.ID = xferID; - send.XferID.Packet = 1 + 2147483648; - send.DataPacket.Data = this.ConvertInventoryToBytes(); - - simClient.OutPacket(send); - } - - /// - /// - /// - /// - public byte[] ConvertInventoryToBytes() + /// + public void UpdatePosition(LLVector3 pos) { - System.Text.Encoding enc = System.Text.Encoding.ASCII; - byte[] result = new byte[0]; - List inventoryData = new List(); - int totallength = 0; - foreach (InventoryItem invItem in inventoryItems.Values) + LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); + if (this.isRootPrim) { - byte[] data = enc.GetBytes(invItem.ExportString()); - inventoryData.Add(data); - totallength += data.Length; + this.m_Parent.Pos = newPos; } - //TODO: copy arrays into the single result array - - return result; - } - - /// - /// - /// - /// - public void CreateInventoryFromBytes(byte[] data) - { - + this.Pos = newPos; + this.updateFlag = 2; } - #endregion - - #region Update viewers Methods + #region Client Update Methods /// /// @@ -402,17 +172,9 @@ namespace OpenSim.Region.Environment.Scenes public void SendFullUpdateToClient(IClientAPI remoteClient) { LLVector3 lPos; - if (this._physActor != null && this.physicsEnabled) - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); - } - else - { - lPos = this.Pos; - } + lPos = this.Pos; - remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); + remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID); } /// @@ -430,22 +192,31 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// + public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) + { + this.SendTerseUpdateToClient(remoteClient); + for (int i = 0; i < this.children.Count; i++) + { + if (this.children[i] is Primitive) + { + ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient); + } + } + } + + /// + /// + /// /// public void SendTerseUpdateToClient(IClientAPI RemoteClient) { LLVector3 lPos; Axiom.MathLib.Quaternion lRot; - if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); - lRot = this._physActor.Orientation; - } - else - { - lPos = this.Pos; - lRot = this.rotation; - } + + lPos = this.Pos; + lRot = this.rotation; + LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); } @@ -463,120 +234,5 @@ namespace OpenSim.Region.Environment.Scenes } #endregion - - #region Create Methods - - /// - /// - /// - /// - /// - /// - public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) - { - PrimData PData = new PrimData(); - this.primData = PData; - this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - - PData.OwnerID = ownerID; - PData.PCode = addPacket.ObjectData.PCode; - PData.PathBegin = addPacket.ObjectData.PathBegin; - PData.PathEnd = addPacket.ObjectData.PathEnd; - PData.PathScaleX = addPacket.ObjectData.PathScaleX; - PData.PathScaleY = addPacket.ObjectData.PathScaleY; - PData.PathShearX = addPacket.ObjectData.PathShearX; - PData.PathShearY = addPacket.ObjectData.PathShearY; - PData.PathSkew = addPacket.ObjectData.PathSkew; - PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; - PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; - PData.Scale = addPacket.ObjectData.Scale; - PData.PathCurve = addPacket.ObjectData.PathCurve; - PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; - PData.ParentID = 0; - PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; - PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; - PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; - PData.PathTaperX = addPacket.ObjectData.PathTaperX; - PData.PathTaperY = addPacket.ObjectData.PathTaperY; - PData.PathTwist = addPacket.ObjectData.PathTwist; - PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; - LLVector3 pos1 = addPacket.ObjectData.RayEnd; - this.primData.FullID = this.uuid = LLUUID.Random(); - this.primData.LocalID = m_localId = (uint)(localID); - this.primData.Position = this.Pos = pos1; - - this.updateFlag = 1; - } - - /// - /// - /// - /// - public void CreateFromBytes(byte[] data) - { - - } - - /// - /// - /// - /// - public void CreateFromPrimData(PrimData primData) - { - this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); - } - - /// - /// - /// - /// - /// - /// - /// - public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) - { - - } - - public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) - { - // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z); - this.Pos = pos; - this.SendTerseUpdateToALLClients(); - } - - public void GetProperites(IClientAPI client) - { - //needs changing - ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate; - proper.ObjectData[0].CreatorID = primData.OwnerID; - proper.ObjectData[0].FolderID = LLUUID.Zero; - proper.ObjectData[0].FromTaskID = LLUUID.Zero; - proper.ObjectData[0].GroupID = LLUUID.Zero; - proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = LLUUID.Zero; - proper.ObjectData[0].ObjectID = this.uuid; - proper.ObjectData[0].OwnerID = primData.OwnerID; - proper.ObjectData[0].TouchName = new byte[0]; - proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[0]; - proper.ObjectData[0].OwnerMask = primData.OwnerMask; - proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask; - proper.ObjectData[0].GroupMask = primData.GroupMask; - proper.ObjectData[0].EveryoneMask = primData.EveryoneMask; - proper.ObjectData[0].BaseMask = primData.BaseMask; - - client.OutPacket(proper); - - } - - #endregion - } } diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs new file mode 100644 index 0000000..d703857 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs @@ -0,0 +1,582 @@ + +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; + +namespace OpenSim.Region.Environment.Scenes +{ + public class PrimitiveOld : Entity + { + internal PrimData primData; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + // private Dictionary m_clientThreads; + private ulong m_regionHandle; + private const uint FULL_MASK_PERMISSIONS = 2147483647; + private bool physicsEnabled = false; + private byte updateFlag = 0; + private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; + + private Dictionary inventoryItems; + + #region Properties + + public LLVector3 Scale + { + set + { + this.primData.Scale = value; + //this.dirtyFlag = true; + } + get + { + return this.primData.Scale; + } + } + + public PhysicsActor PhysActor + { + set + { + this._physActor = value; + } + } + + public override LLVector3 Pos + { + get + { + return base.Pos; + } + set + { + base.Pos = value; + } + } + #endregion + + /// + /// + /// + /// + /// + /// + public PrimitiveOld( ulong regionHandle, Scene world) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public PrimitiveOld(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.CreateFromPacket(addPacket, ownerID, localID); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public PrimitiveOld( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID) + { + // m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = new PrimData(); + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + this.primData.OwnerID = owner; + this.primData.FullID = this.uuid = fullID; + this.primData.LocalID = m_localId = localID; + } + + /// + /// Constructor to create a default cube + /// + /// + /// + /// + /// + /// + /// + public PrimitiveOld( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position) + { + //m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = PrimData.DefaultCube(); + this.primData.OwnerID = owner; + this.primData.LocalID = m_localId = localID; + this.Pos = this.primData.Position = position; + + this.updateFlag = 1; + } + + /// + /// + /// + /// + public byte[] GetByteArray() + { + byte[] result = null; + List dataArrays = new List(); + dataArrays.Add(primData.ToBytes()); + foreach (Entity child in children) + { + if (child is OpenSim.Region.Environment.Scenes.PrimitiveOld) + { + dataArrays.Add(((OpenSim.Region.Environment.Scenes.PrimitiveOld)child).GetByteArray()); + } + } + byte[] primstart = Helpers.StringToField(""); + byte[] primend = Helpers.StringToField(""); + int totalLength = primstart.Length + primend.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + totalLength += dataArrays[i].Length; + } + + result = new byte[totalLength]; + int arraypos = 0; + Array.Copy(primstart, 0, result, 0, primstart.Length); + arraypos += primstart.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); + arraypos += dataArrays[i].Length; + } + Array.Copy(primend, 0, result, arraypos, primend.Length); + + return result; + } + + #region Overridden Methods + + /// + /// + /// + public override void update() + { + if (this.updateFlag == 1) // is a new prim just been created/reloaded + { + this.SendFullUpdateToAllClients(); + this.updateFlag = 0; + } + if (this.updateFlag == 2) //some change has been made so update the clients + { + this.SendTerseUpdateToALLClients(); + this.updateFlag = 0; + } + } + + /// + /// + /// + public override void BackUp() + { + + } + + #endregion + + #region Packet handlers + + /// + /// + /// + /// + public void UpdatePosition(LLVector3 pos) + { + this.Pos = new LLVector3(pos.X, pos.Y, pos.Z); + this.updateFlag = 2; + } + + /// + /// + /// + /// + public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) + { + this.primData.PathBegin = updatePacket.PathBegin; + this.primData.PathEnd = updatePacket.PathEnd; + this.primData.PathScaleX = updatePacket.PathScaleX; + this.primData.PathScaleY = updatePacket.PathScaleY; + this.primData.PathShearX = updatePacket.PathShearX; + this.primData.PathShearY = updatePacket.PathShearY; + this.primData.PathSkew = updatePacket.PathSkew; + this.primData.ProfileBegin = updatePacket.ProfileBegin; + this.primData.ProfileEnd = updatePacket.ProfileEnd; + this.primData.PathCurve = updatePacket.PathCurve; + this.primData.ProfileCurve = updatePacket.ProfileCurve; + this.primData.ProfileHollow = updatePacket.ProfileHollow; + this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset; + this.primData.PathRevolutions = updatePacket.PathRevolutions; + this.primData.PathTaperX = updatePacket.PathTaperX; + this.primData.PathTaperY = updatePacket.PathTaperY; + this.primData.PathTwist = updatePacket.PathTwist; + this.primData.PathTwistBegin = updatePacket.PathTwistBegin; + } + + /// + /// + /// + /// + public void UpdateTexture(byte[] tex) + { + this.primData.TextureEntry = tex; + } + + /// + /// + /// + /// + public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) + { + + } + + /// + /// + /// + /// + public void AssignToParent(PrimitiveOld prim) + { + + } + + #endregion + + # region Inventory Methods + /// + /// + /// + /// + /// + public bool AddToInventory(InventoryItem item) + { + return false; + } + + /// + /// + /// + /// + /// + public InventoryItem RemoveFromInventory(LLUUID itemID) + { + return null; + } + + /// + /// + /// + /// + /// + public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) + { + + } + + /// + /// + /// + /// + /// + public void RequestXferInventory(IClientAPI simClient, ulong xferID) + { + //will only currently work if the total size of the inventory data array is under about 1000 bytes + SendXferPacketPacket send = new SendXferPacketPacket(); + + send.XferID.ID = xferID; + send.XferID.Packet = 1 + 2147483648; + send.DataPacket.Data = this.ConvertInventoryToBytes(); + + simClient.OutPacket(send); + } + + /// + /// + /// + /// + public byte[] ConvertInventoryToBytes() + { + System.Text.Encoding enc = System.Text.Encoding.ASCII; + byte[] result = new byte[0]; + List inventoryData = new List(); + int totallength = 0; + foreach (InventoryItem invItem in inventoryItems.Values) + { + byte[] data = enc.GetBytes(invItem.ExportString()); + inventoryData.Add(data); + totallength += data.Length; + } + //TODO: copy arrays into the single result array + + return result; + } + + /// + /// + /// + /// + public void CreateInventoryFromBytes(byte[] data) + { + + } + + #endregion + + #region Update viewers Methods + + /// + /// + /// + /// + public void SendFullUpdateForAllChildren(IClientAPI remoteClient) + { + this.SendFullUpdateToClient(remoteClient); + for (int i = 0; i < this.children.Count; i++) + { + if (this.children[i] is PrimitiveOld) + { + ((PrimitiveOld)this.children[i]).SendFullUpdateForAllChildren(remoteClient); + } + } + } + + /// + /// + /// + /// + public void SendFullUpdateToClient(IClientAPI remoteClient) + { + LLVector3 lPos; + if (this._physActor != null && this.physicsEnabled) + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + } + else + { + lPos = this.Pos; + } + + remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); + } + + /// + /// + /// + public void SendFullUpdateToAllClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendFullUpdateToClient(avatars[i].ControllingClient); + } + } + + /// + /// + /// + /// + public void SendTerseUpdateToClient(IClientAPI RemoteClient) + { + LLVector3 lPos; + Axiom.MathLib.Quaternion lRot; + if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + lRot = this._physActor.Orientation; + } + else + { + lPos = this.Pos; + lRot = this.rotation; + } + LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); + RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); + } + + /// + /// + /// + public void SendTerseUpdateToALLClients() + { + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + this.SendTerseUpdateToClient(avatars[i].ControllingClient); + } + } + + #endregion + + #region Create Methods + + /// + /// + /// + /// + /// + /// + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + PrimData PData = new PrimData(); + this.primData = PData; + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + + PData.OwnerID = ownerID; + PData.PCode = addPacket.ObjectData.PCode; + PData.PathBegin = addPacket.ObjectData.PathBegin; + PData.PathEnd = addPacket.ObjectData.PathEnd; + PData.PathScaleX = addPacket.ObjectData.PathScaleX; + PData.PathScaleY = addPacket.ObjectData.PathScaleY; + PData.PathShearX = addPacket.ObjectData.PathShearX; + PData.PathShearY = addPacket.ObjectData.PathShearY; + PData.PathSkew = addPacket.ObjectData.PathSkew; + PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; + PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; + PData.Scale = addPacket.ObjectData.Scale; + PData.PathCurve = addPacket.ObjectData.PathCurve; + PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; + PData.ParentID = 0; + PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; + PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; + PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; + PData.PathTaperX = addPacket.ObjectData.PathTaperX; + PData.PathTaperY = addPacket.ObjectData.PathTaperY; + PData.PathTwist = addPacket.ObjectData.PathTwist; + PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; + LLVector3 pos1 = addPacket.ObjectData.RayEnd; + this.primData.FullID = this.uuid = LLUUID.Random(); + this.primData.LocalID = m_localId = (uint)(localID); + this.primData.Position = this.Pos = pos1; + + this.updateFlag = 1; + } + + /// + /// + /// + /// + public void CreateFromBytes(byte[] data) + { + + } + + /// + /// + /// + /// + public void CreateFromPrimData(PrimData primData) + { + this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); + } + + /// + /// + /// + /// + /// + /// + /// + public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) + { + + } + + public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) + { + // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z); + this.Pos = pos; + this.SendTerseUpdateToALLClients(); + } + + public void GetProperites(IClientAPI client) + { + //needs changing + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; + proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); + proper.ObjectData[0].ItemID = LLUUID.Zero; + proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate; + proper.ObjectData[0].CreatorID = primData.OwnerID; + proper.ObjectData[0].FolderID = LLUUID.Zero; + proper.ObjectData[0].FromTaskID = LLUUID.Zero; + proper.ObjectData[0].GroupID = LLUUID.Zero; + proper.ObjectData[0].InventorySerial = 0; + proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].ObjectID = this.uuid; + proper.ObjectData[0].OwnerID = primData.OwnerID; + proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TextureID = new byte[0]; + proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].Name = new byte[0]; + proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].OwnerMask = primData.OwnerMask; + proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask; + proper.ObjectData[0].GroupMask = primData.GroupMask; + proper.ObjectData[0].EveryoneMask = primData.EveryoneMask; + proper.ObjectData[0].BaseMask = primData.BaseMask; + + client.OutPacket(proper); + + } + + #endregion + + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 1d55c4d..f3d461a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -214,12 +214,16 @@ namespace OpenSim.Region.Environment.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) + Console.WriteLine("prim selected :" + primLocalID); + foreach (EntityBase ent in Entities.Values) { - if (ent.LocalId == primLocalID) + if (ent is SceneObject) { - ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient); - break; + if (((SceneObject)ent).rootLocalID == primLocalID) + { + ((OpenSim.Region.Environment.Scenes.SceneObject)ent).GetProperites(remoteClient); + break; + } } } } @@ -228,7 +232,7 @@ namespace OpenSim.Region.Environment.Scenes { if (this.Entities.ContainsKey(objectID)) { - ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); + ((PrimitiveOld)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); } } @@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes { if (ent.LocalId == localID) { - ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos); + ((OpenSim.Region.Environment.Scenes.PrimitiveOld)ent).UpdatePosition(pos); break; } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index dbf385d..2ff3976 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -63,12 +63,12 @@ namespace OpenSim.Region.Environment.Scenes private uint _primCount = 702000; private int storageCount; private Mutex updateLock; - + protected AuthenticateSessionsBase authenticateHandler; protected RegionCommsListener regionCommsHost; protected CommunicationsManager commsManager; - protected Dictionary capsHandlers = new Dictionary(); + protected Dictionary capsHandlers = new Dictionary(); protected BaseHttpServer httpListener; public ParcelManager parcelManager; @@ -121,21 +121,21 @@ namespace OpenSim.Region.Environment.Scenes scriptManager = new ScriptManager(this); eventManager = new EventManager(); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); - Entities = new Dictionary(); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); + Entities = new Dictionary(); Avatars = new Dictionary(); Prims = new Dictionary(); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); ScenePresence.LoadAnims(); this.httpListener = httpServer; - + } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); + OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); } } #endregion @@ -218,49 +218,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool Backup() { - /* - try - { - // Terrain backup routines - if (Terrain.tainted > 0) - { - Terrain.tainted = 0; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); - localStorage.SaveMap(Terrain.getHeights1D()); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); - lock (this.m_syncRoot) - { - phyScene.SetTerrain(Terrain.getHeights1D()); - } - } - - // Primitive backup routines - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].BackUp(); - } - - //Parcel backup routines - ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; - int i = 0; - foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) - { - parcels[i] = parcel.parcelData; - i++; - } - localStorage.SaveParcels(parcels); - - // Backup successful - return true; - } - catch (Exception e) - { - // Backup failed - OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); - return false; - } - */ + return true; } #endregion @@ -432,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes { try { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); this.localStorage.LoadPrimitives(this); } catch (Exception e) @@ -469,13 +427,12 @@ namespace OpenSim.Region.Environment.Scenes { try { - Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); - - this.Entities.Add(prim.uuid, prim); + SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount); + this.Entities.Add(sceneOb.rootUUID, sceneOb); this._primCount++; // Trigger event for listeners - eventManager.TriggerOnNewPrimitive(prim); + // eventManager.TriggerOnNewPrimitive(prim); } catch (Exception e) { @@ -500,11 +457,11 @@ namespace OpenSim.Region.Environment.Scenes client.OnChatFromViewer += this.SimChat; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; - client.OnUpdatePrimPosition += this.UpdatePrimPosition; + //client.OnUpdatePrimPosition += this.UpdatePrimPosition; client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; - //remoteClient.OnObjectSelect += this.SelectPrim; - client.OnGrapUpdate += this.MoveObject; + client.OnObjectSelect += this.SelectPrim; + // client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); @@ -523,39 +480,39 @@ namespace OpenSim.Region.Environment.Scenes { ScenePresence newAvatar = null; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new ScenePresence(client, this, this.m_regInfo); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(client, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); - lock (this.m_syncRoot) + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + lock (this.m_syncRoot) + { + newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + } + + lock (Entities) + { + if (!Entities.ContainsKey(client.AgentId)) { - newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + this.Entities.Add(client.AgentId, newAvatar); } - - lock (Entities) + else { - if (!Entities.ContainsKey(client.AgentId)) - { - this.Entities.Add(client.AgentId, newAvatar); - } - else - { - Entities[client.AgentId] = newAvatar; - } + Entities[client.AgentId] = newAvatar; } - lock (Avatars) + } + lock (Avatars) + { + if (Avatars.ContainsKey(client.AgentId)) { - if (Avatars.ContainsKey(client.AgentId)) - { - Avatars[client.AgentId] = newAvatar; - } - else - { - this.Avatars.Add(client.AgentId, newAvatar); - } + Avatars[client.AgentId] = newAvatar; } + else + { + this.Avatars.Add(client.AgentId, newAvatar); + } + } } @@ -634,7 +591,7 @@ namespace OpenSim.Region.Environment.Scenes public void RegisterRegionWithComms() { GridInfo gridSettings = new GridInfo(); - this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings); if (this.regionCommsHost != null) { this.regionCommsHost.OnExpectUser += this.NewUserConnection; @@ -757,7 +714,9 @@ namespace OpenSim.Region.Environment.Scenes agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); + } //remoteClient.SendTeleportCancel(); } @@ -771,7 +730,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) { - return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); + return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); } #endregion diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index e06acbd..00ab194 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes { public abstract class SceneBase : IWorld { - public Dictionary Entities; + public Dictionary Entities; protected Dictionary m_clientThreads; protected ulong m_regionHandle; protected string m_regionName; diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index fa1bacb..ac887c0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Scenes public delegate void OnNewPresenceDelegate(ScenePresence presence); public event OnNewPresenceDelegate OnNewPresence; - public delegate void OnNewPrimitiveDelegate(Primitive prim); + public delegate void OnNewPrimitiveDelegate(PrimitiveOld prim); public event OnNewPrimitiveDelegate OnNewPrimitive; public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); @@ -29,7 +29,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public void TriggerOnNewPrimitive(Primitive prim) + public void TriggerOnNewPrimitive(PrimitiveOld prim) { if (OnNewPrimitive != null) OnNewPrimitive(prim); diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 88fb160..a228638 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -37,22 +37,46 @@ using OpenSim.Framework.Inventory; namespace OpenSim.Region.Environment.Scenes { - public class SceneObject : Entity + public class SceneObject : EntityBase { - private LLUUID rootUUID; - //private Dictionary ChildPrimitives = new Dictionary(); + + private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group protected Primitive rootPrimitive; private Scene m_world; - protected ulong regionHandle; + protected ulong m_regionHandle; + private bool physicsEnabled = false; + private PhysicsScene m_PhysScene; + private PhysicsActor m_PhysActor; + + public LLUUID rootUUID + { + get + { + this.uuid = this.rootPrimitive.uuid; + return this.uuid; + } + } + + public uint rootLocalID + { + get + { + this.m_localId = this.rootPrimitive.LocalId; + return this.LocalId; + } + } /// /// /// - public SceneObject() + public SceneObject(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) { + m_regionHandle = regionHandle; + m_world = world; + this.Pos = addPacket.ObjectData.RayEnd; + this.CreateFromPacket(addPacket, ownerID, localID); } - /// /// /// @@ -61,7 +85,9 @@ namespace OpenSim.Region.Environment.Scenes /// public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) { - this.rootPrimitive = new Primitive( this.regionHandle, this.m_world, addPacket, agentID, localID); + this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, addPacket, agentID, localID, true, this, this); + this.children.Add(rootPrimitive); + this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); } /// @@ -76,11 +102,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public override void update() + /// + /// + public Primitive HasChildPrim(LLUUID primID) { + if (this.ChildPrimitives.ContainsKey(primID)) + { + return this.ChildPrimitives[primID]; + } + return null; } + /// /// /// @@ -92,6 +126,18 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// + /// + /// + public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) + { + this.Pos = pos; + this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); + } + + /// + /// + /// /// public void GetProperites(IClientAPI client) { @@ -100,25 +146,25 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate; - proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID; + proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate; + proper.ObjectData[0].CreatorID = this.rootPrimitive.OwnerID; proper.ObjectData[0].FolderID = LLUUID.Zero; proper.ObjectData[0].FromTaskID = LLUUID.Zero; proper.ObjectData[0].GroupID = LLUUID.Zero; proper.ObjectData[0].InventorySerial = 0; proper.ObjectData[0].LastOwnerID = LLUUID.Zero; - proper.ObjectData[0].ObjectID = this.uuid; - proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID; + proper.ObjectData[0].ObjectID = this.rootUUID; + proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; proper.ObjectData[0].TouchName = new byte[0]; proper.ObjectData[0].TextureID = new byte[0]; proper.ObjectData[0].SitName = new byte[0]; proper.ObjectData[0].Name = new byte[0]; proper.ObjectData[0].Description = new byte[0]; - proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask; - proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask; - proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask; - proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask; - proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask; + proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; + proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; + proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; + proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask; + proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask; client.OutPacket(proper); diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 6366fb8..502d8e6 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -31,8 +31,16 @@ using System.Text; namespace OpenSim.Physics.Manager { + public delegate void PositionUpdate(PhysicsVector position); + public delegate void VelocityUpdate(PhysicsVector velocity); + public delegate void OrientationUpdate(Axiom.MathLib.Quaternion orientation); + public abstract class PhysicsActor { + public event PositionUpdate OnPositionUpdate; + public event VelocityUpdate OnVelocityUpdate; + public event OrientationUpdate OnOrientationUpdate; + public static PhysicsActor Null { get -- cgit v1.1 From 54ef77f0fda5fabc6f4677e145fafb74d225a77e Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 18:33:44 +0000 Subject: Can change the name and description of a prim. --- OpenSim/Region/ClientStack/ClientView.API.cs | 2 + .../ClientStack/ClientView.ProcessPackets.cs | 29 ++++++++++++-- OpenSim/Region/ClientStack/ClientView.cs | 1 + OpenSim/Region/Environment/Scenes/Entity.cs | 2 +- OpenSim/Region/Environment/Scenes/EntityBase.cs | 1 + OpenSim/Region/Environment/Scenes/Primitive.cs | 13 +++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 45 +++++++++++++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 6 ++- OpenSim/Region/Environment/Scenes/SceneObject.cs | 20 ++++++++-- 9 files changed, 109 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 5056f41..7a9c6cf 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -58,6 +58,8 @@ namespace OpenSim.Region.ClientStack public event GenericCall4 OnAddPrim; public event UpdateShape OnUpdatePrimShape; public event ObjectSelect OnObjectSelect; + public event GenericCall7 OnObjectDescription; + public event GenericCall7 OnObjectName; public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimTexture OnUpdatePrimTexture; public event UpdateVector OnUpdatePrimPosition; diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 0d90968..75d3f65 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack { if (OnModifyTerrain != null) { - OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, + OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); } } @@ -167,8 +167,8 @@ namespace OpenSim.Region.ClientStack case PacketType.AgentUpdate: if (OnAgentUpdate != null) { - AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; - OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation ); + AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; + OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); } break; case PacketType.AgentAnimation: @@ -274,6 +274,29 @@ namespace OpenSim.Region.ClientStack OnDeGrapObject(deGrap.ObjectData.LocalID, this); } break; + case PacketType.ObjectDescription: + ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; + for (int i = 0; i < objDes.ObjectData.Length; i++) + { + if (OnObjectDescription != null) + { + OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); + } + } + break; + case PacketType.ObjectName: + ObjectNamePacket objName = (ObjectNamePacket)Pack; + for (int i = 0; i < objName.ObjectData.Length; i++) + { + if (OnObjectName != null) + { + OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name)); + } + } + break; + case PacketType.ObjectPermissions: + //Console.WriteLine("permissions set " + Pack.ToString()); + break; #endregion #region Inventory/Asset/Other related packets diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 402a3ca..a36eeb0 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -79,6 +79,7 @@ namespace OpenSim.Region.ClientStack private int cachedtextureserial = 0; private RegionInfo m_regionData; protected AuthenticateSessionsBase m_authenticateSessionsHandler; + private System.Text.Encoding enc = System.Text.Encoding.ASCII; public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) { diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index 9603f7f..6db57a4 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -34,7 +34,7 @@ using libsecondlife; namespace OpenSim.Region.Environment.Scenes { - public abstract class Entity :EntityBase //will be phased out + public abstract class Entity :EntityBase //this class (Entity) will be phased out { protected PhysicsActor _physActor; diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index edd72c5..63f3f5d 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes public virtual string Name { get { return m_name; } + set { m_name = value; } } protected LLVector3 m_pos; diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 497196d..97e7974 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes private Dictionary inventoryItems; + private string description = ""; public LLUUID OwnerID; public Int32 CreationDate; public uint OwnerMask = FULL_MASK_PERMISSIONS; @@ -55,6 +56,18 @@ namespace OpenSim.Region.Environment.Scenes } + public string Description + { + get + { + return this.description; + } + set + { + this.description = value; + } + } + public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject) { m_regionHandle = regionHandle; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index f3d461a..f55c118 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -214,7 +214,6 @@ namespace OpenSim.Region.Environment.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - Console.WriteLine("prim selected :" + primLocalID); foreach (EntityBase ent in Entities.Values) { if (ent is SceneObject) @@ -228,6 +227,50 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// + /// + public void PrimDescription(uint primLocalID, string description) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(primLocalID); + if (prim != null) + { + prim.Description = description; + break; + } + } + } + } + + /// + /// + /// + /// + /// + public void PrimName(uint primLocalID, string name) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(primLocalID); + if (prim != null) + { + prim.Name = name; + break; + } + } + } + } + public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { if (this.Entities.ContainsKey(objectID)) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2ff3976..08adc84 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Scenes { protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); protected Dictionary Avatars; - protected Dictionary Prims; + protected Dictionary Prims; private PhysicsScene phyScene; private float timeStep = 0.1f; private Random Rand = new Random(); @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); Entities = new Dictionary(); Avatars = new Dictionary(); - Prims = new Dictionary(); + Prims = new Dictionary(); OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); @@ -463,6 +463,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectSelect += this.SelectPrim; // client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnObjectDescription += this.PrimDescription; + client.OnObjectName += this.PrimName; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index a228638..00df447 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -39,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes { public class SceneObject : EntityBase { - + private System.Text.Encoding enc = System.Text.Encoding.ASCII; private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group protected Primitive rootPrimitive; private Scene m_world; @@ -114,6 +114,19 @@ namespace OpenSim.Region.Environment.Scenes return null; } + public Primitive HasChildPrim(uint localID) + { + Primitive returnPrim = null; + foreach (Primitive prim in this.children) + { + if (prim.LocalId == localID) + { + returnPrim = prim; + break; + } + } + return returnPrim; + } /// /// @@ -141,6 +154,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GetProperites(IClientAPI client) { + //needs changing ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; @@ -158,8 +172,8 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0].TouchName = new byte[0]; proper.ObjectData[0].TextureID = new byte[0]; proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0"); + proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0"); proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; -- cgit v1.1 From 2852cda727f86567c18c6fab193ed31195c9934c Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 21:04:33 +0000 Subject: More work on SceneObject/Primitive and building (Linking is a work in progress as is all). Committing now as I've finished for the night and will be continued tomorrow. --- OpenSim/Region/ClientStack/ClientView.API.cs | 11 +++-- OpenSim/Region/Environment/Scenes/Primitive.cs | 53 +++++++++++++++++++--- .../Environment/Scenes/Scene.PacketHandlers.cs | 40 +++++++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 18 +++++++- OpenSim/Region/Environment/Scenes/SceneObject.cs | 21 +++++++-- 5 files changed, 125 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 7a9c6cf..51f02da 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -629,7 +629,7 @@ namespace OpenSim.Region.ClientStack } - public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID) + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); outPacket.RegionData.RegionHandle = regionHandle; @@ -639,6 +639,8 @@ namespace OpenSim.Region.ClientStack outPacket.ObjectData[0].ID = localID; outPacket.ObjectData[0].FullID = objectID; outPacket.ObjectData[0].OwnerID = ownerID; + outPacket.ObjectData[0].Text = enc.GetBytes(text); + outPacket.ObjectData[0].ParentID = parentID; byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); byte[] rot = rotation.GetBytes(); @@ -646,7 +648,7 @@ namespace OpenSim.Region.ClientStack OutPacket(outPacket); } - public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID) + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); outPacket.RegionData.RegionHandle = regionHandle; @@ -656,6 +658,8 @@ namespace OpenSim.Region.ClientStack outPacket.ObjectData[0].ID = localID; outPacket.ObjectData[0].FullID = objectID; outPacket.ObjectData[0].OwnerID = ownerID; + outPacket.ObjectData[0].Text = enc.GetBytes(text); + outPacket.ObjectData[0].ParentID = parentID; byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); @@ -876,6 +880,7 @@ namespace OpenSim.Region.ClientStack LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID); objectData.TextureEntry = ntex.ToBytes(); objectData.OwnerID = primData.OwnerID; + objectData.ParentID = primData.ParentID; objectData.PCode = primData.PCode; objectData.PathBegin = primData.PathBegin; objectData.PathEnd = primData.PathEnd; @@ -889,7 +894,6 @@ namespace OpenSim.Region.ClientStack objectData.Scale = primData.Scale; objectData.PathCurve = primData.PathCurve; objectData.ProfileCurve = primData.ProfileCurve; - objectData.ParentID = primData.ParentID; objectData.ProfileHollow = primData.ProfileHollow; objectData.PathRadiusOffset = primData.PathRadiusOffset; objectData.PathRevolutions = primData.PathRevolutions; @@ -916,7 +920,6 @@ namespace OpenSim.Region.ClientStack objectData.Scale = primData.Scale; objectData.PathCurve = primData.PathCurve; objectData.ProfileCurve = primData.ProfileCurve; - objectData.ParentID = primData.ParentID; objectData.ProfileHollow = primData.ProfileHollow; objectData.PathRadiusOffset = primData.PathRadiusOffset; objectData.PathRevolutions = primData.PathRevolutions; diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 97e7974..dd8bb02 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -22,8 +22,18 @@ namespace OpenSim.Region.Environment.Scenes private Dictionary inventoryItems; private string description = ""; + + public string SitName = ""; + public string TouchName = ""; + public string Text = ""; + + public LLUUID CreatorID; public LLUUID OwnerID; + public LLUUID LastOwnerID; public Int32 CreationDate; + + public uint ParentID = 0; + public uint OwnerMask = FULL_MASK_PERMISSIONS; public uint NextOwnerMask = FULL_MASK_PERMISSIONS; public uint GroupMask = FULL_MASK_PERMISSIONS; @@ -32,9 +42,9 @@ namespace OpenSim.Region.Environment.Scenes private PrimitiveBaseShape m_Shape; - private SceneObject m_RootParent; - private bool isRootPrim; - private EntityBase m_Parent; + public SceneObject m_RootParent; + public bool isRootPrim; + public EntityBase m_Parent; public override LLVector3 Pos { @@ -51,7 +61,7 @@ namespace OpenSim.Region.Environment.Scenes } set { - this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position + this.m_pos = m_Parent.Pos - value; //should we being subtracting the parent position } } @@ -108,6 +118,8 @@ namespace OpenSim.Region.Environment.Scenes { this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; this.OwnerID = ownerID; + this.CreatorID = this.OwnerID; + this.LastOwnerID = LLUUID.Zero; this.Pos = addPacket.ObjectData.RayEnd; this.uuid = LLUUID.Random(); this.m_localId = (uint)(localID); @@ -128,7 +140,6 @@ namespace OpenSim.Region.Environment.Scenes pShape.Scale = addPacket.ObjectData.Scale; pShape.PathCurve = addPacket.ObjectData.PathCurve; pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve; - pShape.ParentID = 0; pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow; pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions; @@ -142,7 +153,37 @@ namespace OpenSim.Region.Environment.Scenes public void AddToChildren(SceneObject linkObject) { + // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); + //TODO check permissions + this.children.Add(linkObject.rootPrimitive); + linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); + + this.m_world.DeleteEntity(linkObject.rootUUID); + linkObject.rootPrimitive = null; + } + + public void SetNewParent(Primitive newParent, SceneObject rootParent) + { + LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); + //Console.WriteLine("have a new parent and my old position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); + this.isRootPrim = false; + this.m_Parent = newParent; + this.ParentID = newParent.LocalId; + this.SetRootParent(rootParent); + // Console.WriteLine("have a new parent and its position is " + this.m_Parent.Pos.X + " , " + this.m_Parent.Pos.Y + " , " + this.m_Parent.Pos.Z); + this.Pos = oldPos; + // Console.WriteLine("have a new parent so my new offset position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); + this.updateFlag = 1; + + } + public void SetRootParent(SceneObject newRoot) + { + this.m_RootParent = newRoot; + foreach (Primitive child in children) + { + child.SetRootParent(newRoot); + } } /// @@ -187,7 +228,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 lPos; lPos = this.Pos; - remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID); + remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID); } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index f55c118..d8533b0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -193,8 +193,41 @@ namespace OpenSim.Region.Environment.Scenes /// public void LinkObjects(uint parentPrim, List childPrims) { - + SceneObject parenPrim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + if (((SceneObject)ent).rootLocalID == parentPrim) + { + parenPrim = (SceneObject)ent; + break; + } + } + } + List children = new List(); + if (parenPrim != null) + { + for (int i = 0; i < childPrims.Count; i++) + { + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + if (((SceneObject)ent).rootLocalID == childPrims[i]) + { + children.Add((SceneObject)ent); + } + } + } + } + } + + foreach (SceneObject sceneObj in children) + { + parenPrim.AddNewChildPrims(sceneObj); + } } /// @@ -275,7 +308,10 @@ namespace OpenSim.Region.Environment.Scenes { if (this.Entities.ContainsKey(objectID)) { - ((PrimitiveOld)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); + if (this.Entities[objectID] is SceneObject) + { + ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); + } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 08adc84..77058cc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -461,10 +461,11 @@ namespace OpenSim.Region.Environment.Scenes client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; client.OnObjectSelect += this.SelectPrim; - // client.OnGrapUpdate += this.MoveObject; + client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; client.OnObjectDescription += this.PrimDescription; client.OnObjectName += this.PrimName; + client.OnLinkObjects += this.LinkObjects; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -585,6 +586,21 @@ namespace OpenSim.Region.Environment.Scenes #endregion + /// + /// + /// + /// + /// + public bool DeleteEntity(LLUUID entID) + { + if (this.Entities.ContainsKey(entID)) + { + this.Entities.Remove(entID); + return true; + } + return false; + } + #region RegionCommsHost /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 00df447..2c55a7d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes { private System.Text.Encoding enc = System.Text.Encoding.ASCII; private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group - protected Primitive rootPrimitive; + public Primitive rootPrimitive; private Scene m_world; protected ulong m_regionHandle; @@ -99,6 +99,16 @@ namespace OpenSim.Region.Environment.Scenes } + + /// + /// + /// + /// + public void AddNewChildPrims(SceneObject primObject) + { + this.rootPrimitive.AddToChildren(primObject); + } + /// /// /// @@ -145,6 +155,7 @@ namespace OpenSim.Region.Environment.Scenes public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { this.Pos = pos; + this.rootPrimitive.Pos = pos; this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); } @@ -161,17 +172,17 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); proper.ObjectData[0].ItemID = LLUUID.Zero; proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate; - proper.ObjectData[0].CreatorID = this.rootPrimitive.OwnerID; + proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID; proper.ObjectData[0].FolderID = LLUUID.Zero; proper.ObjectData[0].FromTaskID = LLUUID.Zero; proper.ObjectData[0].GroupID = LLUUID.Zero; proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID; proper.ObjectData[0].ObjectID = this.rootUUID; proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; - proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0"); proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName +"\0") ; proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0"); proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0"); proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; -- cgit v1.1 From 2d34caabb9e3c346602566f7724c5e21014ed4ed Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 21:16:45 +0000 Subject: * removed try-catchall from scene constructor * added reference server-side addnewprim prototype to Scene - not implementet yet though. --- OpenSim/Region/Environment/Scenes/Scene.cs | 76 +++++++++++++------------- OpenSim/Region/Environment/Scenes/SceneBase.cs | 4 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 3 + OpenSim/Region/Examples/SimpleApp/Program.cs | 8 +++ 4 files changed, 52 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 77058cc..059bfd7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -103,40 +103,32 @@ namespace OpenSim.Region.Environment.Scenes /// Region Name for this region public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) { - try - { - updateLock = new Mutex(false); - this.authenticateHandler = authen; - this.commsManager = commsMan; - this.assetCache = assetCach; - m_clientThreads = clientThreads; - m_regInfo = regInfo; - m_regionHandle = m_regInfo.RegionHandle; - m_regionName = m_regInfo.RegionName; - this.m_datastore = m_regInfo.DataStore; - this.RegisterRegionWithComms(); - - parcelManager = new ParcelManager(this, this.m_regInfo); - estateManager = new EstateManager(this, this.m_regInfo); - scriptManager = new ScriptManager(this); - eventManager = new EventManager(); - - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); - Entities = new Dictionary(); - Avatars = new Dictionary(); - Prims = new Dictionary(); - - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); - Terrain = new TerrainEngine(); - - ScenePresence.LoadAnims(); - this.httpListener = httpServer; - - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); - } + updateLock = new Mutex(false); + this.authenticateHandler = authen; + this.commsManager = commsMan; + this.assetCache = assetCach; + m_clientThreads = clientThreads; + m_regInfo = regInfo; + m_regionHandle = m_regInfo.RegionHandle; + m_regionName = m_regInfo.RegionName; + this.m_datastore = m_regInfo.DataStore; + this.RegisterRegionWithComms(); + + parcelManager = new ParcelManager(this, this.m_regInfo); + estateManager = new EstateManager(this, this.m_regInfo); + scriptManager = new ScriptManager(this); + eventManager = new EventManager(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); + Entities = new Dictionary(); + Avatars = new Dictionary(); + Prims = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); + Terrain = new TerrainEngine(); + + ScenePresence.LoadAnims(); + this.httpListener = httpServer; } #endregion @@ -218,7 +210,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool Backup() { - + return true; } #endregion @@ -432,7 +424,7 @@ namespace OpenSim.Region.Environment.Scenes this._primCount++; // Trigger event for listeners - // eventManager.TriggerOnNewPrimitive(prim); + // eventManager.TriggerOnNewPrimitive(prim); } catch (Exception e) { @@ -440,6 +432,13 @@ namespace OpenSim.Region.Environment.Scenes } } + public override uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags) + { + uint id = NextLocalId; + + throw new NotImplementedException("Not implemented yet."); + } + #endregion #region Add/Remove Avatar Methods @@ -670,7 +669,7 @@ namespace OpenSim.Region.Environment.Scenes agent.startpos = new LLVector3(128, 128, 70); agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint ); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint); //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); } } @@ -733,7 +732,7 @@ namespace OpenSim.Region.Environment.Scenes this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); - remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); } //remoteClient.SendTeleportCancel(); @@ -752,5 +751,6 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 00ab194..817f206 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -149,7 +149,9 @@ namespace OpenSim.Region.Environment.Scenes /// /// public abstract void AddNewClient(IClientAPI client, bool child); - + + public abstract uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags); + /// /// /// diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index fe1fc16..3ba9c77 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -78,6 +78,9 @@ namespace SimpleApp pos, null); client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); + + + }; client.SendRegionHandshake(m_regionInfo); diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index f5c6999..8e9ad75 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -16,6 +16,7 @@ using OpenSim.Region.Communications.Local; using OpenSim.Region.ClientStack; using OpenSim.Region.Physics.BasicPhysicsPlugin; using System.Net; +using libsecondlife.Packets; namespace SimpleApp { @@ -23,6 +24,7 @@ namespace SimpleApp { private LogBase m_log; AuthenticateSessionsBase m_circuitManager; + uint m_localId; private void Run() { @@ -65,6 +67,12 @@ namespace SimpleApp m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); m_log.ReadLine(); + + PrimData primData = new PrimData(); + primData.Scale = new LLVector3(1, 1, 1); + + m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0); + } private bool AddNewSessionHandler(ulong regionHandle, Login loginData) -- cgit v1.1 From 7f18f494f1200f0f6470020a794e5291124f3ead Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 21:45:47 +0000 Subject: Just committing this because I want my commit to be on the front page of www.opensimulator.org rather than lbsa71's being there. --- OpenSim/Region/Environment/Scenes/Primitive.cs | 6 +++--- OpenSim/Region/Environment/Scenes/SceneObject.cs | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index dd8bb02..b8ec68b 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Scenes /// public override void update() { - if (this.updateFlag == 1) // is a new prim just been created/reloaded + if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes { this.SendFullUpdateToAllClients(); this.updateFlag = 0; @@ -151,7 +151,7 @@ namespace OpenSim.Region.Environment.Scenes this.updateFlag = 1; } - public void AddToChildren(SceneObject linkObject) + public void AddNewChildren(SceneObject linkObject) { // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); //TODO check permissions @@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); this.m_world.DeleteEntity(linkObject.rootUUID); - linkObject.rootPrimitive = null; + linkObject.DeleteAllChildren(); } public void SetNewParent(Primitive newParent, SceneObject rootParent) diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 2c55a7d..c03354e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes m_regionHandle = regionHandle; m_world = world; this.Pos = addPacket.ObjectData.RayEnd; - this.CreateFromPacket(addPacket, ownerID, localID); + this.CreateRootFromPacket(addPacket, ownerID, localID); } /// @@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) + public void CreateRootFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) { this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, addPacket, agentID, localID, true, this, this); this.children.Add(rootPrimitive); @@ -99,6 +99,15 @@ namespace OpenSim.Region.Environment.Scenes } + /// + /// + /// + public void DeleteAllChildren() + { + this.children.Clear(); + this.ChildPrimitives.Clear(); + this.rootPrimitive = null; + } /// /// @@ -106,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void AddNewChildPrims(SceneObject primObject) { - this.rootPrimitive.AddToChildren(primObject); + this.rootPrimitive.AddNewChildren(primObject); } /// -- cgit v1.1 From 686f6a83319eaccd27f426eda82c020246566963 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 2 Jul 2007 08:03:11 +0000 Subject: * Fixed Issue #161 by using PhysicsScene.Null instead of BasePhysicsScene * Hid NullPhysicsScene for great justice * Fixed broken Grid build --- OpenSim/Region/Examples/SimpleApp/Program.cs | 4 +- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 6 -- .../Region/Examples/SimpleApp/SimpleApp.exe.build | 1 - OpenSim/Region/Physics/Manager/PhysicsManager.cs | 2 +- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 74 +++++++++++----------- 5 files changed, 40 insertions(+), 47 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 8e9ad75..3d9dd0d 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -14,9 +14,9 @@ using OpenSim.Region.Caches; using OpenSim.Framework.Communications; using OpenSim.Region.Communications.Local; using OpenSim.Region.ClientStack; -using OpenSim.Region.Physics.BasicPhysicsPlugin; using System.Net; using libsecondlife.Packets; +using OpenSim.Physics.Manager; namespace SimpleApp { @@ -59,7 +59,7 @@ namespace SimpleApp BaseHttpServer httpServer = new BaseHttpServer( internalEndPoint.Port ); MyWorld world = new MyWorld(packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); - world.PhysScene = new BasicScene(); + world.PhysScene = PhysicsScene.Null; udpServer.LocalWorld = world; httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod ); diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index d39d091..bb8dcc0 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -140,12 +140,6 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False - - OpenSim.Region.Physics.BasicPhysicsPlugin - {15B4FEF3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build index db44992..aab0826 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -31,7 +31,6 @@ - diff --git a/OpenSim/Region/Physics/Manager/PhysicsManager.cs b/OpenSim/Region/Physics/Manager/PhysicsManager.cs index efccb36..0e28522 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsManager.cs @@ -51,7 +51,7 @@ namespace OpenSim.Physics.Manager { if (String.IsNullOrEmpty(engineName)) { - return new NullPhysicsScene(); + return PhysicsScene.Null; } if(_plugins.ContainsKey(engineName)) diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 0901c2f..3f22585 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -53,61 +53,61 @@ namespace OpenSim.Physics.Manager public abstract void GetResults(); public abstract void SetTerrain(float[] heightMap); - + public abstract void DeleteTerrain(); public abstract bool IsThreaded { get; } - } - public class NullPhysicsScene : PhysicsScene - { - private static int m_workIndicator; - - public override PhysicsActor AddAvatar(PhysicsVector position) + private class NullPhysicsScene : PhysicsScene { - OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); - return PhysicsActor.Null; - } + private static int m_workIndicator; - public override void RemoveAvatar(PhysicsActor actor) - { + public override PhysicsActor AddAvatar(PhysicsVector position) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); + return PhysicsActor.Null; + } - } + public override void RemoveAvatar(PhysicsActor actor) + { - public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "NullPhysicsScene : AddPrim({0},{1})", position, size); - return PhysicsActor.Null; - } + } - public override void Simulate(float timeStep) - { - m_workIndicator = (m_workIndicator + 1) % 10; + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); + return PhysicsActor.Null; + } - //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); - } + public override void Simulate(float timeStep) + { + m_workIndicator = (m_workIndicator + 1) % 10; - public override void GetResults() - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "NullPhysicsScene : GetResults()"); - } + //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); + } - public override void SetTerrain(float[] heightMap) - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); - } + public override void GetResults() + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : GetResults()"); + } - public override void DeleteTerrain() - { + public override void SetTerrain(float[] heightMap) + { + OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); + } - } + public override void DeleteTerrain() + { - public override bool IsThreaded - { - get { return false; } + } + + public override bool IsThreaded + { + get { return false; } + } } } } -- cgit v1.1 From c25a2fea59dc502519f81062c4122e96abd0f3c3 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 2 Jul 2007 15:45:09 +0000 Subject: * Added support for SL-style RAW export similar to the official simulators operation (low resolution) --- .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index c2d7e86..bf5e776 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -291,6 +291,10 @@ namespace OpenSim.Region.Terrain heightmap.saveImage(args[2]); break; + case "raw": + writeToFileRAW(args[2]); + break; + default: resultText = "Unknown image or data format"; return false; @@ -527,6 +531,70 @@ namespace OpenSim.Region.Terrain } /// + /// A very fast LL-RAW file output mechanism - lower precision mechanism but wont take 5 minutes to run either. + /// + /// Filename to write to + public void writeToFileRAW(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); + System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + + int x, y; + + // Used for the 'green' channel. + byte avgMultiplier = (byte)heightmap.avg(); + byte backupMultiplier = (byte)revertmap.avg(); + + // Limit the multiplier so it can represent points >64m. + if (avgMultiplier > 196) + avgMultiplier = 196; + if(backupMultiplier > 196) + backupMultiplier = 196; + // Make sure it's at least one to prevent a div by zero + if (avgMultiplier < 1) + avgMultiplier = 1; + if(backupMultiplier < 1) + backupMultiplier = 1; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + byte red = (byte)(heightmap.get(x, y) / ((double)avgMultiplier / 128.0)); + byte green = avgMultiplier; + byte blue = (byte)watermap.get(x, y); + byte alpha1 = 0; // Land Parcels + byte alpha2 = 0; // For Sale Land + byte alpha3 = 0; // Public Edit Object + byte alpha4 = 0; // Public Edit Land + byte alpha5 = 255; // Safe Land + byte alpha6 = 255; // Flying Allowed + byte alpha7 = 255; // Create Landmark + byte alpha8 = 255; // Outside Scripts + byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0)); + byte alpha10 = backupMultiplier; + + bs.Write(red); + bs.Write(green); + bs.Write(blue); + bs.Write(alpha1); + bs.Write(alpha2); + bs.Write(alpha3); + bs.Write(alpha4); + bs.Write(alpha5); + bs.Write(alpha6); + bs.Write(alpha7); + bs.Write(alpha8); + bs.Write(alpha9); + bs.Write(alpha10); + } + } + bs.Close(); + s.Close(); + } + + /// /// Sets the random seed to be used by procedural functions which involve random numbers. /// /// The desired seed -- cgit v1.1 From fcabdab7bc7466a8a56c0f034c56ca22124e8060 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 2 Jul 2007 16:03:58 +0000 Subject: * Started working on LlsdMethod for BaseHttpServer *Renamed IRestHandler.cs to RestMethod.cs which is the correct name. --- OpenSim/Region/Capabilities/LLSDType.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Region/Capabilities/LLSDType.cs index 7da5861..a2ae8df 100644 --- a/OpenSim/Region/Capabilities/LLSDType.cs +++ b/OpenSim/Region/Capabilities/LLSDType.cs @@ -34,7 +34,7 @@ namespace OpenSim.Region.Capabilities [AttributeUsage(AttributeTargets.Class)] public class LLSDType : Attribute { - private string myType; + protected string myType; public LLSDType(string type) { @@ -50,4 +50,12 @@ namespace OpenSim.Region.Capabilities } } } + + [AttributeUsage(AttributeTargets.Class)] + public class LLSDMap : LLSDType + { + public LLSDMap() : base( "MAP" ) + { + } + } } -- cgit v1.1 From 858e232cec35bab9681cd49945cd4ba31197dc8d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 2 Jul 2007 16:04:50 +0000 Subject: * Added "HiRAW" mode export for generating as precise outputs as possible in the .RAW format. Ideal for exporting a heightmap to a simulator only capable of reading the RAW format. If you are exporting between OpenSim regions, use F64 instead. --- .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 81 +++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index bf5e776..0ad60df 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -192,7 +192,7 @@ namespace OpenSim.Region.Terrain resultText += "terrain voronoi - generates a worley fractal with X points per block"; resultText += "terrain seed - sets the random seed value to \n"; resultText += "terrain load - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; - resultText += "terrain save - saves a terrain to disk, type can be 'F32', 'F64' or 'PNG'\n"; + resultText += "terrain save - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n"; resultText += "terrain save grdmap - creates a PNG snapshot of the region using a named gradient map\n"; resultText += "terrain rescale - rescales a terrain to be between and meters high\n"; resultText += "terrain erode aerobic \n"; @@ -295,6 +295,10 @@ namespace OpenSim.Region.Terrain writeToFileRAW(args[2]); break; + case "hiraw": + writeToFileHiRAW(args[2]); + break; + default: resultText = "Unknown image or data format"; return false; @@ -532,6 +536,7 @@ namespace OpenSim.Region.Terrain /// /// A very fast LL-RAW file output mechanism - lower precision mechanism but wont take 5 minutes to run either. + /// (is also editable in an image application) /// /// Filename to write to public void writeToFileRAW(string filename) @@ -595,6 +600,80 @@ namespace OpenSim.Region.Terrain } /// + /// Outputs to a LL compatible RAW in the most efficient manner possible + /// + /// Does not calculate the revert map + /// The filename to output to + public void writeToFileHiRAW(string filename) + { + System.IO.FileInfo file = new System.IO.FileInfo(filename); + System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); + System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + + // Generate a smegging big lookup table to speed the operation up (it needs it) + double[] lookupTable = new double[65536]; + int i, j, x, y; + for (i = 0; i < 256; i++) + { + for (j = 0; j < 256; j++) + { + lookupTable[i + (j * 256)] = ((double)i * ((double)j / 127.0)); + } + } + + // Output the calculated raw + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double t = heightmap.get(x, y); + double min = double.MaxValue; + int index = 0; + + for (i = 0; i < 65536; i++) + { + if (Math.Abs(t - lookupTable[i]) < min) + { + min = Math.Abs(t - lookupTable[i]); + index = i; + } + } + + byte red = (byte)(index & 0xFF); + byte green = (byte)((index >> 8) & 0xFF); + byte blue = (byte)watermap.get(x, y); + byte alpha1 = 0; // Land Parcels + byte alpha2 = 0; // For Sale Land + byte alpha3 = 0; // Public Edit Object + byte alpha4 = 0; // Public Edit Land + byte alpha5 = 255; // Safe Land + byte alpha6 = 255; // Flying Allowed + byte alpha7 = 255; // Create Landmark + byte alpha8 = 255; // Outside Scripts + byte alpha9 = red; + byte alpha10 = green; + + bs.Write(red); + bs.Write(green); + bs.Write(blue); + bs.Write(alpha1); + bs.Write(alpha2); + bs.Write(alpha3); + bs.Write(alpha4); + bs.Write(alpha5); + bs.Write(alpha6); + bs.Write(alpha7); + bs.Write(alpha8); + bs.Write(alpha9); + bs.Write(alpha10); + } + } + + bs.Close(); + s.Close(); + } + + /// /// Sets the random seed to be used by procedural functions which involve random numbers. /// /// The desired seed -- cgit v1.1 From d1d38f2edea6d4731fdae964a53f36fbfd9a708d Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 2 Jul 2007 17:48:34 +0000 Subject: Applied Darok's PhysicsVector ToString patch --- OpenSim/Region/Physics/Manager/PhysicsVector.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index 888dbb5..c60da9d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs @@ -50,5 +50,10 @@ namespace OpenSim.Physics.Manager } public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); + + public override string ToString() + { + return "<" + this.X + "," + this.Y + "," + this.Z + ">"; + } } } -- cgit v1.1 From 71f1b2d87803e4fb3a0fb5a12d1e9a2f4287b6fa Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 2 Jul 2007 20:44:39 +0000 Subject: * Added conceptual LlsdMethod Demo to SimpleApp (work in progress) --- OpenSim/Region/Examples/SimpleApp/Program.cs | 7 +++++++ OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 6 ++++++ OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build | 1 + 3 files changed, 14 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 3d9dd0d..2c5fb4d 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -17,6 +17,7 @@ using OpenSim.Region.ClientStack; using System.Net; using libsecondlife.Packets; using OpenSim.Physics.Manager; +using OpenSim.Region.Capabilities; namespace SimpleApp { @@ -63,6 +64,7 @@ namespace SimpleApp udpServer.LocalWorld = world; httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod ); + httpServer.AddLlsdMethod("/Caps/test/", LlsdMethodDemo); httpServer.Start(); m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); @@ -75,6 +77,11 @@ namespace SimpleApp } + private LLSDMapLayerResponse LlsdMethodDemo(LLSDMapRequest request) + { + return new LLSDMapLayerResponse(); + } + private bool AddNewSessionHandler(ulong regionHandle, Login loginData) { m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index bb8dcc0..3ed0efc 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -116,6 +116,12 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False + + OpenSim.Region.Capabilities + {39038E85-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + OpenSim.Region.ClientStack {DC3698B2-0000-0000-0000-000000000000} diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build index aab0826..0c6234a 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -27,6 +27,7 @@ + -- cgit v1.1 From 67af17fdd185e4a70046ac3583d3c64e6c3c8fb9 Mon Sep 17 00:00:00 2001 From: mingchen Date: Mon, 2 Jul 2007 21:02:11 +0000 Subject: *OGS1 Key2Name/Name2Key works *OGS1 doesnt crash on startup anymore --- .../Region/Communications/OGS1/OGS1UserServices.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 856c447..6d428d0 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -35,10 +35,10 @@ namespace OpenSim.Region.Communications.OGS1 userData.userAssetURI = (string)data["server_asset"]; userData.profileFirstText = (string)data["profile_firstlife_about"]; userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); - userData.profileCanDoMask = (uint)data["profile_can_do"]; - userData.profileWantDoMask = (uint)data["profile_want_do"]; + userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); + userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); userData.profileImage = new LLUUID((string)data["profile_image"]); - userData.lastLogin = (int)data["profile_lastlogin"]; + userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); userData.homeLocation = new LLVector3(); userData.homeLookAt = new LLVector3(); @@ -51,8 +51,8 @@ namespace OpenSim.Region.Communications.OGS1 public UserProfileData GetUserProfile(string name) { - try - { + //try + //{ Hashtable param = new Hashtable(); param["avatar_name"] = name; IList parameters = new ArrayList(); @@ -62,12 +62,12 @@ namespace OpenSim.Region.Communications.OGS1 Hashtable respData = (Hashtable)resp.Value; return ConvertXMLRPCDataToUserProfile(respData); - } - catch (Exception e) - { - Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); - } - return null; + //} + //catch (Exception e) + //{ + // Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); + //} + //return null; } public UserProfileData GetUserProfile(LLUUID avatarID) { -- cgit v1.1 From 96dfb33bca20c44202a9c0dd6393d78fec53416f Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 2 Jul 2007 23:42:38 +0000 Subject: Attempted workaround for Mono's insistence on compiling BasicTerrain incorrectly --- OpenSim/Region/Environment/ParcelManager.cs | 4 +-- .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 30 ++++++++-------------- 2 files changed, 13 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 1cab4ab..3afbe6e 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -682,8 +682,8 @@ namespace OpenSim.Region.Environment } } } - parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); - parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); + parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.get((min_x * 4), (min_y * 4))); + parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.get((max_x * 4), (max_y * 4))); parcelData.area = tempArea; } diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 0ad60df..8bd09e3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -815,6 +815,17 @@ namespace OpenSim.Region.Terrain } /// + /// Wrapper to heightmap.get() + /// + /// X coord + /// Y coord + /// Height at specified coordinates + public double get(int x, int y) + { + return heightmap.get(x, y); + } + + /// /// Multiplies the heightfield by val /// /// The heightfield @@ -828,25 +839,6 @@ namespace OpenSim.Region.Terrain } /// - /// Returns the height at the coordinates x,y - /// - /// X Coordinate - /// Y Coordinate - /// - public float this[int x, int y] - { - get - { - return (float)heightmap.get(x, y); - } - set - { - tainted++; - heightmap.set(x, y, (double)value); - } - } - - /// /// Exports the current heightmap to a PNG file /// /// The destination filename for the image -- cgit v1.1 From 315a49e7fdec9b7612ecf2bd9efd756e9223d6d5 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 2 Jul 2007 23:52:18 +0000 Subject: You can now substitute %name% in the filename argument for terrain save & load commands to input the sims name. Useful for sugilite regions where you are running multiple sims in a single instance and need to get them to load or save in a pattern. (Needs cleaning & expansion) --- OpenSim/Region/Application/OpenSimMain.cs | 2 +- OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 102ff76..097d1cc 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -429,7 +429,7 @@ namespace OpenSim string result = ""; for (int i = 0; i < m_localWorld.Count; i++) { - if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result)) + if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result,m_localWorld[i].RegionInfo.RegionName)) { m_log.Error(result); } diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 8bd09e3..0f450c3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.Terrain /// Commandline arguments (space seperated) /// Reference that returns error or help text if returning false /// If the operation was successful (if not, the error is placed into resultText) - public bool RunTerrainCmd(string[] args, ref string resultText) + public bool RunTerrainCmd(string[] args, ref string resultText, string simName) { string command = args[0]; @@ -248,6 +248,7 @@ namespace OpenSim.Region.Terrain break; case "load": + args[2].Replace("%name%", simName); switch (args[1].ToLower()) { case "f32": @@ -273,6 +274,7 @@ namespace OpenSim.Region.Terrain break; case "save": + args[2].Replace("%name%", simName); switch (args[1].ToLower()) { case "f32": -- cgit v1.1 From 73a5ec391aa5600cb779044fbf335ce0537e9500 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 07:06:08 +0000 Subject: * Completed conceptual LlsdMethod - everything resides in SimpleApp pending guru approval. --- .../Region/Examples/SimpleApp/LlsdMethodEntry.cs | 44 ++++++++++++++++++++++ OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 25 ++---------- OpenSim/Region/Examples/SimpleApp/Program.cs | 20 +++++++++- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 3 ++ .../Region/Examples/SimpleApp/SimpleApp.exe.build | 1 + 5 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs new file mode 100644 index 0000000..c3d3d33 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Servers; +using OpenSim.Region.Capabilities; +using libsecondlife; +using System.Collections; + +namespace OpenSim.Framework.Servers +{ + public class LlsdMethodEntry : ILlsdMethodHandler + where TRequest : new() + { + private LlsdMethod m_method; + + + public LlsdMethodEntry( ) + { + + } + + public LlsdMethodEntry(LlsdMethod method) + { + m_method = method; + } + + #region ILlsdMethodHandler Members + + public string Handle(string body, string path) + { + Encoding _enc = System.Text.Encoding.UTF8; + Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes( body )); + TRequest request = new TRequest(); + + LLSDHelpers.DeserialiseLLSDMap(hash, request ); + + TResponse response = m_method(request); + + return LLSDHelpers.SerialiseLLSDReply( response ); + } + + #endregion + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 3ba9c77..8e6fd8f 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -17,13 +17,11 @@ namespace SimpleApp { public class MyWorld : Scene { - private RegionInfo m_regionInfo; private List m_avatars; public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) { - m_regionInfo = regionInfo; m_avatars = new List(); } @@ -68,12 +66,12 @@ namespace SimpleApp client.OnCompleteMovementToRegion += delegate() { - client.MoveAgentIntoRegion(m_regionInfo, pos, LLVector3.Zero ); + client.MoveAgentIntoRegion(m_regInfo, pos, LLVector3.Zero ); }; client.OnCompleteMovementToRegion += delegate() { - client.SendAvatarData(m_regionInfo.RegionHandle, client.FirstName, + client.SendAvatarData(m_regInfo.RegionHandle, client.FirstName, client.LastName, client.AgentId, 0, pos, null); @@ -83,7 +81,7 @@ namespace SimpleApp }; - client.SendRegionHandshake(m_regionInfo); + client.SendRegionHandshake(m_regInfo); CreateAndAddScenePresence(client); @@ -94,23 +92,6 @@ namespace SimpleApp client.SendWearables( AvatarWearable.DefaultWearables ); } - public RegionInfo RegionInfo - { - get { return m_regionInfo; } - } - - public object SyncRoot - { - get { return this; } - } - - private uint m_nextLocalId = 1; - - public uint NextLocalId - { - get { return m_nextLocalId++; } - } - #endregion } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 2c5fb4d..6bf6657 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -64,7 +64,9 @@ namespace SimpleApp udpServer.LocalWorld = world; httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod ); - httpServer.AddLlsdMethod("/Caps/test/", LlsdMethodDemo); + + RegisterLlsdHandler("/Caps/test/", LlsdMethodDemo); + httpServer.Start(); m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); @@ -81,7 +83,23 @@ namespace SimpleApp { return new LLSDMapLayerResponse(); } + + ILlsdMethodHandler m_handler; + private void RegisterLlsdHandler( string path, LlsdMethod method ) + where TRequest : new() + { + // path should be handler key, but for now just conceptually store it. + m_handler = new LlsdMethodEntry( method ); + } + + private string ProcessLlsdMethod( string request,string path ) + { + LlsdMethodEntry concreteHandler = new LlsdMethodEntry( LlsdMethodDemo ); + + return m_handler.Handle(request, path); + } + private bool AddNewSessionHandler(ulong regionHandle, Login loginData) { m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 3ed0efc..1e726b2 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -154,6 +154,9 @@ + + Code + Code diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build index 0c6234a..a826a37 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -11,6 +11,7 @@ + -- cgit v1.1 From 9b6b6d05d45cf0f754a0b26bf6240ef50be66563 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 14:37:29 +0000 Subject: * Optimized usings (the 'LL ate my scripts' commit) * added some licensing info --- OpenSim/Region/Application/Application.cs | 8 +-- OpenSim/Region/Application/OpenSimMain.cs | 52 ++++++---------- OpenSim/Region/Application/VersionInfo.cs | 2 - OpenSim/Region/Caches/AssetCache.cs | 17 +++--- OpenSim/Region/Caches/Properties/AssemblyInfo.cs | 2 - OpenSim/Region/Capabilities/Caps.cs | 11 ++-- OpenSim/Region/Capabilities/LLSDArray.cs | 3 - OpenSim/Region/Capabilities/LLSDCapEvent.cs | 4 -- OpenSim/Region/Capabilities/LLSDCapsDetails.cs | 4 -- OpenSim/Region/Capabilities/LLSDEmpty.cs | 4 -- OpenSim/Region/Capabilities/LLSDHelpers.cs | 9 ++- OpenSim/Region/Capabilities/LLSDMapLayer.cs | 4 -- .../Region/Capabilities/LLSDMapLayerResponse.cs | 4 -- OpenSim/Region/Capabilities/LLSDMapRequest.cs | 4 -- OpenSim/Region/Capabilities/LLSDTest.cs | 4 -- OpenSim/Region/Capabilities/LLSDType.cs | 2 - OpenSim/Region/Capabilities/LLSDUploadReply.cs | 5 +- .../Region/ClientStack/Assets/InventoryCache.cs | 17 +++--- .../ClientStack/ClientStackNetworkHandler.cs | 6 -- OpenSim/Region/ClientStack/ClientView.API.cs | 44 +++++++------- .../ClientStack/ClientView.AgentAssetUpload.cs | 7 +-- .../ClientStack/ClientView.PacketHandlers.cs | 23 ++----- .../ClientStack/ClientView.ProcessPackets.cs | 16 ++--- OpenSim/Region/ClientStack/ClientView.cs | 30 +++++----- OpenSim/Region/ClientStack/ClientViewBase.cs | 23 ++++--- OpenSim/Region/ClientStack/PacketServer.cs | 8 +-- .../Region/ClientStack/RegionApplicationBase.cs | 23 ++----- OpenSim/Region/ClientStack/UDPServer.cs | 19 ++---- .../Communications/Local/CommunicationsLocal.cs | 9 +-- .../Communications/Local/LocalBackEndServices.cs | 6 +- .../Communications/Local/LocalUserServices.cs | 10 +--- .../Local/Properties/AssemblyInfo.cs | 2 - .../Communications/OGS1/CommunicationsOGS1.cs | 6 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 26 ++++---- .../Communications/OGS1/OGS1InterSimComms.cs | 11 ++-- .../Region/Communications/OGS1/OGS1UserServices.cs | 8 +-- .../Communications/OGS1/Properties/AssemblyInfo.cs | 2 - OpenSim/Region/Environment/EstateManager.cs | 33 +++++----- OpenSim/Region/Environment/ParcelManager.cs | 13 ++-- OpenSim/Region/Environment/RegionManager.cs | 8 +-- OpenSim/Region/Environment/Scenes/Entity.cs | 5 +- OpenSim/Region/Environment/Scenes/EntityBase.cs | 6 +- .../Environment/Scenes/IScenePresenceBody.cs | 5 -- OpenSim/Region/Environment/Scenes/Primitive.cs | 7 +-- OpenSim/Region/Environment/Scenes/PrimitiveOld.cs | 13 ++-- .../Environment/Scenes/Scene.PacketHandlers.cs | 8 +-- OpenSim/Region/Environment/Scenes/Scene.cs | 70 ++++++++++------------ OpenSim/Region/Environment/Scenes/SceneBase.cs | 17 ++---- OpenSim/Region/Environment/Scenes/SceneEvents.cs | 8 +-- OpenSim/Region/Environment/Scenes/SceneObject.cs | 5 +- .../Environment/Scenes/ScenePresence.Animations.cs | 6 +- .../Environment/Scenes/ScenePresence.Body.cs | 5 -- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 17 +++--- .../Scenes/scripting/Engines/CSharpScriptEngine.cs | 11 ++-- .../Scenes/scripting/Engines/JScriptEngine.cs | 11 ++-- .../Region/Environment/Scenes/scripting/Script.cs | 9 +-- .../Environment/Scenes/scripting/ScriptInfo.cs | 8 +-- .../Environment/Scenes/scripting/ScriptManager.cs | 14 ++--- .../Region/Examples/SimpleApp/LlsdMethodEntry.cs | 9 +-- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 16 ++--- OpenSim/Region/Examples/SimpleApp/Program.cs | 25 ++++---- .../Examples/SimpleApp/Properties/AssemblyInfo.cs | 2 - .../Region/GridInterfaces/Local/AssemblyInfo.cs | 2 - .../GridInterfaces/Local/LocalAssetServer.cs | 28 ++++----- .../Region/GridInterfaces/Remote/AssemblyInfo.cs | 2 - .../GridInterfaces/Remote/RemoteAssetServer.cs | 10 ++-- .../Physics/BasicPhysicsPlugin/AssemblyInfo.cs | 2 - .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 6 +- OpenSim/Region/Physics/Manager/AssemblyInfo.cs | 2 - OpenSim/Region/Physics/Manager/PhysicsActor.cs | 12 ++-- OpenSim/Region/Physics/Manager/PhysicsManager.cs | 8 +-- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 11 ++-- OpenSim/Region/Physics/Manager/PhysicsVector.cs | 4 -- OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs | 2 - OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 17 +++--- OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs | 2 - OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 9 +-- .../LocalStorageBerkeleyDB/BDBLocalStorage.cs | 9 +-- .../Storage/LocalStorageDb4o/AssemblyInfo.cs | 2 - .../Storage/LocalStorageDb4o/Db4LocalStorage.cs | 24 ++++---- .../Region/Storage/LocalStorageDb4o/MapStorage.cs | 4 -- .../Storage/LocalStorageDb4o/UUIDParcelQuery.cs | 5 -- .../Storage/LocalStorageDb4o/UUIDPrimQuery.cs | 5 -- .../LocalStorageSQLite/Properties/AssemblyInfo.cs | 2 - .../LocalStorageSQLite/SQLiteLocalStorage.cs | 14 ++--- .../Properties/AssemblyInfo.cs | 2 - .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 49 +++++++-------- .../Region/Terrain.BasicTerrain/TerrainFilter.cs | 8 +-- 88 files changed, 366 insertions(+), 641 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 1dcd99b..0428f5a 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -26,10 +26,8 @@ * */ using System; -using System.Collections.Generic; -using System.Text; using OpenSim.Framework.Console; -using OpenSim.Region.ClientStack; +using OpenSim.Region.Environment.Scenes; namespace OpenSim { @@ -109,13 +107,13 @@ namespace OpenSim sim.m_sandbox = sandBoxMode; sim.user_accounts = userAccounts; sim.gridLocalAsset = gridLocalAsset; - OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = allowFlying; + ScenePresence.PhysicsEngineFlying = allowFlying; sim.StartUp(); while (true) { - OpenSim.Framework.Console.MainLog.Instance.MainLogPrompt(); + MainLog.Instance.MainLogPrompt(); } } } diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 097d1cc..e976fe3 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -27,37 +27,23 @@ */ using System; -using System.Text; using System.IO; -using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Region.Environment; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Terrain; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Data; - -using OpenSim.Framework.Types; -using OpenSim.Framework; using OpenSim.Assets; -using OpenSim.Region.Caches; +using OpenSim.Framework; +using OpenSim.Framework.Communications; using OpenSim.Framework.Console; -using OpenSim.Physics.Manager; -using Nwc.XmlRpc; +using OpenSim.Framework.Data; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; using OpenSim.GenericConfig; -using OpenSim.Framework.Communications; -using OpenSim.Region.Communications.OGS1; -using OpenSim.Region.Communications.Local; - +using OpenSim.Physics.Manager; +using OpenSim.Region.Caches; using OpenSim.Region.ClientStack; +using OpenSim.Region.Communications.Local; +using OpenSim.Region.Communications.OGS1; +using OpenSim.Region.Environment.Scenes; namespace OpenSim { @@ -96,7 +82,7 @@ namespace OpenSim } m_log = new LogBase(m_logFilename, "Region", this, m_silent); - OpenSim.Framework.Console.MainLog.Instance = m_log; + MainLog.Instance = m_log; m_log.Verbose( "Main.cs:Startup() - Loading configuration"); this.serversData.InitConfig(this.m_sandbox, this.localConfig); @@ -121,7 +107,7 @@ namespace OpenSim startuptime = DateTime.Now; - this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); + this.physManager = new PhysicsManager(); this.physManager.LoadPlugins(); this.SetupHttpListener(); @@ -187,12 +173,12 @@ namespace OpenSim RegionInfo regionDat = new RegionInfo(); AuthenticateSessionsBase authenBase; - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); + string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); string[] configFiles = Directory.GetFiles(path, "*.xml"); if (configFiles.Length == 0) { - string path2 = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); + string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); string path3 = Path.Combine(path2, "default.xml"); Console.WriteLine("Creating default region config file"); //TODO create default region @@ -361,23 +347,23 @@ namespace OpenSim case "": this.m_physicsEngine = "basicphysics"; configData.SetAttribute("PhysicsEngine", "basicphysics"); - OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = false; + ScenePresence.PhysicsEngineFlying = false; break; case "basicphysics": this.m_physicsEngine = "basicphysics"; configData.SetAttribute("PhysicsEngine", "basicphysics"); - OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = false; + ScenePresence.PhysicsEngineFlying = false; break; case "RealPhysX": this.m_physicsEngine = "RealPhysX"; - OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = true; + ScenePresence.PhysicsEngineFlying = true; break; case "OpenDynamicsEngine": this.m_physicsEngine = "OpenDynamicsEngine"; - OpenSim.Region.Environment.Scenes.ScenePresence.PhysicsEngineFlying = true; + ScenePresence.PhysicsEngineFlying = true; break; } @@ -459,7 +445,7 @@ namespace OpenSim m_log.Error( "That is " + (DateTime.Now - startuptime).ToString()); break; case "users": - OpenSim.Region.Environment.Scenes.ScenePresence TempAv; + ScenePresence TempAv; m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); /* foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) { diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs index 5d1354e..2c720a3 100644 --- a/OpenSim/Region/Application/VersionInfo.cs +++ b/OpenSim/Region/Application/VersionInfo.cs @@ -25,8 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; - namespace OpenSim { /// diff --git a/OpenSim/Region/Caches/AssetCache.cs b/OpenSim/Region/Caches/AssetCache.cs index 6cf921b..453edbe 100644 --- a/OpenSim/Region/Caches/AssetCache.cs +++ b/OpenSim/Region/Caches/AssetCache.cs @@ -28,13 +28,12 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Reflection; +using System.Threading; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Utilities; namespace OpenSim.Region.Caches { @@ -45,8 +44,8 @@ namespace OpenSim.Region.Caches /// public class AssetCache : IAssetReceiver { - public Dictionary Assets; - public Dictionary Textures; + public Dictionary Assets; + public Dictionary Textures; public List AssetRequests = new List(); //assets ready to be sent to viewers public List TextureRequests = new List(); //textures ready to be sent @@ -67,8 +66,8 @@ namespace OpenSim.Region.Caches Console.WriteLine("Creating Asset cache"); _assetServer = assetServer; _assetServer.SetReceiver(this); - Assets = new Dictionary(); - Textures = new Dictionary(); + Assets = new Dictionary(); + Textures = new Dictionary(); this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); this._assetCacheThread.IsBackground = true; this._assetCacheThread.Start(); @@ -81,8 +80,8 @@ namespace OpenSim.Region.Caches _assetServer = this.LoadAssetDll(assetServerDLLName); _assetServer.SetServerInfo(assetServerURL, assetServerKey); _assetServer.SetReceiver(this); - Assets = new Dictionary(); - Textures = new Dictionary(); + Assets = new Dictionary(); + Textures = new Dictionary(); this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); this._assetCacheThread.IsBackground = true; this._assetCacheThread.Start(); @@ -216,7 +215,7 @@ namespace OpenSim.Region.Caches /// Event handler, called by a TextureSender object to say that texture has been sent /// /// - public void TextureSent(AssetCache.TextureSender sender) + public void TextureSent(TextureSender sender) { if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) { diff --git a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs index 5e6ecbb..8389415 100644 --- a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs @@ -1,7 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 2bbf656..b38979d 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -29,14 +29,11 @@ using System; using System.Collections; using System.Collections.Generic; using System.Text; -using System.IO; -using System.Xml; +using libsecondlife; using OpenSim.Framework.Servers; -using OpenSim.Framework; -using OpenSim.Framework.Utilities; using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; using OpenSim.Region.Caches; -using libsecondlife; namespace OpenSim.Region.Capabilities { @@ -126,7 +123,7 @@ namespace OpenSim.Region.Capabilities /// public string MapLayer(string request, string path, string param) { - Encoding _enc = System.Text.Encoding.UTF8; + Encoding _enc = Encoding.UTF8; Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); LLSDMapRequest mapReq = new LLSDMapRequest(); LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); @@ -252,7 +249,7 @@ namespace OpenSim.Region.Capabilities public string uploaderCaps(string request, string path, string param) { - Encoding _enc = System.Text.Encoding.UTF8; + Encoding _enc = Encoding.UTF8; byte[] data = _enc.GetBytes(request); //Console.WriteLine("recieved upload " + Util.FieldToString(data)); LLUUID inv = this.inventoryItemID; diff --git a/OpenSim/Region/Capabilities/LLSDArray.cs b/OpenSim/Region/Capabilities/LLSDArray.cs index 76d5a2c..e04849f 100644 --- a/OpenSim/Region/Capabilities/LLSDArray.cs +++ b/OpenSim/Region/Capabilities/LLSDArray.cs @@ -25,10 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections; -using System.Collections.Generic; -using System.Text; namespace OpenSim.Region.Capabilities { diff --git a/OpenSim/Region/Capabilities/LLSDCapEvent.cs b/OpenSim/Region/Capabilities/LLSDCapEvent.cs index d47d25c..51b4fe0 100644 --- a/OpenSim/Region/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Region/Capabilities/LLSDCapEvent.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs index d6db606..1522559 100644 --- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/Capabilities/LLSDEmpty.cs b/OpenSim/Region/Capabilities/LLSDEmpty.cs index 68f1ce9..d79c09e 100644 --- a/OpenSim/Region/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Region/Capabilities/LLSDEmpty.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs index 76d9345..19ef0c9 100644 --- a/OpenSim/Region/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Region/Capabilities/LLSDHelpers.cs @@ -27,9 +27,8 @@ */ using System; using System.Collections; -using System.Collections.Generic; -using System.Text; using System.IO; +using System.Reflection; using System.Xml; using libsecondlife; @@ -43,7 +42,7 @@ namespace OpenSim.Region.Capabilities XmlTextWriter writer = new XmlTextWriter(sw); writer.Formatting = Formatting.None; writer.WriteStartElement(String.Empty, "llsd", String.Empty); - LLSDHelpers.SerializeLLSDType(writer, obj); + SerializeLLSDType(writer, obj); writer.WriteEndElement(); writer.Close(); return sw.ToString(); @@ -59,7 +58,7 @@ namespace OpenSim.Region.Capabilities { case "MAP": writer.WriteStartElement(String.Empty, "map", String.Empty); - System.Reflection.FieldInfo[] fields = myType.GetFields(); + FieldInfo[] fields = myType.GetFields(); for (int i = 0; i < fields.Length; i++) { object fieldValue = fields[i].GetValue(obj); @@ -115,7 +114,7 @@ namespace OpenSim.Region.Capabilities IDictionaryEnumerator enumerator = llsd.GetEnumerator(); while (enumerator.MoveNext()) { - System.Reflection.FieldInfo field = myType.GetField((string)enumerator.Key); + FieldInfo field = myType.GetField((string)enumerator.Key); if (field != null) { if (enumerator.Value is Hashtable) diff --git a/OpenSim/Region/Capabilities/LLSDMapLayer.cs b/OpenSim/Region/Capabilities/LLSDMapLayer.cs index b097ec3..566d0e9 100644 --- a/OpenSim/Region/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Region/Capabilities/LLSDMapLayer.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - using libsecondlife; namespace OpenSim.Region.Capabilities diff --git a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs index ee37a5b..ce746ae 100644 --- a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/Capabilities/LLSDMapRequest.cs b/OpenSim/Region/Capabilities/LLSDMapRequest.cs index b15f1be..fb739cd 100644 --- a/OpenSim/Region/Capabilities/LLSDMapRequest.cs +++ b/OpenSim/Region/Capabilities/LLSDMapRequest.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/Capabilities/LLSDTest.cs b/OpenSim/Region/Capabilities/LLSDTest.cs index 3948f2c..f23e327 100644 --- a/OpenSim/Region/Capabilities/LLSDTest.cs +++ b/OpenSim/Region/Capabilities/LLSDTest.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Region/Capabilities/LLSDType.cs index a2ae8df..c58a937 100644 --- a/OpenSim/Region/Capabilities/LLSDType.cs +++ b/OpenSim/Region/Capabilities/LLSDType.cs @@ -26,8 +26,6 @@ * */ using System; -using System.Collections.Generic; -using System.Text; namespace OpenSim.Region.Capabilities { diff --git a/OpenSim/Region/Capabilities/LLSDUploadReply.cs b/OpenSim/Region/Capabilities/LLSDUploadReply.cs index 83cf166..023a056 100644 --- a/OpenSim/Region/Capabilities/LLSDUploadReply.cs +++ b/OpenSim/Region/Capabilities/LLSDUploadReply.cs @@ -25,11 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - using libsecondlife; + namespace OpenSim.Region.Capabilities { [LLSDType("MAP")] diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs index da74f85..082c0d0 100644 --- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs +++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs @@ -28,13 +28,12 @@ using System; using System.Collections.Generic; +using System.Text; using libsecondlife; -using OpenSim; using libsecondlife.Packets; -//using OpenSim.GridServers; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Inventory; using OpenSim.Framework.Types; -using OpenSim.Framework.Interfaces; using OpenSim.Region.ClientStack; namespace OpenSim.Assets @@ -46,7 +45,7 @@ namespace OpenSim.Assets { private Dictionary _agentsInventory; private List _serverRequests; //list of requests made to user server. - private System.Text.Encoding _enc = System.Text.Encoding.ASCII; + private Encoding _enc = Encoding.ASCII; private const uint FULL_MASK_PERMISSIONS = 2147483647; public InventoryCache() @@ -127,7 +126,7 @@ namespace OpenSim.Assets return res; } - public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, OpenSim.Framework.Types.AssetBase asset) + public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, AssetBase asset) { LLUUID newItem = null; if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) @@ -163,7 +162,7 @@ namespace OpenSim.Assets return res; } - public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, OpenSim.Framework.Types.AssetBase asset) + public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, AssetBase asset) { if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { @@ -238,7 +237,7 @@ namespace OpenSim.Assets Descend.ItemData[i].SalePrice = 100; Descend.ItemData[i].SaleType = 0; Descend.ItemData[i].Type = Item.Type; - Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + Descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); } userInfo.OutPacket(Descend); @@ -286,7 +285,7 @@ namespace OpenSim.Assets InventoryReply.InventoryData[0].SalePrice = 100; InventoryReply.InventoryData[0].SaleType = 0; InventoryReply.InventoryData[0].Type = Item.Type; - InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); userInfo.OutPacket(InventoryReply); } } @@ -320,7 +319,7 @@ namespace OpenSim.Assets InventoryReply.InventoryData[0].SalePrice = 100; InventoryReply.InventoryData[0].SaleType = 0; InventoryReply.InventoryData[0].Type = Item.Type; - InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); remoteClient.OutPacket(InventoryReply); } diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs index f99cf79..f4e537c 100644 --- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs +++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs @@ -25,13 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; using System.Net.Sockets; -using libsecondlife; - namespace OpenSim.Region.ClientStack { diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 51f02da..40e0021 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -27,14 +27,14 @@ */ using System; using System.Collections.Generic; +using System.Net; using System.Text; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Types; - +using Axiom.MathLib; using libsecondlife; using libsecondlife.Packets; -using System.Net; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; namespace OpenSim.Region.ClientStack { @@ -137,7 +137,7 @@ namespace OpenSim.Region.ClientStack /// public void SendRegionHandshake(RegionInfo regionInfo) { - System.Text.Encoding _enc = System.Text.Encoding.ASCII; + Encoding _enc = Encoding.ASCII; RegionHandshakePacket handshake = new RegionHandshakePacket(); handshake.RegionInfo.BillableFactor = regionInfo.estateSettings.billableFactor; @@ -219,8 +219,8 @@ namespace OpenSim.Region.ClientStack /// public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { - System.Text.Encoding enc = System.Text.Encoding.ASCII; - libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); + Encoding enc = Encoding.ASCII; + ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); reply.ChatData.Audible = 1; reply.ChatData.Message = message; reply.ChatData.ChatType = type; @@ -260,7 +260,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); } } @@ -286,7 +286,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); } } @@ -298,7 +298,7 @@ namespace OpenSim.Region.ClientStack /// public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint ) { - System.Net.IPAddress neighbourIP = neighbourEndPoint.Address; + IPAddress neighbourIP = neighbourEndPoint.Address; ushort neighbourPort = (ushort) neighbourEndPoint.Port; EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); @@ -343,7 +343,7 @@ namespace OpenSim.Region.ClientStack newSimPack.Info = new CrossedRegionPacket.InfoBlock(); newSimPack.Info.Position = pos; newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! - newSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); + newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); newSimPack.RegionData.RegionHandle = newRegionHandle; byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; @@ -359,7 +359,7 @@ namespace OpenSim.Region.ClientStack public void SendMapBlock(List mapBlocks) { - System.Text.Encoding _enc = System.Text.Encoding.ASCII; + Encoding _enc = Encoding.ASCII; MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); mapReply.AgentData.AgentID = this.AgentID; @@ -514,20 +514,20 @@ namespace OpenSim.Region.ClientStack /// public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { - System.Text.Encoding _enc = System.Text.Encoding.ASCII; + Encoding _enc = Encoding.ASCII; //send a objectupdate packet with information about the clients avatar ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); objupdate.RegionData.RegionHandle = regionHandle; objupdate.RegionData.TimeDilation = 64096; - objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; + objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry); //give this avatar object a local id and assign the user a name objupdate.ObjectData[0].ID = avatarLocalID; objupdate.ObjectData[0].FullID = avatarID; objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName + " \0"); - libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); + LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); byte[] pb = pos2.GetBytes(); Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); @@ -716,9 +716,9 @@ namespace OpenSim.Region.ClientStack ushort InternVelocityX; ushort InternVelocityY; ushort InternVelocityZ; - Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); + Vector3 internDirec = new Vector3(0, 0, 0); - internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z); + internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); internDirec = internDirec / 128.0f; internDirec.x += 1; @@ -961,7 +961,7 @@ namespace OpenSim.Region.ClientStack /// protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) { - libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); + ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); SetDefaultAvatarPacketValues(ref objdata); objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); @@ -977,12 +977,12 @@ namespace OpenSim.Region.ClientStack { objdata.TextureEntry = textureEntry; } - System.Text.Encoding enc = System.Text.Encoding.ASCII; - libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); + Encoding enc = Encoding.ASCII; + LLVector3 pos = new LLVector3(objdata.ObjectData, 16); pos.X = 100f; objdata.ID = 8880000; objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); - libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f); + LLVector3 pos2 = new LLVector3(100f, 100f, 23f); //objdata.FullID=user.AgentID; byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs index bc6cc21..60cd33a 100644 --- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs +++ b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs @@ -27,14 +27,13 @@ */ using System; using System.Collections.Generic; -using System.Text; +using libsecondlife; +using libsecondlife.Packets; using OpenSim.Assets; -using OpenSim.Framework.Types; using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using OpenSim.Region.Caches; -using libsecondlife; -using libsecondlife.Packets; namespace OpenSim.Region.ClientStack { diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 0456e3c..e4512d1 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -25,22 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections; -using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using Nwc.XmlRpc; -using System.Net; -using System.Net.Sockets; -using System.IO; -using System.Threading; -using System.Timers; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Utilities; -using OpenSim.Assets; +using OpenSim.Framework.Console; namespace OpenSim.Region.ClientStack { @@ -55,7 +42,7 @@ namespace OpenSim.Region.ClientStack protected virtual bool Logout(ClientView simClient, Packet packet) { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); + MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); //send reply to let the client logout LogoutReplyPacket logReply = new LogoutReplyPacket(); logReply.AgentData.AgentID = this.AgentID; @@ -120,7 +107,7 @@ namespace OpenSim.Region.ClientStack { if (OnUpdatePrimPosition != null) { - libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); } //should update stored position of the prim @@ -129,7 +116,7 @@ namespace OpenSim.Region.ClientStack { if (OnUpdatePrimRotation != null) { - libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); } } @@ -137,7 +124,7 @@ namespace OpenSim.Region.ClientStack { if (OnUpdatePrimScale != null) { - libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 75d3f65..8419906 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -26,21 +26,13 @@ * */ using System; -using System.Collections; using System.Collections.Generic; +using System.Text; using libsecondlife; using libsecondlife.Packets; -using Nwc.XmlRpc; -using System.Net; -using System.Net.Sockets; -using System.IO; -using System.Threading; -using System.Timers; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; -using OpenSim.Assets; namespace OpenSim.Region.ClientStack { @@ -64,7 +56,7 @@ namespace OpenSim.Region.ClientStack } else { - System.Text.Encoding _enc = System.Text.Encoding.ASCII; + Encoding _enc = Encoding.ASCII; switch (Pack.Type) { @@ -452,7 +444,7 @@ namespace OpenSim.Region.ClientStack this.OutPacket(tpStart); TeleportProgressPacket tpProgress = new TeleportProgressPacket(); - tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark"); + tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); tpProgress.Info.TeleportFlags = 8; tpProgress.AgentData.AgentID = tpReq.Info.AgentID; this.OutPacket(tpProgress); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index a36eeb0..606ca1d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -25,24 +25,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections; using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using Nwc.XmlRpc; using System.Net; -using System.Net.Sockets; -using System.IO; +using System.Text; using System.Threading; using System.Timers; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Assets; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; -using OpenSim.Assets; using OpenSim.Region.Caches; +using Timer=System.Timers.Timer; namespace OpenSim.Region.ClientStack { @@ -79,7 +77,7 @@ namespace OpenSim.Region.ClientStack private int cachedtextureserial = 0; private RegionInfo m_regionData; protected AuthenticateSessionsBase m_authenticateSessionsHandler; - private System.Text.Encoding enc = System.Text.Encoding.ASCII; + private Encoding enc = Encoding.ASCII; public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) { @@ -91,7 +89,7 @@ namespace OpenSim.Region.ClientStack m_inventoryCache = inventoryCache; m_authenticateSessionsHandler = authenSessions; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); + MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); cirpack = initialcirpack; userEP = remoteEP; @@ -100,7 +98,7 @@ namespace OpenSim.Region.ClientStack PacketQueue = new BlockingQueue(); this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); - AckTimer = new System.Timers.Timer(500); + AckTimer = new Timer(500); AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); AckTimer.Start(); @@ -189,7 +187,7 @@ namespace OpenSim.Region.ClientStack protected virtual void ClientLoop() { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); + MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); while (true) { QueItem nextPacket = PacketQueue.Dequeue(); @@ -211,7 +209,7 @@ namespace OpenSim.Region.ClientStack protected virtual void InitNewClient() { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); + MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); this.m_world.AddNewClient(this, false); } @@ -222,12 +220,12 @@ namespace OpenSim.Region.ClientStack if (!sessionInfo.Authorised) { //session/circuit not authorised - OpenSim.Framework.Console.MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); + MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); ClientThread.Abort(); } else { - OpenSim.Framework.Console.MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); + MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); //session is authorised this.AgentID = cirpack.CircuitCode.ID; this.SessionID = cirpack.CircuitCode.SessionID; diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index 7d39405..f105978 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -27,17 +27,14 @@ * */ using System; -using System.Collections; using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; using System.Net; using System.Net.Sockets; -using System.IO; -using System.Threading; using System.Timers; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Console; using OpenSim.Framework.Utilities; -using OpenSim.Framework.Interfaces; namespace OpenSim.Region.ClientStack { @@ -47,7 +44,7 @@ namespace OpenSim.Region.ClientStack protected Dictionary PendingAcks = new Dictionary(); protected Dictionary NeedAck = new Dictionary(); - protected System.Timers.Timer AckTimer; + protected Timer AckTimer; protected uint Sequence = 0; protected object SequenceLock = new object(); protected const int MAX_APPENDED_ACKS = 10; @@ -159,7 +156,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception) { - OpenSim.Framework.Console.MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); + MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); this.KillThread(); } @@ -195,8 +192,8 @@ namespace OpenSim.Region.ClientStack else if ((NewPack.Type == PacketType.StartPingCheck)) { //reply to pingcheck - libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; - libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); + StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack; + CompletePingCheckPacket endPing = new CompletePingCheckPacket(); endPing.PingID.PingID = startPing.PingID.PingID; OutPacket(endPing); } @@ -224,7 +221,7 @@ namespace OpenSim.Region.ClientStack { if (Pack.Header.Reliable) { - libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); + PacketAckPacket ack_it = new PacketAckPacket(); ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); ack_it.Packets[0].ID = Pack.Header.Sequence; @@ -254,7 +251,7 @@ namespace OpenSim.Region.ClientStack { if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + + MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + (now - packet.TickCount) + "ms have passed"); packet.Header.Resent = true; @@ -273,7 +270,7 @@ namespace OpenSim.Region.ClientStack if (PendingAcks.Count > 250) { // FIXME: Handle the odd case where we have too many pending ACKs queued up - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Too many ACKs queued up!"); + MainLog.Instance.Verbose( "Too many ACKs queued up!"); return; } diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 6f20413..b5f0a02 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -25,15 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; -using System.Text; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; using System.Net; using System.Net.Sockets; +using libsecondlife.Packets; using OpenSim.Assets; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; using OpenSim.Region.Caches; namespace OpenSim.Region.ClientStack diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 94db8ee..1e99c71 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -26,27 +26,16 @@ * */ using System; -using System.Text; -using System.IO; -using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Region.Terrain; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework; +using System.Net; using OpenSim.Assets; -using OpenSim.Region.Caches; +using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Physics.Manager; -using Nwc.XmlRpc; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; +using OpenSim.Physics.Manager; +using OpenSim.Region.Caches; namespace OpenSim.Region.ClientStack { diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 8ad5332..6eea524 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -26,26 +26,15 @@ * */ using System; -using System.Text; -using System.IO; -using System.Threading; +using System.Collections.Generic; using System.Net; using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; using libsecondlife.Packets; -using OpenSim.Region.Terrain; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; using OpenSim.Assets; -using OpenSim.Region.Caches; -using OpenSim.Framework.Console; using OpenSim.Framework; -using Nwc.XmlRpc; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Caches; namespace OpenSim.Region.ClientStack { diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 7c7c389..5d6ede8 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -25,15 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; using OpenSim.Framework.Communications; +using OpenSim.Framework.Types; namespace OpenSim.Region.Communications.Local { diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 26834be..43bdd03 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -25,13 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; -using System.Text; using libsecondlife; -using OpenSim.Framework.Types; using OpenSim.Framework; using OpenSim.Framework.Communications; +using OpenSim.Framework.Types; namespace OpenSim.Region.Communications.Local { @@ -163,7 +161,7 @@ namespace OpenSim.Region.Communications.Local /// /// /// - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) { if (this.regionHosts.ContainsKey(regionHandle)) { diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index b441a8d..592b36c 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -1,17 +1,11 @@ using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; - +using libsecondlife; using OpenSim.Framework.Communications; -//using OpenSim.Framework.User; -using OpenSim.Framework.UserManagement; using OpenSim.Framework.Data; using OpenSim.Framework.Types; +using OpenSim.Framework.UserManagement; using OpenSim.Framework.Utilities; -using libsecondlife; - namespace OpenSim.Region.Communications.Local { public class LocalUserServices : UserManagerBase, IUserServices diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs index 1eb7107..9afb75e 100644 --- a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs @@ -1,7 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 870f577..0a0847e 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; using OpenSim.Framework.Communications; +using OpenSim.Framework.Types; + namespace OpenSim.Region.Communications.OGS1 { public class CommunicationsOGS1 : CommunicationsManager diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 977b131..1706c6d 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -1,19 +1,17 @@ using System; -using System.Collections.Generic; using System.Collections; -using System.Text; +using System.Collections.Generic; +using System.Net; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; - -using OpenSim.Framework.Servers; +using libsecondlife; +using Nwc.XmlRpc; using OpenSim.Framework; -using OpenSim.Framework.Types; using OpenSim.Framework.Communications; - -using Nwc.XmlRpc; -using libsecondlife; -using System.Net; +using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; namespace OpenSim.Region.Communications.OGS1 { @@ -52,7 +50,7 @@ namespace OpenSim.Region.Communications.OGS1 if (GridRespData.ContainsKey("error")) { string errorstring = (string)GridRespData["error"]; - OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); + MainLog.Instance.Error("Unable to connect to grid: " + errorstring); return null; } @@ -103,7 +101,7 @@ namespace OpenSim.Region.Communications.OGS1 public RegionInfo RequestNeighbourInfo(ulong regionHandle) { - OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); + MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); return null; } @@ -184,7 +182,7 @@ namespace OpenSim.Region.Communications.OGS1 } else { - OpenSim.Framework.Console.MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); + MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); } return new XmlRpcResponse(); @@ -215,7 +213,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) { if (this.listeners.ContainsKey(regionHandle)) { @@ -239,7 +237,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } - public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public bool IncomingArrival(ulong regionHandle, LLUUID agentID, LLVector3 position) { if (this.listeners.ContainsKey(regionHandle)) { diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index 51b33e9..f514a29 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -1,12 +1,11 @@ using System; -using System.Collections.Generic; -using System.Text; +using libsecondlife; using OpenSim.Framework.Types; -using OpenSim.Framework.Communications; + namespace OpenSim.Region.Communications.OGS1 { public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); - public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); + public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position); public sealed class InterRegionSingleton { @@ -40,7 +39,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) { if (OnArrival != null) { @@ -62,7 +61,7 @@ namespace OpenSim.Region.Communications.OGS1 return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); } - public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) { return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); } diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 6d428d0..7c7db03 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -1,13 +1,9 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Data; using libsecondlife; - using Nwc.XmlRpc; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; namespace OpenSim.Region.Communications.OGS1 { diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs index 0c6f965..41f811a 100644 --- a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs @@ -1,7 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs index c2c1ecf..b5a74ad 100644 --- a/OpenSim/Region/Environment/EstateManager.cs +++ b/OpenSim/Region/Environment/EstateManager.cs @@ -28,13 +28,12 @@ using System; using System.Collections.Generic; using System.Text; -using OpenSim.Framework.Types; -using OpenSim.Framework.Interfaces; -using OpenSim.Region.Environment; -using OpenSim.Region.Environment.Scenes; -using OpenSim; using libsecondlife; using libsecondlife.Packets; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Region.Environment.Scenes; using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; @@ -79,30 +78,30 @@ namespace OpenSim.Region.Environment case "setregioninfo": if (packet.ParamList.Length != 9) { - OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); + MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); } else { - m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None; + m_regInfo.estateSettings.regionFlags = Simulator.RegionFlags.None; if (convertParamStringToBool(packet.ParamList[0].Parameter)) { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform; + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform; } if (convertParamStringToBool(packet.ParamList[1].Parameter)) { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly; + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly; } if (convertParamStringToBool(packet.ParamList[2].Parameter)) { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage; + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage; } if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell; + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell; } @@ -113,17 +112,17 @@ namespace OpenSim.Region.Environment m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); - m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel; + m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; if (convertParamStringToBool(packet.ParamList[7].Parameter)) { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject; + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject; } if (convertParamStringToBool(packet.ParamList[8].Parameter)) { - m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges; + m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges; } sendRegionInfoPacketToAll(); @@ -223,7 +222,7 @@ namespace OpenSim.Region.Environment case "setregionterrain": if (packet.ParamList.Length != 9) { - OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); + MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); } else { @@ -237,7 +236,7 @@ namespace OpenSim.Region.Environment } break; default: - OpenSim.Framework.Console.MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); + MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); break; } } @@ -265,7 +264,7 @@ namespace OpenSim.Region.Environment public void sendRegionInfoPacket(IClientAPI remote_client) { - Encoding _enc = System.Text.Encoding.ASCII; + Encoding _enc = Encoding.ASCII; AgentCircuitData circuitData = remote_client.RequestClientInfo(); diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 3afbe6e..2059b3f 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -27,7 +27,6 @@ */ using System; using System.Collections.Generic; -using System.Text; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; @@ -43,7 +42,7 @@ namespace OpenSim.Region.Environment /// /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) /// - public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver + public class ParcelManager : ILocalStorageParcelReceiver { #region Constants @@ -420,7 +419,7 @@ namespace OpenSim.Region.Environment { for (y = 0; y < inc_y; y++) { - OpenSim.Region.Environment.Parcel currentParcel = getParcel(start_x + x, start_y + y); + Parcel currentParcel = getParcel(start_x + x, start_y + y); if (!temp.Contains(currentParcel)) { currentParcel.forceUpdateParcelInfo(); @@ -429,10 +428,10 @@ namespace OpenSim.Region.Environment } } - int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL; + int requestResult = PARCEL_RESULT_ONE_PARCEL; if (temp.Count > 1) { - requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; + requestResult = PARCEL_RESULT_MULTIPLE_PARCELS; } for (i = 0; i < temp.Count; i++) @@ -571,7 +570,7 @@ namespace OpenSim.Region.Environment updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; - updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); + updatePacket.ParcelData.Desc = Helpers.StringToField(parcelData.parcelDesc); updatePacket.ParcelData.Category = (byte)parcelData.category; updatePacket.ParcelData.ClaimDate = parcelData.claimDate; updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; @@ -631,7 +630,7 @@ namespace OpenSim.Region.Environment parcelData.mediaID = packet.ParcelData.MediaID; parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); - parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name); + parcelData.parcelName = Helpers.FieldToUTF8String(packet.ParcelData.Name); parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags; parcelData.passHours = packet.ParcelData.PassHours; parcelData.passPrice = packet.ParcelData.PassPrice; diff --git a/OpenSim/Region/Environment/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs index 4ff55a8..cd67e97 100644 --- a/OpenSim/Region/Environment/RegionManager.cs +++ b/OpenSim/Region/Environment/RegionManager.cs @@ -1,11 +1,9 @@ -using System; using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Communications; using OpenSim.Framework; -using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Capabilities; +using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment { @@ -17,7 +15,7 @@ namespace OpenSim.Region.Environment protected List capsHandlers = new List(); protected BaseHttpServer httpListener; - protected Scenes.Scene m_Scene; + protected Scene m_Scene; public ParcelManager parcelManager; public EstateManager estateManager; diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index 6db57a4..c697faa 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -26,11 +26,8 @@ * */ using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; -using OpenSim.Physics.Manager; using libsecondlife; +using OpenSim.Physics.Manager; namespace OpenSim.Region.Environment.Scenes { diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 63f3f5d..a8eb9ce 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Text; using Axiom.MathLib; using libsecondlife; @@ -8,7 +6,7 @@ namespace OpenSim.Region.Environment.Scenes { public abstract class EntityBase { - public libsecondlife.LLUUID uuid; + public LLUUID uuid; protected List children; @@ -83,7 +81,7 @@ namespace OpenSim.Region.Environment.Scenes /// public EntityBase() { - uuid = new libsecondlife.LLUUID(); + uuid = new LLUUID(); m_pos = new LLVector3(); velocity = new LLVector3(); diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs index 36023d0..7c3a033 100644 --- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs +++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; namespace OpenSim.Region.Environment.Scenes { diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index b8ec68b..a767bd2 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -1,12 +1,11 @@ using System; using System.Collections.Generic; -using System.Text; +using Axiom.MathLib; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; namespace OpenSim.Region.Environment.Scenes { @@ -266,7 +265,7 @@ namespace OpenSim.Region.Environment.Scenes public void SendTerseUpdateToClient(IClientAPI RemoteClient) { LLVector3 lPos; - Axiom.MathLib.Quaternion lRot; + Quaternion lRot; lPos = this.Pos; lRot = this.rotation; diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs index d703857..4213a18 100644 --- a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs +++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs @@ -29,12 +29,13 @@ using System; using System.Collections.Generic; using System.Text; +using Axiom.MathLib; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; +using OpenSim.Physics.Manager; namespace OpenSim.Region.Environment.Scenes { @@ -174,9 +175,9 @@ namespace OpenSim.Region.Environment.Scenes dataArrays.Add(primData.ToBytes()); foreach (Entity child in children) { - if (child is OpenSim.Region.Environment.Scenes.PrimitiveOld) + if (child is PrimitiveOld) { - dataArrays.Add(((OpenSim.Region.Environment.Scenes.PrimitiveOld)child).GetByteArray()); + dataArrays.Add(((PrimitiveOld)child).GetByteArray()); } } byte[] primstart = Helpers.StringToField(""); @@ -351,7 +352,7 @@ namespace OpenSim.Region.Environment.Scenes /// public byte[] ConvertInventoryToBytes() { - System.Text.Encoding enc = System.Text.Encoding.ASCII; + Encoding enc = Encoding.ASCII; byte[] result = new byte[0]; List inventoryData = new List(); int totallength = 0; @@ -434,7 +435,7 @@ namespace OpenSim.Region.Environment.Scenes public void SendTerseUpdateToClient(IClientAPI RemoteClient) { LLVector3 lPos; - Axiom.MathLib.Quaternion lRot; + Quaternion lRot; if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? { PhysicsVector pPos = this._physActor.Position; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index d8533b0..669039f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -27,14 +27,10 @@ */ using System; using System.Collections.Generic; -using System.Text; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Utilities; namespace OpenSim.Region.Environment.Scenes { @@ -253,7 +249,7 @@ namespace OpenSim.Region.Environment.Scenes { if (((SceneObject)ent).rootLocalID == primLocalID) { - ((OpenSim.Region.Environment.Scenes.SceneObject)ent).GetProperites(remoteClient); + ((SceneObject)ent).GetProperites(remoteClient); break; } } @@ -349,7 +345,7 @@ namespace OpenSim.Region.Environment.Scenes { if (ent.LocalId == localID) { - ((OpenSim.Region.Environment.Scenes.PrimitiveOld)ent).UpdatePosition(pos); + ((PrimitiveOld)ent).UpdatePosition(pos); break; } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 059bfd7..2bc3f8c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -26,27 +26,23 @@ * */ using System; -using libsecondlife; -using libsecondlife.Packets; using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; using System.Threading; using System.Timers; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; +using libsecondlife; +using libsecondlife.Packets; using OpenSim.Framework; -using OpenSim.Region.Terrain; using OpenSim.Framework.Communications; -using OpenSim.Region.Caches; -using OpenSim.Region.Environment; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; +using OpenSim.Physics.Manager; +using OpenSim.Region.Caches; using OpenSim.Region.Enviorment.Scripting; -using OpenSim.Region.Capabilities; -using Caps = OpenSim.Region.Capabilities.Caps; +using OpenSim.Region.Terrain; +using Caps=OpenSim.Region.Capabilities.Caps; +using Timer=System.Timers.Timer; namespace OpenSim.Region.Environment.Scenes { @@ -54,9 +50,9 @@ namespace OpenSim.Region.Environment.Scenes public partial class Scene : SceneBase, ILocalStorageReceiver { - protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); - protected Dictionary Avatars; - protected Dictionary Prims; + protected Timer m_heartbeatTimer = new Timer(); + protected Dictionary Avatars; + protected Dictionary Prims; private PhysicsScene phyScene; private float timeStep = 0.1f; private Random Rand = new Random(); @@ -119,12 +115,12 @@ namespace OpenSim.Region.Environment.Scenes scriptManager = new ScriptManager(this); eventManager = new EventManager(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); - Entities = new Dictionary(); + MainLog.Instance.Verbose("World.cs - creating new entitities instance"); + Entities = new Dictionary(); Avatars = new Dictionary(); Prims = new Dictionary(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); + MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); ScenePresence.LoadAnims(); @@ -151,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - void Heartbeat(object sender, System.EventArgs e) + void Heartbeat(object sender, EventArgs e) { this.Update(); } @@ -170,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].updateMovement(); } @@ -180,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes this.phyScene.Simulate(timeStep); } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].update(); } @@ -198,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); } updateLock.ReleaseMutex(); @@ -237,14 +233,14 @@ namespace OpenSim.Region.Environment.Scenes this.SendLayerData(client); } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); } } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); } } @@ -268,14 +264,14 @@ namespace OpenSim.Region.Environment.Scenes this.SendLayerData(client); } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); } } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); } } @@ -301,7 +297,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); } } @@ -351,7 +347,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); } } @@ -382,12 +378,12 @@ namespace OpenSim.Region.Environment.Scenes { try { - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); + MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); this.localStorage.LoadPrimitives(this); } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); } } @@ -428,7 +424,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); } } @@ -482,10 +478,10 @@ namespace OpenSim.Region.Environment.Scenes { ScenePresence newAvatar = null; - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); newAvatar = new ScenePresence(client, this, this.m_regInfo); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); + MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); + MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.m_syncRoot) @@ -638,7 +634,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) { if (regionHandle == this.m_regInfo.RegionHandle) { diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 817f206..4036743 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -26,25 +26,20 @@ * */ using System; -using libsecondlife; -using libsecondlife.Packets; using System.Collections.Generic; -using System.Text; using System.Reflection; -using System.IO; -using System.Threading; -using OpenSim.Physics.Manager; +using libsecondlife; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; -using OpenSim.Region.Terrain; using OpenSim.Region.Caches; +using OpenSim.Region.Terrain; namespace OpenSim.Region.Environment.Scenes { public abstract class SceneBase : IWorld { - public Dictionary Entities; + public Dictionary Entities; protected Dictionary m_clientThreads; protected ulong m_regionHandle; protected string m_regionName; @@ -113,7 +108,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); return false; } } @@ -191,7 +186,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); + MainLog.Instance.WriteLine(LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index ac887c0..9e383c6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using libsecondlife; namespace OpenSim.Region.Environment.Scenes { @@ -18,7 +16,7 @@ namespace OpenSim.Region.Environment.Scenes public delegate void OnNewPrimitiveDelegate(PrimitiveOld prim); public event OnNewPrimitiveDelegate OnNewPrimitive; - public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); + public delegate void OnRemovePresenceDelegate(LLUUID uuid); public event OnRemovePresenceDelegate OnRemovePresence; public void TriggerOnFrame() @@ -41,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes OnNewPresence(presence); } - public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid) + public void TriggerOnRemovePresence(LLUUID uuid) { if (OnRemovePresence != null) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index c03354e..04ed408 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -25,21 +25,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; using System.Text; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; namespace OpenSim.Region.Environment.Scenes { public class SceneObject : EntityBase { - private System.Text.Encoding enc = System.Text.Encoding.ASCII; + private Encoding enc = Encoding.ASCII; private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group public Primitive rootPrimitive; private Scene m_world; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs index 2caabc2..d1f75ed 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs @@ -25,11 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; -using System.Text; -using libsecondlife; using System.Xml; +using libsecondlife; namespace OpenSim.Region.Environment.Scenes { @@ -66,7 +64,7 @@ namespace OpenSim.Region.Environment.Scenes // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); - foreach (KeyValuePair kp in OpenSim.Region.Environment.Scenes.ScenePresence.Animations.AnimsLLUUID) + foreach (KeyValuePair kp in Animations.AnimsLLUUID) { AnimsNames.Add(kp.Value, kp.Key); } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs index 2c81d2a..dbb5d3f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs @@ -25,14 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; namespace OpenSim.Region.Environment.Scenes { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 8a8f5ae..dcca848 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -28,14 +28,13 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; +using Axiom.MathLib; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Inventory; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using Axiom.MathLib; +using OpenSim.Physics.Manager; namespace OpenSim.Region.Environment.Scenes { @@ -53,7 +52,7 @@ namespace OpenSim.Region.Environment.Scenes private byte movementflag = 0; private List forcesList = new List(); private short _updateCount = 0; - private Axiom.MathLib.Quaternion bodyRot; + private Quaternion bodyRot; private LLObject.TextureEntry avatarAppearanceTexture = null; private byte[] visualParams; private AvatarWearable[] Wearables; @@ -110,7 +109,7 @@ namespace OpenSim.Region.Environment.Scenes m_regionInfo = reginfo; m_regionHandle = reginfo.RegionHandle; - OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs "); + MainLog.Instance.Verbose("Avatar.cs "); ControllingClient = theClient; this.firstname = ControllingClient.FirstName; this.lastname = ControllingClient.LastName; @@ -240,7 +239,7 @@ namespace OpenSim.Region.Environment.Scenes bool update_rotation = false; bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = new Vector3(0, 0, 0); - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); @@ -278,10 +277,10 @@ namespace OpenSim.Region.Environment.Scenes } - protected void AddNewMovement(Axiom.MathLib.Vector3 vec, Axiom.MathLib.Quaternion rotation) + protected void AddNewMovement(Vector3 vec, Quaternion rotation) { NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 direc = rotation * vec; + Vector3 direc = rotation * vec; direc.Normalize(); direc = direc * ((0.03f) * 128f); diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs index fc193f5..56f5c0b 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs @@ -26,13 +26,10 @@ * */ using System; -using System.Collections.Generic; -using System.Text; - -// Compilation stuff -using System.CodeDom; using System.CodeDom.Compiler; +using System.Collections.Generic; using Microsoft.CSharp; +using OpenSim.Framework.Console; namespace OpenSim.Region.Enviorment.Scripting { @@ -60,10 +57,10 @@ namespace OpenSim.Region.Enviorment.Scripting if (compilerResults.Errors.Count > 0) { - OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors"); + MainLog.Instance.Error("Compile errors"); foreach (CompilerError error in compilerResults.Errors) { - OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); } } else diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs index e6d66eb..2cea6e0 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs @@ -26,13 +26,10 @@ * */ using System; -using System.Collections.Generic; -using System.Text; - -// Compilation stuff -using System.CodeDom; using System.CodeDom.Compiler; +using System.Collections.Generic; using Microsoft.JScript; +using OpenSim.Framework.Console; namespace OpenSim.Region.Enviorment.Scripting { @@ -60,10 +57,10 @@ namespace OpenSim.Region.Enviorment.Scripting if (compilerResults.Errors.Count > 0) { - OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors"); + MainLog.Instance.Error("Compile errors"); foreach (CompilerError error in compilerResults.Errors) { - OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); } } else diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs index 1e64675..8029883 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Script.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs @@ -25,13 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Framework.Console; -using OpenSim.Framework; -using OpenSim.Region.Environment; using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Enviorment.Scripting @@ -54,7 +47,7 @@ namespace OpenSim.Region.Enviorment.Scripting public void Initialise(ScriptInfo scriptInfo) { script = scriptInfo; - script.events.OnFrame += new OpenSim.Region.Environment.Scenes.EventManager.OnFrameDelegate(events_OnFrame); + script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); } diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs index 522a572..d984d60 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs @@ -25,12 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Region.Environment.Scenes; using OpenSim.Framework.Console; +using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Enviorment.Scripting { @@ -52,7 +48,7 @@ namespace OpenSim.Region.Enviorment.Scripting { world = scene; events = world.eventManager; - logger = OpenSim.Framework.Console.MainLog.Instance; + logger = MainLog.Instance; } } } diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index eb1c1d9..1d47c24 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -25,16 +25,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; -using System.Text; +using OpenSim.Framework.Console; +using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Enviorment.Scripting { public class ScriptManager { List scripts = new List(); - OpenSim.Region.Environment.Scenes.Scene scene; + Scene scene; Dictionary compilers = new Dictionary(); private void LoadFromCompiler(Dictionary compiledscripts) @@ -42,14 +42,14 @@ namespace OpenSim.Region.Enviorment.Scripting foreach (KeyValuePair script in compiledscripts) { ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. - OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading " + script.Key); + MainLog.Instance.Verbose("Loading " + script.Key); script.Value.Initialise(scriptInfo); scripts.Add(script.Value); } - OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); + MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); } - public ScriptManager(OpenSim.Region.Environment.Scenes.Scene world) + public ScriptManager(Scene world) { scene = world; @@ -82,7 +82,7 @@ namespace OpenSim.Region.Enviorment.Scripting break; default: - OpenSim.Framework.Console.MainLog.Instance.Error("Unknown script command"); + MainLog.Instance.Error("Unknown script command"); break; } } diff --git a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs index c3d3d33..f946482 100644 --- a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs +++ b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections; using System.Text; -using OpenSim.Framework.Servers; -using OpenSim.Region.Capabilities; using libsecondlife; -using System.Collections; +using OpenSim.Region.Capabilities; namespace OpenSim.Framework.Servers { @@ -28,7 +25,7 @@ namespace OpenSim.Framework.Servers public string Handle(string body, string path) { - Encoding _enc = System.Text.Encoding.UTF8; + Encoding _enc = Encoding.UTF8; Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes( body )); TRequest request = new TRequest(); diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 8e6fd8f..3245223 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -1,23 +1,19 @@ -using System; using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Console; using libsecondlife; -using OpenSim.Region.Environment; -using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; -using OpenSim.Region.Environment.Scenes; using OpenSim.Framework; -using OpenSim.Region.Caches; using OpenSim.Framework.Communications; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; +using OpenSim.Region.Caches; +using OpenSim.Region.Environment.Scenes; +using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; namespace SimpleApp { public class MyWorld : Scene { - private List m_avatars; + private List m_avatars; public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 6bf6657..bc84c35 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -1,23 +1,18 @@ using System; -using System.Collections.Generic; -using System.Text; -using OpenSim; -using OpenSim.Region.GridInterfaces.Local; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Assets; +using System.Net; using libsecondlife; +using OpenSim.Assets; using OpenSim.Framework; -using OpenSim.Region.Caches; -using OpenSim.Framework.Communications; -using OpenSim.Region.Communications.Local; -using OpenSim.Region.ClientStack; -using System.Net; -using libsecondlife.Packets; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; using OpenSim.Physics.Manager; +using OpenSim.Region.Caches; using OpenSim.Region.Capabilities; +using OpenSim.Region.ClientStack; +using OpenSim.Region.Communications.Local; +using OpenSim.Region.GridInterfaces.Local; namespace SimpleApp { diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs index 0f9bf0f..3b0de8a 100644 --- a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs @@ -1,7 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs index 52ecd6b..b5fc1ef 100644 --- a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs +++ b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index 95d03f1..bd303e1 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs @@ -26,17 +26,15 @@ * */ using System; -using System.Collections.Generic; -using System.Text; -using System.Threading; using System.IO; +using System.Threading; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; +using libsecondlife; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; -using OpenSim.Framework.Console; -using libsecondlife; -using Db4objects.Db4o; -using Db4objects.Db4o.Query; namespace OpenSim.Region.GridInterfaces.Local { @@ -64,19 +62,19 @@ namespace OpenSim.Region.GridInterfaces.Local { bool yapfile; this._assetRequests = new BlockingQueue(); - yapfile = System.IO.File.Exists("assets.yap"); + yapfile = File.Exists("assets.yap"); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Local Asset Server class created"); + MainLog.Instance.Verbose( "Local Asset Server class created"); try { db = Db4oFactory.OpenFile("assets.yap"); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Db4 Asset database creation"); + MainLog.Instance.Verbose( "Db4 Asset database creation"); } catch (Exception e) { db.Close(); - OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured"); - OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + MainLog.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured"); + MainLog.Instance.Warn(e.ToString()); } if (!yapfile) { @@ -124,7 +122,7 @@ namespace OpenSim.Region.GridInterfaces.Local { if (db != null) { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Closing local asset server database"); + MainLog.Instance.Verbose( "Closing local asset server database"); db.Close(); } } @@ -168,7 +166,7 @@ namespace OpenSim.Region.GridInterfaces.Local try { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Setting up asset database"); + MainLog.Instance.Verbose( "Setting up asset database"); AssetBase Image = new AssetBase(); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); @@ -281,7 +279,7 @@ namespace OpenSim.Region.GridInterfaces.Local //should request Asset from storage manager //but for now read from file - string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; + string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; string fileName = Path.Combine(dataPath, filename); FileInfo fInfo = new FileInfo(fileName); long numBytes = fInfo.Length; diff --git a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs index 51596d0..1e15c5e 100644 --- a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs +++ b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs index 4652f70..8643736 100644 --- a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs @@ -25,14 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; +using System.IO; +using System.Net; using System.Text; using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.IO; using libsecondlife; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; @@ -53,7 +51,7 @@ namespace OpenSim.Region.GridInterfaces.Remote this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); this._remoteAssetServerThread.IsBackground = true; this._remoteAssetServerThread.Start(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("Remote Asset Server class created"); + MainLog.Instance.Verbose("Remote Asset Server class created"); } public void SetReceiver(IAssetReceiver receiver) diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs index 177c49d..ce567a9 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index e3f34da..393796f 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -25,8 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; +using Axiom.MathLib; using OpenSim.Physics.Manager; namespace OpenSim.Region.Physics.BasicPhysicsPlugin @@ -250,11 +250,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin } } - public override Axiom.MathLib.Quaternion Orientation + public override Quaternion Orientation { get { - return Axiom.MathLib.Quaternion.Identity; + return Quaternion.Identity; } set { diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs index 132f64a..9415db9 100644 --- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 502d8e6..8c286e0 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -25,15 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; +using Axiom.MathLib; namespace OpenSim.Physics.Manager { public delegate void PositionUpdate(PhysicsVector position); public delegate void VelocityUpdate(PhysicsVector velocity); - public delegate void OrientationUpdate(Axiom.MathLib.Quaternion orientation); + public delegate void OrientationUpdate(Quaternion orientation); public abstract class PhysicsActor { @@ -66,7 +64,7 @@ namespace OpenSim.Physics.Manager get; } - public abstract Axiom.MathLib.Quaternion Orientation + public abstract Quaternion Orientation { get; set; @@ -115,11 +113,11 @@ namespace OpenSim.Physics.Manager } } - public override Axiom.MathLib.Quaternion Orientation + public override Quaternion Orientation { get { - return Axiom.MathLib.Quaternion.Identity; + return Quaternion.Identity; } set { diff --git a/OpenSim/Region/Physics/Manager/PhysicsManager.cs b/OpenSim/Region/Physics/Manager/PhysicsManager.cs index 0e28522..265bce6 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsManager.cs @@ -27,10 +27,8 @@ */ using System; using System.Collections.Generic; -using System.Collections; using System.IO; using System.Reflection; -using Axiom.MathLib; using OpenSim.Framework.Console; namespace OpenSim.Physics.Manager @@ -56,19 +54,19 @@ namespace OpenSim.Physics.Manager if(_plugins.ContainsKey(engineName)) { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName); + MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName); return _plugins[engineName].GetScene(); } else { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName); + MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName); throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); } } public void LoadPlugins() { - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); + string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics"); string[] pluginFiles = Directory.GetFiles(path, "*.dll"); diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 3f22585..d44da00 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -25,9 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; using OpenSim.Framework.Console; namespace OpenSim.Physics.Manager @@ -67,7 +64,7 @@ namespace OpenSim.Physics.Manager public override PhysicsActor AddAvatar(PhysicsVector position) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); + MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); return PhysicsActor.Null; } @@ -78,7 +75,7 @@ namespace OpenSim.Physics.Manager public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); + MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); return PhysicsActor.Null; } @@ -91,12 +88,12 @@ namespace OpenSim.Physics.Manager public override void GetResults() { - OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : GetResults()"); + MainLog.Instance.Verbose("NullPhysicsScene : GetResults()"); } public override void SetTerrain(float[] heightMap) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); + MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); } public override void DeleteTerrain() diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index c60da9d..e75f29b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Physics.Manager { public class PhysicsVector diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs index b49c8da..ee10430 100644 --- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 8aca851..b85c052 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -27,8 +27,9 @@ */ using System; using System.Collections.Generic; -using OpenSim.Physics.Manager; +using Axiom.MathLib; using Ode.NET; +using OpenSim.Physics.Manager; namespace OpenSim.Region.Physics.OdePlugin { @@ -194,13 +195,13 @@ namespace OpenSim.Region.Physics.OdePlugin LandGeom = d.CreateHeightfield(space, HeightmapData, 1); d.Matrix3 R = new d.Matrix3(); - Axiom.MathLib.Quaternion q1 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(1,0,0)); - Axiom.MathLib.Quaternion q2 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(0,1,0)); + Quaternion q1 =Quaternion.FromAngleAxis(1.5707f, new Vector3(1,0,0)); + Quaternion q2 =Quaternion.FromAngleAxis(1.5707f, new Vector3(0,1,0)); //Axiom.MathLib.Quaternion q3 = Axiom.MathLib.Quaternion.FromAngleAxis(3.14f, new Axiom.MathLib.Vector3(0, 0, 1)); q1 = q1 * q2; //q1 = q1 * q3; - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(); + Vector3 v3 = new Vector3(); float angle = 0; q1.ToAngleAxis(ref angle, ref v3); @@ -287,11 +288,11 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override Axiom.MathLib.Quaternion Orientation + public override Quaternion Orientation { get { - return Axiom.MathLib.Quaternion.Identity; + return Quaternion.Identity; } set { @@ -414,11 +415,11 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override Axiom.MathLib.Quaternion Orientation + public override Quaternion Orientation { get { - Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); + Quaternion res = new Quaternion(); return res; } set diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs index b49c8da..ee10430 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 8bf794b..a75e5c7 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using OpenSim.Physics.Manager; using PhysXWrapper; +using Quaternion=Axiom.MathLib.Quaternion; namespace OpenSim.Region.Physics.PhysXPlugin { @@ -240,11 +241,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin } } - public override Axiom.MathLib.Quaternion Orientation + public override Quaternion Orientation { get { - return Axiom.MathLib.Quaternion.Identity; + return Quaternion.Identity; } set { @@ -377,11 +378,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin } } - public override Axiom.MathLib.Quaternion Orientation + public override Quaternion Orientation { get { - Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); + Quaternion res = new Quaternion(); PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); res.w = quat.W; res.x = quat.X; diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs index 3bc6f25..39ba6e4 100644 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs @@ -29,15 +29,10 @@ // BDB Support // Apparently broken on Mono -using System; -using System.Collections.Generic; -using System.Data; +using BerkeleyDb; using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using BerkeleyDb; -using Kds.Serialization; -using Kds.Serialization.Buffer; namespace OpenSim.Region.Storage.LocalStorageBDB { @@ -52,7 +47,7 @@ namespace OpenSim.Region.Storage.LocalStorageBDB public BDBLocalStorage() { DB = new Db(DbCreateFlags.None); - sim = (DbHash)DB.Open(null, simDbName, null, BerkeleyDb.DbType.Hash, Db.OpenFlags.Create, 0); + sim = (DbHash)DB.Open(null, simDbName, null, DbType.Hash, Db.OpenFlags.Create, 0); //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0); } diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs index ea2b62e..4463ac9 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // Information about this assembly is defined by the following // attributes. // diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs index 5cb4861..8214bc8 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs @@ -26,15 +26,11 @@ * */ using System; -using System.Collections.Generic; using Db4objects.Db4o; -using Db4objects.Db4o.Query; - using libsecondlife; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Console; - namespace OpenSim.Region.Storage.LocalStorageDb4o { @@ -53,18 +49,18 @@ namespace OpenSim.Region.Storage.LocalStorageDb4o public void Initialise(string dfile) { - OpenSim.Framework.Console.MainLog.Instance.Warn("Db4LocalStorage Opening " + dfile); + MainLog.Instance.Warn("Db4LocalStorage Opening " + dfile); datastore = dfile; try { db = Db4oFactory.OpenFile(datastore); - OpenSim.Framework.Console.MainLog.Instance.Verbose("Db4LocalStorage creation"); + MainLog.Instance.Verbose("Db4LocalStorage creation"); } catch (Exception e) { db.Close(); - OpenSim.Framework.Console.MainLog.Instance.Warn("Db4LocalStorage :Constructor - Exception occured"); - OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + MainLog.Instance.Warn("Db4LocalStorage :Constructor - Exception occured"); + MainLog.Instance.Warn(e.ToString()); } } @@ -123,7 +119,7 @@ namespace OpenSim.Region.Storage.LocalStorageDb4o public void LoadPrimitives(ILocalStorageReceiver receiver) { IObjectSet result = db.Get(typeof(PrimData)); - OpenSim.Framework.Console.MainLog.Instance.Verbose("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is " + result.Count); + MainLog.Instance.Verbose("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is " + result.Count); foreach (PrimData prim in result) { receiver.PrimFromStorage(prim); @@ -132,13 +128,13 @@ namespace OpenSim.Region.Storage.LocalStorageDb4o public float[] LoadWorld() { - OpenSim.Framework.Console.MainLog.Instance.Verbose("LoadWorld() - Loading world...."); + MainLog.Instance.Verbose("LoadWorld() - Loading world...."); float[] heightmap = null; - OpenSim.Framework.Console.MainLog.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); + MainLog.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); IObjectSet world_result = db.Get(typeof(MapStorage)); if (world_result.Count > 0) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("LoadWorld() - Found a heightmap in local database, loading"); + MainLog.Instance.Verbose("LoadWorld() - Found a heightmap in local database, loading"); MapStorage map = (MapStorage)world_result.Next(); //blank.LandMap = map.Map; heightmap = map.Map; @@ -151,7 +147,7 @@ namespace OpenSim.Region.Storage.LocalStorageDb4o IObjectSet world_result = db.Get(typeof(MapStorage)); if (world_result.Count > 0) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("SaveWorld() - updating saved copy of heightmap in local database"); + MainLog.Instance.Verbose("SaveWorld() - updating saved copy of heightmap in local database"); MapStorage map = (MapStorage)world_result.Next(); db.Delete(map); } diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs index 22f3392..ec82d02 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Storage.LocalStorageDb4o { public class MapStorage diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs index dcbe639..6e6768c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs @@ -25,13 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; -using Db4objects.Db4o; using Db4objects.Db4o.Query; using libsecondlife; -using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; namespace OpenSim.Region.Storage.LocalStorageDb4o diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs index 23de6dd..eb309cb 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs @@ -25,13 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; -using Db4objects.Db4o; using Db4objects.Db4o.Query; using libsecondlife; -using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; namespace OpenSim.Region.Storage.LocalStorageDb4o diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs index 80158d5..ea9cda8 100644 --- a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs index b407be4..9900a98 100644 --- a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs @@ -30,10 +30,10 @@ // A bad idea, but the IRC people told me to! using System; -using System.Collections.Generic; using System.Data; using System.Data.SQLite; using libsecondlife; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; @@ -54,8 +54,8 @@ namespace OpenSim.Region.Storage.LocalStorageSQLite catch (Exception e) { db.Close(); - OpenSim.Framework.Console.MainLog.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured"); - OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + MainLog.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured"); + MainLog.Instance.Warn(e.ToString()); } } @@ -117,8 +117,8 @@ namespace OpenSim.Region.Storage.LocalStorageSQLite } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured"); - OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + MainLog.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured"); + MainLog.Instance.Warn(e.ToString()); } cmd.Dispose(); @@ -144,8 +144,8 @@ namespace OpenSim.Region.Storage.LocalStorageSQLite } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured"); - OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); + MainLog.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured"); + MainLog.Instance.Warn(e.ToString()); } cmd.Dispose(); diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs index 7d10ae3..9c721d1 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs @@ -26,9 +26,7 @@ * */ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 0f450c3..6c9ec26 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -27,8 +27,9 @@ */ using System; using System.Collections.Generic; -using System.Text; using System.Drawing; +using System.Drawing.Imaging; +using System.IO; using libTerrain; using OpenJPEGNet; @@ -421,9 +422,9 @@ namespace OpenSim.Region.Terrain /// The filename of the double array to import public void loadFromFileF64(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); - System.IO.BinaryReader bs = new System.IO.BinaryReader(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.Open, FileAccess.Read); + BinaryReader bs = new BinaryReader(s); int x, y; for (x = 0; x < w; x++) { @@ -446,9 +447,9 @@ namespace OpenSim.Region.Terrain /// The filename of the float array to import public void loadFromFileF32(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); - System.IO.BinaryReader bs = new System.IO.BinaryReader(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.Open, FileAccess.Read); + BinaryReader bs = new BinaryReader(s); int x, y; for (x = 0; x < w; x++) { @@ -471,9 +472,9 @@ namespace OpenSim.Region.Terrain /// A path to the .RAW format public void loadFromFileSLRAW(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); - System.IO.BinaryReader bs = new System.IO.BinaryReader(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.Open, FileAccess.Read); + BinaryReader bs = new BinaryReader(s); int x, y; for (x = 0; x < w; x++) { @@ -496,9 +497,9 @@ namespace OpenSim.Region.Terrain /// The desired output filename public void writeToFileF64(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); - System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); + BinaryWriter bs = new BinaryWriter(s); int x, y; for (x = 0; x < w; x++) @@ -519,9 +520,9 @@ namespace OpenSim.Region.Terrain /// The desired output filename public void writeToFileF32(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); - System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); + BinaryWriter bs = new BinaryWriter(s); int x, y; for (x = 0; x < w; x++) @@ -543,9 +544,9 @@ namespace OpenSim.Region.Terrain /// Filename to write to public void writeToFileRAW(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); - System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); + BinaryWriter bs = new BinaryWriter(s); int x, y; @@ -608,9 +609,9 @@ namespace OpenSim.Region.Terrain /// The filename to output to public void writeToFileHiRAW(string filename) { - System.IO.FileInfo file = new System.IO.FileInfo(filename); - System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); - System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); + BinaryWriter bs = new BinaryWriter(s); // Generate a smegging big lookup table to speed the operation up (it needs it) double[] lookupTable = new double[65536]; @@ -872,7 +873,7 @@ namespace OpenSim.Region.Terrain } } - bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png); + bmp.Save(filename, ImageFormat.Png); } catch (Exception e) { @@ -913,7 +914,7 @@ namespace OpenSim.Region.Terrain } //bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png); - imageData = OpenJPEGNet.OpenJPEG.EncodeFromImage(bmp, "map"); + imageData = OpenJPEG.EncodeFromImage(bmp, "map"); } catch (Exception e) diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs index e0ae586..feb9327 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs @@ -26,16 +26,12 @@ * */ using System; -using System.Collections.Generic; -using System.Text; - using System.CodeDom.Compiler; -using System.CodeDom; +using System.Collections.Generic; +using libTerrain; using Microsoft.CSharp; using Microsoft.JScript; -using libTerrain; - namespace OpenSim.Region.Terrain { public interface ITerrainFilter -- cgit v1.1 From 898b48464a288e963fc588afc5fb0c9d51bdc755 Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 3 Jul 2007 14:56:00 +0000 Subject: *Renamed OGS1 XmlRpcLoginToSimulatorMethod to the more appropriate XmlRpcSimulatorLoginMethod *Attempt to fix the "sim not found" issue by adding sim if...well...not found (OGS1) --- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1706c6d..0ef327e 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -20,7 +20,6 @@ namespace OpenSim.Region.Communications.OGS1 public Dictionary listeners = new Dictionary(); public GridInfo grid; public BaseHttpServer httpListener; - private bool initialised = false; public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) { @@ -44,6 +43,7 @@ namespace OpenSim.Region.Communications.OGS1 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); Hashtable GridRespData = (Hashtable)GridResp.Value; + Hashtable griddatahash = GridRespData; // Process Response -- cgit v1.1 From e06ffb3981d29ddb3383690b4a05dc684813b6d9 Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 3 Jul 2007 17:03:14 +0000 Subject: *Removed GridInfo class as it has been previously replaced with the much better NetworkServersInfo class *Got the GridServer in OGS1 to go through with registering the region, but the actual storage of the region isnt working right now. **After this is fixed, grid mode should work! --- .../Communications/Local/LocalBackEndServices.cs | 2 +- .../Region/Communications/OGS1/CommunicationsOGS1.cs | 3 ++- .../Region/Communications/OGS1/OGS1GridServices.cs | 20 ++++++++++++++------ OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- 4 files changed, 19 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 43bdd03..d0cd991 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Communications.Local /// /// /// - public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + public RegionCommsListener RegisterRegion(RegionInfo regionInfo) { //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 0a0847e..1118726 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -5,9 +5,10 @@ namespace OpenSim.Region.Communications.OGS1 { public class CommunicationsOGS1 : CommunicationsManager { - private OGS1GridServices gridInterComms = new OGS1GridServices(); + public CommunicationsOGS1(NetworkServersInfo serversInfo) :base(serversInfo) { + OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo); GridServer = gridInterComms; InterRegion = gridInterComms; UserServer = new OGS1UserServices(this); diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 0ef327e..5fff777 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -18,20 +18,28 @@ namespace OpenSim.Region.Communications.OGS1 public class OGS1GridServices : IGridServices, IInterRegionCommunications { public Dictionary listeners = new Dictionary(); - public GridInfo grid; public BaseHttpServer httpListener; + public NetworkServersInfo serversInfo; - public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + public OGS1GridServices(NetworkServersInfo servers_info) + { + serversInfo = servers_info; + } + + public RegionCommsListener RegisterRegion(RegionInfo regionInfo) { Hashtable GridParams = new Hashtable(); - grid = gridInfo; // Login / Authentication - GridParams["authkey"] = gridInfo.GridServerSendKey; + + GridParams["authkey"] = serversInfo.GridSendKey; GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); GridParams["sim_ip"] = regionInfo.InternalEndPoint.Address.ToString(); GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); + GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); + GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); + GridParams["sim_name"] = regionInfo.RegionName; // Package into an XMLRPC Request ArrayList SendParams = new ArrayList(); @@ -41,7 +49,7 @@ namespace OpenSim.Region.Communications.OGS1 // Send Request XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); - XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); + XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); Hashtable GridRespData = (Hashtable)GridResp.Value; Hashtable griddatahash = GridRespData; @@ -149,7 +157,7 @@ namespace OpenSim.Region.Communications.OGS1 IList parameters = new ArrayList(); parameters.Add(param); XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); - XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000); + XmlRpcResponse resp = req.Send(serversInfo.GridURL, 3000); Hashtable respData = (Hashtable)resp.Value; return respData; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2bc3f8c..d13b3ab 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -603,8 +603,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void RegisterRegionWithComms() { - GridInfo gridSettings = new GridInfo(); - this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings); + + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); if (this.regionCommsHost != null) { this.regionCommsHost.OnExpectUser += this.NewUserConnection; -- cgit v1.1 From bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 3 Jul 2007 20:10:20 +0000 Subject: Today's work on Building support/tools. Think I am slowly getting there. --- OpenSim/Region/Application/OpenSimMain.cs | 4 +- OpenSim/Region/Capabilities/Caps.cs | 33 ++---- OpenSim/Region/ClientStack/ClientView.API.cs | 3 +- .../ClientStack/ClientView.PacketHandlers.cs | 79 ++++++++++++- OpenSim/Region/Environment/Scenes/EntityBase.cs | 2 +- OpenSim/Region/Environment/Scenes/Primitive.cs | 130 ++++++++++++++++++--- .../Environment/Scenes/Scene.PacketHandlers.cs | 82 +++++++++++-- OpenSim/Region/Environment/Scenes/Scene.cs | 17 ++- OpenSim/Region/Environment/Scenes/SceneObject.cs | 24 +++- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 1 + 10 files changed, 319 insertions(+), 56 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e976fe3..17a32cf 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -51,7 +51,7 @@ namespace OpenSim public class OpenSimMain : RegionApplicationBase, conscmd_callback { protected CommunicationsManager commsManager; - // private CheckSumServer checkServer; + // private CheckSumServer checkServer; private bool m_silent; private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; @@ -96,7 +96,7 @@ namespace OpenSim { this.SetupLocalGridServers(); // this.checkServer = new CheckSumServer(12036); - // this.checkServer.ServerListener(); + // this.checkServer.ServerListener(); this.commsManager = new CommunicationsLocal(this.serversData); } else diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index b38979d..d9d6f51 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -98,13 +98,6 @@ namespace OpenSim.Region.Capabilities /// protected LLSDCapsDetails GetCapabilities() { - /* string capURLS = ""; - capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; - capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; - //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; - //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; - return capURLS;*/ - LLSDCapsDetails caps = new LLSDCapsDetails(); string capsBaseUrl = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath; @@ -131,8 +124,6 @@ namespace OpenSim.Region.Capabilities LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); - - //Console.WriteLine(" Maplayer response is " + res); return res; } @@ -172,27 +163,23 @@ namespace OpenSim.Region.Capabilities public string CreateEstablishAgentComms(string caps, string ipAddressPort) { - string res = "id" + eventQueueCount + ""; - res += "events"; - res += "messageEstablishAgentCommunication"; - res += "body"; - res += "sim-ip-and-port" + ipAddressPort + ""; - res += "seed-capability" + caps + ""; - res += "agent-id" + this.agentID.ToStringHyphenated() + ""; - res += ""; - res += ""; - res += ""; + LLSDCapEvent eventItem = new LLSDCapEvent(); + eventItem.id = eventQueueCount; + //should be creating a EstablishAgentComms item, but there isn't a class for it yet + eventItem.events.Array.Add(new LLSDEmpty()); + string res = LLSDHelpers.SerialiseLLSDReply(eventItem); eventQueueCount++; + this.CapsEventQueue.Enqueue(res); return res; } public string CreateEmptyEventResponse() { - string res = "id" + eventQueueCount + ""; - res += "events"; - res += ""; - res += ""; + LLSDCapEvent eventItem = new LLSDCapEvent(); + eventItem.id = eventQueueCount; + eventItem.events.Array.Add(new LLSDEmpty()); + string res = LLSDHelpers.SerialiseLLSDReply(eventItem); eventQueueCount++; return res; } diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 40e0021..6de6af6 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.ClientStack public event UpdatePrimTexture OnUpdatePrimTexture; public event UpdateVector OnUpdatePrimPosition; public event UpdatePrimRotation OnUpdatePrimRotation; + public event UpdatePrimGroupRotation OnUpdatePrimGroupRotation; public event UpdateVector OnUpdatePrimScale; public event StatusChange OnChildAgentStatus; public event GenericCall2 OnStopMovement; @@ -644,7 +645,7 @@ namespace OpenSim.Region.ClientStack byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); byte[] rot = rotation.GetBytes(); - Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length); + Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length); OutPacket(outPacket); } diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index e4512d1..0b6c4f6 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -101,8 +101,10 @@ namespace OpenSim.Region.ClientStack protected bool MultipleObjUpdate(ClientView simClient, Packet packet) { MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; + // Console.WriteLine("new multi update packet " + multipleupdate.ToString()); for (int i = 0; i < multipleupdate.ObjectData.Length; i++) { + #region position if (multipleupdate.ObjectData[i].Type == 9) //change position { if (OnUpdatePrimPosition != null) @@ -110,24 +112,95 @@ namespace OpenSim.Region.ClientStack LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); } - //should update stored position of the prim + + } + else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position + { + if (OnUpdatePrimPosition != null) + { + // libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + //OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + } } - else if (multipleupdate.ObjectData[i].Type == 10)//rotation + #endregion position + #region rotation + else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab { if (OnUpdatePrimRotation != null) { LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + } + } + else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse + { + if (OnUpdatePrimRotation != null) + { + libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + } + } + else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab + { + if (OnUpdatePrimRotation != null) + { + libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); } } - else if (multipleupdate.ObjectData[i].Type == 13)//scale + else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse + { + if (OnUpdatePrimGroupRotation != null) + { + libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); + //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); + } + } + #endregion + #region scale + else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab { if (OnUpdatePrimScale != null) { LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + } + } + else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse + { + if (OnUpdatePrimScale != null) + { + libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); + // OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + } + } + else if (multipleupdate.ObjectData[i].Type == 5)//single scale from object tab + { + if (OnUpdatePrimScale != null) + { + libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + } + } + else if (multipleupdate.ObjectData[i].Type == 21)//single scale from mouse + { + if (OnUpdatePrimScale != null) + { + libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } + #endregion } return true; } diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index a8eb9ce..2874ae2 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public Quaternion _rotation; + public Quaternion _rotation = new Quaternion(0,0,1,0); public virtual Quaternion rotation { diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index a767bd2..803bd28 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes private PrimitiveBaseShape m_Shape; public SceneObject m_RootParent; - public bool isRootPrim; + public bool isRootPrim; public EntityBase m_Parent; public override LLVector3 Pos @@ -60,7 +60,11 @@ namespace OpenSim.Region.Environment.Scenes } set { - this.m_pos = m_Parent.Pos - value; //should we being subtracting the parent position + if (isRootPrim) + { + m_Parent.Pos = value; + } + this.m_pos = value - m_Parent.Pos; } } @@ -77,7 +81,19 @@ namespace OpenSim.Region.Environment.Scenes } } - public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject) + public LLVector3 Scale + { + set + { + this.m_Shape.Scale = value; + } + get + { + return this.m_Shape.Scale; + } + } + + public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) { m_regionHandle = regionHandle; m_world = world; @@ -86,12 +102,13 @@ namespace OpenSim.Region.Environment.Scenes this.isRootPrim = isRoot; this.m_RootParent = rootObject; this.CreateFromPacket(addPacket, ownerID, localID); + this.rotation = Axiom.MathLib.Quaternion.Identity; } /// /// /// - public override void update() + public override void update() { if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes { @@ -104,7 +121,10 @@ namespace OpenSim.Region.Environment.Scenes this.updateFlag = 0; } - base.update(); + foreach (EntityBase child in children) + { + child.update(); + } } /// @@ -150,9 +170,13 @@ namespace OpenSim.Region.Environment.Scenes this.updateFlag = 1; } + /// + /// + /// + /// public void AddNewChildren(SceneObject linkObject) { - // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); + // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); //TODO check permissions this.children.Add(linkObject.rootPrimitive); linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); @@ -161,30 +185,73 @@ namespace OpenSim.Region.Environment.Scenes linkObject.DeleteAllChildren(); } + /// + /// + /// + /// + /// public void SetNewParent(Primitive newParent, SceneObject rootParent) { LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); - //Console.WriteLine("have a new parent and my old position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); this.isRootPrim = false; this.m_Parent = newParent; this.ParentID = newParent.LocalId; this.SetRootParent(rootParent); - // Console.WriteLine("have a new parent and its position is " + this.m_Parent.Pos.X + " , " + this.m_Parent.Pos.Y + " , " + this.m_Parent.Pos.Z); this.Pos = oldPos; - // Console.WriteLine("have a new parent so my new offset position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); + Axiom.MathLib.Vector3 axPos = new Axiom.MathLib.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); + axPos = this.m_Parent.rotation.Inverse() * axPos; + this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); + this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); this.updateFlag = 1; } + /// + /// + /// + /// public void SetRootParent(SceneObject newRoot) { this.m_RootParent = newRoot; + this.m_RootParent.AddChildToList(this); foreach (Primitive child in children) { child.SetRootParent(newRoot); } } + public void AddOffsetToChildren(LLVector3 offset) + { + foreach (Primitive prim in this.children) + { + prim.m_pos += offset; + prim.updateFlag = 2; + } + } + + #region Resizing/Scale + public void ResizeGoup(LLVector3 scale) + { + LLVector3 offset = (scale - this.m_Shape.Scale); + offset.X /= 2; + offset.Y /= 2; + offset.Z /= 2; + if (this.isRootPrim) + { + this.m_Parent.Pos += offset; + } + else + { + this.m_pos += offset; + } + + this.AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z)); + this.m_Shape.Scale = scale; + + this.updateFlag = 1; + } + #endregion + /// /// /// @@ -192,14 +259,47 @@ namespace OpenSim.Region.Environment.Scenes public void UpdatePosition(LLVector3 pos) { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - if (this.isRootPrim) - { - this.m_Parent.Pos = newPos; - } + this.Pos = newPos; this.updateFlag = 2; } + public void UpdateRotation(LLQuaternion rot) + { + this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.updateFlag = 2; + } + + public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) + { + this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.Pos = pos; + this.updateFlag = 2; + } + + public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) + { + this.m_Shape.PathBegin = shapeBlock.PathBegin; + this.m_Shape.PathEnd = shapeBlock.PathEnd; + this.m_Shape.PathScaleX = shapeBlock.PathScaleX; + this.m_Shape.PathScaleY = shapeBlock.PathScaleY; + this.m_Shape.PathShearX = shapeBlock.PathShearX; + this.m_Shape.PathShearY = shapeBlock.PathShearY; + this.m_Shape.PathSkew = shapeBlock.PathSkew; + this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin; + this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd; + this.m_Shape.PathCurve = shapeBlock.PathCurve; + this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve; + this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow; + this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; + this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions; + this.m_Shape.PathTaperX = shapeBlock.PathTaperX; + this.m_Shape.PathTaperY = shapeBlock.PathTaperY; + this.m_Shape.PathTwist = shapeBlock.PathTwist; + this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; + this.updateFlag = 1; + } + #region Client Update Methods /// @@ -226,8 +326,10 @@ namespace OpenSim.Region.Environment.Scenes { LLVector3 lPos; lPos = this.Pos; + LLQuaternion lRot; + lRot = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); - remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID); + remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID); } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 669039f..0927903 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -233,7 +233,19 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) { - + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(primLocalID); + if (prim != null) + { + prim.UpdateShape(shapeBlock); + break; + } + } + } } /// @@ -263,7 +275,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void PrimDescription(uint primLocalID, string description) { - Primitive prim = null; + Primitive prim = null; foreach (EntityBase ent in Entities.Values) { if (ent is SceneObject) @@ -271,7 +283,7 @@ namespace OpenSim.Region.Environment.Scenes prim = ((SceneObject)ent).HasChildPrim(primLocalID); if (prim != null) { - prim.Description = description; + prim.Description = description; break; } } @@ -341,12 +353,41 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) { - if (ent.LocalId == localID) + if (ent is SceneObject) { - ((PrimitiveOld)ent).UpdatePosition(pos); - break; + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.UpdatePosition(pos); + break; + } + } + } + } + + /// + /// + /// + /// + /// + /// + /// + public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.UpdateGroupMouseRotation( pos, rot); + break; + } } } } @@ -359,7 +400,19 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) { - + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.UpdateRotation(rot); + break; + } + } + } } /// @@ -370,6 +423,19 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.ResizeGoup(scale); + break; + } + } + } } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d13b3ab..838d722 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -452,7 +452,11 @@ namespace OpenSim.Region.Environment.Scenes client.OnChatFromViewer += this.SimChat; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; - //client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimRotation += this.UpdatePrimRotation; + client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; + client.OnUpdatePrimScale += this.UpdatePrimScale; + client.OnUpdatePrimShape += this.UpdatePrimShape; client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; client.OnObjectSelect += this.SelectPrim; @@ -596,6 +600,17 @@ namespace OpenSim.Region.Environment.Scenes return false; } + public void SendAllSceneObjectsToClient(IClientAPI client) + { + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + ((SceneObject)ent).SendAllChildPrimsToClient(client); + } + } + } + #region RegionCommsHost /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 04ed408..3d97a06 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -63,6 +63,7 @@ namespace OpenSim.Region.Environment.Scenes return this.LocalId; } } + /// /// /// @@ -72,8 +73,8 @@ namespace OpenSim.Region.Environment.Scenes m_world = world; this.Pos = addPacket.ObjectData.RayEnd; this.CreateRootFromPacket(addPacket, ownerID, localID); - } + /// /// /// @@ -115,6 +116,13 @@ namespace OpenSim.Region.Environment.Scenes this.rootPrimitive.AddNewChildren(primObject); } + public void AddChildToList(Primitive prim) + { + if (!this.ChildPrimitives.ContainsKey(prim.uuid)) + { + this.ChildPrimitives.Add(prim.uuid, prim); + } + } /// /// /// @@ -130,10 +138,15 @@ namespace OpenSim.Region.Environment.Scenes return null; } + /// + /// + /// + /// + /// public Primitive HasChildPrim(uint localID) { Primitive returnPrim = null; - foreach (Primitive prim in this.children) + foreach (Primitive prim in this.ChildPrimitives.Values) { if (prim.LocalId == localID) { @@ -144,6 +157,11 @@ namespace OpenSim.Region.Environment.Scenes return returnPrim; } + public void SendAllChildPrimsToClient(IClientAPI client) + { + this.rootPrimitive.SendFullUpdateForAllChildren(client); + } + /// /// /// @@ -160,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - this.Pos = pos; + //this.Pos = pos; this.rootPrimitive.Pos = pos; this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index dcca848..98fa2ed 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -384,6 +384,7 @@ namespace OpenSim.Region.Environment.Scenes public void SendOurAppearance(IClientAPI OurClient) { this.ControllingClient.SendWearables(this.Wearables); + this.m_world.SendAllSceneObjectsToClient(this.ControllingClient); } /// -- cgit v1.1 From daf7b8ec76bb333d4808e8cd4392a002042ac2d0 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 4 Jul 2007 05:25:40 +0000 Subject: * Cleaning - attempting to get compiler warnings back down to zero. --- OpenSim/Region/Application/OpenSimMain.cs | 15 +++++++++------ OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 2 +- .../Scenes/scripting/Engines/CSharpScriptEngine.cs | 4 ++-- .../Environment/Scenes/scripting/Engines/JScriptEngine.cs | 4 ++-- OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs | 6 +++--- 5 files changed, 17 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 17a32cf..eaa067b 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -446,15 +446,18 @@ namespace OpenSim break; case "users": ScenePresence TempAv; - m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); - /* foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) + m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP","World")); + for (int i = 0; i < m_localWorld.Count; i++) + { + foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) { - if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") + if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") { - TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; - m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); + TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; + m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); } - }*/ + } + } break; } } diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 8419906..7f961ef 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -378,7 +378,7 @@ namespace OpenSim.Region.ClientStack // Console.WriteLine(Pack.ToString()); RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); - bool foundent = false; + //bool foundent = false; /* foreach (Entity ent in m_world.Entities.Values) { if (ent.localid == requesttask.InventoryData.LocalID) diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs index 56f5c0b..7928088 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Enviorment.Scripting return ".cs"; } - private Dictionary LoadDotNetScript(ICodeCompiler compiler, string filename) + private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) { CompilerParameters compilerParams = new CompilerParameters(); CompilerResults compilerResults; @@ -96,7 +96,7 @@ namespace OpenSim.Region.Enviorment.Scripting public Dictionary compile(string filename) { CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); - return LoadDotNetScript(csharpProvider.CreateCompiler(), filename); + return LoadDotNetScript(csharpProvider, filename); } } } diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs index 2cea6e0..d9d6f7e 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Enviorment.Scripting return ".js"; } - private Dictionary LoadDotNetScript(ICodeCompiler compiler, string filename) + private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) { CompilerParameters compilerParams = new CompilerParameters(); CompilerResults compilerResults; @@ -96,7 +96,7 @@ namespace OpenSim.Region.Enviorment.Scripting public Dictionary compile(string filename) { JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); - return LoadDotNetScript(jscriptProvider.CreateCompiler(), filename); + return LoadDotNetScript(jscriptProvider, filename); } } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs index feb9327..a38be07 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Terrain { public Dictionary filters = new Dictionary(); - private void LoadFilter(ICodeCompiler compiler, string filename) + private void LoadFilter(CodeDomProvider compiler, string filename) { CompilerParameters compilerParams = new CompilerParameters(); CompilerResults compilerResults; @@ -114,13 +114,13 @@ namespace OpenSim.Region.Terrain public void LoadFilterCSharp(string filename) { CSharpCodeProvider compiler = new CSharpCodeProvider(); - LoadFilter(compiler.CreateCompiler(), filename); + LoadFilter(compiler, filename); } public void LoadFilterJScript(string filename) { JScriptCodeProvider compiler = new JScriptCodeProvider(); - LoadFilter(compiler.CreateCompiler(), filename); + LoadFilter(compiler, filename); } } } -- cgit v1.1 From 249ce4cf6f353dd59ebec27689e74a527c39a090 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 4 Jul 2007 05:49:12 +0000 Subject: * More cleaning - Sugilite now only has build errors for "value is never used" properties (which I presume will be filled in over time) --- OpenSim/Region/Capabilities/Caps.cs | 14 ++++++++++++++ OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 2 +- OpenSim/Region/ClientStack/ClientView.cs | 1 - OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 2 +- OpenSim/Region/Environment/Scenes/SceneObject.cs | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index d9d6f51..4a283b2 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -75,6 +75,7 @@ namespace OpenSim.Region.Capabilities httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestTexture, RequestTexture); } /// @@ -131,6 +132,19 @@ namespace OpenSim.Region.Capabilities /// /// /// + /// + /// + /// + /// + public string RequestTexture(string request, string path, string param) + { + // Needs implementing (added to remove compiler warning) + return ""; + } + + /// + /// + /// /// protected LLSDMapLayer BuildLLSDMapLayerResponse() { diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 7f961ef..64856ea 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -456,7 +456,7 @@ namespace OpenSim.Region.ClientStack { AssetLandmark lm = new AssetLandmark(lma); - if (lm.RegionID == m_regionData.SimUUID) + if (lm.RegionID == m_world.RegionInfo.SimUUID) { TeleportLocalPacket tpLocal = new TeleportLocalPacket(); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 606ca1d..52749a1 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -75,7 +75,6 @@ namespace OpenSim.Region.ClientStack private AssetCache m_assetCache; private InventoryCache m_inventoryCache; private int cachedtextureserial = 0; - private RegionInfo m_regionData; protected AuthenticateSessionsBase m_authenticateSessionsHandler; private Encoding enc = Encoding.ASCII; diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 5fff777..a11995a 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.Communications.OGS1 private void StartRemoting() { TcpChannel ch = new TcpChannel(8895); - ChannelServices.RegisterChannel(ch); + ChannelServices.RegisterChannel(ch, true); WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wellType); diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 3d97a06..9a46fbf 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -39,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes private Encoding enc = Encoding.ASCII; private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group public Primitive rootPrimitive; - private Scene m_world; + private new Scene m_world; protected ulong m_regionHandle; private bool physicsEnabled = false; -- cgit v1.1 From 827cccb99c39b7dd3ee0ccc3defb9d88e449db52 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 4 Jul 2007 07:45:42 +0000 Subject: Grid Servers: * Sugilite grid server now works with older regions properly (using it on deepgrid for testing) * Sugilite user server still broken with sugilite region server * Reduced the number of compiler warnings to zero Region Servers: * Added debug information to OGS1 Comms to help debug user server connectivity issues. --- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index a11995a..99e9c96 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.Communications.OGS1 if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) { + MainLog.Instance.Verbose("OGS1 - Registering new HTTP listener on port " + regionInfo.InternalEndPoint.Port.ToString()); // initialised = true; httpListener = new BaseHttpServer( regionInfo.InternalEndPoint.Port ); httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); @@ -193,6 +194,8 @@ namespace OpenSim.Region.Communications.OGS1 MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); } + MainLog.Instance.Verbose("ExpectUser() - Welcoming new user..."); + return new XmlRpcResponse(); } -- cgit v1.1 From 9a51949cb4c833dcacf2a5803a8f2753273941c8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 11:47:32 +0000 Subject: * Added StreamHandler support * Implemented RestStreamHandler * Some caps functions now use it * Moved out RestMethodEntry from httpserver * The IStreamHandler interface now reports required method and Content-Type --- OpenSim/Region/Capabilities/Caps.cs | 47 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 4a283b2..0f6c471 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -41,13 +41,13 @@ namespace OpenSim.Region.Capabilities public class Caps { - private string httpListenerHostName; - private int httpListenPort; - private string capsObjectPath = "00001-"; - private string requestPath = "0000/"; - private string mapLayerPath = "0001/"; - private string newInventory = "0002/"; - private string requestTexture = "0003/"; + private string m_httpListenerHostName; + private int m_httpListenPort; + private string m_capsObjectPath = "00001-"; + private string m_requestPath = "0000/"; + private string m_mapLayerPath = "0001/"; + private string m_newInventory = "0002/"; + private string m_requestTexture = "0003/"; private string eventQueue = "0100/"; private BaseHttpServer httpListener; private LLUUID agentID; @@ -58,10 +58,10 @@ namespace OpenSim.Region.Capabilities public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) { assetCache = assetCach; - capsObjectPath = capsPath; + m_capsObjectPath = capsPath; httpListener = httpServer; - httpListenerHostName = httpListen; - httpListenPort = httpPort; + m_httpListenerHostName = httpListen; + m_httpListenPort = httpPort; agentID = agent; } @@ -71,13 +71,20 @@ namespace OpenSim.Region.Capabilities public void RegisterHandlers() { Console.WriteLine("registering CAPS handlers"); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); - httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestTexture, RequestTexture); + + AddCapsHandler( httpListener, m_requestPath, CapsRequest); + AddCapsHandler( httpListener, m_mapLayerPath, MapLayer); + AddCapsHandler( httpListener, m_newInventory, NewAgentInventory); + AddCapsHandler( httpListener, eventQueue, ProcessEventQueue); + AddCapsHandler( httpListener, m_requestTexture, RequestTexture); } + private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod ) + { + string capsBase = "/CAPS/" + m_capsObjectPath; + httpListener.AddStreamHandler(capsBase + path, new RestStreamHandler(restMethod, "POST", "application/xml")); + } + /// /// /// @@ -100,10 +107,10 @@ namespace OpenSim.Region.Capabilities protected LLSDCapsDetails GetCapabilities() { LLSDCapsDetails caps = new LLSDCapsDetails(); - string capsBaseUrl = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath; + string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; - caps.MapLayer = capsBaseUrl + mapLayerPath; - caps.NewFileAgentInventory = capsBaseUrl + newInventory; + caps.MapLayer = capsBaseUrl + m_mapLayerPath; + caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; return caps; } @@ -204,10 +211,10 @@ namespace OpenSim.Region.Capabilities string res = ""; LLUUID newAsset = LLUUID.Random(); LLUUID newInvItem = LLUUID.Random(); - string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); + string uploaderPath = m_capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); - string uploaderURL = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; + string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; //Console.WriteLine("uploader url is " + uploaderURL); res += ""; res += "uploader" + uploaderURL + ""; -- cgit v1.1 From 6a2588454a1ac4bb484ad0b9ee648e9ac156f8db Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 14:12:32 +0000 Subject: * Removed AssetHttpServer, using BaseHttpServer instead * Removed legacy REST handling * Created two custom IStreamHandlers for asset up/download * Removed quite a lot of double and triple encodings, trying to work towards binary only and direct write into storage. * Introduced BaseStreamHandler with GetParam() and some other goodies --- OpenSim/Region/Application/OpenSimMain.cs | 94 ++++++++++++++++++------------- OpenSim/Region/Capabilities/Caps.cs | 11 ++-- 2 files changed, 62 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index eaa067b..e2486bd 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -44,6 +44,7 @@ using OpenSim.Region.ClientStack; using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Environment.Scenes; +using System.Text; namespace OpenSim { @@ -51,7 +52,7 @@ namespace OpenSim public class OpenSimMain : RegionApplicationBase, conscmd_callback { protected CommunicationsManager commsManager; - // private CheckSumServer checkServer; + // private CheckSumServer checkServer; private bool m_silent; private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; @@ -84,10 +85,10 @@ namespace OpenSim m_log = new LogBase(m_logFilename, "Region", this, m_silent); MainLog.Instance = m_log; - m_log.Verbose( "Main.cs:Startup() - Loading configuration"); + m_log.Verbose("Main.cs:Startup() - Loading configuration"); this.serversData.InitConfig(this.m_sandbox, this.localConfig); this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change - + ScenePresence.LoadTextureFile("avatar-texture.dat"); ClientView.TerrainManager = new TerrainManager(new SecondLife()); @@ -95,8 +96,8 @@ namespace OpenSim if (m_sandbox) { this.SetupLocalGridServers(); - // this.checkServer = new CheckSumServer(12036); - // this.checkServer.ServerListener(); + // this.checkServer = new CheckSumServer(12036); + // this.checkServer.ServerListener(); this.commsManager = new CommunicationsLocal(this.serversData); } else @@ -114,7 +115,7 @@ namespace OpenSim this.SetupWorld(); - m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server"); + m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); @@ -124,7 +125,7 @@ namespace OpenSim } //Start http server - m_log.Verbose( "Main.cs:Startup() - Starting HTTP server"); + m_log.Verbose("Main.cs:Startup() - Starting HTTP server"); httpServer.Start(); // Start UDP servers @@ -145,7 +146,7 @@ namespace OpenSim } catch (Exception e) { - m_log.Error( e.Message + "\nSorry, could not setup local cache"); + m_log.Error(e.Message + "\nSorry, could not setup local cache"); Environment.Exit(1); } @@ -160,7 +161,7 @@ namespace OpenSim } catch (Exception e) { - m_log.Error( e.Message + "\nSorry, could not setup remote cache"); + m_log.Error(e.Message + "\nSorry, could not setup remote cache"); Environment.Exit(1); } } @@ -226,7 +227,7 @@ namespace OpenSim LocalWorld.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. LocalWorld.LoadWorldMap(); - m_log.Verbose( "Main.cs:Startup() - Starting up messaging system"); + m_log.Verbose("Main.cs:Startup() - Starting up messaging system"); LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); LocalWorld.LoadPrimsFromStorage(); @@ -244,21 +245,36 @@ namespace OpenSim } } - protected override void SetupHttpListener() + private class SimStatusHandler : IStreamHandler { - httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); + public byte[] Handle(string path, Stream request) + { + return Encoding.UTF8.GetBytes("OK"); + } - if (!this.m_sandbox) + public string ContentType { + get { return "text/plain"; } + } - // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server + public string HttpMethod + { + get { return "GET"; } + } + + public string Path + { + get { return "/simstatus/"; } + } + } + protected override void SetupHttpListener() + { + httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); - httpServer.AddRestHandler("GET", "/simstatus/", - delegate(string request, string path, string param) - { - return "OK"; - }); + if (!this.m_sandbox) + { + httpServer.AddStreamHandler( new SimStatusHandler() ); } } @@ -340,7 +356,7 @@ namespace OpenSim switch (attri) { default: - m_log.Warn( "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); + m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); Environment.Exit(1); break; @@ -376,11 +392,11 @@ namespace OpenSim /// public virtual void Shutdown() { - m_log.Verbose( "Main.cs:Shutdown() - Closing all threads"); - m_log.Verbose( "Main.cs:Shutdown() - Killing listener thread"); - m_log.Verbose( "Main.cs:Shutdown() - Killing clients"); + m_log.Verbose("Main.cs:Shutdown() - Closing all threads"); + m_log.Verbose("Main.cs:Shutdown() - Killing listener thread"); + m_log.Verbose("Main.cs:Shutdown() - Killing clients"); // IMPLEMENT THIS - m_log.Verbose( "Main.cs:Shutdown() - Closing console and terminating"); + m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating"); for (int i = 0; i < m_localWorld.Count; i++) { ((Scene)m_localWorld[i]).Close(); @@ -400,8 +416,8 @@ namespace OpenSim switch (command) { case "help": - m_log.Error( "show users - show info about connected users"); - m_log.Error( "shutdown - disconnect all clients and shutdown"); + m_log.Error("show users - show info about connected users"); + m_log.Error("shutdown - disconnect all clients and shutdown"); break; case "show": @@ -415,7 +431,7 @@ namespace OpenSim string result = ""; for (int i = 0; i < m_localWorld.Count; i++) { - if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result,m_localWorld[i].RegionInfo.RegionName)) + if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName)) { m_log.Error(result); } @@ -427,7 +443,7 @@ namespace OpenSim break; default: - m_log.Error( "Unknown command"); + m_log.Error("Unknown command"); break; } } @@ -441,22 +457,22 @@ namespace OpenSim switch (ShowWhat) { case "uptime": - m_log.Error( "OpenSim has been running since " + startuptime.ToString()); - m_log.Error( "That is " + (DateTime.Now - startuptime).ToString()); + m_log.Error("OpenSim has been running since " + startuptime.ToString()); + m_log.Error("That is " + (DateTime.Now - startuptime).ToString()); break; case "users": ScenePresence TempAv; - m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP","World")); + m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); for (int i = 0; i < m_localWorld.Count; i++) { - foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) - { - if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") - { - TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; - m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); - } - } + foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) + { + if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") + { + TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; + m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); + } + } } break; } diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 0f6c471..1d07683 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.Capabilities private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod ) { string capsBase = "/CAPS/" + m_capsObjectPath; - httpListener.AddStreamHandler(capsBase + path, new RestStreamHandler(restMethod, "POST", "application/xml")); + httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); } /// @@ -211,9 +211,11 @@ namespace OpenSim.Region.Capabilities string res = ""; LLUUID newAsset = LLUUID.Random(); LLUUID newInvItem = LLUUID.Random(); - string uploaderPath = m_capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); - httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); + + AddCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); + string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; //Console.WriteLine("uploader url is " + uploaderURL); res += ""; @@ -269,7 +271,8 @@ namespace OpenSim.Region.Capabilities res += ""; // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); - httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); + httpListener.RemoveStreamHandler("POST", "/CAPS/" + uploaderPath); + if (OnUpLoad != null) { OnUpLoad(newAssetID, inv, data); -- cgit v1.1 From 5c32b33a66fbdf371d53d85ee54ee8e837481570 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 16:28:59 +0000 Subject: * re-fixed the utf-16 bug in xmlRpcResponse serialization * added LLSDStreamHandler.cs to Caps (Haven't enabled it yet, though) * removed last traces of old rest handling --- OpenSim/Region/Capabilities/Caps.cs | 38 +++++++++++++------- OpenSim/Region/Capabilities/LLSDMethod.cs | 8 +++++ OpenSim/Region/Capabilities/LLSDStreamHandler.cs | 40 ++++++++++++++++++++++ .../OpenSim.Region.Capabilities.csproj | 6 ++++ .../OpenSim.Region.Capabilities.dll.build | 2 ++ .../Region/Examples/SimpleApp/LlsdMethodEntry.cs | 35 ++----------------- OpenSim/Region/Examples/SimpleApp/Program.cs | 23 ------------- 7 files changed, 84 insertions(+), 68 deletions(-) create mode 100644 OpenSim/Region/Capabilities/LLSDMethod.cs create mode 100644 OpenSim/Region/Capabilities/LLSDStreamHandler.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 1d07683..70d601f 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -71,20 +71,33 @@ namespace OpenSim.Region.Capabilities public void RegisterHandlers() { Console.WriteLine("registering CAPS handlers"); + string capsBase = "/CAPS/" + m_capsObjectPath; + + AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); + + //httpListener.AddStreamHandler( + // new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); - AddCapsHandler( httpListener, m_requestPath, CapsRequest); - AddCapsHandler( httpListener, m_mapLayerPath, MapLayer); - AddCapsHandler( httpListener, m_newInventory, NewAgentInventory); - AddCapsHandler( httpListener, eventQueue, ProcessEventQueue); - AddCapsHandler( httpListener, m_requestTexture, RequestTexture); + AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); + AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); + AddLegacyCapsHandler( httpListener, eventQueue, ProcessEventQueue); + AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture); } - private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod ) + public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) + { + LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + return mapResponse; + } + + [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] + private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) { string capsBase = "/CAPS/" + m_capsObjectPath; httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); } - + /// /// /// @@ -125,17 +138,18 @@ namespace OpenSim.Region.Capabilities public string MapLayer(string request, string path, string param) { Encoding _enc = Encoding.UTF8; - Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); + Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes(request)); LLSDMapRequest mapReq = new LLSDMapRequest(); - LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); + LLSDHelpers.DeserialiseLLSDMap(hash, mapReq); - LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); + LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); - + return res; } + /// /// /// @@ -214,7 +228,7 @@ namespace OpenSim.Region.Capabilities string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); - AddCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); + AddLegacyCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; //Console.WriteLine("uploader url is " + uploaderURL); diff --git a/OpenSim/Region/Capabilities/LLSDMethod.cs b/OpenSim/Region/Capabilities/LLSDMethod.cs new file mode 100644 index 0000000..5f42f44 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDMethod.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Capabilities +{ + public delegate TResponse LLSDMethod(TRequest request); +} diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs new file mode 100644 index 0000000..ff63353 --- /dev/null +++ b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Servers; +using System.IO; +using System.Collections; +using libsecondlife; + +namespace OpenSim.Region.Capabilities +{ + public class LLSDStreamhandler : BaseStreamHandler + where TRequest : new() + { + private LLSDMethod m_method; + + public LLSDStreamhandler(string httpMethod, string path, LLSDMethod method) + : base(httpMethod, path) + { + m_method = method; + } + + public override byte[] Handle(string path, Stream request) + { + Encoding encoding = Encoding.UTF8; + StreamReader streamReader = new StreamReader(request, encoding); + + string requestBody = streamReader.ReadToEnd(); + streamReader.Close(); + + Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody)); + TRequest llsdRequest = new TRequest(); + LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); + + TResponse response = m_method(llsdRequest); + + return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); + + } + } +} diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj index 4667d52..4b672ae 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj @@ -123,6 +123,12 @@ Code + + Code + + + Code + Code diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build index a091b5c..1d552c2 100644 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build @@ -20,6 +20,8 @@ + + diff --git a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs index f946482..d0ef2af 100644 --- a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs +++ b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs @@ -2,40 +2,9 @@ using System.Collections; using System.Text; using libsecondlife; using OpenSim.Region.Capabilities; +using System.IO; namespace OpenSim.Framework.Servers { - public class LlsdMethodEntry : ILlsdMethodHandler - where TRequest : new() - { - private LlsdMethod m_method; - - - public LlsdMethodEntry( ) - { - - } - - public LlsdMethodEntry(LlsdMethod method) - { - m_method = method; - } - - #region ILlsdMethodHandler Members - - public string Handle(string body, string path) - { - Encoding _enc = Encoding.UTF8; - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes( body )); - TRequest request = new TRequest(); - - LLSDHelpers.DeserialiseLLSDMap(hash, request ); - - TResponse response = m_method(request); - - return LLSDHelpers.SerialiseLLSDReply( response ); - } - - #endregion - } + } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index bc84c35..ad70df8 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -60,8 +60,6 @@ namespace SimpleApp httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod ); - RegisterLlsdHandler("/Caps/test/", LlsdMethodDemo); - httpServer.Start(); m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); @@ -74,27 +72,6 @@ namespace SimpleApp } - private LLSDMapLayerResponse LlsdMethodDemo(LLSDMapRequest request) - { - return new LLSDMapLayerResponse(); - } - - ILlsdMethodHandler m_handler; - - private void RegisterLlsdHandler( string path, LlsdMethod method ) - where TRequest : new() - { - // path should be handler key, but for now just conceptually store it. - m_handler = new LlsdMethodEntry( method ); - } - - private string ProcessLlsdMethod( string request,string path ) - { - LlsdMethodEntry concreteHandler = new LlsdMethodEntry( LlsdMethodDemo ); - - return m_handler.Handle(request, path); - } - private bool AddNewSessionHandler(ulong regionHandle, Login loginData) { m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); -- cgit v1.1 From beb3073bec9438a439e13eaec40a8320a9279adc Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 4 Jul 2007 19:07:27 +0000 Subject: A bit more work on Building tools/support. updated Axiom.MathLib.dll. --- OpenSim/Region/Capabilities/Caps.cs | 52 +++++++-- OpenSim/Region/ClientStack/ClientView.API.cs | 4 +- .../ClientStack/ClientView.PacketHandlers.cs | 21 ++-- .../Environment/OpenSim.Region.Environment.csproj | 58 +++++----- OpenSim/Region/Environment/Scenes/EntityBase.cs | 2 +- OpenSim/Region/Environment/Scenes/Primitive.cs | 124 +++++++++++++++++++-- OpenSim/Region/Environment/Scenes/PrimitiveOld.cs | 2 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 60 +++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 2 + OpenSim/Region/Environment/Scenes/SceneObject.cs | 3 +- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 2 +- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 2 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 4 +- OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 2 +- 15 files changed, 273 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 70d601f..6206f65 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -73,6 +73,7 @@ namespace OpenSim.Region.Capabilities Console.WriteLine("registering CAPS handlers"); string capsBase = "/CAPS/" + m_capsObjectPath; + AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); //httpListener.AddStreamHandler( @@ -82,6 +83,7 @@ namespace OpenSim.Region.Capabilities AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); AddLegacyCapsHandler( httpListener, eventQueue, ProcessEventQueue); AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture); + } public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) @@ -153,6 +155,20 @@ namespace OpenSim.Region.Capabilities /// /// /// + /// + protected LLSDMapLayer BuildLLSDMapLayerResponse() + { + LLSDMapLayer mapLayer = new LLSDMapLayer(); + mapLayer.Right = 5000; + mapLayer.Top = 5000; + mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); + + return mapLayer; + } + + /// + /// + /// /// /// /// @@ -166,17 +182,10 @@ namespace OpenSim.Region.Capabilities /// /// /// + /// + /// + /// /// - protected LLSDMapLayer BuildLLSDMapLayerResponse() - { - LLSDMapLayer mapLayer = new LLSDMapLayer(); - mapLayer.Right = 5000; - mapLayer.Top = 5000; - mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); - - return mapLayer; - } - public string ProcessEventQueue(string request, string path, string param) { string res = ""; @@ -196,6 +205,12 @@ namespace OpenSim.Region.Capabilities return res; } + /// + /// + /// + /// + /// + /// public string CreateEstablishAgentComms(string caps, string ipAddressPort) { LLSDCapEvent eventItem = new LLSDCapEvent(); @@ -209,6 +224,10 @@ namespace OpenSim.Region.Capabilities return res; } + /// + /// + /// + /// public string CreateEmptyEventResponse() { LLSDCapEvent eventItem = new LLSDCapEvent(); @@ -219,6 +238,13 @@ namespace OpenSim.Region.Capabilities return res; } + /// + /// + /// + /// + /// + /// + /// public string NewAgentInventory(string request, string path, string param) { //Console.WriteLine("received upload request:"+ request); @@ -241,6 +267,12 @@ namespace OpenSim.Region.Capabilities return res; } + /// + /// + /// + /// + /// + /// public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) { // Console.WriteLine("upload handler called"); diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 6de6af6..9e7117f 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Net; using System.Text; -using Axiom.MathLib; +using Axiom.Math; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Console; @@ -63,7 +63,9 @@ namespace OpenSim.Region.ClientStack public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimTexture OnUpdatePrimTexture; public event UpdateVector OnUpdatePrimPosition; + public event UpdateVector OnUpdatePrimSinglePosition; public event UpdatePrimRotation OnUpdatePrimRotation; + public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; public event UpdatePrimGroupRotation OnUpdatePrimGroupRotation; public event UpdateVector OnUpdatePrimScale; public event StatusChange OnChildAgentStatus; diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 0b6c4f6..5cea28a 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.ClientStack protected bool MultipleObjUpdate(ClientView simClient, Packet packet) { MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; - // Console.WriteLine("new multi update packet " + multipleupdate.ToString()); + //System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); for (int i = 0; i < multipleupdate.ObjectData.Length; i++) { #region position @@ -116,30 +116,31 @@ namespace OpenSim.Region.ClientStack } else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position { - if (OnUpdatePrimPosition != null) + if (OnUpdatePrimSinglePosition != null) { - // libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - //OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); } } #endregion position #region rotation else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab { - if (OnUpdatePrimRotation != null) + if (OnUpdatePrimSingleRotation != null) { LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); } } else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse { - if (OnUpdatePrimRotation != null) + if (OnUpdatePrimSingleRotation != null) { libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); } } else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab @@ -182,7 +183,7 @@ namespace OpenSim.Region.ClientStack // OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } - else if (multipleupdate.ObjectData[i].Type == 5)//single scale from object tab + else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab { if (OnUpdatePrimScale != null) { @@ -191,7 +192,7 @@ namespace OpenSim.Region.ClientStack OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } - else if (multipleupdate.ObjectData[i].Type == 21)//single scale from mouse + else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse { if (OnUpdatePrimScale != null) { diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 9e9405e..f5724dd 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {DCBA491C-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Region.Environment @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Region.Environment - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,34 +61,36 @@ False False 4 - + + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + Microsoft.JScript.dll False - + System.dll False - + + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -92,55 +100,55 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Capabilities {39038E85-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -215,4 +223,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 2874ae2..99ca021 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Axiom.MathLib; +using Axiom.Math; using libsecondlife; namespace OpenSim.Region.Environment.Scenes diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 803bd28..24dc115 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Axiom.MathLib; +using Axiom.Math; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; @@ -45,6 +45,7 @@ namespace OpenSim.Region.Environment.Scenes public bool isRootPrim; public EntityBase m_Parent; + #region Properties public override LLVector3 Pos { get @@ -69,6 +70,22 @@ namespace OpenSim.Region.Environment.Scenes } + public LLVector3 WorldPos + { + get + { + if (!this.isRootPrim) + { + Primitive parentPrim = (Primitive)this.m_Parent; + return this.m_pos + parentPrim.WorldPos; + } + else + { + return this.Pos; + } + } + } + public string Description { get @@ -92,7 +109,9 @@ namespace OpenSim.Region.Environment.Scenes return this.m_Shape.Scale; } } + #endregion + #region Constructors public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) { m_regionHandle = regionHandle; @@ -102,9 +121,11 @@ namespace OpenSim.Region.Environment.Scenes this.isRootPrim = isRoot; this.m_RootParent = rootObject; this.CreateFromPacket(addPacket, ownerID, localID); - this.rotation = Axiom.MathLib.Quaternion.Identity; + this.rotation = Axiom.Math.Quaternion.Identity; } + #endregion + #region Override from EntityBase /// /// /// @@ -126,7 +147,9 @@ namespace OpenSim.Region.Environment.Scenes child.update(); } } + #endregion + #region Setup /// /// /// @@ -169,7 +192,9 @@ namespace OpenSim.Region.Environment.Scenes this.updateFlag = 1; } + #endregion + #region Linking / unlinking /// /// /// @@ -196,28 +221,49 @@ namespace OpenSim.Region.Environment.Scenes this.isRootPrim = false; this.m_Parent = newParent; this.ParentID = newParent.LocalId; - this.SetRootParent(rootParent); + this.m_RootParent = rootParent; + this.m_RootParent.AddChildToList(this); this.Pos = oldPos; - Axiom.MathLib.Vector3 axPos = new Axiom.MathLib.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); + Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); axPos = this.m_Parent.rotation.Inverse() * axPos; this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); this.updateFlag = 1; + foreach (Primitive child in children) + { + child.SetRootParent(rootParent, newParent, oldPos); + } + children.Clear(); + + } /// /// /// /// - public void SetRootParent(SceneObject newRoot) + public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition) { + LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); + oldPos += oldParentPosition; + this.isRootPrim = false; + this.m_Parent = newParent; + this.ParentID = newParent.LocalId; + newParent.AddToChildrenList(this); this.m_RootParent = newRoot; this.m_RootParent.AddChildToList(this); + this.Pos = oldPos; + Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); + axPos = this.m_Parent.rotation.Inverse() * axPos; + this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); + this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); + this.updateFlag = 1; foreach (Primitive child in children) { - child.SetRootParent(newRoot); + child.SetRootParent(newRoot, newParent, oldPos); } + children.Clear(); } public void AddOffsetToChildren(LLVector3 offset) @@ -229,6 +275,12 @@ namespace OpenSim.Region.Environment.Scenes } } + public void AddToChildrenList(Primitive prim) + { + this.children.Add(prim); + } + #endregion + #region Resizing/Scale public void ResizeGoup(LLVector3 scale) { @@ -252,6 +304,7 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + #region Position /// /// /// @@ -264,19 +317,73 @@ namespace OpenSim.Region.Environment.Scenes this.updateFlag = 2; } + public void UpdateSinglePosition(LLVector3 pos) + { + //Console.WriteLine("updating single prim position"); + if (this.isRootPrim) + { + LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); + LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); + LLVector3 diff = oldPos - newPos; + Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); + axDiff = this.rotation.Inverse() * axDiff; + diff.X = axDiff.x; + diff.Y = axDiff.y; + diff.Z = axDiff.z; + this.Pos = newPos; + + foreach (Primitive prim in this.children) + { + prim.m_pos += diff; + prim.updateFlag = 2; + } + this.updateFlag = 2; + } + else + { + LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); + this.m_pos = newPos; + this.updateFlag = 2; + } + } + + #endregion + + #region Rotation public void UpdateRotation(LLQuaternion rot) { - this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.updateFlag = 2; + } + + public void UpdateSingleRotation(LLQuaternion rot) + { + Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + Axiom.Math.Quaternion oldParentRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); + this.rotation = axRot; + foreach (Primitive prim in this.children) + { + Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); + axPos = oldParentRot * axPos; + axPos = axRot.Inverse() * axPos; + prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); + prim.rotation = prim.rotation * oldParentRot; + prim.rotation = prim.rotation * axRot.Inverse(); + prim.updateFlag = 2; + } this.updateFlag = 2; } public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) { - this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); this.Pos = pos; this.updateFlag = 2; } + #endregion + + #region Shape public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) { this.m_Shape.PathBegin = shapeBlock.PathBegin; @@ -299,6 +406,7 @@ namespace OpenSim.Region.Environment.Scenes this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; this.updateFlag = 1; } + #endregion #region Client Update Methods diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs index 4213a18..247ff87 100644 --- a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs +++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -using Axiom.MathLib; +using Axiom.Math; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 0927903..b3d9d15 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { - Console.WriteLine("Chat message"); + // Console.WriteLine("Chat message"); ScenePresence avatar = null; foreach (IClientAPI client in m_clientThreads.Values) { @@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes avatar = this.Avatars[client.AgentId]; // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); dis= (int)avatar.Pos.GetDistanceTo(fromPos); - Console.WriteLine("found avatar at " +dis); + //Console.WriteLine("found avatar at " +dis); } @@ -314,13 +314,27 @@ namespace OpenSim.Region.Environment.Scenes public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(objectID); + if (prim != null) + { + ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); + break; + } + } + } + /* if (this.Entities.ContainsKey(objectID)) { if (this.Entities[objectID] is SceneObject) { ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); } - } + }*/ } /// @@ -368,6 +382,23 @@ namespace OpenSim.Region.Environment.Scenes } } + public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.UpdateSinglePosition(pos); + break; + } + } + } + } + /// /// /// @@ -419,6 +450,29 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// + /// + public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.UpdateSingleRotation(rot); + break; + } + } + } + } + + /// + /// + /// + /// /// /// public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 838d722..0797566 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -453,8 +453,10 @@ namespace OpenSim.Region.Environment.Scenes client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; client.OnUpdatePrimRotation += this.UpdatePrimRotation; client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; + client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; client.OnUpdatePrimScale += this.UpdatePrimScale; client.OnUpdatePrimShape += this.UpdatePrimShape; client.OnRequestMapBlocks += this.RequestMapBlocks; diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 9a46fbf..00d7c63 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -178,8 +178,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - //this.Pos = pos; - this.rootPrimitive.Pos = pos; + this.rootPrimitive.Pos = pos ; this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 98fa2ed..14b7b2f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.IO; -using Axiom.MathLib; +using Axiom.Math; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Console; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 393796f..f133045 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -26,7 +26,7 @@ * */ using System.Collections.Generic; -using Axiom.MathLib; +using Axiom.Math; using OpenSim.Physics.Manager; namespace OpenSim.Region.Physics.BasicPhysicsPlugin diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 8c286e0..da3b560 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using Axiom.MathLib; +using Axiom.Math; namespace OpenSim.Physics.Manager { diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index b85c052..2780188 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -27,7 +27,7 @@ */ using System; using System.Collections.Generic; -using Axiom.MathLib; +using Axiom.Math; using Ode.NET; using OpenSim.Physics.Manager; @@ -197,7 +197,7 @@ namespace OpenSim.Region.Physics.OdePlugin Quaternion q1 =Quaternion.FromAngleAxis(1.5707f, new Vector3(1,0,0)); Quaternion q2 =Quaternion.FromAngleAxis(1.5707f, new Vector3(0,1,0)); - //Axiom.MathLib.Quaternion q3 = Axiom.MathLib.Quaternion.FromAngleAxis(3.14f, new Axiom.MathLib.Vector3(0, 0, 1)); + //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); q1 = q1 * q2; //q1 = q1 * q3; diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index a75e5c7..4c82549 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using OpenSim.Physics.Manager; using PhysXWrapper; -using Quaternion=Axiom.MathLib.Quaternion; +using Quaternion=Axiom.Math.Quaternion; namespace OpenSim.Region.Physics.PhysXPlugin { -- cgit v1.1 From 3c46e5b170991e41e8c82e25bae65cf46152b924 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 5 Jul 2007 00:09:45 +0000 Subject: * Added Java support back into Sugilite (although it still needs a calling host to be added). --- .../Environment/OpenSim.Region.Environment.csproj | 128 ++++-- .../OpenSim.Region.Environment.dll.build | 26 +- OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- .../Engines/CSharpEngine/CSharpScriptEngine.cs | 102 +++++ .../Scenes/scripting/Engines/CSharpScriptEngine.cs | 102 ----- .../Scenes/scripting/Engines/JScriptEngine.cs | 102 ----- .../Engines/JScriptEngine/JScriptEngine.cs | 102 +++++ .../scripting/Engines/JVMEngine/ClassInstance.cs | 45 ++ .../scripting/Engines/JVMEngine/ClassRecord.cs | 503 +++++++++++++++++++++ .../Scenes/scripting/Engines/JVMEngine/Heap.cs | 43 ++ .../scripting/Engines/JVMEngine/Interpreter.cs | 135 ++++++ .../Engines/JVMEngine/InterpreterLogic.cs | 427 +++++++++++++++++ .../Engines/JVMEngine/InterpreterMethods.cs | 96 ++++ .../Engines/JVMEngine/InterpreterReturn.cs | 40 ++ .../scripting/Engines/JVMEngine/MainMemory.cs | 45 ++ .../scripting/Engines/JVMEngine/MethodMemory.cs | 46 ++ .../Scenes/scripting/Engines/JVMEngine/Object.cs | 37 ++ .../scripting/Engines/JVMEngine/OpenSimJVM.cs | 176 +++++++ .../Scenes/scripting/Engines/JVMEngine/Stack.cs | 42 ++ .../scripting/Engines/JVMEngine/StackFrame.cs | 49 ++ .../Scenes/scripting/Engines/JVMEngine/Thread.cs | 120 +++++ .../Engines/JVMEngine/Types/ArrayReference.cs | 10 + .../scripting/Engines/JVMEngine/Types/BaseType.cs | 10 + .../Engines/JVMEngine/Types/ObjectReference.cs | 16 + .../Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | 10 + .../Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | 10 + .../JVMEngine/Types/PrimitiveTypes/Float.cs | 16 + .../Engines/JVMEngine/Types/PrimitiveTypes/Int.cs | 16 + .../Region/Environment/Scenes/scripting/Script.cs | 2 +- .../Environment/Scenes/scripting/ScriptAPI.cs | 25 + .../Environment/Scenes/scripting/ScriptInfo.cs | 6 +- .../Environment/Scenes/scripting/ScriptManager.cs | 2 +- 32 files changed, 2246 insertions(+), 245 deletions(-) create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassInstance.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassRecord.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Heap.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Interpreter.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterLogic.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterMethods.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterReturn.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MainMemory.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MethodMemory.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Object.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Stack.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/StackFrame.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs create mode 100644 OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index f5724dd..365c7ff 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {DCBA491C-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region.Environment @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region.Environment - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,36 +55,34 @@ False False 4 - - + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + Microsoft.JScript.dll False - + System.dll False - - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -100,55 +92,55 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Capabilities {39038E85-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -203,16 +195,82 @@ Code + + Code + Code Code - + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + Code - + Code @@ -223,4 +281,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index d4b163e..52d9a26 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -28,10 +28,32 @@ + - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 0797566..1f370c4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Types; using OpenSim.Physics.Manager; using OpenSim.Region.Caches; -using OpenSim.Region.Enviorment.Scripting; +using OpenSim.Region.Environment.Scripting; using OpenSim.Region.Terrain; using Caps=OpenSim.Region.Capabilities.Caps; using Timer=System.Timers.Timer; diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs new file mode 100644 index 0000000..9cb881a --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs @@ -0,0 +1,102 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Microsoft.CSharp; +using OpenSim.Framework.Console; + +namespace OpenSim.Region.Environment.Scripting +{ + public class CSharpScriptEngine : IScriptCompiler + { + public string FileExt() + { + return ".cs"; + } + + private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); + compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + MainLog.Instance.Error("Compile errors"); + foreach (CompilerError error in compilerResults.Errors) + { + MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + Dictionary scripts = new Dictionary(); + + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("IScript", true); + + if (testInterface != null) + { + IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string scriptName = "C#/" + script.getName(); + Console.WriteLine("Script: " + scriptName + " loaded."); + + if (!scripts.ContainsKey(scriptName)) + { + scripts.Add(scriptName, script); + } + else + { + scripts[scriptName] = script; + } + } + } + return scripts; + } + return null; + } + + public Dictionary compile(string filename) + { + CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); + return LoadDotNetScript(csharpProvider, filename); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs deleted file mode 100644 index 7928088..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Microsoft.CSharp; -using OpenSim.Framework.Console; - -namespace OpenSim.Region.Enviorment.Scripting -{ - public class CSharpScriptEngine : IScriptCompiler - { - public string FileExt() - { - return ".cs"; - } - - private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) - { - CompilerParameters compilerParams = new CompilerParameters(); - CompilerResults compilerResults; - compilerParams.GenerateExecutable = false; - compilerParams.GenerateInMemory = true; - compilerParams.IncludeDebugInformation = false; - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); - compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); - compilerParams.ReferencedAssemblies.Add("System.dll"); - - compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); - - if (compilerResults.Errors.Count > 0) - { - MainLog.Instance.Error("Compile errors"); - foreach (CompilerError error in compilerResults.Errors) - { - MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); - } - } - else - { - Dictionary scripts = new Dictionary(); - - foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) - { - Type testInterface = pluginType.GetInterface("IScript", true); - - if (testInterface != null) - { - IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); - - string scriptName = "C#/" + script.getName(); - Console.WriteLine("Script: " + scriptName + " loaded."); - - if (!scripts.ContainsKey(scriptName)) - { - scripts.Add(scriptName, script); - } - else - { - scripts[scriptName] = script; - } - } - } - return scripts; - } - return null; - } - - public Dictionary compile(string filename) - { - CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); - return LoadDotNetScript(csharpProvider, filename); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs deleted file mode 100644 index d9d6f7e..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Microsoft.JScript; -using OpenSim.Framework.Console; - -namespace OpenSim.Region.Enviorment.Scripting -{ - public class JScriptEngine : IScriptCompiler - { - public string FileExt() - { - return ".js"; - } - - private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) - { - CompilerParameters compilerParams = new CompilerParameters(); - CompilerResults compilerResults; - compilerParams.GenerateExecutable = false; - compilerParams.GenerateInMemory = true; - compilerParams.IncludeDebugInformation = false; - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); - compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); - compilerParams.ReferencedAssemblies.Add("System.dll"); - - compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); - - if (compilerResults.Errors.Count > 0) - { - MainLog.Instance.Error("Compile errors"); - foreach (CompilerError error in compilerResults.Errors) - { - MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); - } - } - else - { - Dictionary scripts = new Dictionary(); - - foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) - { - Type testInterface = pluginType.GetInterface("IScript", true); - - if (testInterface != null) - { - IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); - - string scriptName = "JS.NET/" + script.getName(); - Console.WriteLine("Script: " + scriptName + " loaded."); - - if (!scripts.ContainsKey(scriptName)) - { - scripts.Add(scriptName, script); - } - else - { - scripts[scriptName] = script; - } - } - } - return scripts; - } - return null; - } - - public Dictionary compile(string filename) - { - JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); - return LoadDotNetScript(jscriptProvider, filename); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs new file mode 100644 index 0000000..be1fe56 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs @@ -0,0 +1,102 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Microsoft.JScript; +using OpenSim.Framework.Console; + +namespace OpenSim.Region.Environment.Scripting +{ + public class JScriptEngine : IScriptCompiler + { + public string FileExt() + { + return ".js"; + } + + private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); + compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + MainLog.Instance.Error("Compile errors"); + foreach (CompilerError error in compilerResults.Errors) + { + MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + Dictionary scripts = new Dictionary(); + + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("IScript", true); + + if (testInterface != null) + { + IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string scriptName = "JS.NET/" + script.getName(); + Console.WriteLine("Script: " + scriptName + " loaded."); + + if (!scripts.ContainsKey(scriptName)) + { + scripts.Add(scriptName, script); + } + else + { + scripts[scriptName] = script; + } + } + } + return scripts; + } + return null; + } + + public Dictionary compile(string filename) + { + JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); + return LoadDotNetScript(jscriptProvider, filename); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassInstance.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassInstance.cs new file mode 100644 index 0000000..1d93197 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassInstance.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class ClassInstance : Object + { + public int size; + public Dictionary Fields = new Dictionary(); + + public ClassInstance() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassRecord.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassRecord.cs new file mode 100644 index 0000000..f4ab1a2 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/ClassRecord.cs @@ -0,0 +1,503 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class ClassRecord + { + private ushort _majorVersion; + private ushort _minorVersion; + private ushort _constantPoolCount; + private ushort _accessFlags; + private ushort _thisClass; + private ushort _supperClass; + private ushort _interfaceCount; + private ushort _fieldCount; + private ushort _methodCount; + //private ushort _attributeCount; + //private string _name; + public Dictionary StaticFields = new Dictionary(); + public PoolClass mClass; + + public List _constantsPool = new List(); + private List _methodsList = new List(); + private List _fieldList = new List(); + + public ClassRecord() + { + + } + + public ClassInstance CreateNewInstance() + { + return new ClassInstance(); + } + + public void LoadClassFromFile(string fileName) + { + Console.WriteLine("loading script " + fileName); + FileStream fs = File.OpenRead(fileName); + this.LoadClassFromBytes(ReadFully(fs)); + fs.Close(); + } + + public void LoadClassFromBytes(byte[] data) + { + int i = 0; + i += 4; + _minorVersion = (ushort)((data[i++] << 8) + data[i++] ); + _majorVersion = (ushort)((data[i++] << 8) + data[i++] ); + _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] ); + // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); + for (int count = 0; count < _constantPoolCount -1 ; count++) + { + //read in the constant pool + byte pooltype = data[i++]; + //Console.WriteLine("#" +count +": new constant type = " +pooltype); + //Console.WriteLine("start position is: " + i); + switch (pooltype) + { + case 1: //Utf8 + ushort uLength = (ushort)((data[i++] << 8) + data[i++] ); + + // Console.WriteLine("new utf8 type, length is " + uLength); + PoolUtf8 utf8 = new PoolUtf8(); + utf8.readValue(data, ref i, uLength); + this._constantsPool.Add(utf8); + break; + case 3: //Int + break; + case 7: //Class + PoolClass pClass = new PoolClass(this); + pClass.readValue(data, ref i); + this._constantsPool.Add(pClass); + break; + case 10: //Method + PoolMethodRef pMeth = new PoolMethodRef(this); + pMeth.readValue(data, ref i); + this._constantsPool.Add(pMeth); + break; + case 12: //NamedType + PoolNamedType pNamed = new PoolNamedType(this); + pNamed.readValue(data, ref i); + this._constantsPool.Add(pNamed); + break; + } + } + + _accessFlags = (ushort)((data[i++] << 8) + data[i++] ); + _thisClass = (ushort)((data[i++] << 8) + data[i++] ); + _supperClass = (ushort)((data[i++] << 8) + data[i++] ); + + if (this._constantsPool[this._thisClass - 1] is PoolClass) + { + this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]); + } + + _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); + //should now read in the info for each interface + _fieldCount = (ushort)((data[i++] << 8) + data[i++]); + //should now read in the info for each field + _methodCount = (ushort)((data[i++] << 8) + data[i++]); + for (int count = 0; count < _methodCount; count++) + { + MethodInfo methInf = new MethodInfo(this); + methInf.ReadData(data, ref i); + this._methodsList.Add(methInf); + } + } + + public void AddMethodsToMemory(MethodMemory memory) + { + for (int count = 0; count < _methodCount; count++) + { + this._methodsList[count].AddMethodCode(memory); + } + } + + public bool StartMethod(Thread thread, string methodName) + { + for (int count = 0; count < _methodCount; count++) + { + if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8) + { + if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName) + { + //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); + thread.SetPC(this._methodsList[count].CodePointer); + return true; + } + } + } + return false; + } + + public void PrintToConsole() + { + Console.WriteLine("Class File:"); + Console.WriteLine("Major version: " + _majorVersion); + Console.WriteLine("Minor version: " + _minorVersion); + Console.WriteLine("Pool size: " + _constantPoolCount); + + for (int i = 0; i < _constantsPool.Count; i++) + { + this._constantsPool[i].Print(); + } + + Console.WriteLine("Access flags: " + _accessFlags); + Console.WriteLine("This class: " + _thisClass ); + Console.WriteLine("Super class: " + _supperClass); + + for (int count = 0; count < _methodCount; count++) + { + Console.WriteLine(); + this._methodsList[count].Print(); + } + + Console.WriteLine("class name is " + this.mClass.Name.Value); + } + + public static byte[] ReadFully(Stream stream) + { + byte[] buffer = new byte[1024]; + using (MemoryStream ms = new MemoryStream()) + { + while (true) + { + int read = stream.Read(buffer, 0, buffer.Length); + if (read <= 0) + return ms.ToArray(); + ms.Write(buffer, 0, read); + } + } + } + + #region nested classes + public class PoolItem + { + public virtual void Print() + { + + } + } + + public class PoolUtf8 : PoolItem + { + public string Value = ""; + + public void readValue(byte[] data,ref int pointer , int length) + { + for (int i = 0; i < length; i++) + { + int a =(int) data[pointer++]; + if ((a & 0x80) == 0) + { + Value = Value + (char)a; + } + else if ((a & 0x20) == 0) + { + int b = (int) data[pointer++]; + Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); + } + else + { + int b = (int)data[pointer++]; + int c = (int)data[pointer++]; + Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); + } + } + } + + public override void Print() + { + Console.WriteLine("Utf8 type: " + Value); + } + } + + private class PoolInt : PoolItem + { + + } + + public class PoolClass : PoolItem + { + //public string name = ""; + public ushort namePointer = 0; + private ClassRecord parent; + public PoolUtf8 Name; + + public PoolClass(ClassRecord paren) + { + parent = paren; + } + + public void readValue(byte[] data, ref int pointer) + { + namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); + } + + public override void Print() + { + this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); + Console.Write("Class type: " + namePointer); + Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); + + } + } + + public class PoolMethodRef : PoolItem + { + public ushort classPointer = 0; + public ushort nameTypePointer = 0; + public PoolNamedType mNameType; + public PoolClass mClass; + private ClassRecord parent; + + public PoolMethodRef(ClassRecord paren) + { + parent = paren; + } + + public void readValue(byte[] data, ref int pointer) + { + classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); + nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); + } + + public override void Print() + { + this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); + this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); + Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); + } + } + + public class PoolNamedType : PoolItem + { + public ushort namePointer = 0; + public ushort typePointer = 0; + private ClassRecord parent; + public PoolUtf8 Name; + public PoolUtf8 Type; + + public PoolNamedType(ClassRecord paren) + { + parent = paren; + } + + public void readValue(byte[] data, ref int pointer) + { + namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); + typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); + } + + public override void Print() + { + Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]); + Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]); + Console.Write("Named type: " + namePointer + " , " + typePointer ); + Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value); + } + } + + //*********************** + public class MethodInfo + { + public ushort AccessFlags = 0; + public ushort NameIndex = 0; + public string Name = ""; + public ushort DescriptorIndex = 0; + public ushort AttributeCount = 0; + public List Attributes = new List(); + private ClassRecord parent; + public int CodePointer = 0; + + public MethodInfo(ClassRecord paren) + { + parent = paren; + } + + public void AddMethodCode(MethodMemory memory) + { + Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); + memory.Methodcount++; + this.CodePointer = memory.NextMethodPC; + memory.NextMethodPC += this.Attributes[0].Code.Length; + } + + public void ReadData(byte[] data, ref int pointer) + { + AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); + NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); + DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); + AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); + for(int i =0; i< AttributeCount; i++) + { + MethodAttribute attri = new MethodAttribute(this.parent); + attri.ReadData(data, ref pointer); + this.Attributes.Add(attri); + } + } + + public void Print() + { + Console.WriteLine("Method Info Struct: "); + Console.WriteLine("AccessFlags: " + AccessFlags); + Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); + Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value); + Console.WriteLine("Attribute Count:" + AttributeCount); + for (int i = 0; i < AttributeCount; i++) + { + this.Attributes[i].Print(); + } + } + + public class MethodAttribute + { + public ushort NameIndex = 0; + public string Name = ""; + public Int32 Length = 0; + //for now only support code attribute + public ushort MaxStack = 0; + public ushort MaxLocals = 0; + public Int32 CodeLength = 0; + public byte[] Code; + public ushort ExceptionTableLength = 0; + public ushort SubAttributeCount = 0; + public List SubAttributes = new List(); + private ClassRecord parent; + + public MethodAttribute(ClassRecord paren) + { + parent = paren; + } + + public void ReadData(byte[] data, ref int pointer) + { + NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); + Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); + MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); + MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); + CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); + Code = new byte[CodeLength]; + for (int i = 0; i < CodeLength; i++) + { + Code[i] = data[pointer++]; + } + ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); + SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); + for (int i = 0; i < SubAttributeCount; i++) + { + SubAttribute subAttri = new SubAttribute(this.parent); + subAttri.ReadData(data, ref pointer); + this.SubAttributes.Add(subAttri); + } + } + + public void Print() + { + Console.WriteLine("Method Attribute: "); + Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); + Console.WriteLine("Length: " + Length); + Console.WriteLine("MaxStack: " + MaxStack); + Console.WriteLine("MaxLocals: " + MaxLocals); + Console.WriteLine("CodeLength: " + CodeLength); + for (int i = 0; i < Code.Length; i++) + { + Console.WriteLine("OpCode #" + i + " is: " + Code[i]); + } + Console.WriteLine("SubAttributes: " + SubAttributeCount); + for (int i = 0; i < SubAttributeCount; i++) + { + this.SubAttributes[i].Print(); + } + } + + public class SubAttribute + { + public ushort NameIndex = 0; + public string Name = ""; + public Int32 Length = 0; + public byte[] Data; + private ClassRecord parent; + + public SubAttribute(ClassRecord paren) + { + parent = paren; + } + + public void ReadData(byte[] data, ref int pointer) + { + NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); + Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); + Data = new byte[Length]; + for (int i = 0; i < Length; i++) + { + Data[i] = data[pointer++]; + } + } + + public void Print() + { + Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); + } + + } + } + + } + private class InterfaceInfo + { + public void ReadData(byte[] data, ref int i) + { + + } + } + private class FieldInfo + { + public void ReadData(byte[] data, ref int i) + { + + } + } + private class AttributeInfo + { + public void ReadData(byte[] data, ref int i) + { + + } + } + #endregion + + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Heap.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Heap.cs new file mode 100644 index 0000000..f213c36 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Heap.cs @@ -0,0 +1,43 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class Heap + { + public List ClassObjects = new List(); + + public Heap() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Interpreter.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Interpreter.cs new file mode 100644 index 0000000..c5995b2 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Interpreter.cs @@ -0,0 +1,135 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; +using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + partial class Thread + { + private partial class Interpreter + { + private Thread _mThread; + + public Interpreter(Thread parentThread) + { + _mThread = parentThread; + } + + public bool Excute() + { + bool run = true; + byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++]; + // Console.WriteLine("opCode is: " + currentOpCode); + bool handled = false; + + handled = this.IsLogicOpCode(currentOpCode); + if (!handled) + { + handled = this.IsMethodOpCode(currentOpCode); + } + if (!handled) + { + if (currentOpCode == 172) + { + if (this._mThread.stack.StackFrames.Count > 1) + { + Console.WriteLine("returning int from function"); + int retPC1 = this._mThread.currentFrame.ReturnPC; + BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); + this._mThread.stack.StackFrames.Pop(); + this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); + this._mThread.PC = retPC1; + if (bas1 is Int) + { + this._mThread.currentFrame.OpStack.Push((Int)bas1); + } + } + else + { + // Console.WriteLine("No parent function so ending program"); + this._mThread.stack.StackFrames.Pop(); + run = false; + } + handled = true; + } + if (currentOpCode == 174) + { + if (this._mThread.stack.StackFrames.Count > 1) + { + Console.WriteLine("returning float from function"); + int retPC1 = this._mThread.currentFrame.ReturnPC; + BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); + this._mThread.stack.StackFrames.Pop(); + this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); + this._mThread.PC = retPC1; + if (bas1 is Float) + { + this._mThread.currentFrame.OpStack.Push((Float)bas1); + } + } + else + { + // Console.WriteLine("No parent function so ending program"); + this._mThread.stack.StackFrames.Pop(); + run = false; + } + handled = true; + } + if (currentOpCode == 177) + { + if (this._mThread.stack.StackFrames.Count > 1) + { + Console.WriteLine("returning from function"); + int retPC = this._mThread.currentFrame.ReturnPC; + this._mThread.stack.StackFrames.Pop(); + this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); + this._mThread.PC = retPC; + } + else + { + // Console.WriteLine("No parent function so ending program"); + this._mThread.stack.StackFrames.Pop(); + run = false; + } + handled = true; + } + } + if (!handled) + { + Console.WriteLine("opcode " + currentOpCode + " not been handled "); + } + return run; + + } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterLogic.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterLogic.cs new file mode 100644 index 0000000..2a11afd --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterLogic.cs @@ -0,0 +1,427 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; +using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + partial class Thread + { + private partial class Interpreter + { + private bool IsLogicOpCode(byte opcode) + { + bool result = false; + switch (opcode) + { + case 2: + Int m_int= new Int(); + m_int.mValue = -1; + this._mThread.currentFrame.OpStack.Push(m_int); + result = true; + break; + case 3: + m_int= new Int(); + m_int.mValue = 0; + this._mThread.currentFrame.OpStack.Push(m_int); + result = true; + break; + case 4: + m_int = new Int(); + m_int.mValue = 1; + this._mThread.currentFrame.OpStack.Push(m_int); + result = true; + break; + case 5: + m_int = new Int(); + m_int.mValue = 2; + this._mThread.currentFrame.OpStack.Push(m_int); + result = true; + break; + case 6: + m_int = new Int(); + m_int.mValue = 3; + this._mThread.currentFrame.OpStack.Push(m_int); + break; + case 7: + m_int = new Int(); + m_int.mValue = 4; + this._mThread.currentFrame.OpStack.Push(m_int); + result = true; + break; + case 8: + m_int = new Int(); + m_int.mValue = 5; + this._mThread.currentFrame.OpStack.Push(m_int); + result = true; + break; + case 11: + Float m_float = new Float(); + m_float.mValue = 0.0f; + this._mThread.currentFrame.OpStack.Push(m_float); + result = true; + break; + case 12: + m_float = new Float(); + m_float.mValue = 1.0f; + this._mThread.currentFrame.OpStack.Push(m_float); + result = true; + break; + case 13: + m_float = new Float(); + m_float.mValue = 2.0f; + this._mThread.currentFrame.OpStack.Push(m_float); + result = true; + break; + case 16: + int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; + Int pushInt = new Int(); + pushInt.mValue = pushvalue; + this._mThread.currentFrame.OpStack.Push(pushInt); + this._mThread.PC++; + result = true; + break; + case 17: + short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); + Int pushInt2 = new Int(); + pushInt2.mValue = pushvalue2; + this._mThread.currentFrame.OpStack.Push(pushInt2); + this._mThread.PC += 2; + result = true; + break; + case 23: + short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); + Float fload = new Float(); + if (this._mThread.currentFrame.LocalVariables[findex1] != null) + { + if (this._mThread.currentFrame.LocalVariables[findex1] is Float) + { + fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; + this._mThread.currentFrame.OpStack.Push(fload); + } + } + this._mThread.PC++; + result = true; + break; + case 26: + if (this._mThread.currentFrame.LocalVariables[0] != null) + { + if (this._mThread.currentFrame.LocalVariables[0] is Int) + { + Int newInt = new Int(); + newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; + this._mThread.currentFrame.OpStack.Push(newInt); + } + } + result = true; + break; + case 27: + if (this._mThread.currentFrame.LocalVariables[1] != null) + { + if (this._mThread.currentFrame.LocalVariables[1] is Int) + { + Int newInt = new Int(); + newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; + this._mThread.currentFrame.OpStack.Push(newInt); + } + } + result = true; + break; + case 34: + if (this._mThread.currentFrame.LocalVariables[0] != null) + { + if (this._mThread.currentFrame.LocalVariables[0] is Float) + { + Float newfloat = new Float(); + newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; + this._mThread.currentFrame.OpStack.Push(newfloat); + } + } + result = true; + break; + case 35: + if (this._mThread.currentFrame.LocalVariables[1] != null) + { + if (this._mThread.currentFrame.LocalVariables[1] is Float) + { + Float newfloat = new Float(); + newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; + this._mThread.currentFrame.OpStack.Push(newfloat); + } + } + result = true; + break; + case 36: + if (this._mThread.currentFrame.LocalVariables[2] != null) + { + if (this._mThread.currentFrame.LocalVariables[2] is Float) + { + Float newfloat = new Float(); + newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; + this._mThread.currentFrame.OpStack.Push(newfloat); + } + } + result = true; + break; + case 37: + if (this._mThread.currentFrame.LocalVariables[3] != null) + { + if (this._mThread.currentFrame.LocalVariables[3] is Float) + { + Float newfloat = new Float(); + newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; + this._mThread.currentFrame.OpStack.Push(newfloat); + } + } + result = true; + break; + case 56: + short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); + BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); + if (fstor is Float) + { + this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; + } + this._mThread.PC++; + result = true; + break; + case 59: + BaseType baset = this._mThread.currentFrame.OpStack.Pop(); + if (baset is Int) + { + this._mThread.currentFrame.LocalVariables[0] = (Int)baset; + } + result = true; + break; + case 60: + baset = this._mThread.currentFrame.OpStack.Pop(); + if (baset is Int) + { + this._mThread.currentFrame.LocalVariables[1] = (Int)baset; + } + result = true; + break; + case 67: + baset = this._mThread.currentFrame.OpStack.Pop(); + if (baset is Float) + { + this._mThread.currentFrame.LocalVariables[0] = (Float)baset; + } + result = true; + break; + case 68: + baset = this._mThread.currentFrame.OpStack.Pop(); + if (baset is Float) + { + this._mThread.currentFrame.LocalVariables[1] = (Float)baset; + } + result = true; + break; + case 69: + baset = this._mThread.currentFrame.OpStack.Pop(); + if (baset is Float) + { + this._mThread.currentFrame.LocalVariables[2] = (Float)baset; + } + result = true; + break; + case 70: + baset = this._mThread.currentFrame.OpStack.Pop(); + if (baset is Float) + { + this._mThread.currentFrame.LocalVariables[3] = (Float)baset; + } + result = true; + break; + case 87: + this._mThread.currentFrame.OpStack.Pop(); + result = true; + break; + case 98: + BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); + BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); + if (bf1 is Float && bf2 is Float) + { + Float nflt = new Float(); + nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; + this._mThread.currentFrame.OpStack.Push(nflt); + } + result = true; + break; + case 102: + BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); + BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); + if (bsf1 is Float && bsf2 is Float) + { + Float resf = new Float(); + resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; + this._mThread.currentFrame.OpStack.Push(resf); + } + result = true; + break; + case 104: //check the order of the two values off the stack is correct + BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); + BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); + if (bs1 is Int && bs2 is Int) + { + Int nInt = new Int(); + nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; + this._mThread.currentFrame.OpStack.Push(nInt); + } + result = true; + break; + case 132: + if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) + { + if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) + { + ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; + } + } + this._mThread.PC += 2; + result = true; + break; + case 139: + BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); + if (conv1 is Float) + { + Int newconv = new Int(); + newconv.mValue = (int)((Float)conv1).mValue; + this._mThread.currentFrame.OpStack.Push(newconv); + } + result = true; + break; + case 149: + BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); + BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); + if (flcom1 is Float && flcom2 is Float) + { + Int compres = new Int(); + if (((Float)flcom1).mValue < ((Float)flcom2).mValue) + { + compres.mValue = -1; + } + else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) + { + compres.mValue = 1; + } + else + { + compres.mValue = 0; + } + this._mThread.currentFrame.OpStack.Push(compres); + } + result = true; + break; + case 158: + short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); + BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); + if (comp1 is Int) + { + if (((Int)comp1).mValue <= 0) + { + this._mThread.PC += -1 + compareoffset1; + } + else + { + this._mThread.PC += 2; + } + } + else + { + this._mThread.PC += 2; + } + result = true; + break; + case 162: + short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); + BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); + BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); + if (bc1 is Int && bc2 is Int) + { + //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); + if (((Int)bc1).mValue >= ((Int)bc2).mValue) + { + // Console.WriteLine("branch compare true , offset is " +compareoffset); + // Console.WriteLine("current PC is " + this._mThread.PC); + this._mThread.PC += -1 + compareoffset; + //Console.WriteLine("new PC is " + this._mThread.PC); + } + else + { + //Console.WriteLine("branch compare false"); + this._mThread.PC += 2; + } + } + else + { + this._mThread.PC += 2; + } + result = true; + break; + case 164: + short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); + BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); + BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); + if (bcl1 is Int && bcl2 is Int) + { + //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); + if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) + { + // Console.WriteLine("branch compare true , offset is " + compareloffset); + // Console.WriteLine("current PC is " + this._mThread.PC); + this._mThread.PC += -1 + compareloffset; + // Console.WriteLine("new PC is " + this._mThread.PC); + } + else + { + //Console.WriteLine("branch compare false"); + this._mThread.PC += 2; + } + } + else + { + this._mThread.PC += 2; + } + result = true; + break; + case 167: + short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); + this._mThread.PC += -1 + offset; + result = true; + break; + } + + return result; + } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterMethods.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterMethods.cs new file mode 100644 index 0000000..4d60559 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterMethods.cs @@ -0,0 +1,96 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; +using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Types; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + partial class Thread + { + private partial class Interpreter + { + private bool IsMethodOpCode(byte opcode) + { + bool result = false; + switch (opcode) + { + case 184: + short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); + if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) + { + string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value; + string typeparam = ""; + string typereturn = ""; + int firstbrak = 0; + int secondbrak = 0; + firstbrak = typ.LastIndexOf('('); + secondbrak = typ.LastIndexOf(')'); + typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); + typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); + if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) + { + //calling a method in this class + if (typeparam.Length == 0) + { + this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2)); + } + else + { + this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2)); + } + } + else + { + //calling a method of a different class + + // OpenSimAPI Class + if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") + { + this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null); + } + } + } + else + { + this._mThread.PC += 2; + } + result = true; + break; + } + + return result; + } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterReturn.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterReturn.cs new file mode 100644 index 0000000..cbedb71 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/InterpreterReturn.cs @@ -0,0 +1,40 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + partial class Thread + { + private partial class Interpreter + { + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MainMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MainMemory.cs new file mode 100644 index 0000000..97d9fb6 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MainMemory.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class MainMemory + { + public Heap HeapArea; + public MethodMemory MethodArea; + + public MainMemory() + { + MethodArea = new MethodMemory(); + HeapArea = new Heap(); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MethodMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MethodMemory.cs new file mode 100644 index 0000000..7e938b4 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/MethodMemory.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class MethodMemory + { + public byte[] MethodBuffer; + public List Classes = new List(); + public int NextMethodPC = 0; + public int Methodcount = 0; + + public MethodMemory() + { + MethodBuffer = new byte[20000]; + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Object.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Object.cs new file mode 100644 index 0000000..2c3bedd --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Object.cs @@ -0,0 +1,37 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class Object + { + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs new file mode 100644 index 0000000..7ed734b --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs @@ -0,0 +1,176 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Utilities; +using OpenSim.Region.Environment.Scripting; +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class OpenSimJVM : IScript + { + private List _threads = new List(); + private BlockingQueue CompileScripts = new BlockingQueue(); + private MainMemory _mainMemory; + private System.Threading.Thread compileThread; + + ScriptInfo scriptInfo; + + public OpenSimJVM() + { + + } + + public void Initialise(ScriptInfo info) + { + scriptInfo = info; + } + + public string getName() + { + return "JVM Scripting Engine"; + } + + public bool Init(Scene world) + { + Console.WriteLine("Creating OpenSim JVM scripting engine"); + _mainMemory = new MainMemory(); + Thread.GlobalMemory = this._mainMemory; + Thread.World = world; + compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); + compileThread.IsBackground = true; + compileThread.Start(); + return true; + } + + public string GetName() + { + return "OpenSimJVM"; + } + + public void LoadScript(string script, string scriptName, uint entityID) + { + Console.WriteLine("OpenSimJVM - loading new script: " + scriptName); + CompileInfo comp = new CompileInfo(); + comp.entityId = entityID; + comp.script = script; + comp.scriptName = scriptName; + this.CompileScripts.Enqueue(comp); + } + + public void CompileScript() + { + while (true) + { + CompileInfo comp = this.CompileScripts.Dequeue(); + string script = comp.script; + string scriptName = comp.scriptName; + uint entityID = comp.entityId; + try + { + //need to compile the script into a java class file + + //first save it to a java source file + TextWriter tw = new StreamWriter(scriptName + ".java"); + tw.WriteLine(script); + tw.Close(); + + //now compile + System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); + // psi.RedirectStandardOutput = true; + psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + psi.UseShellExecute = false; + + System.Diagnostics.Process javacomp; + javacomp = System.Diagnostics.Process.Start(psi); + javacomp.WaitForExit(); + + + //now load in class file + ClassRecord class1 = new ClassRecord(); + class1.LoadClassFromFile(scriptName + ".class"); + class1.PrintToConsole(); + //Console.WriteLine(); + this._mainMemory.MethodArea.Classes.Add(class1); + class1.AddMethodsToMemory(this._mainMemory.MethodArea); + + Thread newThread = new Thread(); + this._threads.Add(newThread); + newThread.EntityId = entityID; + newThread.currentClass = class1; + newThread.scriptInfo = scriptInfo; + + //now delete the created files + System.IO.File.Delete(scriptName + ".java"); + System.IO.File.Delete(scriptName + ".class"); + //this.OnFrame(); + } + catch (Exception e) + { + Console.WriteLine("exception"); + Console.WriteLine(e.StackTrace); + Console.WriteLine(e.Message); + } + } + } + + public void OnFrame() + { + for (int i = 0; i < this._threads.Count; i++) + { + if (!this._threads[i].running) + { + this._threads[i].StartMethod("OnFrame"); + bool run = true; + while (run) + { + run = this._threads[i].Excute(); + } + } + } + } + + private class CompileInfo + { + public string script; + public string scriptName; + public uint entityId; + + public CompileInfo() + { + + } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Stack.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Stack.cs new file mode 100644 index 0000000..69a274c --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Stack.cs @@ -0,0 +1,42 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class Stack + { + public Stack StackFrames = new Stack(); + + public Stack() + { + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/StackFrame.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/StackFrame.cs new file mode 100644 index 0000000..3a2b58a --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/StackFrame.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public class StackFrame + { + public BaseType[] LocalVariables; + public Stack OpStack = new Stack(); + + public int ReturnPC = 0; + public ClassRecord CallingClass = null; + + public StackFrame() + { + LocalVariables = new BaseType[20]; + } + + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs new file mode 100644 index 0000000..806f833 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs @@ -0,0 +1,120 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Scripting.EmbeddedJVM.Types; +using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Scripting; + +namespace OpenSim.Scripting.EmbeddedJVM +{ + public partial class Thread + { + // Is this smart? + public static MainMemory GlobalMemory; + public static Scene World; + private int PC = 0; + private Stack stack; + private Interpreter mInterpreter; + public ClassRecord currentClass; + public ClassInstance currentInstance; + private StackFrame currentFrame; + public int excutionCounter = 0; + public bool running = false; + public uint EntityId = 0; + + public ScriptInfo scriptInfo; + + public Thread() + { + this.mInterpreter = new Interpreter(this); + this.stack = new Stack(); + } + + public void SetPC(int methodpointer) + { + //Console.WriteLine("Thread PC has been set to " + methodpointer); + PC = methodpointer; + } + + public void StartMethod(ClassRecord rec, string methName) + { + currentFrame = new StackFrame(); + this.stack.StackFrames.Push(currentFrame); + this.currentClass = rec; + currentClass.StartMethod(this, methName); + } + + public void StartMethod( string methName) + { + currentFrame = new StackFrame(); + this.stack.StackFrames.Push(currentFrame); + currentClass.StartMethod(this, methName); + } + + public void JumpToStaticVoidMethod(string methName, int returnPC) + { + currentFrame = new StackFrame(); + currentFrame.ReturnPC = returnPC; + this.stack.StackFrames.Push(currentFrame); + currentClass.StartMethod(this, methName); + } + + public void JumpToStaticParamMethod(string methName, string param, int returnPC) + { + if (param == "I") + { + BaseType bs1 = currentFrame.OpStack.Pop(); + currentFrame = new StackFrame(); + currentFrame.ReturnPC = returnPC; + this.stack.StackFrames.Push(currentFrame); + currentFrame.LocalVariables[0] = ((Int)bs1); + currentClass.StartMethod(this, methName); + } + if (param == "F") + { + + } + } + + public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) + { + + } + + public bool Excute() + { + excutionCounter++; + return this.mInterpreter.Excute(); + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs new file mode 100644 index 0000000..2854eab --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types +{ + public class ArrayReference :BaseType + { + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs new file mode 100644 index 0000000..270aa7b --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types +{ + public class BaseType : Object + { + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs new file mode 100644 index 0000000..da28eaa --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types +{ + public class ObjectReference : BaseType + { + public ushort Reference; + + public ObjectReference() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs new file mode 100644 index 0000000..1a3ecff --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes +{ + public class Byte : BaseType + { + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs new file mode 100644 index 0000000..19002d4 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes +{ + public class Char : BaseType + { + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs new file mode 100644 index 0000000..91f1679 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes +{ + public class Float : BaseType + { + public float mValue = 0; + + public Float() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs new file mode 100644 index 0000000..4ecd325 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes +{ + public class Int : BaseType + { + public int mValue = 0; + + public Int() + { + + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs index 8029883..139bdf1 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Script.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs @@ -27,7 +27,7 @@ */ using OpenSim.Region.Environment.Scenes; -namespace OpenSim.Region.Enviorment.Scripting +namespace OpenSim.Region.Environment.Scripting { public interface IScript { diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs new file mode 100644 index 0000000..fd601cb --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Region.Environment.Scripting +{ + // This class is to be used for engines which may not be able to access the Scene directly. + // Scene access is preffered, but obviously not possible on some non-.NET languages. + public class ScriptAPI + { + Scene scene; + + public ScriptAPI(Scene world) + { + scene = world; + } + + public Object CallMethod(String method, Object[] args) + { + return null; + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs index d984d60..ed6f033 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs @@ -28,7 +28,7 @@ using OpenSim.Framework.Console; using OpenSim.Region.Environment.Scenes; -namespace OpenSim.Region.Enviorment.Scripting +namespace OpenSim.Region.Environment.Scripting { /// /// Class which provides access to the world @@ -44,11 +44,15 @@ namespace OpenSim.Region.Enviorment.Scripting // The console public LogBase logger; + // API Access + public ScriptAPI api; + public ScriptInfo(Scene scene) { world = scene; events = world.eventManager; logger = MainLog.Instance; + api = new ScriptAPI(scene); } } } diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 1d47c24..250a4f0 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using OpenSim.Framework.Console; using OpenSim.Region.Environment.Scenes; -namespace OpenSim.Region.Enviorment.Scripting +namespace OpenSim.Region.Environment.Scripting { public class ScriptManager { -- cgit v1.1 From c570b107f890180bcaf5e5a030525af04feab1d4 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 5 Jul 2007 00:24:40 +0000 Subject: * Java engine fully back in Sugilite --- .../Environment/OpenSim.Region.Environment.csproj | 59 +++++++++++++--------- .../scripting/Engines/JVMEngine/JavaEngine.cs | 29 +++++++++++ .../scripting/Engines/JVMEngine/OpenSimJVM.cs | 31 ++++-------- .../Scenes/scripting/Engines/JVMEngine/Thread.cs | 1 - .../Environment/Scenes/scripting/ScriptManager.cs | 3 ++ 5 files changed, 75 insertions(+), 48 deletions(-) create mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 365c7ff..3b86468 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {DCBA491C-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Region.Environment @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Region.Environment - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,34 +61,36 @@ False False 4 - + + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + Microsoft.JScript.dll False - + System.dll False - + + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -92,55 +100,55 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Capabilities {39038E85-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -192,6 +200,7 @@ Code + Code @@ -281,4 +290,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs new file mode 100644 index 0000000..1773156 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Environment.Scripting; +using OpenSim.Scripting.EmbeddedJVM; + +namespace OpenSim.Region.Environment.Scripting +{ + public class JavaEngine : IScriptCompiler + { + public string FileExt() + { + return ".java"; + } + + public Dictionary compile(string filename) + { + JVMScript script = new JVMScript(); + Dictionary returns = new Dictionary(); + + script.LoadScript(filename); + + returns.Add(filename, script); + + return returns; + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs index 7ed734b..aaa1609 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs @@ -38,7 +38,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Scripting.EmbeddedJVM { - public class OpenSimJVM : IScript + public class JVMScript : IScript { private List _threads = new List(); private BlockingQueue CompileScripts = new BlockingQueue(); @@ -47,7 +47,7 @@ namespace OpenSim.Scripting.EmbeddedJVM ScriptInfo scriptInfo; - public OpenSimJVM() + public JVMScript() { } @@ -55,37 +55,27 @@ namespace OpenSim.Scripting.EmbeddedJVM public void Initialise(ScriptInfo info) { scriptInfo = info; - } - - public string getName() - { - return "JVM Scripting Engine"; - } - public bool Init(Scene world) - { - Console.WriteLine("Creating OpenSim JVM scripting engine"); _mainMemory = new MainMemory(); Thread.GlobalMemory = this._mainMemory; - Thread.World = world; + Thread.World = info.world; compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); compileThread.IsBackground = true; compileThread.Start(); - return true; + } - public string GetName() + public string getName() { - return "OpenSimJVM"; + return "JVM Scripting Engine"; } - public void LoadScript(string script, string scriptName, uint entityID) + public void LoadScript(string script) { - Console.WriteLine("OpenSimJVM - loading new script: " + scriptName); + Console.WriteLine("OpenSimJVM - loading new script: " + script); CompileInfo comp = new CompileInfo(); - comp.entityId = entityID; comp.script = script; - comp.scriptName = scriptName; + comp.scriptName = script; this.CompileScripts.Enqueue(comp); } @@ -96,7 +86,6 @@ namespace OpenSim.Scripting.EmbeddedJVM CompileInfo comp = this.CompileScripts.Dequeue(); string script = comp.script; string scriptName = comp.scriptName; - uint entityID = comp.entityId; try { //need to compile the script into a java class file @@ -127,7 +116,6 @@ namespace OpenSim.Scripting.EmbeddedJVM Thread newThread = new Thread(); this._threads.Add(newThread); - newThread.EntityId = entityID; newThread.currentClass = class1; newThread.scriptInfo = scriptInfo; @@ -165,7 +153,6 @@ namespace OpenSim.Scripting.EmbeddedJVM { public string script; public string scriptName; - public uint entityId; public CompileInfo() { diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs index 806f833..3993436 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs @@ -50,7 +50,6 @@ namespace OpenSim.Scripting.EmbeddedJVM private StackFrame currentFrame; public int excutionCounter = 0; public bool running = false; - public uint EntityId = 0; public ScriptInfo scriptInfo; diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 250a4f0..153f4d7 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -59,6 +59,9 @@ namespace OpenSim.Region.Environment.Scripting JScriptEngine jscriptCompiler = new JScriptEngine(); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); + + JavaEngine javaCompiler = new JavaEngine(); + compilers.Add(javaCompiler.FileExt(), javaCompiler); } public void Compile(string filename) -- cgit v1.1 From ad86e94b3d69b0f9d525758a7e00dab86e11970f Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 5 Jul 2007 04:23:34 +0000 Subject: * Tweaks to Java engine (uses less threads). Added support for OnFrame and OnNewPresence events. --- .../scripting/Engines/JVMEngine/OpenSimJVM.cs | 148 +++++++++++---------- 1 file changed, 78 insertions(+), 70 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs index aaa1609..3e083cc 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs @@ -47,11 +47,6 @@ namespace OpenSim.Scripting.EmbeddedJVM ScriptInfo scriptInfo; - public JVMScript() - { - - } - public void Initialise(ScriptInfo info) { scriptInfo = info; @@ -59,81 +54,29 @@ namespace OpenSim.Scripting.EmbeddedJVM _mainMemory = new MainMemory(); Thread.GlobalMemory = this._mainMemory; Thread.World = info.world; - compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); - compileThread.IsBackground = true; - compileThread.Start(); + CompileScript(); + scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); + scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); } - public string getName() + void events_OnNewPresence(ScenePresence presence) { - return "JVM Scripting Engine"; - } - - public void LoadScript(string script) - { - Console.WriteLine("OpenSimJVM - loading new script: " + script); - CompileInfo comp = new CompileInfo(); - comp.script = script; - comp.scriptName = script; - this.CompileScripts.Enqueue(comp); - } - - public void CompileScript() - { - while (true) + for (int i = 0; i < this._threads.Count; i++) { - CompileInfo comp = this.CompileScripts.Dequeue(); - string script = comp.script; - string scriptName = comp.scriptName; - try - { - //need to compile the script into a java class file - - //first save it to a java source file - TextWriter tw = new StreamWriter(scriptName + ".java"); - tw.WriteLine(script); - tw.Close(); - - //now compile - System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); - // psi.RedirectStandardOutput = true; - psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - psi.UseShellExecute = false; - - System.Diagnostics.Process javacomp; - javacomp = System.Diagnostics.Process.Start(psi); - javacomp.WaitForExit(); - - - //now load in class file - ClassRecord class1 = new ClassRecord(); - class1.LoadClassFromFile(scriptName + ".class"); - class1.PrintToConsole(); - //Console.WriteLine(); - this._mainMemory.MethodArea.Classes.Add(class1); - class1.AddMethodsToMemory(this._mainMemory.MethodArea); - - Thread newThread = new Thread(); - this._threads.Add(newThread); - newThread.currentClass = class1; - newThread.scriptInfo = scriptInfo; - - //now delete the created files - System.IO.File.Delete(scriptName + ".java"); - System.IO.File.Delete(scriptName + ".class"); - //this.OnFrame(); - } - catch (Exception e) + if (!this._threads[i].running) { - Console.WriteLine("exception"); - Console.WriteLine(e.StackTrace); - Console.WriteLine(e.Message); + this._threads[i].StartMethod("OnNewPresence"); + bool run = true; + while (run) + { + run = this._threads[i].Excute(); + } } } } - public void OnFrame() + void events_OnFrame() { for (int i = 0; i < this._threads.Count; i++) { @@ -149,6 +92,71 @@ namespace OpenSim.Scripting.EmbeddedJVM } } + public string getName() + { + return "JVM Scripting Engine"; + } + + public void LoadScript(string script) + { + Console.WriteLine("OpenSimJVM - loading new script: " + script); + CompileInfo comp = new CompileInfo(); + comp.script = script; + comp.scriptName = script; + this.CompileScripts.Enqueue(comp); + } + + public void CompileScript() + { + CompileInfo comp = this.CompileScripts.Dequeue(); + string script = comp.script; + string scriptName = comp.scriptName; + try + { + //need to compile the script into a java class file + + //first save it to a java source file + TextWriter tw = new StreamWriter(scriptName + ".java"); + tw.WriteLine(script); + tw.Close(); + + //now compile + System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); + // psi.RedirectStandardOutput = true; + psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + psi.UseShellExecute = false; + + System.Diagnostics.Process javacomp; + javacomp = System.Diagnostics.Process.Start(psi); + javacomp.WaitForExit(); + + + //now load in class file + ClassRecord class1 = new ClassRecord(); + class1.LoadClassFromFile(scriptName + ".class"); + class1.PrintToConsole(); + //Console.WriteLine(); + this._mainMemory.MethodArea.Classes.Add(class1); + class1.AddMethodsToMemory(this._mainMemory.MethodArea); + + Thread newThread = new Thread(); + this._threads.Add(newThread); + newThread.currentClass = class1; + newThread.scriptInfo = scriptInfo; + + //now delete the created files + System.IO.File.Delete(scriptName + ".java"); + System.IO.File.Delete(scriptName + ".class"); + //this.OnFrame(); + } + catch (Exception e) + { + Console.WriteLine("exception"); + Console.WriteLine(e.StackTrace); + Console.WriteLine(e.Message); + } + } + private class CompileInfo { public string script; -- cgit v1.1 From 583f2a9de8e503773a427facd5f81a82b40bd585 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 5 Jul 2007 15:15:28 +0000 Subject: *Removed SimProfile.cs as it is no longer needed (in favor of SimProfileData) *Added simulator_data_request XMLRPC method to request data from the grid server about a sim instead of faking its login *Login is progressing, now just getting an XML error (http://pastebin.com/942515) -- if you can fix this, throw MingChen in IRC a Private Message --- OpenSim/Region/Application/OpenSim.csproj | 6 +++--- OpenSim/Region/Application/OpenSim.exe.build | 2 +- OpenSim/Region/Application/OpenSimMain.cs | 2 +- .../ClientStack/OpenSim.Region.ClientStack.csproj | 18 +++++++++--------- .../ClientStack/OpenSim.Region.ClientStack.dll.build | 12 ++++++------ .../Local/OpenSim.Region.Communications.Local.csproj | 6 +++--- .../OpenSim.Region.Communications.Local.dll.build | 2 +- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 3 ++- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 6 +++--- .../OGS1/OpenSim.Region.Communications.OGS1.dll.build | 4 ++-- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 4 ++-- OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build | 2 +- .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +++--- .../OpenSim.Region.Storage.LocalStorageDb4o.dll.build | 2 +- 14 files changed, 38 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index bec85cc..f5da23d 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -170,13 +170,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build index 6c7d7ac..9890cfa 100644 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -11,9 +11,9 @@ + - diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e2486bd..c5c9efc 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -481,4 +481,4 @@ namespace OpenSim } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 3093eb0..2e1d8e2 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,34 +122,34 @@ - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index f76a4c8..1c791d3 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -11,16 +11,16 @@ - - - + + + + - - - + + diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index 0a15a49..f9f6b7d 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,13 +98,13 @@ - + Code - + Code - + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build index 3cac9d3..bfefabf 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -11,9 +11,9 @@ + - diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 99e9c96..e8ed7f4 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.Communications.OGS1 GridParams["authkey"] = serversInfo.GridSendKey; GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); - GridParams["sim_ip"] = regionInfo.InternalEndPoint.Address.ToString(); + GridParams["sim_ip"] = regionInfo.ExternalHostName; GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); @@ -166,6 +166,7 @@ namespace OpenSim.Region.Communications.OGS1 // Grid Request Processing public XmlRpcResponse ExpectUser(XmlRpcRequest request) { + Console.WriteLine("Expecting User..."); Hashtable requestData = (Hashtable)request.Params[0]; AgentCircuitData agentData = new AgentCircuitData(); agentData.SessionID = new LLUUID((string)requestData["session_id"]); diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index d6abd13..390326e 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,16 +116,16 @@ - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 04d61b9..06f0b9e 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,10 +11,10 @@ + - - + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index 1e726b2..d3f2518 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -154,10 +154,10 @@ - + Code - + Code diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build index a826a37..ffcf59e 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -11,8 +11,8 @@ - + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 147158c..716fd57 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,9 +93,6 @@ Code - - Code - Code @@ -105,6 +102,9 @@ Code + + Code + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build index fc9f055..112ff1c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -12,10 +12,10 @@ - + -- cgit v1.1 From 70d8731aa2b50f4ef615e0623c02ac1da0067366 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 5 Jul 2007 19:19:39 +0000 Subject: Fixed rotation editing of individual prims in a group. I think positioning and rotations should now be correct (for both groups and on editing individuals of a group). Resizing still needs work. --- OpenSim/Region/Environment/Scenes/Primitive.cs | 78 +++++++++++++++++++--- .../Environment/Scenes/Scene.PacketHandlers.cs | 1 + OpenSim/Region/Environment/Scenes/SceneObject.cs | 2 +- 3 files changed, 70 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 24dc115..9d01618 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -46,12 +46,17 @@ namespace OpenSim.Region.Environment.Scenes public EntityBase m_Parent; #region Properties - public override LLVector3 Pos + /// + /// If rootprim will return world position + /// otherwise will return local offset from rootprim + /// + public override LLVector3 Pos { get { if (isRootPrim) { + //if we are rootprim then our offset should be zero return this.m_pos + m_Parent.Pos; } else @@ -77,7 +82,9 @@ namespace OpenSim.Region.Environment.Scenes if (!this.isRootPrim) { Primitive parentPrim = (Primitive)this.m_Parent; - return this.m_pos + parentPrim.WorldPos; + Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); + offsetPos = parentPrim.rotation * offsetPos; + return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z); } else { @@ -112,6 +119,17 @@ namespace OpenSim.Region.Environment.Scenes #endregion #region Constructors + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) { m_regionHandle = regionHandle; @@ -227,12 +245,13 @@ namespace OpenSim.Region.Environment.Scenes Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); axPos = this.m_Parent.rotation.Inverse() * axPos; this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); + Axiom.Math.Quaternion oldRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); + this.rotation = this.m_Parent.rotation.Inverse() * this.rotation; this.updateFlag = 1; foreach (Primitive child in children) { - child.SetRootParent(rootParent, newParent, oldPos); + child.SetRootParent(rootParent, newParent, oldPos, oldRot); } children.Clear(); @@ -243,10 +262,14 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition) + public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition, Axiom.Math.Quaternion oldParentRotation) { LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); + Axiom.Math.Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); + axOldPos = oldParentRotation * axOldPos; + oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); oldPos += oldParentPosition; + Axiom.Math.Quaternion oldRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); this.isRootPrim = false; this.m_Parent = newParent; this.ParentID = newParent.LocalId; @@ -257,15 +280,20 @@ namespace OpenSim.Region.Environment.Scenes Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); axPos = this.m_Parent.rotation.Inverse() * axPos; this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); + this.rotation = oldParentRotation * this.rotation; + this.rotation = this.m_Parent.rotation.Inverse()* this.rotation ; this.updateFlag = 1; foreach (Primitive child in children) { - child.SetRootParent(newRoot, newParent, oldPos); + child.SetRootParent(newRoot, newParent, oldPos, oldRot); } children.Clear(); } + /// + /// + /// + /// public void AddOffsetToChildren(LLVector3 offset) { foreach (Primitive prim in this.children) @@ -275,6 +303,10 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// public void AddToChildrenList(Primitive prim) { this.children.Add(prim); @@ -282,6 +314,10 @@ namespace OpenSim.Region.Environment.Scenes #endregion #region Resizing/Scale + /// + /// + /// + /// public void ResizeGoup(LLVector3 scale) { LLVector3 offset = (scale - this.m_Shape.Scale); @@ -317,9 +353,13 @@ namespace OpenSim.Region.Environment.Scenes this.updateFlag = 2; } + /// + /// + /// + /// public void UpdateSinglePosition(LLVector3 pos) { - //Console.WriteLine("updating single prim position"); + // Console.WriteLine("updating single prim position"); if (this.isRootPrim) { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); @@ -350,14 +390,23 @@ namespace OpenSim.Region.Environment.Scenes #endregion #region Rotation + /// + /// + /// + /// public void UpdateRotation(LLQuaternion rot) { this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); this.updateFlag = 2; } + /// + /// + /// + /// public void UpdateSingleRotation(LLQuaternion rot) { + //Console.WriteLine("updating single prim rotation"); Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); Axiom.Math.Quaternion oldParentRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); this.rotation = axRot; @@ -367,13 +416,18 @@ namespace OpenSim.Region.Environment.Scenes axPos = oldParentRot * axPos; axPos = axRot.Inverse() * axPos; prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - prim.rotation = prim.rotation * oldParentRot; - prim.rotation = prim.rotation * axRot.Inverse(); + prim.rotation = oldParentRot * prim.rotation ; + prim.rotation = axRot.Inverse()* prim.rotation; prim.updateFlag = 2; } this.updateFlag = 2; } + /// + /// + /// + /// + /// public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) { this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); @@ -384,6 +438,10 @@ namespace OpenSim.Region.Environment.Scenes #endregion #region Shape + /// + /// + /// + /// public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) { this.m_Shape.PathBegin = shapeBlock.PathBegin; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index b3d9d15..bcef137 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -454,6 +454,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) { + //Console.WriteLine("trying to update single prim rotation"); Primitive prim = null; foreach (EntityBase ent in Entities.Values) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 00d7c63..452502b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes private bool physicsEnabled = false; private PhysicsScene m_PhysScene; private PhysicsActor m_PhysActor; - + public LLUUID rootUUID { get -- cgit v1.1 From e2bafc8d6c37d48c7af6a30c28696adb145d3f00 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 5 Jul 2007 20:46:37 +0000 Subject: *Fixed crash of OpenSim client when in grid mode from a recent commit *The XML issue is now fixed (yay lbsa71) -- but I am still getting a "login packet never received", but that is probably an issue on my end, and not it the code --- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index e8ed7f4..4d93cc9 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -186,9 +186,9 @@ namespace OpenSim.Region.Communications.OGS1 } - if (listeners.ContainsKey((ulong)requestData["regionhandle"])) + if (listeners.ContainsKey(Convert.ToUInt64((string)requestData["regionhandle"]))) { - this.listeners[(ulong)requestData["regionhandle"]].TriggerExpectUser((ulong)requestData["regionhandle"], agentData); + this.listeners[Convert.ToUInt64((string)requestData["regionhandle"])].TriggerExpectUser(Convert.ToUInt64((string)requestData["regionhandle"]), agentData); } else { -- cgit v1.1 From 93640f1d71115dea680639c4564dcf89ecab4b61 Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 6 Jul 2007 13:57:49 +0000 Subject: *Fixed 2 small references to localhost which has some conflicts when resolving. *Grid mode now gets past region handshake, BUT the client (both nicholas and the normal one) crash as soon as the next step is displayed on the screen --- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index ad70df8..4567d7e 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -51,7 +51,7 @@ namespace SimpleApp NetworkServersInfo serverInfo = new NetworkServersInfo(); CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo); - RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "localhost" ); + RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" ); BaseHttpServer httpServer = new BaseHttpServer( internalEndPoint.Port ); MyWorld world = new MyWorld(packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); -- cgit v1.1 From bc02ddf5231d7731af33cc0aa5dc914cbdeb5ee7 Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 6 Jul 2007 20:40:03 +0000 Subject: *Fixed several bugs that crashed the viewer and opensim server when logging in on grid mode *Note: Grid Mode now works in sugilite, but is still unstable **Known bug in which the grid server crashes after being relaunched from a previously create configuration **Crashing of the viewer crashes the OpenSim server which then crashes the grid server -- needs better handling of exceptions **Multiple sims is still untested, but should connect correctly. Moving between the sims may be a different story --- .../ClientStack/ClientView.ProcessPackets.cs | 3 ++- OpenSim/Region/ClientStack/ClientViewBase.cs | 2 ++ .../Region/Communications/OGS1/OGS1GridServices.cs | 31 ++++++++++++---------- .../Region/Communications/OGS1/OGS1UserServices.cs | 5 ++-- 4 files changed, 24 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 64856ea..0114fb1 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -41,11 +41,12 @@ namespace OpenSim.Region.ClientStack protected override void ProcessInPacket(Packet Pack) { ack_pack(Pack); + debug = true; if (debug) { if (Pack.Type != PacketType.AgentUpdate) { - Console.WriteLine(Pack.Type.ToString()); + Console.WriteLine("IN: " + Pack.Type.ToString()); } } diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index f105978..24c6911 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -71,6 +71,8 @@ namespace OpenSim.Region.ClientStack // Keep track of when this packet was sent out Pack.TickCount = Environment.TickCount; + Console.WriteLine("OUT: " + Pack.Type.ToString()); + if (!Pack.Header.Resent) { // Set the sequence number diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 4d93cc9..b7d62ed 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -83,26 +83,29 @@ namespace OpenSim.Region.Communications.OGS1 List neighbours = new List(); - foreach (Hashtable n in (Hashtable)respData.Values) + foreach (ArrayList a in respData.Values) { - string internalIpStr = (string)n["sim_ip"]; - int port = (int)n["sim_port"]; - string externalUri = (string)n["sim_uri"]; - - IPEndPoint neighbourInternalEndPoint = new IPEndPoint( IPAddress.Parse( internalIpStr ), port); - string neighbourExternalUri = externalUri; + foreach (Hashtable n in a) + { + string internalIpStr = (string)n["sim_ip"]; + int port = (int)n["sim_port"]; + string externalUri = (string)n["sim_uri"]; - RegionInfo neighbour = new RegionInfo((uint)n["x"], (uint)n["y"], neighbourInternalEndPoint, neighbourExternalUri ); + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), port); + string neighbourExternalUri = externalUri; - //OGS1 - //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally + RegionInfo neighbour = new RegionInfo((uint)n["x"], (uint)n["y"], neighbourInternalEndPoint, neighbourExternalUri); - neighbour.RegionName = (string)n["name"]; + //OGS1 + //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally - //OGS1+ - neighbour.SimUUID = (string)n["uuid"]; + neighbour.RegionName = (string)n["name"]; - neighbours.Add(neighbour); + //OGS1+ + neighbour.SimUUID = (string)n["uuid"]; + + neighbours.Add(neighbour); + } } return neighbours; diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 7c7db03..3a3bccb 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -35,8 +35,9 @@ namespace OpenSim.Region.Communications.OGS1 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); userData.profileImage = new LLUUID((string)data["profile_image"]); userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); - userData.homeLocation = new LLVector3(); - userData.homeLookAt = new LLVector3(); + userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); + userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"])); + userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"])); return userData; } -- cgit v1.1 From 10ece46cf681f389b9ecce5e89b94d749a44e9c1 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 8 Jul 2007 02:58:01 +0000 Subject: * Updating prebuild --- OpenSim/Region/Application/OpenSim.csproj | 6 +-- OpenSim/Region/Application/OpenSim.exe.build | 2 +- .../ClientStack/OpenSim.Region.ClientStack.csproj | 18 +++---- .../OpenSim.Region.ClientStack.dll.build | 12 ++--- .../OpenSim.Region.Communications.Local.csproj | 6 +-- .../OpenSim.Region.Communications.Local.dll.build | 2 +- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 6 +-- .../OpenSim.Region.Communications.OGS1.dll.build | 4 +- .../Environment/OpenSim.Region.Environment.csproj | 62 ++++++++++------------ .../OpenSim.Region.Environment.dll.build | 1 + OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 4 +- .../Region/Examples/SimpleApp/SimpleApp.exe.build | 2 +- .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 6 +-- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 2 +- 14 files changed, 64 insertions(+), 69 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj index f5da23d..bec85cc 100644 --- a/OpenSim/Region/Application/OpenSim.csproj +++ b/OpenSim/Region/Application/OpenSim.csproj @@ -170,15 +170,15 @@ - - Code - Code Code + + Code + diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build index 9890cfa..6c7d7ac 100644 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ b/OpenSim/Region/Application/OpenSim.exe.build @@ -11,9 +11,9 @@ - + diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj index 2e1d8e2..3093eb0 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj @@ -122,34 +122,34 @@ - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build index 1c791d3..f76a4c8 100644 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build @@ -11,16 +11,16 @@ - - - - + + + - - + + + diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj index f9f6b7d..0a15a49 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -98,15 +98,15 @@ - - Code - Code Code + + Code + Code diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build index bfefabf..3cac9d3 100644 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build @@ -11,9 +11,9 @@ - + diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj index 390326e..d6abd13 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -116,16 +116,16 @@ - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build index 06f0b9e..04d61b9 100644 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build @@ -11,10 +11,10 @@ - - + + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 3b86468..048f326 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {DCBA491C-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region.Environment @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region.Environment - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,36 +55,34 @@ False False 4 - - + - + ..\..\..\bin\Axiom.MathLib.dll False - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + Microsoft.JScript.dll False - + System.dll False - - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -100,55 +92,55 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Communications {CB52B7E7-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.GenericConfig.Xml {C74E4A30-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Servers {2CC71860-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Caches {61FCCDB3-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Capabilities {39038E85-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Physics.Manager {F4FF31EB-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region.Terrain.BasicTerrain {C9E0F891-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -200,7 +192,6 @@ Code - Code @@ -240,6 +231,9 @@ Code + + Code + Code @@ -290,4 +284,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index 52d9a26..bba3266 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -40,6 +40,7 @@ + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj index d3f2518..1e726b2 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -154,10 +154,10 @@ - + Code - + Code diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build index ffcf59e..a826a37 100644 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build @@ -11,8 +11,8 @@ - + diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj index 716fd57..147158c 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj @@ -93,6 +93,9 @@ Code + + Code + Code @@ -102,9 +105,6 @@ Code - - Code - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build index 112ff1c..fc9f055 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build @@ -12,10 +12,10 @@ + - -- cgit v1.1 From bdab40280b64e31b763a99f6c2011e7e91e7d0fa Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 8 Jul 2007 03:32:27 +0000 Subject: * Added instant message support for the local region. Grid support forthcoming. --- OpenSim/Region/ClientStack/ClientView.API.cs | 25 ++++++++++++++++++++++ .../ClientStack/ClientView.ProcessPackets.cs | 14 ++++++++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 24 +++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 1 + 4 files changed, 64 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 9e7117f..cefe856 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -40,6 +40,7 @@ namespace OpenSim.Region.ClientStack { partial class ClientView { + public event ImprovedInstantMessage OnInstantMessage; public event ChatFromViewer OnChatFromViewer; public event RezObject OnRezObject; public event GenericCall4 OnDeRezObject; @@ -236,6 +237,30 @@ namespace OpenSim.Region.ClientStack this.OutPacket(reply); } + /// + /// + /// + /// TODO + /// + /// + public void SendInstantMessage(string message, LLUUID target) + { + ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); + msg.AgentData.AgentID = this.AgentID; + msg.AgentData.SessionID = this.SessionID; + + msg.MessageBlock.Dialog = 0; + msg.MessageBlock.FromGroup = false; + msg.MessageBlock.ID = target.Combine(this.AgentID); + msg.MessageBlock.Offline = 0; + msg.MessageBlock.ParentEstateID = 0; + msg.MessageBlock.Position = new LLVector3(); + msg.MessageBlock.RegionID = new LLUUID(); + msg.MessageBlock.Timestamp = 0; + msg.MessageBlock.ToAgentID = target; + + this.OutPacket(msg); + } /// /// Send the region heightmap to the client diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 0114fb1..def14c7 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -92,6 +92,20 @@ namespace OpenSim.Region.ClientStack this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); } break; + case PacketType.ImprovedInstantMessage: + ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; + + string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); + string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); + + if (OnInstantMessage != null) + { + this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID, + msgpack.MessageBlock.Timestamp, IMfromName, IMmessage); + } + + break; + case PacketType.RezObject: RezObjectPacket rezPacket = (RezObjectPacket)Pack; AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index bcef137..7535049 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -100,6 +100,30 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// Inefficient. TODO: Fixme + /// + /// + /// + /// + /// + public void InstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message) + { + if (this.Avatars.ContainsKey(toAgentID)) + { + // Local sim message + ScenePresence avatar = this.Avatars[toAgentID]; + + + } + else + { + // Grid message + } + } + + /// + /// + /// /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1f370c4..fdf3cc8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -450,6 +450,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnRegionHandShakeReply += this.SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); client.OnChatFromViewer += this.SimChat; + client.OnInstantMessage += this.InstantMessage; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; client.OnUpdatePrimPosition += this.UpdatePrimPosition; -- cgit v1.1 From 855ebe739b27fda5ab45ab993cbc76668125a9b1 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 8 Jul 2007 03:36:17 +0000 Subject: * Missed a line - IM support in local simulator should now work. --- OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 7535049..4cb0bec 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Scenes // Local sim message ScenePresence avatar = this.Avatars[toAgentID]; - + avatar.ControllingClient.SendInstantMessage(message, toAgentID); } else { -- cgit v1.1 From 74410efb22046688f0b3abe84ef4fdda8b166da6 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 8 Jul 2007 03:45:06 +0000 Subject: * Bugfix with instant message handlers. Looking at implementing grid IM server, ideally using a known scalable infrastructure. --- OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 4cb0bec..e078348 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -110,10 +110,16 @@ namespace OpenSim.Region.Environment.Scenes { if (this.Avatars.ContainsKey(toAgentID)) { - // Local sim message - ScenePresence avatar = this.Avatars[toAgentID]; - - avatar.ControllingClient.SendInstantMessage(message, toAgentID); + if (this.Avatars.ContainsKey(fromAgentID)) + { + // Local sim message + ScenePresence avatar = this.Avatars[fromAgentID]; + avatar.ControllingClient.SendInstantMessage(message, toAgentID); + } + else + { + // Message came from a user outside the sim, ignore? + } } else { -- cgit v1.1 From 5f8de1e7045b9daa2d4f3b21ca826987e32efe6e Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 8 Jul 2007 19:27:04 +0000 Subject: * By popular demand, all generated build files are now deleted. Somebody should make sure the wiki is updated. --- OpenSim/Region/Application/OpenSim.csproj | 190 -------------- OpenSim/Region/Application/OpenSim.exe.build | 60 ----- OpenSim/Region/Caches/OpenSim.Region.Caches.csproj | 97 ------- .../Region/Caches/OpenSim.Region.Caches.dll.build | 43 --- .../OpenSim.Region.Capabilities.csproj | 149 ----------- .../OpenSim.Region.Capabilities.dll.build | 58 ----- .../ClientStack/OpenSim.Region.ClientStack.csproj | 166 ------------ .../OpenSim.Region.ClientStack.dll.build | 60 ----- .../OpenSim.Region.Communications.Local.csproj | 121 --------- .../OpenSim.Region.Communications.Local.dll.build | 48 ---- .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 142 ---------- .../OpenSim.Region.Communications.OGS1.dll.build | 53 ---- .../Environment/OpenSim.Region.Environment.csproj | 287 --------------------- .../OpenSim.Region.Environment.dll.build | 97 ------- OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 177 ------------- .../Region/Examples/SimpleApp/SimpleApp.exe.build | 58 ----- .../OpenSim.Region.GridInterfaces.Local.csproj | 107 -------- .../OpenSim.Region.GridInterfaces.Local.dll.build | 45 ---- .../OpenSim.Region.GridInterfaces.Remote.csproj | 107 -------- .../OpenSim.Region.GridInterfaces.Remote.dll.build | 45 ---- ...penSim.Region.Physics.BasicPhysicsPlugin.csproj | 93 ------- ...Sim.Region.Physics.BasicPhysicsPlugin.dll.build | 42 --- .../Manager/OpenSim.Region.Physics.Manager.csproj | 112 -------- .../OpenSim.Region.Physics.Manager.dll.build | 47 ---- .../OpenSim.Region.Physics.OdePlugin.csproj | 97 ------- .../OpenSim.Region.Physics.OdePlugin.dll.build | 43 --- .../OpenSim.Region.Physics.PhysXPlugin.csproj | 97 ------- .../OpenSim.Region.Physics.PhysXPlugin.dll.build | 43 --- ...im.Region.Storage.LocalStorageBerkeleyDB.csproj | 112 -------- ...Region.Storage.LocalStorageBerkeleyDB.dll.build | 46 ---- ...penSim.Storage.LocalStorageBerkeleyDB.dll.build | 46 ---- .../OpenSim.Region.Storage.LocalStorageDb4o.csproj | 116 --------- ...enSim.Region.Storage.LocalStorageDb4o.dll.build | 48 ---- ...penSim.Region.Storage.LocalStorageSQLite.csproj | 111 -------- ...Sim.Region.Storage.LocalStorageSQLite.dll.build | 46 ---- .../OpenSim.Storage.LocalStorageSQLite.dll.build | 46 ---- .../OpenSim.Region.Terrain.BasicTerrain.csproj | 110 -------- .../OpenSim.Region.Terrain.BasicTerrain.dll.build | 47 ---- 38 files changed, 3412 deletions(-) delete mode 100644 OpenSim/Region/Application/OpenSim.csproj delete mode 100644 OpenSim/Region/Application/OpenSim.exe.build delete mode 100644 OpenSim/Region/Caches/OpenSim.Region.Caches.csproj delete mode 100644 OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build delete mode 100644 OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj delete mode 100644 OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build delete mode 100644 OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj delete mode 100644 OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build delete mode 100644 OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj delete mode 100644 OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build delete mode 100644 OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj delete mode 100644 OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build delete mode 100644 OpenSim/Region/Environment/OpenSim.Region.Environment.csproj delete mode 100644 OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build delete mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj delete mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build delete mode 100644 OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj delete mode 100644 OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build delete mode 100644 OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj delete mode 100644 OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build delete mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj delete mode 100644 OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build delete mode 100644 OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj delete mode 100644 OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build delete mode 100644 OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj delete mode 100644 OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build delete mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj delete mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build delete mode 100644 OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build delete mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj delete mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build delete mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj delete mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build delete mode 100644 OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.csproj b/OpenSim/Region/Application/OpenSim.csproj deleted file mode 100644 index bec85cc..0000000 --- a/OpenSim/Region/Application/OpenSim.csproj +++ /dev/null @@ -1,190 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {438A9556-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim - JScript - Grid - IE50 - false - Exe - - OpenSim - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Data - {36B72A9B-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.GenericConfig.Xml - {C74E4A30-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.UserManagement - {586E2916-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.ClientStack - {DC3698B2-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Communications.Local - {BFB5D807-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Communications.OGS1 - {4806E378-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Environment - {DCBA491C-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Terrain.BasicTerrain - {C9E0F891-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Application/OpenSim.exe.build b/OpenSim/Region/Application/OpenSim.exe.build deleted file mode 100644 index 6c7d7ac..0000000 --- a/OpenSim/Region/Application/OpenSim.exe.build +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj b/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj deleted file mode 100644 index 4a73d08..0000000 --- a/OpenSim/Region/Caches/OpenSim.Region.Caches.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {61FCCDB3-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Caches - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Caches - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build b/OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build deleted file mode 100644 index 3ca89e8..0000000 --- a/OpenSim/Region/Caches/OpenSim.Region.Caches.dll.build +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj deleted file mode 100644 index 4b672ae..0000000 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.csproj +++ /dev/null @@ -1,149 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {39038E85-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Capabilities - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Capabilities - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build b/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build deleted file mode 100644 index 1d552c2..0000000 --- a/OpenSim/Region/Capabilities/OpenSim.Region.Capabilities.dll.build +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj deleted file mode 100644 index 3093eb0..0000000 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.csproj +++ /dev/null @@ -1,166 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {DC3698B2-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.ClientStack - JScript - Grid - IE50 - false - Library - - OpenSim.Region.ClientStack - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Terrain.BasicTerrain - {C9E0F891-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build b/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build deleted file mode 100644 index f76a4c8..0000000 --- a/OpenSim/Region/ClientStack/OpenSim.Region.ClientStack.dll.build +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj deleted file mode 100644 index 0a15a49..0000000 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj +++ /dev/null @@ -1,121 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {BFB5D807-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Communications.Local - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Communications.Local - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Data - {36B72A9B-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.UserManagement - {586E2916-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build deleted file mode 100644 index 3cac9d3..0000000 --- a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.dll.build +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj deleted file mode 100644 index d6abd13..0000000 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj +++ /dev/null @@ -1,142 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {4806E378-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Communications.OGS1 - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Communications.OGS1 - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Data.dll - False - - - System.Runtime.Remoting.dll - False - - - System.Xml.dll - False - - - ..\..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Data - {36B72A9B-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build deleted file mode 100644 index 04d61b9..0000000 --- a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.dll.build +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj deleted file mode 100644 index 048f326..0000000 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ /dev/null @@ -1,287 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {DCBA491C-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Environment - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Environment - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\bin\libsecondlife.dll - False - - - Microsoft.JScript.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.GenericConfig.Xml - {C74E4A30-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Capabilities - {39038E85-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Terrain.BasicTerrain - {C9E0F891-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build deleted file mode 100644 index bba3266..0000000 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj deleted file mode 100644 index 1e726b2..0000000 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj +++ /dev/null @@ -1,177 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {24B12448-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - SimpleApp - JScript - Grid - IE50 - false - Exe - - SimpleApp - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - ..\..\..\..\bin\System.Data.dll - False - - - System.Xml.dll - False - - - ..\..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Communications - {CB52B7E7-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Servers - {2CC71860-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.UserManagement - {586E2916-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Caches - {61FCCDB3-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Capabilities - {39038E85-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.ClientStack - {DC3698B2-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Communications.Local - {BFB5D807-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Environment - {DCBA491C-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.GridInterfaces.Local - {241A8CDD-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build deleted file mode 100644 index a826a37..0000000 --- a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj deleted file mode 100644 index 484a205..0000000 --- a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {241A8CDD-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.GridInterfaces.Local - JScript - Grid - IE50 - false - Library - - OpenSim.Region.GridInterfaces.Local - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build b/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build deleted file mode 100644 index 4770e6d..0000000 --- a/OpenSim/Region/GridInterfaces/Local/OpenSim.Region.GridInterfaces.Local.dll.build +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj deleted file mode 100644 index 793fde2..0000000 --- a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {98C7B681-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.GridInterfaces.Remote - JScript - Grid - IE50 - false - Library - - OpenSim.Region.GridInterfaces.Remote - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build deleted file mode 100644 index 0bf1b86..0000000 --- a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.dll.build +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj deleted file mode 100644 index 7dad533..0000000 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.csproj +++ /dev/null @@ -1,93 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {15B4FEF3-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Physics.BasicPhysicsPlugin - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Physics.BasicPhysicsPlugin - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\Physics\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\Physics\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Axiom.MathLib.dll - False - - - System.dll - False - - - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build b/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build deleted file mode 100644 index 6cf26ca..0000000 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/OpenSim.Region.Physics.BasicPhysicsPlugin.dll.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj deleted file mode 100644 index f340400..0000000 --- a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {F4FF31EB-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Physics.Manager - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Physics.Manager - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Axiom.MathLib.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build b/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build deleted file mode 100644 index 4b7ce81..0000000 --- a/OpenSim/Region/Physics/Manager/OpenSim.Region.Physics.Manager.dll.build +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj deleted file mode 100644 index 490c681..0000000 --- a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {90620634-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Physics.OdePlugin - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Physics.OdePlugin - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\Physics\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\Physics\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\..\bin\Ode.NET.dll - False - - - System.dll - False - - - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build b/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build deleted file mode 100644 index 07b9386..0000000 --- a/OpenSim/Region/Physics/OdePlugin/OpenSim.Region.Physics.OdePlugin.dll.build +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj deleted file mode 100644 index 77da908..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {A6D191D8-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Physics.PhysXPlugin - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Physics.PhysXPlugin - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\Physics\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\Physics\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\..\bin\PhysX_Wrapper_Dotnet.dll - False - - - System.dll - False - - - - - OpenSim.Region.Physics.Manager - {F4FF31EB-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build b/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build deleted file mode 100644 index c1a9608..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/OpenSim.Region.Physics.PhysXPlugin.dll.build +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj deleted file mode 100644 index b956c9b..0000000 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {A4691E59-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Storage.LocalStorageBerkeleyDB - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Storage.LocalStorageBerkeleyDB - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Kds.Serialization.dll - False - - - ..\..\..\..\bin\libdb_dotNET43.dll - False - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Data.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build deleted file mode 100644 index 20f5171..0000000 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Region.Storage.LocalStorageBerkeleyDB.dll.build +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build deleted file mode 100644 index bc2d8ec..0000000 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj deleted file mode 100644 index 147158c..0000000 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {43DB702D-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Storage.LocalStorageDb4o - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Storage.LocalStorageDb4o - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\Db4objects.Db4o.dll - False - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build b/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build deleted file mode 100644 index fc9f055..0000000 --- a/OpenSim/Region/Storage/LocalStorageDb4o/OpenSim.Region.Storage.LocalStorageDb4o.dll.build +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj deleted file mode 100644 index d1353a5..0000000 --- a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.csproj +++ /dev/null @@ -1,111 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {477B9270-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Storage.LocalStorageSQLite - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Storage.LocalStorageSQLite - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Data.dll - False - - - ..\..\..\..\bin\System.Data.SQLite.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build deleted file mode 100644 index 9d12c33..0000000 --- a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Region.Storage.LocalStorageSQLite.dll.build +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build b/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build deleted file mode 100644 index bd4c731..0000000 --- a/OpenSim/Region/Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj deleted file mode 100644 index 24667e5..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {C9E0F891-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Region.Terrain.BasicTerrain - JScript - Grid - IE50 - false - Library - - OpenSim.Region.Terrain.BasicTerrain - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\libTerrain-BSD.dll - False - - - Microsoft.JScript.dll - False - - - ..\..\..\bin\openjpegnet.dll - False - - - System.dll - False - - - System.Data.dll - False - - - System.Drawing.dll - False - - - System.Xml.dll - False - - - - - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build b/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build deleted file mode 100644 index dc7203a..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/OpenSim.Region.Terrain.BasicTerrain.dll.build +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.1 From 252ff78eb3fafe2c8214446973f3c7f2e80297a2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 8 Jul 2007 19:28:53 +0000 Subject: Applied animations patch (#175) submitted by dalien --- OpenSim/Region/ClientStack/ClientView.API.cs | 15 ++++++++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 33 +++++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index cefe856..dfae9e0 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -527,6 +527,21 @@ namespace OpenSim.Region.ClientStack OutPacket(avp); } + public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) + { + AvatarAnimationPacket ani = new AvatarAnimationPacket(); + ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; + ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); + ani.AnimationSourceList[0].ObjectID = sourceAgentId; + ani.Sender = new AvatarAnimationPacket.SenderBlock(); + ani.Sender.ID = sourceAgentId; + ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; + ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); + ani.AnimationList[0].AnimID = animID; + ani.AnimationList[0].AnimSequenceID = seq; + this.OutPacket(ani); + } + #endregion #region Avatar Packet/data sending Methods diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 14b7b2f..d1e2817 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -122,6 +122,8 @@ namespace OpenSim.Region.Environment.Scenes } Wearables = AvatarWearable.DefaultWearables; + Animations = new ScenePresence.AvatarAnimations(); + Animations.LoadAnims(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); @@ -274,9 +276,27 @@ namespace OpenSim.Region.Environment.Scenes { this.AddNewMovement(agent_control_v3, q); } - + UpdateMovementAnimations(update_movementflag); } + protected void UpdateMovementAnimations(bool update_movementflag) + { + if (update_movementflag) + { + if (movementflag != 0) { + if (this._physActor.Flying) { + this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); + } else { + this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); + } + } else { + this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); + } + } + + } + + protected void AddNewMovement(Vector3 vec, Quaternion rotation) { NewForce newVelocity = new NewForce(); @@ -403,8 +423,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack(LLUUID animID, int seq) { - - + this.current_anim = animID; + this.anim_seq = anim_seq; + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); + } } /// @@ -412,7 +437,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack() { - + this.SendAnimPack(this.current_anim, this.anim_seq); } #endregion -- cgit v1.1 From f62b7f3d1ed0fbc1afc431a1e25c20ec8effe243 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 8 Jul 2007 19:47:04 +0000 Subject: * reverted rev 1200 waiting for info re animations.xml --- OpenSim/Region/ClientStack/ClientView.API.cs | 15 ---------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 33 +++------------------- 2 files changed, 4 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index dfae9e0..cefe856 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -527,21 +527,6 @@ namespace OpenSim.Region.ClientStack OutPacket(avp); } - public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) - { - AvatarAnimationPacket ani = new AvatarAnimationPacket(); - ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; - ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); - ani.AnimationSourceList[0].ObjectID = sourceAgentId; - ani.Sender = new AvatarAnimationPacket.SenderBlock(); - ani.Sender.ID = sourceAgentId; - ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; - ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); - ani.AnimationList[0].AnimID = animID; - ani.AnimationList[0].AnimSequenceID = seq; - this.OutPacket(ani); - } - #endregion #region Avatar Packet/data sending Methods diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index d1e2817..14b7b2f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -122,8 +122,6 @@ namespace OpenSim.Region.Environment.Scenes } Wearables = AvatarWearable.DefaultWearables; - Animations = new ScenePresence.AvatarAnimations(); - Animations.LoadAnims(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); @@ -276,26 +274,8 @@ namespace OpenSim.Region.Environment.Scenes { this.AddNewMovement(agent_control_v3, q); } - UpdateMovementAnimations(update_movementflag); - } - - protected void UpdateMovementAnimations(bool update_movementflag) - { - if (update_movementflag) - { - if (movementflag != 0) { - if (this._physActor.Flying) { - this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); - } else { - this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); - } - } else { - this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); - } - } - - } + } protected void AddNewMovement(Vector3 vec, Quaternion rotation) { @@ -423,13 +403,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack(LLUUID animID, int seq) { - this.current_anim = animID; - this.anim_seq = anim_seq; - List avatars = this.m_world.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); - } + + } /// @@ -437,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack() { - this.SendAnimPack(this.current_anim, this.anim_seq); + } #endregion -- cgit v1.1 From e8acf1cca92592fea38208dbfe4137555431434d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 9 Jul 2007 15:29:39 +0000 Subject: * Begun work on Primitive Duplication. Not hooked up yet, but theoretically could be done so. In practice, more work needs to be done. --- OpenSim/Region/ClientStack/ClientView.API.cs | 1 + .../ClientStack/ClientView.ProcessPackets.cs | 12 ++++++++ OpenSim/Region/Environment/Scenes/EntityBase.cs | 10 +++++++ OpenSim/Region/Environment/Scenes/Primitive.cs | 35 ++++++++++++++++++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 33 ++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 21 +++++++++++-- OpenSim/Region/Environment/Scenes/SceneObject.cs | 28 +++++++++++++++++ 7 files changed, 138 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index cefe856..3c1df75 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -55,6 +55,7 @@ namespace OpenSim.Region.ClientStack public event LinkObjects OnLinkObjects; public event UpdateVector OnGrapObject; public event ObjectSelect OnDeGrapObject; + public event ObjectDuplicate OnObjectDuplicate; public event MoveObject OnGrapUpdate; public event GenericCall4 OnAddPrim; public event UpdateShape OnUpdatePrimShape; diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index def14c7..982ae50 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -233,6 +233,18 @@ namespace OpenSim.Region.ClientStack } } break; + case PacketType.ObjectDuplicate: + ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; + for (int i = 0; i < dupe.ObjectData.Length; i++) + { + if (OnObjectDuplicate != null) + { + OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); + } + } + + break; + case PacketType.ObjectSelect: ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; for (int i = 0; i < incomingselect.ObjectData.Length; i++) diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 99ca021..7914bab 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -74,6 +74,7 @@ namespace OpenSim.Region.Environment.Scenes public uint LocalId { get { return m_localId; } + set { m_localId = value; } } /// @@ -122,6 +123,15 @@ namespace OpenSim.Region.Environment.Scenes } /// + /// Copies the entity + /// + /// + public virtual EntityBase Copy() + { + return (EntityBase)this.MemberwiseClone(); + } + + /// /// Infoms the entity that the land (heightmap) has changed /// public virtual void LandRenegerated() diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 9d01618..8d31d63 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -141,8 +141,43 @@ namespace OpenSim.Region.Environment.Scenes this.CreateFromPacket(addPacket, ownerID, localID); this.rotation = Axiom.Math.Quaternion.Identity; } + + /// + /// + /// + /// Empty constructor for duplication + public Primitive() + { + + } + #endregion + #region Duplication + + public Primitive Copy(EntityBase parent, SceneObject rootParent) + { + Primitive dupe = (Primitive)this.MemberwiseClone(); + // TODO: Copy this properly. + dupe.inventoryItems = this.inventoryItems; + dupe.m_Parent = parent; + dupe.m_RootParent = rootParent; + // TODO: Copy this properly. + dupe.m_Shape = this.m_Shape; + + uint newLocalID = this.m_world.PrimIDAllocate(); + dupe.LocalId = newLocalID; + + dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); + dupe.rotation = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); + dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); + + return dupe; + } + + #endregion + + #region Override from EntityBase /// /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index e078348..35e0ea6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -215,6 +215,39 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// + /// + /// + public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags) + { + SceneObject originPrim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + if (((SceneObject)ent).rootLocalID == originalPrim) + { + originPrim = (SceneObject)ent; + break; + } + } + } + + if (originPrim != null) + { + //SceneObject copy = originPrim.Copy(); + + } + else + { + OpenSim.Framework.Console.MainLog.Instance.Warn("Attempted to duplicate nonexistant prim"); + } + + } + + /// + /// + /// /// /// public void LinkObjects(uint parentPrim, List childPrims) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fdf3cc8..1798cba 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -57,6 +57,7 @@ namespace OpenSim.Region.Environment.Scenes private float timeStep = 0.1f; private Random Rand = new Random(); private uint _primCount = 702000; + private System.Threading.Mutex _primAllocateMutex = new Mutex(false); private int storageCount; private Mutex updateLock; @@ -397,6 +398,22 @@ namespace OpenSim.Region.Environment.Scenes } /// + /// Returns a new unallocated primitive ID + /// + /// A brand new primitive ID + public uint PrimIDAllocate() + { + uint myID; + + _primAllocateMutex.WaitOne(); + ++_primCount; + myID = _primCount; + _primAllocateMutex.ReleaseMutex(); + + return myID; + } + + /// /// /// /// @@ -415,9 +432,8 @@ namespace OpenSim.Region.Environment.Scenes { try { - SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount); + SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this.PrimIDAllocate()); this.Entities.Add(sceneOb.rootUUID, sceneOb); - this._primCount++; // Trigger event for listeners // eventManager.TriggerOnNewPrimitive(prim); @@ -468,6 +484,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectDescription += this.PrimDescription; client.OnObjectName += this.PrimName; client.OnLinkObjects += this.LinkObjects; + client.OnObjectDuplicate += this.DuplicateObject; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 452502b..2b80d57 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -78,6 +78,15 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// Need a null constructor for duplication + public SceneObject() + { + + } + + /// + /// + /// /// /// /// @@ -100,6 +109,25 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// A complete copy of the object + public SceneObject Copy() + { + SceneObject dupe = new SceneObject(); + + Primitive newRoot = this.rootPrimitive.Copy((EntityBase)dupe, dupe); + + foreach (EntityBase child in this.children) + { + EntityBase newChild = child.Copy(); + dupe.children.Add(newChild); + } + + return dupe; + } + + /// + /// + /// public void DeleteAllChildren() { this.children.Clear(); -- cgit v1.1 From 93f3ef7e0d1c7d8b9c578ffdf4e45d9c0d2dde6c Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 9 Jul 2007 15:59:35 +0000 Subject: Done a little bit of renaming in primitive.cs and on a few events in IClientAPI. Disabled CAPS asset uploading as it seems it now crashes the server. --- OpenSim/Region/Capabilities/Caps.cs | 2 +- OpenSim/Region/Capabilities/LLSDCapsDetails.cs | 2 +- OpenSim/Region/ClientStack/ClientView.API.cs | 6 +-- .../ClientStack/ClientView.PacketHandlers.cs | 12 ++--- OpenSim/Region/Environment/Scenes/Entity.cs | 10 ++-- OpenSim/Region/Environment/Scenes/EntityBase.cs | 14 ++--- OpenSim/Region/Environment/Scenes/Primitive.cs | 60 +++++++++++----------- .../Environment/Scenes/Scene.PacketHandlers.cs | 4 +- OpenSim/Region/Environment/Scenes/Scene.cs | 4 +- OpenSim/Region/Environment/Scenes/SceneObject.cs | 6 +-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 2 +- 12 files changed, 60 insertions(+), 64 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 6206f65..fdc21cf 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Capabilities string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; caps.MapLayer = capsBaseUrl + m_mapLayerPath; - caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; + // caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; return caps; } diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs index 1522559..1f8b242 100644 --- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs @@ -4,7 +4,7 @@ namespace OpenSim.Region.Capabilities public class LLSDCapsDetails { public string MapLayer = ""; - public string NewFileAgentInventory = ""; + //public string NewFileAgentInventory = ""; //public string EventQueueGet = ""; public LLSDCapsDetails() diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 3c1df75..5866b45 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -64,11 +64,11 @@ namespace OpenSim.Region.ClientStack public event GenericCall7 OnObjectName; public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimTexture OnUpdatePrimTexture; - public event UpdateVector OnUpdatePrimPosition; + public event UpdateVector OnUpdatePrimGroupPosition; public event UpdateVector OnUpdatePrimSinglePosition; - public event UpdatePrimRotation OnUpdatePrimRotation; + public event UpdatePrimRotation OnUpdatePrimGroupRotation; public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; - public event UpdatePrimGroupRotation OnUpdatePrimGroupRotation; + public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; public event UpdateVector OnUpdatePrimScale; public event StatusChange OnChildAgentStatus; public event GenericCall2 OnStopMovement; diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 5cea28a..31ea3eb 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -107,10 +107,10 @@ namespace OpenSim.Region.ClientStack #region position if (multipleupdate.ObjectData[i].Type == 9) //change position { - if (OnUpdatePrimPosition != null) + if (OnUpdatePrimGroupPosition != null) { LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); } } @@ -145,22 +145,22 @@ namespace OpenSim.Region.ClientStack } else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab { - if (OnUpdatePrimRotation != null) + if (OnUpdatePrimGroupRotation != null) { libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); } } else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse { - if (OnUpdatePrimGroupRotation != null) + if (OnUpdatePrimGroupMouseRotation != null) { libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); + OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); } } #endregion diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index c697faa..084c9ab 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -83,12 +83,12 @@ namespace OpenSim.Region.Environment.Scenes { if (this._physActor != null) { - velocity.X = _physActor.Velocity.X; - velocity.Y = _physActor.Velocity.Y; - velocity.Z = _physActor.Velocity.Z; + m_velocity.X = _physActor.Velocity.X; + m_velocity.Y = _physActor.Velocity.Y; + m_velocity.Z = _physActor.Velocity.Z; } - return velocity; + return m_velocity; } set { @@ -108,7 +108,7 @@ namespace OpenSim.Region.Environment.Scenes } } - velocity = value; + m_velocity = value; } } } diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 7914bab..6360ae1 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public LLVector3 velocity; + public LLVector3 m_velocity; /// /// @@ -47,25 +47,25 @@ namespace OpenSim.Region.Environment.Scenes { get { - return velocity; + return m_velocity; } set { - velocity = value; + m_velocity = value; } } - public Quaternion _rotation = new Quaternion(0,0,1,0); + protected Quaternion m_rotation = new Quaternion(0,0,1,0); public virtual Quaternion rotation { get { - return _rotation; + return m_rotation; } set { - _rotation = value; + m_rotation = value; } } @@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Scenes uuid = new LLUUID(); m_pos = new LLVector3(); - velocity = new LLVector3(); + m_velocity = new LLVector3(); rotation = new Quaternion(); m_name = "(basic entity)"; children = new List(); diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 8d31d63..05bb1f9 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -16,11 +16,11 @@ namespace OpenSim.Region.Environment.Scenes private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); private ulong m_regionHandle; private byte updateFlag = 0; - private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; + private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; private Dictionary inventoryItems; - private string description = ""; + private string m_description = ""; public string SitName = ""; public string TouchName = ""; @@ -42,19 +42,19 @@ namespace OpenSim.Region.Environment.Scenes private PrimitiveBaseShape m_Shape; public SceneObject m_RootParent; - public bool isRootPrim; + public bool m_isRootPrim; public EntityBase m_Parent; #region Properties /// - /// If rootprim will return world position + /// If rootprim, will return world position /// otherwise will return local offset from rootprim /// public override LLVector3 Pos { get { - if (isRootPrim) + if (m_isRootPrim) { //if we are rootprim then our offset should be zero return this.m_pos + m_Parent.Pos; @@ -66,7 +66,7 @@ namespace OpenSim.Region.Environment.Scenes } set { - if (isRootPrim) + if (m_isRootPrim) { m_Parent.Pos = value; } @@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment.Scenes { get { - if (!this.isRootPrim) + if (!this.m_isRootPrim) { Primitive parentPrim = (Primitive)this.m_Parent; Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); @@ -97,11 +97,11 @@ namespace OpenSim.Region.Environment.Scenes { get { - return this.description; + return this.m_description; } set { - this.description = value; + this.m_description = value; } } @@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Scenes m_world = world; inventoryItems = new Dictionary(); this.m_Parent = parent; - this.isRootPrim = isRoot; + this.m_isRootPrim = isRoot; this.m_RootParent = rootObject; this.CreateFromPacket(addPacket, ownerID, localID); this.rotation = Axiom.Math.Quaternion.Identity; @@ -271,7 +271,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetNewParent(Primitive newParent, SceneObject rootParent) { LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); - this.isRootPrim = false; + this.m_isRootPrim = false; this.m_Parent = newParent; this.ParentID = newParent.LocalId; this.m_RootParent = rootParent; @@ -305,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); oldPos += oldParentPosition; Axiom.Math.Quaternion oldRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); - this.isRootPrim = false; + this.m_isRootPrim = false; this.m_Parent = newParent; this.ParentID = newParent.LocalId; newParent.AddToChildrenList(this); @@ -359,7 +359,7 @@ namespace OpenSim.Region.Environment.Scenes offset.X /= 2; offset.Y /= 2; offset.Z /= 2; - if (this.isRootPrim) + if (this.m_isRootPrim) { this.m_Parent.Pos += offset; } @@ -380,7 +380,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void UpdatePosition(LLVector3 pos) + public void UpdateGroupPosition(LLVector3 pos) { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); @@ -395,7 +395,7 @@ namespace OpenSim.Region.Environment.Scenes public void UpdateSinglePosition(LLVector3 pos) { // Console.WriteLine("updating single prim position"); - if (this.isRootPrim) + if (this.m_isRootPrim) { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); @@ -429,10 +429,23 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void UpdateRotation(LLQuaternion rot) + public void UpdateGroupRotation(LLQuaternion rot) { this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); this.updateFlag = 2; + + } + + /// + /// + /// + /// + /// + public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) + { + this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.Pos = pos; + this.updateFlag = 2; } /// @@ -457,19 +470,6 @@ namespace OpenSim.Region.Environment.Scenes } this.updateFlag = 2; } - - /// - /// - /// - /// - /// - public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) - { - this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); - this.Pos = pos; - this.updateFlag = 2; - } - #endregion #region Shape @@ -530,7 +530,7 @@ namespace OpenSim.Region.Environment.Scenes LLQuaternion lRot; lRot = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); - remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID); + remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, new LLUUID("00000000-0000-0000-9999-000000000005"), this.m_flags, this.uuid, this.OwnerID, this.Text, this.ParentID); } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 35e0ea6..6dc9968 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -438,7 +438,7 @@ namespace OpenSim.Region.Environment.Scenes prim = ((SceneObject)ent).HasChildPrim(localID); if (prim != null) { - prim.UpdatePosition(pos); + prim.UpdateGroupPosition(pos); break; } } @@ -502,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes prim = ((SceneObject)ent).HasChildPrim(localID); if (prim != null) { - prim.UpdateRotation(rot); + prim.UpdateGroupRotation(rot); break; } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1798cba..5e08d53 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -469,10 +469,10 @@ namespace OpenSim.Region.Environment.Scenes client.OnInstantMessage += this.InstantMessage; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; - client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; - client.OnUpdatePrimRotation += this.UpdatePrimRotation; client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; + client.OnUpdatePrimGroupMouseRotation += this.UpdatePrimRotation; client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; client.OnUpdatePrimScale += this.UpdatePrimScale; client.OnUpdatePrimShape += this.UpdatePrimShape; diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 2b80d57..ecd2dee 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -216,8 +216,6 @@ namespace OpenSim.Region.Environment.Scenes /// public void GetProperites(IClientAPI client) { - - //needs changing ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); @@ -242,9 +240,7 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask; proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask; - client.OutPacket(proper); - + client.OutPacket(proper); } - } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 14b7b2f..d335699 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes newpos.Y = 1; } - LLVector3 vel = this.velocity; + LLVector3 vel = this.m_velocity; ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); if (neighbourRegion != null) diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 3245223..da1b43d 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -54,7 +54,7 @@ namespace SimpleApp client.OnRequestWearables += SendWearables; client.OnAddPrim += AddNewPrim; - client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; client.OnGrapUpdate += this.MoveObject; -- cgit v1.1 From d91f33b87b4578eb5e5a9ef22f383ed598cc28e2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 19:56:22 +0000 Subject: Re-applied dalien patch (#175) and included bin\data with avataranimations.xml --- OpenSim/Region/ClientStack/ClientView.API.cs | 15 ++++++++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 33 +++++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 5866b45..48d5b9d 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -528,6 +528,21 @@ namespace OpenSim.Region.ClientStack OutPacket(avp); } + public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) + { + AvatarAnimationPacket ani = new AvatarAnimationPacket(); + ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; + ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); + ani.AnimationSourceList[0].ObjectID = sourceAgentId; + ani.Sender = new AvatarAnimationPacket.SenderBlock(); + ani.Sender.ID = sourceAgentId; + ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; + ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); + ani.AnimationList[0].AnimID = animID; + ani.AnimationList[0].AnimSequenceID = seq; + this.OutPacket(ani); + } + #endregion #region Avatar Packet/data sending Methods diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index d335699..b0e7710 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -122,6 +122,8 @@ namespace OpenSim.Region.Environment.Scenes } Wearables = AvatarWearable.DefaultWearables; + Animations = new ScenePresence.AvatarAnimations(); + Animations.LoadAnims(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); @@ -274,9 +276,27 @@ namespace OpenSim.Region.Environment.Scenes { this.AddNewMovement(agent_control_v3, q); } - + UpdateMovementAnimations(update_movementflag); } + protected void UpdateMovementAnimations(bool update_movementflag) + { + if (update_movementflag) + { + if (movementflag != 0) { + if (this._physActor.Flying) { + this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); + } else { + this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); + } + } else { + this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); + } + } + + } + + protected void AddNewMovement(Vector3 vec, Quaternion rotation) { NewForce newVelocity = new NewForce(); @@ -403,8 +423,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack(LLUUID animID, int seq) { - - + this.current_anim = animID; + this.anim_seq = anim_seq; + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); + } } /// @@ -412,7 +437,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack() { - + this.SendAnimPack(this.current_anim, this.anim_seq); } #endregion -- cgit v1.1 From 08a1fa3f96eee5e067475da453a3770ff15780f9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 21:03:36 +0000 Subject: * Introduced ClientManager for great justice. --- OpenSim/Region/ClientStack/PacketServer.cs | 2 +- OpenSim/Region/Environment/Scenes/PrimitiveOld.cs | 2 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 84 +++++++++++----------- OpenSim/Region/Environment/Scenes/Scene.cs | 28 ++++---- OpenSim/Region/Environment/Scenes/SceneBase.cs | 3 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 2 +- 6 files changed, 62 insertions(+), 59 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index b5f0a02..5e62450 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.ClientStack private ClientStackNetworkHandler _networkHandler; private IWorld _localWorld; public Dictionary ClientThreads = new Dictionary(); - public Dictionary ClientAPIs = new Dictionary(); + public ClientManager ClientAPIs = new ClientManager(); public PacketServer(ClientStackNetworkHandler networkHandler) { diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs index 247ff87..4933b01 100644 --- a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs +++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Environment.Scenes { internal PrimData primData; private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); - // private Dictionary m_clientThreads; + // private ClientManager m_clientThreads; private ulong m_regionHandle; private const uint FULL_MASK_PERMISSIONS = 2147483647; private bool physicsEnabled = false; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 6dc9968..bb19996 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -139,48 +139,50 @@ namespace OpenSim.Region.Environment.Scenes { // Console.WriteLine("Chat message"); ScenePresence avatar = null; - foreach (IClientAPI client in m_clientThreads.Values) - { - int dis = -1000; - if (this.Avatars.ContainsKey(client.AgentId)) - { - - avatar = this.Avatars[client.AgentId]; - // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); - dis= (int)avatar.Pos.GetDistanceTo(fromPos); - //Console.WriteLine("found avatar at " +dis); - - } - - switch (type) - { - case 0: // Whisper - if ((dis < 10) && (dis > -10)) - { - //should change so the message is sent through the avatar rather than direct to the ClientView - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 1: // Say - if ((dis < 30) && (dis > -30)) - { - Console.WriteLine("sending chat"); - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 2: // Shout - if ((dis < 100) && (dis > -100)) - { - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 0xff: // Broadcast - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - break; - } - - } + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + int dis = -1000; + if (this.Avatars.ContainsKey(client.AgentId)) + { + avatar = this.Avatars[client.AgentId]; + // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); + dis = (int) avatar.Pos.GetDistanceTo(fromPos); + //Console.WriteLine("found avatar at " +dis); + } + + switch (type) + { + case 0: // Whisper + if ((dis < 10) && (dis > -10)) + { + //should change so the message is sent through the avatar rather than direct to the ClientView + client.SendChatMessage(message, type, fromPos, fromName, + fromAgentID); + } + break; + case 1: // Say + if ((dis < 30) && (dis > -30)) + { + Console.WriteLine("sending chat"); + client.SendChatMessage(message, type, fromPos, fromName, + fromAgentID); + } + break; + case 2: // Shout + if ((dis < 100) && (dis > -100)) + { + client.SendChatMessage(message, type, fromPos, fromName, + fromAgentID); + } + break; + + case 0xff: // Broadcast + client.SendChatMessage(message, type, fromPos, fromName, + fromAgentID); + break; + } + }); } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5e08d53..043dcd7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -98,7 +98,7 @@ namespace OpenSim.Region.Environment.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + public Scene(ClientManager clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) { updateLock = new Mutex(false); this.authenticateHandler = authen; @@ -229,11 +229,11 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(client); - } - + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + this.SendLayerData(client); + }); + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); @@ -260,10 +260,10 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(client); - } + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + this.SendLayerData(client); + }); foreach (LLUUID UUID in Entities.Keys) { @@ -290,10 +290,10 @@ namespace OpenSim.Region.Environment.Scenes { /* Dont save here, rely on tainting system instead */ - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(pointx, pointy, client); - } + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + this.SendLayerData(pointx, pointy, client); + }); } } catch (Exception e) diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 4036743..44121b4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -34,13 +34,14 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Region.Caches; using OpenSim.Region.Terrain; +using OpenSim.Framework; namespace OpenSim.Region.Environment.Scenes { public abstract class SceneBase : IWorld { public Dictionary Entities; - protected Dictionary m_clientThreads; + protected ClientManager m_clientThreads; protected ulong m_regionHandle; protected string m_regionName; protected RegionInfo m_regInfo; diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index da1b43d..b82529a 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -15,7 +15,7 @@ namespace SimpleApp { private List m_avatars; - public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + public MyWorld(ClientManager clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) { m_avatars = new List(); -- cgit v1.1 From 85dd493614cda12488eb7920713ddda07c921dbc Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 21:25:43 +0000 Subject: * some follow up renaming of members et c. --- OpenSim/Region/Application/OpenSimMain.cs | 2 +- OpenSim/Region/ClientStack/PacketServer.cs | 8 ++++++-- OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++----- OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 4 ++-- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index c5c9efc..949c369 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -217,7 +217,7 @@ namespace OpenSim m_udpServer.Add(udpServer); this.regionData.Add(regionDat); - LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager, this.AssetCache, httpServer); + LocalWorld = new Scene(udpServer.PacketServer.ClientManager, regionDat, authenBase, commsManager, this.AssetCache, httpServer); this.m_localWorld.Add(LocalWorld); //LocalWorld.InventoryCache = InventoryCache; //LocalWorld.AssetCache = AssetCache; diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 5e62450..c7ca315 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -41,7 +41,11 @@ namespace OpenSim.Region.ClientStack private ClientStackNetworkHandler _networkHandler; private IWorld _localWorld; public Dictionary ClientThreads = new Dictionary(); - public ClientManager ClientAPIs = new ClientManager(); + private ClientManager m_clientManager = new ClientManager(); + public ClientManager ClientManager + { + get { return m_clientManager; } + } public PacketServer(ClientStackNetworkHandler networkHandler) { @@ -150,7 +154,7 @@ namespace OpenSim.Region.ClientStack authenticateSessionsClass); this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); - this.ClientAPIs.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); + this.m_clientManager.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); return true; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index bb19996..e64e147 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -140,7 +140,7 @@ namespace OpenSim.Region.Environment.Scenes // Console.WriteLine("Chat message"); ScenePresence avatar = null; - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { int dis = -1000; if (this.Avatars.ContainsKey(client.AgentId)) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 043dcd7..81c56c4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -98,13 +98,13 @@ namespace OpenSim.Region.Environment.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(ClientManager clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + public Scene(ClientManager clientManager, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) { updateLock = new Mutex(false); this.authenticateHandler = authen; this.commsManager = commsMan; this.assetCache = assetCach; - m_clientThreads = clientThreads; + m_clientManager = clientManager; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -229,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { this.SendLayerData(client); }); @@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { this.SendLayerData(client); }); @@ -290,7 +290,7 @@ namespace OpenSim.Region.Environment.Scenes { /* Dont save here, rely on tainting system instead */ - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { this.SendLayerData(pointx, pointy, client); }); diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 44121b4..811f54c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes public abstract class SceneBase : IWorld { public Dictionary Entities; - protected ClientManager m_clientThreads; + protected ClientManager m_clientManager; protected ulong m_regionHandle; protected string m_regionName; protected RegionInfo m_regInfo; diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index b82529a..3c69420 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -15,8 +15,8 @@ namespace SimpleApp { private List m_avatars; - public MyWorld(ClientManager clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) - : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) + public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + : base(clientManager, regionInfo, authen, commsMan, assetCach, httpServer) { m_avatars = new List(); } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 4567d7e..5cfc769 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -54,7 +54,7 @@ namespace SimpleApp RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" ); BaseHttpServer httpServer = new BaseHttpServer( internalEndPoint.Port ); - MyWorld world = new MyWorld(packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); + MyWorld world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); world.PhysScene = PhysicsScene.Null; udpServer.LocalWorld = world; -- cgit v1.1 From 9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 23:32:29 +0000 Subject: * LLSDStreamhandler now works. --- OpenSim/Region/Capabilities/Caps.cs | 20 ++++++++++---------- OpenSim/Region/Capabilities/LLSDStreamHandler.cs | 14 ++++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index fdc21cf..6068076 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -74,10 +74,10 @@ namespace OpenSim.Region.Capabilities string capsBase = "/CAPS/" + m_capsObjectPath; - AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); + //AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); - //httpListener.AddStreamHandler( - // new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); + httpListener.AddStreamHandler( + new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); @@ -86,13 +86,6 @@ namespace OpenSim.Region.Capabilities } - public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) - { - LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); - mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); - return mapResponse; - } - [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) { @@ -151,6 +144,13 @@ namespace OpenSim.Region.Capabilities return res; } + public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) + { + LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + return mapResponse; + } + /// /// diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs index ff63353..7d99b6e 100644 --- a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs @@ -14,25 +14,27 @@ namespace OpenSim.Region.Capabilities private LLSDMethod m_method; public LLSDStreamhandler(string httpMethod, string path, LLSDMethod method) - : base(httpMethod, path) + : base(httpMethod, path ) { m_method = method; } public override byte[] Handle(string path, Stream request) { - Encoding encoding = Encoding.UTF8; - StreamReader streamReader = new StreamReader(request, encoding); + //Encoding encoding = Encoding.UTF8; + //StreamReader streamReader = new StreamReader(request, false); - string requestBody = streamReader.ReadToEnd(); - streamReader.Close(); + //string requestBody = streamReader.ReadToEnd(); + //streamReader.Close(); - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody)); + Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); TRequest llsdRequest = new TRequest(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); TResponse response = m_method(llsdRequest); + Encoding encoding = new UTF8Encoding(false); + return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); } -- cgit v1.1 From 7f03246653a6f277505d2055528cbb8dd2e1f4c1 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 10 Jul 2007 17:56:31 +0000 Subject: Gird mode in sugilite should now work in so far as you should be able to login and move between regions in the same instance. Moving to regions in a different instance of opensim still needs implementing (working on it now). Also trying to look at the map in grid mode will crash the server. --- OpenSim/Region/Application/OpenSimMain.cs | 12 ++- .../ClientStack/ClientView.ProcessPackets.cs | 1 - OpenSim/Region/ClientStack/ClientViewBase.cs | 3 +- .../Communications/Local/CommunicationsLocal.cs | 5 +- .../Communications/OGS1/CommunicationsOGS1.cs | 5 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 93 ++++++++++++++-------- .../Region/Communications/OGS1/OGS1UserServices.cs | 1 - OpenSim/Region/Environment/Scenes/EntityBase.cs | 4 +- OpenSim/Region/Environment/Scenes/Primitive.cs | 38 ++++----- OpenSim/Region/Environment/Scenes/PrimitiveOld.cs | 2 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 3 - OpenSim/Region/Environment/Scenes/ScenePresence.cs | 62 ++++++++------- OpenSim/Region/Examples/SimpleApp/Program.cs | 4 +- 14 files changed, 133 insertions(+), 102 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 949c369..728329e 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -93,17 +93,17 @@ namespace OpenSim ClientView.TerrainManager = new TerrainManager(new SecondLife()); + this.SetupHttpListener(); + if (m_sandbox) { this.SetupLocalGridServers(); // this.checkServer = new CheckSumServer(12036); // this.checkServer.ServerListener(); - this.commsManager = new CommunicationsLocal(this.serversData); } else { this.SetupRemoteGridServers(); - this.commsManager = new CommunicationsOGS1(this.serversData); } startuptime = DateTime.Now; @@ -111,14 +111,10 @@ namespace OpenSim this.physManager = new PhysicsManager(); this.physManager.LoadPlugins(); - this.SetupHttpListener(); - this.SetupWorld(); m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); - - if (m_sandbox) { httpServer.AddXmlRPCHandler("login_to_simulator", ((CommunicationsLocal)this.commsManager).UserServices.XmlRpcLoginMethod); @@ -143,6 +139,7 @@ namespace OpenSim { AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); InventoryCache = new InventoryCache(); + this.commsManager = new CommunicationsLocal(this.serversData, httpServer); } catch (Exception e) { @@ -156,8 +153,9 @@ namespace OpenSim { try { - AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Remote.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); InventoryCache = new InventoryCache(); + this.commsManager = new CommunicationsOGS1(this.serversData, httpServer); } catch (Exception e) { diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 982ae50..7d924d0 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -41,7 +41,6 @@ namespace OpenSim.Region.ClientStack protected override void ProcessInPacket(Packet Pack) { ack_pack(Pack); - debug = true; if (debug) { if (Pack.Type != PacketType.AgentUpdate) diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index 24c6911..ec7b039 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -71,7 +71,8 @@ namespace OpenSim.Region.ClientStack // Keep track of when this packet was sent out Pack.TickCount = Environment.TickCount; - Console.WriteLine("OUT: " + Pack.Type.ToString()); + + // Console.WriteLine("OUT: " + Pack.Type.ToString()); if (!Pack.Header.Resent) { diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 5d6ede8..a047843 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -27,6 +27,7 @@ */ using OpenSim.Framework.Communications; using OpenSim.Framework.Types; +using OpenSim.Framework.Servers; namespace OpenSim.Region.Communications.Local { @@ -35,8 +36,8 @@ namespace OpenSim.Region.Communications.Local public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); public LocalUserServices UserServices; - public CommunicationsLocal(NetworkServersInfo serversInfo) - : base(serversInfo) + public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) + : base(serversInfo, httpServer) { UserServices = new LocalUserServices(this, serversInfo); UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 1118726..cc05845 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -1,14 +1,15 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Types; +using OpenSim.Framework.Servers; namespace OpenSim.Region.Communications.OGS1 { public class CommunicationsOGS1 : CommunicationsManager { - public CommunicationsOGS1(NetworkServersInfo serversInfo) :base(serversInfo) + public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) :base(serversInfo, httpServer) { - OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo); + OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); GridServer = gridInterComms; InterRegion = gridInterComms; UserServer = new OGS1UserServices(this); diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index b7d62ed..50a31c6 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -18,40 +18,50 @@ namespace OpenSim.Region.Communications.OGS1 public class OGS1GridServices : IGridServices, IInterRegionCommunications { public Dictionary listeners = new Dictionary(); + protected Dictionary regions = new Dictionary(); + public BaseHttpServer httpListener; public NetworkServersInfo serversInfo; + public BaseHttpServer httpServer; - public OGS1GridServices(NetworkServersInfo servers_info) + public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe) { serversInfo = servers_info; + httpServer = httpServe; + httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); } public RegionCommsListener RegisterRegion(RegionInfo regionInfo) { + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + this.regions.Add(regionInfo.RegionHandle, regionInfo); + } + Hashtable GridParams = new Hashtable(); // Login / Authentication - - GridParams["authkey"] = serversInfo.GridSendKey; + + GridParams["authkey"] = serversInfo.GridSendKey; GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); GridParams["sim_ip"] = regionInfo.ExternalHostName; GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); GridParams["sim_name"] = regionInfo.RegionName; + GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); + GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString(); // Package into an XMLRPC Request - ArrayList SendParams = new ArrayList(); + ArrayList SendParams = new ArrayList(); SendParams.Add(GridParams); - - // Send Request XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); Hashtable GridRespData = (Hashtable)GridResp.Value; - + Hashtable griddatahash = GridRespData; // Process Response @@ -60,25 +70,34 @@ namespace OpenSim.Region.Communications.OGS1 string errorstring = (string)GridRespData["error"]; MainLog.Instance.Error("Unable to connect to grid: " + errorstring); return null; - } - - if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) - { - MainLog.Instance.Verbose("OGS1 - Registering new HTTP listener on port " + regionInfo.InternalEndPoint.Port.ToString()); - // initialised = true; - httpListener = new BaseHttpServer( regionInfo.InternalEndPoint.Port ); - httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); - httpListener.Start(); } + /* if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) + { + MainLog.Instance.Verbose("OGS1 - Registering new HTTP listener on port " + regionInfo.InternalEndPoint.Port.ToString()); + // initialised = true; + httpListener = new BaseHttpServer( regionInfo.InternalEndPoint.Port ); + httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); + httpListener.Start(); + }*/ + // Initialise the background listeners - listeners[regionInfo.RegionHandle] = new RegionCommsListener(); + RegionCommsListener regListener = new RegionCommsListener(); + if (this.listeners.ContainsKey(regionInfo.RegionHandle)) + { + this.listeners.Add(regionInfo.RegionHandle, regListener); + } + else + { + listeners[regionInfo.RegionHandle] = regListener; + } - return listeners[regionInfo.RegionHandle]; + return regListener; } public List RequestNeighbours(RegionInfo regionInfo) { + Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); List neighbours = new List(); @@ -87,24 +106,28 @@ namespace OpenSim.Region.Communications.OGS1 { foreach (Hashtable n in a) { - string internalIpStr = (string)n["sim_ip"]; - int port = (int)n["sim_port"]; - string externalUri = (string)n["sim_uri"]; - - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), port); - string neighbourExternalUri = externalUri; + uint regX = Convert.ToUInt32(n["x"]); + uint regY = Convert.ToUInt32(n["y"]); + if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY)) + { + string internalIpStr = (string)n["sim_ip"]; + uint port = Convert.ToUInt32(n["sim_port"]); + string externalUri = (string)n["sim_uri"]; - RegionInfo neighbour = new RegionInfo((uint)n["x"], (uint)n["y"], neighbourInternalEndPoint, neighbourExternalUri); + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); + string neighbourExternalUri = externalUri; + RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); - //OGS1 - //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally + //OGS1 + //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally - neighbour.RegionName = (string)n["name"]; + neighbour.RegionName = (string)n["name"]; - //OGS1+ - neighbour.SimUUID = (string)n["uuid"]; + //OGS1+ + neighbour.SimUUID = (string)n["uuid"]; - neighbours.Add(neighbour); + neighbours.Add(neighbour); + } } } @@ -113,6 +136,11 @@ namespace OpenSim.Region.Communications.OGS1 public RegionInfo RequestNeighbourInfo(ulong regionHandle) { + if (this.regions.ContainsKey(regionHandle)) + { + return this.regions[regionHandle]; + } + //TODO not a region in this instance so ask remote grid server MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); return null; } @@ -209,7 +237,7 @@ namespace OpenSim.Region.Communications.OGS1 TcpChannel ch = new TcpChannel(8895); ChannelServices.RegisterChannel(ch, true); - WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); + WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wellType); InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; @@ -225,6 +253,7 @@ namespace OpenSim.Region.Communications.OGS1 } //TODO need to see if we know about where this region is and use .net remoting // to inform it. + Console.WriteLine("Inform remote region of child agent not implemented yet"); return false; } diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 3a3bccb..2bbaf9d 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -47,7 +47,6 @@ namespace OpenSim.Region.Communications.OGS1 } public UserProfileData GetUserProfile(string name) { - //try //{ Hashtable param = new Hashtable(); diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 6360ae1..65a0395 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Scenes protected Quaternion m_rotation = new Quaternion(0,0,1,0); - public virtual Quaternion rotation + public virtual Quaternion Rotation { get { @@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Scenes m_pos = new LLVector3(); m_velocity = new LLVector3(); - rotation = new Quaternion(); + Rotation = new Quaternion(); m_name = "(basic entity)"; children = new List(); } diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 05bb1f9..d23a569 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes { Primitive parentPrim = (Primitive)this.m_Parent; Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); - offsetPos = parentPrim.rotation * offsetPos; + offsetPos = parentPrim.Rotation * offsetPos; return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z); } else @@ -139,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes this.m_isRootPrim = isRoot; this.m_RootParent = rootObject; this.CreateFromPacket(addPacket, ownerID, localID); - this.rotation = Axiom.Math.Quaternion.Identity; + this.Rotation = Axiom.Math.Quaternion.Identity; } /// @@ -169,7 +169,7 @@ namespace OpenSim.Region.Environment.Scenes dupe.LocalId = newLocalID; dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); - dupe.rotation = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); + dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); return dupe; @@ -278,10 +278,10 @@ namespace OpenSim.Region.Environment.Scenes this.m_RootParent.AddChildToList(this); this.Pos = oldPos; Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); - axPos = this.m_Parent.rotation.Inverse() * axPos; + axPos = this.m_Parent.Rotation.Inverse() * axPos; this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - Axiom.Math.Quaternion oldRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); - this.rotation = this.m_Parent.rotation.Inverse() * this.rotation; + Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); + this.Rotation = this.m_Parent.Rotation.Inverse() * this.Rotation; this.updateFlag = 1; foreach (Primitive child in children) @@ -304,7 +304,7 @@ namespace OpenSim.Region.Environment.Scenes axOldPos = oldParentRotation * axOldPos; oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); oldPos += oldParentPosition; - Axiom.Math.Quaternion oldRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); + Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); this.m_isRootPrim = false; this.m_Parent = newParent; this.ParentID = newParent.LocalId; @@ -313,10 +313,10 @@ namespace OpenSim.Region.Environment.Scenes this.m_RootParent.AddChildToList(this); this.Pos = oldPos; Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); - axPos = this.m_Parent.rotation.Inverse() * axPos; + axPos = this.m_Parent.Rotation.Inverse() * axPos; this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - this.rotation = oldParentRotation * this.rotation; - this.rotation = this.m_Parent.rotation.Inverse()* this.rotation ; + this.Rotation = oldParentRotation * this.Rotation; + this.Rotation = this.m_Parent.Rotation.Inverse()* this.Rotation ; this.updateFlag = 1; foreach (Primitive child in children) { @@ -401,7 +401,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); LLVector3 diff = oldPos - newPos; Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); - axDiff = this.rotation.Inverse() * axDiff; + axDiff = this.Rotation.Inverse() * axDiff; diff.X = axDiff.x; diff.Y = axDiff.y; diff.Z = axDiff.z; @@ -431,7 +431,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdateGroupRotation(LLQuaternion rot) { - this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); this.updateFlag = 2; } @@ -443,7 +443,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) { - this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); this.Pos = pos; this.updateFlag = 2; } @@ -456,16 +456,16 @@ namespace OpenSim.Region.Environment.Scenes { //Console.WriteLine("updating single prim rotation"); Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); - Axiom.Math.Quaternion oldParentRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z); - this.rotation = axRot; + Axiom.Math.Quaternion oldParentRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); + this.Rotation = axRot; foreach (Primitive prim in this.children) { Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); axPos = oldParentRot * axPos; axPos = axRot.Inverse() * axPos; prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - prim.rotation = oldParentRot * prim.rotation ; - prim.rotation = axRot.Inverse()* prim.rotation; + prim.Rotation = oldParentRot * prim.Rotation ; + prim.Rotation = axRot.Inverse()* prim.Rotation; prim.updateFlag = 2; } this.updateFlag = 2; @@ -528,7 +528,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 lPos; lPos = this.Pos; LLQuaternion lRot; - lRot = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); + lRot = new LLQuaternion(this.Rotation.x, this.Rotation.y, this.Rotation.z, this.Rotation.w); remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, new LLUUID("00000000-0000-0000-9999-000000000005"), this.m_flags, this.uuid, this.OwnerID, this.Text, this.ParentID); } @@ -571,7 +571,7 @@ namespace OpenSim.Region.Environment.Scenes Quaternion lRot; lPos = this.Pos; - lRot = this.rotation; + lRot = this.Rotation; LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs index 4933b01..91a4162 100644 --- a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs +++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs @@ -445,7 +445,7 @@ namespace OpenSim.Region.Environment.Scenes else { lPos = this.Pos; - lRot = this.rotation; + lRot = this.Rotation; } LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index e64e147..69eaa75 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Scenes case 1: // Say if ((dis < 30) && (dis > -30)) { - Console.WriteLine("sending chat"); + //Console.WriteLine("sending chat"); client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 81c56c4..cd81384 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -685,15 +685,12 @@ namespace OpenSim.Region.Environment.Scenes /// public void InformClientOfNeighbours(IClientAPI remoteClient) { - // Console.WriteLine("informing client of neighbouring regions"); List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); - //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); if (neighbours != null) { for (int i = 0; i < neighbours.Count; i++) { - // Console.WriteLine("sending neighbours data"); AgentCircuitData agent = remoteClient.RequestClientInfo(); agent.BaseFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b0e7710..7330bc5 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes Wearables = AvatarWearable.DefaultWearables; Animations = new ScenePresence.AvatarAnimations(); Animations.LoadAnims(); - + this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); //register for events @@ -160,7 +160,7 @@ namespace OpenSim.Region.Environment.Scenes { this.Velocity = new LLVector3(0, 0, 0); this.Pos = new LLVector3(128, 128, 70); - + } } @@ -276,25 +276,31 @@ namespace OpenSim.Region.Environment.Scenes { this.AddNewMovement(agent_control_v3, q); } - UpdateMovementAnimations(update_movementflag); + UpdateMovementAnimations(update_movementflag); } - protected void UpdateMovementAnimations(bool update_movementflag) - { - if (update_movementflag) - { - if (movementflag != 0) { - if (this._physActor.Flying) { - this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); - } else { - this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); - } - } else { - this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); - } - } - - } + protected void UpdateMovementAnimations(bool update_movementflag) + { + if (update_movementflag) + { + if (movementflag != 0) + { + if (this._physActor.Flying) + { + this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); + } + else + { + this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); + } + } + else + { + this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); + } + } + + } protected void AddNewMovement(Vector3 vec, Quaternion rotation) @@ -423,13 +429,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack(LLUUID animID, int seq) { - this.current_anim = animID; - this.anim_seq = anim_seq; - List avatars = this.m_world.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); - } + this.current_anim = animID; + this.anim_seq = anim_seq; + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); + } } /// @@ -437,7 +443,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack() { - this.SendAnimPack(this.current_anim, this.anim_seq); + this.SendAnimPack(this.current_anim, this.anim_seq); } #endregion @@ -506,7 +512,7 @@ namespace OpenSim.Region.Environment.Scenes if (res) { this.MakeChildAgent(); - this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.InternalEndPoint ); + this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.InternalEndPoint); } } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 5cfc769..87e877c 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -47,13 +47,13 @@ namespace SimpleApp udpServer.ServerListener(); ClientView.TerrainManager = new TerrainManager(new SecondLife()); + BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); NetworkServersInfo serverInfo = new NetworkServersInfo(); - CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo); + CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer); RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" ); - BaseHttpServer httpServer = new BaseHttpServer( internalEndPoint.Port ); MyWorld world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); world.PhysScene = PhysicsScene.Null; udpServer.LocalWorld = world; -- cgit v1.1 From ebdc64730a832a6e5dc2dc7d304eff813c73e933 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 10 Jul 2007 18:58:42 +0000 Subject: Fixed the crashing when trying to look at the map in grid mode. Although the textures for the regions don't seem to show up, about to look into that. --- .../Region/Communications/OGS1/OGS1GridServices.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 50a31c6..1cadf9b 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -151,20 +151,23 @@ namespace OpenSim.Region.Communications.OGS1 List neighbours = new List(); - foreach (Hashtable n in (Hashtable)respData.Values) + foreach (ArrayList a in respData.Values) { - MapBlockData neighbour = new MapBlockData(); + foreach (Hashtable n in a) + { + MapBlockData neighbour = new MapBlockData(); - neighbour.X = (ushort)n["x"]; - neighbour.Y = (ushort)n["y"]; + neighbour.X = Convert.ToUInt16(n["x"]); + neighbour.Y = Convert.ToUInt16(n["y"]); - neighbour.Name = (string)n["name"]; - neighbour.Access = (byte)n["access"]; - neighbour.RegionFlags = (uint)n["region-flags"]; - neighbour.WaterHeight = (byte)n["water-height"]; - neighbour.MapImageId = (string)n["map-image-id"]; + neighbour.Name = (string)n["name"]; + neighbour.Access = Convert.ToByte(n["access"]); + neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); + neighbour.WaterHeight = Convert.ToByte(n["water-height"]); + neighbour.MapImageId = (string)n["map-image-id"]; - neighbours.Add(neighbour); + neighbours.Add(neighbour); + } } return neighbours; -- cgit v1.1 From f0ecc1de4ccb40ed23b5bc925130bda3ff07c1a6 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 10 Jul 2007 20:52:43 +0000 Subject: preliminary inter region communications (between regions in different instances) now works, so child agents and border crossings (and teleporting) now work. The .net remoting is still very basic: we need security sinks added. And we really need the OGS 2 protocol as soon as possible. --- .../Region/Communications/OGS1/OGS1GridServices.cs | 97 ++++++++++++++++++++-- .../GridInterfaces/Local/LocalAssetServer.cs | 1 + 2 files changed, 89 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1cadf9b..66c1739 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -29,6 +29,7 @@ namespace OpenSim.Region.Communications.OGS1 serversInfo = servers_info; httpServer = httpServe; httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); + this.StartRemoting(); } public RegionCommsListener RegisterRegion(RegionInfo regionInfo) @@ -52,6 +53,7 @@ namespace OpenSim.Region.Communications.OGS1 GridParams["sim_name"] = regionInfo.RegionName; GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString(); + GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated(); // Package into an XMLRPC Request ArrayList SendParams = new ArrayList(); @@ -97,7 +99,7 @@ namespace OpenSim.Region.Communications.OGS1 public List RequestNeighbours(RegionInfo regionInfo) { - + Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); List neighbours = new List(); @@ -141,8 +143,40 @@ namespace OpenSim.Region.Communications.OGS1 return this.regions[regionHandle]; } //TODO not a region in this instance so ask remote grid server - MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); - return null; + + Hashtable requestData = new Hashtable(); + requestData["region_handle"] = regionHandle.ToString(); + requestData["authkey"] = this.serversInfo.GridSendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); + + Hashtable responseData = (Hashtable)GridResp.Value; + + if (responseData.ContainsKey("error")) + { + Console.WriteLine("error received from grid server" + responseData["error"]); + return null; + } + + uint regX = Convert.ToUInt32((string)responseData["region_locx"]); + uint regY = Convert.ToUInt32((string)responseData["region_locy"]); + string internalIpStr = (string)responseData["sim_ip"]; + uint port = Convert.ToUInt32(responseData["sim_port"]); + string externalUri = (string)responseData["sim_uri"]; + + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); + string neighbourExternalUri = externalUri; + RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); + + regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); + regionInfo.RemotingAddress = internalIpStr; + + regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]); + regionInfo.RegionName = (string)responseData["region_name"]; + + return regionInfo; } public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) @@ -164,7 +198,7 @@ namespace OpenSim.Region.Communications.OGS1 neighbour.Access = Convert.ToByte(n["access"]); neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); neighbour.WaterHeight = Convert.ToByte(n["water-height"]); - neighbour.MapImageId = (string)n["map-image-id"]; + neighbour.MapImageId = new LLUUID((string)n["map-image-id"]); neighbours.Add(neighbour); } @@ -237,10 +271,10 @@ namespace OpenSim.Region.Communications.OGS1 #region InterRegion Comms private void StartRemoting() { - TcpChannel ch = new TcpChannel(8895); + TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort); ChannelServices.RegisterChannel(ch, true); - WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); + WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wellType); InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; @@ -254,9 +288,31 @@ namespace OpenSim.Region.Communications.OGS1 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); return true; } - //TODO need to see if we know about where this region is and use .net remoting - // to inform it. - Console.WriteLine("Inform remote region of child agent not implemented yet"); + RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + //don't want to be creating a new link to the remote instance every time like we are here + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://"+ regInfo.RemotingAddress+":"+regInfo.RemotingPort+"/InterRegions"); + if (remObject != null) + { + + retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + + return retValue; + } + return false; } @@ -267,6 +323,29 @@ namespace OpenSim.Region.Communications.OGS1 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); return true; } + RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); + if (remObject != null) + { + + retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + + return retValue; + } //TODO need to see if we know about where this region is and use .net remoting // to inform it. return false; diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index bd303e1..54d43a1 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs @@ -269,6 +269,7 @@ namespace OpenSim.Region.GridInterfaces.Local } catch (Exception e) { + Console.WriteLine("exception loading default assets into database"); Console.WriteLine(e.Message); } -- cgit v1.1 From 561b87b303e8e141ef516b8725ebd3c0be8b1122 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 11 Jul 2007 02:51:51 +0000 Subject: * Applying dalien's patches from bug#177 and #179 --- OpenSim/Region/ClientStack/ClientView.API.cs | 17 +++++++++ .../ClientStack/ClientView.PacketHandlers.cs | 25 ++------------ .../ClientStack/ClientView.ProcessPackets.cs | 2 +- OpenSim/Region/ClientStack/ClientView.cs | 40 +++++++++++++++++----- OpenSim/Region/ClientStack/ClientViewBase.cs | 3 +- OpenSim/Region/ClientStack/PacketServer.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.cs | 22 ++++++++++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 31 +++++++++++++---- 8 files changed, 99 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 48d5b9d..225e906 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -476,6 +476,23 @@ namespace OpenSim.Region.ClientStack OutPacket(money); } + public void SendStartPingCheck(byte seq) + { + StartPingCheckPacket pc = new StartPingCheckPacket(); + pc.PingID.PingID = seq; + OutPacket(pc); + } + + public void SendKillObject(ulong regionHandle, uint avatarLocalID) + { + KillObjectPacket kill = new KillObjectPacket(); + kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; + kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); + kill.ObjectData[0].ID = avatarLocalID; + OutPacket(kill); + } + + #region Appearance/ Wearables Methods /// diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 31ea3eb..e67807e 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -51,29 +51,8 @@ namespace OpenSim.Region.ClientStack logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); logReply.InventoryData[0].ItemID = LLUUID.Zero; OutPacket(logReply); - //tell all clients to kill our object - KillObjectPacket kill = new KillObjectPacket(); - kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; - kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - // kill.ObjectData[0].ID = this.ClientAvatar.localid; - foreach (ClientView client in m_clientThreads.Values) - { - client.OutPacket(kill); - } - - this.m_inventoryCache.ClientLeaving(this.AgentID, null); - - - // m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); - /*lock (m_world.Entities) - { - m_world.Entities.Remove(this.AgentID); - }*/ - // m_world.RemoveViewerAgent(this); - //need to do other cleaning up here too - m_clientThreads.Remove(this.CircuitCode); - m_networkServer.RemoveClientCircuit(this.CircuitCode); - this.ClientThread.Abort(); + // + this.KillClient(); return true; } diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 7d924d0..3265898 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack { if (Pack.Type != PacketType.AgentUpdate) { - Console.WriteLine("IN: " + Pack.Type.ToString()); + Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString()); } } diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 52749a1..0fe3884 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +using System; using System.Collections.Generic; using System.Net; using System.Text; @@ -77,6 +78,11 @@ namespace OpenSim.Region.ClientStack private int cachedtextureserial = 0; protected AuthenticateSessionsBase m_authenticateSessionsHandler; private Encoding enc = Encoding.ASCII; + // Dead client detection vars + private Timer clientPingTimer; + private int packetsReceived = 0; + private int probesWithNoIngressPackets = 0; + private int lastPacketsReceived = 0; public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) { @@ -112,15 +118,7 @@ namespace OpenSim.Region.ClientStack public void KillClient() { - KillObjectPacket kill = new KillObjectPacket(); - kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; - kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - //kill.ObjectData[0].ID = this.ClientAvatar.localid; - foreach (ClientView client in m_clientThreads.Values) - { - client.OutPacket(kill); - } - + clientPingTimer.Stop(); this.m_inventoryCache.ClientLeaving(this.AgentID, null); m_world.RemoveClient(this.AgentId); @@ -193,6 +191,9 @@ namespace OpenSim.Region.ClientStack if (nextPacket.Incoming) { //is a incoming packet + if (nextPacket.Packet.Type != PacketType.AgentUpdate) { + packetsReceived++; + } ProcessInPacket(nextPacket.Packet); } else @@ -204,10 +205,31 @@ namespace OpenSim.Region.ClientStack } # endregion + protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) + { + if (packetsReceived == lastPacketsReceived) { + probesWithNoIngressPackets++; + if (probesWithNoIngressPackets > 30) { + this.KillClient(); + } else { + // this will normally trigger at least one packet (ping response) + SendStartPingCheck(0); + } + } else { + // Something received in the meantime - we can reset the counters + probesWithNoIngressPackets = 0; + lastPacketsReceived = packetsReceived; + } + } + # region Setup protected virtual void InitNewClient() { + clientPingTimer = new Timer(1000); + clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); + clientPingTimer.Enabled = true; + MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); this.m_world.AddNewClient(this, false); } diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index ec7b039..048f4df 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -71,8 +71,7 @@ namespace OpenSim.Region.ClientStack // Keep track of when this packet was sent out Pack.TickCount = Environment.TickCount; - - // Console.WriteLine("OUT: " + Pack.Type.ToString()); + Console.WriteLine(CircuitCode + ":OUT: " + Pack.Type.ToString()); if (!Pack.Header.Resent) { diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index c7ca315..a88c682 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -178,6 +178,7 @@ namespace OpenSim.Region.ClientStack public virtual void RemoveClientCircuit(uint circuitcode) { this._networkHandler.RemoveClientCircuit(circuitcode); + this.m_clientManager.Remove(circuitcode); } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cd81384..d1f6038 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -546,6 +546,28 @@ namespace OpenSim.Region.Environment.Scenes { eventManager.TriggerOnRemovePresence(agentID); + ScenePresence avatar = this.RequestAvatar(agentID); + + m_clientManager.ForEachClient( + delegate(IClientAPI client) + { + client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + }); + + lock (Avatars) { + if (Avatars.ContainsKey(agentID)) { + Avatars.Remove(agentID); + } + } + lock (Entities) { + if (Entities.ContainsKey(agentID)) { + Entities.Remove(agentID); + } + } + // TODO: Add the removal from physics ? + + + return; } #endregion diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 7330bc5..e65ab7c 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -91,6 +91,12 @@ namespace OpenSim.Region.Environment.Scenes return _physActor; } } + + public ulong RegionHandle + { + get { return m_regionHandle; } + } + #endregion #region Constructor(s) @@ -390,6 +396,16 @@ namespace OpenSim.Region.Environment.Scenes remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); } + public void SendFullUpdateToALLClients() + { + List avatars = this.m_world.RequestAvatarList(); + foreach (ScenePresence avatar in this.m_world.RequestAvatarList()) + { + this.SendFullUpdateToOtherClient(avatar); + avatar.SendFullUpdateToOtherClient(this); + } + } + /// /// /// @@ -410,6 +426,7 @@ namespace OpenSim.Region.Environment.Scenes public void SendOurAppearance(IClientAPI OurClient) { this.ControllingClient.SendWearables(this.Wearables); + this.SendFullUpdateToALLClients(); this.m_world.SendAllSceneObjectsToClient(this.ControllingClient); } @@ -429,13 +446,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack(LLUUID animID, int seq) { - this.current_anim = animID; - this.anim_seq = anim_seq; - List avatars = this.m_world.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); - } + this.current_anim = animID; + this.anim_seq = seq; + List avatars = this.m_world.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); + } } /// -- cgit v1.1