From c89db49f3cd3bbd60577eb5a1787ccf8dea930e3 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 19 Aug 2007 13:35:20 +0000 Subject: 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. --- OpenSim/Region/Environment/Scenes/Scene.cs | 92 +++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') 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; using System.Collections.Generic; using System.Threading; using System.Timers; +using System.IO; +using System.Xml; using libsecondlife; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -65,6 +67,10 @@ namespace OpenSim.Region.Environment.Scenes private int storageCount; private int terrainCheckCount; private int landPrimCheckCount; + + private int m_timePhase = 24; + private int m_timeUpdateCount; + private Mutex updateLock; protected StorageManager storageManager; @@ -123,6 +129,11 @@ namespace OpenSim.Region.Environment.Scenes get { return Prims; } } + public int TimePhase + { + get { return this.m_timePhase; } + } + #endregion #region Constructors @@ -301,6 +312,26 @@ namespace OpenSim.Region.Environment.Scenes landPrimCheckCount = 0; } } + + m_timeUpdateCount++; + if (m_timeUpdateCount > 600) + { + List Avatars = this.RequestAvatarList(); + foreach (ScenePresence avatar in Avatars) + { + if (!avatar.childAgent) + { + //Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname); + avatar.ControllingClient.SendViewerTime(m_timePhase); + } + } + m_timeUpdateCount = 0; + m_timePhase++; + if (m_timePhase > 94) + { + m_timePhase = 0; + } + } } catch (NotImplementedException) { @@ -538,7 +569,7 @@ namespace OpenSim.Region.Environment.Scenes public void AddEntity(SceneObjectGroup sceneObject) { - if(!Entities.ContainsKey(sceneObject.UUID)) + if (!Entities.ContainsKey(sceneObject.UUID)) { Entities.Add(sceneObject.UUID, sceneObject); } @@ -563,6 +594,52 @@ namespace OpenSim.Region.Environment.Scenes prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; } + public void LoadPrimsFromXml(string fileName) + { + XmlDocument doc = new XmlDocument(); + XmlNode rootNode; + int primCount = 0; + if (File.Exists(fileName)) + { + XmlTextReader reader = new XmlTextReader(fileName); + reader.WhitespaceHandling = WhitespaceHandling.None; + doc.Load(reader); + reader.Close(); + rootNode = doc.FirstChild; + foreach (XmlNode aPrimNode in rootNode.ChildNodes) + { + SceneObjectGroup obj = new SceneObjectGroup(this, + this.m_regionHandle, aPrimNode.OuterXml); + AddEntity(obj); + primCount++; + } + } + else + { + throw new Exception("Could not open file " + fileName + " for reading"); + } + } + + public void SavePrimsToXml(string fileName) + { + FileStream file = new FileStream(fileName, FileMode.Create); + StreamWriter stream = new StreamWriter(file); + int primCount = 0; + stream.WriteLine("\n"); + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObjectGroup) + { + stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); + primCount++; + } + } + stream.WriteLine("\n"); + stream.Close(); + file.Close(); + } + + #endregion #region Add/Remove Avatar Methods @@ -632,6 +709,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; + // client.OnRequestXfer += RequestXfer; client.OnGrabObject += ProcessObjectGrab; } @@ -950,7 +1028,7 @@ namespace OpenSim.Region.Environment.Scenes AgentCircuitData agent = remoteClient.RequestClientInfo(); agent.BaseFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero; -// agent.startpos = new LLVector3(128, 128, 70); + // agent.startpos = new LLVector3(128, 128, 70); agent.startpos = position; agent.child = true; commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); @@ -1121,7 +1199,15 @@ namespace OpenSim.Region.Environment.Scenes item.assetID = asset.FullID; userInfo.UpdateItem(remoteClient.AgentId, item); - // remoteClient.SendInventoryItemUpdate(item); + // remoteClient.SendInventoryItemUpdate(item); + if (item.invType == 7) + { + //do we want to know about updated note cards? + } + else if (item.invType == 10) + { + // do we want to know about updated scripts + } return (asset.FullID); } -- cgit v1.1