diff options
Diffstat (limited to 'OpenSim/Region/Framework')
16 files changed, 358 insertions, 644 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 2c906a2..89a45da 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -185,19 +185,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
185 | List<UUID> GetInventoryList(); | 185 | List<UUID> GetInventoryList(); |
186 | 186 | ||
187 | /// <summary> | 187 | /// <summary> |
188 | /// Get the names of the assemblies associated with scripts in this inventory. | ||
189 | /// </summary> | ||
190 | /// <returns></returns> | ||
191 | string[] GetScriptAssemblies(); | ||
192 | |||
193 | /// <summary> | ||
194 | /// Get the xml representing the saved states of scripts in this inventory. | 188 | /// Get the xml representing the saved states of scripts in this inventory. |
195 | /// </summary> | 189 | /// </summary> |
196 | /// <returns> | 190 | /// <returns> |
197 | /// A <see cref="Dictionary`2"/> | 191 | /// A <see cref="Dictionary`2"/> |
198 | /// </returns> | 192 | /// </returns> |
199 | Dictionary<UUID, string> GetScriptStates(); | 193 | Dictionary<UUID, string> GetScriptStates(); |
200 | |||
201 | bool CanBeDeleted(); | ||
202 | } | 194 | } |
203 | } | 195 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index 74f404f..6fe6118 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs | |||
@@ -33,26 +33,41 @@ namespace OpenSim.Region.Framework.Interfaces | |||
33 | { | 33 | { |
34 | public interface ILandChannel | 34 | public interface ILandChannel |
35 | { | 35 | { |
36 | List<ILandObject> ParcelsNearPoint(Vector3 position); | 36 | /// <summary> |
37 | /// Get all parcels | ||
38 | /// </summary> | ||
39 | /// <returns></returns> | ||
37 | List<ILandObject> AllParcels(); | 40 | List<ILandObject> AllParcels(); |
38 | 41 | ||
39 | /// <summary> | 42 | /// <summary> |
40 | /// Get the land object at the specified point | 43 | /// Get the parcel at the specified point |
41 | /// </summary> | 44 | /// </summary> |
42 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | 45 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> |
43 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | 46 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> |
44 | /// <returns>Land object at the point supplied</returns> | 47 | /// <returns>Land object at the point supplied</returns> |
45 | ILandObject GetLandObject(int x, int y); | 48 | ILandObject GetLandObject(int x, int y); |
46 | 49 | ||
47 | ILandObject GetLandObject(int localID); | ||
48 | |||
49 | /// <summary> | 50 | /// <summary> |
50 | /// Get the land object at the specified point | 51 | /// Get the parcel at the specified point |
51 | /// </summary> | 52 | /// </summary> |
52 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | 53 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> |
53 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | 54 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> |
54 | /// <returns>Land object at the point supplied</returns> | 55 | /// <returns>Land object at the point supplied</returns> |
55 | ILandObject GetLandObject(float x, float y); | 56 | ILandObject GetLandObject(float x, float y); |
57 | |||
58 | /// <summary> | ||
59 | /// Get the parcels near the specified point | ||
60 | /// </summary> | ||
61 | /// <param name="position"></param> | ||
62 | /// <returns></returns> | ||
63 | List<ILandObject> ParcelsNearPoint(Vector3 position); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Get the parcel given the land's local id. | ||
67 | /// </summary> | ||
68 | /// <param name="localID"></param> | ||
69 | /// <returns></returns> | ||
70 | ILandObject GetLandObject(int localID); | ||
56 | 71 | ||
57 | bool IsLandPrimCountTainted(); | 72 | bool IsLandPrimCountTainted(); |
58 | bool IsForcefulBansAllowed(); | 73 | bool IsForcefulBansAllowed(); |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs index 9ad2036..1a8babc 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs | |||
@@ -34,7 +34,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | /// Interface to region archive functionality | 34 | /// Interface to region archive functionality |
35 | /// </summary> | 35 | /// </summary> |
36 | public interface IRegionArchiverModule | 36 | public interface IRegionArchiverModule |
37 | { | 37 | { |
38 | void HandleLoadOarConsoleCommand(string module, string[] cmdparams); | ||
39 | void HandleSaveOarConsoleCommand(string module, string[] cmdparams); | ||
40 | |||
38 | /// <summary> | 41 | /// <summary> |
39 | /// Archive the region to the given path | 42 | /// Archive the region to the given path |
40 | /// </summary> | 43 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 10835b9..f11e571 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -34,9 +34,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | string ScriptEngineName { get; } | 35 | string ScriptEngineName { get; } |
36 | 36 | ||
37 | string GetAssemblyName(UUID itemID); | ||
38 | string GetXMLState(UUID itemID); | 37 | string GetXMLState(UUID itemID); |
39 | bool CanBeDeleted(UUID itemID); | 38 | void SetXMLState(UUID itemID, string xml); |
40 | 39 | ||
41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 40 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 41 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 2d41342..b031f61 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -163,8 +163,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
163 | // Check control flags | 163 | // Check control flags |
164 | bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS); | 164 | bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS); |
165 | bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); | 165 | bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); |
166 | bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS; | 166 | bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS); |
167 | bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG; | 167 | bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG); |
168 | //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; | 168 | //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; |
169 | //bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; | 169 | //bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; |
170 | bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS; | 170 | bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS; |
@@ -252,8 +252,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
252 | else if (m_movementAnimation == "LAND") | 252 | else if (m_movementAnimation == "LAND") |
253 | { | 253 | { |
254 | float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f; | 254 | float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f; |
255 | 255 | if ((m_animTickFall != 0) && (landElapsed <= FALL_DELAY)) | |
256 | if (landElapsed <= FALL_DELAY) | ||
257 | return "LAND"; | 256 | return "LAND"; |
258 | } | 257 | } |
259 | 258 | ||
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 5b571c7..9a7863b 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
131 | if (left > 0) | 131 | if (left > 0) |
132 | { | 132 | { |
133 | x = m_inventoryDeletes.Dequeue(); | 133 | x = m_inventoryDeletes.Dequeue(); |
134 | if (!x.objectGroup.CanBeDeleted()) | ||
135 | { | ||
136 | m_inventoryDeletes.Enqueue(x); | ||
137 | return true; | ||
138 | } | ||
139 | 134 | ||
140 | m_log.DebugFormat( | 135 | m_log.DebugFormat( |
141 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); | 136 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 66fb918..83208e9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -840,8 +840,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
840 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) | 840 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) |
841 | { | 841 | { |
842 | SceneObjectPart part = GetSceneObjectPart(localID); | 842 | SceneObjectPart part = GetSceneObjectPart(localID); |
843 | SceneObjectGroup group = part.ParentGroup; | 843 | SceneObjectGroup group = null; |
844 | if (group != null) | 844 | if (part != null) |
845 | { | ||
846 | group = part.ParentGroup; | ||
847 | } | ||
848 | if (part != null && group != null) | ||
845 | { | 849 | { |
846 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); | 850 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); |
847 | if (item == null) | 851 | if (item == null) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4ffa1a2..3034f9a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -387,6 +387,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | { | 387 | { |
388 | get { return StatsReporter.getLastReportedSimFPS(); } | 388 | get { return StatsReporter.getLastReportedSimFPS(); } |
389 | } | 389 | } |
390 | |||
391 | public float[] SimulatorStats | ||
392 | { | ||
393 | get { return StatsReporter.getLastReportedSimStats(); } | ||
394 | } | ||
390 | 395 | ||
391 | public string DefaultScriptEngine | 396 | public string DefaultScriptEngine |
392 | { | 397 | { |
@@ -618,7 +623,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
618 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 623 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
619 | m_persistAfter *= 10000000; | 624 | m_persistAfter *= 10000000; |
620 | 625 | ||
621 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); | 626 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
622 | 627 | ||
623 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 628 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
624 | if (packetConfig != null) | 629 | if (packetConfig != null) |
@@ -873,6 +878,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
873 | /// <param name="seconds">float indicating duration before restart.</param> | 878 | /// <param name="seconds">float indicating duration before restart.</param> |
874 | public virtual void Restart(float seconds) | 879 | public virtual void Restart(float seconds) |
875 | { | 880 | { |
881 | Restart(seconds, true); | ||
882 | } | ||
883 | |||
884 | /// <summary> | ||
885 | /// Given float seconds, this will restart the region. showDialog will optionally alert the users. | ||
886 | /// </summary> | ||
887 | /// <param name="seconds">float indicating duration before restart.</param> | ||
888 | public virtual void Restart(float seconds, bool showDialog) | ||
889 | { | ||
876 | // notifications are done in 15 second increments | 890 | // notifications are done in 15 second increments |
877 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request | 891 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request |
878 | // It's a 'Cancel restart' request. | 892 | // It's a 'Cancel restart' request. |
@@ -893,8 +907,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
893 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); | 907 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); |
894 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); | 908 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); |
895 | m_restartTimer.Start(); | 909 | m_restartTimer.Start(); |
896 | m_dialogModule.SendNotificationToUsersInRegion( | 910 | if (showDialog) |
897 | UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); | 911 | { |
912 | m_dialogModule.SendNotificationToUsersInRegion( | ||
913 | UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + (seconds / 60).ToString() + " Minutes"); | ||
914 | } | ||
898 | } | 915 | } |
899 | } | 916 | } |
900 | 917 | ||
@@ -2381,103 +2398,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2381 | return successYN; | 2398 | return successYN; |
2382 | } | 2399 | } |
2383 | 2400 | ||
2384 | /// <summary> | ||
2385 | /// Handle a scene object that is crossing into this region from another. | ||
2386 | /// NOTE: Unused as of 2009-02-09. Soon to be deleted. | ||
2387 | /// </summary> | ||
2388 | /// <param name="regionHandle"></param> | ||
2389 | /// <param name="primID"></param> | ||
2390 | /// <param name="objXMLData"></param> | ||
2391 | /// <param name="XMLMethod"></param> | ||
2392 | /// <returns></returns> | ||
2393 | public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) | ||
2394 | { | ||
2395 | if (XMLMethod == 0) | ||
2396 | { | ||
2397 | m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); | ||
2398 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); | ||
2399 | if (sceneObject.IsAttachment) | ||
2400 | sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
2401 | |||
2402 | return AddSceneObject(sceneObject); | ||
2403 | } | ||
2404 | else if ((XMLMethod == 100) && m_allowScriptCrossings) | ||
2405 | { | ||
2406 | m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor"); | ||
2407 | |||
2408 | XmlDocument doc = new XmlDocument(); | ||
2409 | doc.LoadXml(objXMLData); | ||
2410 | |||
2411 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); | ||
2412 | if (rootL.Count == 1) | ||
2413 | { | ||
2414 | XmlNode rootNode = rootL[0]; | ||
2415 | if (rootNode != null) | ||
2416 | { | ||
2417 | XmlNodeList partL = rootNode.ChildNodes; | ||
2418 | |||
2419 | foreach (XmlNode part in partL) | ||
2420 | { | ||
2421 | XmlNodeList nodeL = part.ChildNodes; | ||
2422 | |||
2423 | switch (part.Name) | ||
2424 | { | ||
2425 | case "Assemblies": | ||
2426 | foreach (XmlNode asm in nodeL) | ||
2427 | { | ||
2428 | string fn = asm.Attributes.GetNamedItem("Filename").Value; | ||
2429 | |||
2430 | Byte[] filedata = Convert.FromBase64String(asm.InnerText); | ||
2431 | string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); | ||
2432 | path = Path.Combine(path, fn); | ||
2433 | |||
2434 | if (!File.Exists(path)) | ||
2435 | { | ||
2436 | FileStream fs = File.Create(path); | ||
2437 | fs.Write(filedata, 0, filedata.Length); | ||
2438 | fs.Close(); | ||
2439 | } | ||
2440 | } | ||
2441 | break; | ||
2442 | case "ScriptStates": | ||
2443 | foreach (XmlNode st in nodeL) | ||
2444 | { | ||
2445 | string id = st.Attributes.GetNamedItem("UUID").Value; | ||
2446 | UUID uuid = new UUID(id); | ||
2447 | XmlNode state = st.ChildNodes[0]; | ||
2448 | |||
2449 | XmlDocument sdoc = new XmlDocument(); | ||
2450 | XmlNode sxmlnode = sdoc.CreateNode( | ||
2451 | XmlNodeType.XmlDeclaration, | ||
2452 | "", ""); | ||
2453 | sdoc.AppendChild(sxmlnode); | ||
2454 | |||
2455 | XmlNode newnode = sdoc.ImportNode(state, true); | ||
2456 | sdoc.AppendChild(newnode); | ||
2457 | |||
2458 | string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); | ||
2459 | spath = Path.Combine(spath, uuid.ToString()); | ||
2460 | FileStream sfs = File.Create(spath + ".state"); | ||
2461 | ASCIIEncoding enc = new ASCIIEncoding(); | ||
2462 | Byte[] buf = enc.GetBytes(sdoc.InnerXml); | ||
2463 | sfs.Write(buf, 0, buf.Length); | ||
2464 | sfs.Close(); | ||
2465 | } | ||
2466 | break; | ||
2467 | } | ||
2468 | } | ||
2469 | } | ||
2470 | } | ||
2471 | |||
2472 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2473 | RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); | ||
2474 | |||
2475 | return true; | ||
2476 | } | ||
2477 | |||
2478 | return true; | ||
2479 | } | ||
2480 | |||
2481 | public bool IncomingCreateObject(ISceneObject sog) | 2401 | public bool IncomingCreateObject(ISceneObject sog) |
2482 | { | 2402 | { |
2483 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); | 2403 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
@@ -3350,7 +3270,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3350 | m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; | 3270 | m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; |
3351 | //m_eventManager.OnRegionUp += OtherRegionUp; | 3271 | //m_eventManager.OnRegionUp += OtherRegionUp; |
3352 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 3272 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
3353 | m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; | ||
3354 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 3273 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
3355 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | 3274 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; |
3356 | m_sceneGridService.KiPrimitive += SendKillObject; | 3275 | m_sceneGridService.KiPrimitive += SendKillObject; |
@@ -3374,7 +3293,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3374 | m_sceneGridService.KiPrimitive -= SendKillObject; | 3293 | m_sceneGridService.KiPrimitive -= SendKillObject; |
3375 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | 3294 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; |
3376 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 3295 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
3377 | m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; | ||
3378 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3296 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
3379 | //m_eventManager.OnRegionUp -= OtherRegionUp; | 3297 | //m_eventManager.OnRegionUp -= OtherRegionUp; |
3380 | m_sceneGridService.OnExpectUser -= HandleNewUserConnection; | 3298 | m_sceneGridService.OnExpectUser -= HandleNewUserConnection; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 76c6cab..3892769 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
85 | /// <summary> | 85 | /// <summary> |
86 | /// A Prim will arrive shortly | 86 | /// A Prim will arrive shortly |
87 | /// </summary> | 87 | /// </summary> |
88 | public event ExpectPrimDelegate OnExpectPrim; | ||
89 | public event CloseAgentConnection OnCloseAgentConnection; | 88 | public event CloseAgentConnection OnCloseAgentConnection; |
90 | 89 | ||
91 | /// <summary> | 90 | /// <summary> |
@@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | 115 | ||
117 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; | 116 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; |
118 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; | 117 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; |
119 | private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; | ||
120 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; | 118 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; |
121 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; | 119 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; |
122 | //private RegionUp handlerRegionUp = null; // OnRegionUp; | 120 | //private RegionUp handlerRegionUp = null; // OnRegionUp; |
@@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | /// <exception cref="System.Exception">Thrown if region registration fails.</exception> | 145 | /// <exception cref="System.Exception">Thrown if region registration fails.</exception> |
148 | public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos) | 146 | public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos) |
149 | { | 147 | { |
150 | //m_interregionCommsOut = comms_out; | ||
151 | |||
152 | //m_regionInfo = regionInfos; | ||
153 | //m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; | ||
154 | //regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); | ||
155 | |||
156 | //if (regionCommsHost != null) | ||
157 | //{ | ||
158 | // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString()); | ||
159 | |||
160 | // regionCommsHost.debugRegionName = regionInfos.RegionName; | ||
161 | // regionCommsHost.OnExpectPrim += IncomingPrimCrossing; | ||
162 | // regionCommsHost.OnExpectUser += NewUserConnection; | ||
163 | // regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; | ||
164 | // regionCommsHost.OnCloseAgentConnection += CloseConnection; | ||
165 | // regionCommsHost.OnRegionUp += newRegionUp; | ||
166 | // regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; | ||
167 | // regionCommsHost.OnLogOffUser += GridLogOffUser; | ||
168 | // regionCommsHost.OnGetLandData += FetchLandData; | ||
169 | //} | ||
170 | //else | ||
171 | //{ | ||
172 | // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null"); | ||
173 | //} | ||
174 | } | 148 | } |
175 | 149 | ||
176 | /// <summary> | 150 | /// <summary> |
@@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | /// </summary> | 153 | /// </summary> |
180 | public void Close() | 154 | public void Close() |
181 | { | 155 | { |
182 | |||
183 | //if (regionCommsHost != null) | ||
184 | //{ | ||
185 | // regionCommsHost.OnLogOffUser -= GridLogOffUser; | ||
186 | // regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; | ||
187 | // regionCommsHost.OnRegionUp -= newRegionUp; | ||
188 | // regionCommsHost.OnExpectUser -= NewUserConnection; | ||
189 | // regionCommsHost.OnExpectPrim -= IncomingPrimCrossing; | ||
190 | // regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; | ||
191 | // regionCommsHost.OnCloseAgentConnection -= CloseConnection; | ||
192 | // regionCommsHost.OnGetLandData -= FetchLandData; | ||
193 | |||
194 | // try | ||
195 | // { | ||
196 | // m_commsProvider.GridService.DeregisterRegion(m_regionInfo); | ||
197 | // } | ||
198 | // catch (Exception e) | ||
199 | // { | ||
200 | // m_log.ErrorFormat( | ||
201 | // "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing", | ||
202 | // m_regionInfo.RegionName, e); | ||
203 | // } | ||
204 | |||
205 | // regionCommsHost = null; | ||
206 | //} | ||
207 | } | 156 | } |
208 | 157 | ||
209 | #region CommsManager Event handlers | 158 | #region CommsManager Event handlers |
@@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
263 | } | 212 | } |
264 | } | 213 | } |
265 | 214 | ||
266 | /// <summary> | ||
267 | /// We have a new prim from a neighbor | ||
268 | /// </summary> | ||
269 | /// <param name="primID">unique ID for the primative</param> | ||
270 | /// <param name="objXMLData">XML2 encoded data of the primative</param> | ||
271 | /// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param> | ||
272 | /// <returns>True if the prim was accepted, false if it was not</returns> | ||
273 | protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod) | ||
274 | { | ||
275 | handlerExpectPrim = OnExpectPrim; | ||
276 | if (handlerExpectPrim != null) | ||
277 | { | ||
278 | return handlerExpectPrim(primID, objXMLData, XMLMethod); | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | return false; | ||
283 | } | ||
284 | |||
285 | } | ||
286 | |||
287 | protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical) | 215 | protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical) |
288 | { | 216 | { |
289 | handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; | 217 | handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index dfaa7ea..c2e3370 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -241,24 +241,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
241 | /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets | 241 | /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets |
242 | /// as well as the details of the prims themselves. | 242 | /// as well as the details of the prims themselves. |
243 | /// </summary> | 243 | /// </summary> |
244 | /// <param name="filename"></param> | 244 | /// <param name="cmdparams"></param> |
245 | public void SaveCurrentSceneToArchive(string filename) | 245 | public void SaveCurrentSceneToArchive(string[] cmdparams) |
246 | { | 246 | { |
247 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); | 247 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); |
248 | if (archiver != null) | 248 | if (archiver != null) |
249 | archiver.ArchiveRegion(filename); | 249 | archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams); |
250 | } | 250 | } |
251 | 251 | ||
252 | /// <summary> | 252 | /// <summary> |
253 | /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload | 253 | /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload |
254 | /// their assets to the asset service. | 254 | /// their assets to the asset service. |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <param name="filename"></param> | 256 | /// <param name="cmdparams"></param> |
257 | public void LoadArchiveToCurrentScene(string filename) | 257 | public void LoadArchiveToCurrentScene(string[] cmdparams) |
258 | { | 258 | { |
259 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); | 259 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); |
260 | if (archiver != null) | 260 | if (archiver != null) |
261 | archiver.DearchiveRegion(filename); | 261 | archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams); |
262 | } | 262 | } |
263 | 263 | ||
264 | public string SaveCurrentSceneMapToXmlString() | 264 | public string SaveCurrentSceneMapToXmlString() |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 3cec77f..5a06bdb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
309 | 309 | ||
310 | public string GetStateSnapshot() | 310 | public string GetStateSnapshot() |
311 | { | 311 | { |
312 | //m_log.Debug(" >>> GetStateSnapshot <<<"); | ||
313 | |||
314 | List<string> assemblies = new List<string>(); | ||
315 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); | 312 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); |
316 | 313 | ||
317 | foreach (SceneObjectPart part in m_parts.Values) | 314 | foreach (SceneObjectPart part in m_parts.Values) |
318 | { | 315 | { |
319 | foreach (string a in part.Inventory.GetScriptAssemblies()) | ||
320 | { | ||
321 | if (a != "" && !assemblies.Contains(a)) | ||
322 | assemblies.Add(a); | ||
323 | } | ||
324 | |||
325 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) | 316 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) |
326 | { | ||
327 | states[s.Key] = s.Value; | 317 | states[s.Key] = s.Value; |
328 | } | ||
329 | } | 318 | } |
330 | 319 | ||
331 | if (states.Count < 1 || assemblies.Count < 1) | 320 | if (states.Count < 1) |
332 | return ""; | 321 | return ""; |
333 | 322 | ||
334 | XmlDocument xmldoc = new XmlDocument(); | 323 | XmlDocument xmldoc = new XmlDocument(); |
@@ -342,104 +331,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
342 | 331 | ||
343 | xmldoc.AppendChild(rootElement); | 332 | xmldoc.AppendChild(rootElement); |
344 | 333 | ||
345 | XmlElement wrapper = xmldoc.CreateElement("", "Assemblies", | ||
346 | ""); | ||
347 | 334 | ||
348 | rootElement.AppendChild(wrapper); | 335 | XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates", |
349 | |||
350 | foreach (string assembly in assemblies) | ||
351 | { | ||
352 | string fn = Path.GetFileName(assembly); | ||
353 | if (fn == String.Empty) | ||
354 | continue; | ||
355 | |||
356 | String filedata = String.Empty; | ||
357 | |||
358 | if (File.Exists(assembly+".text")) | ||
359 | { | ||
360 | FileInfo tfi = new FileInfo(assembly+".text"); | ||
361 | |||
362 | if (tfi == null) | ||
363 | continue; | ||
364 | |||
365 | Byte[] tdata = new Byte[tfi.Length]; | ||
366 | |||
367 | try | ||
368 | { | ||
369 | FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read); | ||
370 | tfs.Read(tdata, 0, tdata.Length); | ||
371 | tfs.Close(); | ||
372 | } | ||
373 | catch (Exception e) | ||
374 | { | ||
375 | m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message); | ||
376 | } | ||
377 | |||
378 | filedata = new System.Text.ASCIIEncoding().GetString(tdata); | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | FileInfo fi = new FileInfo(assembly); | ||
383 | |||
384 | if (fi == null) | ||
385 | continue; | ||
386 | |||
387 | Byte[] data = new Byte[fi.Length]; | ||
388 | |||
389 | try | ||
390 | { | ||
391 | FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); | ||
392 | fs.Read(data, 0, data.Length); | ||
393 | fs.Close(); | ||
394 | } | ||
395 | catch (Exception e) | ||
396 | { | ||
397 | m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message); | ||
398 | } | ||
399 | |||
400 | filedata = System.Convert.ToBase64String(data); | ||
401 | } | ||
402 | XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", ""); | ||
403 | XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", ""); | ||
404 | assemblyName.Value = fn; | ||
405 | assemblyData.Attributes.Append(assemblyName); | ||
406 | |||
407 | assemblyData.InnerText = filedata; | ||
408 | |||
409 | wrapper.AppendChild(assemblyData); | ||
410 | } | ||
411 | |||
412 | wrapper = xmldoc.CreateElement("", "ScriptStates", | ||
413 | ""); | 336 | ""); |
414 | 337 | ||
415 | rootElement.AppendChild(wrapper); | 338 | rootElement.AppendChild(wrapper); |
416 | 339 | ||
417 | foreach (KeyValuePair<UUID, string> state in states) | 340 | foreach (KeyValuePair<UUID, string> state in states) |
418 | { | 341 | { |
419 | XmlElement stateData = xmldoc.CreateElement("", "State", ""); | ||
420 | |||
421 | XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", ""); | ||
422 | stateID.Value = state.Key.ToString(); | ||
423 | stateData.Attributes.Append(stateID); | ||
424 | |||
425 | XmlDocument sdoc = new XmlDocument(); | 342 | XmlDocument sdoc = new XmlDocument(); |
426 | sdoc.LoadXml(state.Value); | 343 | sdoc.LoadXml(state.Value); |
427 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); | 344 | XmlNodeList rootL = sdoc.GetElementsByTagName("State"); |
428 | XmlNode rootNode = rootL[0]; | 345 | XmlNode rootNode = rootL[0]; |
429 | 346 | ||
430 | XmlNode newNode = xmldoc.ImportNode(rootNode, true); | 347 | XmlNode newNode = xmldoc.ImportNode(rootNode, true); |
431 | stateData.AppendChild(newNode); | 348 | wrapper.AppendChild(newNode); |
432 | wrapper.AppendChild(stateData); | ||
433 | } | 349 | } |
434 | 350 | ||
435 | return xmldoc.InnerXml; | 351 | return xmldoc.InnerXml; |
436 | } | 352 | } |
437 | 353 | ||
438 | public void SetState(string objXMLData, UUID RegionID) | 354 | public void SetState(string objXMLData, IScene ins) |
439 | { | 355 | { |
356 | if (!(ins is Scene)) | ||
357 | return; | ||
358 | |||
359 | Scene s = (Scene)ins; | ||
360 | |||
440 | if (objXMLData == String.Empty) | 361 | if (objXMLData == String.Empty) |
441 | return; | 362 | return; |
442 | 363 | ||
364 | IScriptModule scriptModule = null; | ||
365 | |||
366 | foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>()) | ||
367 | { | ||
368 | if (sm.ScriptEngineName == s.DefaultScriptEngine) | ||
369 | scriptModule = sm; | ||
370 | else if (scriptModule == null) | ||
371 | scriptModule = sm; | ||
372 | } | ||
373 | |||
374 | if (scriptModule == null) | ||
375 | return; | ||
376 | |||
443 | XmlDocument doc = new XmlDocument(); | 377 | XmlDocument doc = new XmlDocument(); |
444 | try | 378 | try |
445 | { | 379 | { |
@@ -457,69 +391,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | } | 391 | } |
458 | 392 | ||
459 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); | 393 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); |
460 | if (rootL.Count == 1) | 394 | if (rootL.Count != 1) |
395 | return; | ||
396 | |||
397 | XmlElement rootE = (XmlElement)rootL[0]; | ||
398 | |||
399 | XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates"); | ||
400 | if (dataL.Count != 1) | ||
401 | return; | ||
402 | |||
403 | XmlElement dataE = (XmlElement)dataL[0]; | ||
404 | |||
405 | foreach (XmlNode n in dataE.ChildNodes) | ||
461 | { | 406 | { |
462 | XmlNode rootNode = rootL[0]; | 407 | XmlElement stateE = (XmlElement)n; |
463 | if (rootNode != null) | 408 | UUID itemID = new UUID(stateE.GetAttribute("UUID")); |
464 | { | 409 | |
465 | XmlNodeList partL = rootNode.ChildNodes; | 410 | scriptModule.SetXMLState(itemID, n.OuterXml); |
466 | |||
467 | foreach (XmlNode part in partL) | ||
468 | { | ||
469 | XmlNodeList nodeL = part.ChildNodes; | ||
470 | |||
471 | switch (part.Name) | ||
472 | { | ||
473 | case "Assemblies": | ||
474 | foreach (XmlNode asm in nodeL) | ||
475 | { | ||
476 | string fn = asm.Attributes.GetNamedItem("Filename").Value; | ||
477 | |||
478 | Byte[] filedata = Convert.FromBase64String(asm.InnerText); | ||
479 | string path = Path.Combine("ScriptEngines", RegionID.ToString()); | ||
480 | path = Path.Combine(path, fn); | ||
481 | |||
482 | if (!File.Exists(path)) | ||
483 | { | ||
484 | FileStream fs = File.Create(path); | ||
485 | fs.Write(filedata, 0, filedata.Length); | ||
486 | fs.Close(); | ||
487 | |||
488 | Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText); | ||
489 | fs = File.Create(path+".text"); | ||
490 | fs.Write(textbytes, 0, textbytes.Length); | ||
491 | fs.Close(); | ||
492 | } | ||
493 | } | ||
494 | break; | ||
495 | case "ScriptStates": | ||
496 | foreach (XmlNode st in nodeL) | ||
497 | { | ||
498 | string id = st.Attributes.GetNamedItem("UUID").Value; | ||
499 | UUID uuid = new UUID(id); | ||
500 | XmlNode state = st.ChildNodes[0]; | ||
501 | |||
502 | XmlDocument sdoc = new XmlDocument(); | ||
503 | XmlNode sxmlnode = sdoc.CreateNode( | ||
504 | XmlNodeType.XmlDeclaration, | ||
505 | "", ""); | ||
506 | sdoc.AppendChild(sxmlnode); | ||
507 | |||
508 | XmlNode newnode = sdoc.ImportNode(state, true); | ||
509 | sdoc.AppendChild(newnode); | ||
510 | |||
511 | string spath = Path.Combine("ScriptEngines", RegionID.ToString()); | ||
512 | spath = Path.Combine(spath, uuid.ToString()); | ||
513 | FileStream sfs = File.Create(spath + ".state"); | ||
514 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
515 | Byte[] buf = enc.GetBytes(sdoc.InnerXml); | ||
516 | sfs.Write(buf, 0, buf.Length); | ||
517 | sfs.Close(); | ||
518 | } | ||
519 | break; | ||
520 | } | ||
521 | } | ||
522 | } | ||
523 | } | 411 | } |
524 | } | 412 | } |
525 | } | 413 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ea4f2c7..f36ff1d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3380,17 +3380,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3380 | } | 3380 | } |
3381 | #endregion | 3381 | #endregion |
3382 | 3382 | ||
3383 | public bool CanBeDeleted() | ||
3384 | { | ||
3385 | foreach (SceneObjectPart part in Children.Values) | ||
3386 | { | ||
3387 | if (!part.CanBeDeleted()) | ||
3388 | return false; | ||
3389 | } | ||
3390 | |||
3391 | return true; | ||
3392 | } | ||
3393 | |||
3394 | public double GetUpdatePriority(IClientAPI client) | 3383 | public double GetUpdatePriority(IClientAPI client) |
3395 | { | 3384 | { |
3396 | switch (Scene.UpdatePrioritizationScheme) | 3385 | switch (Scene.UpdatePrioritizationScheme) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cdec135..19e3023 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -389,12 +389,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
389 | } | 389 | } |
390 | 390 | ||
391 | /// <value> | 391 | /// <value> |
392 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 392 | /// Get the inventory list |
393 | /// </value> | 393 | /// </value> |
394 | public TaskInventoryDictionary TaskInventory | 394 | public TaskInventoryDictionary TaskInventory |
395 | { | 395 | { |
396 | get { return m_inventory.Items; } | 396 | get { |
397 | set { m_inventory.Items = value; } | 397 | return m_inventory.Items; |
398 | } | ||
399 | set { | ||
400 | m_inventory.Items = value; | ||
401 | } | ||
398 | } | 402 | } |
399 | 403 | ||
400 | public uint ObjectFlags | 404 | public uint ObjectFlags |
@@ -2101,17 +2105,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2101 | //Trys to fetch sound id from prim's inventory. | 2105 | //Trys to fetch sound id from prim's inventory. |
2102 | //Prim's inventory doesn't support non script items yet | 2106 | //Prim's inventory doesn't support non script items yet |
2103 | 2107 | ||
2104 | lock (TaskInventory) | 2108 | TaskInventory.LockItemsForRead(true); |
2109 | |||
2110 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2105 | { | 2111 | { |
2106 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2112 | if (item.Value.Name == sound) |
2107 | { | 2113 | { |
2108 | if (item.Value.Name == sound) | 2114 | soundID = item.Value.ItemID; |
2109 | { | 2115 | break; |
2110 | soundID = item.Value.ItemID; | ||
2111 | break; | ||
2112 | } | ||
2113 | } | 2116 | } |
2114 | } | 2117 | } |
2118 | |||
2119 | TaskInventory.LockItemsForRead(false); | ||
2115 | } | 2120 | } |
2116 | 2121 | ||
2117 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2122 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
@@ -2457,17 +2462,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2457 | if (!UUID.TryParse(sound, out soundID)) | 2462 | if (!UUID.TryParse(sound, out soundID)) |
2458 | { | 2463 | { |
2459 | // search sound file from inventory | 2464 | // search sound file from inventory |
2460 | lock (TaskInventory) | 2465 | TaskInventory.LockItemsForRead(true); |
2466 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2461 | { | 2467 | { |
2462 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2468 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
2463 | { | 2469 | { |
2464 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 2470 | soundID = item.Value.ItemID; |
2465 | { | 2471 | break; |
2466 | soundID = item.Value.ItemID; | ||
2467 | break; | ||
2468 | } | ||
2469 | } | 2472 | } |
2470 | } | 2473 | } |
2474 | TaskInventory.LockItemsForRead(false); | ||
2471 | } | 2475 | } |
2472 | 2476 | ||
2473 | if (soundID == UUID.Zero) | 2477 | if (soundID == UUID.Zero) |
@@ -3803,10 +3807,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
3803 | 3807 | ||
3804 | Inventory.ApplyNextOwnerPermissions(); | 3808 | Inventory.ApplyNextOwnerPermissions(); |
3805 | } | 3809 | } |
3806 | |||
3807 | public bool CanBeDeleted() | ||
3808 | { | ||
3809 | return Inventory.CanBeDeleted(); | ||
3810 | } | ||
3811 | } | 3810 | } |
3812 | } | 3811 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index f4ca877..eca8588 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -80,7 +80,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | /// </value> | 80 | /// </value> |
81 | protected internal TaskInventoryDictionary Items | 81 | protected internal TaskInventoryDictionary Items |
82 | { | 82 | { |
83 | get { return m_items; } | 83 | get { |
84 | return m_items; | ||
85 | } | ||
84 | set | 86 | set |
85 | { | 87 | { |
86 | m_items = value; | 88 | m_items = value; |
@@ -116,22 +118,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | /// <param name="linkNum">Link number for the part</param> | 118 | /// <param name="linkNum">Link number for the part</param> |
117 | public void ResetInventoryIDs() | 119 | public void ResetInventoryIDs() |
118 | { | 120 | { |
119 | lock (Items) | 121 | m_items.LockItemsForWrite(true); |
122 | |||
123 | if (0 == Items.Count) | ||
120 | { | 124 | { |
121 | if (0 == Items.Count) | 125 | m_items.LockItemsForWrite(false); |
122 | return; | 126 | return; |
127 | } | ||
123 | 128 | ||
124 | HasInventoryChanged = true; | 129 | HasInventoryChanged = true; |
125 | m_part.ParentGroup.HasGroupChanged = true; | 130 | m_part.ParentGroup.HasGroupChanged = true; |
126 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 131 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
127 | Items.Clear(); | 132 | Items.Clear(); |
128 | 133 | ||
129 | foreach (TaskInventoryItem item in items) | 134 | foreach (TaskInventoryItem item in items) |
130 | { | 135 | { |
131 | item.ResetIDs(m_part.UUID); | 136 | item.ResetIDs(m_part.UUID); |
132 | Items.Add(item.ItemID, item); | 137 | Items.Add(item.ItemID, item); |
133 | } | ||
134 | } | 138 | } |
139 | m_items.LockItemsForWrite(false); | ||
135 | } | 140 | } |
136 | 141 | ||
137 | /// <summary> | 142 | /// <summary> |
@@ -140,25 +145,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | /// <param name="ownerId"></param> | 145 | /// <param name="ownerId"></param> |
141 | public void ChangeInventoryOwner(UUID ownerId) | 146 | public void ChangeInventoryOwner(UUID ownerId) |
142 | { | 147 | { |
143 | lock (Items) | 148 | m_items.LockItemsForWrite(true); |
149 | if (0 == Items.Count) | ||
144 | { | 150 | { |
145 | if (0 == Items.Count) | 151 | m_items.LockItemsForWrite(false); |
146 | { | 152 | return; |
147 | return; | 153 | } |
148 | } | ||
149 | 154 | ||
150 | HasInventoryChanged = true; | 155 | HasInventoryChanged = true; |
151 | m_part.ParentGroup.HasGroupChanged = true; | 156 | m_part.ParentGroup.HasGroupChanged = true; |
152 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 157 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
153 | foreach (TaskInventoryItem item in items) | 158 | foreach (TaskInventoryItem item in items) |
159 | { | ||
160 | if (ownerId != item.OwnerID) | ||
154 | { | 161 | { |
155 | if (ownerId != item.OwnerID) | 162 | item.LastOwnerID = item.OwnerID; |
156 | { | 163 | item.OwnerID = ownerId; |
157 | item.LastOwnerID = item.OwnerID; | ||
158 | item.OwnerID = ownerId; | ||
159 | } | ||
160 | } | 164 | } |
161 | } | 165 | } |
166 | m_items.LockItemsForWrite(false); | ||
162 | } | 167 | } |
163 | 168 | ||
164 | /// <summary> | 169 | /// <summary> |
@@ -167,24 +172,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
167 | /// <param name="groupID"></param> | 172 | /// <param name="groupID"></param> |
168 | public void ChangeInventoryGroup(UUID groupID) | 173 | public void ChangeInventoryGroup(UUID groupID) |
169 | { | 174 | { |
170 | lock (Items) | 175 | m_items.LockItemsForWrite(true); |
176 | if (0 == Items.Count) | ||
171 | { | 177 | { |
172 | if (0 == Items.Count) | 178 | m_items.LockItemsForWrite(false); |
173 | { | 179 | return; |
174 | return; | 180 | } |
175 | } | ||
176 | 181 | ||
177 | HasInventoryChanged = true; | 182 | HasInventoryChanged = true; |
178 | m_part.ParentGroup.HasGroupChanged = true; | 183 | m_part.ParentGroup.HasGroupChanged = true; |
179 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 184 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
180 | foreach (TaskInventoryItem item in items) | 185 | foreach (TaskInventoryItem item in items) |
186 | { | ||
187 | if (groupID != item.GroupID) | ||
181 | { | 188 | { |
182 | if (groupID != item.GroupID) | 189 | item.GroupID = groupID; |
183 | { | ||
184 | item.GroupID = groupID; | ||
185 | } | ||
186 | } | 190 | } |
187 | } | 191 | } |
192 | m_items.LockItemsForWrite(false); | ||
188 | } | 193 | } |
189 | 194 | ||
190 | /// <summary> | 195 | /// <summary> |
@@ -192,14 +197,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
192 | /// </summary> | 197 | /// </summary> |
193 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 198 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
194 | { | 199 | { |
195 | lock (m_items) | 200 | Items.LockItemsForRead(true); |
201 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | ||
202 | Items.LockItemsForRead(false); | ||
203 | foreach (TaskInventoryItem item in items) | ||
196 | { | 204 | { |
197 | foreach (TaskInventoryItem item in Items.Values) | 205 | if ((int)InventoryType.LSL == item.InvType) |
198 | { | 206 | { |
199 | if ((int)InventoryType.LSL == item.InvType) | 207 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
200 | { | ||
201 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
202 | } | ||
203 | } | 208 | } |
204 | } | 209 | } |
205 | } | 210 | } |
@@ -209,17 +214,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
209 | /// </summary> | 214 | /// </summary> |
210 | public void RemoveScriptInstances() | 215 | public void RemoveScriptInstances() |
211 | { | 216 | { |
212 | lock (Items) | 217 | Items.LockItemsForRead(true); |
218 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | ||
219 | Items.LockItemsForRead(false); | ||
220 | |||
221 | foreach (TaskInventoryItem item in items) | ||
213 | { | 222 | { |
214 | foreach (TaskInventoryItem item in Items.Values) | 223 | if ((int)InventoryType.LSL == item.InvType) |
215 | { | 224 | { |
216 | if ((int)InventoryType.LSL == item.InvType) | 225 | RemoveScriptInstance(item.ItemID); |
217 | { | 226 | m_part.RemoveScriptEvents(item.ItemID); |
218 | RemoveScriptInstance(item.ItemID); | ||
219 | m_part.RemoveScriptEvents(item.ItemID); | ||
220 | } | ||
221 | } | 227 | } |
222 | } | 228 | } |
229 | |||
230 | |||
223 | } | 231 | } |
224 | 232 | ||
225 | /// <summary> | 233 | /// <summary> |
@@ -244,8 +252,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | if (stateSource == 1 && // Prim crossing | 252 | if (stateSource == 1 && // Prim crossing |
245 | m_part.ParentGroup.Scene.m_trustBinaries) | 253 | m_part.ParentGroup.Scene.m_trustBinaries) |
246 | { | 254 | { |
255 | m_items.LockItemsForWrite(true); | ||
247 | m_items[item.ItemID].PermsMask = 0; | 256 | m_items[item.ItemID].PermsMask = 0; |
248 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 257 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
258 | m_items.LockItemsForWrite(false); | ||
249 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 259 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
250 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); | 260 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); |
251 | m_part.ParentGroup.AddActiveScriptCount(1); | 261 | m_part.ParentGroup.AddActiveScriptCount(1); |
@@ -266,8 +276,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | { | 276 | { |
267 | if (m_part.ParentGroup.m_savedScriptState != null) | 277 | if (m_part.ParentGroup.m_savedScriptState != null) |
268 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | 278 | RestoreSavedScriptState(item.OldItemID, item.ItemID); |
279 | m_items.LockItemsForWrite(true); | ||
269 | m_items[item.ItemID].PermsMask = 0; | 280 | m_items[item.ItemID].PermsMask = 0; |
270 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 281 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
282 | m_items.LockItemsForWrite(false); | ||
271 | string script = Utils.BytesToString(asset.Data); | 283 | string script = Utils.BytesToString(asset.Data); |
272 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 284 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
273 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | 285 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); |
@@ -302,20 +314,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
302 | /// </param> | 314 | /// </param> |
303 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) | 315 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) |
304 | { | 316 | { |
305 | lock (m_items) | 317 | m_items.LockItemsForRead(true); |
318 | if (m_items.ContainsKey(itemId)) | ||
306 | { | 319 | { |
307 | if (m_items.ContainsKey(itemId)) | 320 | TaskInventoryItem item = m_items[itemId]; |
308 | { | 321 | m_items.LockItemsForRead(false); |
309 | CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); | 322 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
310 | } | 323 | } |
311 | else | 324 | else |
312 | { | 325 | { |
313 | m_log.ErrorFormat( | 326 | m_items.LockItemsForRead(false); |
314 | "[PRIM INVENTORY]: " + | 327 | m_log.ErrorFormat( |
315 | "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", | 328 | "[PRIM INVENTORY]: " + |
316 | itemId, m_part.Name, m_part.UUID); | 329 | "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", |
317 | } | 330 | itemId, m_part.Name, m_part.UUID); |
318 | } | 331 | } |
332 | |||
319 | } | 333 | } |
320 | 334 | ||
321 | /// <summary> | 335 | /// <summary> |
@@ -346,11 +360,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
346 | /// <returns></returns> | 360 | /// <returns></returns> |
347 | private bool InventoryContainsName(string name) | 361 | private bool InventoryContainsName(string name) |
348 | { | 362 | { |
349 | foreach (TaskInventoryItem item in Items.Values) | 363 | m_items.LockItemsForRead(true); |
364 | foreach (TaskInventoryItem item in m_items.Values) | ||
350 | { | 365 | { |
351 | if (item.Name == name) | 366 | if (item.Name == name) |
367 | { | ||
368 | m_items.LockItemsForRead(false); | ||
352 | return true; | 369 | return true; |
370 | } | ||
353 | } | 371 | } |
372 | m_items.LockItemsForRead(false); | ||
354 | return false; | 373 | return false; |
355 | } | 374 | } |
356 | 375 | ||
@@ -392,7 +411,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
392 | /// <param name="item"></param> | 411 | /// <param name="item"></param> |
393 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) | 412 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) |
394 | { | 413 | { |
414 | m_items.LockItemsForRead(true); | ||
395 | List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values); | 415 | List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values); |
416 | m_items.LockItemsForRead(false); | ||
396 | foreach (TaskInventoryItem i in il) | 417 | foreach (TaskInventoryItem i in il) |
397 | { | 418 | { |
398 | if (i.Name == item.Name) | 419 | if (i.Name == item.Name) |
@@ -429,15 +450,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
429 | item.ParentPartID = m_part.UUID; | 450 | item.ParentPartID = m_part.UUID; |
430 | item.Name = name; | 451 | item.Name = name; |
431 | 452 | ||
432 | lock (m_items) | 453 | m_items.LockItemsForWrite(true); |
433 | { | 454 | m_items.Add(item.ItemID, item); |
434 | m_items.Add(item.ItemID, item); | 455 | m_items.LockItemsForWrite(false); |
435 | |||
436 | if (allowedDrop) | 456 | if (allowedDrop) |
437 | m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); | 457 | m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); |
438 | else | 458 | else |
439 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 459 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
440 | } | 460 | |
441 | 461 | ||
442 | m_inventorySerial++; | 462 | m_inventorySerial++; |
443 | //m_inventorySerial += 2; | 463 | //m_inventorySerial += 2; |
@@ -454,14 +474,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
454 | /// <param name="items"></param> | 474 | /// <param name="items"></param> |
455 | public void RestoreInventoryItems(ICollection<TaskInventoryItem> items) | 475 | public void RestoreInventoryItems(ICollection<TaskInventoryItem> items) |
456 | { | 476 | { |
457 | lock (m_items) | 477 | m_items.LockItemsForWrite(true); |
478 | foreach (TaskInventoryItem item in items) | ||
458 | { | 479 | { |
459 | foreach (TaskInventoryItem item in items) | 480 | m_items.Add(item.ItemID, item); |
460 | { | 481 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
461 | m_items.Add(item.ItemID, item); | ||
462 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
463 | } | ||
464 | } | 482 | } |
483 | m_items.LockItemsForWrite(false); | ||
465 | 484 | ||
466 | m_inventorySerial++; | 485 | m_inventorySerial++; |
467 | } | 486 | } |
@@ -474,8 +493,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
474 | public TaskInventoryItem GetInventoryItem(UUID itemId) | 493 | public TaskInventoryItem GetInventoryItem(UUID itemId) |
475 | { | 494 | { |
476 | TaskInventoryItem item; | 495 | TaskInventoryItem item; |
496 | m_items.LockItemsForRead(true); | ||
477 | m_items.TryGetValue(itemId, out item); | 497 | m_items.TryGetValue(itemId, out item); |
478 | 498 | m_items.LockItemsForRead(false); | |
479 | return item; | 499 | return item; |
480 | } | 500 | } |
481 | 501 | ||
@@ -487,45 +507,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
487 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 507 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
488 | public bool UpdateInventoryItem(TaskInventoryItem item) | 508 | public bool UpdateInventoryItem(TaskInventoryItem item) |
489 | { | 509 | { |
490 | lock (m_items) | 510 | m_items.LockItemsForWrite(true); |
511 | |||
512 | if (m_items.ContainsKey(item.ItemID)) | ||
491 | { | 513 | { |
492 | if (m_items.ContainsKey(item.ItemID)) | 514 | item.ParentID = m_part.UUID; |
515 | item.ParentPartID = m_part.UUID; | ||
516 | item.Flags = m_items[item.ItemID].Flags; | ||
517 | if (item.AssetID == UUID.Zero) | ||
493 | { | 518 | { |
494 | item.ParentID = m_part.UUID; | 519 | item.AssetID = m_items[item.ItemID].AssetID; |
495 | item.ParentPartID = m_part.UUID; | 520 | } |
496 | item.Flags = m_items[item.ItemID].Flags; | 521 | else if ((InventoryType)item.Type == InventoryType.Notecard) |
497 | if (item.AssetID == UUID.Zero) | 522 | { |
498 | { | 523 | ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID); |
499 | item.AssetID = m_items[item.ItemID].AssetID; | ||
500 | } | ||
501 | else if ((InventoryType)item.Type == InventoryType.Notecard) | ||
502 | { | ||
503 | ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID); | ||
504 | 524 | ||
505 | if (presence != null) | 525 | if (presence != null) |
506 | { | 526 | { |
507 | presence.ControllingClient.SendAgentAlertMessage( | 527 | presence.ControllingClient.SendAgentAlertMessage( |
508 | "Notecard saved", false); | 528 | "Notecard saved", false); |
509 | } | ||
510 | } | 529 | } |
530 | } | ||
511 | 531 | ||
512 | m_items[item.ItemID] = item; | 532 | m_items[item.ItemID] = item; |
513 | m_inventorySerial++; | 533 | m_inventorySerial++; |
514 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 534 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
515 | |||
516 | HasInventoryChanged = true; | ||
517 | m_part.ParentGroup.HasGroupChanged = true; | ||
518 | 535 | ||
519 | return true; | 536 | HasInventoryChanged = true; |
520 | } | 537 | m_part.ParentGroup.HasGroupChanged = true; |
521 | else | 538 | m_items.LockItemsForWrite(false); |
522 | { | 539 | return true; |
523 | m_log.ErrorFormat( | 540 | } |
524 | "[PRIM INVENTORY]: " + | 541 | else |
525 | "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", | 542 | { |
526 | item.ItemID, m_part.Name, m_part.UUID); | 543 | m_log.ErrorFormat( |
527 | } | 544 | "[PRIM INVENTORY]: " + |
545 | "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", | ||
546 | item.ItemID, m_part.Name, m_part.UUID); | ||
528 | } | 547 | } |
548 | m_items.LockItemsForWrite(false); | ||
529 | 549 | ||
530 | return false; | 550 | return false; |
531 | } | 551 | } |
@@ -538,51 +558,54 @@ namespace OpenSim.Region.Framework.Scenes | |||
538 | /// in this prim's inventory.</returns> | 558 | /// in this prim's inventory.</returns> |
539 | public int RemoveInventoryItem(UUID itemID) | 559 | public int RemoveInventoryItem(UUID itemID) |
540 | { | 560 | { |
541 | lock (m_items) | 561 | m_items.LockItemsForRead(true); |
562 | |||
563 | if (m_items.ContainsKey(itemID)) | ||
542 | { | 564 | { |
543 | if (m_items.ContainsKey(itemID)) | 565 | int type = m_items[itemID].InvType; |
566 | m_items.LockItemsForRead(false); | ||
567 | if (type == 10) // Script | ||
544 | { | 568 | { |
545 | int type = m_items[itemID].InvType; | 569 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); |
546 | if (type == 10) // Script | 570 | } |
547 | { | 571 | m_items.LockItemsForWrite(true); |
548 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); | 572 | m_items.Remove(itemID); |
549 | } | 573 | m_items.LockItemsForWrite(false); |
550 | m_items.Remove(itemID); | 574 | m_inventorySerial++; |
551 | m_inventorySerial++; | 575 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
552 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
553 | |||
554 | HasInventoryChanged = true; | ||
555 | m_part.ParentGroup.HasGroupChanged = true; | ||
556 | 576 | ||
557 | int scriptcount = 0; | 577 | HasInventoryChanged = true; |
558 | lock (m_items) | 578 | m_part.ParentGroup.HasGroupChanged = true; |
559 | { | ||
560 | foreach (TaskInventoryItem item in m_items.Values) | ||
561 | { | ||
562 | if (item.Type == 10) | ||
563 | { | ||
564 | scriptcount++; | ||
565 | } | ||
566 | } | ||
567 | } | ||
568 | 579 | ||
569 | if (scriptcount <= 0) | 580 | int scriptcount = 0; |
581 | m_items.LockItemsForRead(true); | ||
582 | foreach (TaskInventoryItem item in m_items.Values) | ||
583 | { | ||
584 | if (item.Type == 10) | ||
570 | { | 585 | { |
571 | m_part.RemFlag(PrimFlags.Scripted); | 586 | scriptcount++; |
572 | } | 587 | } |
573 | |||
574 | m_part.ScheduleFullUpdate(); | ||
575 | |||
576 | return type; | ||
577 | } | 588 | } |
578 | else | 589 | m_items.LockItemsForRead(false); |
590 | |||
591 | |||
592 | if (scriptcount <= 0) | ||
579 | { | 593 | { |
580 | m_log.ErrorFormat( | 594 | m_part.RemFlag(PrimFlags.Scripted); |
581 | "[PRIM INVENTORY]: " + | ||
582 | "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", | ||
583 | itemID, m_part.Name, m_part.UUID); | ||
584 | } | 595 | } |
596 | |||
597 | m_part.ScheduleFullUpdate(); | ||
598 | |||
599 | return type; | ||
585 | } | 600 | } |
601 | else | ||
602 | { | ||
603 | m_log.ErrorFormat( | ||
604 | "[PRIM INVENTORY]: " + | ||
605 | "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", | ||
606 | itemID, m_part.Name, m_part.UUID); | ||
607 | } | ||
608 | m_items.LockItemsForWrite(false); | ||
586 | 609 | ||
587 | return -1; | 610 | return -1; |
588 | } | 611 | } |
@@ -635,52 +658,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
635 | // isn't available (such as drag from prim inventory to agent inventory) | 658 | // isn't available (such as drag from prim inventory to agent inventory) |
636 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 659 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
637 | 660 | ||
638 | lock (m_items) | 661 | m_items.LockItemsForRead(true); |
662 | |||
663 | foreach (TaskInventoryItem item in m_items.Values) | ||
639 | { | 664 | { |
640 | foreach (TaskInventoryItem item in m_items.Values) | 665 | UUID ownerID = item.OwnerID; |
641 | { | 666 | uint everyoneMask = 0; |
642 | UUID ownerID = item.OwnerID; | 667 | uint baseMask = item.BasePermissions; |
643 | uint everyoneMask = 0; | 668 | uint ownerMask = item.CurrentPermissions; |
644 | uint baseMask = item.BasePermissions; | ||
645 | uint ownerMask = item.CurrentPermissions; | ||
646 | 669 | ||
647 | invString.AddItemStart(); | 670 | invString.AddItemStart(); |
648 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 671 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); |
649 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); | 672 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); |
650 | 673 | ||
651 | invString.AddPermissionsStart(); | 674 | invString.AddPermissionsStart(); |
652 | 675 | ||
653 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); | 676 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); |
654 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | 677 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); |
655 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0)); | 678 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0)); |
656 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | 679 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); |
657 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | 680 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); |
658 | 681 | ||
659 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 682 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
660 | invString.AddNameValueLine("owner_id", ownerID.ToString()); | 683 | invString.AddNameValueLine("owner_id", ownerID.ToString()); |
661 | 684 | ||
662 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); | 685 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); |
663 | 686 | ||
664 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); | 687 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); |
665 | invString.AddSectionEnd(); | 688 | invString.AddSectionEnd(); |
666 | 689 | ||
667 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | 690 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); |
668 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | 691 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); |
669 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | 692 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); |
670 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); | 693 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); |
671 | 694 | ||
672 | invString.AddSaleStart(); | 695 | invString.AddSaleStart(); |
673 | invString.AddNameValueLine("sale_type", "not"); | 696 | invString.AddNameValueLine("sale_type", "not"); |
674 | invString.AddNameValueLine("sale_price", "0"); | 697 | invString.AddNameValueLine("sale_price", "0"); |
675 | invString.AddSectionEnd(); | 698 | invString.AddSectionEnd(); |
676 | 699 | ||
677 | invString.AddNameValueLine("name", item.Name + "|"); | 700 | invString.AddNameValueLine("name", item.Name + "|"); |
678 | invString.AddNameValueLine("desc", item.Description + "|"); | 701 | invString.AddNameValueLine("desc", item.Description + "|"); |
679 | 702 | ||
680 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); | 703 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); |
681 | invString.AddSectionEnd(); | 704 | invString.AddSectionEnd(); |
682 | } | ||
683 | } | 705 | } |
706 | int count = m_items.Count; | ||
707 | m_items.LockItemsForRead(false); | ||
684 | 708 | ||
685 | fileData = Utils.StringToBytes(invString.BuildString); | 709 | fileData = Utils.StringToBytes(invString.BuildString); |
686 | 710 | ||
@@ -701,10 +725,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
701 | { | 725 | { |
702 | if (HasInventoryChanged) | 726 | if (HasInventoryChanged) |
703 | { | 727 | { |
704 | lock (Items) | 728 | Items.LockItemsForRead(true); |
705 | { | 729 | datastore.StorePrimInventory(m_part.UUID, Items.Values); |
706 | datastore.StorePrimInventory(m_part.UUID, Items.Values); | 730 | Items.LockItemsForRead(false); |
707 | } | ||
708 | 731 | ||
709 | HasInventoryChanged = false; | 732 | HasInventoryChanged = false; |
710 | } | 733 | } |
@@ -857,36 +880,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
857 | return ret; | 880 | return ret; |
858 | } | 881 | } |
859 | 882 | ||
860 | public string[] GetScriptAssemblies() | ||
861 | { | ||
862 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
863 | |||
864 | List<string> ret = new List<string>(); | ||
865 | if (engines == null) // No engine at all | ||
866 | return new string[0]; | ||
867 | |||
868 | foreach (TaskInventoryItem item in m_items.Values) | ||
869 | { | ||
870 | if (item.InvType == (int)InventoryType.LSL) | ||
871 | { | ||
872 | foreach (IScriptModule e in engines) | ||
873 | { | ||
874 | if (e != null) | ||
875 | { | ||
876 | string n = e.GetAssemblyName(item.ItemID); | ||
877 | if (n != String.Empty) | ||
878 | { | ||
879 | if (!ret.Contains(n)) | ||
880 | ret.Add(n); | ||
881 | break; | ||
882 | } | ||
883 | } | ||
884 | } | ||
885 | } | ||
886 | } | ||
887 | return ret.ToArray(); | ||
888 | } | ||
889 | |||
890 | public Dictionary<UUID, string> GetScriptStates() | 883 | public Dictionary<UUID, string> GetScriptStates() |
891 | { | 884 | { |
892 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 885 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
@@ -916,30 +909,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | } | 909 | } |
917 | return ret; | 910 | return ret; |
918 | } | 911 | } |
919 | |||
920 | public bool CanBeDeleted() | ||
921 | { | ||
922 | if (!ContainsScripts()) | ||
923 | return true; | ||
924 | |||
925 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
926 | |||
927 | if (engines == null) // No engine at all | ||
928 | return true; | ||
929 | |||
930 | foreach (TaskInventoryItem item in m_items.Values) | ||
931 | { | ||
932 | if (item.InvType == (int)InventoryType.LSL) | ||
933 | { | ||
934 | foreach (IScriptModule e in engines) | ||
935 | { | ||
936 | if (!e.CanBeDeleted(item.ItemID)) | ||
937 | return false; | ||
938 | } | ||
939 | } | ||
940 | } | ||
941 | |||
942 | return true; | ||
943 | } | ||
944 | } | 912 | } |
945 | } | 913 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e677cfd..cebd108 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
171 | protected RegionInfo m_regionInfo; | 171 | protected RegionInfo m_regionInfo; |
172 | protected ulong crossingFromRegion; | 172 | protected ulong crossingFromRegion; |
173 | 173 | ||
174 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; | 174 | private readonly Vector3[] Dir_Vectors = new Vector3[11]; |
175 | private bool m_isNudging = false; | 175 | private bool m_isNudging = false; |
176 | 176 | ||
177 | // Position of agent's camera in world (region cordinates) | 177 | // Position of agent's camera in world (region cordinates) |
@@ -241,6 +241,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
241 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | 241 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, |
242 | DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, | 242 | DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, |
243 | DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, | 243 | DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, |
244 | DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS, | ||
245 | DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG, | ||
244 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | 246 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG |
245 | } | 247 | } |
246 | 248 | ||
@@ -725,12 +727,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
725 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN | 727 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN |
726 | Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE | 728 | Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE |
727 | Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE | 729 | Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE |
728 | Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | 730 | Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE |
731 | Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE | ||
732 | Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | ||
729 | } | 733 | } |
730 | 734 | ||
731 | private Vector3[] GetWalkDirectionVectors() | 735 | private Vector3[] GetWalkDirectionVectors() |
732 | { | 736 | { |
733 | Vector3[] vector = new Vector3[9]; | 737 | Vector3[] vector = new Vector3[11]; |
734 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 738 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD |
735 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK | 739 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK |
736 | vector[2] = Vector3.UnitY; //LEFT | 740 | vector[2] = Vector3.UnitY; //LEFT |
@@ -739,13 +743,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
739 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN | 743 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN |
740 | vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE | 744 | vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE |
741 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE | 745 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE |
742 | vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge | 746 | vector[8] = Vector3.UnitY; //LEFT_NUDGE |
747 | vector[9] = -Vector3.UnitY; //RIGHT_NUDGE | ||
748 | vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE | ||
743 | return vector; | 749 | return vector; |
744 | } | 750 | } |
745 | 751 | ||
746 | private bool[] GetDirectionIsNudge() | 752 | private bool[] GetDirectionIsNudge() |
747 | { | 753 | { |
748 | bool[] isNudge = new bool[9]; | 754 | bool[] isNudge = new bool[11]; |
749 | isNudge[0] = false; //FORWARD | 755 | isNudge[0] = false; //FORWARD |
750 | isNudge[1] = false; //BACK | 756 | isNudge[1] = false; //BACK |
751 | isNudge[2] = false; //LEFT | 757 | isNudge[2] = false; //LEFT |
@@ -754,7 +760,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
754 | isNudge[5] = false; //DOWN | 760 | isNudge[5] = false; //DOWN |
755 | isNudge[6] = true; //FORWARD_NUDGE | 761 | isNudge[6] = true; //FORWARD_NUDGE |
756 | isNudge[7] = true; //BACK_NUDGE | 762 | isNudge[7] = true; //BACK_NUDGE |
757 | isNudge[8] = true; //DOWN_Nudge | 763 | isNudge[8] = true; //LEFT_NUDGE |
764 | isNudge[9] = true; //RIGHT_NUDGE | ||
765 | isNudge[10] = true; //DOWN_Nudge | ||
758 | return isNudge; | 766 | return isNudge; |
759 | } | 767 | } |
760 | 768 | ||
@@ -1618,21 +1626,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1618 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 1626 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); |
1619 | if (part != null) | 1627 | if (part != null) |
1620 | { | 1628 | { |
1629 | part.TaskInventory.LockItemsForRead(true); | ||
1621 | TaskInventoryDictionary taskIDict = part.TaskInventory; | 1630 | TaskInventoryDictionary taskIDict = part.TaskInventory; |
1622 | if (taskIDict != null) | 1631 | if (taskIDict != null) |
1623 | { | 1632 | { |
1624 | lock (taskIDict) | 1633 | foreach (UUID taskID in taskIDict.Keys) |
1625 | { | 1634 | { |
1626 | foreach (UUID taskID in taskIDict.Keys) | 1635 | UnRegisterControlEventsToScript(LocalId, taskID); |
1627 | { | 1636 | taskIDict[taskID].PermsMask &= ~( |
1628 | UnRegisterControlEventsToScript(LocalId, taskID); | 1637 | 2048 | //PERMISSION_CONTROL_CAMERA |
1629 | taskIDict[taskID].PermsMask &= ~( | 1638 | 4); // PERMISSION_TAKE_CONTROLS |
1630 | 2048 | //PERMISSION_CONTROL_CAMERA | ||
1631 | 4); // PERMISSION_TAKE_CONTROLS | ||
1632 | } | ||
1633 | } | 1639 | } |
1634 | |||
1635 | } | 1640 | } |
1641 | part.TaskInventory.LockItemsForRead(false); | ||
1636 | // Reset sit target. | 1642 | // Reset sit target. |
1637 | if (part.GetAvatarOnSitTarget() == UUID) | 1643 | if (part.GetAvatarOnSitTarget() == UUID) |
1638 | part.SetAvatarOnSitTarget(UUID.Zero); | 1644 | part.SetAvatarOnSitTarget(UUID.Zero); |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index ee288b3..56c6ed6 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
82 | private int m_fps = 0; | 82 | private int m_fps = 0; |
83 | // saved last reported value so there is something available for llGetRegionFPS | 83 | // saved last reported value so there is something available for llGetRegionFPS |
84 | private float lastReportedSimFPS = 0; | 84 | private float lastReportedSimFPS = 0; |
85 | private float[] lastReportedSimStats = new float[21]; | ||
85 | private float m_pfps = 0; | 86 | private float m_pfps = 0; |
86 | private int m_agentUpdates = 0; | 87 | private int m_agentUpdates = 0; |
87 | 88 | ||
@@ -259,6 +260,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | 260 | ||
260 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 261 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; |
261 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; | 262 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; |
263 | |||
264 | for (int i = 0; i < 21; i++) | ||
265 | { | ||
266 | lastReportedSimStats[i] = sb[i].StatValue; | ||
267 | } | ||
262 | 268 | ||
263 | SimStats simStats | 269 | SimStats simStats |
264 | = new SimStats( | 270 | = new SimStats( |
@@ -438,6 +444,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
438 | { | 444 | { |
439 | return lastReportedSimFPS; | 445 | return lastReportedSimFPS; |
440 | } | 446 | } |
447 | |||
448 | public float[] getLastReportedSimStats() | ||
449 | { | ||
450 | return lastReportedSimStats; | ||
451 | } | ||
441 | 452 | ||
442 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) | 453 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) |
443 | { | 454 | { |