diff options
author | mingchen | 2007-06-07 14:23:19 +0000 |
---|---|---|
committer | mingchen | 2007-06-07 14:23:19 +0000 |
commit | f88a4777f9e9b23795aed5a7f364a93a73e9ed15 (patch) | |
tree | 7acf567aed35932ae0bcc5410698379bbb6087c0 /OpenSim | |
parent | *When avatar crosses parcel, it updates successfully in the viewer (diff) | |
download | opensim-SC-f88a4777f9e9b23795aed5a7f364a93a73e9ed15.zip opensim-SC-f88a4777f9e9b23795aed5a7f364a93a73e9ed15.tar.gz opensim-SC-f88a4777f9e9b23795aed5a7f364a93a73e9ed15.tar.bz2 opensim-SC-f88a4777f9e9b23795aed5a7f364a93a73e9ed15.tar.xz |
*Cleaned up namespaces, filenames, etc in OpenSim.RegionServer
NOTES:
*ClientView is now in the namespace OpenSim.RegionServer.Client
*Scripting is now in the namespace OpenSim.RegionServer.scripting
*Other various cleaning
Diffstat (limited to 'OpenSim')
49 files changed, 169 insertions, 5230 deletions
diff --git a/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs index 57a8d08..6781781 100644 --- a/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs +++ b/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs | |||
@@ -28,13 +28,14 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Assets; | 31 | using OpenSim.RegionServer.Assets; |
32 | using OpenSim.RegionServer.Client; | ||
32 | using OpenSim.Framework.Types; | 33 | using OpenSim.Framework.Types; |
33 | using OpenSim.Framework.Utilities; | 34 | using OpenSim.Framework.Utilities; |
34 | using libsecondlife; | 35 | using libsecondlife; |
35 | using libsecondlife.Packets; | 36 | using libsecondlife.Packets; |
36 | 37 | ||
37 | namespace OpenSim | 38 | namespace OpenSim.RegionServer |
38 | { | 39 | { |
39 | public class AgentAssetUpload | 40 | public class AgentAssetUpload |
40 | { | 41 | { |
diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs index 2d9a501..466f9f9 100644 --- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs | |||
@@ -31,13 +31,13 @@ using System.Collections.Generic; | |||
31 | using System.Threading; | 31 | using System.Threading; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
34 | using OpenSim; | ||
35 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
36 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
37 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
38 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.RegionServer.Client; | ||
39 | 39 | ||
40 | namespace OpenSim.Assets | 40 | namespace OpenSim.RegionServer.Assets |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// Manages local cache of assets and their sending to viewers. | 43 | /// Manages local cache of assets and their sending to viewers. |
diff --git a/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs index 5d5021c..9ed5dcb 100644 --- a/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs | |||
@@ -31,12 +31,13 @@ using System.Collections.Generic; | |||
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim; | 32 | using OpenSim; |
33 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
34 | //using OpenSim.GridServers; | 34 | |
35 | using OpenSim.Framework.Inventory; | 35 | using OpenSim.Framework.Inventory; |
36 | using OpenSim.Framework.Types; | 36 | using OpenSim.Framework.Types; |
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.RegionServer.Client; | ||
38 | 39 | ||
39 | namespace OpenSim.Assets | 40 | namespace OpenSim.RegionServer.Assets |
40 | { | 41 | { |
41 | /// <summary> | 42 | /// <summary> |
42 | /// Description of InventoryManager. | 43 | /// Description of InventoryManager. |
diff --git a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs index 12ebfc7..6f80210 100644 --- a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs +++ b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs | |||
@@ -32,7 +32,7 @@ using libsecondlife; | |||
32 | using OpenSim.Framework.Interfaces; | 32 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Types; | 33 | using OpenSim.Framework.Types; |
34 | 34 | ||
35 | namespace OpenSim | 35 | namespace OpenSim.RegionServer |
36 | { | 36 | { |
37 | public class AuthenticateSessionsBase | 37 | public class AuthenticateSessionsBase |
38 | { | 38 | { |
diff --git a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs index c806262..e0ffd71 100644 --- a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs +++ b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs | |||
@@ -31,7 +31,7 @@ using System.Text; | |||
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework.Types; | 32 | using OpenSim.Framework.Types; |
33 | 33 | ||
34 | namespace OpenSim | 34 | namespace OpenSim.RegionServer |
35 | { | 35 | { |
36 | public class AuthenticateSessionsLocal : AuthenticateSessionsBase | 36 | public class AuthenticateSessionsLocal : AuthenticateSessionsBase |
37 | { | 37 | { |
diff --git a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs index 34181d6..5747f8a 100644 --- a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs +++ b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs | |||
@@ -34,7 +34,7 @@ using libsecondlife; | |||
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | 36 | ||
37 | namespace OpenSim | 37 | namespace OpenSim.RegionServer |
38 | { | 38 | { |
39 | public class AuthenticateSessionsRemote : AuthenticateSessionsBase | 39 | public class AuthenticateSessionsRemote : AuthenticateSessionsBase |
40 | { | 40 | { |
diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs index a8d78bb..ead902d 100644 --- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs | |||
@@ -29,16 +29,16 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using System.IO; | 31 | using System.IO; |
32 | using OpenSim.world; | 32 | using OpenSim.RegionServer.Simulator; |
33 | using OpenSim.UserServer; | 33 | using OpenSim.UserServer; |
34 | using OpenSim.Servers; | 34 | using OpenSim.Servers; |
35 | using OpenSim.Assets; | 35 | using OpenSim.RegionServer.Assets; |
36 | using OpenSim.Framework.Inventory; | 36 | using OpenSim.Framework.Inventory; |
37 | using libsecondlife; | 37 | using libsecondlife; |
38 | using OpenSim.RegionServer.world.scripting; | 38 | using OpenSim.RegionServer.Scripting; |
39 | using Avatar=libsecondlife.Avatar; | 39 | using Avatar=libsecondlife.Avatar; |
40 | 40 | ||
41 | namespace OpenSim.CAPS | 41 | namespace OpenSim.RegionServer.CAPS |
42 | { | 42 | { |
43 | public class AdminWebFront | 43 | public class AdminWebFront |
44 | { | 44 | { |
@@ -150,12 +150,12 @@ namespace OpenSim.CAPS | |||
150 | { | 150 | { |
151 | string responseString; | 151 | string responseString; |
152 | responseString = " <p> Listing connected Clients </p>"; | 152 | responseString = " <p> Listing connected Clients </p>"; |
153 | OpenSim.world.Avatar TempAv; | 153 | OpenSim.RegionServer.Simulator.Avatar TempAv; |
154 | foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys) | 154 | foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys) |
155 | { | 155 | { |
156 | if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar") | 156 | if (m_world.Entities[UUID].ToString() == "OpenSim.RegionServer.Simulator.Avatar") |
157 | { | 157 | { |
158 | TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID]; | 158 | TempAv = (OpenSim.RegionServer.Simulator.Avatar)m_world.Entities[UUID]; |
159 | responseString += "<p> Client: "; | 159 | responseString += "<p> Client: "; |
160 | responseString += TempAv.firstname + " , " + TempAv.lastname + " , <A HREF=\"javascript:loadXMLDoc('ClientInventory/" + UUID.ToString() + "')\">" + UUID + "</A> , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString(); | 160 | responseString += TempAv.firstname + " , " + TempAv.lastname + " , <A HREF=\"javascript:loadXMLDoc('ClientInventory/" + UUID.ToString() + "')\">" + UUID + "</A> , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString(); |
161 | responseString += "</p>"; | 161 | responseString += "</p>"; |
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs index 019b65d..514435a 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs +++ b/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs | |||
@@ -40,11 +40,11 @@ using OpenSim.Framework.Interfaces; | |||
40 | using OpenSim.Framework.Types; | 40 | using OpenSim.Framework.Types; |
41 | using OpenSim.Framework.Inventory; | 41 | using OpenSim.Framework.Inventory; |
42 | using OpenSim.Framework.Utilities; | 42 | using OpenSim.Framework.Utilities; |
43 | using OpenSim.world; | 43 | using OpenSim.RegionServer.Simulator; |
44 | using OpenSim.Assets; | 44 | using OpenSim.RegionServer.Assets; |
45 | using OpenSim.Framework.Console; | 45 | using OpenSim.Framework.Console; |
46 | 46 | ||
47 | namespace OpenSim | 47 | namespace OpenSim.RegionServer.Client |
48 | { | 48 | { |
49 | public partial class ClientView | 49 | public partial class ClientView |
50 | { | 50 | { |
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.PacketHandlers.cs index be3a893..4af0485 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs +++ b/OpenSim/OpenSim.RegionServer/Client/ClientView.PacketHandlers.cs | |||
@@ -40,11 +40,11 @@ using OpenSim.Framework.Interfaces; | |||
40 | using OpenSim.Framework.Types; | 40 | using OpenSim.Framework.Types; |
41 | using OpenSim.Framework.Inventory; | 41 | using OpenSim.Framework.Inventory; |
42 | using OpenSim.Framework.Utilities; | 42 | using OpenSim.Framework.Utilities; |
43 | using OpenSim.world; | 43 | using OpenSim.RegionServer.Simulator; |
44 | using OpenSim.Assets; | 44 | using OpenSim.RegionServer.Assets; |
45 | using OpenSim.Framework.Console; | 45 | using OpenSim.Framework.Console; |
46 | 46 | ||
47 | namespace OpenSim | 47 | namespace OpenSim.RegionServer.Client |
48 | { | 48 | { |
49 | public partial class ClientView | 49 | public partial class ClientView |
50 | { | 50 | { |
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs index e3d875f..b07749e 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs | |||
@@ -40,12 +40,11 @@ using OpenSim.Framework.Interfaces; | |||
40 | using OpenSim.Framework.Types; | 40 | using OpenSim.Framework.Types; |
41 | using OpenSim.Framework.Inventory; | 41 | using OpenSim.Framework.Inventory; |
42 | using OpenSim.Framework.Utilities; | 42 | using OpenSim.Framework.Utilities; |
43 | using OpenSim.world; | 43 | using OpenSim.RegionServer.Simulator; |
44 | using OpenSim.RegionServer.world; | 44 | using OpenSim.RegionServer.Assets; |
45 | using OpenSim.Assets; | ||
46 | using OpenSim.Framework.Console; | 45 | using OpenSim.Framework.Console; |
47 | 46 | ||
48 | namespace OpenSim | 47 | namespace OpenSim.RegionServer.Client |
49 | { | 48 | { |
50 | public partial class ClientView | 49 | public partial class ClientView |
51 | { | 50 | { |
@@ -92,6 +91,7 @@ namespace OpenSim | |||
92 | protected override void ProcessInPacket(Packet Pack) | 91 | protected override void ProcessInPacket(Packet Pack) |
93 | { | 92 | { |
94 | ack_pack(Pack); | 93 | ack_pack(Pack); |
94 | debug = true; | ||
95 | if (debug) | 95 | if (debug) |
96 | { | 96 | { |
97 | if (Pack.Type != PacketType.AgentUpdate) | 97 | if (Pack.Type != PacketType.AgentUpdate) |
@@ -361,7 +361,7 @@ namespace OpenSim | |||
361 | { | 361 | { |
362 | if (ent.localid == updatetask.UpdateData.LocalID) | 362 | if (ent.localid == updatetask.UpdateData.LocalID) |
363 | { | 363 | { |
364 | if (ent is OpenSim.world.Primitive) | 364 | if (ent is OpenSim.RegionServer.Simulator.Primitive) |
365 | { | 365 | { |
366 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); | 366 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); |
367 | } | 367 | } |
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.cs index 3934567..6d7c3f2 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/Client/ClientView.cs | |||
@@ -41,11 +41,11 @@ using OpenSim.Framework.Interfaces; | |||
41 | using OpenSim.Framework.Types; | 41 | using OpenSim.Framework.Types; |
42 | using OpenSim.Framework.Inventory; | 42 | using OpenSim.Framework.Inventory; |
43 | using OpenSim.Framework.Utilities; | 43 | using OpenSim.Framework.Utilities; |
44 | using OpenSim.world; | 44 | using OpenSim.RegionServer.Simulator; |
45 | using OpenSim.Assets; | 45 | using OpenSim.RegionServer.Assets; |
46 | using OpenSim.Framework.Console; | 46 | using OpenSim.Framework.Console; |
47 | 47 | ||
48 | namespace OpenSim | 48 | namespace OpenSim.RegionServer.Client |
49 | { | 49 | { |
50 | public delegate bool PacketMethod(ClientView simClient, Packet packet); | 50 | public delegate bool PacketMethod(ClientView simClient, Packet packet); |
51 | 51 | ||
@@ -62,7 +62,7 @@ namespace OpenSim | |||
62 | public LLUUID SessionID; | 62 | public LLUUID SessionID; |
63 | public LLUUID SecureSessionID = LLUUID.Zero; | 63 | public LLUUID SecureSessionID = LLUUID.Zero; |
64 | public bool m_child; | 64 | public bool m_child; |
65 | public world.Avatar ClientAvatar; | 65 | public Simulator.Avatar ClientAvatar; |
66 | private UseCircuitCodePacket cirpack; | 66 | private UseCircuitCodePacket cirpack; |
67 | public Thread ClientThread; | 67 | public Thread ClientThread; |
68 | public LLVector3 startpos; | 68 | public LLVector3 startpos; |
diff --git a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs b/OpenSim/OpenSim.RegionServer/Client/ClientViewBase.cs index 26391a7..2ff245f 100644 --- a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs +++ b/OpenSim/OpenSim.RegionServer/Client/ClientViewBase.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Framework.Utilities; | |||
39 | using OpenSim.Framework.Interfaces; | 39 | using OpenSim.Framework.Interfaces; |
40 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | 41 | ||
42 | namespace OpenSim | 42 | namespace OpenSim.RegionServer.Client |
43 | { | 43 | { |
44 | public class ClientViewBase | 44 | public class ClientViewBase |
45 | { | 45 | { |
diff --git a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs b/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs new file mode 100644 index 0000000..7ddfcd2 --- /dev/null +++ b/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs | |||
@@ -0,0 +1,11 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.RegionServer.Estate | ||
6 | { | ||
7 | public class EstateManager | ||
8 | { | ||
9 | |||
10 | } | ||
11 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs index 0308f4b..844bb71 100644 --- a/OpenSim/OpenSim.RegionServer/Grid.cs +++ b/OpenSim/OpenSim.RegionServer/Grid.cs | |||
@@ -32,7 +32,7 @@ using System.Reflection; | |||
32 | using OpenSim.Framework.Interfaces; | 32 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.UserServer; | 33 | using OpenSim.UserServer; |
34 | 34 | ||
35 | namespace OpenSim | 35 | namespace OpenSim.RegionServer |
36 | { | 36 | { |
37 | public class Grid | 37 | public class Grid |
38 | { | 38 | { |
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj index 9161a4e..faa479f 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj | |||
@@ -124,10 +124,7 @@ | |||
124 | </ProjectReference> | 124 | </ProjectReference> |
125 | </ItemGroup> | 125 | </ItemGroup> |
126 | <ItemGroup> | 126 | <ItemGroup> |
127 | <Compile Include="OpenSimMain.cs"> | 127 | <Compile Include="AuthenticateSessionsBase.cs"> |
128 | <SubType>Code</SubType> | ||
129 | </Compile> | ||
130 | <Compile Include="UDPServer.cs"> | ||
131 | <SubType>Code</SubType> | 128 | <SubType>Code</SubType> |
132 | </Compile> | 129 | </Compile> |
133 | <Compile Include="AuthenticateSessionsLocal.cs"> | 130 | <Compile Include="AuthenticateSessionsLocal.cs"> |
@@ -136,118 +133,124 @@ | |||
136 | <Compile Include="AuthenticateSessionsRemote.cs"> | 133 | <Compile Include="AuthenticateSessionsRemote.cs"> |
137 | <SubType>Code</SubType> | 134 | <SubType>Code</SubType> |
138 | </Compile> | 135 | </Compile> |
136 | <Compile Include="Grid.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | <Compile Include="OpenSimNetworkHandler.cs"> | 139 | <Compile Include="OpenSimNetworkHandler.cs"> |
140 | <SubType>Code</SubType> | 140 | <SubType>Code</SubType> |
141 | </Compile> | 141 | </Compile> |
142 | <Compile Include="Grid.cs"> | 142 | <Compile Include="RegionInfo.cs"> |
143 | <SubType>Code</SubType> | 143 | <SubType>Code</SubType> |
144 | </Compile> | 144 | </Compile> |
145 | <Compile Include="RegionInfoBase.cs"> | 145 | <Compile Include="RegionInfoBase.cs"> |
146 | <SubType>Code</SubType> | 146 | <SubType>Code</SubType> |
147 | </Compile> | 147 | </Compile> |
148 | <Compile Include="ClientView.Grid.cs"> | 148 | <Compile Include="VersionInfo.cs"> |
149 | <SubType>Code</SubType> | 149 | <SubType>Code</SubType> |
150 | </Compile> | 150 | </Compile> |
151 | <Compile Include="PacketServer.cs"> | 151 | <Compile Include="AgentAssetUpload.cs"> |
152 | <SubType>Code</SubType> | 152 | <SubType>Code</SubType> |
153 | </Compile> | 153 | </Compile> |
154 | <Compile Include="RegionInfo.cs"> | 154 | <Compile Include="RegionServerBase.cs"> |
155 | <SubType>Code</SubType> | 155 | <SubType>Code</SubType> |
156 | </Compile> | 156 | </Compile> |
157 | <Compile Include="ClientView.PacketHandlers.cs"> | 157 | <Compile Include="PacketServer.cs"> |
158 | <SubType>Code</SubType> | 158 | <SubType>Code</SubType> |
159 | </Compile> | 159 | </Compile> |
160 | <Compile Include="AuthenticateSessionsBase.cs"> | 160 | <Compile Include="UDPServer.cs"> |
161 | <SubType>Code</SubType> | 161 | <SubType>Code</SubType> |
162 | </Compile> | 162 | </Compile> |
163 | <Compile Include="ClientView.ProcessPackets.cs"> | 163 | <Compile Include="OpenSimMain.cs"> |
164 | <SubType>Code</SubType> | 164 | <SubType>Code</SubType> |
165 | </Compile> | 165 | </Compile> |
166 | <Compile Include="VersionInfo.cs"> | 166 | <Compile Include="CAPS\AdminWebFront.cs"> |
167 | <SubType>Code</SubType> | 167 | <SubType>Code</SubType> |
168 | </Compile> | 168 | </Compile> |
169 | <Compile Include="AgentAssetUpload.cs"> | 169 | <Compile Include="Assets\AssetCache.cs"> |
170 | <SubType>Code</SubType> | 170 | <SubType>Code</SubType> |
171 | </Compile> | 171 | </Compile> |
172 | <Compile Include="ClientViewBase.cs"> | 172 | <Compile Include="Assets\InventoryCache.cs"> |
173 | <SubType>Code</SubType> | 173 | <SubType>Code</SubType> |
174 | </Compile> | 174 | </Compile> |
175 | <Compile Include="RegionServerBase.cs"> | 175 | <Compile Include="Estate\EstateManager.cs"> |
176 | <SubType>Code</SubType> | 176 | <SubType>Code</SubType> |
177 | </Compile> | 177 | </Compile> |
178 | <Compile Include="ClientView.cs"> | 178 | <Compile Include="Types\Mesh.cs"> |
179 | <SubType>Code</SubType> | 179 | <SubType>Code</SubType> |
180 | </Compile> | 180 | </Compile> |
181 | <Compile Include="CAPS\AdminWebFront.cs"> | 181 | <Compile Include="Types\Triangle.cs"> |
182 | <SubType>Code</SubType> | 182 | <SubType>Code</SubType> |
183 | </Compile> | 183 | </Compile> |
184 | <Compile Include="world\Avatar.Client.cs"> | 184 | <Compile Include="Simulator\World.Scripting.cs"> |
185 | <SubType>Code</SubType> | 185 | <SubType>Code</SubType> |
186 | </Compile> | 186 | </Compile> |
187 | <Compile Include="world\Entity.cs"> | 187 | <Compile Include="Simulator\Entity.cs"> |
188 | <SubType>Code</SubType> | 188 | <SubType>Code</SubType> |
189 | </Compile> | 189 | </Compile> |
190 | <Compile Include="world\Avatar.cs"> | 190 | <Compile Include="Simulator\Primitive.cs"> |
191 | <SubType>Code</SubType> | 191 | <SubType>Code</SubType> |
192 | </Compile> | 192 | </Compile> |
193 | <Compile Include="world\World.PacketHandlers.cs"> | 193 | <Compile Include="Simulator\WorldBase.cs"> |
194 | <SubType>Code</SubType> | 194 | <SubType>Code</SubType> |
195 | </Compile> | 195 | </Compile> |
196 | <Compile Include="world\Avatar.Update.cs"> | 196 | <Compile Include="Simulator\SceneObject.cs"> |
197 | <SubType>Code</SubType> | 197 | <SubType>Code</SubType> |
198 | </Compile> | 198 | </Compile> |
199 | <Compile Include="world\AvatarAnimations.cs"> | 199 | <Compile Include="Simulator\World.cs"> |
200 | <SubType>Code</SubType> | 200 | <SubType>Code</SubType> |
201 | </Compile> | 201 | </Compile> |
202 | <Compile Include="world\ParcelManager.cs"> | 202 | <Compile Include="Simulator\ParcelManager.cs"> |
203 | <SubType>Code</SubType> | 203 | <SubType>Code</SubType> |
204 | </Compile> | 204 | </Compile> |
205 | <Compile Include="world\WorldBase.cs"> | 205 | <Compile Include="Simulator\World.PacketHandlers.cs"> |
206 | <SubType>Code</SubType> | 206 | <SubType>Code</SubType> |
207 | </Compile> | 207 | </Compile> |
208 | <Compile Include="world\SceneObject.cs"> | 208 | <Compile Include="Simulator\Avatar.cs"> |
209 | <SubType>Code</SubType> | 209 | <SubType>Code</SubType> |
210 | </Compile> | 210 | </Compile> |
211 | <Compile Include="world\World.cs"> | 211 | <Compile Include="Simulator\Avatar.Update.cs"> |
212 | <SubType>Code</SubType> | 212 | <SubType>Code</SubType> |
213 | </Compile> | 213 | </Compile> |
214 | <Compile Include="world\Primitive.cs"> | 214 | <Compile Include="Simulator\AvatarAnimations.cs"> |
215 | <SubType>Code</SubType> | 215 | <SubType>Code</SubType> |
216 | </Compile> | 216 | </Compile> |
217 | <Compile Include="world\World.Scripting.cs"> | 217 | <Compile Include="Simulator\Primitive2.cs"> |
218 | <SubType>Code</SubType> | 218 | <SubType>Code</SubType> |
219 | </Compile> | 219 | </Compile> |
220 | <Compile Include="world\Primitive2.cs"> | 220 | <Compile Include="Simulator\Avatar.Client.cs"> |
221 | <SubType>Code</SubType> | 221 | <SubType>Code</SubType> |
222 | </Compile> | 222 | </Compile> |
223 | <Compile Include="world\scripting\IScriptHandler.cs"> | 223 | <Compile Include="Scripting\IScriptContext.cs"> |
224 | <SubType>Code</SubType> | 224 | <SubType>Code</SubType> |
225 | </Compile> | 225 | </Compile> |
226 | <Compile Include="world\scripting\ScriptFactory.cs"> | 226 | <Compile Include="Scripting\IScriptEntity.cs"> |
227 | <SubType>Code</SubType> | 227 | <SubType>Code</SubType> |
228 | </Compile> | 228 | </Compile> |
229 | <Compile Include="world\scripting\IScriptContext.cs"> | 229 | <Compile Include="Scripting\Script.cs"> |
230 | <SubType>Code</SubType> | 230 | <SubType>Code</SubType> |
231 | </Compile> | 231 | </Compile> |
232 | <Compile Include="world\scripting\Script.cs"> | 232 | <Compile Include="Scripting\ScriptFactory.cs"> |
233 | <SubType>Code</SubType> | 233 | <SubType>Code</SubType> |
234 | </Compile> | 234 | </Compile> |
235 | <Compile Include="world\scripting\IScriptEntity.cs"> | 235 | <Compile Include="Scripting\IScriptHandler.cs"> |
236 | <SubType>Code</SubType> | 236 | <SubType>Code</SubType> |
237 | </Compile> | 237 | </Compile> |
238 | <Compile Include="world\scripting\Scripts\FollowRandomAvatar.cs"> | 238 | <Compile Include="Scripting\Scripts\FollowRandomAvatar.cs"> |
239 | <SubType>Code</SubType> | 239 | <SubType>Code</SubType> |
240 | </Compile> | 240 | </Compile> |
241 | <Compile Include="Assets\InventoryCache.cs"> | 241 | <Compile Include="Client\ClientViewBase.cs"> |
242 | <SubType>Code</SubType> | 242 | <SubType>Code</SubType> |
243 | </Compile> | 243 | </Compile> |
244 | <Compile Include="Assets\AssetCache.cs"> | 244 | <Compile Include="Client\ClientView.Grid.cs"> |
245 | <SubType>Code</SubType> | ||
246 | </Compile> | ||
247 | <Compile Include="Client\ClientView.PacketHandlers.cs"> | ||
245 | <SubType>Code</SubType> | 248 | <SubType>Code</SubType> |
246 | </Compile> | 249 | </Compile> |
247 | <Compile Include="types\Mesh.cs"> | 250 | <Compile Include="Client\ClientView.cs"> |
248 | <SubType>Code</SubType> | 251 | <SubType>Code</SubType> |
249 | </Compile> | 252 | </Compile> |
250 | <Compile Include="types\Triangle.cs"> | 253 | <Compile Include="Client\ClientView.ProcessPackets.cs"> |
251 | <SubType>Code</SubType> | 254 | <SubType>Code</SubType> |
252 | </Compile> | 255 | </Compile> |
253 | </ItemGroup> | 256 | </ItemGroup> |
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build index bbd63f1..82fc661 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build +++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build | |||
@@ -11,48 +11,49 @@ | |||
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="OpenSimMain.cs" /> | 14 | <include name="AuthenticateSessionsBase.cs" /> |
15 | <include name="UDPServer.cs" /> | ||
16 | <include name="AuthenticateSessionsLocal.cs" /> | 15 | <include name="AuthenticateSessionsLocal.cs" /> |
17 | <include name="AuthenticateSessionsRemote.cs" /> | 16 | <include name="AuthenticateSessionsRemote.cs" /> |
18 | <include name="OpenSimNetworkHandler.cs" /> | ||
19 | <include name="Grid.cs" /> | 17 | <include name="Grid.cs" /> |
20 | <include name="RegionInfoBase.cs" /> | 18 | <include name="OpenSimNetworkHandler.cs" /> |
21 | <include name="ClientView.Grid.cs" /> | ||
22 | <include name="PacketServer.cs" /> | ||
23 | <include name="RegionInfo.cs" /> | 19 | <include name="RegionInfo.cs" /> |
24 | <include name="ClientView.PacketHandlers.cs" /> | 20 | <include name="RegionInfoBase.cs" /> |
25 | <include name="AuthenticateSessionsBase.cs" /> | ||
26 | <include name="ClientView.ProcessPackets.cs" /> | ||
27 | <include name="VersionInfo.cs" /> | 21 | <include name="VersionInfo.cs" /> |
28 | <include name="AgentAssetUpload.cs" /> | 22 | <include name="AgentAssetUpload.cs" /> |
29 | <include name="ClientViewBase.cs" /> | ||
30 | <include name="RegionServerBase.cs" /> | 23 | <include name="RegionServerBase.cs" /> |
31 | <include name="ClientView.cs" /> | 24 | <include name="PacketServer.cs" /> |
25 | <include name="UDPServer.cs" /> | ||
26 | <include name="OpenSimMain.cs" /> | ||
32 | <include name="CAPS/AdminWebFront.cs" /> | 27 | <include name="CAPS/AdminWebFront.cs" /> |
33 | <include name="world/Avatar.Client.cs" /> | ||
34 | <include name="world/Entity.cs" /> | ||
35 | <include name="world/Avatar.cs" /> | ||
36 | <include name="world/World.PacketHandlers.cs" /> | ||
37 | <include name="world/Avatar.Update.cs" /> | ||
38 | <include name="world/AvatarAnimations.cs" /> | ||
39 | <include name="world/ParcelManager.cs" /> | ||
40 | <include name="world/WorldBase.cs" /> | ||
41 | <include name="world/SceneObject.cs" /> | ||
42 | <include name="world/World.cs" /> | ||
43 | <include name="world/Primitive.cs" /> | ||
44 | <include name="world/World.Scripting.cs" /> | ||
45 | <include name="world/Primitive2.cs" /> | ||
46 | <include name="world/scripting/IScriptHandler.cs" /> | ||
47 | <include name="world/scripting/ScriptFactory.cs" /> | ||
48 | <include name="world/scripting/IScriptContext.cs" /> | ||
49 | <include name="world/scripting/Script.cs" /> | ||
50 | <include name="world/scripting/IScriptEntity.cs" /> | ||
51 | <include name="world/scripting/Scripts/FollowRandomAvatar.cs" /> | ||
52 | <include name="Assets/InventoryCache.cs" /> | ||
53 | <include name="Assets/AssetCache.cs" /> | 28 | <include name="Assets/AssetCache.cs" /> |
54 | <include name="types/Mesh.cs" /> | 29 | <include name="Assets/InventoryCache.cs" /> |
55 | <include name="types/Triangle.cs" /> | 30 | <include name="Estate/EstateManager.cs" /> |
31 | <include name="Types/Mesh.cs" /> | ||
32 | <include name="Types/Triangle.cs" /> | ||
33 | <include name="Simulator/World.Scripting.cs" /> | ||
34 | <include name="Simulator/Entity.cs" /> | ||
35 | <include name="Simulator/Primitive.cs" /> | ||
36 | <include name="Simulator/WorldBase.cs" /> | ||
37 | <include name="Simulator/SceneObject.cs" /> | ||
38 | <include name="Simulator/World.cs" /> | ||
39 | <include name="Simulator/ParcelManager.cs" /> | ||
40 | <include name="Simulator/World.PacketHandlers.cs" /> | ||
41 | <include name="Simulator/Avatar.cs" /> | ||
42 | <include name="Simulator/Avatar.Update.cs" /> | ||
43 | <include name="Simulator/AvatarAnimations.cs" /> | ||
44 | <include name="Simulator/Primitive2.cs" /> | ||
45 | <include name="Simulator/Avatar.Client.cs" /> | ||
46 | <include name="Scripting/IScriptContext.cs" /> | ||
47 | <include name="Scripting/IScriptEntity.cs" /> | ||
48 | <include name="Scripting/Script.cs" /> | ||
49 | <include name="Scripting/ScriptFactory.cs" /> | ||
50 | <include name="Scripting/IScriptHandler.cs" /> | ||
51 | <include name="Scripting/Scripts/FollowRandomAvatar.cs" /> | ||
52 | <include name="Client/ClientViewBase.cs" /> | ||
53 | <include name="Client/ClientView.Grid.cs" /> | ||
54 | <include name="Client/ClientView.PacketHandlers.cs" /> | ||
55 | <include name="Client/ClientView.cs" /> | ||
56 | <include name="Client/ClientView.ProcessPackets.cs" /> | ||
56 | </sources> | 57 | </sources> |
57 | <references basedir="${project::get-base-directory()}"> | 58 | <references basedir="${project::get-base-directory()}"> |
58 | <lib> | 59 | <lib> |
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim/OpenSim.RegionServer/OpenSimMain.cs index 73050c3..4d20e72 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -38,13 +38,13 @@ using System.Collections; | |||
38 | using System.Collections.Generic; | 38 | using System.Collections.Generic; |
39 | using libsecondlife; | 39 | using libsecondlife; |
40 | using libsecondlife.Packets; | 40 | using libsecondlife.Packets; |
41 | using OpenSim.world; | 41 | using OpenSim.RegionServer.Simulator; |
42 | using OpenSim.Terrain; | 42 | using OpenSim.Terrain; |
43 | using OpenSim.Framework.Interfaces; | 43 | using OpenSim.Framework.Interfaces; |
44 | using OpenSim.Framework.Types; | 44 | using OpenSim.Framework.Types; |
45 | using OpenSim.UserServer; | 45 | using OpenSim.UserServer; |
46 | using OpenSim.Assets; | 46 | using OpenSim.RegionServer.Assets; |
47 | using OpenSim.CAPS; | 47 | using OpenSim.RegionServer.CAPS; |
48 | using OpenSim.Framework.Console; | 48 | using OpenSim.Framework.Console; |
49 | using OpenSim.Physics.Manager; | 49 | using OpenSim.Physics.Manager; |
50 | using Nwc.XmlRpc; | 50 | using Nwc.XmlRpc; |
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs index f577152..bc85cdb 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs +++ b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs | |||
@@ -33,7 +33,7 @@ using System.Net.Sockets; | |||
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | 35 | ||
36 | namespace OpenSim | 36 | namespace OpenSim.RegionServer |
37 | { | 37 | { |
38 | public interface OpenSimNetworkHandler | 38 | public interface OpenSimNetworkHandler |
39 | { | 39 | { |
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs index dd7c658..7267ae8 100644 --- a/OpenSim/OpenSim.RegionServer/PacketServer.cs +++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs | |||
@@ -28,10 +28,11 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.world; | 31 | using OpenSim.RegionServer.Simulator; |
32 | using OpenSim.RegionServer.Client; | ||
32 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
33 | 34 | ||
34 | namespace OpenSim | 35 | namespace OpenSim.RegionServer |
35 | { | 36 | { |
36 | public class PacketServer | 37 | public class PacketServer |
37 | { | 38 | { |
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs index d54a708..f14fd3f 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Framework.Interfaces; | |||
36 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
37 | using libsecondlife; | 37 | using libsecondlife; |
38 | 38 | ||
39 | namespace OpenSim | 39 | namespace OpenSim.RegionServer |
40 | { | 40 | { |
41 | public class RegionInfo : RegionInfoBase | 41 | public class RegionInfo : RegionInfoBase |
42 | { | 42 | { |
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs index d362e96..8622857 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs | |||
@@ -35,7 +35,7 @@ using OpenSim.Framework.Interfaces; | |||
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | using libsecondlife; | 36 | using libsecondlife; |
37 | 37 | ||
38 | namespace OpenSim | 38 | namespace OpenSim.RegionServer |
39 | { | 39 | { |
40 | public class RegionInfoBase | 40 | public class RegionInfoBase |
41 | { | 41 | { |
diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs index 01a072d..2d99bb3 100644 --- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs | |||
@@ -37,20 +37,20 @@ using System.Collections; | |||
37 | using System.Collections.Generic; | 37 | using System.Collections.Generic; |
38 | using libsecondlife; | 38 | using libsecondlife; |
39 | using libsecondlife.Packets; | 39 | using libsecondlife.Packets; |
40 | using OpenSim.world; | 40 | using OpenSim.RegionServer.Simulator; |
41 | using OpenSim.Terrain; | 41 | using OpenSim.Terrain; |
42 | using OpenSim.Framework.Interfaces; | 42 | using OpenSim.Framework.Interfaces; |
43 | using OpenSim.Framework.Types; | 43 | using OpenSim.Framework.Types; |
44 | using OpenSim.UserServer; | 44 | using OpenSim.UserServer; |
45 | using OpenSim.Assets; | 45 | using OpenSim.RegionServer.Assets; |
46 | using OpenSim.CAPS; | 46 | using OpenSim.RegionServer.CAPS; |
47 | using OpenSim.Framework.Console; | 47 | using OpenSim.Framework.Console; |
48 | using OpenSim.Physics.Manager; | 48 | using OpenSim.Physics.Manager; |
49 | using Nwc.XmlRpc; | 49 | using Nwc.XmlRpc; |
50 | using OpenSim.Servers; | 50 | using OpenSim.Servers; |
51 | using OpenSim.GenericConfig; | 51 | using OpenSim.GenericConfig; |
52 | 52 | ||
53 | namespace OpenSim | 53 | namespace OpenSim.RegionServer |
54 | { | 54 | { |
55 | public class RegionServerBase | 55 | public class RegionServerBase |
56 | { | 56 | { |
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index bc77aa0..6b3e7b1 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs | |||
@@ -37,19 +37,24 @@ using System.Collections; | |||
37 | using System.Collections.Generic; | 37 | using System.Collections.Generic; |
38 | using libsecondlife; | 38 | using libsecondlife; |
39 | using libsecondlife.Packets; | 39 | using libsecondlife.Packets; |
40 | using OpenSim.world; | ||
41 | using OpenSim.Terrain; | 40 | using OpenSim.Terrain; |
41 | |||
42 | using OpenSim.Framework.Interfaces; | 42 | using OpenSim.Framework.Interfaces; |
43 | using OpenSim.Framework.Types; | 43 | using OpenSim.Framework.Types; |
44 | using OpenSim.UserServer; | ||
45 | using OpenSim.Assets; | ||
46 | using OpenSim.CAPS; | ||
47 | using OpenSim.Framework.Console; | 44 | using OpenSim.Framework.Console; |
45 | |||
46 | using OpenSim.UserServer; | ||
47 | |||
48 | using OpenSim.RegionServer.Simulator; | ||
49 | using OpenSim.RegionServer.Assets; | ||
50 | using OpenSim.RegionServer.CAPS; | ||
51 | using OpenSim.RegionServer.Client; | ||
52 | |||
48 | using Nwc.XmlRpc; | 53 | using Nwc.XmlRpc; |
49 | using OpenSim.Servers; | 54 | using OpenSim.Servers; |
50 | using OpenSim.GenericConfig; | 55 | using OpenSim.GenericConfig; |
51 | 56 | ||
52 | namespace OpenSim | 57 | namespace OpenSim.RegionServer |
53 | { | 58 | { |
54 | public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode); | 59 | public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode); |
55 | 60 | ||
diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs index 9ab16d0..5e0eed6 100644 --- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/VersionInfo.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | 30 | ||
31 | namespace OpenSim | 31 | namespace OpenSim.RegionServer |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// </summary> | 34 | /// </summary> |
diff --git a/OpenSim/OpenSim.RegionServer/types/Mesh.cs b/OpenSim/OpenSim.RegionServer/types/Mesh.cs index 81b4a47..4c8acab 100644 --- a/OpenSim/OpenSim.RegionServer/types/Mesh.cs +++ b/OpenSim/OpenSim.RegionServer/types/Mesh.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.types | 32 | namespace OpenSim.RegionServer.Types |
33 | { | 33 | { |
34 | // TODO: This will need some performance tuning no doubt. | 34 | // TODO: This will need some performance tuning no doubt. |
35 | public class Mesh | 35 | public class Mesh |
diff --git a/OpenSim/OpenSim.RegionServer/types/Triangle.cs b/OpenSim/OpenSim.RegionServer/types/Triangle.cs index 6e63433..ffb62e5 100644 --- a/OpenSim/OpenSim.RegionServer/types/Triangle.cs +++ b/OpenSim/OpenSim.RegionServer/types/Triangle.cs | |||
@@ -30,7 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Text; | 30 | using System.Text; |
31 | using Axiom.MathLib; | 31 | using Axiom.MathLib; |
32 | 32 | ||
33 | namespace OpenSim.types | 33 | namespace OpenSim.RegionServer.Types |
34 | { | 34 | { |
35 | public class Triangle | 35 | public class Triangle |
36 | { | 36 | { |
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs deleted file mode 100644 index b1c2ff7..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife.Packets; | ||
32 | |||
33 | namespace OpenSim.world | ||
34 | { | ||
35 | partial class Avatar | ||
36 | { | ||
37 | private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> updateList = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | ||
38 | private List<Entity> interestList = new List<Entity>(); | ||
39 | |||
40 | public void SendPacketToViewer(Packet packet) | ||
41 | { | ||
42 | this.ControllingClient.OutPacket(packet); | ||
43 | } | ||
44 | |||
45 | public void AddTerseUpdateToViewersList(ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock) | ||
46 | { | ||
47 | |||
48 | } | ||
49 | |||
50 | public void SendUpdateListToViewer() | ||
51 | { | ||
52 | |||
53 | } | ||
54 | |||
55 | private void UpdateInterestList() | ||
56 | { | ||
57 | |||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs deleted file mode 100644 index 7712905..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs +++ /dev/null | |||
@@ -1,370 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | |||
34 | namespace OpenSim.world | ||
35 | { | ||
36 | partial class Avatar | ||
37 | { | ||
38 | public override void update() | ||
39 | { | ||
40 | if (!this.childAvatar) | ||
41 | { | ||
42 | if (this._physActor == null) | ||
43 | { | ||
44 | //HACKHACK: Note to work out why this entity does not have a physics actor | ||
45 | // and prehaps create one. | ||
46 | return; | ||
47 | } | ||
48 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | ||
49 | if (this.updateflag) | ||
50 | { | ||
51 | //need to send movement info | ||
52 | //so create the improvedterseobjectupdate packet | ||
53 | //use CreateTerseBlock() | ||
54 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
55 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
56 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
57 | terse.RegionData.TimeDilation = 64096; | ||
58 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
59 | terse.ObjectData[0] = terseBlock; | ||
60 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
61 | foreach (Avatar client in avList) | ||
62 | { | ||
63 | client.SendPacketToViewer(terse); | ||
64 | } | ||
65 | |||
66 | updateflag = false; | ||
67 | //this._updateCount = 0; | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | |||
72 | if ((pos2 != this.positionLastFrame) || (this.movementflag == 16)) | ||
73 | { | ||
74 | _updateCount++; | ||
75 | if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) | ||
76 | { | ||
77 | //It has been a while since last update was sent so lets send one. | ||
78 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
79 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
80 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
81 | terse.RegionData.TimeDilation = 64096; | ||
82 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
83 | terse.ObjectData[0] = terseBlock; | ||
84 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
85 | foreach (Avatar client in avList) | ||
86 | { | ||
87 | client.SendPacketToViewer(terse); | ||
88 | } | ||
89 | _updateCount = 0; | ||
90 | } | ||
91 | |||
92 | if (this.movementflag == 16) | ||
93 | { | ||
94 | movementflag = 0; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | } | ||
99 | |||
100 | if (positionFrameBeforeLast != pos2) | ||
101 | { | ||
102 | this.positionFrameBeforeLast = this.positionLastFrame; | ||
103 | this.positionLastFrame = pos2; | ||
104 | int tempRoundedX = (int)Math.Round(positionLastFrame.X); | ||
105 | int tempRoundedY = (int)Math.Round(positionLastFrame.Y); | ||
106 | if (this.positionRoundedX != tempRoundedX || this.positionRoundedY != tempRoundedY) | ||
107 | { | ||
108 | |||
109 | this.positionRoundedX = tempRoundedX; | ||
110 | this.positionRoundedY = tempRoundedY; | ||
111 | int currentParcelLocalID = m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).parcelData.localID; | ||
112 | if(currentParcelLocalID != this.positionParcelHoverLocalID) | ||
113 | { | ||
114 | |||
115 | Console.WriteLine("NEW PARCEL: " + m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).parcelData.parcelName); | ||
116 | m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).sendParcelProperties(this.parcelUpdateSequenceIncrement, false, 0,this.ControllingClient); | ||
117 | this.positionParcelHoverLocalID = currentParcelLocalID; | ||
118 | this.parcelUpdateSequenceIncrement++; | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | |||
123 | if (!this.ControllingClient.m_sandboxMode) | ||
124 | { | ||
125 | if (pos2.X < 0) | ||
126 | { | ||
127 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
128 | } | ||
129 | |||
130 | if (pos2.Y < 0) | ||
131 | { | ||
132 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
133 | } | ||
134 | |||
135 | if (pos2.X > 255) | ||
136 | { | ||
137 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
138 | } | ||
139 | |||
140 | if (pos2.Y > 255) | ||
141 | { | ||
142 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
143 | } | ||
144 | } | ||
145 | } | ||
146 | |||
147 | } | ||
148 | |||
149 | public void SendUpdateToOtherClient(Avatar remoteAvatar) | ||
150 | { | ||
151 | ObjectUpdatePacket objupdate = CreateUpdatePacket(); | ||
152 | remoteAvatar.SendPacketToViewer(objupdate); | ||
153 | } | ||
154 | |||
155 | public ObjectUpdatePacket CreateUpdatePacket() | ||
156 | { | ||
157 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
158 | //send a objectupdate packet with information about the clients avatar | ||
159 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
160 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
161 | objupdate.RegionData.TimeDilation = 64096; | ||
162 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
163 | |||
164 | objupdate.ObjectData[0] = AvatarTemplate; | ||
165 | //give this avatar object a local id and assign the user a name | ||
166 | objupdate.ObjectData[0].ID = this.localid; | ||
167 | objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
168 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
169 | |||
170 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z); | ||
171 | |||
172 | byte[] pb = pos2.GetBytes(); | ||
173 | |||
174 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
175 | return objupdate; | ||
176 | } | ||
177 | |||
178 | public void SendInitialPosition() | ||
179 | { | ||
180 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
181 | //send a objectupdate packet with information about the clients avatar | ||
182 | |||
183 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
184 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
185 | objupdate.RegionData.TimeDilation = 64096; | ||
186 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
187 | objupdate.ObjectData[0] = AvatarTemplate; | ||
188 | //give this avatar object a local id and assign the user a name | ||
189 | |||
190 | objupdate.ObjectData[0].ID = this.localid; | ||
191 | this.uuid = objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
192 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
193 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this.Pos.X, (float)this.Pos.Y, (float)this.Pos.Z); | ||
194 | byte[] pb = pos2.GetBytes(); | ||
195 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
196 | m_world._localNumber++; | ||
197 | |||
198 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
199 | foreach (Avatar client in avList) | ||
200 | { | ||
201 | client.SendPacketToViewer(objupdate); | ||
202 | if (client.ControllingClient.AgentID != this.ControllingClient.AgentID) | ||
203 | { | ||
204 | SendAppearanceToOtherAgent(client); | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | |||
209 | public void SendOurAppearance() | ||
210 | { | ||
211 | ControllingClient.SendAppearance(this.Wearables); | ||
212 | } | ||
213 | |||
214 | public void SendOurAppearance(ClientView OurClient) | ||
215 | { | ||
216 | //event handler for wearables request | ||
217 | this.SendOurAppearance(); | ||
218 | } | ||
219 | |||
220 | public void SendAppearanceToOtherAgent(Avatar avatarInfo) | ||
221 | { | ||
222 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
223 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
224 | avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); | ||
225 | |||
226 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
227 | for (int i = 0; i < 218; i++) | ||
228 | { | ||
229 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
230 | avblock.ParamValue = visualParams[i]; | ||
231 | avp.VisualParam[i] = avblock; | ||
232 | } | ||
233 | |||
234 | avp.Sender.IsTrial = false; | ||
235 | avp.Sender.ID = ControllingClient.AgentID; | ||
236 | avatarInfo.SendPacketToViewer(avp); | ||
237 | } | ||
238 | |||
239 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) | ||
240 | { | ||
241 | LLObject.TextureEntry tex = new LLObject.TextureEntry(texture, 0, texture.Length); | ||
242 | this.avatarAppearanceTexture = tex; | ||
243 | |||
244 | for (int i = 0; i < visualParam.Length; i++) | ||
245 | { | ||
246 | this.visualParams[i] = visualParam[i].ParamValue; | ||
247 | } | ||
248 | |||
249 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
250 | foreach (Avatar client in avList) | ||
251 | { | ||
252 | if (client.ControllingClient.AgentID != this.ControllingClient.AgentID) | ||
253 | { | ||
254 | SendAppearanceToOtherAgent(client); | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | |||
259 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() | ||
260 | { | ||
261 | byte[] bytes = new byte[60]; | ||
262 | int i = 0; | ||
263 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
264 | |||
265 | dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; | ||
266 | libsecondlife.LLVector3 pos2 = new LLVector3(0, 0, 0); | ||
267 | lock (m_world.LockPhysicsEngine) | ||
268 | { | ||
269 | pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | ||
270 | } | ||
271 | |||
272 | uint ID = this.localid; | ||
273 | |||
274 | bytes[i++] = (byte)(ID % 256); | ||
275 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
276 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
277 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
278 | bytes[i++] = 0; | ||
279 | bytes[i++] = 1; | ||
280 | i += 14; | ||
281 | bytes[i++] = 128; | ||
282 | bytes[i++] = 63; | ||
283 | |||
284 | byte[] pb = pos2.GetBytes(); | ||
285 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
286 | i += 12; | ||
287 | ushort InternVelocityX; | ||
288 | ushort InternVelocityY; | ||
289 | ushort InternVelocityZ; | ||
290 | Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); | ||
291 | lock (m_world.LockPhysicsEngine) | ||
292 | { | ||
293 | internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); | ||
294 | } | ||
295 | internDirec = internDirec / 128.0f; | ||
296 | internDirec.x += 1; | ||
297 | internDirec.y += 1; | ||
298 | internDirec.z += 1; | ||
299 | |||
300 | InternVelocityX = (ushort)(32768 * internDirec.x); | ||
301 | InternVelocityY = (ushort)(32768 * internDirec.y); | ||
302 | InternVelocityZ = (ushort)(32768 * internDirec.z); | ||
303 | |||
304 | ushort ac = 32767; | ||
305 | bytes[i++] = (byte)(InternVelocityX % 256); | ||
306 | bytes[i++] = (byte)((InternVelocityX >> 8) % 256); | ||
307 | bytes[i++] = (byte)(InternVelocityY % 256); | ||
308 | bytes[i++] = (byte)((InternVelocityY >> 8) % 256); | ||
309 | bytes[i++] = (byte)(InternVelocityZ % 256); | ||
310 | bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); | ||
311 | |||
312 | //accel | ||
313 | bytes[i++] = (byte)(ac % 256); | ||
314 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
315 | bytes[i++] = (byte)(ac % 256); | ||
316 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
317 | bytes[i++] = (byte)(ac % 256); | ||
318 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
319 | |||
320 | //rot | ||
321 | bytes[i++] = (byte)(ac % 256); | ||
322 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
323 | bytes[i++] = (byte)(ac % 256); | ||
324 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
325 | bytes[i++] = (byte)(ac % 256); | ||
326 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
327 | bytes[i++] = (byte)(ac % 256); | ||
328 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
329 | |||
330 | //rotation vel | ||
331 | bytes[i++] = (byte)(ac % 256); | ||
332 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
333 | bytes[i++] = (byte)(ac % 256); | ||
334 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
335 | bytes[i++] = (byte)(ac % 256); | ||
336 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
337 | |||
338 | dat.Data = bytes; | ||
339 | return (dat); | ||
340 | } | ||
341 | |||
342 | // Sends animation update | ||
343 | public void SendAnimPack(LLUUID animID, int seq) | ||
344 | { | ||
345 | AvatarAnimationPacket ani = new AvatarAnimationPacket(); | ||
346 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; | ||
347 | ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); | ||
348 | ani.AnimationSourceList[0].ObjectID = ControllingClient.AgentID; | ||
349 | ani.Sender = new AvatarAnimationPacket.SenderBlock(); | ||
350 | ani.Sender.ID = ControllingClient.AgentID; | ||
351 | ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; | ||
352 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); | ||
353 | ani.AnimationList[0].AnimID = this.current_anim = animID; | ||
354 | ani.AnimationList[0].AnimSequenceID = this.anim_seq = seq; | ||
355 | |||
356 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
357 | foreach (Avatar client in avList) | ||
358 | { | ||
359 | client.SendPacketToViewer(ani); | ||
360 | } | ||
361 | |||
362 | } | ||
363 | |||
364 | public void SendAnimPack() | ||
365 | { | ||
366 | this.SendAnimPack(this.current_anim, this.anim_seq); | ||
367 | } | ||
368 | |||
369 | } | ||
370 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.cs deleted file mode 100644 index 30999fc..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.cs +++ /dev/null | |||
@@ -1,482 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Physics.Manager; | ||
35 | using OpenSim.Framework.Inventory; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using Axiom.MathLib; | ||
38 | |||
39 | namespace OpenSim.world | ||
40 | { | ||
41 | public partial class Avatar : Entity | ||
42 | { | ||
43 | public static bool PhysicsEngineFlying = false; | ||
44 | public static AvatarAnimations Animations; | ||
45 | public string firstname; | ||
46 | public string lastname; | ||
47 | public ClientView ControllingClient; | ||
48 | public LLUUID current_anim; | ||
49 | public int anim_seq; | ||
50 | private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | ||
51 | private bool updateflag = false; | ||
52 | private byte movementflag = 0; | ||
53 | private List<NewForce> forcesList = new List<NewForce>(); | ||
54 | private short _updateCount = 0; | ||
55 | private Axiom.MathLib.Quaternion bodyRot; | ||
56 | private LLObject.TextureEntry avatarAppearanceTexture = null; | ||
57 | private byte[] visualParams; | ||
58 | private AvatarWearable[] Wearables; | ||
59 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | ||
60 | private LLVector3 positionFrameBeforeLast = new LLVector3(0, 0, 0); | ||
61 | |||
62 | private int positionRoundedX = 0; | ||
63 | private int positionRoundedY = 0; | ||
64 | |||
65 | private int positionParcelHoverLocalID = -1; //Local ID of the last parcel they were over | ||
66 | private int parcelUpdateSequenceIncrement = 1; | ||
67 | private ulong m_regionHandle; | ||
68 | //private Dictionary<uint, ClientView> m_clientThreads; | ||
69 | private string m_regionName; | ||
70 | private ushort m_regionWaterHeight; | ||
71 | private bool m_regionTerraform; | ||
72 | private bool childAvatar = false; | ||
73 | |||
74 | public Avatar(ClientView TheClient, World world, string regionName, Dictionary<uint, ClientView> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) | ||
75 | { | ||
76 | m_world = world; | ||
77 | // m_clientThreads = clientThreads; | ||
78 | m_regionName = regionName; | ||
79 | m_regionHandle = regionHandle; | ||
80 | m_regionTerraform = regionTerraform; | ||
81 | m_regionWaterHeight = regionWater; | ||
82 | |||
83 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs - Loading details from grid (DUMMY)"); | ||
84 | ControllingClient = TheClient; | ||
85 | localid = 8880000 + (this.m_world._localNumber++); | ||
86 | Pos = ControllingClient.startpos; | ||
87 | visualParams = new byte[218]; | ||
88 | for (int i = 0; i < 218; i++) | ||
89 | { | ||
90 | visualParams[i] = 100; | ||
91 | } | ||
92 | Wearables = new AvatarWearable[13]; //should be 13 of these | ||
93 | for (int i = 0; i < 13; i++) | ||
94 | { | ||
95 | Wearables[i] = new AvatarWearable(); | ||
96 | } | ||
97 | this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
98 | this.Wearables[0].ItemID = LLUUID.Random(); | ||
99 | |||
100 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
101 | |||
102 | //register for events | ||
103 | ControllingClient.OnRequestWearables += new ClientView.GenericCall(this.SendOurAppearance); | ||
104 | ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); | ||
105 | ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.CompleteMovement); | ||
106 | ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); | ||
107 | ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); | ||
108 | ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); | ||
109 | ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange); | ||
110 | |||
111 | } | ||
112 | |||
113 | public PhysicsActor PhysActor | ||
114 | { | ||
115 | set | ||
116 | { | ||
117 | this._physActor = value; | ||
118 | } | ||
119 | get | ||
120 | { | ||
121 | return _physActor; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public void ChildStatusChange(bool status) | ||
126 | { | ||
127 | this.childAvatar = status; | ||
128 | |||
129 | if (this.childAvatar == true) | ||
130 | { | ||
131 | this._physActor.Velocity = new PhysicsVector(0, 0, 0); | ||
132 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
133 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
134 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
135 | terse.RegionData.TimeDilation = 64096; | ||
136 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
137 | terse.ObjectData[0] = terseBlock; | ||
138 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
139 | foreach (Avatar client in avList) | ||
140 | { | ||
141 | client.SendPacketToViewer(terse); | ||
142 | } | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | LLVector3 startp = ControllingClient.StartPos; | ||
147 | lock (m_world.LockPhysicsEngine) | ||
148 | { | ||
149 | this._physActor.Position = new PhysicsVector(startp.X, startp.Y, startp.Z); | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | |||
154 | public override void addForces() | ||
155 | { | ||
156 | lock (this.forcesList) | ||
157 | { | ||
158 | if (this.forcesList.Count > 0) | ||
159 | { | ||
160 | for (int i = 0; i < this.forcesList.Count; i++) | ||
161 | { | ||
162 | NewForce force = this.forcesList[i]; | ||
163 | PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); | ||
164 | lock (m_world.LockPhysicsEngine) | ||
165 | { | ||
166 | this._physActor.Velocity = phyVector; | ||
167 | } | ||
168 | this.updateflag = true; | ||
169 | this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this | ||
170 | // but as we are setting the velocity (rather than using real forces) at the moment it is okay. | ||
171 | } | ||
172 | for (int i = 0; i < this.forcesList.Count; i++) | ||
173 | { | ||
174 | this.forcesList.RemoveAt(0); | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | public static void SetupTemplate(string name) | ||
181 | { | ||
182 | FileInfo fInfo = new FileInfo(name); | ||
183 | long numBytes = fInfo.Length; | ||
184 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
185 | BinaryReader br = new BinaryReader(fStream); | ||
186 | byte[] data1 = br.ReadBytes((int)numBytes); | ||
187 | br.Close(); | ||
188 | fStream.Close(); | ||
189 | |||
190 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
191 | |||
192 | SetDefaultPacketValues(objdata); | ||
193 | objdata.TextureEntry = data1; | ||
194 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | ||
195 | objdata.PathCurve = 16; | ||
196 | objdata.ProfileCurve = 1; | ||
197 | objdata.PathScaleX = 100; | ||
198 | objdata.PathScaleY = 100; | ||
199 | objdata.ParentID = 0; | ||
200 | objdata.OwnerID = LLUUID.Zero; | ||
201 | objdata.Scale = new LLVector3(1, 1, 1); | ||
202 | objdata.PCode = 47; | ||
203 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
204 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); | ||
205 | pos.X = 100f; | ||
206 | objdata.ID = 8880000; | ||
207 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | ||
208 | libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f); | ||
209 | //objdata.FullID=user.AgentID; | ||
210 | byte[] pb = pos.GetBytes(); | ||
211 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
212 | |||
213 | Avatar.AvatarTemplate = objdata; | ||
214 | } | ||
215 | |||
216 | protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) | ||
217 | { | ||
218 | objdata.PSBlock = new byte[0]; | ||
219 | objdata.ExtraParams = new byte[1]; | ||
220 | objdata.MediaURL = new byte[0]; | ||
221 | objdata.NameValue = new byte[0]; | ||
222 | objdata.Text = new byte[0]; | ||
223 | objdata.TextColor = new byte[4]; | ||
224 | objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
225 | objdata.JointPivot = new LLVector3(0, 0, 0); | ||
226 | objdata.Material = 4; | ||
227 | objdata.TextureAnim = new byte[0]; | ||
228 | objdata.Sound = LLUUID.Zero; | ||
229 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
230 | objdata.TextureEntry = ntex.ToBytes(); | ||
231 | objdata.State = 0; | ||
232 | objdata.Data = new byte[0]; | ||
233 | |||
234 | objdata.ObjectData = new byte[76]; | ||
235 | objdata.ObjectData[15] = 128; | ||
236 | objdata.ObjectData[16] = 63; | ||
237 | objdata.ObjectData[56] = 128; | ||
238 | objdata.ObjectData[61] = 102; | ||
239 | objdata.ObjectData[62] = 40; | ||
240 | objdata.ObjectData[63] = 61; | ||
241 | objdata.ObjectData[64] = 189; | ||
242 | |||
243 | |||
244 | } | ||
245 | |||
246 | public void CompleteMovement() | ||
247 | { | ||
248 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); | ||
249 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | ||
250 | mov.AgentData.SessionID = this.ControllingClient.SessionID; | ||
251 | mov.AgentData.AgentID = this.ControllingClient.AgentID; | ||
252 | mov.Data.RegionHandle = this.m_regionHandle; | ||
253 | // TODO - dynamicalise this stuff | ||
254 | mov.Data.Timestamp = 1172750370; | ||
255 | mov.Data.Position = this.ControllingClient.startpos; | ||
256 | mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); | ||
257 | |||
258 | ControllingClient.OutPacket(mov); | ||
259 | } | ||
260 | |||
261 | public void HandleAgentUpdate(Packet pack) | ||
262 | { | ||
263 | this.HandleUpdate((AgentUpdatePacket)pack); | ||
264 | } | ||
265 | |||
266 | public void HandleUpdate(AgentUpdatePacket pack) | ||
267 | { | ||
268 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0) | ||
269 | { | ||
270 | if (this._physActor.Flying == false) | ||
271 | { | ||
272 | this.current_anim = Animations.AnimsLLUUID["FLY"]; | ||
273 | this.anim_seq = 1; | ||
274 | this.SendAnimPack(); | ||
275 | } | ||
276 | this._physActor.Flying = true; | ||
277 | |||
278 | } | ||
279 | else | ||
280 | { | ||
281 | if (this._physActor.Flying == true) | ||
282 | { | ||
283 | this.current_anim = Animations.AnimsLLUUID["STAND"]; | ||
284 | this.anim_seq = 1; | ||
285 | this.SendAnimPack(); | ||
286 | } | ||
287 | this._physActor.Flying = false; | ||
288 | } | ||
289 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) | ||
290 | { | ||
291 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
292 | if (((movementflag & 1) == 0) || (q != this.bodyRot)) | ||
293 | { | ||
294 | |||
295 | if (((movementflag & 1) == 0) && (!this._physActor.Flying)) | ||
296 | { | ||
297 | this.current_anim = Animations.AnimsLLUUID["WALK"]; | ||
298 | this.anim_seq = 1; | ||
299 | this.SendAnimPack(); | ||
300 | } | ||
301 | |||
302 | |||
303 | //we should add a new force to the list | ||
304 | // but for now we will deal with velocities | ||
305 | NewForce newVelocity = new NewForce(); | ||
306 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); | ||
307 | Axiom.MathLib.Vector3 direc = q * v3; | ||
308 | direc.Normalize(); | ||
309 | |||
310 | //work out velocity for sim physics system | ||
311 | direc = direc * ((0.03f) * 128f); | ||
312 | if (this._physActor.Flying) | ||
313 | direc *= 4; | ||
314 | |||
315 | newVelocity.X = direc.x; | ||
316 | newVelocity.Y = direc.y; | ||
317 | newVelocity.Z = direc.z; | ||
318 | this.forcesList.Add(newVelocity); | ||
319 | movementflag = 1; | ||
320 | this.bodyRot = q; | ||
321 | } | ||
322 | } | ||
323 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying)) | ||
324 | { | ||
325 | if (((movementflag & 2) == 0) && this._physActor.Flying) | ||
326 | { | ||
327 | //we should add a new force to the list | ||
328 | // but for now we will deal with velocities | ||
329 | NewForce newVelocity = new NewForce(); | ||
330 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1); | ||
331 | Axiom.MathLib.Vector3 direc = v3; | ||
332 | direc.Normalize(); | ||
333 | |||
334 | //work out velocity for sim physics system | ||
335 | direc = direc * ((0.03f) * 128f * 2); | ||
336 | newVelocity.X = direc.x; | ||
337 | newVelocity.Y = direc.y; | ||
338 | newVelocity.Z = direc.z; | ||
339 | this.forcesList.Add(newVelocity); | ||
340 | movementflag = 2; | ||
341 | } | ||
342 | } | ||
343 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying)) | ||
344 | { | ||
345 | if (((movementflag & 4) == 0) && this._physActor.Flying) | ||
346 | { | ||
347 | //we should add a new force to the list | ||
348 | // but for now we will deal with velocities | ||
349 | NewForce newVelocity = new NewForce(); | ||
350 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1); | ||
351 | //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
352 | Axiom.MathLib.Vector3 direc = v3; | ||
353 | direc.Normalize(); | ||
354 | |||
355 | //work out velocity for sim physics system | ||
356 | direc = direc * ((0.03f) * 128f * 2); | ||
357 | newVelocity.X = direc.x; | ||
358 | newVelocity.Y = direc.y; | ||
359 | newVelocity.Z = direc.z; | ||
360 | this.forcesList.Add(newVelocity); | ||
361 | movementflag = 4; | ||
362 | } | ||
363 | } | ||
364 | else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) | ||
365 | { | ||
366 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
367 | if (((movementflag & 8) == 0) || (q != this.bodyRot)) | ||
368 | { | ||
369 | //we should add a new force to the list | ||
370 | // but for now we will deal with velocities | ||
371 | NewForce newVelocity = new NewForce(); | ||
372 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); | ||
373 | Axiom.MathLib.Vector3 direc = q * v3; | ||
374 | direc.Normalize(); | ||
375 | |||
376 | //work out velocity for sim physics system | ||
377 | direc = direc * ((0.03f) * 128f); | ||
378 | if (this._physActor.Flying) | ||
379 | direc *= 2; | ||
380 | |||
381 | newVelocity.X = direc.x; | ||
382 | newVelocity.Y = direc.y; | ||
383 | newVelocity.Z = direc.z; | ||
384 | this.forcesList.Add(newVelocity); | ||
385 | movementflag = 8; | ||
386 | this.bodyRot = q; | ||
387 | } | ||
388 | } | ||
389 | else | ||
390 | { | ||
391 | if (movementflag == 16) | ||
392 | { | ||
393 | movementflag = 0; | ||
394 | } | ||
395 | if ((movementflag) != 0) | ||
396 | { | ||
397 | NewForce newVelocity = new NewForce(); | ||
398 | newVelocity.X = 0; | ||
399 | newVelocity.Y = 0; | ||
400 | newVelocity.Z = 0; | ||
401 | this.forcesList.Add(newVelocity); | ||
402 | movementflag = 0; | ||
403 | // We're standing still, so make it show! | ||
404 | if (this._physActor.Flying == false) | ||
405 | { | ||
406 | this.current_anim = Animations.AnimsLLUUID["STAND"]; | ||
407 | this.anim_seq = 1; | ||
408 | this.SendAnimPack(); | ||
409 | } | ||
410 | this.movementflag = 16; | ||
411 | |||
412 | } | ||
413 | } | ||
414 | } | ||
415 | |||
416 | //really really should be moved somewhere else (RegionInfo.cs ?) | ||
417 | public void SendRegionHandshake(World regionInfo) | ||
418 | { | ||
419 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); | ||
420 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
421 | RegionHandshakePacket handshake = new RegionHandshakePacket(); | ||
422 | |||
423 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); | ||
424 | handshake.RegionInfo.BillableFactor = 0; | ||
425 | handshake.RegionInfo.IsEstateManager = false; | ||
426 | handshake.RegionInfo.TerrainHeightRange00 = regionInfo.m_regInfo.TerrainHeightRange00; | ||
427 | handshake.RegionInfo.TerrainHeightRange01 = regionInfo.m_regInfo.TerrainHeightRange01; | ||
428 | handshake.RegionInfo.TerrainHeightRange10 = regionInfo.m_regInfo.TerrainHeightRange10; | ||
429 | handshake.RegionInfo.TerrainHeightRange11 = regionInfo.m_regInfo.TerrainHeightRange11; | ||
430 | handshake.RegionInfo.TerrainStartHeight00 = regionInfo.m_regInfo.TerrainStartHeight00; | ||
431 | handshake.RegionInfo.TerrainStartHeight01 = regionInfo.m_regInfo.TerrainStartHeight01; | ||
432 | handshake.RegionInfo.TerrainStartHeight10 = regionInfo.m_regInfo.TerrainStartHeight10; | ||
433 | handshake.RegionInfo.TerrainStartHeight11 = regionInfo.m_regInfo.TerrainStartHeight11; | ||
434 | handshake.RegionInfo.SimAccess = 13; | ||
435 | handshake.RegionInfo.WaterHeight = m_regionWaterHeight; | ||
436 | uint regionFlags = 72458694; | ||
437 | if (this.m_regionTerraform) | ||
438 | { | ||
439 | regionFlags -= 64; | ||
440 | } | ||
441 | handshake.RegionInfo.RegionFlags = regionFlags; | ||
442 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); | ||
443 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
444 | handshake.RegionInfo.TerrainBase0 = regionInfo.m_regInfo.TerrainBase0; | ||
445 | handshake.RegionInfo.TerrainBase1 = regionInfo.m_regInfo.TerrainBase1; | ||
446 | handshake.RegionInfo.TerrainBase2 = regionInfo.m_regInfo.TerrainBase2; | ||
447 | handshake.RegionInfo.TerrainBase3 = regionInfo.m_regInfo.TerrainBase3; | ||
448 | handshake.RegionInfo.TerrainDetail0 = regionInfo.m_regInfo.TerrainDetail0; | ||
449 | handshake.RegionInfo.TerrainDetail1 = regionInfo.m_regInfo.TerrainDetail1; | ||
450 | handshake.RegionInfo.TerrainDetail2 = regionInfo.m_regInfo.TerrainDetail2; | ||
451 | handshake.RegionInfo.TerrainDetail3 = regionInfo.m_regInfo.TerrainDetail3; | ||
452 | handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); | ||
453 | |||
454 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); | ||
455 | this.ControllingClient.OutPacket(handshake); | ||
456 | } | ||
457 | |||
458 | public static void LoadAnims() | ||
459 | { | ||
460 | Avatar.Animations = new AvatarAnimations(); | ||
461 | Avatar.Animations.LoadAnims(); | ||
462 | } | ||
463 | |||
464 | public override void LandRenegerated() | ||
465 | { | ||
466 | Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain[(int)Pos.X, (int)Pos.Y] + 50.0f); | ||
467 | } | ||
468 | } | ||
469 | |||
470 | public class NewForce | ||
471 | { | ||
472 | public float X; | ||
473 | public float Y; | ||
474 | public float Z; | ||
475 | |||
476 | public NewForce() | ||
477 | { | ||
478 | |||
479 | } | ||
480 | } | ||
481 | |||
482 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs b/OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs deleted file mode 100644 index 5870928..0000000 --- a/OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using System.Xml; | ||
33 | |||
34 | namespace OpenSim.world | ||
35 | { | ||
36 | public class AvatarAnimations | ||
37 | { | ||
38 | |||
39 | public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); | ||
40 | public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); | ||
41 | |||
42 | public AvatarAnimations() | ||
43 | { | ||
44 | } | ||
45 | |||
46 | public void LoadAnims() | ||
47 | { | ||
48 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); | ||
49 | XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); | ||
50 | |||
51 | XmlDocument doc = new XmlDocument(); | ||
52 | doc.Load(reader); | ||
53 | foreach (XmlNode nod in doc.DocumentElement.ChildNodes) | ||
54 | { | ||
55 | |||
56 | if ( nod.Attributes["name"] != null) | ||
57 | { | ||
58 | AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); | ||
59 | } | ||
60 | |||
61 | } | ||
62 | |||
63 | reader.Close(); | ||
64 | |||
65 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); | ||
66 | |||
67 | foreach (KeyValuePair<string, LLUUID> kp in OpenSim.world.Avatar.Animations.AnimsLLUUID) | ||
68 | { | ||
69 | AnimsNames.Add(kp.Value, kp.Key); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/Entity.cs b/OpenSim/OpenSim.RegionServer/world/Entity.cs deleted file mode 100644 index 5c653c7..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Entity.cs +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Axiom.MathLib; | ||
32 | using OpenSim.Physics.Manager; | ||
33 | using OpenSim.types; | ||
34 | using libsecondlife; | ||
35 | using OpenSim.RegionServer.world.scripting; | ||
36 | |||
37 | namespace OpenSim.world | ||
38 | { | ||
39 | public abstract class Entity : IScriptReadonlyEntity | ||
40 | { | ||
41 | public libsecondlife.LLUUID uuid; | ||
42 | public uint localid; | ||
43 | public LLVector3 velocity; | ||
44 | public Quaternion rotation; | ||
45 | protected List<Entity> children; | ||
46 | |||
47 | protected string m_name; | ||
48 | public virtual string Name | ||
49 | { | ||
50 | get { return m_name; } | ||
51 | } | ||
52 | |||
53 | protected LLVector3 m_pos; | ||
54 | protected PhysicsActor _physActor; | ||
55 | protected World m_world; | ||
56 | |||
57 | public virtual LLVector3 Pos | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | if (this._physActor != null) | ||
62 | { | ||
63 | m_pos.X = _physActor.Position.X; | ||
64 | m_pos.Y = _physActor.Position.Y; | ||
65 | m_pos.Z = _physActor.Position.Z; | ||
66 | } | ||
67 | |||
68 | return m_pos; | ||
69 | } | ||
70 | set | ||
71 | { | ||
72 | if (this._physActor != null) | ||
73 | { | ||
74 | try | ||
75 | { | ||
76 | lock (this.m_world.LockPhysicsEngine) | ||
77 | { | ||
78 | |||
79 | this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | ||
80 | } | ||
81 | } | ||
82 | catch (Exception e) | ||
83 | { | ||
84 | Console.WriteLine(e.Message); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | m_pos = value; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /// <summary> | ||
93 | /// Creates a new Entity (should not occur on it's own) | ||
94 | /// </summary> | ||
95 | public Entity() | ||
96 | { | ||
97 | uuid = new libsecondlife.LLUUID(); | ||
98 | localid = 0; | ||
99 | m_pos = new LLVector3(); | ||
100 | velocity = new LLVector3(); | ||
101 | rotation = new Quaternion(); | ||
102 | m_name = "(basic entity)"; | ||
103 | children = new List<Entity>(); | ||
104 | } | ||
105 | |||
106 | public virtual void addForces() | ||
107 | { | ||
108 | foreach (Entity child in children) | ||
109 | { | ||
110 | child.addForces(); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | /// <summary> | ||
115 | /// Performs any updates that need to be done at each frame. This function is overridable from it's children. | ||
116 | /// </summary> | ||
117 | public virtual void update() { | ||
118 | // Do any per-frame updates needed that are applicable to every type of entity | ||
119 | foreach (Entity child in children) | ||
120 | { | ||
121 | child.update(); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | /// <summary> | ||
126 | /// Returns a mesh for this object and any dependents | ||
127 | /// </summary> | ||
128 | /// <returns>The mesh of this entity tree</returns> | ||
129 | public virtual Mesh getMesh() | ||
130 | { | ||
131 | Mesh mesh = new Mesh(); | ||
132 | |||
133 | foreach (Entity child in children) | ||
134 | { | ||
135 | mesh += child.getMesh(); | ||
136 | } | ||
137 | |||
138 | return mesh; | ||
139 | } | ||
140 | |||
141 | public virtual void BackUp() | ||
142 | { | ||
143 | |||
144 | } | ||
145 | |||
146 | public virtual void LandRenegerated() | ||
147 | { | ||
148 | |||
149 | } | ||
150 | } | ||
151 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs deleted file mode 100644 index fe977bc..0000000 --- a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs +++ /dev/null | |||
@@ -1,831 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.world; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | |||
37 | namespace OpenSim.RegionServer.world | ||
38 | { | ||
39 | public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client); | ||
40 | public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client); | ||
41 | public delegate void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client); | ||
42 | public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, ClientView remote_client); | ||
43 | |||
44 | #region ParcelManager Class | ||
45 | /// <summary> | ||
46 | /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) | ||
47 | /// </summary> | ||
48 | public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver | ||
49 | { | ||
50 | |||
51 | #region Constants | ||
52 | //Parcel types set with flags in ParcelOverlay. | ||
53 | //Only one of these can be used. | ||
54 | public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 | ||
55 | public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 | ||
56 | public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 | ||
57 | public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 | ||
58 | public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 | ||
59 | public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 | ||
60 | |||
61 | |||
62 | //Flags that when set, a border on the given side will be placed | ||
63 | //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) | ||
64 | //This took forever to figure out -- jeesh. /blame LL for even having to send these | ||
65 | public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 | ||
66 | public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 | ||
67 | |||
68 | //RequestResults (I think these are right, they seem to work): | ||
69 | public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel | ||
70 | public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel | ||
71 | |||
72 | //These are other constants. Yay! | ||
73 | public const int START_PARCEL_LOCAL_ID = 1; | ||
74 | #endregion | ||
75 | |||
76 | #region Member Variables | ||
77 | public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>(); | ||
78 | private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; | ||
79 | private int[,] parcelIDList = new int[64, 64]; | ||
80 | |||
81 | private static World m_world; | ||
82 | #endregion | ||
83 | |||
84 | #region Constructors | ||
85 | public ParcelManager(World world) | ||
86 | { | ||
87 | |||
88 | m_world = world; | ||
89 | parcelIDList.Initialize(); | ||
90 | |||
91 | } | ||
92 | #endregion | ||
93 | |||
94 | #region Member Functions | ||
95 | |||
96 | #region Parcel From Storage Functions | ||
97 | public void ParcelFromStorage(ParcelData data) | ||
98 | { | ||
99 | Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); | ||
100 | new_parcel.parcelData = data.Copy(); | ||
101 | new_parcel.setParcelBitmapFromByteArray(); | ||
102 | addParcel(new_parcel); | ||
103 | |||
104 | } | ||
105 | |||
106 | public void NoParcelDataFromStorage() | ||
107 | { | ||
108 | resetSimParcels(); | ||
109 | } | ||
110 | #endregion | ||
111 | |||
112 | #region Parcel Add/Remove/Get/Create | ||
113 | /// <summary> | ||
114 | /// Creates a basic Parcel object without an owner (a zeroed key) | ||
115 | /// </summary> | ||
116 | /// <returns></returns> | ||
117 | public Parcel createBaseParcel() | ||
118 | { | ||
119 | return new Parcel(new LLUUID(), false, m_world); | ||
120 | } | ||
121 | |||
122 | /// <summary> | ||
123 | /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own | ||
124 | /// </summary> | ||
125 | /// <param name="new_parcel">The parcel being added</param> | ||
126 | public void addParcel(Parcel new_parcel) | ||
127 | { | ||
128 | lastParcelLocalID++; | ||
129 | new_parcel.parcelData.localID = lastParcelLocalID; | ||
130 | parcelList.Add(lastParcelLocalID, new_parcel.Copy()); | ||
131 | |||
132 | |||
133 | bool[,] parcelBitmap = new_parcel.getParcelBitmap(); | ||
134 | int x, y; | ||
135 | for (x = 0; x < 64; x++) | ||
136 | { | ||
137 | for (y = 0; y < 64; y++) | ||
138 | { | ||
139 | if (parcelBitmap[x, y]) | ||
140 | { | ||
141 | parcelIDList[x, y] = lastParcelLocalID; | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | parcelList[lastParcelLocalID].forceUpdateParcelInfo(); | ||
146 | |||
147 | |||
148 | } | ||
149 | /// <summary> | ||
150 | /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList | ||
151 | /// </summary> | ||
152 | /// <param name="local_id">Parcel.localID of the parcel to remove.</param> | ||
153 | public void removeParcel(int local_id) | ||
154 | { | ||
155 | int x, y; | ||
156 | for (x = 0; x < 64; x++) | ||
157 | { | ||
158 | for (y = 0; y < 64; y++) | ||
159 | { | ||
160 | if (parcelIDList[x, y] == local_id) | ||
161 | { | ||
162 | throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y); | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData); | ||
167 | parcelList.Remove(local_id); | ||
168 | } | ||
169 | |||
170 | public void performFinalParcelJoin(Parcel master, Parcel slave) | ||
171 | { | ||
172 | int x, y; | ||
173 | bool[,] parcelBitmapSlave = slave.getParcelBitmap(); | ||
174 | for (x = 0; x < 64; x++) | ||
175 | { | ||
176 | for (y = 0; y < 64; y++) | ||
177 | { | ||
178 | if (parcelBitmapSlave[x, y]) | ||
179 | { | ||
180 | parcelIDList[x, y] = master.parcelData.localID; | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | removeParcel(slave.parcelData.localID); | ||
185 | } | ||
186 | /// <summary> | ||
187 | /// Get the parcel at the specified point | ||
188 | /// </summary> | ||
189 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | ||
190 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | ||
191 | /// <returns>Parcel at the point supplied</returns> | ||
192 | public Parcel getParcel(int x, int y) | ||
193 | { | ||
194 | if (x > 256 || y > 256 || x < 0 || y < 0) | ||
195 | { | ||
196 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | return parcelList[parcelIDList[x / 4, y / 4]]; | ||
201 | } | ||
202 | |||
203 | } | ||
204 | #endregion | ||
205 | |||
206 | #region Parcel Modification | ||
207 | /// <summary> | ||
208 | /// Subdivides a parcel | ||
209 | /// </summary> | ||
210 | /// <param name="start_x">West Point</param> | ||
211 | /// <param name="start_y">South Point</param> | ||
212 | /// <param name="end_x">East Point</param> | ||
213 | /// <param name="end_y">North Point</param> | ||
214 | /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param> | ||
215 | /// <returns>Returns true if successful</returns> | ||
216 | public bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | ||
217 | { | ||
218 | //First, lets loop through the points and make sure they are all in the same parcel | ||
219 | //Get the parcel at start | ||
220 | Parcel startParcel = getParcel(start_x, start_y); | ||
221 | if (startParcel == null) return false; //No such parcel at the beginning | ||
222 | |||
223 | //Loop through the points | ||
224 | try | ||
225 | { | ||
226 | int totalX = end_x - start_x; | ||
227 | int totalY = end_y - start_y; | ||
228 | int x, y; | ||
229 | for (y = 0; y < totalY; y++) | ||
230 | { | ||
231 | for (x = 0; x < totalX; x++) | ||
232 | { | ||
233 | Parcel tempParcel = getParcel(start_x + x, start_y + y); | ||
234 | if (tempParcel == null) return false; //No such parcel at that point | ||
235 | if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | catch (Exception e) | ||
240 | { | ||
241 | return false; //Exception. For now, lets skip subdivision | ||
242 | } | ||
243 | |||
244 | //If we are still here, then they are subdividing within one parcel | ||
245 | //Check owner | ||
246 | if (startParcel.parcelData.ownerID != attempting_user_id) | ||
247 | { | ||
248 | return false; //They cant do this! | ||
249 | } | ||
250 | |||
251 | //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) | ||
252 | Parcel newParcel = startParcel.Copy(); | ||
253 | newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; | ||
254 | newParcel.parcelData.globalID = LLUUID.Random(); | ||
255 | |||
256 | newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); | ||
257 | |||
258 | //Now, lets set the subdivision area of the original to false | ||
259 | int startParcelIndex = startParcel.parcelData.localID; | ||
260 | parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); | ||
261 | parcelList[startParcelIndex].forceUpdateParcelInfo(); | ||
262 | |||
263 | |||
264 | //Now add the new parcel | ||
265 | addParcel(newParcel); | ||
266 | |||
267 | |||
268 | |||
269 | |||
270 | |||
271 | return true; | ||
272 | } | ||
273 | /// <summary> | ||
274 | /// Join 2 parcels together | ||
275 | /// </summary> | ||
276 | /// <param name="start_x">x value in first parcel</param> | ||
277 | /// <param name="start_y">y value in first parcel</param> | ||
278 | /// <param name="end_x">x value in second parcel</param> | ||
279 | /// <param name="end_y">y value in second parcel</param> | ||
280 | /// <param name="attempting_user_id">LLUUID of the avatar trying to join the parcels</param> | ||
281 | /// <returns>Returns true if successful</returns> | ||
282 | public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | ||
283 | { | ||
284 | end_x -= 4; | ||
285 | end_y -= 4; | ||
286 | Console.WriteLine("Joining Parcels between (" + start_x + ", " + start_y + ") and (" + end_x + ", " + end_y + ")"); | ||
287 | |||
288 | //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! | ||
289 | //This should be fixed later -- somewhat "incomplete code" --Ming | ||
290 | Parcel startParcel, endParcel; | ||
291 | |||
292 | try | ||
293 | { | ||
294 | startParcel = getParcel(start_x, start_y); | ||
295 | endParcel = getParcel(end_x, end_y); | ||
296 | } | ||
297 | catch (Exception e) | ||
298 | { | ||
299 | return false; //Error occured when trying to get the start and end parcels | ||
300 | } | ||
301 | if (startParcel == endParcel) | ||
302 | { | ||
303 | return false; //Subdivision of the same parcel is not allowed | ||
304 | } | ||
305 | |||
306 | //Check the parcel owners: | ||
307 | if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) | ||
308 | { | ||
309 | return false; | ||
310 | } | ||
311 | if (startParcel.parcelData.ownerID != attempting_user_id) | ||
312 | { | ||
313 | //TODO: Group editing stuff. Avatar owner support for now | ||
314 | return false; | ||
315 | } | ||
316 | |||
317 | Console.WriteLine("Performing Join on parcel: " + startParcel.parcelData.parcelName + " - " + startParcel.parcelData.area + "sqm and " + endParcel.parcelData.parcelName + " - " + endParcel.parcelData.area + "sqm"); | ||
318 | //Same owners! Lets join them | ||
319 | //Merge them to startParcel | ||
320 | parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); | ||
321 | performFinalParcelJoin(startParcel, endParcel); | ||
322 | |||
323 | return true; | ||
324 | |||
325 | |||
326 | |||
327 | } | ||
328 | #endregion | ||
329 | |||
330 | #region Parcel Updating | ||
331 | /// <summary> | ||
332 | /// Where we send the ParcelOverlay packet to the client | ||
333 | /// </summary> | ||
334 | /// <param name="remote_client">The object representing the client</param> | ||
335 | public void sendParcelOverlay(ClientView remote_client) | ||
336 | { | ||
337 | const int PARCEL_BLOCKS_PER_PACKET = 1024; | ||
338 | int x, y = 0; | ||
339 | byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; | ||
340 | int byteArrayCount = 0; | ||
341 | int sequenceID = 0; | ||
342 | ParcelOverlayPacket packet; | ||
343 | |||
344 | for (y = 0; y < 64; y++) | ||
345 | { | ||
346 | for (x = 0; x < 64; x++) | ||
347 | { | ||
348 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 | ||
349 | Parcel currentParcelBlock = getParcel(x * 4, y * 4); | ||
350 | |||
351 | if (currentParcelBlock.parcelData.ownerID == remote_client.AgentID) | ||
352 | { | ||
353 | //Owner Flag | ||
354 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER); | ||
355 | } | ||
356 | else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentID)) | ||
357 | { | ||
358 | //Sale Flag | ||
359 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE); | ||
360 | } | ||
361 | else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero) | ||
362 | { | ||
363 | //Public Flag | ||
364 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC); | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | //Other Flag | ||
369 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER); | ||
370 | } | ||
371 | |||
372 | |||
373 | //Now for border control | ||
374 | if (x == 0) | ||
375 | { | ||
376 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); | ||
377 | } | ||
378 | else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) | ||
379 | { | ||
380 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); | ||
381 | } | ||
382 | |||
383 | if (y == 0) | ||
384 | { | ||
385 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); | ||
386 | } | ||
387 | else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) | ||
388 | { | ||
389 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); | ||
390 | } | ||
391 | |||
392 | byteArray[byteArrayCount] = tempByte; | ||
393 | byteArrayCount++; | ||
394 | if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET) | ||
395 | { | ||
396 | byteArrayCount = 0; | ||
397 | packet = new ParcelOverlayPacket(); | ||
398 | packet.ParcelData.Data = byteArray; | ||
399 | packet.ParcelData.SequenceID = sequenceID; | ||
400 | remote_client.OutPacket((Packet)packet); | ||
401 | sequenceID++; | ||
402 | byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; | ||
403 | } | ||
404 | } | ||
405 | } | ||
406 | |||
407 | packet = new ParcelOverlayPacket(); | ||
408 | packet.ParcelData.Data = byteArray; | ||
409 | packet.ParcelData.SequenceID = sequenceID; //Eh? | ||
410 | remote_client.OutPacket((Packet)packet); | ||
411 | } | ||
412 | #endregion | ||
413 | |||
414 | /// <summary> | ||
415 | /// Resets the sim to the default parcel (full sim parcel owned by the default user) | ||
416 | /// </summary> | ||
417 | public void resetSimParcels() | ||
418 | { | ||
419 | //Remove all the parcels in the sim and add a blank, full sim parcel set to public | ||
420 | parcelList.Clear(); | ||
421 | lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; | ||
422 | parcelIDList.Initialize(); | ||
423 | |||
424 | Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); | ||
425 | |||
426 | fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); | ||
427 | fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; | ||
428 | fullSimParcel.parcelData.parcelDesc = ""; | ||
429 | |||
430 | fullSimParcel.parcelData.ownerID = m_world.m_regInfo.MasterAvatarAssignedUUID; | ||
431 | fullSimParcel.parcelData.salePrice = 1; | ||
432 | fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; | ||
433 | fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; | ||
434 | |||
435 | addParcel(fullSimParcel); | ||
436 | |||
437 | } | ||
438 | #endregion | ||
439 | } | ||
440 | #endregion | ||
441 | |||
442 | |||
443 | #region Parcel Class | ||
444 | /// <summary> | ||
445 | /// Keeps track of a specific parcel's information | ||
446 | /// </summary> | ||
447 | public class Parcel | ||
448 | { | ||
449 | #region Member Variables | ||
450 | public ParcelData parcelData = new ParcelData(); | ||
451 | public World m_world; | ||
452 | |||
453 | private bool[,] parcelBitmap = new bool[64, 64]; | ||
454 | |||
455 | #endregion | ||
456 | |||
457 | |||
458 | #region Constructors | ||
459 | public Parcel(LLUUID owner_id, bool is_group_owned, World world) | ||
460 | { | ||
461 | m_world = world; | ||
462 | parcelData.ownerID = owner_id; | ||
463 | parcelData.isGroupOwned = is_group_owned; | ||
464 | |||
465 | } | ||
466 | #endregion | ||
467 | |||
468 | |||
469 | #region Member Functions | ||
470 | |||
471 | #region General Functions | ||
472 | /// <summary> | ||
473 | /// Checks to see if this parcel contains a point | ||
474 | /// </summary> | ||
475 | /// <param name="x"></param> | ||
476 | /// <param name="y"></param> | ||
477 | /// <returns>Returns true if the parcel contains the specified point</returns> | ||
478 | public bool containsPoint(int x, int y) | ||
479 | { | ||
480 | if (x >= 0 && y >= 0 && x <= 256 && x <= 256) | ||
481 | { | ||
482 | return (parcelBitmap[x / 4, y / 4] == true); | ||
483 | } | ||
484 | else | ||
485 | { | ||
486 | return false; | ||
487 | } | ||
488 | } | ||
489 | |||
490 | public Parcel Copy() | ||
491 | { | ||
492 | Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); | ||
493 | |||
494 | //Place all new variables here! | ||
495 | newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); | ||
496 | newParcel.parcelData = parcelData.Copy(); | ||
497 | |||
498 | return newParcel; | ||
499 | } | ||
500 | |||
501 | #endregion | ||
502 | |||
503 | |||
504 | #region Packet Request Handling | ||
505 | /// <summary> | ||
506 | /// Sends parcel properties as requested | ||
507 | /// </summary> | ||
508 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> | ||
509 | /// <param name="snap_selection">Bool sent by client for them to use</param> | ||
510 | /// <param name="remote_client">Object representing the client</param> | ||
511 | public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, ClientView remote_client) | ||
512 | { | ||
513 | |||
514 | ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); | ||
515 | updatePacket.ParcelData.AABBMax = parcelData.AABBMax; | ||
516 | updatePacket.ParcelData.AABBMin = parcelData.AABBMin; | ||
517 | updatePacket.ParcelData.Area = parcelData.area; | ||
518 | updatePacket.ParcelData.AuctionID = parcelData.auctionID; | ||
519 | updatePacket.ParcelData.AuthBuyerID =parcelData.authBuyerID; //unemplemented | ||
520 | |||
521 | updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; | ||
522 | |||
523 | updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); | ||
524 | updatePacket.ParcelData.Category = (byte)parcelData.category; | ||
525 | updatePacket.ParcelData.ClaimDate = parcelData.claimDate; | ||
526 | updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; | ||
527 | updatePacket.ParcelData.GroupID = parcelData.groupID; | ||
528 | updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; | ||
529 | updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; | ||
530 | updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; | ||
531 | updatePacket.ParcelData.LocalID = parcelData.localID; | ||
532 | updatePacket.ParcelData.MaxPrims = 1000; //unemplemented | ||
533 | updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; | ||
534 | updatePacket.ParcelData.MediaID = parcelData.mediaID; | ||
535 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); | ||
536 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL); | ||
537 | updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); | ||
538 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented | ||
539 | updatePacket.ParcelData.OtherCount = 0; //unemplemented | ||
540 | updatePacket.ParcelData.OtherPrims = 0; //unemplented | ||
541 | updatePacket.ParcelData.OwnerID = parcelData.ownerID; | ||
542 | updatePacket.ParcelData.OwnerPrims = 0; //unemplemented | ||
543 | updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented | ||
544 | updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented | ||
545 | updatePacket.ParcelData.PassHours = parcelData.passHours; | ||
546 | updatePacket.ParcelData.PassPrice = parcelData.passPrice; | ||
547 | updatePacket.ParcelData.PublicCount = 0; //unemplemented | ||
548 | updatePacket.ParcelData.RegionDenyAnonymous = false; //unemplemented | ||
549 | updatePacket.ParcelData.RegionDenyIdentified = false; //unemplemented | ||
550 | updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented | ||
551 | updatePacket.ParcelData.RegionPushOverride = true; //unemplemented | ||
552 | updatePacket.ParcelData.RentPrice = 0; //?? | ||
553 | updatePacket.ParcelData.RequestResult = request_result; | ||
554 | updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented | ||
555 | updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented | ||
556 | updatePacket.ParcelData.SelfCount = 0;//unemplemented | ||
557 | updatePacket.ParcelData.SequenceID = sequence_id; | ||
558 | updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented | ||
559 | updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented | ||
560 | updatePacket.ParcelData.SnapSelection = snap_selection; | ||
561 | updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; | ||
562 | updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; | ||
563 | updatePacket.ParcelData.TotalPrims = 0; //unemplemented | ||
564 | updatePacket.ParcelData.UserLocation = parcelData.userLocation; | ||
565 | updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; | ||
566 | |||
567 | remote_client.OutPacket((Packet)updatePacket); | ||
568 | } | ||
569 | |||
570 | public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, ClientView remote_client) | ||
571 | { | ||
572 | if (remote_client.AgentID == parcelData.ownerID) | ||
573 | { | ||
574 | //Needs later group support | ||
575 | Console.WriteLine("Request for update - parcel #" + parcelData.localID); | ||
576 | parcelData.authBuyerID = packet.ParcelData.AuthBuyerID; | ||
577 | parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; | ||
578 | parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); | ||
579 | parcelData.groupID = packet.ParcelData.GroupID; | ||
580 | parcelData.landingType = packet.ParcelData.LandingType; | ||
581 | parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale; | ||
582 | parcelData.mediaID = packet.ParcelData.MediaID; | ||
583 | parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); | ||
584 | parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); | ||
585 | parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name); | ||
586 | parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags; | ||
587 | parcelData.passHours = packet.ParcelData.PassHours; | ||
588 | parcelData.passPrice = packet.ParcelData.PassPrice; | ||
589 | parcelData.salePrice = packet.ParcelData.SalePrice; | ||
590 | parcelData.snapshotID = packet.ParcelData.SnapshotID; | ||
591 | parcelData.userLocation = packet.ParcelData.UserLocation; | ||
592 | parcelData.userLookAt = packet.ParcelData.UserLookAt; | ||
593 | } | ||
594 | } | ||
595 | #endregion | ||
596 | |||
597 | |||
598 | #region Update Functions | ||
599 | /// <summary> | ||
600 | /// Updates the AABBMin and AABBMax values after area/shape modification of parcel | ||
601 | /// </summary> | ||
602 | private void updateAABBAndAreaValues() | ||
603 | { | ||
604 | int min_x = 64; | ||
605 | int min_y = 64; | ||
606 | int max_x = 0; | ||
607 | int max_y = 0; | ||
608 | int tempArea = 0; | ||
609 | int x, y; | ||
610 | for (x = 0; x < 64; x++) | ||
611 | { | ||
612 | for (y = 0; y < 64; y++) | ||
613 | { | ||
614 | if (parcelBitmap[x, y] == true) | ||
615 | { | ||
616 | if (min_x > x) min_x = x; | ||
617 | if (min_y > y) min_y = y; | ||
618 | if (max_x < x) max_x = x; | ||
619 | if (max_y < y) max_y = y; | ||
620 | tempArea += 16; //16sqm parcel | ||
621 | } | ||
622 | } | ||
623 | } | ||
624 | parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); | ||
625 | parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); | ||
626 | parcelData.area = tempArea; | ||
627 | } | ||
628 | |||
629 | public void updateParcelBitmapByteArray() | ||
630 | { | ||
631 | parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); | ||
632 | } | ||
633 | |||
634 | /// <summary> | ||
635 | /// Update all settings in parcel such as area, bitmap byte array, etc | ||
636 | /// </summary> | ||
637 | public void forceUpdateParcelInfo() | ||
638 | { | ||
639 | this.updateAABBAndAreaValues(); | ||
640 | this.updateParcelBitmapByteArray(); | ||
641 | } | ||
642 | |||
643 | public void setParcelBitmapFromByteArray() | ||
644 | { | ||
645 | parcelBitmap = convertBytesToParcelBitmap(); | ||
646 | } | ||
647 | #endregion | ||
648 | |||
649 | |||
650 | #region Parcel Bitmap Functions | ||
651 | /// <summary> | ||
652 | /// Sets the parcel's bitmap manually | ||
653 | /// </summary> | ||
654 | /// <param name="bitmap">64x64 block representing where this parcel is on a map</param> | ||
655 | public void setParcelBitmap(bool[,] bitmap) | ||
656 | { | ||
657 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) | ||
658 | { | ||
659 | //Throw an exception - The bitmap is not 64x64 | ||
660 | throw new Exception("Error: Invalid Parcel Bitmap"); | ||
661 | } | ||
662 | else | ||
663 | { | ||
664 | //Valid: Lets set it | ||
665 | parcelBitmap = bitmap; | ||
666 | forceUpdateParcelInfo(); | ||
667 | |||
668 | } | ||
669 | } | ||
670 | /// <summary> | ||
671 | /// Gets the parcels bitmap manually | ||
672 | /// </summary> | ||
673 | /// <returns></returns> | ||
674 | public bool[,] getParcelBitmap() | ||
675 | { | ||
676 | return parcelBitmap; | ||
677 | } | ||
678 | /// <summary> | ||
679 | /// Converts the parcel bitmap to a packet friendly byte array | ||
680 | /// </summary> | ||
681 | /// <returns></returns> | ||
682 | private byte[] convertParcelBitmapToBytes() | ||
683 | { | ||
684 | byte[] tempConvertArr = new byte[512]; | ||
685 | byte tempByte = 0; | ||
686 | int x, y, i, byteNum = 0; | ||
687 | i = 0; | ||
688 | for (y = 0; y < 64; y++) | ||
689 | { | ||
690 | for (x = 0; x < 64; x++) | ||
691 | { | ||
692 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8)); | ||
693 | if (i % 8 == 0) | ||
694 | { | ||
695 | tempConvertArr[byteNum] = tempByte; | ||
696 | tempByte = (byte)0; | ||
697 | i = 0; | ||
698 | byteNum++; | ||
699 | } | ||
700 | } | ||
701 | } | ||
702 | return tempConvertArr; | ||
703 | } | ||
704 | |||
705 | private bool[,] convertBytesToParcelBitmap() | ||
706 | { | ||
707 | bool[,] tempConvertMap = new bool[64, 64]; | ||
708 | tempConvertMap.Initialize(); | ||
709 | byte tempByte = 0; | ||
710 | int x = 0, y = 0, i = 0, bitNum = 0; | ||
711 | for(i = 0; i < 512; i++) | ||
712 | { | ||
713 | tempByte = parcelData.parcelBitmapByteArray[i]; | ||
714 | for(bitNum = 0; bitNum < 8; bitNum++) | ||
715 | { | ||
716 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); | ||
717 | tempConvertMap[x, y] = bit; | ||
718 | x++; | ||
719 | if(x > 63) | ||
720 | { | ||
721 | x = 0; | ||
722 | y++; | ||
723 | } | ||
724 | |||
725 | } | ||
726 | |||
727 | } | ||
728 | return tempConvertMap; | ||
729 | } | ||
730 | /// <summary> | ||
731 | /// Full sim parcel creation | ||
732 | /// </summary> | ||
733 | /// <returns></returns> | ||
734 | public static bool[,] basicFullRegionParcelBitmap() | ||
735 | { | ||
736 | return getSquareParcelBitmap(0, 0, 256, 256); | ||
737 | } | ||
738 | |||
739 | /// <summary> | ||
740 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | ||
741 | /// </summary> | ||
742 | /// <param name="start_x"></param> | ||
743 | /// <param name="start_y"></param> | ||
744 | /// <param name="end_x"></param> | ||
745 | /// <param name="end_y"></param> | ||
746 | /// <returns></returns> | ||
747 | public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y) | ||
748 | { | ||
749 | |||
750 | bool[,] tempBitmap = new bool[64, 64]; | ||
751 | tempBitmap.Initialize(); | ||
752 | |||
753 | tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | ||
754 | return tempBitmap; | ||
755 | } | ||
756 | |||
757 | /// <summary> | ||
758 | /// Change a parcel's bitmap at within a square and set those points to a specific value | ||
759 | /// </summary> | ||
760 | /// <param name="parcel_bitmap"></param> | ||
761 | /// <param name="start_x"></param> | ||
762 | /// <param name="start_y"></param> | ||
763 | /// <param name="end_x"></param> | ||
764 | /// <param name="end_y"></param> | ||
765 | /// <param name="set_value"></param> | ||
766 | /// <returns></returns> | ||
767 | public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) | ||
768 | { | ||
769 | if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2) | ||
770 | { | ||
771 | //Throw an exception - The bitmap is not 64x64 | ||
772 | throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()"); | ||
773 | } | ||
774 | |||
775 | int x, y; | ||
776 | for (y = 0; y < 64; y++) | ||
777 | { | ||
778 | for (x = 0; x < 64; x++) | ||
779 | { | ||
780 | if (x >= start_x / 4 && x < end_x / 4 | ||
781 | && y >= start_y / 4 && y < end_y / 4) | ||
782 | { | ||
783 | parcel_bitmap[x, y] = set_value; | ||
784 | } | ||
785 | } | ||
786 | } | ||
787 | return parcel_bitmap; | ||
788 | } | ||
789 | /// <summary> | ||
790 | /// Join the true values of 2 bitmaps together | ||
791 | /// </summary> | ||
792 | /// <param name="bitmap_base"></param> | ||
793 | /// <param name="bitmap_add"></param> | ||
794 | /// <returns></returns> | ||
795 | public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) | ||
796 | { | ||
797 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) | ||
798 | { | ||
799 | //Throw an exception - The bitmap is not 64x64 | ||
800 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps"); | ||
801 | } | ||
802 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) | ||
803 | { | ||
804 | //Throw an exception - The bitmap is not 64x64 | ||
805 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); | ||
806 | |||
807 | } | ||
808 | |||
809 | int x, y; | ||
810 | for (y = 0; y < 64; y++) | ||
811 | { | ||
812 | for (x = 0; x < 64; x++) | ||
813 | { | ||
814 | if (bitmap_add[x, y]) | ||
815 | { | ||
816 | bitmap_base[x, y] = true; | ||
817 | } | ||
818 | } | ||
819 | } | ||
820 | return bitmap_base; | ||
821 | } | ||
822 | #endregion | ||
823 | |||
824 | #endregion | ||
825 | |||
826 | |||
827 | } | ||
828 | #endregion | ||
829 | |||
830 | |||
831 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/Primitive.cs b/OpenSim/OpenSim.RegionServer/world/Primitive.cs deleted file mode 100644 index 07d07db..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Primitive.cs +++ /dev/null | |||
@@ -1,597 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.types; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Physics.Manager; | ||
36 | using OpenSim.Framework.Types; | ||
37 | |||
38 | namespace OpenSim.world | ||
39 | { | ||
40 | public class Primitive : Entity | ||
41 | { | ||
42 | protected float mesh_cutbegin; | ||
43 | protected float mesh_cutend; | ||
44 | protected PrimData primData; | ||
45 | protected bool newPrimFlag = false; | ||
46 | protected bool updateFlag = false; | ||
47 | protected bool dirtyFlag = false; | ||
48 | private ObjectUpdatePacket OurPacket; | ||
49 | private bool physicsEnabled = false; | ||
50 | private bool physicstest = false; | ||
51 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | ||
52 | private Dictionary<uint, ClientView> m_clientThreads; | ||
53 | private ulong m_regionHandle; | ||
54 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
55 | |||
56 | public bool PhysicsEnabled | ||
57 | { | ||
58 | get | ||
59 | { | ||
60 | return physicsEnabled; | ||
61 | } | ||
62 | set | ||
63 | { | ||
64 | physicsEnabled = value; | ||
65 | } | ||
66 | } | ||
67 | public bool UpdateFlag | ||
68 | { | ||
69 | get | ||
70 | { | ||
71 | return updateFlag; | ||
72 | } | ||
73 | set | ||
74 | { | ||
75 | updateFlag = value; | ||
76 | } | ||
77 | } | ||
78 | public LLVector3 Scale | ||
79 | { | ||
80 | set | ||
81 | { | ||
82 | LLVector3 offset = (value - primData.Scale); | ||
83 | offset.X /= 2; | ||
84 | offset.Y /= 2; | ||
85 | offset.Z /= 2; | ||
86 | |||
87 | this.primData.Position += offset; | ||
88 | this.primData.Scale = value; | ||
89 | |||
90 | this.dirtyFlag = true; | ||
91 | } | ||
92 | get | ||
93 | { | ||
94 | return this.primData.Scale; | ||
95 | } | ||
96 | } | ||
97 | public PhysicsActor PhysActor | ||
98 | { | ||
99 | set | ||
100 | { | ||
101 | this._physActor = value; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public Primitive(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world) | ||
106 | { | ||
107 | mesh_cutbegin = 0.0f; | ||
108 | mesh_cutend = 1.0f; | ||
109 | |||
110 | m_clientThreads = clientThreads; | ||
111 | m_regionHandle = regionHandle; | ||
112 | m_world = world; | ||
113 | } | ||
114 | |||
115 | public override Mesh getMesh() | ||
116 | { | ||
117 | Mesh mesh = new Mesh(); | ||
118 | Triangle tri = new Triangle( | ||
119 | new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), | ||
120 | new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), | ||
121 | new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); | ||
122 | |||
123 | mesh.AddTri(tri); | ||
124 | mesh += base.getMesh(); | ||
125 | |||
126 | return mesh; | ||
127 | } | ||
128 | |||
129 | public byte[] GetByteArray() | ||
130 | { | ||
131 | return this.primData.ToBytes(); | ||
132 | } | ||
133 | |||
134 | public void GetProperites(ClientView client) | ||
135 | { | ||
136 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
137 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
138 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
139 | proper.ObjectData[0].ItemID = LLUUID.Zero; // this.uuid; | ||
140 | proper.ObjectData[0].CreationDate = (ulong) this.primData.CreationDate; | ||
141 | proper.ObjectData[0].CreatorID = this.primData.OwnerID; | ||
142 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
143 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
144 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
145 | proper.ObjectData[0].InventorySerial = 0; | ||
146 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
147 | proper.ObjectData[0].ObjectID = this.uuid; | ||
148 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
149 | proper.ObjectData[0].TouchName = new byte[0]; | ||
150 | proper.ObjectData[0].TextureID = new byte[0]; | ||
151 | proper.ObjectData[0].SitName = new byte[0]; | ||
152 | proper.ObjectData[0].Name = new byte[0]; | ||
153 | proper.ObjectData[0].Description = new byte[0]; | ||
154 | proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; | ||
155 | proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; | ||
156 | proper.ObjectData[0].GroupMask = this.primData.GroupMask; | ||
157 | proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; | ||
158 | proper.ObjectData[0].BaseMask = this.primData.BaseMask; | ||
159 | |||
160 | client.OutPacket(proper); | ||
161 | } | ||
162 | |||
163 | public void UpdatePosition(LLVector3 pos) | ||
164 | { | ||
165 | this.Pos = pos; | ||
166 | if (this._physActor != null) // && this.physicsEnabled) | ||
167 | { | ||
168 | try | ||
169 | { | ||
170 | lock (m_world.LockPhysicsEngine) | ||
171 | { | ||
172 | this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z); | ||
173 | } | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | Console.WriteLine(e.Message); | ||
178 | } | ||
179 | } | ||
180 | this.updateFlag = true; | ||
181 | } | ||
182 | |||
183 | public override void update() | ||
184 | { | ||
185 | LLVector3 pos2 = new LLVector3(0, 0, 0); | ||
186 | if (this._physActor != null && this.physicsEnabled) | ||
187 | { | ||
188 | |||
189 | PhysicsVector pPos = this._physActor.Position; | ||
190 | pos2 = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
191 | } | ||
192 | if (this.newPrimFlag) | ||
193 | { | ||
194 | foreach (ClientView client in m_clientThreads.Values) | ||
195 | { | ||
196 | client.OutPacket(OurPacket); | ||
197 | } | ||
198 | this.newPrimFlag = false; | ||
199 | } | ||
200 | else if (this.updateFlag) | ||
201 | { | ||
202 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
203 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
204 | terse.RegionData.TimeDilation = 64096; | ||
205 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
206 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
207 | foreach (ClientView client in m_clientThreads.Values) | ||
208 | { | ||
209 | client.OutPacket(terse); | ||
210 | } | ||
211 | this.updateFlag = false; | ||
212 | } | ||
213 | else if (this.dirtyFlag) | ||
214 | { | ||
215 | foreach (ClientView client in m_clientThreads.Values) | ||
216 | { | ||
217 | UpdateClient(client); | ||
218 | } | ||
219 | this.dirtyFlag = false; | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | if (this._physActor != null && this.physicsEnabled) | ||
224 | { | ||
225 | if (pos2 != this.positionLastFrame) | ||
226 | { | ||
227 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
228 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
229 | terse.RegionData.TimeDilation = 64096; | ||
230 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
231 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
232 | foreach (ClientView client in m_clientThreads.Values) | ||
233 | { | ||
234 | client.OutPacket(terse); | ||
235 | } | ||
236 | } | ||
237 | this.positionLastFrame = pos2; | ||
238 | } | ||
239 | } | ||
240 | |||
241 | if (this.physicstest) | ||
242 | { | ||
243 | LLVector3 pos = this.Pos; | ||
244 | pos.Z += 0.0001f; | ||
245 | this.UpdatePosition(pos); | ||
246 | this.physicstest = false; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | public void UpdateClient(ClientView RemoteClient) | ||
251 | { | ||
252 | |||
253 | LLVector3 lPos; | ||
254 | if (this._physActor != null && this.physicsEnabled) | ||
255 | { | ||
256 | PhysicsVector pPos = this._physActor.Position; | ||
257 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | lPos = this.Pos; | ||
262 | } | ||
263 | byte[] pb = lPos.GetBytes(); | ||
264 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
265 | |||
266 | // OurPacket should be update with the follwing in updateShape() rather than having to do it here | ||
267 | OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
268 | OurPacket.ObjectData[0].PCode = this.primData.PCode; | ||
269 | OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
270 | OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
271 | OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
272 | OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
273 | OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
274 | OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
275 | OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
276 | OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
277 | OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
278 | OurPacket.ObjectData[0].Scale = this.primData.Scale; | ||
279 | OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
280 | OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
281 | OurPacket.ObjectData[0].ParentID = this.primData.ParentID ; | ||
282 | OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
283 | //finish off copying rest of shape data | ||
284 | OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
285 | OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
286 | OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
287 | OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
288 | OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
289 | OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; | ||
290 | |||
291 | RemoteClient.OutPacket(OurPacket); | ||
292 | } | ||
293 | |||
294 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
295 | { | ||
296 | this.primData.PathBegin = addPacket.PathBegin; | ||
297 | this.primData.PathEnd = addPacket.PathEnd; | ||
298 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
299 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
300 | this.primData.PathShearX = addPacket.PathShearX; | ||
301 | this.primData.PathShearY = addPacket.PathShearY; | ||
302 | this.primData.PathSkew = addPacket.PathSkew; | ||
303 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
304 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
305 | this.primData.PathCurve = addPacket.PathCurve; | ||
306 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
307 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
308 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
309 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
310 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
311 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
312 | this.primData.PathTwist = addPacket.PathTwist; | ||
313 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; | ||
314 | this.dirtyFlag = true; | ||
315 | } | ||
316 | |||
317 | public void UpdateTexture(byte[] tex) | ||
318 | { | ||
319 | this.OurPacket.ObjectData[0].TextureEntry = tex; | ||
320 | this.primData.Texture = tex; | ||
321 | this.dirtyFlag = true; | ||
322 | } | ||
323 | |||
324 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) | ||
325 | { | ||
326 | if (this._physActor != null) | ||
327 | { | ||
328 | if (this._physActor.Kinematic == pack.AgentData.UsePhysics) | ||
329 | { | ||
330 | this._physActor.Kinematic = !pack.AgentData.UsePhysics; //if Usephysics = true, then Kinematic should = false | ||
331 | } | ||
332 | this.physicsEnabled = pack.AgentData.UsePhysics; | ||
333 | if (this._physActor.Kinematic == false) | ||
334 | { | ||
335 | LLVector3 pos = this.Pos; | ||
336 | this.UpdatePosition(pos); | ||
337 | pos.Z += 0.000001f; | ||
338 | this.UpdatePosition(pos); | ||
339 | this.physicstest = true; | ||
340 | } | ||
341 | else | ||
342 | { | ||
343 | PhysicsVector vec = this._physActor.Position; | ||
344 | LLVector3 pos = new LLVector3(vec.X, vec.Y, vec.Z); | ||
345 | this.Pos = pos; | ||
346 | this.updateFlag = true; | ||
347 | } | ||
348 | } | ||
349 | } | ||
350 | |||
351 | public void MakeParent(Primitive prim) | ||
352 | { | ||
353 | this.primData.ParentID = prim.localid; | ||
354 | this.Pos -= prim.Pos; | ||
355 | this.dirtyFlag = true; | ||
356 | } | ||
357 | |||
358 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | ||
359 | { | ||
360 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
361 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
362 | objupdate.RegionData.TimeDilation = 64096; | ||
363 | |||
364 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
365 | PrimData PData = new PrimData(); | ||
366 | this.primData = PData; | ||
367 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
368 | |||
369 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
370 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
371 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
372 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
373 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
374 | objupdate.ObjectData[0].Text = new byte[0]; | ||
375 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
376 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
377 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
378 | objupdate.ObjectData[0].Material = 3; | ||
379 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
380 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
381 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
382 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
383 | this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
384 | objupdate.ObjectData[0].State = 0; | ||
385 | objupdate.ObjectData[0].Data = new byte[0]; | ||
386 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = ownerID; | ||
387 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; | ||
388 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; | ||
389 | PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; | ||
390 | PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; | ||
391 | PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; | ||
392 | PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; | ||
393 | PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; | ||
394 | PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; | ||
395 | PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
396 | PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
397 | PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; | ||
398 | PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; | ||
399 | PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
400 | PData.ParentID = objupdate.ObjectData[0].ParentID = 0; | ||
401 | PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
402 | PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
403 | PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
404 | PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX; | ||
405 | PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY; | ||
406 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; | ||
407 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
408 | |||
409 | objupdate.ObjectData[0].ID = (uint)(localID); | ||
410 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); | ||
411 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
412 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
413 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
414 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | ||
415 | //update position | ||
416 | byte[] pb = pos1.GetBytes(); | ||
417 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
418 | this.newPrimFlag = true; | ||
419 | this.primData.FullID = this.uuid = objupdate.ObjectData[0].FullID; | ||
420 | this.localid = objupdate.ObjectData[0].ID; | ||
421 | this.primData.Position = this.Pos = pos1; | ||
422 | this.OurPacket = objupdate; | ||
423 | } | ||
424 | |||
425 | public void CreateFromStorage(PrimData store) | ||
426 | { | ||
427 | this.CreateFromStorage(store, store.Position, store.LocalID, false); | ||
428 | } | ||
429 | |||
430 | public void CreateFromStorage(PrimData store, LLVector3 posi, uint localID, bool newprim) | ||
431 | { | ||
432 | //need to clean this up as it shares a lot of code with CreateFromPacket() | ||
433 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
434 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
435 | objupdate.RegionData.TimeDilation = 64096; | ||
436 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
437 | |||
438 | this.primData = store; | ||
439 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
440 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
441 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
442 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
443 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
444 | objupdate.ObjectData[0].Text = new byte[0]; | ||
445 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
446 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
447 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
448 | objupdate.ObjectData[0].Material = 3; | ||
449 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
450 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
451 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
452 | |||
453 | if (store.Texture == null) | ||
454 | { | ||
455 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
456 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | objupdate.ObjectData[0].TextureEntry = store.Texture; | ||
461 | } | ||
462 | |||
463 | objupdate.ObjectData[0].State = 0; | ||
464 | objupdate.ObjectData[0].Data = new byte[0]; | ||
465 | objupdate.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
466 | objupdate.ObjectData[0].PCode = this.primData.PCode; | ||
467 | objupdate.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
468 | objupdate.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
469 | objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
470 | objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
471 | objupdate.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
472 | objupdate.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
473 | objupdate.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
474 | objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
475 | objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
476 | objupdate.ObjectData[0].Scale = this.primData.Scale; | ||
477 | objupdate.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
478 | objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
479 | objupdate.ObjectData[0].ParentID = 0; | ||
480 | objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
481 | //finish off copying rest of shape data | ||
482 | objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
483 | objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
484 | objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
485 | objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
486 | objupdate.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
487 | objupdate.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; | ||
488 | |||
489 | objupdate.ObjectData[0].ID = localID; // (uint)store.LocalID; | ||
490 | objupdate.ObjectData[0].FullID = store.FullID; | ||
491 | |||
492 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
493 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
494 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
495 | LLVector3 pos1 = posi; // store.Position; | ||
496 | //update position | ||
497 | byte[] pb = pos1.GetBytes(); | ||
498 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
499 | |||
500 | this.uuid = objupdate.ObjectData[0].FullID; | ||
501 | this.localid = objupdate.ObjectData[0].ID; | ||
502 | this.Pos = pos1; | ||
503 | this.OurPacket = objupdate; | ||
504 | if (newprim) | ||
505 | { | ||
506 | this.newPrimFlag = true; | ||
507 | } | ||
508 | } | ||
509 | |||
510 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
511 | { | ||
512 | uint ID = this.localid; | ||
513 | byte[] bytes = new byte[60]; | ||
514 | |||
515 | int i = 0; | ||
516 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
517 | //dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; | ||
518 | dat.TextureEntry = new byte[0]; | ||
519 | bytes[i++] = (byte)(ID % 256); | ||
520 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
521 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
522 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
523 | bytes[i++] = 0; | ||
524 | bytes[i++] = 0; | ||
525 | |||
526 | LLVector3 lPos; | ||
527 | Axiom.MathLib.Quaternion lRot; | ||
528 | if (this._physActor != null && this.physicsEnabled) | ||
529 | { | ||
530 | PhysicsVector pPos = this._physActor.Position; | ||
531 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
532 | lRot = this._physActor.Orientation; | ||
533 | } | ||
534 | else | ||
535 | { | ||
536 | lPos = this.Pos; | ||
537 | lRot = this.rotation; | ||
538 | } | ||
539 | byte[] pb = lPos.GetBytes(); | ||
540 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
541 | i += 12; | ||
542 | ushort ac = 32767; | ||
543 | |||
544 | //vel | ||
545 | bytes[i++] = (byte)(ac % 256); | ||
546 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
547 | bytes[i++] = (byte)(ac % 256); | ||
548 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
549 | bytes[i++] = (byte)(ac % 256); | ||
550 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
551 | |||
552 | //accel | ||
553 | bytes[i++] = (byte)(ac % 256); | ||
554 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
555 | bytes[i++] = (byte)(ac % 256); | ||
556 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
557 | bytes[i++] = (byte)(ac % 256); | ||
558 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
559 | |||
560 | ushort rw, rx, ry, rz; | ||
561 | rw = (ushort)(32768 * (lRot.w + 1)); | ||
562 | rx = (ushort)(32768 * (lRot.x + 1)); | ||
563 | ry = (ushort)(32768 * (lRot.y + 1)); | ||
564 | rz = (ushort)(32768 * (lRot.z + 1)); | ||
565 | |||
566 | //rot | ||
567 | bytes[i++] = (byte)(rx % 256); | ||
568 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
569 | bytes[i++] = (byte)(ry % 256); | ||
570 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
571 | bytes[i++] = (byte)(rz % 256); | ||
572 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
573 | bytes[i++] = (byte)(rw % 256); | ||
574 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
575 | |||
576 | //rotation vel | ||
577 | bytes[i++] = (byte)(ac % 256); | ||
578 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
579 | bytes[i++] = (byte)(ac % 256); | ||
580 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
581 | bytes[i++] = (byte)(ac % 256); | ||
582 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
583 | |||
584 | dat.Data = bytes; | ||
585 | return dat; | ||
586 | } | ||
587 | |||
588 | public override void BackUp() | ||
589 | { | ||
590 | this.primData.FullID = this.uuid; | ||
591 | this.primData.LocalID = this.localid; | ||
592 | this.primData.Position = this.Pos; | ||
593 | this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); | ||
594 | this.m_world.localStorage.StorePrim(this.primData); | ||
595 | } | ||
596 | } | ||
597 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/Primitive2.cs b/OpenSim/OpenSim.RegionServer/world/Primitive2.cs deleted file mode 100644 index 083d4b8..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Primitive2.cs +++ /dev/null | |||
@@ -1,518 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.types; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Physics.Manager; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | |||
39 | namespace OpenSim.world | ||
40 | { | ||
41 | public class Primitive2 : Entity | ||
42 | { | ||
43 | protected PrimData primData; | ||
44 | //private ObjectUpdatePacket OurPacket; | ||
45 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | ||
46 | private Dictionary<uint, ClientView> m_clientThreads; | ||
47 | private ulong m_regionHandle; | ||
48 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
49 | private bool physicsEnabled = false; | ||
50 | |||
51 | private Dictionary<LLUUID, InventoryItem> inventoryItems; | ||
52 | |||
53 | #region Properties | ||
54 | |||
55 | public LLVector3 Scale | ||
56 | { | ||
57 | set | ||
58 | { | ||
59 | this.primData.Scale = value; | ||
60 | //this.dirtyFlag = true; | ||
61 | } | ||
62 | get | ||
63 | { | ||
64 | return this.primData.Scale; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | public PhysicsActor PhysActor | ||
69 | { | ||
70 | set | ||
71 | { | ||
72 | this._physActor = value; | ||
73 | } | ||
74 | } | ||
75 | public override LLVector3 Pos | ||
76 | { | ||
77 | get | ||
78 | { | ||
79 | return base.Pos; | ||
80 | } | ||
81 | set | ||
82 | { | ||
83 | base.Pos = value; | ||
84 | } | ||
85 | } | ||
86 | #endregion | ||
87 | |||
88 | public Primitive2(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world) | ||
89 | { | ||
90 | m_clientThreads = clientThreads; | ||
91 | m_regionHandle = regionHandle; | ||
92 | m_world = world; | ||
93 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
94 | } | ||
95 | |||
96 | public Primitive2(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world, LLUUID owner) | ||
97 | { | ||
98 | m_clientThreads = clientThreads; | ||
99 | m_regionHandle = regionHandle; | ||
100 | m_world = world; | ||
101 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
102 | this.primData = new PrimData(); | ||
103 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
104 | this.primData.OwnerID = owner; | ||
105 | } | ||
106 | |||
107 | public byte[] GetByteArray() | ||
108 | { | ||
109 | byte[] result = null; | ||
110 | List<byte[]> dataArrays = new List<byte[]>(); | ||
111 | dataArrays.Add(primData.ToBytes()); | ||
112 | foreach (Entity child in children) | ||
113 | { | ||
114 | if (child is OpenSim.world.Primitive2) | ||
115 | { | ||
116 | dataArrays.Add(((OpenSim.world.Primitive2)child).GetByteArray()); | ||
117 | } | ||
118 | } | ||
119 | byte[] primstart = Helpers.StringToField("<Prim>"); | ||
120 | byte[] primend = Helpers.StringToField("</Prim>"); | ||
121 | int totalLength = primstart.Length + primend.Length; | ||
122 | for (int i = 0; i < dataArrays.Count; i++) | ||
123 | { | ||
124 | totalLength += dataArrays[i].Length; | ||
125 | } | ||
126 | |||
127 | result = new byte[totalLength]; | ||
128 | int arraypos = 0; | ||
129 | Array.Copy(primstart, 0, result, 0, primstart.Length); | ||
130 | arraypos += primstart.Length; | ||
131 | for (int i = 0; i < dataArrays.Count; i++) | ||
132 | { | ||
133 | Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); | ||
134 | arraypos += dataArrays[i].Length; | ||
135 | } | ||
136 | Array.Copy(primend, 0, result, arraypos, primend.Length); | ||
137 | |||
138 | return result; | ||
139 | } | ||
140 | |||
141 | #region Overridden Methods | ||
142 | |||
143 | public override void update() | ||
144 | { | ||
145 | LLVector3 pos2 = new LLVector3(0, 0, 0); | ||
146 | } | ||
147 | |||
148 | public override void BackUp() | ||
149 | { | ||
150 | |||
151 | } | ||
152 | |||
153 | #endregion | ||
154 | |||
155 | #region Packet handlers | ||
156 | |||
157 | public void UpdatePosition(LLVector3 pos) | ||
158 | { | ||
159 | |||
160 | } | ||
161 | |||
162 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
163 | { | ||
164 | this.primData.PathBegin = addPacket.PathBegin; | ||
165 | this.primData.PathEnd = addPacket.PathEnd; | ||
166 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
167 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
168 | this.primData.PathShearX = addPacket.PathShearX; | ||
169 | this.primData.PathShearY = addPacket.PathShearY; | ||
170 | this.primData.PathSkew = addPacket.PathSkew; | ||
171 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
172 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
173 | this.primData.PathCurve = addPacket.PathCurve; | ||
174 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
175 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
176 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
177 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
178 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
179 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
180 | this.primData.PathTwist = addPacket.PathTwist; | ||
181 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; | ||
182 | } | ||
183 | |||
184 | public void UpdateTexture(byte[] tex) | ||
185 | { | ||
186 | this.primData.Texture = tex; | ||
187 | //this.dirtyFlag = true; | ||
188 | } | ||
189 | |||
190 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) | ||
191 | { | ||
192 | |||
193 | } | ||
194 | |||
195 | public void AssignToParent(Primitive prim) | ||
196 | { | ||
197 | |||
198 | } | ||
199 | |||
200 | public void GetProperites(ClientView client) | ||
201 | { | ||
202 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
203 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
204 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
205 | proper.ObjectData[0].ItemID = LLUUID.Zero; | ||
206 | proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; | ||
207 | proper.ObjectData[0].CreatorID = this.primData.OwnerID; | ||
208 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
209 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
210 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
211 | proper.ObjectData[0].InventorySerial = 0; | ||
212 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
213 | proper.ObjectData[0].ObjectID = this.uuid; | ||
214 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
215 | proper.ObjectData[0].TouchName = new byte[0]; | ||
216 | proper.ObjectData[0].TextureID = new byte[0]; | ||
217 | proper.ObjectData[0].SitName = new byte[0]; | ||
218 | proper.ObjectData[0].Name = new byte[0]; | ||
219 | proper.ObjectData[0].Description = new byte[0]; | ||
220 | proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; | ||
221 | proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; | ||
222 | proper.ObjectData[0].GroupMask = this.primData.GroupMask; | ||
223 | proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; | ||
224 | proper.ObjectData[0].BaseMask = this.primData.BaseMask; | ||
225 | |||
226 | client.OutPacket(proper); | ||
227 | } | ||
228 | |||
229 | #endregion | ||
230 | |||
231 | # region Inventory Methods | ||
232 | |||
233 | public bool AddToInventory(InventoryItem item) | ||
234 | { | ||
235 | return false; | ||
236 | } | ||
237 | |||
238 | public InventoryItem RemoveFromInventory(LLUUID itemID) | ||
239 | { | ||
240 | return null; | ||
241 | } | ||
242 | |||
243 | public void RequestInventoryInfo(ClientView simClient, RequestTaskInventoryPacket packet) | ||
244 | { | ||
245 | |||
246 | } | ||
247 | |||
248 | public void RequestXferInventory(ClientView simClient, ulong xferID) | ||
249 | { | ||
250 | //will only currently work if the total size of the inventory data array is under about 1000 bytes | ||
251 | SendXferPacketPacket send = new SendXferPacketPacket(); | ||
252 | |||
253 | send.XferID.ID = xferID; | ||
254 | send.XferID.Packet = 1 + 2147483648; | ||
255 | send.DataPacket.Data = this.ConvertInventoryToBytes(); | ||
256 | |||
257 | simClient.OutPacket(send); | ||
258 | } | ||
259 | |||
260 | public byte[] ConvertInventoryToBytes() | ||
261 | { | ||
262 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
263 | byte[] result = new byte[0]; | ||
264 | List<byte[]> inventoryData = new List<byte[]>(); | ||
265 | int totallength = 0; | ||
266 | foreach (InventoryItem invItem in inventoryItems.Values) | ||
267 | { | ||
268 | byte[] data = enc.GetBytes(invItem.ExportString()); | ||
269 | inventoryData.Add(data); | ||
270 | totallength += data.Length; | ||
271 | } | ||
272 | //TODO: copy arrays into the single result array | ||
273 | |||
274 | return result; | ||
275 | } | ||
276 | |||
277 | public void CreateInventoryFromBytes(byte[] data) | ||
278 | { | ||
279 | |||
280 | } | ||
281 | |||
282 | #endregion | ||
283 | |||
284 | #region Update viewers Methods | ||
285 | |||
286 | //should change these mehtods, so that outgoing packets are sent through the avatar class | ||
287 | public void SendFullUpdateToClient(ClientView remoteClient) | ||
288 | { | ||
289 | LLVector3 lPos; | ||
290 | if (this._physActor != null && this.physicsEnabled) | ||
291 | { | ||
292 | PhysicsVector pPos = this._physActor.Position; | ||
293 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
294 | } | ||
295 | else | ||
296 | { | ||
297 | lPos = this.Pos; | ||
298 | } | ||
299 | |||
300 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | ||
301 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
302 | outPacket.ObjectData[0] = this.CreateUpdateBlock(); | ||
303 | byte[] pb = lPos.GetBytes(); | ||
304 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
305 | |||
306 | remoteClient.OutPacket(outPacket); | ||
307 | } | ||
308 | |||
309 | public void SendFullUpdateToAllClients() | ||
310 | { | ||
311 | |||
312 | } | ||
313 | |||
314 | public void SendTerseUpdateToClient(ClientView RemoteClient) | ||
315 | { | ||
316 | |||
317 | } | ||
318 | |||
319 | public void SendTerseUpdateToALLClients() | ||
320 | { | ||
321 | |||
322 | } | ||
323 | |||
324 | #endregion | ||
325 | |||
326 | #region Create Methods | ||
327 | |||
328 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | ||
329 | { | ||
330 | PrimData PData = new PrimData(); | ||
331 | this.primData = PData; | ||
332 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
333 | |||
334 | PData.OwnerID = ownerID; | ||
335 | PData.PCode = addPacket.ObjectData.PCode; | ||
336 | PData.PathBegin = addPacket.ObjectData.PathBegin; | ||
337 | PData.PathEnd = addPacket.ObjectData.PathEnd; | ||
338 | PData.PathScaleX = addPacket.ObjectData.PathScaleX; | ||
339 | PData.PathScaleY = addPacket.ObjectData.PathScaleY; | ||
340 | PData.PathShearX = addPacket.ObjectData.PathShearX; | ||
341 | PData.PathShearY = addPacket.ObjectData.PathShearY; | ||
342 | PData.PathSkew = addPacket.ObjectData.PathSkew; | ||
343 | PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
344 | PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
345 | PData.Scale = addPacket.ObjectData.Scale; | ||
346 | PData.PathCurve = addPacket.ObjectData.PathCurve; | ||
347 | PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
348 | PData.ParentID = 0; | ||
349 | PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
350 | PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
351 | PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
352 | PData.PathTaperX = addPacket.ObjectData.PathTaperX; | ||
353 | PData.PathTaperY = addPacket.ObjectData.PathTaperY; | ||
354 | PData.PathTwist = addPacket.ObjectData.PathTwist; | ||
355 | PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
356 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | ||
357 | this.primData.FullID = this.uuid = LLUUID.Random(); | ||
358 | this.localid = (uint)(localID); | ||
359 | this.primData.Position = this.Pos = pos1; | ||
360 | } | ||
361 | |||
362 | public void CreateFromBytes(byte[] data) | ||
363 | { | ||
364 | |||
365 | } | ||
366 | |||
367 | public void CreateFromPrimData(PrimData primData) | ||
368 | { | ||
369 | this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); | ||
370 | } | ||
371 | |||
372 | public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) | ||
373 | { | ||
374 | |||
375 | } | ||
376 | |||
377 | #endregion | ||
378 | |||
379 | #region Packet Update Methods | ||
380 | protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) | ||
381 | { | ||
382 | objdata.PSBlock = new byte[0]; | ||
383 | objdata.ExtraParams = new byte[1]; | ||
384 | objdata.MediaURL = new byte[0]; | ||
385 | objdata.NameValue = new byte[0]; | ||
386 | objdata.Text = new byte[0]; | ||
387 | objdata.TextColor = new byte[4]; | ||
388 | objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
389 | objdata.JointPivot = new LLVector3(0, 0, 0); | ||
390 | objdata.Material = 3; | ||
391 | objdata.TextureAnim = new byte[0]; | ||
392 | objdata.Sound = LLUUID.Zero; | ||
393 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
394 | this.primData.Texture = objdata.TextureEntry = ntex.ToBytes(); | ||
395 | objdata.State = 0; | ||
396 | objdata.Data = new byte[0]; | ||
397 | |||
398 | objdata.ObjectData = new byte[60]; | ||
399 | objdata.ObjectData[46] = 128; | ||
400 | objdata.ObjectData[47] = 63; | ||
401 | } | ||
402 | |||
403 | protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) | ||
404 | { | ||
405 | objectData.OwnerID = this.primData.OwnerID; | ||
406 | objectData.PCode = this.primData.PCode; | ||
407 | objectData.PathBegin = this.primData.PathBegin; | ||
408 | objectData.PathEnd = this.primData.PathEnd; | ||
409 | objectData.PathScaleX = this.primData.PathScaleX; | ||
410 | objectData.PathScaleY = this.primData.PathScaleY; | ||
411 | objectData.PathShearX = this.primData.PathShearX; | ||
412 | objectData.PathShearY = this.primData.PathShearY; | ||
413 | objectData.PathSkew = this.primData.PathSkew; | ||
414 | objectData.ProfileBegin = this.primData.ProfileBegin; | ||
415 | objectData.ProfileEnd = this.primData.ProfileEnd; | ||
416 | objectData.Scale = this.primData.Scale; | ||
417 | objectData.PathCurve = this.primData.PathCurve; | ||
418 | objectData.ProfileCurve = this.primData.ProfileCurve; | ||
419 | objectData.ParentID = this.primData.ParentID; | ||
420 | objectData.ProfileHollow = this.primData.ProfileHollow; | ||
421 | objectData.PathRadiusOffset = this.primData.PathRadiusOffset; | ||
422 | objectData.PathRevolutions = this.primData.PathRevolutions; | ||
423 | objectData.PathTaperX = this.primData.PathTaperX; | ||
424 | objectData.PathTaperY = this.primData.PathTaperY; | ||
425 | objectData.PathTwist = this.primData.PathTwist; | ||
426 | objectData.PathTwistBegin = this.primData.PathTwistBegin; | ||
427 | } | ||
428 | |||
429 | #endregion | ||
430 | protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock() | ||
431 | { | ||
432 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | ||
433 | this.SetDefaultPacketValues(objupdate); | ||
434 | objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
435 | this.SetPacketShapeData(objupdate); | ||
436 | byte[] pb = this.Pos.GetBytes(); | ||
437 | Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); | ||
438 | return objupdate; | ||
439 | } | ||
440 | |||
441 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
442 | { | ||
443 | uint ID = this.localid; | ||
444 | byte[] bytes = new byte[60]; | ||
445 | |||
446 | int i = 0; | ||
447 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
448 | dat.TextureEntry = new byte[0]; | ||
449 | bytes[i++] = (byte)(ID % 256); | ||
450 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
451 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
452 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
453 | bytes[i++] = 0; | ||
454 | bytes[i++] = 0; | ||
455 | |||
456 | LLVector3 lPos; | ||
457 | Axiom.MathLib.Quaternion lRot; | ||
458 | if (this._physActor != null && this.physicsEnabled) | ||
459 | { | ||
460 | PhysicsVector pPos = this._physActor.Position; | ||
461 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
462 | lRot = this._physActor.Orientation; | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | lPos = this.Pos; | ||
467 | lRot = this.rotation; | ||
468 | } | ||
469 | byte[] pb = lPos.GetBytes(); | ||
470 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
471 | i += 12; | ||
472 | ushort ac = 32767; | ||
473 | |||
474 | //vel | ||
475 | bytes[i++] = (byte)(ac % 256); | ||
476 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
477 | bytes[i++] = (byte)(ac % 256); | ||
478 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
479 | bytes[i++] = (byte)(ac % 256); | ||
480 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
481 | |||
482 | //accel | ||
483 | bytes[i++] = (byte)(ac % 256); | ||
484 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
485 | bytes[i++] = (byte)(ac % 256); | ||
486 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
487 | bytes[i++] = (byte)(ac % 256); | ||
488 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
489 | |||
490 | ushort rw, rx, ry, rz; | ||
491 | rw = (ushort)(32768 * (lRot.w + 1)); | ||
492 | rx = (ushort)(32768 * (lRot.x + 1)); | ||
493 | ry = (ushort)(32768 * (lRot.y + 1)); | ||
494 | rz = (ushort)(32768 * (lRot.z + 1)); | ||
495 | |||
496 | //rot | ||
497 | bytes[i++] = (byte)(rx % 256); | ||
498 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
499 | bytes[i++] = (byte)(ry % 256); | ||
500 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
501 | bytes[i++] = (byte)(rz % 256); | ||
502 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
503 | bytes[i++] = (byte)(rw % 256); | ||
504 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
505 | |||
506 | //rotation vel | ||
507 | bytes[i++] = (byte)(ac % 256); | ||
508 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
509 | bytes[i++] = (byte)(ac % 256); | ||
510 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
511 | bytes[i++] = (byte)(ac % 256); | ||
512 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
513 | |||
514 | dat.Data = bytes; | ||
515 | return dat; | ||
516 | } | ||
517 | } | ||
518 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/SceneObject.cs b/OpenSim/OpenSim.RegionServer/world/SceneObject.cs deleted file mode 100644 index 73adf87..0000000 --- a/OpenSim/OpenSim.RegionServer/world/SceneObject.cs +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.types; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Physics.Manager; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | |||
39 | namespace OpenSim.world | ||
40 | { | ||
41 | public class SceneObject : Entity | ||
42 | { | ||
43 | private LLUUID rootUUID; | ||
44 | private Dictionary<LLUUID, Primitive2> ChildPrimitives = new Dictionary<LLUUID, Primitive2>(); | ||
45 | private Dictionary<uint, ClientView> m_clientThreads; | ||
46 | private World m_world; | ||
47 | |||
48 | public SceneObject() | ||
49 | { | ||
50 | |||
51 | } | ||
52 | |||
53 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) | ||
54 | { | ||
55 | } | ||
56 | |||
57 | public void CreateFromBytes(byte[] data) | ||
58 | { | ||
59 | |||
60 | } | ||
61 | |||
62 | public override void update() | ||
63 | { | ||
64 | |||
65 | } | ||
66 | |||
67 | public override void BackUp() | ||
68 | { | ||
69 | |||
70 | } | ||
71 | |||
72 | public void GetProperites(ClientView client) | ||
73 | { | ||
74 | /* | ||
75 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
76 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
77 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
78 | proper.ObjectData[0].ItemID = LLUUID.Zero; | ||
79 | proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; | ||
80 | proper.ObjectData[0].CreatorID = this.primData.OwnerID; | ||
81 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
82 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
83 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
84 | proper.ObjectData[0].InventorySerial = 0; | ||
85 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
86 | proper.ObjectData[0].ObjectID = this.uuid; | ||
87 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
88 | proper.ObjectData[0].TouchName = new byte[0]; | ||
89 | proper.ObjectData[0].TextureID = new byte[0]; | ||
90 | proper.ObjectData[0].SitName = new byte[0]; | ||
91 | proper.ObjectData[0].Name = new byte[0]; | ||
92 | proper.ObjectData[0].Description = new byte[0]; | ||
93 | proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; | ||
94 | proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; | ||
95 | proper.ObjectData[0].GroupMask = this.primData.GroupMask; | ||
96 | proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; | ||
97 | proper.ObjectData[0].BaseMask = this.primData.BaseMask; | ||
98 | |||
99 | client.OutPacket(proper); | ||
100 | * */ | ||
101 | } | ||
102 | |||
103 | } | ||
104 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs deleted file mode 100644 index d2abec2..0000000 --- a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs +++ /dev/null | |||
@@ -1,449 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.Physics.Manager; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Terrain; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | using OpenSim.Assets; | ||
40 | using OpenSim.RegionServer.world; | ||
41 | |||
42 | namespace OpenSim.world | ||
43 | { | ||
44 | public partial class World | ||
45 | { | ||
46 | public void ModifyTerrain(byte action, float north, float west) | ||
47 | { | ||
48 | switch (action) | ||
49 | { | ||
50 | case 1: | ||
51 | // raise terrain | ||
52 | Terrain.raise(north, west, 10.0, 0.001); | ||
53 | RegenerateTerrain(true, (int)north, (int)west); | ||
54 | break; | ||
55 | case 2: | ||
56 | //lower terrain | ||
57 | Terrain.lower(north, west, 10.0, 0.001); | ||
58 | RegenerateTerrain(true, (int)north, (int)west); | ||
59 | break; | ||
60 | } | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | ||
65 | { | ||
66 | foreach (ClientView client in m_clientThreads.Values) | ||
67 | { | ||
68 | // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
69 | int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); | ||
70 | |||
71 | switch (type) | ||
72 | { | ||
73 | case 0: // Whisper | ||
74 | if ((dis < 10) && (dis > -10)) | ||
75 | { | ||
76 | //should change so the message is sent through the avatar rather than direct to the ClientView | ||
77 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
78 | } | ||
79 | break; | ||
80 | case 1: // Say | ||
81 | if ((dis < 30) && (dis > -30)) | ||
82 | { | ||
83 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
84 | } | ||
85 | break; | ||
86 | case 2: // Shout | ||
87 | if ((dis < 100) && (dis > -100)) | ||
88 | { | ||
89 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
90 | } | ||
91 | break; | ||
92 | |||
93 | case 0xff: // Broadcast | ||
94 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
95 | break; | ||
96 | } | ||
97 | |||
98 | } | ||
99 | } | ||
100 | |||
101 | public void RezObject(AssetBase primAsset, LLVector3 pos) | ||
102 | { | ||
103 | PrimData primd = new PrimData(primAsset.Data); | ||
104 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
105 | nPrim.CreateFromStorage(primd, pos, this._primCount, true); | ||
106 | this.Entities.Add(nPrim.uuid, nPrim); | ||
107 | this._primCount++; | ||
108 | } | ||
109 | |||
110 | public void DeRezObject(Packet packet, ClientView simClient) | ||
111 | { | ||
112 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | ||
113 | |||
114 | //Needs to delete object from physics at a later date | ||
115 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | ||
116 | { | ||
117 | //currently following code not used (or don't know of any case of destination being zero | ||
118 | libsecondlife.LLUUID[] DeRezEnts; | ||
119 | DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length]; | ||
120 | int i = 0; | ||
121 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | ||
122 | { | ||
123 | |||
124 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | ||
125 | foreach (Entity ent in this.Entities.Values) | ||
126 | { | ||
127 | if (ent.localid == Data.ObjectLocalID) | ||
128 | { | ||
129 | DeRezEnts[i++] = ent.uuid; | ||
130 | this.localStorage.RemovePrim(ent.uuid); | ||
131 | KillObjectPacket kill = new KillObjectPacket(); | ||
132 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
133 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
134 | kill.ObjectData[0].ID = ent.localid; | ||
135 | foreach (ClientView client in m_clientThreads.Values) | ||
136 | { | ||
137 | client.OutPacket(kill); | ||
138 | } | ||
139 | //Uncommenting this means an old UUID will be re-used, thus crashing the asset server | ||
140 | //Uncomment when prim/object UUIDs are random or such | ||
141 | //2007-03-22 - Randomskk | ||
142 | //this._primCount--; | ||
143 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Deleted UUID " + ent.uuid); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | foreach (libsecondlife.LLUUID uuid in DeRezEnts) | ||
148 | { | ||
149 | lock (Entities) | ||
150 | { | ||
151 | Entities.Remove(uuid); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | ||
158 | { | ||
159 | Entity selectedEnt = null; | ||
160 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | ||
161 | foreach (Entity ent in this.Entities.Values) | ||
162 | { | ||
163 | if (ent.localid == Data.ObjectLocalID) | ||
164 | { | ||
165 | AssetBase primAsset = new AssetBase(); | ||
166 | primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid | ||
167 | primAsset.InvType = 6; | ||
168 | primAsset.Type = 6; | ||
169 | primAsset.Name = "Prim"; | ||
170 | primAsset.Description = ""; | ||
171 | primAsset.Data = ((Primitive)ent).GetByteArray(); | ||
172 | this._assetCache.AddAsset(primAsset); | ||
173 | this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); | ||
174 | selectedEnt = ent; | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | if (selectedEnt != null) | ||
179 | { | ||
180 | this.localStorage.RemovePrim(selectedEnt.uuid); | ||
181 | KillObjectPacket kill = new KillObjectPacket(); | ||
182 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
183 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
184 | kill.ObjectData[0].ID = selectedEnt.localid; | ||
185 | foreach (ClientView client in m_clientThreads.Values) | ||
186 | { | ||
187 | client.OutPacket(kill); | ||
188 | } | ||
189 | lock (Entities) | ||
190 | { | ||
191 | Entities.Remove(selectedEnt.uuid); | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | |||
197 | } | ||
198 | |||
199 | public void SendAvatarsToClient(ClientView remoteClient) | ||
200 | { | ||
201 | foreach (ClientView client in m_clientThreads.Values) | ||
202 | { | ||
203 | if (client.AgentID != remoteClient.AgentID) | ||
204 | { | ||
205 | // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); | ||
206 | // RemoteClient.OutPacket(objupdate); | ||
207 | client.ClientAvatar.SendUpdateToOtherClient(remoteClient.ClientAvatar); | ||
208 | client.ClientAvatar.SendAppearanceToOtherAgent(remoteClient.ClientAvatar); | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | public void LinkObjects(uint parentPrim, List<uint> childPrims) | ||
214 | { | ||
215 | Primitive parentprim = null; | ||
216 | foreach (Entity ent in Entities.Values) | ||
217 | { | ||
218 | if (ent.localid == parentPrim) | ||
219 | { | ||
220 | parentprim = (OpenSim.world.Primitive)ent; | ||
221 | |||
222 | } | ||
223 | } | ||
224 | |||
225 | for (int i = 0; i < childPrims.Count; i++) | ||
226 | { | ||
227 | uint childId = childPrims[i]; | ||
228 | foreach (Entity ent in Entities.Values) | ||
229 | { | ||
230 | if (ent.localid == childId) | ||
231 | { | ||
232 | ((OpenSim.world.Primitive)ent).MakeParent(parentprim); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | } | ||
238 | |||
239 | public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) | ||
240 | { | ||
241 | foreach (Entity ent in Entities.Values) | ||
242 | { | ||
243 | if (ent.localid == primLocalID) | ||
244 | { | ||
245 | ((OpenSim.world.Primitive)ent).UpdateShape(shapeBlock); | ||
246 | break; | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | |||
251 | public void SelectPrim(uint primLocalID, ClientView remoteClient) | ||
252 | { | ||
253 | foreach (Entity ent in Entities.Values) | ||
254 | { | ||
255 | if (ent.localid == primLocalID) | ||
256 | { | ||
257 | ((OpenSim.world.Primitive)ent).GetProperites(remoteClient); | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | |||
263 | public void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient) | ||
264 | { | ||
265 | foreach (Entity ent in Entities.Values) | ||
266 | { | ||
267 | if (ent.localid == localID) | ||
268 | { | ||
269 | ((OpenSim.world.Primitive)ent).UpdateObjectFlags((ObjectFlagUpdatePacket) packet); | ||
270 | break; | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | |||
275 | public void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient) | ||
276 | { | ||
277 | foreach (Entity ent in Entities.Values) | ||
278 | { | ||
279 | if (ent.localid == localID) | ||
280 | { | ||
281 | ((OpenSim.world.Primitive)ent).UpdateTexture(texture); | ||
282 | break; | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | |||
287 | public void UpdatePrimPosition(uint localID, LLVector3 pos, ClientView remoteClient) | ||
288 | { | ||
289 | foreach (Entity ent in Entities.Values) | ||
290 | { | ||
291 | if (ent.localid == localID) | ||
292 | { | ||
293 | ((OpenSim.world.Primitive)ent).UpdatePosition(pos); | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
299 | public void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient) | ||
300 | { | ||
301 | foreach (Entity ent in Entities.Values) | ||
302 | { | ||
303 | if (ent.localid == localID) | ||
304 | { | ||
305 | ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | ||
306 | ((OpenSim.world.Primitive)ent).UpdateFlag = true; | ||
307 | break; | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
312 | public void UpdatePrimScale(uint localID, LLVector3 scale, ClientView remoteClient) | ||
313 | { | ||
314 | foreach (Entity ent in Entities.Values) | ||
315 | { | ||
316 | if (ent.localid == localID) | ||
317 | { | ||
318 | ((OpenSim.world.Primitive)ent).Scale = scale; | ||
319 | break; | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | #region Parcel Packet Handlers | ||
324 | void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client) | ||
325 | { | ||
326 | //Get the parcels within the bounds | ||
327 | List<OpenSim.RegionServer.world.Parcel> temp = new List<OpenSim.RegionServer.world.Parcel>(); | ||
328 | int x, y, i; | ||
329 | int inc_x = end_x - start_x; | ||
330 | int inc_y = end_y - start_y; | ||
331 | for(x = 0; x < inc_x; x++) | ||
332 | { | ||
333 | for(y = 0; y < inc_y; y++) | ||
334 | { | ||
335 | OpenSim.RegionServer.world.Parcel currentParcel = parcelManager.getParcel(start_x + x, start_y + y); | ||
336 | if(!temp.Contains(currentParcel)) | ||
337 | { | ||
338 | currentParcel. | ||
339 | forceUpdateParcelInfo(); | ||
340 | temp.Add(currentParcel); | ||
341 | } | ||
342 | } | ||
343 | } | ||
344 | |||
345 | int requestResult = OpenSim.RegionServer.world.ParcelManager.PARCEL_RESULT_ONE_PARCEL; | ||
346 | if (temp.Count > 1) | ||
347 | { | ||
348 | requestResult = OpenSim.RegionServer.world.ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; | ||
349 | } | ||
350 | |||
351 | for (i = 0; i < temp.Count; i++) | ||
352 | { | ||
353 | temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); | ||
354 | } | ||
355 | |||
356 | |||
357 | parcelManager.sendParcelOverlay(remote_client); | ||
358 | } | ||
359 | |||
360 | void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client) | ||
361 | { | ||
362 | parcelManager.subdivide(west, south, east, north, remote_client.AgentID); | ||
363 | } | ||
364 | void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client) | ||
365 | { | ||
366 | parcelManager.join(west, south, east, north, remote_client.AgentID); | ||
367 | } | ||
368 | void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, ClientView remote_client) | ||
369 | { | ||
370 | if (parcelManager.parcelList.ContainsKey(packet.ParcelData.LocalID)) | ||
371 | { | ||
372 | parcelManager.parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); | ||
373 | } | ||
374 | } | ||
375 | #endregion | ||
376 | |||
377 | /* | ||
378 | public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY) | ||
379 | { | ||
380 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
381 | if (((m_regInfo.RegionLocX > minX) && (m_regInfo.RegionLocX < maxX)) && ((m_regInfo.RegionLocY > minY) && (m_regInfo.RegionLocY < maxY))) | ||
382 | { | ||
383 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); | ||
384 | mapReply.AgentData.AgentID = simClient.AgentID; | ||
385 | mapReply.AgentData.Flags = 0; | ||
386 | mapReply.Data = new MapBlockReplyPacket.DataBlock[1]; | ||
387 | mapReply.Data[0] = new MapBlockReplyPacket.DataBlock(); | ||
388 | mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000007"); | ||
389 | mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX; | ||
390 | mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY; | ||
391 | mapReply.Data[0].WaterHeight = (byte)m_regInfo.RegionWaterHeight; | ||
392 | mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName); | ||
393 | mapReply.Data[0].RegionFlags = 72458694; | ||
394 | mapReply.Data[0].Access = 13; | ||
395 | mapReply.Data[0].Agents = 1; //should send number of clients connected | ||
396 | simClient.OutPacket(mapReply); | ||
397 | } | ||
398 | } | ||
399 | public bool RezObjectHandler(ClientView simClient, Packet packet) | ||
400 | { | ||
401 | RezObjectPacket rezPacket = (RezObjectPacket)packet; | ||
402 | AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID); | ||
403 | if (inven != null) | ||
404 | { | ||
405 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) | ||
406 | { | ||
407 | AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); | ||
408 | if (asset != null) | ||
409 | { | ||
410 | PrimData primd = new PrimData(asset.Data); | ||
411 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
412 | nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true); | ||
413 | this.Entities.Add(nPrim.uuid, nPrim); | ||
414 | this._primCount++; | ||
415 | this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID); | ||
416 | } | ||
417 | } | ||
418 | } | ||
419 | return true; | ||
420 | } | ||
421 | public bool ModifyTerrain(ClientView simClient, Packet packet) | ||
422 | { | ||
423 | ModifyLandPacket modify = (ModifyLandPacket)packet; | ||
424 | |||
425 | switch (modify.ModifyBlock.Action) | ||
426 | { | ||
427 | case 1: | ||
428 | // raise terrain | ||
429 | if (modify.ParcelData.Length > 0) | ||
430 | { | ||
431 | Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1); | ||
432 | RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West); | ||
433 | } | ||
434 | break; | ||
435 | case 2: | ||
436 | //lower terrain | ||
437 | if (modify.ParcelData.Length > 0) | ||
438 | { | ||
439 | Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1); | ||
440 | RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West); | ||
441 | } | ||
442 | break; | ||
443 | } | ||
444 | return true; | ||
445 | } | ||
446 | */ | ||
447 | |||
448 | } | ||
449 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/World.Scripting.cs b/OpenSim/OpenSim.RegionServer/world/World.Scripting.cs deleted file mode 100644 index 0972168..0000000 --- a/OpenSim/OpenSim.RegionServer/world/World.Scripting.cs +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using libsecondlife; | ||
37 | |||
38 | namespace OpenSim.world | ||
39 | { | ||
40 | public partial class World | ||
41 | { | ||
42 | private Dictionary<string, IScriptEngine> scriptEngines = new Dictionary<string, IScriptEngine>(); | ||
43 | |||
44 | private void LoadScriptEngines() | ||
45 | { | ||
46 | this.LoadScriptPlugins(); | ||
47 | } | ||
48 | |||
49 | public void LoadScriptPlugins() | ||
50 | { | ||
51 | string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); | ||
52 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | ||
53 | |||
54 | |||
55 | for (int i = 0; i < pluginFiles.Length; i++) | ||
56 | { | ||
57 | this.AddPlugin(pluginFiles[i]); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | private void AddPlugin(string FileName) | ||
62 | { | ||
63 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
64 | |||
65 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
66 | { | ||
67 | if (pluginType.IsPublic) | ||
68 | { | ||
69 | if (!pluginType.IsAbstract) | ||
70 | { | ||
71 | Type typeInterface = pluginType.GetInterface("IScriptEngine", true); | ||
72 | |||
73 | if (typeInterface != null) | ||
74 | { | ||
75 | IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
76 | plug.Init(this); | ||
77 | this.scriptEngines.Add(plug.GetName(), plug); | ||
78 | |||
79 | } | ||
80 | |||
81 | typeInterface = null; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | pluginAssembly = null; | ||
87 | } | ||
88 | |||
89 | public void LoadScript(string scriptType, string scriptName, string script, Entity ent) | ||
90 | { | ||
91 | if(this.scriptEngines.ContainsKey(scriptType)) | ||
92 | { | ||
93 | this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.localid); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | #region IScriptAPI Methods | ||
98 | |||
99 | public OSVector3 GetEntityPosition(uint localID) | ||
100 | { | ||
101 | OSVector3 res = new OSVector3(); | ||
102 | // Console.WriteLine("script- getting entity " + localID + " position"); | ||
103 | foreach (Entity entity in this.Entities.Values) | ||
104 | { | ||
105 | if (entity.localid == localID) | ||
106 | { | ||
107 | res.X = entity.Pos.X; | ||
108 | res.Y = entity.Pos.Y; | ||
109 | res.Z = entity.Pos.Z; | ||
110 | } | ||
111 | } | ||
112 | return res; | ||
113 | } | ||
114 | |||
115 | public void SetEntityPosition(uint localID, float x , float y, float z) | ||
116 | { | ||
117 | foreach (Entity entity in this.Entities.Values) | ||
118 | { | ||
119 | if (entity.localid == localID && entity is Primitive) | ||
120 | { | ||
121 | LLVector3 pos = entity.Pos; | ||
122 | pos.X = x; | ||
123 | pos.Y = y; | ||
124 | Primitive prim = entity as Primitive; | ||
125 | // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. | ||
126 | prim.UpdatePosition(pos); | ||
127 | // Console.WriteLine("script- setting entity " + localID + " positon"); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | } | ||
132 | |||
133 | public uint GetRandomAvatarID() | ||
134 | { | ||
135 | //Console.WriteLine("script- getting random avatar id"); | ||
136 | uint res = 0; | ||
137 | foreach (Entity entity in this.Entities.Values) | ||
138 | { | ||
139 | if (entity is Avatar) | ||
140 | { | ||
141 | res = entity.localid; | ||
142 | } | ||
143 | } | ||
144 | return res; | ||
145 | } | ||
146 | |||
147 | #endregion | ||
148 | |||
149 | |||
150 | } | ||
151 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs deleted file mode 100644 index 69f3fda..0000000 --- a/OpenSim/OpenSim.RegionServer/world/World.cs +++ /dev/null | |||
@@ -1,734 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | using libsecondlife.Packets; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using OpenSim.Physics.Manager; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Terrain; | ||
40 | using OpenSim.Framework.Inventory; | ||
41 | using OpenSim.Assets; | ||
42 | //using OpenSim.world.scripting; | ||
43 | using OpenSim.RegionServer.world.scripting; | ||
44 | using OpenSim.Terrain; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim.world | ||
48 | { | ||
49 | public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI | ||
50 | { | ||
51 | public object LockPhysicsEngine = new object(); | ||
52 | public Dictionary<libsecondlife.LLUUID, Avatar> Avatars; | ||
53 | public Dictionary<libsecondlife.LLUUID, Primitive> Prims; | ||
54 | //public ScriptEngine Scripts; | ||
55 | public uint _localNumber = 0; | ||
56 | private PhysicsScene phyScene; | ||
57 | private float timeStep = 0.1f; | ||
58 | public ILocalStorage localStorage; | ||
59 | private Random Rand = new Random(); | ||
60 | private uint _primCount = 702000; | ||
61 | private int storageCount; | ||
62 | private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers; | ||
63 | private Dictionary<string, ScriptFactory> m_scripts; | ||
64 | private Mutex updateLock; | ||
65 | public string m_datastore; | ||
66 | public OpenSim.RegionServer.world.ParcelManager parcelManager; | ||
67 | |||
68 | #region Properties | ||
69 | public PhysicsScene PhysScene | ||
70 | { | ||
71 | set | ||
72 | { | ||
73 | this.phyScene = value; | ||
74 | } | ||
75 | get | ||
76 | { | ||
77 | return (this.phyScene); | ||
78 | } | ||
79 | } | ||
80 | #endregion | ||
81 | |||
82 | #region Constructors | ||
83 | /// <summary> | ||
84 | /// Creates a new World class, and a region to go with it. | ||
85 | /// </summary> | ||
86 | /// <param name="clientThreads">Dictionary to contain client threads</param> | ||
87 | /// <param name="regionHandle">Region Handle for this region</param> | ||
88 | /// <param name="regionName">Region Name for this region</param> | ||
89 | public World(Dictionary<uint, ClientView> clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName) | ||
90 | { | ||
91 | try | ||
92 | { | ||
93 | updateLock = new Mutex(false); | ||
94 | m_clientThreads = clientThreads; | ||
95 | m_regionHandle = regionHandle; | ||
96 | m_regionName = regionName; | ||
97 | m_regInfo = regInfo; | ||
98 | |||
99 | m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); | ||
100 | m_scripts = new Dictionary<string, ScriptFactory>(); | ||
101 | |||
102 | MainConsole.Instance.Notice("World.cs - creating new entitities instance"); | ||
103 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | ||
104 | Avatars = new Dictionary<LLUUID, Avatar>(); | ||
105 | Prims = new Dictionary<LLUUID, Primitive>(); | ||
106 | |||
107 | MainConsole.Instance.Notice("World.cs - creating LandMap"); | ||
108 | TerrainManager = new TerrainManager(new SecondLife()); | ||
109 | Terrain = new TerrainEngine(); | ||
110 | Avatar.SetupTemplate("avatar-texture.dat"); | ||
111 | // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); | ||
112 | // Initialise this only after the world has loaded | ||
113 | // Scripts = new ScriptEngine(this); | ||
114 | Avatar.LoadAnims(); | ||
115 | this.SetDefaultScripts(); | ||
116 | this.LoadScriptEngines(); | ||
117 | |||
118 | } | ||
119 | catch (Exception e) | ||
120 | { | ||
121 | OpenSim.Framework.Console.MainConsole.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); | ||
122 | } | ||
123 | } | ||
124 | #endregion | ||
125 | |||
126 | #region Script Methods | ||
127 | /// <summary> | ||
128 | /// Loads a new script into the specified entity | ||
129 | /// </summary> | ||
130 | /// <param name="entity">Entity to be scripted</param> | ||
131 | /// <param name="script">The script to load</param> | ||
132 | public void AddScript(Entity entity, Script script) | ||
133 | { | ||
134 | try | ||
135 | { | ||
136 | ScriptHandler scriptHandler = new ScriptHandler(script, entity, this); | ||
137 | m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler); | ||
138 | } | ||
139 | catch (Exception e) | ||
140 | { | ||
141 | MainConsole.Instance.Warn("World.cs: AddScript() - Failed with exception " + e.ToString()); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /// <summary> | ||
146 | /// Loads a new script into the specified entity, using a script loaded from a string. | ||
147 | /// </summary> | ||
148 | /// <param name="entity">The entity to be scripted</param> | ||
149 | /// <param name="scriptData">The string containing the script</param> | ||
150 | public void AddScript(Entity entity, string scriptData) | ||
151 | { | ||
152 | try | ||
153 | { | ||
154 | int scriptstart = 0; | ||
155 | int scriptend = 0; | ||
156 | string substring; | ||
157 | scriptstart = scriptData.LastIndexOf("<Script>"); | ||
158 | scriptend = scriptData.LastIndexOf("</Script>"); | ||
159 | substring = scriptData.Substring(scriptstart + 8, scriptend - scriptstart - 8); | ||
160 | substring = substring.Trim(); | ||
161 | //Console.WriteLine("searching for script to add: " + substring); | ||
162 | |||
163 | ScriptFactory scriptFactory; | ||
164 | //Console.WriteLine("script string is " + substring); | ||
165 | if (substring.StartsWith("<ScriptEngine:")) | ||
166 | { | ||
167 | string substring1 = ""; | ||
168 | string script = ""; | ||
169 | // Console.WriteLine("searching for script engine"); | ||
170 | substring1 = substring.Remove(0, 14); | ||
171 | int dev = substring1.IndexOf(','); | ||
172 | string sEngine = substring1.Substring(0, dev); | ||
173 | substring1 = substring1.Remove(0, dev + 1); | ||
174 | int end = substring1.IndexOf('>'); | ||
175 | string sName = substring1.Substring(0, end); | ||
176 | //Console.WriteLine(" script info : " + sEngine + " , " + sName); | ||
177 | int startscript = substring.IndexOf('>'); | ||
178 | script = substring.Remove(0, startscript + 1); | ||
179 | // Console.WriteLine("script data is " + script); | ||
180 | if (this.scriptEngines.ContainsKey(sEngine)) | ||
181 | { | ||
182 | this.scriptEngines[sEngine].LoadScript(script, sName, entity.localid); | ||
183 | } | ||
184 | } | ||
185 | else if (this.m_scripts.TryGetValue(substring, out scriptFactory)) | ||
186 | { | ||
187 | //Console.WriteLine("added script"); | ||
188 | this.AddScript(entity, scriptFactory()); | ||
189 | } | ||
190 | } | ||
191 | catch (Exception e) | ||
192 | { | ||
193 | MainConsole.Instance.Warn("World.cs: AddScript() - Failed with exception " + e.ToString()); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | #endregion | ||
198 | |||
199 | #region Update Methods | ||
200 | /// <summary> | ||
201 | /// Performs per-frame updates on the world, this should be the central world loop | ||
202 | /// </summary> | ||
203 | public override void Update() | ||
204 | { | ||
205 | updateLock.WaitOne(); | ||
206 | try | ||
207 | { | ||
208 | if (this.phyScene.IsThreaded) | ||
209 | { | ||
210 | this.phyScene.GetResults(); | ||
211 | |||
212 | } | ||
213 | |||
214 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
215 | { | ||
216 | Entities[UUID].addForces(); | ||
217 | } | ||
218 | |||
219 | lock (this.LockPhysicsEngine) | ||
220 | { | ||
221 | this.phyScene.Simulate(timeStep); | ||
222 | } | ||
223 | |||
224 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
225 | { | ||
226 | Entities[UUID].update(); | ||
227 | } | ||
228 | |||
229 | foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) | ||
230 | { | ||
231 | scriptHandler.OnFrame(); | ||
232 | } | ||
233 | foreach (IScriptEngine scripteng in this.scriptEngines.Values) | ||
234 | { | ||
235 | scripteng.OnFrame(); | ||
236 | } | ||
237 | //backup world data | ||
238 | this.storageCount++; | ||
239 | if (storageCount > 1200) //set to how often you want to backup | ||
240 | { | ||
241 | this.Backup(); | ||
242 | storageCount = 0; | ||
243 | } | ||
244 | } | ||
245 | catch (Exception e) | ||
246 | { | ||
247 | MainConsole.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); | ||
248 | } | ||
249 | updateLock.ReleaseMutex(); | ||
250 | } | ||
251 | |||
252 | public bool Backup() | ||
253 | { | ||
254 | try | ||
255 | { | ||
256 | // Terrain backup routines | ||
257 | if (Terrain.tainted > 0) | ||
258 | { | ||
259 | Terrain.tainted = 0; | ||
260 | MainConsole.Instance.Notice("World.cs: Backup() - Terrain tainted, saving."); | ||
261 | localStorage.SaveMap(Terrain.getHeights1D()); | ||
262 | MainConsole.Instance.Notice("World.cs: Backup() - Rebuilding world map image."); | ||
263 | Terrain.exportImage("map_" + m_regInfo.RegionName.ToLower() + ".png", "defaultstripe.png"); | ||
264 | MainConsole.Instance.Notice("World.cs: Backup() - Terrain saved, informing Physics."); | ||
265 | phyScene.SetTerrain(Terrain.getHeights1D()); | ||
266 | |||
267 | // Needs optimising to just send patches which have changed. | ||
268 | MainConsole.Instance.Notice("World.cs: Backup() - Terrain changed, informing Clients."); | ||
269 | foreach (ClientView client in m_clientThreads.Values) | ||
270 | { | ||
271 | this.SendLayerData(client); | ||
272 | } | ||
273 | } | ||
274 | |||
275 | // Primitive backup routines -- should only do if there's been a change. | ||
276 | MainConsole.Instance.Notice("World.cs: Backup() - Backing up Primitives"); | ||
277 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
278 | { | ||
279 | Entities[UUID].BackUp(); | ||
280 | } | ||
281 | |||
282 | |||
283 | //Parcel backup routines. Yay! | ||
284 | ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; | ||
285 | int i = 0; | ||
286 | foreach(OpenSim.RegionServer.world.Parcel parcel in parcelManager.parcelList.Values) | ||
287 | { | ||
288 | parcels[i] = parcel.parcelData; | ||
289 | i++; | ||
290 | } | ||
291 | localStorage.SaveParcels(parcels); | ||
292 | |||
293 | |||
294 | // Backup successful | ||
295 | return true; | ||
296 | } | ||
297 | catch (Exception e) | ||
298 | { | ||
299 | // Backup failed | ||
300 | OpenSim.Framework.Console.MainConsole.Instance.Error("World.cs: Backup() - Backup Failed with exception " + e.ToString()); | ||
301 | return false; | ||
302 | } | ||
303 | } | ||
304 | #endregion | ||
305 | |||
306 | #region Setup Methods | ||
307 | /// <summary> | ||
308 | /// Loads a new storage subsystem from a named library | ||
309 | /// </summary> | ||
310 | /// <param name="dllName">Storage Library</param> | ||
311 | /// <returns>Successful or not</returns> | ||
312 | public bool LoadStorageDLL(string dllName) | ||
313 | { | ||
314 | try | ||
315 | { | ||
316 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
317 | ILocalStorage store = null; | ||
318 | |||
319 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
320 | { | ||
321 | if (pluginType.IsPublic) | ||
322 | { | ||
323 | if (!pluginType.IsAbstract) | ||
324 | { | ||
325 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); | ||
326 | |||
327 | if (typeInterface != null) | ||
328 | { | ||
329 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
330 | store = plug; | ||
331 | |||
332 | store.Initialise(this.m_datastore); | ||
333 | break; | ||
334 | } | ||
335 | |||
336 | typeInterface = null; | ||
337 | } | ||
338 | } | ||
339 | } | ||
340 | pluginAssembly = null; | ||
341 | this.localStorage = store; | ||
342 | return (store == null); | ||
343 | } | ||
344 | catch (Exception e) | ||
345 | { | ||
346 | MainConsole.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); | ||
347 | return false; | ||
348 | } | ||
349 | } | ||
350 | |||
351 | public void SetDefaultScripts() | ||
352 | { | ||
353 | this.m_scripts.Add("FollowRandomAvatar", delegate() | ||
354 | { | ||
355 | return new OpenSim.RegionServer.world.scripting.FollowRandomAvatar(); | ||
356 | }); | ||
357 | } | ||
358 | |||
359 | #endregion | ||
360 | |||
361 | #region Regenerate Terrain | ||
362 | |||
363 | /// <summary> | ||
364 | /// Rebuilds the terrain using a procedural algorithm | ||
365 | /// </summary> | ||
366 | public void RegenerateTerrain() | ||
367 | { | ||
368 | try | ||
369 | { | ||
370 | Terrain.hills(); | ||
371 | |||
372 | lock (this.LockPhysicsEngine) | ||
373 | { | ||
374 | this.phyScene.SetTerrain(Terrain.getHeights1D()); | ||
375 | } | ||
376 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
377 | |||
378 | foreach (ClientView client in m_clientThreads.Values) | ||
379 | { | ||
380 | this.SendLayerData(client); | ||
381 | } | ||
382 | |||
383 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
384 | { | ||
385 | Entities[UUID].LandRenegerated(); | ||
386 | } | ||
387 | } | ||
388 | catch (Exception e) | ||
389 | { | ||
390 | MainConsole.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | /// <summary> | ||
395 | /// Rebuilds the terrain using a 2D float array | ||
396 | /// </summary> | ||
397 | /// <param name="newMap">256,256 float array containing heights</param> | ||
398 | public void RegenerateTerrain(float[,] newMap) | ||
399 | { | ||
400 | try | ||
401 | { | ||
402 | this.Terrain.setHeights2D(newMap); | ||
403 | lock (this.LockPhysicsEngine) | ||
404 | { | ||
405 | this.phyScene.SetTerrain(this.Terrain.getHeights1D()); | ||
406 | } | ||
407 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
408 | |||
409 | foreach (ClientView client in m_clientThreads.Values) | ||
410 | { | ||
411 | this.SendLayerData(client); | ||
412 | } | ||
413 | |||
414 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
415 | { | ||
416 | Entities[UUID].LandRenegerated(); | ||
417 | } | ||
418 | } | ||
419 | catch (Exception e) | ||
420 | { | ||
421 | MainConsole.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); | ||
422 | } | ||
423 | } | ||
424 | |||
425 | /// <summary> | ||
426 | /// Rebuilds the terrain assuming changes occured at a specified point[?] | ||
427 | /// </summary> | ||
428 | /// <param name="changes">???</param> | ||
429 | /// <param name="pointx">???</param> | ||
430 | /// <param name="pointy">???</param> | ||
431 | public void RegenerateTerrain(bool changes, int pointx, int pointy) | ||
432 | { | ||
433 | try | ||
434 | { | ||
435 | if (changes) | ||
436 | { | ||
437 | /* Dont save here, rely on tainting system instead */ | ||
438 | |||
439 | foreach (ClientView client in m_clientThreads.Values) | ||
440 | { | ||
441 | this.SendLayerData(pointx, pointy, client); | ||
442 | } | ||
443 | } | ||
444 | } | ||
445 | catch (Exception e) | ||
446 | { | ||
447 | MainConsole.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | #endregion | ||
452 | |||
453 | #region Load Terrain | ||
454 | /// <summary> | ||
455 | /// Loads the World heightmap | ||
456 | /// </summary> | ||
457 | public override void LoadWorldMap() | ||
458 | { | ||
459 | try | ||
460 | { | ||
461 | float[] map = this.localStorage.LoadWorld(); | ||
462 | if (map == null) | ||
463 | { | ||
464 | if (string.IsNullOrEmpty(this.m_regInfo.TerrainFile)) | ||
465 | { | ||
466 | Console.WriteLine("No default terrain, procedurally generating..."); | ||
467 | this.Terrain.hills(); | ||
468 | |||
469 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | try | ||
474 | { | ||
475 | this.Terrain.loadFromFileF32(this.m_regInfo.TerrainFile); | ||
476 | this.Terrain *= this.m_regInfo.TerrainMultiplier; | ||
477 | } | ||
478 | catch (Exception e) | ||
479 | { | ||
480 | Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); | ||
481 | Terrain.hills(); | ||
482 | } | ||
483 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
484 | } | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | this.Terrain.setHeights1D(map); | ||
489 | } | ||
490 | } | ||
491 | catch (Exception e) | ||
492 | { | ||
493 | MainConsole.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); | ||
494 | } | ||
495 | } | ||
496 | #endregion | ||
497 | |||
498 | #region Primitives Methods | ||
499 | |||
500 | /// <summary> | ||
501 | /// Sends prims to a client | ||
502 | /// </summary> | ||
503 | /// <param name="RemoteClient">Client to send to</param> | ||
504 | public void GetInitialPrims(ClientView RemoteClient) | ||
505 | { | ||
506 | try | ||
507 | { | ||
508 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
509 | { | ||
510 | if (Entities[UUID] is Primitive) | ||
511 | { | ||
512 | Primitive primitive = Entities[UUID] as Primitive; | ||
513 | primitive.UpdateClient(RemoteClient); | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | catch (Exception e) | ||
518 | { | ||
519 | MainConsole.Instance.Warn("World.cs: GetInitialPrims() - Failed with exception " + e.ToString()); | ||
520 | } | ||
521 | } | ||
522 | |||
523 | /// <summary> | ||
524 | /// Loads the World's objects | ||
525 | /// </summary> | ||
526 | public void LoadPrimsFromStorage() | ||
527 | { | ||
528 | try | ||
529 | { | ||
530 | MainConsole.Instance.Notice("World.cs: LoadPrimsFromStorage() - Loading primitives"); | ||
531 | this.localStorage.LoadPrimitives(this); | ||
532 | } | ||
533 | catch (Exception e) | ||
534 | { | ||
535 | MainConsole.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); | ||
536 | } | ||
537 | } | ||
538 | |||
539 | /// <summary> | ||
540 | /// Loads a specific object from storage | ||
541 | /// </summary> | ||
542 | /// <param name="prim">The object to load</param> | ||
543 | public void PrimFromStorage(PrimData prim) | ||
544 | { | ||
545 | try | ||
546 | { | ||
547 | if (prim.LocalID >= this._primCount) | ||
548 | { | ||
549 | _primCount = prim.LocalID + 1; | ||
550 | } | ||
551 | MainConsole.Instance.Notice("World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage"); | ||
552 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
553 | nPrim.CreateFromStorage(prim); | ||
554 | this.Entities.Add(nPrim.uuid, nPrim); | ||
555 | } | ||
556 | catch (Exception e) | ||
557 | { | ||
558 | MainConsole.Instance.Warn("World.cs: PrimFromStorage() - Failed with exception " + e.ToString()); | ||
559 | } | ||
560 | } | ||
561 | |||
562 | public void AddNewPrim(Packet addPacket, ClientView agentClient) | ||
563 | { | ||
564 | AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentID); | ||
565 | } | ||
566 | |||
567 | public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) | ||
568 | { | ||
569 | try | ||
570 | { | ||
571 | MainConsole.Instance.Notice("World.cs: AddNewPrim() - Creating new prim"); | ||
572 | Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
573 | prim.CreateFromPacket(addPacket, ownerID, this._primCount); | ||
574 | PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z); | ||
575 | PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); | ||
576 | if (OpenSim.world.Avatar.PhysicsEngineFlying) | ||
577 | { | ||
578 | lock (this.LockPhysicsEngine) | ||
579 | { | ||
580 | prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); | ||
581 | } | ||
582 | } | ||
583 | |||
584 | this.Entities.Add(prim.uuid, prim); | ||
585 | this._primCount++; | ||
586 | } | ||
587 | catch (Exception e) | ||
588 | { | ||
589 | MainConsole.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | #endregion | ||
594 | |||
595 | #region Add/Remove Avatar Methods | ||
596 | |||
597 | public override Avatar AddViewerAgent(ClientView agentClient) | ||
598 | { | ||
599 | //register for events | ||
600 | agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); | ||
601 | agentClient.OnRezObject += new RezObject(this.RezObject); | ||
602 | agentClient.OnModifyTerrain += new ModifyTerrain(this.ModifyTerrain); | ||
603 | agentClient.OnRegionHandShakeReply += new ClientView.GenericCall(this.SendLayerData); | ||
604 | agentClient.OnRequestWearables += new ClientView.GenericCall(this.GetInitialPrims); | ||
605 | agentClient.OnRequestAvatarsData += new ClientView.GenericCall(this.SendAvatarsToClient); | ||
606 | agentClient.OnLinkObjects += new LinkObjects(this.LinkObjects); | ||
607 | agentClient.OnAddPrim += new ClientView.GenericCall4(this.AddNewPrim); | ||
608 | agentClient.OnUpdatePrimShape += new ClientView.UpdateShape(this.UpdatePrimShape); | ||
609 | |||
610 | agentClient.OnObjectSelect += new ClientView.ObjectSelect(this.SelectPrim); | ||
611 | agentClient.OnUpdatePrimFlags += new ClientView.UpdatePrimFlags(this.UpdatePrimFlags); | ||
612 | agentClient.OnUpdatePrimTexture += new ClientView.UpdatePrimTexture(this.UpdatePrimTexture); | ||
613 | agentClient.OnUpdatePrimPosition += new ClientView.UpdatePrimVector(this.UpdatePrimPosition); | ||
614 | agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); | ||
615 | agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); | ||
616 | agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); | ||
617 | |||
618 | agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest); | ||
619 | agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.world.ParcelDivideRequest(ParcelDivideRequest); | ||
620 | agentClient.OnParcelJoinRequest+=new OpenSim.RegionServer.world.ParcelJoinRequest(ParcelJoinRequest); | ||
621 | agentClient.OnParcelPropertiesUpdateRequest += new OpenSim.RegionServer.world.ParcelPropertiesUpdateRequest(ParcelPropertiesUpdateRequest); | ||
622 | Avatar newAvatar = null; | ||
623 | try | ||
624 | { | ||
625 | MainConsole.Instance.Notice("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | ||
626 | newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); | ||
627 | MainConsole.Instance.Notice("World.cs:AddViewerAgent() - Adding new avatar to world"); | ||
628 | MainConsole.Instance.Notice("World.cs:AddViewerAgent() - Starting RegionHandshake "); | ||
629 | newAvatar.SendRegionHandshake(this); | ||
630 | //if (!agentClient.m_child) | ||
631 | //{ | ||
632 | |||
633 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); | ||
634 | lock (this.LockPhysicsEngine) | ||
635 | { | ||
636 | newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | ||
637 | } | ||
638 | // } | ||
639 | lock (Entities) | ||
640 | { | ||
641 | if (!Entities.ContainsKey(agentClient.AgentID)) | ||
642 | { | ||
643 | this.Entities.Add(agentClient.AgentID, newAvatar); | ||
644 | } | ||
645 | else | ||
646 | { | ||
647 | Entities[agentClient.AgentID] = newAvatar; | ||
648 | } | ||
649 | } | ||
650 | lock (Avatars) | ||
651 | { | ||
652 | if (Avatars.ContainsKey(agentClient.AgentID)) | ||
653 | { | ||
654 | Avatars[agentClient.AgentID] = newAvatar; | ||
655 | } | ||
656 | else | ||
657 | { | ||
658 | this.Avatars.Add(agentClient.AgentID, newAvatar); | ||
659 | } | ||
660 | } | ||
661 | } | ||
662 | catch (Exception e) | ||
663 | { | ||
664 | MainConsole.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); | ||
665 | } | ||
666 | return newAvatar; | ||
667 | } | ||
668 | |||
669 | |||
670 | |||
671 | |||
672 | |||
673 | |||
674 | |||
675 | public override void RemoveViewerAgent(ClientView agentClient) | ||
676 | { | ||
677 | try | ||
678 | { | ||
679 | lock (Entities) | ||
680 | { | ||
681 | Entities.Remove(agentClient.AgentID); | ||
682 | } | ||
683 | lock (Avatars) | ||
684 | { | ||
685 | Avatars.Remove(agentClient.AgentID); | ||
686 | } | ||
687 | if (agentClient.ClientAvatar.PhysActor != null) | ||
688 | { | ||
689 | this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor); | ||
690 | } | ||
691 | } | ||
692 | catch (Exception e) | ||
693 | { | ||
694 | MainConsole.Instance.Warn("World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString()); | ||
695 | } | ||
696 | } | ||
697 | #endregion | ||
698 | |||
699 | #region Request Avatars List Methods | ||
700 | //The idea is to have a group of method that return a list of avatars meeting some requirement | ||
701 | // ie it could be all Avatars within a certain range of the calling prim/avatar. | ||
702 | |||
703 | public List<Avatar> RequestAvatarList() | ||
704 | { | ||
705 | List<Avatar> result = new List<Avatar>(); | ||
706 | |||
707 | foreach (Avatar avatar in Avatars.Values) | ||
708 | { | ||
709 | result.Add(avatar); | ||
710 | } | ||
711 | |||
712 | return result; | ||
713 | } | ||
714 | #endregion | ||
715 | |||
716 | #region ShutDown | ||
717 | /// <summary> | ||
718 | /// Tidy before shutdown | ||
719 | /// </summary> | ||
720 | public override void Close() | ||
721 | { | ||
722 | try | ||
723 | { | ||
724 | this.localStorage.ShutDown(); | ||
725 | } | ||
726 | catch (Exception e) | ||
727 | { | ||
728 | OpenSim.Framework.Console.MainConsole.Instance.Error("World.cs: Close() - Failed with exception " + e.ToString()); | ||
729 | } | ||
730 | } | ||
731 | #endregion | ||
732 | |||
733 | } | ||
734 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs b/OpenSim/OpenSim.RegionServer/world/WorldBase.cs deleted file mode 100644 index 4050c09..0000000 --- a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs +++ /dev/null | |||
@@ -1,204 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | using libsecondlife.Packets; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using OpenSim.Physics.Manager; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Terrain; | ||
40 | using OpenSim.Framework.Inventory; | ||
41 | using OpenSim.Assets; | ||
42 | using OpenSim.RegionServer.world.scripting; | ||
43 | using OpenSim.Terrain; | ||
44 | using OpenSim.Framework.Console; | ||
45 | |||
46 | namespace OpenSim.world | ||
47 | { | ||
48 | public class WorldBase | ||
49 | { | ||
50 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | ||
51 | protected Dictionary<uint, ClientView> m_clientThreads; | ||
52 | protected ulong m_regionHandle; | ||
53 | protected string m_regionName; | ||
54 | protected InventoryCache _inventoryCache; | ||
55 | protected AssetCache _assetCache; | ||
56 | public RegionInfo m_regInfo; | ||
57 | |||
58 | public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. | ||
59 | protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine | ||
60 | |||
61 | #region Properties | ||
62 | public InventoryCache InventoryCache | ||
63 | { | ||
64 | set | ||
65 | { | ||
66 | this._inventoryCache = value; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | public AssetCache AssetCache | ||
71 | { | ||
72 | set | ||
73 | { | ||
74 | this._assetCache = value; | ||
75 | } | ||
76 | } | ||
77 | #endregion | ||
78 | |||
79 | #region Constructors | ||
80 | public WorldBase() | ||
81 | { | ||
82 | |||
83 | } | ||
84 | #endregion | ||
85 | |||
86 | #region Setup Methods | ||
87 | /// <summary> | ||
88 | /// Register Packet handler Methods with the packet server (which will register them with the SimClient) | ||
89 | /// </summary> | ||
90 | /// <param name="packetServer"></param> | ||
91 | public virtual void RegisterPacketHandlers(PacketServer packetServer) | ||
92 | { | ||
93 | |||
94 | } | ||
95 | #endregion | ||
96 | |||
97 | #region Update Methods | ||
98 | /// <summary> | ||
99 | /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) | ||
100 | /// </summary> | ||
101 | public virtual void Update() | ||
102 | { | ||
103 | |||
104 | } | ||
105 | #endregion | ||
106 | |||
107 | #region Terrain Methods | ||
108 | |||
109 | /// <summary> | ||
110 | /// Loads the World heightmap | ||
111 | /// </summary> | ||
112 | public virtual void LoadWorldMap() | ||
113 | { | ||
114 | |||
115 | } | ||
116 | |||
117 | /// <summary> | ||
118 | /// Send the region heightmap to the client | ||
119 | /// </summary> | ||
120 | /// <param name="RemoteClient">Client to send to</param> | ||
121 | public virtual void SendLayerData(ClientView RemoteClient) | ||
122 | { | ||
123 | try | ||
124 | { | ||
125 | int[] patches = new int[4]; | ||
126 | |||
127 | for (int y = 0; y < 16; y++) | ||
128 | { | ||
129 | for (int x = 0; x < 16; x = x + 4) | ||
130 | { | ||
131 | patches[0] = x + 0 + y * 16; | ||
132 | patches[1] = x + 1 + y * 16; | ||
133 | patches[2] = x + 2 + y * 16; | ||
134 | patches[3] = x + 3 + y * 16; | ||
135 | |||
136 | Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); | ||
137 | RemoteClient.OutPacket(layerpack); | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | catch (Exception e) | ||
142 | { | ||
143 | MainConsole.Instance.Warn("World.cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | /// <summary> | ||
148 | /// Sends a specified patch to a client | ||
149 | /// </summary> | ||
150 | /// <param name="px">Patch coordinate (x) 0..16</param> | ||
151 | /// <param name="py">Patch coordinate (y) 0..16</param> | ||
152 | /// <param name="RemoteClient">The client to send to</param> | ||
153 | public void SendLayerData(int px, int py, ClientView RemoteClient) | ||
154 | { | ||
155 | try | ||
156 | { | ||
157 | int[] patches = new int[1]; | ||
158 | int patchx, patchy; | ||
159 | patchx = px / 16; | ||
160 | patchy = py / 16; | ||
161 | |||
162 | patches[0] = patchx + 0 + patchy * 16; | ||
163 | |||
164 | Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); | ||
165 | RemoteClient.OutPacket(layerpack); | ||
166 | } | ||
167 | catch (Exception e) | ||
168 | { | ||
169 | MainConsole.Instance.Warn("World.cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
170 | } | ||
171 | } | ||
172 | #endregion | ||
173 | |||
174 | #region Add/Remove Agent/Avatar | ||
175 | /// <summary> | ||
176 | /// Add a new Agent's avatar | ||
177 | /// </summary> | ||
178 | /// <param name="agentClient"></param> | ||
179 | public virtual Avatar AddViewerAgent(ClientView agentClient) | ||
180 | { | ||
181 | return null; | ||
182 | } | ||
183 | |||
184 | /// <summary> | ||
185 | /// Remove a Agent's avatar | ||
186 | /// </summary> | ||
187 | /// <param name="agentClient"></param> | ||
188 | public virtual void RemoveViewerAgent(ClientView agentClient) | ||
189 | { | ||
190 | |||
191 | } | ||
192 | #endregion | ||
193 | |||
194 | #region Shutdown | ||
195 | /// <summary> | ||
196 | /// Tidy before shutdown | ||
197 | /// </summary> | ||
198 | public virtual void Close() | ||
199 | { | ||
200 | |||
201 | } | ||
202 | #endregion | ||
203 | } | ||
204 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs b/OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs deleted file mode 100644 index 3b5c91c..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.world.scripting | ||
34 | { | ||
35 | public interface IScriptContext | ||
36 | { | ||
37 | IScriptEntity Entity { get; } | ||
38 | bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs b/OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs deleted file mode 100644 index adb1b58..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.world.scripting | ||
34 | { | ||
35 | public interface IScriptReadonlyEntity | ||
36 | { | ||
37 | LLVector3 Pos { get; } | ||
38 | string Name { get; } | ||
39 | } | ||
40 | |||
41 | public interface IScriptEntity | ||
42 | { | ||
43 | LLVector3 Pos { get; set; } | ||
44 | string Name { get; } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs b/OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs deleted file mode 100644 index 7f53c86..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Physics.Manager; | ||
33 | using OpenSim.world; | ||
34 | using Avatar=OpenSim.world.Avatar; | ||
35 | using Primitive = OpenSim.world.Primitive; | ||
36 | |||
37 | namespace OpenSim.RegionServer.world.scripting | ||
38 | { | ||
39 | public delegate void ScriptEventHandler(IScriptContext context); | ||
40 | |||
41 | public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity | ||
42 | { | ||
43 | private World m_world; | ||
44 | private Script m_script; | ||
45 | private Entity m_entity; | ||
46 | |||
47 | public LLUUID ScriptId | ||
48 | { | ||
49 | get | ||
50 | { | ||
51 | return m_script.ScriptId; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | public void OnFrame() | ||
56 | { | ||
57 | m_script.OnFrame(this); | ||
58 | } | ||
59 | |||
60 | public ScriptHandler(Script script, Entity entity, World world) | ||
61 | { | ||
62 | m_script = script; | ||
63 | m_entity = entity; | ||
64 | m_world = world; | ||
65 | } | ||
66 | |||
67 | #region IScriptContext Members | ||
68 | |||
69 | IScriptEntity IScriptContext.Entity | ||
70 | { | ||
71 | get | ||
72 | { | ||
73 | return this; | ||
74 | } | ||
75 | } | ||
76 | |||
77 | bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) | ||
78 | { | ||
79 | foreach (Entity entity in m_world.Entities.Values ) | ||
80 | { | ||
81 | if( entity is Avatar ) | ||
82 | { | ||
83 | avatar = entity; | ||
84 | return true; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | avatar = null; | ||
89 | return false; | ||
90 | } | ||
91 | |||
92 | #endregion | ||
93 | |||
94 | #region IScriptEntity and IScriptReadonlyEntity Members | ||
95 | |||
96 | public string Name | ||
97 | { | ||
98 | get | ||
99 | { | ||
100 | return m_entity.Name; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public LLVector3 Pos | ||
105 | { | ||
106 | get | ||
107 | { | ||
108 | return m_entity.Pos; | ||
109 | } | ||
110 | |||
111 | set | ||
112 | { | ||
113 | if (m_entity is Primitive) | ||
114 | { | ||
115 | Primitive prim = m_entity as Primitive; | ||
116 | // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. | ||
117 | prim.UpdatePosition( value ); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | #endregion | ||
123 | } | ||
124 | |||
125 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/Script.cs b/OpenSim/OpenSim.RegionServer/world/scripting/Script.cs deleted file mode 100644 index 9c2280a..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/Script.cs +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.world.scripting | ||
34 | { | ||
35 | public class Script | ||
36 | { | ||
37 | private LLUUID m_scriptId; | ||
38 | public virtual LLUUID ScriptId | ||
39 | { | ||
40 | get | ||
41 | { | ||
42 | return m_scriptId; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public Script( LLUUID scriptId ) | ||
47 | { | ||
48 | m_scriptId = scriptId; | ||
49 | } | ||
50 | |||
51 | public ScriptEventHandler OnFrame; | ||
52 | } | ||
53 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs b/OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs deleted file mode 100644 index 17ec50e..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.RegionServer.world.scripting | ||
33 | { | ||
34 | public delegate Script ScriptFactory(); | ||
35 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs deleted file mode 100644 index 8e4565a..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.world.scripting | ||
34 | { | ||
35 | public class FollowRandomAvatar : Script | ||
36 | { | ||
37 | public FollowRandomAvatar() | ||
38 | : base(LLUUID.Random()) | ||
39 | { | ||
40 | OnFrame += MyOnFrame; | ||
41 | } | ||
42 | |||
43 | private void MyOnFrame(IScriptContext context) | ||
44 | { | ||
45 | LLVector3 pos = context.Entity.Pos; | ||
46 | |||
47 | IScriptReadonlyEntity avatar; | ||
48 | |||
49 | if (context.TryGetRandomAvatar(out avatar)) | ||
50 | { | ||
51 | LLVector3 avatarPos = avatar.Pos; | ||
52 | |||
53 | float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; | ||
54 | float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; | ||
55 | |||
56 | LLVector3 newPos = new LLVector3(x, y, pos.Z); | ||
57 | |||
58 | context.Entity.Pos = newPos; | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | |||
63 | |||
64 | } | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj index 7bb5d6e..7d90947 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj +++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj | |||
@@ -99,10 +99,10 @@ | |||
99 | <Compile Include="UUIDPrimQuery.cs"> | 99 | <Compile Include="UUIDPrimQuery.cs"> |
100 | <SubType>Code</SubType> | 100 | <SubType>Code</SubType> |
101 | </Compile> | 101 | </Compile> |
102 | <Compile Include="Db4LocalStorage.cs"> | 102 | <Compile Include="UUIDParcelQuery.cs"> |
103 | <SubType>Code</SubType> | 103 | <SubType>Code</SubType> |
104 | </Compile> | 104 | </Compile> |
105 | <Compile Include="UUIDParcelQuery.cs"> | 105 | <Compile Include="Db4LocalStorage.cs"> |
106 | <SubType>Code</SubType> | 106 | <SubType>Code</SubType> |
107 | </Compile> | 107 | </Compile> |
108 | </ItemGroup> | 108 | </ItemGroup> |
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build index e18478a..9789712 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build | |||
@@ -14,8 +14,8 @@ | |||
14 | <include name="AssemblyInfo.cs" /> | 14 | <include name="AssemblyInfo.cs" /> |
15 | <include name="MapStorage.cs" /> | 15 | <include name="MapStorage.cs" /> |
16 | <include name="UUIDPrimQuery.cs" /> | 16 | <include name="UUIDPrimQuery.cs" /> |
17 | <include name="Db4LocalStorage.cs" /> | ||
18 | <include name="UUIDParcelQuery.cs" /> | 17 | <include name="UUIDParcelQuery.cs" /> |
18 | <include name="Db4LocalStorage.cs" /> | ||
19 | </sources> | 19 | </sources> |
20 | <references basedir="${project::get-base-directory()}"> | 20 | <references basedir="${project::get-base-directory()}"> |
21 | <lib> | 21 | <lib> |
diff --git a/OpenSim/OpenSim/Application.cs b/OpenSim/OpenSim/Application.cs index 38da779..e3b23ad 100644 --- a/OpenSim/OpenSim/Application.cs +++ b/OpenSim/OpenSim/Application.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.UserServer; | 32 | using OpenSim.UserServer; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.RegionServer; | ||
34 | 35 | ||
35 | namespace OpenSim | 36 | namespace OpenSim |
36 | { | 37 | { |
@@ -111,7 +112,7 @@ namespace OpenSim | |||
111 | sim.m_sandbox = sandBoxMode; | 112 | sim.m_sandbox = sandBoxMode; |
112 | sim.user_accounts = userAccounts; | 113 | sim.user_accounts = userAccounts; |
113 | sim.gridLocalAsset = gridLocalAsset; | 114 | sim.gridLocalAsset = gridLocalAsset; |
114 | OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying; | 115 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = allowFlying; |
115 | 116 | ||
116 | sim.StartUp(); | 117 | sim.StartUp(); |
117 | 118 | ||
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 6db4572..a310ded 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs | |||
@@ -38,13 +38,15 @@ using System.Collections; | |||
38 | using System.Collections.Generic; | 38 | using System.Collections.Generic; |
39 | using libsecondlife; | 39 | using libsecondlife; |
40 | using libsecondlife.Packets; | 40 | using libsecondlife.Packets; |
41 | using OpenSim.world; | 41 | using OpenSim.RegionServer; |
42 | |||
43 | using OpenSim.RegionServer.Simulator; | ||
42 | using OpenSim.Terrain; | 44 | using OpenSim.Terrain; |
43 | using OpenSim.Framework.Interfaces; | 45 | using OpenSim.Framework.Interfaces; |
44 | using OpenSim.Framework.Types; | 46 | using OpenSim.Framework.Types; |
45 | using OpenSim.UserServer; | 47 | using OpenSim.UserServer; |
46 | using OpenSim.Assets; | 48 | using OpenSim.RegionServer.Assets; |
47 | using OpenSim.CAPS; | 49 | using OpenSim.RegionServer.CAPS; |
48 | using OpenSim.Framework.Console; | 50 | using OpenSim.Framework.Console; |
49 | using OpenSim.Physics.Manager; | 51 | using OpenSim.Physics.Manager; |
50 | using Nwc.XmlRpc; | 52 | using Nwc.XmlRpc; |
@@ -54,7 +56,7 @@ using OpenSim.GenericConfig; | |||
54 | namespace OpenSim | 56 | namespace OpenSim |
55 | { | 57 | { |
56 | 58 | ||
57 | public class OpenSimMain : RegionServerBase, conscmd_callback | 59 | public class OpenSimMain : OpenSim.RegionServer.RegionServerBase, conscmd_callback |
58 | { | 60 | { |
59 | private CheckSumServer checkServer; | 61 | private CheckSumServer checkServer; |
60 | 62 | ||
@@ -209,7 +211,7 @@ namespace OpenSim | |||
209 | } | 211 | } |
210 | 212 | ||
211 | m_console.Notice("Creating ParcelManager"); | 213 | m_console.Notice("Creating ParcelManager"); |
212 | LocalWorld.parcelManager = new OpenSim.RegionServer.world.ParcelManager(this.LocalWorld); | 214 | LocalWorld.parcelManager = new OpenSim.RegionServer.Simulator.ParcelManager(this.LocalWorld); |
213 | 215 | ||
214 | m_console.Notice("Loading Parcels from DB..."); | 216 | m_console.Notice("Loading Parcels from DB..."); |
215 | LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); | 217 | LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); |
@@ -436,23 +438,23 @@ namespace OpenSim | |||
436 | case "": | 438 | case "": |
437 | this.m_physicsEngine = "basicphysics"; | 439 | this.m_physicsEngine = "basicphysics"; |
438 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | 440 | configData.SetAttribute("PhysicsEngine", "basicphysics"); |
439 | OpenSim.world.Avatar.PhysicsEngineFlying = false; | 441 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false; |
440 | break; | 442 | break; |
441 | 443 | ||
442 | case "basicphysics": | 444 | case "basicphysics": |
443 | this.m_physicsEngine = "basicphysics"; | 445 | this.m_physicsEngine = "basicphysics"; |
444 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | 446 | configData.SetAttribute("PhysicsEngine", "basicphysics"); |
445 | OpenSim.world.Avatar.PhysicsEngineFlying = false; | 447 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false; |
446 | break; | 448 | break; |
447 | 449 | ||
448 | case "RealPhysX": | 450 | case "RealPhysX": |
449 | this.m_physicsEngine = "RealPhysX"; | 451 | this.m_physicsEngine = "RealPhysX"; |
450 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | 452 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true; |
451 | break; | 453 | break; |
452 | 454 | ||
453 | case "OpenDynamicsEngine": | 455 | case "OpenDynamicsEngine": |
454 | this.m_physicsEngine = "OpenDynamicsEngine"; | 456 | this.m_physicsEngine = "OpenDynamicsEngine"; |
455 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | 457 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true; |
456 | break; | 458 | break; |
457 | } | 459 | } |
458 | 460 | ||
@@ -556,19 +558,19 @@ namespace OpenSim | |||
556 | m_console.Error("That is " + (DateTime.Now - startuptime).ToString()); | 558 | m_console.Error("That is " + (DateTime.Now - startuptime).ToString()); |
557 | break; | 559 | break; |
558 | case "users": | 560 | case "users": |
559 | OpenSim.world.Avatar TempAv; | 561 | OpenSim.RegionServer.Simulator.Avatar TempAv; |
560 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); | 562 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); |
561 | foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) | 563 | foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) |
562 | { | 564 | { |
563 | if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | 565 | if (LocalWorld.Entities[UUID].ToString() == "OpenSim.RegionServer.Simulator.Avatar") |
564 | { | 566 | { |
565 | TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; | 567 | TempAv = (OpenSim.RegionServer.Simulator.Avatar)LocalWorld.Entities[UUID]; |
566 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); | 568 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); |
567 | } | 569 | } |
568 | } | 570 | } |
569 | break; | 571 | break; |
570 | case "parcels": | 572 | case "parcels": |
571 | foreach (OpenSim.RegionServer.world.Parcel parcel in LocalWorld.parcelManager.parcelList.Values) | 573 | foreach (OpenSim.RegionServer.Simulator.Parcel parcel in LocalWorld.parcelManager.parcelList.Values) |
572 | { | 574 | { |
573 | m_console.Error("Parcel ID#" + parcel.parcelData.localID + "(Global UUID: " + parcel.parcelData.globalID + "):"); | 575 | m_console.Error("Parcel ID#" + parcel.parcelData.localID + "(Global UUID: " + parcel.parcelData.globalID + "):"); |
574 | m_console.Error("\tParcel Name: " + parcel.parcelData.parcelName); | 576 | m_console.Error("\tParcel Name: " + parcel.parcelData.parcelName); |