diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 92 |
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; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | 30 | using System.Threading; |
31 | using System.Timers; | 31 | using System.Timers; |
32 | using System.IO; | ||
33 | using System.Xml; | ||
32 | using libsecondlife; | 34 | using libsecondlife; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 36 | using 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 | } |