aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Region')
-rw-r--r--OpenSim/OpenSim.Region/Caps.cs28
-rw-r--r--OpenSim/OpenSim.Region/EstateManager.cs3
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Primitive.cs45
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs17
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs85
-rw-r--r--OpenSim/OpenSim.Region/Scenes/SceneBase.cs71
-rw-r--r--OpenSim/OpenSim.Region/Scenes/ScenePresence.cs44
7 files changed, 185 insertions, 108 deletions
diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs
index 9cb921b..88799a0 100644
--- a/OpenSim/OpenSim.Region/Caps.cs
+++ b/OpenSim/OpenSim.Region/Caps.cs
@@ -27,6 +27,7 @@ namespace OpenSim.Region
27 private LLUUID agentID; 27 private LLUUID agentID;
28 private AssetCache assetCache; 28 private AssetCache assetCache;
29 private int eventQueueCount = 1; 29 private int eventQueueCount = 1;
30 private Queue<string> CapsEventQueue = new Queue<string>();
30 31
31 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) 32 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent)
32 { 33 {
@@ -77,7 +78,7 @@ namespace OpenSim.Region
77 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>"; 78 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
78 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>"; 79 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
79 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>"; 80 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
80 // capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>"; 81 //capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>";
81 return capURLS; 82 return capURLS;
82 } 83 }
83 84
@@ -122,9 +123,26 @@ namespace OpenSim.Region
122 123
123 public string ProcessEventQueue(string request, string path, string param) 124 public string ProcessEventQueue(string request, string path, string param)
124 { 125 {
125 // Console.WriteLine("event queue request " + request); 126 // Console.WriteLine("event queue request " + request);
126 string res = ""; 127 string res = "";
127 res = this.CreateEmptyEventResponse(); 128 int timer = 0;
129
130 /*while ((timer < 200) || (this.CapsEventQueue.Count < 1))
131 {
132 timer++;
133 }*/
134 if (this.CapsEventQueue.Count > 0)
135 {
136 lock (this.CapsEventQueue)
137 {
138 string item = CapsEventQueue.Dequeue();
139 res = item;
140 }
141 }
142 else
143 {
144 res = this.CreateEmptyEventResponse();
145 }
128 return res; 146 return res;
129 } 147 }
130 148
@@ -141,6 +159,7 @@ namespace OpenSim.Region
141 res += "</map></array>"; 159 res += "</map></array>";
142 res += "</map></llsd>"; 160 res += "</map></llsd>";
143 eventQueueCount++; 161 eventQueueCount++;
162 this.CapsEventQueue.Enqueue(res);
144 return res; 163 return res;
145 } 164 }
146 165
@@ -176,7 +195,7 @@ namespace OpenSim.Region
176 195
177 public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) 196 public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data)
178 { 197 {
179 // Console.WriteLine("upload handler called"); 198 Console.WriteLine("upload handler called");
180 AssetBase asset; 199 AssetBase asset;
181 asset = new AssetBase(); 200 asset = new AssetBase();
182 asset.FullID = assetID; 201 asset.FullID = assetID;
@@ -185,7 +204,6 @@ namespace OpenSim.Region
185 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); 204 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
186 asset.Data = data; 205 asset.Data = data;
187 this.assetCache.AddAsset(asset); 206 this.assetCache.AddAsset(asset);
188
189 } 207 }
190 208
191 public class AssetUploader 209 public class AssetUploader
diff --git a/OpenSim/OpenSim.Region/EstateManager.cs b/OpenSim/OpenSim.Region/EstateManager.cs
index fbcab33..dcb5564 100644
--- a/OpenSim/OpenSim.Region/EstateManager.cs
+++ b/OpenSim/OpenSim.Region/EstateManager.cs
@@ -265,6 +265,7 @@ namespace OpenSim.Region
265 265
266 public void sendRegionInfoPacket(IClientAPI remote_client) 266 public void sendRegionInfoPacket(IClientAPI remote_client)
267 { 267 {
268 Encoding _enc = System.Text.Encoding.ASCII;
268 269
269 AgentCircuitData circuitData = remote_client.RequestClientInfo(); 270 AgentCircuitData circuitData = remote_client.RequestClientInfo();
270 271
@@ -281,7 +282,7 @@ namespace OpenSim.Region
281 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; 282 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
282 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; 283 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
283 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; 284 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
284 regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_regInfo.RegionName); 285 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName);
285 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; 286 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
286 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; 287 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
287 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; 288 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
diff --git a/OpenSim/OpenSim.Region/Scenes/Primitive.cs b/OpenSim/OpenSim.Region/Scenes/Primitive.cs
index 62f401c..b0bfd1e 100644
--- a/OpenSim/OpenSim.Region/Scenes/Primitive.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Primitive.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Region.Scenes
47 private const uint FULL_MASK_PERMISSIONS = 2147483647; 47 private const uint FULL_MASK_PERMISSIONS = 2147483647;
48 private bool physicsEnabled = false; 48 private bool physicsEnabled = false;
49 private byte updateFlag = 0; 49 private byte updateFlag = 0;
50 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
50 51
51 private Dictionary<LLUUID, InventoryItem> inventoryItems; 52 private Dictionary<LLUUID, InventoryItem> inventoryItems;
52 53
@@ -411,7 +412,7 @@ namespace OpenSim.Region.Scenes
411 lPos = this.Pos; 412 lPos = this.Pos;
412 } 413 }
413 414
414 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005")); 415 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags);
415 } 416 }
416 417
417 /// <summary> 418 /// <summary>
@@ -434,7 +435,7 @@ namespace OpenSim.Region.Scenes
434 { 435 {
435 LLVector3 lPos; 436 LLVector3 lPos;
436 Axiom.MathLib.Quaternion lRot; 437 Axiom.MathLib.Quaternion lRot;
437 if (this._physActor != null && this.physicsEnabled) 438 if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us?
438 { 439 {
439 PhysicsVector pPos = this._physActor.Position; 440 PhysicsVector pPos = this._physActor.Position;
440 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); 441 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
@@ -445,6 +446,8 @@ namespace OpenSim.Region.Scenes
445 lPos = this.Pos; 446 lPos = this.Pos;
446 lRot = this.rotation; 447 lRot = this.rotation;
447 } 448 }
449 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
450 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot);
448 } 451 }
449 452
450 /// <summary> 453 /// <summary>
@@ -534,6 +537,44 @@ namespace OpenSim.Region.Scenes
534 { 537 {
535 538
536 } 539 }
540
541 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
542 {
543 Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z);
544 this.Pos = pos;
545 this.SendTerseUpdateToALLClients();
546 }
547
548 public void GetProperites(IClientAPI client)
549 {
550 //needs changing
551 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
552 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
553 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
554 proper.ObjectData[0].ItemID = LLUUID.Zero;
555 proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate;
556 proper.ObjectData[0].CreatorID = primData.OwnerID;
557 proper.ObjectData[0].FolderID = LLUUID.Zero;
558 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
559 proper.ObjectData[0].GroupID = LLUUID.Zero;
560 proper.ObjectData[0].InventorySerial = 0;
561 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
562 proper.ObjectData[0].ObjectID = this.uuid;
563 proper.ObjectData[0].OwnerID = primData.OwnerID;
564 proper.ObjectData[0].TouchName = new byte[0];
565 proper.ObjectData[0].TextureID = new byte[0];
566 proper.ObjectData[0].SitName = new byte[0];
567 proper.ObjectData[0].Name = new byte[0];
568 proper.ObjectData[0].Description = new byte[0];
569 proper.ObjectData[0].OwnerMask = primData.OwnerMask;
570 proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask;
571 proper.ObjectData[0].GroupMask = primData.GroupMask;
572 proper.ObjectData[0].EveryoneMask = primData.EveryoneMask;
573 proper.ObjectData[0].BaseMask = primData.BaseMask;
574
575 client.OutPacket(proper);
576
577 }
537 578
538 #endregion 579 #endregion
539 580
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs b/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
index 01e38d5..d1a2717 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
@@ -214,7 +214,22 @@ namespace OpenSim.Region.Scenes
214 /// <param name="remoteClient"></param> 214 /// <param name="remoteClient"></param>
215 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 215 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
216 { 216 {
217 217 foreach (Entity ent in Entities.Values)
218 {
219 if (ent.LocalId == primLocalID)
220 {
221 ((OpenSim.Region.Scenes.Primitive)ent).GetProperites(remoteClient);
222 break;
223 }
224 }
225 }
226
227 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
228 {
229 if (this.Entities.ContainsKey(objectID))
230 {
231 ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
232 }
218 } 233 }
219 234
220 /// <summary> 235 /// <summary>
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index 62edc4b..426dd50 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -57,19 +57,18 @@ namespace OpenSim.Region.Scenes
57 protected Dictionary<libsecondlife.LLUUID, Primitive> Prims; 57 protected Dictionary<libsecondlife.LLUUID, Primitive> Prims;
58 private PhysicsScene phyScene; 58 private PhysicsScene phyScene;
59 private float timeStep = 0.1f; 59 private float timeStep = 0.1f;
60 public ILocalStorage localStorage;
61 private Random Rand = new Random(); 60 private Random Rand = new Random();
62 private uint _primCount = 702000; 61 private uint _primCount = 702000;
63 private int storageCount; 62 private int storageCount;
64 private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers; 63 private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers;
65 private Dictionary<string, ScriptFactory> m_scripts; 64 private Dictionary<string, ScriptFactory> m_scripts;
66 private Mutex updateLock; 65 private Mutex updateLock;
67 public string m_datastore; 66
68 protected AuthenticateSessionsBase authenticateHandler; 67 protected AuthenticateSessionsBase authenticateHandler;
69 protected RegionCommsListener regionCommsHost; 68 protected RegionCommsListener regionCommsHost;
70 protected CommunicationsManager commsManager; 69 protected CommunicationsManager commsManager;
71 70
72 protected List<Caps> capsHandlers = new List<Caps>(); 71 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
73 protected BaseHttpServer httpListener; 72 protected BaseHttpServer httpListener;
74 73
75 public ParcelManager parcelManager; 74 public ParcelManager parcelManager;
@@ -127,7 +126,6 @@ namespace OpenSim.Region.Scenes
127 Prims = new Dictionary<LLUUID, Primitive>(); 126 Prims = new Dictionary<LLUUID, Primitive>();
128 127
129 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); 128 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap");
130 TerrainManager = new TerrainManager(new SecondLife());
131 Terrain = new TerrainEngine(); 129 Terrain = new TerrainEngine();
132 130
133 ScenePresence.LoadAnims(); 131 ScenePresence.LoadAnims();
@@ -271,53 +269,6 @@ namespace OpenSim.Region.Scenes
271 } 269 }
272 #endregion 270 #endregion
273 271
274 #region Setup Methods
275 /// <summary>
276 /// Loads a new storage subsystem from a named library
277 /// </summary>
278 /// <param name="dllName">Storage Library</param>
279 /// <returns>Successful or not</returns>
280 public bool LoadStorageDLL(string dllName)
281 {
282 try
283 {
284 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
285 ILocalStorage store = null;
286
287 foreach (Type pluginType in pluginAssembly.GetTypes())
288 {
289 if (pluginType.IsPublic)
290 {
291 if (!pluginType.IsAbstract)
292 {
293 Type typeInterface = pluginType.GetInterface("ILocalStorage", true);
294
295 if (typeInterface != null)
296 {
297 ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
298 store = plug;
299
300 store.Initialise(this.m_datastore);
301 break;
302 }
303
304 typeInterface = null;
305 }
306 }
307 }
308 pluginAssembly = null;
309 this.localStorage = store;
310 return (store == null);
311 }
312 catch (Exception e)
313 {
314 OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
315 return false;
316 }
317 }
318
319 #endregion
320
321 #region Regenerate Terrain 272 #region Regenerate Terrain
322 273
323 /// <summary> 274 /// <summary>
@@ -558,6 +509,8 @@ namespace OpenSim.Region.Scenes
558 remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; 509 remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition;
559 remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; 510 remoteClient.OnRequestMapBlocks += this.RequestMapBlocks;
560 remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; 511 remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation;
512 //remoteClient.OnObjectSelect += this.SelectPrim;
513 remoteClient.OnGrapUpdate += this.MoveObject;
561 514
562 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 515 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
563 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 516 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
@@ -680,22 +633,6 @@ namespace OpenSim.Region.Scenes
680 } 633 }
681 #endregion 634 #endregion
682 635
683 #region ShutDown
684 /// <summary>
685 /// Tidy before shutdown
686 /// </summary>
687 public override void Close()
688 {
689 try
690 {
691 this.localStorage.ShutDown();
692 }
693 catch (Exception e)
694 {
695 OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString());
696 }
697 }
698 #endregion
699 636
700 #region RegionCommsHost 637 #region RegionCommsHost
701 638
@@ -729,7 +666,7 @@ namespace OpenSim.Region.Scenes
729 //Console.WriteLine("new user, so creating caps handler for it"); 666 //Console.WriteLine("new user, so creating caps handler for it");
730 Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); 667 Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID);
731 cap.RegisterHandlers(); 668 cap.RegisterHandlers();
732 this.capsHandlers.Add(cap); 669 this.capsHandlers.Add(agent.AgentID, cap);
733 } 670 }
734 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 671 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
735 } 672 }
@@ -767,6 +704,7 @@ namespace OpenSim.Region.Scenes
767 agent.child = true; 704 agent.child = true;
768 this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); 705 this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent);
769 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); 706 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort);
707 //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort);
770 } 708 }
771 } 709 }
772 } 710 }
@@ -845,16 +783,5 @@ namespace OpenSim.Region.Scenes
845 } 783 }
846 784
847 #endregion 785 #endregion
848
849 /// <summary>
850 ///
851 /// </summary>
852 /// <param name="px"></param>
853 /// <param name="py"></param>
854 /// <param name="RemoteClient"></param>
855 public override void SendLayerData(int px, int py, IClientAPI RemoteClient)
856 {
857 RemoteClient.SendLayerData(px, py, Terrain.getHeights1D());
858 }
859 } 786 }
860} 787}
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
index e650127..4dbd374 100644
--- a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
+++ b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
@@ -51,8 +51,11 @@ namespace OpenSim.Region.Scenes
51 protected string m_regionName; 51 protected string m_regionName;
52 protected RegionInfo m_regInfo; 52 protected RegionInfo m_regInfo;
53 53
54 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. 54 public TerrainEngine Terrain;
55 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine 55
56 public string m_datastore;
57 public ILocalStorage localStorage;
58
56 protected object m_syncRoot = new object(); 59 protected object m_syncRoot = new object();
57 private uint m_nextLocalId = 8880000; 60 private uint m_nextLocalId = 8880000;
58 protected AssetCache assetCache; 61 protected AssetCache assetCache;
@@ -71,6 +74,51 @@ namespace OpenSim.Region.Scenes
71 /// Loads the World heightmap 74 /// Loads the World heightmap
72 /// </summary> 75 /// </summary>
73 public abstract void LoadWorldMap(); 76 public abstract void LoadWorldMap();
77
78 /// <summary>
79 /// Loads a new storage subsystem from a named library
80 /// </summary>
81 /// <param name="dllName">Storage Library</param>
82 /// <returns>Successful or not</returns>
83 public bool LoadStorageDLL(string dllName)
84 {
85 try
86 {
87 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
88 ILocalStorage store = null;
89
90 foreach (Type pluginType in pluginAssembly.GetTypes())
91 {
92 if (pluginType.IsPublic)
93 {
94 if (!pluginType.IsAbstract)
95 {
96 Type typeInterface = pluginType.GetInterface("ILocalStorage", true);
97
98 if (typeInterface != null)
99 {
100 ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
101 store = plug;
102
103 store.Initialise(this.m_datastore);
104 break;
105 }
106
107 typeInterface = null;
108 }
109 }
110 }
111 pluginAssembly = null;
112 this.localStorage = store;
113 return (store == null);
114 }
115 catch (Exception e)
116 {
117 OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
118 return false;
119 }
120 }
121
74 122
75 /// <summary> 123 /// <summary>
76 /// Send the region heightmap to the client 124 /// Send the region heightmap to the client
@@ -87,7 +135,10 @@ namespace OpenSim.Region.Scenes
87 /// <param name="px">Patch coordinate (x) 0..16</param> 135 /// <param name="px">Patch coordinate (x) 0..16</param>
88 /// <param name="py">Patch coordinate (y) 0..16</param> 136 /// <param name="py">Patch coordinate (y) 0..16</param>
89 /// <param name="RemoteClient">The client to send to</param> 137 /// <param name="RemoteClient">The client to send to</param>
90 public abstract void SendLayerData(int px, int py, IClientAPI RemoteClient); 138 public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient)
139 {
140 RemoteClient.SendLayerData(px, py, Terrain.getHeights1D());
141 }
91 142
92 #endregion 143 #endregion
93 144
@@ -114,7 +165,7 @@ namespace OpenSim.Region.Scenes
114 /// <returns></returns> 165 /// <returns></returns>
115 public virtual RegionInfo RegionInfo 166 public virtual RegionInfo RegionInfo
116 { 167 {
117 get { return null; } 168 get { return this.m_regInfo; }
118 } 169 }
119 170
120 public object SyncRoot 171 public object SyncRoot
@@ -131,7 +182,17 @@ namespace OpenSim.Region.Scenes
131 /// <summary> 182 /// <summary>
132 /// Tidy before shutdown 183 /// Tidy before shutdown
133 /// </summary> 184 /// </summary>
134 public abstract void Close(); 185 public virtual void Close()
186 {
187 try
188 {
189 this.localStorage.ShutDown();
190 }
191 catch (Exception e)
192 {
193 OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString());
194 }
195 }
135 196
136 #endregion 197 #endregion
137 198
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
index e2e30b9..ffec3e5 100644
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
@@ -223,26 +223,23 @@ namespace OpenSim.Region.Scenes
223 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 223 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
224 if (((movementflag & 1) == 0) || (q != this.bodyRot)) 224 if (((movementflag & 1) == 0) || (q != this.bodyRot))
225 { 225 {
226 //we should add a new force to the list
227 // but for now we will deal with velocities
228 NewForce newVelocity = new NewForce();
229 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); 226 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
230 Axiom.MathLib.Vector3 direc = q * v3; 227 this.AddNewMovement(v3, q);
231 direc.Normalize();
232
233 //work out velocity for sim physics system
234 direc = direc * ((0.03f) * 128f);
235 if (this._physActor.Flying)
236 direc *= 4;
237
238 newVelocity.X = direc.x;
239 newVelocity.Y = direc.y;
240 newVelocity.Z = direc.z;
241 this.forcesList.Add(newVelocity);
242 movementflag = 1; 228 movementflag = 1;
243 this.bodyRot = q; 229 this.bodyRot = q;
244 } 230 }
245 } 231 }
232 else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0)
233 {
234 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
235 if (((movementflag & 2) == 0) || (q != this.bodyRot))
236 {
237 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0);
238 this.AddNewMovement(v3, q);
239 movementflag = 2;
240 this.bodyRot = q;
241 }
242 }
246 else 243 else
247 { 244 {
248 if ((movementflag) != 0) 245 if ((movementflag) != 0)
@@ -257,6 +254,23 @@ namespace OpenSim.Region.Scenes
257 } 254 }
258 255
259 } 256 }
257
258 protected void AddNewMovement(Axiom.MathLib.Vector3 vec, Axiom.MathLib.Quaternion rotation)
259 {
260 NewForce newVelocity = new NewForce();
261 Axiom.MathLib.Vector3 direc = rotation * vec;
262 direc.Normalize();
263
264 direc = direc * ((0.03f) * 128f);
265 if (this._physActor.Flying)
266 direc *= 4;
267
268 newVelocity.X = direc.x;
269 newVelocity.Y = direc.y;
270 newVelocity.Z = direc.z;
271 this.forcesList.Add(newVelocity);
272 }
273
260 #endregion 274 #endregion
261 275
262 #region Overridden Methods 276 #region Overridden Methods