aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMW2007-08-19 13:35:20 +0000
committerMW2007-08-19 13:35:20 +0000
commitc89db49f3cd3bbd60577eb5a1787ccf8dea930e3 (patch)
tree2b51b0d261724427933f543dd2f39ef8cd21127f /OpenSim/Region/Environment/Scenes/Scene.cs
parentCode comments on recent changes in EventQueueManager (diff)
downloadopensim-SC_OLD-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.zip
opensim-SC_OLD-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.tar.gz
opensim-SC_OLD-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.tar.bz2
opensim-SC_OLD-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.tar.xz
Sqlite datastore should now save the textures and extraparams data (used by sculpties) correctly. [Really need to add a ExtraParams field to the sqlite database though, but for now I have combined their data so that we don't lose backward compatibility, know a couple of people have been using the datastore already].
Now have a rough day/night cycle (the movement of the sun needs to be made smoother but for now it is better than we had I think). Added dalien's patch (issue 294) for saving and loading prims to a xml file (think he will be modifying these to be import/export functions and maybe writing a xml datastore for backups). Some preliminary work on task inventory (ie object's/prim's inventory). Added place holder data for AvatarProperties (ie a avatar's profile). Should we store this sort of data on the user server or have another server for it (a normal webserver should work). Added a few more method to IClientAPI. Sure there is something I'm forgeting.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs92
1 files changed, 89 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 01e58c7..85479a7 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -29,6 +29,8 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading; 30using System.Threading;
31using System.Timers; 31using System.Timers;
32using System.IO;
33using System.Xml;
32using libsecondlife; 34using libsecondlife;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
@@ -65,6 +67,10 @@ namespace OpenSim.Region.Environment.Scenes
65 private int storageCount; 67 private int storageCount;
66 private int terrainCheckCount; 68 private int terrainCheckCount;
67 private int landPrimCheckCount; 69 private int landPrimCheckCount;
70
71 private int m_timePhase = 24;
72 private int m_timeUpdateCount;
73
68 private Mutex updateLock; 74 private Mutex updateLock;
69 75
70 protected StorageManager storageManager; 76 protected StorageManager storageManager;
@@ -123,6 +129,11 @@ namespace OpenSim.Region.Environment.Scenes
123 get { return Prims; } 129 get { return Prims; }
124 } 130 }
125 131
132 public int TimePhase
133 {
134 get { return this.m_timePhase; }
135 }
136
126 #endregion 137 #endregion
127 138
128 #region Constructors 139 #region Constructors
@@ -301,6 +312,26 @@ namespace OpenSim.Region.Environment.Scenes
301 landPrimCheckCount = 0; 312 landPrimCheckCount = 0;
302 } 313 }
303 } 314 }
315
316 m_timeUpdateCount++;
317 if (m_timeUpdateCount > 600)
318 {
319 List<ScenePresence> Avatars = this.RequestAvatarList();
320 foreach (ScenePresence avatar in Avatars)
321 {
322 if (!avatar.childAgent)
323 {
324 //Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname);
325 avatar.ControllingClient.SendViewerTime(m_timePhase);
326 }
327 }
328 m_timeUpdateCount = 0;
329 m_timePhase++;
330 if (m_timePhase > 94)
331 {
332 m_timePhase = 0;
333 }
334 }
304 } 335 }
305 catch (NotImplementedException) 336 catch (NotImplementedException)
306 { 337 {
@@ -538,7 +569,7 @@ namespace OpenSim.Region.Environment.Scenes
538 569
539 public void AddEntity(SceneObjectGroup sceneObject) 570 public void AddEntity(SceneObjectGroup sceneObject)
540 { 571 {
541 if(!Entities.ContainsKey(sceneObject.UUID)) 572 if (!Entities.ContainsKey(sceneObject.UUID))
542 { 573 {
543 Entities.Add(sceneObject.UUID, sceneObject); 574 Entities.Add(sceneObject.UUID, sceneObject);
544 } 575 }
@@ -563,6 +594,52 @@ namespace OpenSim.Region.Environment.Scenes
563 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; 594 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
564 } 595 }
565 596
597 public void LoadPrimsFromXml(string fileName)
598 {
599 XmlDocument doc = new XmlDocument();
600 XmlNode rootNode;
601 int primCount = 0;
602 if (File.Exists(fileName))
603 {
604 XmlTextReader reader = new XmlTextReader(fileName);
605 reader.WhitespaceHandling = WhitespaceHandling.None;
606 doc.Load(reader);
607 reader.Close();
608 rootNode = doc.FirstChild;
609 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
610 {
611 SceneObjectGroup obj = new SceneObjectGroup(this,
612 this.m_regionHandle, aPrimNode.OuterXml);
613 AddEntity(obj);
614 primCount++;
615 }
616 }
617 else
618 {
619 throw new Exception("Could not open file " + fileName + " for reading");
620 }
621 }
622
623 public void SavePrimsToXml(string fileName)
624 {
625 FileStream file = new FileStream(fileName, FileMode.Create);
626 StreamWriter stream = new StreamWriter(file);
627 int primCount = 0;
628 stream.WriteLine("<scene>\n");
629 foreach (EntityBase ent in Entities.Values)
630 {
631 if (ent is SceneObjectGroup)
632 {
633 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString());
634 primCount++;
635 }
636 }
637 stream.WriteLine("</scene>\n");
638 stream.Close();
639 file.Close();
640 }
641
642
566 #endregion 643 #endregion
567 644
568 #region Add/Remove Avatar Methods 645 #region Add/Remove Avatar Methods
@@ -632,6 +709,7 @@ namespace OpenSim.Region.Environment.Scenes
632 client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; 709 client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory;
633 client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; 710 client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
634 client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; 711 client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
712 // client.OnRequestXfer += RequestXfer;
635 713
636 client.OnGrabObject += ProcessObjectGrab; 714 client.OnGrabObject += ProcessObjectGrab;
637 } 715 }
@@ -950,7 +1028,7 @@ namespace OpenSim.Region.Environment.Scenes
950 AgentCircuitData agent = remoteClient.RequestClientInfo(); 1028 AgentCircuitData agent = remoteClient.RequestClientInfo();
951 agent.BaseFolder = LLUUID.Zero; 1029 agent.BaseFolder = LLUUID.Zero;
952 agent.InventoryFolder = LLUUID.Zero; 1030 agent.InventoryFolder = LLUUID.Zero;
953// agent.startpos = new LLVector3(128, 128, 70); 1031 // agent.startpos = new LLVector3(128, 128, 70);
954 agent.startpos = position; 1032 agent.startpos = position;
955 agent.child = true; 1033 agent.child = true;
956 commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); 1034 commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
@@ -1121,7 +1199,15 @@ namespace OpenSim.Region.Environment.Scenes
1121 item.assetID = asset.FullID; 1199 item.assetID = asset.FullID;
1122 userInfo.UpdateItem(remoteClient.AgentId, item); 1200 userInfo.UpdateItem(remoteClient.AgentId, item);
1123 1201
1124 // remoteClient.SendInventoryItemUpdate(item); 1202 // remoteClient.SendInventoryItemUpdate(item);
1203 if (item.invType == 7)
1204 {
1205 //do we want to know about updated note cards?
1206 }
1207 else if (item.invType == 10)
1208 {
1209 // do we want to know about updated scripts
1210 }
1125 1211
1126 return (asset.FullID); 1212 return (asset.FullID);
1127 } 1213 }