aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorMW2007-03-28 13:08:27 +0000
committerMW2007-03-28 13:08:27 +0000
commit98d81485e724b26d9ad35b9b7cd24c98808b9a81 (patch)
treee806f29235952264161fd33aab652937e84b1870 /OpenSim.RegionServer
parent* And lo, the OpenSim (which is actually the RegionServer) is decoupled from ... (diff)
downloadopensim-SC_OLD-98d81485e724b26d9ad35b9b7cd24c98808b9a81.zip
opensim-SC_OLD-98d81485e724b26d9ad35b9b7cd24c98808b9a81.tar.gz
opensim-SC_OLD-98d81485e724b26d9ad35b9b7cd24c98808b9a81.tar.bz2
opensim-SC_OLD-98d81485e724b26d9ad35b9b7cd24c98808b9a81.tar.xz
RIP OpenSimRoot. (removed)
Merged most of the bug fixes etc in from LLdemo branch. Added the textures from that branch.
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/Assets/AssetCache.cs6
-rw-r--r--OpenSim.RegionServer/CAPS/IXmlRPCHandler.cs11
-rw-r--r--OpenSim.RegionServer/CAPS/SimHttp.cs29
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj50
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build3
-rw-r--r--OpenSim.RegionServer/OpenSimApplication.cs16
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs99
-rw-r--r--OpenSim.RegionServer/OpenSimNetworkHandler.cs16
-rw-r--r--OpenSim.RegionServer/OpenSimRoot.cs48
-rw-r--r--OpenSim.RegionServer/SimClient.cs6
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs2
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs54
-rw-r--r--OpenSim.RegionServer/world/Entity.cs5
-rw-r--r--OpenSim.RegionServer/world/Primitive.cs45
-rw-r--r--OpenSim.RegionServer/world/World.cs100
15 files changed, 300 insertions, 190 deletions
diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs
index 3c28e1c..244f562 100644
--- a/OpenSim.RegionServer/Assets/AssetCache.cs
+++ b/OpenSim.RegionServer/Assets/AssetCache.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Assets
55 55
56 private IAssetServer _assetServer; 56 private IAssetServer _assetServer;
57 private Thread _assetCacheThread; 57 private Thread _assetCacheThread;
58 private LLUUID[] textureList = new LLUUID[2]; 58 private LLUUID[] textureList = new LLUUID[5];
59 59
60 /// <summary> 60 /// <summary>
61 /// 61 ///
@@ -100,6 +100,10 @@ namespace OpenSim.Assets
100 //hack: so we can give each user a set of textures 100 //hack: so we can give each user a set of textures
101 textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); 101 textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001");
102 textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); 102 textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002");
103 textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003");
104 textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004");
105 textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005");
106
103 for (int i = 0; i < textureList.Length; i++) 107 for (int i = 0; i < textureList.Length; i++)
104 { 108 {
105 this._assetServer.RequestAsset(textureList[i], true); 109 this._assetServer.RequestAsset(textureList[i], true);
diff --git a/OpenSim.RegionServer/CAPS/IXmlRPCHandler.cs b/OpenSim.RegionServer/CAPS/IXmlRPCHandler.cs
new file mode 100644
index 0000000..c3cbbcc
--- /dev/null
+++ b/OpenSim.RegionServer/CAPS/IXmlRPCHandler.cs
@@ -0,0 +1,11 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.CAPS
6{
7 public interface IXmlRPCHandler
8 {
9 string HandleRPC(string requestBody);
10 }
11}
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
index 92bbc6f..bfba635 100644
--- a/OpenSim.RegionServer/CAPS/SimHttp.cs
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -50,6 +50,7 @@ namespace OpenSim.CAPS
50 private Thread m_workerThread; 50 private Thread m_workerThread;
51 private HttpListener m_httpListener; 51 private HttpListener m_httpListener;
52 private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>(); 52 private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>();
53 private Dictionary<string, IXmlRPCHandler> RPCHandlers = new Dictionary<string, IXmlRPCHandler>();
53 private IGridServer m_gridServer; 54 private IGridServer m_gridServer;
54 private int m_port; 55 private int m_port;
55 56
@@ -96,8 +97,22 @@ namespace OpenSim.CAPS
96 //must already have a handler for that path so return false 97 //must already have a handler for that path so return false
97 return false; 98 return false;
98 } 99 }
100
101 public bool AddXmlRPCHandler(string method, IXmlRPCHandler handler)
102 {
103 if (!this.RPCHandlers.ContainsKey(method))
104 {
105 this.RPCHandlers.Add(method, handler);
106 return true;
107 }
108
109 //must already have a handler for that path so return false
110 return false;
111 }
112
99 protected virtual string ParseXMLRPC(string requestBody) 113 protected virtual string ParseXMLRPC(string requestBody)
100 { 114 {
115 string responseString = "";
101 try 116 try
102 { 117 {
103 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); 118 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
@@ -115,17 +130,23 @@ namespace OpenSim.CAPS
115 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 130 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
116 if (m_gridServer.GetName() == "Remote") 131 if (m_gridServer.GetName() == "Remote")
117 { 132 {
118 133 ((RemoteGridBase) m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
119 ((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
120 } 134 }
121 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; 135 responseString = "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
136 break;
137 default:
138 if (this.RPCHandlers.ContainsKey(request.MethodName))
139 {
140 //responseString = this.RPCHandlers[request.MethodName]
141 }
142 break;
122 } 143 }
123 } 144 }
124 catch (Exception e) 145 catch (Exception e)
125 { 146 {
126 Console.WriteLine(e.ToString()); 147 Console.WriteLine(e.ToString());
127 } 148 }
128 return ""; 149 return responseString;
129 } 150 }
130 151
131 protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod) 152 protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod)
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 1ce2837..d9d5f1a 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{ADD974E2-994C-4998-864E-4B54D8AD5F00}</ProjectGuid> 6 <ProjectGuid>{ADD974E2-994C-4998-864E-4B54D8AD5F00}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,28 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 74 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 75 <Private>False</Private>
68 </Reference> 76 </Reference>
69 <Reference Include="libsecondlife.dll" > 77 <Reference Include="libsecondlife.dll">
70 <HintPath>..\bin\libsecondlife.dll</HintPath> 78 <HintPath>..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 79 <Private>False</Private>
72 </Reference> 80 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 81 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\bin\Axiom.MathLib.dll</HintPath> 82 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 83 <Private>False</Private>
76 </Reference> 84 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 85 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> 86 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 87 <Private>False</Private>
80 </Reference> 88 </Reference>
@@ -84,46 +92,44 @@
84 <Name>OpenSim.Framework</Name> 92 <Name>OpenSim.Framework</Name>
85 <Project>{BD7866A4-04BA-47F0-905F-B2359118F5B2}</Project> 93 <Project>{BD7866A4-04BA-47F0-905F-B2359118F5B2}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 95 <Private>False</Private>
88 </ProjectReference> 96 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 97 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name> 98 <Name>OpenSim.Framework.Console</Name>
91 <Project>{4B0A7290-36C2-4C74-B9B4-07775B031CF2}</Project> 99 <Project>{4B0A7290-36C2-4C74-B9B4-07775B031CF2}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 101 <Private>False</Private>
94 </ProjectReference> 102 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 103 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
96 <Name>OpenSim.Physics.Manager</Name> 104 <Name>OpenSim.Physics.Manager</Name>
97 <Project>{2EAB18A1-8187-4C79-9947-A671F9C007D9}</Project> 105 <Project>{2EAB18A1-8187-4C79-9947-A671F9C007D9}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 107 <Private>False</Private>
100 </ProjectReference> 108 </ProjectReference>
101 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj"> 109 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
102 <Name>OpenSim.Servers</Name> 110 <Name>OpenSim.Servers</Name>
103 <Project>{B9D6A5F0-3BD2-4161-8AF1-90C03295D4EE}</Project> 111 <Project>{B9D6A5F0-3BD2-4161-8AF1-90C03295D4EE}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 113 <Private>False</Private>
106 </ProjectReference> 114 </ProjectReference>
107 </ItemGroup> 115 </ItemGroup>
108 <ItemGroup> 116 <ItemGroup>
109 <Compile Include="AgentAssetUpload.cs"> 117 <Compile Include="AgentAssetUpload.cs">
110 <SubType>Code</SubType> 118 <SubType>Code</SubType>
111 </Compile> 119 </Compile>
120 <Compile Include="CAPS\IXmlRPCHandler.cs" />
112 <Compile Include="ConsoleCmds.cs"> 121 <Compile Include="ConsoleCmds.cs">
113 <SubType>Code</SubType> 122 <SubType>Code</SubType>
114 </Compile> 123 </Compile>
115 <Compile Include="Grid.cs"> 124 <Compile Include="Grid.cs">
116 <SubType>Code</SubType> 125 <SubType>Code</SubType>
117 </Compile> 126 </Compile>
118 <Compile Include="OpenSimApplication.cs"> 127 <Compile Include="OpenSimNetworkHandler.cs">
119 <SubType>Code</SubType> 128 <SubType>Code</SubType>
120 </Compile> 129 </Compile>
121 <Compile Include="OpenSimMain.cs"> 130 <Compile Include="OpenSimMain.cs">
122 <SubType>Code</SubType> 131 <SubType>Code</SubType>
123 </Compile> 132 </Compile>
124 <Compile Include="OpenSimRoot.cs">
125 <SubType>Code</SubType>
126 </Compile>
127 <Compile Include="QueItem.cs"> 133 <Compile Include="QueItem.cs">
128 <SubType>Code</SubType> 134 <SubType>Code</SubType>
129 </Compile> 135 </Compile>
@@ -195,4 +201,4 @@
195 <PostBuildEvent> 201 <PostBuildEvent>
196 </PostBuildEvent> 202 </PostBuildEvent>
197 </PropertyGroup> 203 </PropertyGroup>
198</Project> 204</Project> \ No newline at end of file
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index 04e86bc..b67db54 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -14,8 +14,8 @@
14 <include name="AgentAssetUpload.cs" /> 14 <include name="AgentAssetUpload.cs" />
15 <include name="ConsoleCmds.cs" /> 15 <include name="ConsoleCmds.cs" />
16 <include name="Grid.cs" /> 16 <include name="Grid.cs" />
17 <include name="OpenSimApplication.cs" />
18 <include name="OpenSimMain.cs" /> 17 <include name="OpenSimMain.cs" />
18 <include name="OpenSimNetworkHandler.cs" />
19 <include name="OpenSimRoot.cs" /> 19 <include name="OpenSimRoot.cs" />
20 <include name="QueItem.cs" /> 20 <include name="QueItem.cs" />
21 <include name="SimClient.cs" /> 21 <include name="SimClient.cs" />
@@ -25,6 +25,7 @@
25 <include name="Assets/InventoryCache.cs" /> 25 <include name="Assets/InventoryCache.cs" />
26 <include name="CAPS/AdminWebFront.cs" /> 26 <include name="CAPS/AdminWebFront.cs" />
27 <include name="CAPS/IRestHandler.cs" /> 27 <include name="CAPS/IRestHandler.cs" />
28 <include name="CAPS/IXmlRPCHandler.cs" />
28 <include name="CAPS/SimHttp.cs" /> 29 <include name="CAPS/SimHttp.cs" />
29 <include name="types/Mesh.cs" /> 30 <include name="types/Mesh.cs" />
30 <include name="types/Triangle.cs" /> 31 <include name="types/Triangle.cs" />
diff --git a/OpenSim.RegionServer/OpenSimApplication.cs b/OpenSim.RegionServer/OpenSimApplication.cs
deleted file mode 100644
index abfdf45..0000000
--- a/OpenSim.RegionServer/OpenSimApplication.cs
+++ /dev/null
@@ -1,16 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.Net.Sockets;
6
7namespace OpenSim
8{
9 public abstract class OpenSimApplication
10 {
11 public abstract void StartUp();
12 public abstract void Shutdown();
13 public abstract void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
14 public abstract void RemoveClientCircuit(uint circuitcode);
15 }
16}
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 497b801..ed3e732 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -48,10 +48,19 @@ using OpenSim.Physics.Manager;
48 48
49namespace OpenSim 49namespace OpenSim
50{ 50{
51 public class OpenSimMain : OpenSimApplication, conscmd_callback 51 public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback
52 { 52 {
53 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
54 private PhysicsManager physManager; 53 private PhysicsManager physManager;
54 private World LocalWorld;
55 private Grid GridServers;
56 private SimConfig Cfg;
57 private SimCAPSHTTPServer HttpServer;
58 private AssetCache AssetCache;
59 private InventoryCache InventoryCache;
60 //public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
61 private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
62 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
63 private DateTime startuptime;
55 64
56 public Socket Server; 65 public Socket Server;
57 private IPEndPoint ServerIncoming; 66 private IPEndPoint ServerIncoming;
@@ -79,68 +88,68 @@ namespace OpenSim
79 OpenSim.Framework.Console.MainConsole.Instance = m_console; 88 OpenSim.Framework.Console.MainConsole.Instance = m_console;
80 } 89 }
81 90
82 public override void StartUp() 91 public virtual void StartUp()
83 { 92 {
84 OpenSimRoot.Instance.GridServers = new Grid(); 93 GridServers = new Grid();
85 if ( m_sandbox ) 94 if ( m_sandbox )
86 { 95 {
87 OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; 96 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
88 OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; 97 GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
89 98
90 m_console.WriteLine("Starting in Sandbox mode"); 99 m_console.WriteLine("Starting in Sandbox mode");
91 } 100 }
92 else 101 else
93 { 102 {
94 OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; 103 GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
95 OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; 104 GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
96 105
97 m_console.WriteLine("Starting in Grid mode"); 106 m_console.WriteLine("Starting in Grid mode");
98 } 107 }
99 108
100 OpenSimRoot.Instance.GridServers.Initialise(); 109 GridServers.Initialise();
101 110
102 OpenSimRoot.Instance.startuptime = DateTime.Now; 111 startuptime = DateTime.Now;
103 112
104 OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer); 113 AssetCache = new AssetCache(GridServers.AssetServer);
105 OpenSimRoot.Instance.InventoryCache = new InventoryCache(); 114 InventoryCache = new InventoryCache();
106 115
107 // We check our local database first, then the grid for config options 116 // We check our local database first, then the grid for config options
108 m_console.WriteLine("Main.cs:Startup() - Loading configuration"); 117 m_console.WriteLine("Main.cs:Startup() - Loading configuration");
109 OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll); 118 Cfg = this.LoadConfigDll(this.ConfigDll);
110 OpenSimRoot.Instance.Cfg.InitConfig(this.m_sandbox); 119 Cfg.InitConfig(this.m_sandbox);
111 m_console.WriteLine("Main.cs:Startup() - Contacting gridserver"); 120 m_console.WriteLine("Main.cs:Startup() - Contacting gridserver");
112 OpenSimRoot.Instance.Cfg.LoadFromGrid(); 121 Cfg.LoadFromGrid();
113 122
114 m_console.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString()); 123 m_console.WriteLine("Main.cs:Startup() - We are " + Cfg.RegionName + " at " + Cfg.RegionLocX.ToString() + "," + Cfg.RegionLocY.ToString());
115 m_console.WriteLine("Initialising world"); 124 m_console.WriteLine("Initialising world");
116 OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg); 125 LocalWorld = new World(ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg);
117 OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld(); 126 LocalWorld.LandMap = Cfg.LoadWorld();
118 127
119 this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); 128 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
120 this.physManager.LoadPlugins(); 129 this.physManager.LoadPlugins();
121 130
122 m_console.WriteLine("Main.cs:Startup() - Starting up messaging system"); 131 m_console.WriteLine("Main.cs:Startup() - Starting up messaging system");
123 OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use 132 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use
124 OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap); 133 LocalWorld.PhysScene.SetTerrain(LocalWorld.LandMap);
125 134
126 OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey); 135 GridServers.AssetServer.SetServerInfo(Cfg.AssetURL, Cfg.AssetSendKey);
127 OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey); 136 GridServers.GridServer.SetServerInfo(Cfg.GridURL, Cfg.GridSendKey, Cfg.GridRecvKey);
128 137
129 OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. 138 LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
130 OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage(); 139 LocalWorld.LoadPrimsFromStorage();
131 140
132 if ( m_sandbox) 141 if ( m_sandbox)
133 { 142 {
134 OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet(); 143 AssetCache.LoadDefaultTextureSet();
135 } 144 }
136 145
137 m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); 146 m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
138 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort); 147 HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
139 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld)); 148 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld));
140 149
141 if ( m_loginserver && m_sandbox) 150 if ( m_loginserver && m_sandbox)
142 { 151 {
143 LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenAddr, OpenSimRoot.Instance.Cfg.IPListenPort); 152 LoginServer loginServer = new LoginServer(GridServers.GridServer, Cfg.IPListenAddr, Cfg.IPListenPort);
144 loginServer.Startup(); 153 loginServer.Startup();
145 } 154 }
146 155
@@ -194,15 +203,15 @@ namespace OpenSim
194 // do we already have a circuit for this endpoint 203 // do we already have a circuit for this endpoint
195 if(this.clientCircuits.ContainsKey(epSender)) 204 if(this.clientCircuits.ContainsKey(epSender))
196 { 205 {
197 OpenSimRoot.Instance.ClientThreads[this.clientCircuits[epSender]].InPacket(packet); 206 ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
198 } 207 }
199 else if (packet.Type == PacketType.UseCircuitCode) 208 else if (packet.Type == PacketType.UseCircuitCode)
200 { // new client 209 { // new client
201 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 210 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
202 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 211 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
203 SimClient newuser = new SimClient(epSender, useCircuit, OpenSimRoot.Instance.LocalWorld, OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.AssetCache, OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Application, OpenSimRoot.Instance.InventoryCache, OpenSimRoot.Instance.Sandbox); 212 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox);
204 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 213 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
205 OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 214 ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
206 } 215 }
207 else 216 else
208 { // invalid client 217 { // invalid client
@@ -214,9 +223,9 @@ namespace OpenSim
214 private void MainServerListener() 223 private void MainServerListener()
215 { 224 {
216 m_console.WriteLine("Main.cs:MainServerListener() - New thread started"); 225 m_console.WriteLine("Main.cs:MainServerListener() - New thread started");
217 m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + OpenSimRoot.Instance.Cfg.IPListenAddr + ":" + OpenSimRoot.Instance.Cfg.IPListenPort); 226 m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + Cfg.IPListenAddr + ":" + Cfg.IPListenPort);
218 227
219 ServerIncoming = new IPEndPoint(IPAddress.Any, OpenSimRoot.Instance.Cfg.IPListenPort); 228 ServerIncoming = new IPEndPoint(IPAddress.Any, Cfg.IPListenPort);
220 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 229 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
221 Server.Bind(ServerIncoming); 230 Server.Bind(ServerIncoming);
222 231
@@ -231,7 +240,7 @@ namespace OpenSim
231 240
232 } 241 }
233 242
234 public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender) 243 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
235 { 244 {
236 // find the endpoint for this circuit 245 // find the endpoint for this circuit
237 EndPoint sendto = null; 246 EndPoint sendto = null;
@@ -250,7 +259,7 @@ namespace OpenSim
250 } 259 }
251 } 260 }
252 261
253 public override void RemoveClientCircuit(uint circuitcode) 262 public virtual void RemoveClientCircuit(uint circuitcode)
254 { 263 {
255 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) 264 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits)
256 { 265 {
@@ -262,22 +271,22 @@ namespace OpenSim
262 } 271 }
263 } 272 }
264 273
265 public override void Shutdown() 274 public virtual void Shutdown()
266 { 275 {
267 m_console.WriteLine("Main.cs:Shutdown() - Closing all threads"); 276 m_console.WriteLine("Main.cs:Shutdown() - Closing all threads");
268 m_console.WriteLine("Main.cs:Shutdown() - Killing listener thread"); 277 m_console.WriteLine("Main.cs:Shutdown() - Killing listener thread");
269 m_console.WriteLine("Main.cs:Shutdown() - Killing clients"); 278 m_console.WriteLine("Main.cs:Shutdown() - Killing clients");
270 // IMPLEMENT THIS 279 // IMPLEMENT THIS
271 m_console.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); 280 m_console.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
272 OpenSimRoot.Instance.LocalWorld.Close(); 281 LocalWorld.Close();
273 OpenSimRoot.Instance.GridServers.Close(); 282 GridServers.Close();
274 m_console.Close(); 283 m_console.Close();
275 Environment.Exit(0); 284 Environment.Exit(0);
276 } 285 }
277 286
278 void Timer1Tick(object sender, System.EventArgs e) 287 void Timer1Tick(object sender, System.EventArgs e)
279 { 288 {
280 OpenSimRoot.Instance.LocalWorld.Update(); 289 LocalWorld.Update();
281 } 290 }
282 291
283 public void RunCmd(string command, string[] cmdparams) 292 public void RunCmd(string command, string[] cmdparams)
@@ -295,7 +304,7 @@ namespace OpenSim
295 break; 304 break;
296 305
297 case "regenerate": 306 case "regenerate":
298 OpenSimRoot.Instance.LocalWorld.RegenerateTerrain(); 307 LocalWorld.RegenerateTerrain();
299 break; 308 break;
300 309
301 case "shutdown": 310 case "shutdown":
@@ -309,17 +318,17 @@ namespace OpenSim
309 switch (ShowWhat) 318 switch (ShowWhat)
310 { 319 {
311 case "uptime": 320 case "uptime":
312 m_console.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString()); 321 m_console.WriteLine("OpenSim has been running since " + startuptime.ToString());
313 m_console.WriteLine("That is " + (DateTime.Now - OpenSimRoot.Instance.startuptime).ToString()); 322 m_console.WriteLine("That is " + (DateTime.Now - startuptime).ToString());
314 break; 323 break;
315 case "users": 324 case "users":
316 OpenSim.world.Avatar TempAv; 325 OpenSim.world.Avatar TempAv;
317 m_console.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); 326 m_console.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP"));
318 foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) 327 foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys)
319 { 328 {
320 if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") 329 if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
321 { 330 {
322 TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; 331 TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID];
323 m_console.WriteLine(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())); 332 m_console.WriteLine(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()));
324 } 333 }
325 } 334 }
diff --git a/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim.RegionServer/OpenSimNetworkHandler.cs
new file mode 100644
index 0000000..4ed201e
--- /dev/null
+++ b/OpenSim.RegionServer/OpenSimNetworkHandler.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.Net.Sockets;
6
7namespace OpenSim
8{
9 public interface OpenSimNetworkHandler
10 {
11 //public abstract void StartUp();
12 // public abstract void Shutdown();
13 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
14 void RemoveClientCircuit(uint circuitcode);
15 }
16}
diff --git a/OpenSim.RegionServer/OpenSimRoot.cs b/OpenSim.RegionServer/OpenSimRoot.cs
deleted file mode 100644
index 1f96c4d..0000000
--- a/OpenSim.RegionServer/OpenSimRoot.cs
+++ /dev/null
@@ -1,48 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5//using System.Net.Sockets;
6using libsecondlife;
7using libsecondlife.Packets;
8using OpenSim.world;
9using OpenSim.Framework.Interfaces;
10using OpenSim.UserServer;
11using OpenSim.Assets;
12using OpenSim.CAPS;
13using OpenSim.Framework.Console;
14using OpenSim.Physics.Manager;
15
16namespace OpenSim
17{
18 public sealed class OpenSimRoot
19 {
20 private static OpenSimRoot instance = new OpenSimRoot();
21
22 public static OpenSimRoot Instance
23 {
24 get
25 {
26 return instance;
27 }
28 }
29
30 private OpenSimRoot()
31 {
32
33 }
34
35 public World LocalWorld;
36 public Grid GridServers;
37 public SimConfig Cfg;
38 public SimCAPSHTTPServer HttpServer;
39 public AssetCache AssetCache;
40 public InventoryCache InventoryCache;
41 //public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
42 public Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
43 public DateTime startuptime;
44 public OpenSimApplication Application;
45 public bool Sandbox = false;
46
47 }
48}
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 698053d..e013b63 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -75,7 +75,7 @@ namespace OpenSim
75 private Dictionary<uint, SimClient> m_clientThreads; 75 private Dictionary<uint, SimClient> m_clientThreads;
76 private AssetCache m_assetCache; 76 private AssetCache m_assetCache;
77 private IGridServer m_gridServer; 77 private IGridServer m_gridServer;
78 private OpenSimApplication m_application; 78 private OpenSimNetworkHandler m_application;
79 private InventoryCache m_inventoryCache; 79 private InventoryCache m_inventoryCache;
80 private bool m_sandboxMode; 80 private bool m_sandboxMode;
81 81
@@ -188,7 +188,7 @@ namespace OpenSim
188 { 188 {
189 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 189 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
190 { 190 {
191 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W); 191 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
192 ((OpenSim.world.Primitive)ent).UpdateFlag = true; 192 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
193 } 193 }
194 } 194 }
@@ -576,7 +576,7 @@ namespace OpenSim
576 this.PacketQueue.Enqueue(item); 576 this.PacketQueue.Enqueue(item);
577 } 577 }
578 578
579 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimApplication application, InventoryCache inventoryCache, bool sandboxMode) 579 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode)
580 { 580 {
581 m_world = world; 581 m_world = world;
582 m_clientThreads = clientThreads; 582 m_clientThreads = clientThreads;
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
index 47af8a8..0bbe0b0 100644
--- a/OpenSim.RegionServer/UserServer/LoginServer.cs
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -309,7 +309,7 @@ namespace OpenSim.UserServer
309 Hashtable Inventory2 = (Hashtable)InventoryList[1]; 309 Hashtable Inventory2 = (Hashtable)InventoryList[1];
310 LLUUID BaseFolderID = LLUUID.Random(); 310 LLUUID BaseFolderID = LLUUID.Random();
311 LLUUID InventoryFolderID = LLUUID.Random(); 311 LLUUID InventoryFolderID = LLUUID.Random();
312 Inventory2["name"] = "Base"; 312 Inventory2["name"] = "Textures";
313 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); 313 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
314 Inventory2["type_default"] = 0; 314 Inventory2["type_default"] = 0;
315 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); 315 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
index 2ae9992..7b79378 100644
--- a/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -41,10 +41,10 @@ namespace OpenSim.world
41 m_clientThreads = clientThreads; 41 m_clientThreads = clientThreads;
42 m_regionName = regionName; 42 m_regionName = regionName;
43 m_regionHandle = regionHandle; 43 m_regionHandle = regionHandle;
44 44
45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
46 ControllingClient = TheClient; 46 ControllingClient = TheClient;
47 localid = 8880000 + (m_world._localNumber++); 47 localid = 8880000 + (this.m_world._localNumber++);
48 position = new LLVector3(100.0f, 100.0f, 30.0f); 48 position = new LLVector3(100.0f, 100.0f, 30.0f);
49 position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1; 49 position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
50 visualParams = new byte[218]; 50 visualParams = new byte[218];
@@ -61,7 +61,7 @@ namespace OpenSim.world
61 this.Wearables[0].ItemID = LLUUID.Random(); 61 this.Wearables[0].ItemID = LLUUID.Random();
62 62
63 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 63 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
64 64
65 } 65 }
66 66
67 public PhysicsActor PhysActor 67 public PhysicsActor PhysActor
@@ -82,7 +82,10 @@ namespace OpenSim.world
82 { 82 {
83 NewForce force = this.forcesList[i]; 83 NewForce force = this.forcesList[i];
84 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); 84 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
85 this._physActor.Velocity = phyVector; 85 lock (m_world.LockPhysicsEngine)
86 {
87 this._physActor.Velocity = phyVector;
88 }
86 this.updateflag = true; 89 this.updateflag = true;
87 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this 90 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
88 // but as we are setting the velocity (rather than using real forces) at the moment it is okay. 91 // but as we are setting the velocity (rather than using real forces) at the moment it is okay.
@@ -181,7 +184,7 @@ namespace OpenSim.world
181 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 184 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
182 mov.AgentData.SessionID = this.ControllingClient.SessionID; 185 mov.AgentData.SessionID = this.ControllingClient.SessionID;
183 mov.AgentData.AgentID = this.ControllingClient.AgentID; 186 mov.AgentData.AgentID = this.ControllingClient.AgentID;
184 mov.Data.RegionHandle = m_regionHandle; 187 mov.Data.RegionHandle = this.m_regionHandle;
185 // TODO - dynamicalise this stuff 188 // TODO - dynamicalise this stuff
186 mov.Data.Timestamp = 1172750370; 189 mov.Data.Timestamp = 1172750370;
187 mov.Data.Position = new LLVector3(100f, 100f, 23f); 190 mov.Data.Position = new LLVector3(100f, 100f, 23f);
@@ -475,7 +478,12 @@ namespace OpenSim.world
475 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); 478 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
476 ani.AnimationList[0].AnimID = this.current_anim; 479 ani.AnimationList[0].AnimID = this.current_anim;
477 ani.AnimationList[0].AnimSequenceID = this.anim_seq; 480 ani.AnimationList[0].AnimSequenceID = this.anim_seq;
478 ControllingClient.OutPacket(ani); 481
482 //ControllingClient.OutPacket(ani);
483 foreach (SimClient client in m_clientThreads.Values)
484 {
485 client.OutPacket(ani);
486 }
479 } 487 }
480 488
481 //should be moved somewhere else 489 //should be moved somewhere else
@@ -522,7 +530,11 @@ namespace OpenSim.world
522 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 530 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
523 531
524 dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; 532 dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry;
525 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); 533 libsecondlife.LLVector3 pos2 = new LLVector3(0, 0, 0);
534 lock (m_world.LockPhysicsEngine)
535 {
536 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
537 }
526 538
527 uint ID = this.localid; 539 uint ID = this.localid;
528 540
@@ -542,8 +554,11 @@ namespace OpenSim.world
542 ushort InternVelocityX; 554 ushort InternVelocityX;
543 ushort InternVelocityY; 555 ushort InternVelocityY;
544 ushort InternVelocityZ; 556 ushort InternVelocityZ;
545 557 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
546 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); 558 lock (m_world.LockPhysicsEngine)
559 {
560 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
561 }
547 internDirec = internDirec / 128.0f; 562 internDirec = internDirec / 128.0f;
548 internDirec.x += 1; 563 internDirec.x += 1;
549 internDirec.y += 1; 564 internDirec.y += 1;
@@ -596,6 +611,27 @@ namespace OpenSim.world
596 Avatar.Animations = new AvatarAnimations(); 611 Avatar.Animations = new AvatarAnimations();
597 Avatar.Animations.LoadAnims(); 612 Avatar.Animations.LoadAnims();
598 } 613 }
614
615 public override void LandRenegerated()
616 {
617 position = new LLVector3(100.0f, 100.0f, 30.0f);
618 position.Z = this.m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 50;
619 if (this._physActor != null)
620 {
621 try
622 {
623 lock (this.m_world.LockPhysicsEngine)
624 {
625
626 this._physActor.Position = new PhysicsVector(position.X, position.Y, position.Z);
627 }
628 }
629 catch (Exception e)
630 {
631 Console.WriteLine(e.Message);
632 }
633 }
634 }
599 } 635 }
600 636
601 public class NewForce 637 public class NewForce
diff --git a/OpenSim.RegionServer/world/Entity.cs b/OpenSim.RegionServer/world/Entity.cs
index 780f3a0..567c0b7 100644
--- a/OpenSim.RegionServer/world/Entity.cs
+++ b/OpenSim.RegionServer/world/Entity.cs
@@ -63,5 +63,10 @@ namespace OpenSim.world
63 { 63 {
64 64
65 } 65 }
66
67 public virtual void LandRenegerated()
68 {
69
70 }
66 } 71 }
67} 72}
diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs
index a185f0b..ca764a7 100644
--- a/OpenSim.RegionServer/world/Primitive.cs
+++ b/OpenSim.RegionServer/world/Primitive.cs
@@ -12,6 +12,7 @@ namespace OpenSim.world
12{ 12{
13 public class Primitive : Entity 13 public class Primitive : Entity
14 { 14 {
15 //private static object physicsLock = new object();
15 protected float mesh_cutbegin; 16 protected float mesh_cutbegin;
16 protected float mesh_cutend; 17 protected float mesh_cutend;
17 protected PrimData primData; 18 protected PrimData primData;
@@ -21,7 +22,8 @@ namespace OpenSim.world
21 private ObjectUpdatePacket OurPacket; 22 private ObjectUpdatePacket OurPacket;
22 private PhysicsActor _physActor; 23 private PhysicsActor _physActor;
23 private bool physicsEnabled = false; 24 private bool physicsEnabled = false;
24 private bool physicstest = false; //just added for testing 25 private bool physicstest = false;
26 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
25 private Dictionary<uint, SimClient> m_clientThreads; 27 private Dictionary<uint, SimClient> m_clientThreads;
26 private ulong m_regionHandle; 28 private ulong m_regionHandle;
27 private World m_world; 29 private World m_world;
@@ -72,7 +74,7 @@ namespace OpenSim.world
72 { 74 {
73 mesh_cutbegin = 0.0f; 75 mesh_cutbegin = 0.0f;
74 mesh_cutend = 1.0f; 76 mesh_cutend = 1.0f;
75 77
76 m_clientThreads = clientThreads; 78 m_clientThreads = clientThreads;
77 m_regionHandle = regionHandle; 79 m_regionHandle = regionHandle;
78 m_world = world; 80 m_world = world;
@@ -97,13 +99,30 @@ namespace OpenSim.world
97 this.position = pos; 99 this.position = pos;
98 if (this._physActor != null) // && this.physicsEnabled) 100 if (this._physActor != null) // && this.physicsEnabled)
99 { 101 {
100 this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z); 102 try
103 {
104 lock (m_world.LockPhysicsEngine)
105 {
106 this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
107 }
108 }
109 catch (Exception e)
110 {
111 Console.WriteLine(e.Message);
112 }
101 } 113 }
102 this.updateFlag = true; 114 this.updateFlag = true;
103 } 115 }
104 116
105 public override void update() 117 public override void update()
106 { 118 {
119 LLVector3 pos2 = new LLVector3(0, 0, 0);
120 if (this._physActor != null && this.physicsEnabled)
121 {
122
123 PhysicsVector pPos = this._physActor.Position;
124 pos2 = new LLVector3(pPos.X, pPos.Y, pPos.Z);
125 }
107 if (this.newPrimFlag) 126 if (this.newPrimFlag)
108 { 127 {
109 foreach (SimClient client in m_clientThreads.Values) 128 foreach (SimClient client in m_clientThreads.Values)
@@ -137,15 +156,19 @@ namespace OpenSim.world
137 { 156 {
138 if (this._physActor != null && this.physicsEnabled) 157 if (this._physActor != null && this.physicsEnabled)
139 { 158 {
140 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 159 if (pos2 != this.positionLastFrame)
141 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
142 terse.RegionData.TimeDilation = 64096;
143 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
144 terse.ObjectData[0] = this.CreateImprovedBlock();
145 foreach (SimClient client in m_clientThreads.Values)
146 { 160 {
147 client.OutPacket(terse); 161 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
162 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
163 terse.RegionData.TimeDilation = 64096;
164 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
165 terse.ObjectData[0] = this.CreateImprovedBlock();
166 foreach (SimClient client in m_clientThreads.Values)
167 {
168 client.OutPacket(terse);
169 }
148 } 170 }
171 this.positionLastFrame = pos2;
149 } 172 }
150 } 173 }
151 174
@@ -487,7 +510,7 @@ namespace OpenSim.world
487 this.primData.LocalID = this.localid; 510 this.primData.LocalID = this.localid;
488 this.primData.Position = this.position; 511 this.primData.Position = this.position;
489 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); 512 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
490 m_world.localStorage.StorePrim(this.primData); 513 this.m_world.localStorage.StorePrim(this.primData);
491 } 514 }
492 } 515 }
493 516
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index 0d126e6..3c131b2 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -14,6 +14,7 @@ namespace OpenSim.world
14{ 14{
15 public class World : ILocalStorageReceiver 15 public class World : ILocalStorageReceiver
16 { 16 {
17 public object LockPhysicsEngine = new object();
17 public Dictionary<libsecondlife.LLUUID, Entity> Entities; 18 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
18 public float[] LandMap; 19 public float[] LandMap;
19 public ScriptEngine Scripts; 20 public ScriptEngine Scripts;
@@ -25,19 +26,19 @@ namespace OpenSim.world
25 private Random Rand = new Random(); 26 private Random Rand = new Random();
26 private uint _primCount = 702000; 27 private uint _primCount = 702000;
27 private int storageCount; 28 private int storageCount;
28 private Dictionary<uint, SimClient> m_clientThreads; 29 private Dictionary<uint, SimClient> m_clientThreads;
29 private ulong m_regionHandle; 30 private ulong m_regionHandle;
30 private string m_regionName; 31 private string m_regionName;
31 private SimConfig m_cfg; 32 private SimConfig m_cfg;
32 33
33 public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg) 34 public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg)
34 { 35 {
35 m_clientThreads = clientThreads; 36 m_clientThreads = clientThreads;
36 m_regionHandle = regionHandle; 37 m_regionHandle = regionHandle;
37 m_regionName = regionName; 38 m_regionName = regionName;
38 m_cfg = cfg; 39 m_cfg = cfg;
39 40
40 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); 41 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
41 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 42 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
42 43
43 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 44 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
@@ -73,8 +74,11 @@ namespace OpenSim.world
73 { 74 {
74 Entities[UUID].addForces(); 75 Entities[UUID].addForces();
75 } 76 }
76 77
77 this.phyScene.Simulate(timeStep); 78 lock (this.LockPhysicsEngine)
79 {
80 this.phyScene.Simulate(timeStep);
81 }
78 82
79 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 83 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
80 { 84 {
@@ -118,18 +122,49 @@ namespace OpenSim.world
118 this.localStorage = store; 122 this.localStorage = store;
119 return(store == null); 123 return(store == null);
120 } 124 }
125
126 public void RegenerateTerrain()
127 {
128 HeightmapGenHills hills = new HeightmapGenHills();
129 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
130 lock (this.LockPhysicsEngine)
131 {
132 this.phyScene.SetTerrain(this.LandMap);
133 }
134 m_cfg.SaveMap(this.LandMap);
135
136 foreach (SimClient client in m_clientThreads.Values)
137 {
138 this.SendLayerData(client);
139 }
140
141 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
142 {
143 Entities[UUID].LandRenegerated();
144 }
145 }
146
147 public void RegenerateTerrain(float[] newMap)
148 {
149
150 this.LandMap = newMap;
151 lock (this.LockPhysicsEngine)
152 {
153 this.phyScene.SetTerrain(this.LandMap);
154 }
155 m_cfg.SaveMap(this.LandMap);
156
157 foreach (SimClient client in m_clientThreads.Values)
158 {
159 this.SendLayerData(client);
160 }
161
162 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
163 {
164 Entities[UUID].LandRenegerated();
165 }
166 }
121 167
122 public void RegenerateTerrain()
123 {
124 HeightmapGenHills hills = new HeightmapGenHills();
125 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
126 this.phyScene.SetTerrain(this.LandMap);
127 m_cfg.SaveMap(this.LandMap);
128
129 foreach(SimClient client in m_clientThreads.Values) {
130 this.SendLayerData(client);
131 }
132 }
133 public void LoadPrimsFromStorage() 168 public void LoadPrimsFromStorage()
134 { 169 {
135 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); 170 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
@@ -143,7 +178,7 @@ namespace OpenSim.world
143 _primCount = prim.LocalID + 1; 178 _primCount = prim.LocalID + 1;
144 } 179 }
145 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 180 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
146 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); 181 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
147 nPrim.CreateFromStorage(prim); 182 nPrim.CreateFromStorage(prim);
148 this.Entities.Add(nPrim.uuid, nPrim); 183 this.Entities.Add(nPrim.uuid, nPrim);
149 } 184 }
@@ -182,27 +217,34 @@ namespace OpenSim.world
182 } 217 }
183 } 218 }
184 219
185 public void AddViewerAgent(SimClient AgentClient) { 220 public void AddViewerAgent(SimClient AgentClient)
221 {
186 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 222 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
187 Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle ); 223 Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle);
188 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 224 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
189 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 225 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
190 NewAvatar.SendRegionHandshake(this); 226 NewAvatar.SendRegionHandshake(this);
191 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); 227 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z);
192 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 228 lock (this.LockPhysicsEngine)
229 {
230 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
231 }
193 this.Entities.Add(AgentClient.AgentID, NewAvatar); 232 this.Entities.Add(AgentClient.AgentID, NewAvatar);
194 } 233 }
195 234
196 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) 235 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
197 { 236 {
198 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 237 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
199 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this ); 238 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
200 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 239 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
201 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); 240 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
202 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f); 241 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
203 if(OpenSim.world.Avatar.PhysicsEngineFlying) 242 if(OpenSim.world.Avatar.PhysicsEngineFlying)
204 { 243 {
205 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize ); 244 lock (this.LockPhysicsEngine)
245 {
246 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize);
247 }
206 } 248 }
207 //prim.PhysicsEnabled = true; 249 //prim.PhysicsEnabled = true;
208 this.Entities.Add(prim.uuid, prim); 250 this.Entities.Add(prim.uuid, prim);
@@ -243,9 +285,9 @@ namespace OpenSim.world
243 } 285 }
244 foreach( libsecondlife.LLUUID uuid in DeRezEnts ) 286 foreach( libsecondlife.LLUUID uuid in DeRezEnts )
245 { 287 {
246 lock (this.Entities) 288 lock (Entities)
247 { 289 {
248 this.Entities.Remove(uuid); 290 Entities.Remove(uuid);
249 } 291 }
250 } 292 }
251 293