aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorMW2007-05-17 10:24:10 +0000
committerMW2007-05-17 10:24:10 +0000
commitaae0222f8154a32d71112a8a468412efa5b857da (patch)
tree30342f61cf94448396b87794bf25c40522417403 /OpenSim.RegionServer
parentImplemented initial login code for the management agent (diff)
downloadopensim-SC-aae0222f8154a32d71112a8a468412efa5b857da.zip
opensim-SC-aae0222f8154a32d71112a8a468412efa5b857da.tar.gz
opensim-SC-aae0222f8154a32d71112a8a468412efa5b857da.tar.bz2
opensim-SC-aae0222f8154a32d71112a8a468412efa5b857da.tar.xz
More OO and abstract goodness for Gareth to drool over. Cleaned up the World class a bit and added a WorldBase class (that World now inherits from)
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj526
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build179
-rw-r--r--OpenSim.RegionServer/PacketServer.cs5
-rw-r--r--OpenSim.RegionServer/world/World.PacketHandlers.cs1
-rw-r--r--OpenSim.RegionServer/world/World.cs302
-rw-r--r--OpenSim.RegionServer/world/WorldBase.cs176
6 files changed, 662 insertions, 527 deletions
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 47b269e..100622b 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,255 +1,271 @@
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>
5 <SchemaVersion>2.0</SchemaVersion> 5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{58019DB8-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</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 <AssemblyKeyContainerName> 10 </ApplicationIcon>
11 </AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 12 </AssemblyKeyContainerName>
13 <DefaultClientScript>JScript</DefaultClientScript> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> 14 <DefaultClientScript>JScript</DefaultClientScript>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 15 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
16 <DelaySign>false</DelaySign> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <OutputType>Library</OutputType> 17 <DelaySign>false</DelaySign>
18 <AppDesignerFolder></AppDesignerFolder> 18 <OutputType>Library</OutputType>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 19 <AppDesignerFolder>
20 <StartupObject></StartupObject> 20 </AppDesignerFolder>
21 <FileUpgradeFlags> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
22 </FileUpgradeFlags> 22 <StartupObject>
23 </PropertyGroup> 23 </StartupObject>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 24 <FileUpgradeFlags>
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 25 </FileUpgradeFlags>
26 <BaseAddress>285212672</BaseAddress> 26 </PropertyGroup>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> 27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28 <ConfigurationOverrideFile> 28 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
29 </ConfigurationOverrideFile> 29 <BaseAddress>285212672</BaseAddress>
30 <DefineConstants>TRACE</DefineConstants> 30 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
31 <DocumentationFile></DocumentationFile> 31 <ConfigurationOverrideFile>
32 <DebugSymbols>False</DebugSymbols> 32 </ConfigurationOverrideFile>
33 <FileAlignment>4096</FileAlignment> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
34 <Optimize>True</Optimize> 34 <DocumentationFile>
35 <OutputPath>../bin/</OutputPath> 35 </DocumentationFile>
36 <RegisterForComInterop>False</RegisterForComInterop> 36 <DebugSymbols>True</DebugSymbols>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 37 <FileAlignment>4096</FileAlignment>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 38 <Optimize>False</Optimize>
39 <WarningLevel>4</WarningLevel> 39 <OutputPath>..\bin\</OutputPath>
40 <NoWarn></NoWarn> 40 <RegisterForComInterop>False</RegisterForComInterop>
41 </PropertyGroup> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 43 <WarningLevel>4</WarningLevel>
44 <BaseAddress>285212672</BaseAddress> 44 <NoWarn>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> 45 </NoWarn>
46 <ConfigurationOverrideFile> 46 </PropertyGroup>
47 </ConfigurationOverrideFile> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48 <DefineConstants>TRACE;DEBUG</DefineConstants> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
49 <DocumentationFile></DocumentationFile> 49 <BaseAddress>285212672</BaseAddress>
50 <DebugSymbols>True</DebugSymbols> 50 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
51 <FileAlignment>4096</FileAlignment> 51 <ConfigurationOverrideFile>
52 <Optimize>False</Optimize> 52 </ConfigurationOverrideFile>
53 <OutputPath>../bin/</OutputPath> 53 <DefineConstants>TRACE</DefineConstants>
54 <RegisterForComInterop>False</RegisterForComInterop> 54 <DocumentationFile>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 55 </DocumentationFile>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 56 <DebugSymbols>False</DebugSymbols>
57 <WarningLevel>4</WarningLevel> 57 <FileAlignment>4096</FileAlignment>
58 <NoWarn></NoWarn> 58 <Optimize>True</Optimize>
59 </PropertyGroup> 59 <OutputPath>..\bin\</OutputPath>
60 <ItemGroup> 60 <RegisterForComInterop>False</RegisterForComInterop>
61 <Reference Include="System" > 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
62 <HintPath>System.dll</HintPath> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
63 <Private>False</Private> 63 <WarningLevel>4</WarningLevel>
64 </Reference> 64 <NoWarn>
65 <Reference Include="System.Xml" > 65 </NoWarn>
66 <HintPath>System.Xml.dll</HintPath> 66 </PropertyGroup>
67 <Private>False</Private> 67 <ItemGroup>
68 </Reference> 68 <Reference Include="System">
69 <Reference Include="libsecondlife.dll" > 69 <HintPath>System.dll</HintPath>
70 <HintPath>..\bin\libsecondlife.dll</HintPath> 70 <Private>False</Private>
71 <Private>False</Private> 71 </Reference>
72 </Reference> 72 <Reference Include="System.Data" />
73 <Reference Include="Axiom.MathLib.dll" > 73 <Reference Include="System.Xml">
74 <HintPath>..\bin\Axiom.MathLib.dll</HintPath> 74 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private> 75 <Private>False</Private>
76 </Reference> 76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 77 <Reference Include="libsecondlife.dll">
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> 78 <HintPath>..\bin\libsecondlife.dll</HintPath>
79 <Private>False</Private> 79 <Private>False</Private>
80 </Reference> 80 </Reference>
81 </ItemGroup> 81 <Reference Include="Axiom.MathLib.dll">
82 <ItemGroup> 82 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
83 <ProjectReference Include="../OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj"> 83 <Private>False</Private>
84 <Name>OpenSim.Terrain.BasicTerrain</Name> 84 </Reference>
85 <Project>{9CBFE2C1-0000-0000-0000-000000000000}</Project> 85 <Reference Include="Db4objects.Db4o.dll">
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 86 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
87 <Private>False</Private> 87 <Private>False</Private>
88 </ProjectReference> 88 </Reference>
89 <ProjectReference Include="../OpenSim.Framework/OpenSim.Framework.csproj"> 89 </ItemGroup>
90 <Name>OpenSim.Framework</Name> 90 <ItemGroup>
91 <Project>{7404933D-0000-0000-0000-000000000000}</Project> 91 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 92 <Name>OpenSim.Terrain.BasicTerrain</Name>
93 <Private>False</Private> 93 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
94 </ProjectReference> 94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
95 <ProjectReference Include="../OpenSim.Framework.Console/OpenSim.Framework.Console.csproj"> 95 <Private>False</Private>
96 <Name>OpenSim.Framework.Console</Name> 96 </ProjectReference>
97 <Project>{16759386-0000-0000-0000-000000000000}</Project> 97 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 98 <Name>OpenSim.Framework</Name>
99 <Private>False</Private> 99 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
100 </ProjectReference> 100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
101 <ProjectReference Include="../OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj"> 101 <Private>False</Private>
102 <Name>OpenSim.GenericConfig.Xml</Name> 102 </ProjectReference>
103 <Project>{CAC10AC1-0000-0000-0000-000000000000}</Project> 103 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 104 <Name>OpenSim.Framework.Console</Name>
105 <Private>False</Private> 105 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
106 </ProjectReference> 106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
107 <ProjectReference Include="../OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj"> 107 <Private>False</Private>
108 <Name>OpenSim.Physics.Manager</Name> 108 </ProjectReference>
109 <Project>{DA1FDCE5-0000-0000-0000-000000000000}</Project> 109 <ProjectReference Include="..\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 110 <Name>OpenSim.GenericConfig.Xml</Name>
111 <Private>False</Private> 111 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
112 </ProjectReference> 112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
113 <ProjectReference Include="../OpenSim.Servers/OpenSim.Servers.csproj"> 113 <Private>False</Private>
114 <Name>OpenSim.Servers</Name> 114 </ProjectReference>
115 <Project>{111F9E8F-0000-0000-0000-000000000000}</Project> 115 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 116 <Name>OpenSim.Physics.Manager</Name>
117 <Private>False</Private> 117 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
118 </ProjectReference> 118 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
119 <ProjectReference Include="../XmlRpcCS/XMLRPC.csproj"> 119 <Private>False</Private>
120 <Name>XMLRPC</Name> 120 </ProjectReference>
121 <Project>{9A8B526E-0000-0000-0000-000000000000}</Project> 121 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 122 <Name>OpenSim.Servers</Name>
123 <Private>False</Private> 123 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
124 </ProjectReference> 124 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
125 </ItemGroup> 125 <Private>False</Private>
126 <ItemGroup> 126 </ProjectReference>
127 <Compile Include="AgentAssetUpload.cs"> 127 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
128 <SubType>Code</SubType> 128 <Name>XMLRPC</Name>
129 </Compile> 129 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
130 <Compile Include="AuthenticateSessionsBase.cs"> 130 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
131 <SubType>Code</SubType> 131 <Private>False</Private>
132 </Compile> 132 </ProjectReference>
133 <Compile Include="AuthenticateSessionsLocal.cs"> 133 </ItemGroup>
134 <SubType>Code</SubType> 134 <ItemGroup>
135 </Compile> 135 <Compile Include="AgentAssetUpload.cs">
136 <Compile Include="AuthenticateSessionsRemote.cs"> 136 <SubType>Code</SubType>
137 <SubType>Code</SubType> 137 </Compile>
138 </Compile> 138 <Compile Include="AuthenticateSessionsBase.cs">
139 <Compile Include="Grid.cs"> 139 <SubType>Code</SubType>
140 <SubType>Code</SubType> 140 </Compile>
141 </Compile> 141 <Compile Include="AuthenticateSessionsLocal.cs">
142 <Compile Include="OpenSimMain.cs"> 142 <SubType>Code</SubType>
143 <SubType>Code</SubType> 143 </Compile>
144 </Compile> 144 <Compile Include="AuthenticateSessionsRemote.cs">
145 <Compile Include="OpenSimNetworkHandler.cs"> 145 <SubType>Code</SubType>
146 <SubType>Code</SubType> 146 </Compile>
147 </Compile> 147 <Compile Include="Grid.cs">
148 <Compile Include="PacketServer.cs"> 148 <SubType>Code</SubType>
149 <SubType>Code</SubType> 149 </Compile>
150 </Compile> 150 <Compile Include="OpenSimMain.cs">
151 <Compile Include="RegionInfo.cs"> 151 <SubType>Code</SubType>
152 <SubType>Code</SubType> 152 </Compile>
153 </Compile> 153 <Compile Include="OpenSimNetworkHandler.cs">
154 <Compile Include="RegionInfoBase.cs"> 154 <SubType>Code</SubType>
155 <SubType>Code</SubType> 155 </Compile>
156 </Compile> 156 <Compile Include="PacketServer.cs">
157 <Compile Include="RegionServerBase.cs"> 157 <SubType>Code</SubType>
158 <SubType>Code</SubType> 158 </Compile>
159 </Compile> 159 <Compile Include="RegionInfo.cs">
160 <Compile Include="SimClient.Grid.cs"> 160 <SubType>Code</SubType>
161 <SubType>Code</SubType> 161 </Compile>
162 </Compile> 162 <Compile Include="RegionInfoBase.cs">
163 <Compile Include="SimClient.PacketHandlers.cs"> 163 <SubType>Code</SubType>
164 <SubType>Code</SubType> 164 </Compile>
165 </Compile> 165 <Compile Include="RegionServerBase.cs">
166 <Compile Include="SimClient.ProcessPackets.cs"> 166 <SubType>Code</SubType>
167 <SubType>Code</SubType> 167 </Compile>
168 </Compile> 168 <Compile Include="SimClient.cs">
169 <Compile Include="SimClient.cs"> 169 <SubType>Code</SubType>
170 <SubType>Code</SubType> 170 </Compile>
171 </Compile> 171 <Compile Include="SimClient.Grid.cs">
172 <Compile Include="SimClientBase.cs"> 172 <DependentUpon>SimClient.cs</DependentUpon>
173 <SubType>Code</SubType> 173 <SubType>Code</SubType>
174 </Compile> 174 </Compile>
175 <Compile Include="UDPServer.cs"> 175 <Compile Include="SimClient.PacketHandlers.cs">
176 <SubType>Code</SubType> 176 <SubType>Code</SubType>
177 </Compile> 177 <DependentUpon>SimClient.cs</DependentUpon>
178 <Compile Include="VersionInfo.cs"> 178 </Compile>
179 <SubType>Code</SubType> 179 <Compile Include="SimClient.ProcessPackets.cs">
180 </Compile> 180 <SubType>Code</SubType>
181 <Compile Include="Assets/AssetCache.cs"> 181 <DependentUpon>SimClient.cs</DependentUpon>
182 <SubType>Code</SubType> 182 </Compile>
183 </Compile> 183 <Compile Include="SimClientBase.cs">
184 <Compile Include="Assets/InventoryCache.cs"> 184 <SubType>Code</SubType>
185 <SubType>Code</SubType> 185 </Compile>
186 </Compile> 186 <Compile Include="UDPServer.cs">
187 <Compile Include="CAPS/AdminWebFront.cs"> 187 <SubType>Code</SubType>
188 <SubType>Code</SubType> 188 </Compile>
189 </Compile> 189 <Compile Include="VersionInfo.cs">
190 <Compile Include="types/Mesh.cs"> 190 <SubType>Code</SubType>
191 <SubType>Code</SubType> 191 </Compile>
192 </Compile> 192 <Compile Include="Assets\AssetCache.cs">
193 <Compile Include="types/Triangle.cs"> 193 <SubType>Code</SubType>
194 <SubType>Code</SubType> 194 </Compile>
195 </Compile> 195 <Compile Include="Assets\InventoryCache.cs">
196 <Compile Include="world/Avatar.Client.cs"> 196 <SubType>Code</SubType>
197 <SubType>Code</SubType> 197 </Compile>
198 </Compile> 198 <Compile Include="CAPS\AdminWebFront.cs">
199 <Compile Include="world/Avatar.Update.cs"> 199 <SubType>Code</SubType>
200 <SubType>Code</SubType> 200 </Compile>
201 </Compile> 201 <Compile Include="types\Mesh.cs">
202 <Compile Include="world/Avatar.cs"> 202 <SubType>Code</SubType>
203 <SubType>Code</SubType> 203 </Compile>
204 </Compile> 204 <Compile Include="types\Triangle.cs">
205 <Compile Include="world/AvatarAnimations.cs"> 205 <SubType>Code</SubType>
206 <SubType>Code</SubType> 206 </Compile>
207 </Compile> 207 <Compile Include="world\Avatar.Client.cs">
208 <Compile Include="world/Entity.cs"> 208 <SubType>Code</SubType>
209 <SubType>Code</SubType> 209 <DependentUpon>Avatar.cs</DependentUpon>
210 </Compile> 210 </Compile>
211 <Compile Include="world/Primitive.cs"> 211 <Compile Include="world\Avatar.cs">
212 <SubType>Code</SubType> 212 <SubType>Code</SubType>
213 </Compile> 213 </Compile>
214 <Compile Include="world/Primitive2.cs"> 214 <Compile Include="world\Avatar.Update.cs">
215 <SubType>Code</SubType> 215 <SubType>Code</SubType>
216 </Compile> 216 <DependentUpon>Avatar.cs</DependentUpon>
217 <Compile Include="world/SceneObject.cs"> 217 </Compile>
218 <SubType>Code</SubType> 218 <Compile Include="world\AvatarAnimations.cs">
219 </Compile> 219 <SubType>Code</SubType>
220 <Compile Include="world/World.PacketHandlers.cs"> 220 </Compile>
221 <SubType>Code</SubType> 221 <Compile Include="world\Entity.cs">
222 </Compile> 222 <SubType>Code</SubType>
223 <Compile Include="world/World.Scripting.cs"> 223 </Compile>
224 <SubType>Code</SubType> 224 <Compile Include="world\Primitive.cs">
225 </Compile> 225 <SubType>Code</SubType>
226 <Compile Include="world/World.cs"> 226 </Compile>
227 <SubType>Code</SubType> 227 <Compile Include="world\Primitive2.cs">
228 </Compile> 228 <SubType>Code</SubType>
229 <Compile Include="world/scripting/IScriptContext.cs"> 229 </Compile>
230 <SubType>Code</SubType> 230 <Compile Include="world\SceneObject.cs">
231 </Compile> 231 <SubType>Code</SubType>
232 <Compile Include="world/scripting/IScriptEntity.cs"> 232 </Compile>
233 <SubType>Code</SubType> 233 <Compile Include="world\World.cs">
234 </Compile> 234 <SubType>Code</SubType>
235 <Compile Include="world/scripting/IScriptHandler.cs"> 235 </Compile>
236 <SubType>Code</SubType> 236 <Compile Include="world\World.PacketHandlers.cs">
237 </Compile> 237 <SubType>Code</SubType>
238 <Compile Include="world/scripting/Script.cs"> 238 <DependentUpon>World.cs</DependentUpon>
239 <SubType>Code</SubType> 239 </Compile>
240 </Compile> 240 <Compile Include="world\World.Scripting.cs">
241 <Compile Include="world/scripting/ScriptFactory.cs"> 241 <SubType>Code</SubType>
242 <SubType>Code</SubType> 242 <DependentUpon>World.cs</DependentUpon>
243 </Compile> 243 </Compile>
244 <Compile Include="world/scripting/Scripts/FollowRandomAvatar.cs"> 244 <Compile Include="world\scripting\IScriptContext.cs">
245 <SubType>Code</SubType> 245 <SubType>Code</SubType>
246 </Compile> 246 </Compile>
247 </ItemGroup> 247 <Compile Include="world\scripting\IScriptEntity.cs">
248 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 248 <SubType>Code</SubType>
249 <PropertyGroup> 249 </Compile>
250 <PreBuildEvent> 250 <Compile Include="world\scripting\IScriptHandler.cs">
251 </PreBuildEvent> 251 <SubType>Code</SubType>
252 <PostBuildEvent> 252 </Compile>
253 </PostBuildEvent> 253 <Compile Include="world\scripting\Script.cs">
254 </PropertyGroup> 254 <SubType>Code</SubType>
255</Project> 255 </Compile>
256 <Compile Include="world\scripting\ScriptFactory.cs">
257 <SubType>Code</SubType>
258 </Compile>
259 <Compile Include="world\scripting\Scripts\FollowRandomAvatar.cs">
260 <SubType>Code</SubType>
261 </Compile>
262 <Compile Include="world\WorldBase.cs" />
263 </ItemGroup>
264 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
265 <PropertyGroup>
266 <PreBuildEvent>
267 </PreBuildEvent>
268 <PostBuildEvent>
269 </PostBuildEvent>
270 </PropertyGroup>
271</Project> \ No newline at end of file
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index a8e6ea9..35985ac 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -1,89 +1,90 @@
1<?xml version="1.0" ?> 1<?xml version="1.0" ?>
2<project name="OpenSim.RegionServer" default="build"> 2<project name="OpenSim.RegionServer" default="build">
3 <target name="build"> 3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> 4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" /> 5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}"> 6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}"> 7 <fileset basedir="${project::get-base-directory()}">
8 </fileset> 8 </fileset>
9 </copy> 9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> 10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.RegionServer" dynamicprefix="true" > 11 <resources prefix="OpenSim.RegionServer" dynamicprefix="true" >
12 </resources> 12 </resources>
13 <sources failonempty="true"> 13 <sources failonempty="true">
14 <include name="AgentAssetUpload.cs" /> 14 <include name="AgentAssetUpload.cs" />
15 <include name="AuthenticateSessionsBase.cs" /> 15 <include name="AuthenticateSessionsBase.cs" />
16 <include name="AuthenticateSessionsLocal.cs" /> 16 <include name="AuthenticateSessionsLocal.cs" />
17 <include name="AuthenticateSessionsRemote.cs" /> 17 <include name="AuthenticateSessionsRemote.cs" />
18 <include name="Grid.cs" /> 18 <include name="Grid.cs" />
19 <include name="OpenSimMain.cs" /> 19 <include name="OpenSimMain.cs" />
20 <include name="OpenSimNetworkHandler.cs" /> 20 <include name="OpenSimNetworkHandler.cs" />
21 <include name="PacketServer.cs" /> 21 <include name="PacketServer.cs" />
22 <include name="RegionInfo.cs" /> 22 <include name="RegionInfo.cs" />
23 <include name="RegionInfoBase.cs" /> 23 <include name="RegionInfoBase.cs" />
24 <include name="RegionServerBase.cs" /> 24 <include name="RegionServerBase.cs" />
25 <include name="SimClient.Grid.cs" /> 25 <include name="SimClient.cs" />
26 <include name="SimClient.PacketHandlers.cs" /> 26 <include name="SimClient.Grid.cs" />
27 <include name="SimClient.ProcessPackets.cs" /> 27 <include name="SimClient.PacketHandlers.cs" />
28 <include name="SimClient.cs" /> 28 <include name="SimClient.ProcessPackets.cs" />
29 <include name="SimClientBase.cs" /> 29 <include name="SimClientBase.cs" />
30 <include name="UDPServer.cs" /> 30 <include name="UDPServer.cs" />
31 <include name="VersionInfo.cs" /> 31 <include name="VersionInfo.cs" />
32 <include name="Assets/AssetCache.cs" /> 32 <include name="Assets/AssetCache.cs" />
33 <include name="Assets/InventoryCache.cs" /> 33 <include name="Assets/InventoryCache.cs" />
34 <include name="CAPS/AdminWebFront.cs" /> 34 <include name="CAPS/AdminWebFront.cs" />
35 <include name="types/Mesh.cs" /> 35 <include name="types/Mesh.cs" />
36 <include name="types/Triangle.cs" /> 36 <include name="types/Triangle.cs" />
37 <include name="world/Avatar.Client.cs" /> 37 <include name="world/Avatar.Client.cs" />
38 <include name="world/Avatar.Update.cs" /> 38 <include name="world/Avatar.cs" />
39 <include name="world/Avatar.cs" /> 39 <include name="world/Avatar.Update.cs" />
40 <include name="world/AvatarAnimations.cs" /> 40 <include name="world/AvatarAnimations.cs" />
41 <include name="world/Entity.cs" /> 41 <include name="world/Entity.cs" />
42 <include name="world/Primitive.cs" /> 42 <include name="world/Primitive.cs" />
43 <include name="world/Primitive2.cs" /> 43 <include name="world/Primitive2.cs" />
44 <include name="world/SceneObject.cs" /> 44 <include name="world/SceneObject.cs" />
45 <include name="world/World.PacketHandlers.cs" /> 45 <include name="world/World.cs" />
46 <include name="world/World.Scripting.cs" /> 46 <include name="world/World.PacketHandlers.cs" />
47 <include name="world/World.cs" /> 47 <include name="world/World.Scripting.cs" />
48 <include name="world/scripting/IScriptContext.cs" /> 48 <include name="world/WorldBase.cs" />
49 <include name="world/scripting/IScriptEntity.cs" /> 49 <include name="world/scripting/IScriptContext.cs" />
50 <include name="world/scripting/IScriptHandler.cs" /> 50 <include name="world/scripting/IScriptEntity.cs" />
51 <include name="world/scripting/Script.cs" /> 51 <include name="world/scripting/IScriptHandler.cs" />
52 <include name="world/scripting/ScriptFactory.cs" /> 52 <include name="world/scripting/Script.cs" />
53 <include name="world/scripting/Scripts/FollowRandomAvatar.cs" /> 53 <include name="world/scripting/ScriptFactory.cs" />
54 </sources> 54 <include name="world/scripting/Scripts/FollowRandomAvatar.cs" />
55 <references basedir="${project::get-base-directory()}"> 55 </sources>
56 <lib> 56 <references basedir="${project::get-base-directory()}">
57 <include name="${project::get-base-directory()}" /> 57 <lib>
58 <include name="${project::get-base-directory()}/${build.dir}" /> 58 <include name="${project::get-base-directory()}" />
59 </lib> 59 <include name="${project::get-base-directory()}/${build.dir}" />
60 <include name="System.dll" /> 60 </lib>
61 <include name="System.Xml.dll" /> 61 <include name="System.dll" />
62 <include name="../bin/libsecondlife.dll" /> 62 <include name="System.Xml.dll" />
63 <include name="../bin/Axiom.MathLib.dll" /> 63 <include name="../bin/libsecondlife.dll" />
64 <include name="../bin/Db4objects.Db4o.dll" /> 64 <include name="../bin/Axiom.MathLib.dll" />
65 <include name="../bin/OpenSim.Terrain.BasicTerrain.dll" /> 65 <include name="../bin/Db4objects.Db4o.dll" />
66 <include name="../bin/OpenSim.Framework.dll" /> 66 <include name="../bin/OpenSim.Terrain.BasicTerrain.dll" />
67 <include name="../bin/OpenSim.Framework.Console.dll" /> 67 <include name="../bin/OpenSim.Framework.dll" />
68 <include name="../bin/OpenSim.GenericConfig.Xml.dll" /> 68 <include name="../bin/OpenSim.Framework.Console.dll" />
69 <include name="../bin/OpenSim.Physics.Manager.dll" /> 69 <include name="../bin/OpenSim.GenericConfig.Xml.dll" />
70 <include name="../bin/OpenSim.Servers.dll" /> 70 <include name="../bin/OpenSim.Physics.Manager.dll" />
71 <include name="../bin/XMLRPC.dll" /> 71 <include name="../bin/OpenSim.Servers.dll" />
72 </references> 72 <include name="../bin/XMLRPC.dll" />
73 </csc> 73 </references>
74 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> 74 </csc>
75 <mkdir dir="${project::get-base-directory()}/../bin/"/> 75 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
76 <copy todir="${project::get-base-directory()}/../bin/"> 76 <mkdir dir="${project::get-base-directory()}/../bin/"/>
77 <fileset basedir="${project::get-base-directory()}/${build.dir}/" > 77 <copy todir="${project::get-base-directory()}/../bin/">
78 <include name="*.dll"/> 78 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
79 <include name="*.exe"/> 79 <include name="*.dll"/>
80 </fileset> 80 <include name="*.exe"/>
81 </copy> 81 </fileset>
82 </target> 82 </copy>
83 <target name="clean"> 83 </target>
84 <delete dir="${bin.dir}" failonerror="false" /> 84 <target name="clean">
85 <delete dir="${obj.dir}" failonerror="false" /> 85 <delete dir="${bin.dir}" failonerror="false" />
86 </target> 86 <delete dir="${obj.dir}" failonerror="false" />
87 <target name="doc" description="Creates documentation."> 87 </target>
88 </target> 88 <target name="doc" description="Creates documentation.">
89</project> 89 </target>
90</project>
diff --git a/OpenSim.RegionServer/PacketServer.cs b/OpenSim.RegionServer/PacketServer.cs
index f0a1f52..098076e 100644
--- a/OpenSim.RegionServer/PacketServer.cs
+++ b/OpenSim.RegionServer/PacketServer.cs
@@ -49,6 +49,11 @@ namespace OpenSim
49 49
50 } 50 }
51 51
52 public virtual void AddClientPacketHanlder(PacketType packetType, PacketMethod handler)
53 {
54
55 }
56
52 public virtual void RegisterClientPacketHandlers() 57 public virtual void RegisterClientPacketHandlers()
53 { 58 {
54 if (this._localWorld != null) 59 if (this._localWorld != null)
diff --git a/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim.RegionServer/world/World.PacketHandlers.cs
index 362bc14..175b777 100644
--- a/OpenSim.RegionServer/world/World.PacketHandlers.cs
+++ b/OpenSim.RegionServer/world/World.PacketHandlers.cs
@@ -15,6 +15,7 @@ namespace OpenSim.world
15{ 15{
16 public partial class World 16 public partial class World
17 { 17 {
18
18 public bool ModifyTerrain(SimClient simClient, Packet packet) 19 public bool ModifyTerrain(SimClient simClient, Packet packet)
19 { 20 {
20 ModifyLandPacket modify = (ModifyLandPacket)packet; 21 ModifyLandPacket modify = (ModifyLandPacket)packet;
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index 640ab81..72214d4 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -18,33 +18,39 @@ using OpenSim.Terrain;
18 18
19namespace OpenSim.world 19namespace OpenSim.world
20{ 20{
21 public partial class World : ILocalStorageReceiver, IScriptAPI 21 public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI
22 { 22 {
23 public object LockPhysicsEngine = new object(); 23 public object LockPhysicsEngine = new object();
24 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
25 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars; 24 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars;
26 public Dictionary<libsecondlife.LLUUID, Primitive> Prims; 25 public Dictionary<libsecondlife.LLUUID, Primitive> Prims;
27 //public ScriptEngine Scripts; 26 //public ScriptEngine Scripts;
28 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
29 public uint _localNumber = 0; 27 public uint _localNumber = 0;
30 private PhysicsScene phyScene; 28 private PhysicsScene phyScene;
31 private float timeStep = 0.1f; 29 private float timeStep = 0.1f;
32 private libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
33 public ILocalStorage localStorage; 30 public ILocalStorage localStorage;
34 private Random Rand = new Random(); 31 private Random Rand = new Random();
35 private uint _primCount = 702000; 32 private uint _primCount = 702000;
36 private int storageCount; 33 private int storageCount;
37 private Dictionary<uint, SimClient> m_clientThreads;
38 private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers; 34 private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers;
39 private Dictionary<string, ScriptFactory> m_scripts; 35 private Dictionary<string, ScriptFactory> m_scripts;
40 private ulong m_regionHandle;
41 private string m_regionName;
42 private InventoryCache _inventoryCache;
43 private AssetCache _assetCache;
44 private Mutex updateLock; 36 private Mutex updateLock;
45 private RegionInfo m_regInfo;
46 public string m_datastore; 37 public string m_datastore;
47 38
39 #region Properties
40 public PhysicsScene PhysScene
41 {
42 set
43 {
44 this.phyScene = value;
45 }
46 get
47 {
48 return (this.phyScene);
49 }
50 }
51 #endregion
52
53 #region Constructors
48 /// <summary> 54 /// <summary>
49 /// Creates a new World class, and a region to go with it. 55 /// Creates a new World class, and a region to go with it.
50 /// </summary> 56 /// </summary>
@@ -85,7 +91,9 @@ namespace OpenSim.world
85 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,"World.cs: Constructor failed with exception " + e.ToString()); 91 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,"World.cs: Constructor failed with exception " + e.ToString());
86 } 92 }
87 } 93 }
94 #endregion
88 95
96 #region Script Methods
89 /// <summary> 97 /// <summary>
90 /// Loads a new script into the specified entity 98 /// Loads a new script into the specified entity
91 /// </summary> 99 /// </summary>
@@ -156,37 +164,13 @@ namespace OpenSim.world
156 } 164 }
157 } 165 }
158 166
159 public InventoryCache InventoryCache 167 #endregion
160 {
161 set
162 {
163 this._inventoryCache = value;
164 }
165 }
166
167 public AssetCache AssetCache
168 {
169 set
170 {
171 this._assetCache = value;
172 }
173 }
174 public PhysicsScene PhysScene
175 {
176 set
177 {
178 this.phyScene = value;
179 }
180 get
181 {
182 return (this.phyScene);
183 }
184 }
185 168
169 #region Update Methods
186 /// <summary> 170 /// <summary>
187 /// Performs per-frame updates on the world, this should be the central world loop 171 /// Performs per-frame updates on the world, this should be the central world loop
188 /// </summary> 172 /// </summary>
189 public void Update() 173 public override void Update()
190 { 174 {
191 updateLock.WaitOne(); 175 updateLock.WaitOne();
192 try 176 try
@@ -235,6 +219,40 @@ namespace OpenSim.world
235 updateLock.ReleaseMutex(); 219 updateLock.ReleaseMutex();
236 } 220 }
237 221
222 public bool Backup()
223 {
224 try
225 {
226 // Terrain backup routines
227 if (Terrain.tainted > 0)
228 {
229 Terrain.tainted = 0;
230 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain tainted, saving.");
231 localStorage.SaveMap(Terrain.getHeights1D());
232 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain saved, informing Physics.");
233 phyScene.SetTerrain(Terrain.getHeights1D());
234 }
235
236 // Primitive backup routines
237 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Backing up Primitives");
238 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
239 {
240 Entities[UUID].BackUp();
241 }
242
243 // Backup successful
244 return true;
245 }
246 catch (Exception e)
247 {
248 // Backup failed
249 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString());
250 return false;
251 }
252 }
253 #endregion
254
255 #region Setup Methods
238 /// <summary> 256 /// <summary>
239 /// Loads a new storage subsystem from a named library 257 /// Loads a new storage subsystem from a named library
240 /// </summary> 258 /// </summary>
@@ -279,6 +297,16 @@ namespace OpenSim.world
279 } 297 }
280 } 298 }
281 299
300 public void SetDefaultScripts()
301 {
302 this.m_scripts.Add("FollowRandomAvatar", delegate()
303 {
304 return new OpenSim.RegionServer.world.scripting.FollowRandomAvatar();
305 });
306 }
307
308 #endregion
309
282 #region Regenerate Terrain 310 #region Regenerate Terrain
283 311
284 /// <summary> 312 /// <summary>
@@ -375,10 +403,11 @@ namespace OpenSim.world
375 403
376 #endregion 404 #endregion
377 405
406 #region Load Terrain
378 /// <summary> 407 /// <summary>
379 /// Loads the World heightmap 408 /// Loads the World heightmap
380 /// </summary> 409 /// </summary>
381 public void LoadWorldMap() 410 public override void LoadWorldMap()
382 { 411 {
383 try 412 try
384 { 413 {
@@ -400,6 +429,32 @@ namespace OpenSim.world
400 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); 429 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: LoadWorldMap() - Failed with exception " + e.ToString());
401 } 430 }
402 } 431 }
432 #endregion
433
434 #region Primitives Methods
435
436 /// <summary>
437 /// Sends prims to a client
438 /// </summary>
439 /// <param name="RemoteClient">Client to send to</param>
440 public void GetInitialPrims(SimClient RemoteClient)
441 {
442 try
443 {
444 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
445 {
446 if (Entities[UUID] is Primitive)
447 {
448 Primitive primitive = Entities[UUID] as Primitive;
449 primitive.UpdateClient(RemoteClient);
450 }
451 }
452 }
453 catch (Exception e)
454 {
455 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: GetInitialPrims() - Failed with exception " + e.ToString());
456 }
457 }
403 458
404 /// <summary> 459 /// <summary>
405 /// Loads the World's objects 460 /// Loads the World's objects
@@ -440,108 +495,37 @@ namespace OpenSim.world
440 } 495 }
441 } 496 }
442 497
443 /// <summary> 498 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
444 /// Tidy before shutdown
445 /// </summary>
446 public void Close()
447 {
448 try
449 {
450 this.localStorage.ShutDown();
451 }
452 catch (Exception e)
453 {
454 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"World.cs: Close() - Failed with exception " + e.ToString());
455 }
456 }
457
458 /// <summary>
459 /// Send the region heightmap to the client
460 /// </summary>
461 /// <param name="RemoteClient">Client to send to</param>
462 public void SendLayerData(SimClient RemoteClient)
463 { 499 {
464 try 500 try
465 { 501 {
466 int[] patches = new int[4]; 502 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: AddNewPrim() - Creating new prim");
467 503 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
468 for (int y = 0; y < 16; y++) 504 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
505 PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z);
506 PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f);
507 if (OpenSim.world.Avatar.PhysicsEngineFlying)
469 { 508 {
470 for (int x = 0; x < 16; x = x + 4) 509 lock (this.LockPhysicsEngine)
471 { 510 {
472 patches[0] = x + 0 + y * 16; 511 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize);
473 patches[1] = x + 1 + y * 16;
474 patches[2] = x + 2 + y * 16;
475 patches[3] = x + 3 + y * 16;
476
477 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
478 RemoteClient.OutPacket(layerpack);
479 } 512 }
480 } 513 }
481 }
482 catch (Exception e)
483 {
484 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: SendLayerData() - Failed with exception " + e.ToString());
485 }
486 }
487
488 /// <summary>
489 /// Sends a specified patch to a client
490 /// </summary>
491 /// <param name="px">Patch coordinate (x) 0..16</param>
492 /// <param name="py">Patch coordinate (y) 0..16</param>
493 /// <param name="RemoteClient">The client to send to</param>
494 public void SendLayerData(int px, int py, SimClient RemoteClient)
495 {
496 try
497 {
498 int[] patches = new int[1];
499 int patchx, patchy;
500 patchx = px / 16;
501 /* if (patchx > 12)
502 {
503 patchx = 12;
504 }*/
505 patchy = py / 16;
506 514
507 patches[0] = patchx + 0 + patchy * 16; 515 this.Entities.Add(prim.uuid, prim);
508 //patches[1] = patchx + 1 + patchy * 16; 516 this._primCount++;
509 //patches[2] = patchx + 2 + patchy * 16;
510 //patches[3] = patchx + 3 + patchy * 16;
511
512 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
513 RemoteClient.OutPacket(layerpack);
514 } 517 }
515 catch (Exception e) 518 catch (Exception e)
516 { 519 {
517 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: SendLayerData() - Failed with exception " + e.ToString()); 520 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddNewPrim() - Failed with exception " + e.ToString());
518 } 521 }
519 } 522 }
520 523
521 /// <summary> 524 #endregion
522 /// Sends prims to a client 525
523 /// </summary> 526 #region Add/Remove Avatar Methods
524 /// <param name="RemoteClient">Client to send to</param>
525 public void GetInitialPrims(SimClient RemoteClient)
526 {
527 try
528 {
529 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
530 {
531 if (Entities[UUID] is Primitive)
532 {
533 Primitive primitive = Entities[UUID] as Primitive;
534 primitive.UpdateClient(RemoteClient);
535 }
536 }
537 }
538 catch (Exception e)
539 {
540 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: GetInitialPrims() - Failed with exception " + e.ToString());
541 }
542 }
543 527
544 public void AddViewerAgent(SimClient agentClient) 528 public override void AddViewerAgent(SimClient agentClient)
545 { 529 {
546 try 530 try
547 { 531 {
@@ -587,7 +571,7 @@ namespace OpenSim.world
587 } 571 }
588 } 572 }
589 573
590 public void RemoveViewerAgent(SimClient agentClient) 574 public override void RemoveViewerAgent(SimClient agentClient)
591 { 575 {
592 try 576 try
593 { 577 {
@@ -609,72 +593,24 @@ namespace OpenSim.world
609 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString()); 593 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString());
610 } 594 }
611 } 595 }
596 #endregion
612 597
613 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) 598 #region ShutDown
614 { 599 /// <summary>
615 try 600 /// Tidy before shutdown
616 { 601 /// </summary>
617 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs: AddNewPrim() - Creating new prim"); 602 public override void Close()
618 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
619 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
620 PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z);
621 PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f);
622 if (OpenSim.world.Avatar.PhysicsEngineFlying)
623 {
624 lock (this.LockPhysicsEngine)
625 {
626 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize);
627 }
628 }
629
630 this.Entities.Add(prim.uuid, prim);
631 this._primCount++;
632 }
633 catch (Exception e)
634 {
635 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: AddNewPrim() - Failed with exception " + e.ToString());
636 }
637 }
638
639 public bool Backup()
640 { 603 {
641 try 604 try
642 { 605 {
643 // Terrain backup routines 606 this.localStorage.ShutDown();
644 if (Terrain.tainted > 0)
645 {
646 Terrain.tainted = 0;
647 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs: Backup() - Terrain tainted, saving.");
648 localStorage.SaveMap(Terrain.getHeights1D());
649 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs: Backup() - Terrain saved, informing Physics.");
650 phyScene.SetTerrain(Terrain.getHeights1D());
651 }
652
653 // Primitive backup routines
654 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs: Backup() - Backing up Primitives");
655 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
656 {
657 Entities[UUID].BackUp();
658 }
659
660 // Backup successful
661 return true;
662 } 607 }
663 catch (Exception e) 608 catch (Exception e)
664 { 609 {
665 // Backup failed 610 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString());
666 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"World.cs: Backup() - Backup Failed with exception " + e.ToString());
667 return false;
668 } 611 }
669 } 612 }
670 613 #endregion
671 public void SetDefaultScripts()
672 {
673 this.m_scripts.Add("FollowRandomAvatar", delegate()
674 {
675 return new OpenSim.RegionServer.world.scripting.FollowRandomAvatar();
676 });
677 }
678 614
679 } 615 }
680} 616}
diff --git a/OpenSim.RegionServer/world/WorldBase.cs b/OpenSim.RegionServer/world/WorldBase.cs
new file mode 100644
index 0000000..b8c086d
--- /dev/null
+++ b/OpenSim.RegionServer/world/WorldBase.cs
@@ -0,0 +1,176 @@
1using System;
2using libsecondlife;
3using libsecondlife.Packets;
4using System.Collections.Generic;
5using System.Text;
6using System.Reflection;
7using System.IO;
8using System.Threading;
9using OpenSim.Physics.Manager;
10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types;
12using OpenSim.Framework.Terrain;
13using OpenSim.Framework.Inventory;
14using OpenSim.Assets;
15using OpenSim.RegionServer.world.scripting;
16using OpenSim.Terrain;
17
18namespace OpenSim.world
19{
20 public class WorldBase
21 {
22 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
23 protected Dictionary<uint, SimClient> m_clientThreads;
24 protected ulong m_regionHandle;
25 protected string m_regionName;
26 protected InventoryCache _inventoryCache;
27 protected AssetCache _assetCache;
28 protected RegionInfo m_regInfo;
29
30 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
31 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
32
33 #region Properties
34 public InventoryCache InventoryCache
35 {
36 set
37 {
38 this._inventoryCache = value;
39 }
40 }
41
42 public AssetCache AssetCache
43 {
44 set
45 {
46 this._assetCache = value;
47 }
48 }
49 #endregion
50
51 #region Constructors
52 public WorldBase()
53 {
54
55 }
56 #endregion
57
58 #region Setup Methods
59 /// <summary>
60 /// Register Packet handler Methods with the packet server (which will register them with the SimClient)
61 /// </summary>
62 /// <param name="packetServer"></param>
63 public virtual void RegisterPacketHandlers(PacketServer packetServer)
64 {
65
66 }
67 #endregion
68
69 #region Update Methods
70 /// <summary>
71 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
72 /// </summary>
73 public virtual void Update()
74 {
75
76 }
77 #endregion
78
79 #region Terrain Methods
80
81 /// <summary>
82 /// Loads the World heightmap
83 /// </summary>
84 public virtual void LoadWorldMap()
85 {
86
87 }
88
89 /// <summary>
90 /// Send the region heightmap to the client
91 /// </summary>
92 /// <param name="RemoteClient">Client to send to</param>
93 public virtual void SendLayerData(SimClient RemoteClient)
94 {
95 try
96 {
97 int[] patches = new int[4];
98
99 for (int y = 0; y < 16; y++)
100 {
101 for (int x = 0; x < 16; x = x + 4)
102 {
103 patches[0] = x + 0 + y * 16;
104 patches[1] = x + 1 + y * 16;
105 patches[2] = x + 2 + y * 16;
106 patches[3] = x + 3 + y * 16;
107
108 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
109 RemoteClient.OutPacket(layerpack);
110 }
111 }
112 }
113 catch (Exception e)
114 {
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: SendLayerData() - Failed with exception " + e.ToString());
116 }
117 }
118
119 /// <summary>
120 /// Sends a specified patch to a client
121 /// </summary>
122 /// <param name="px">Patch coordinate (x) 0..16</param>
123 /// <param name="py">Patch coordinate (y) 0..16</param>
124 /// <param name="RemoteClient">The client to send to</param>
125 public void SendLayerData(int px, int py, SimClient RemoteClient)
126 {
127 try
128 {
129 int[] patches = new int[1];
130 int patchx, patchy;
131 patchx = px / 16;
132 patchy = py / 16;
133
134 patches[0] = patchx + 0 + patchy * 16;
135
136 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
137 RemoteClient.OutPacket(layerpack);
138 }
139 catch (Exception e)
140 {
141 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: SendLayerData() - Failed with exception " + e.ToString());
142 }
143 }
144 #endregion
145
146 #region Add/Remove Agent/Avatar
147 /// <summary>
148 /// Add a new Agent's avatar
149 /// </summary>
150 /// <param name="agentClient"></param>
151 public virtual void AddViewerAgent(SimClient agentClient)
152 {
153
154 }
155
156 /// <summary>
157 /// Remove a Agent's avatar
158 /// </summary>
159 /// <param name="agentClient"></param>
160 public virtual void RemoveViewerAgent(SimClient agentClient)
161 {
162
163 }
164 #endregion
165
166 #region Shutdown
167 /// <summary>
168 /// Tidy before shutdown
169 /// </summary>
170 public virtual void Close()
171 {
172
173 }
174 #endregion
175 }
176}