diff options
Diffstat (limited to 'OpenSim/Region/Framework')
28 files changed, 415 insertions, 363 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs b/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs new file mode 100644 index 0000000..c5e678b --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Interfaces | ||
35 | { | ||
36 | public interface ISceneCommandsModule | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Sets the scene debug options. | ||
40 | /// </summary> | ||
41 | void SetSceneDebugOptions(Dictionary<string, string> options); | ||
42 | } | ||
43 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs b/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs index 6db6674..093d3f0 100644 --- a/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs +++ b/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs | |||
@@ -34,5 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url); | 34 | void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url); |
35 | void ScriptRemoved(UUID itemID); | 35 | void ScriptRemoved(UUID itemID); |
36 | void ObjectRemoved(UUID objectID); | 36 | void ObjectRemoved(UUID objectID); |
37 | void UnRegisterReceiver(string channelID, UUID itemID); | ||
37 | } | 38 | } |
38 | } | 39 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 9458079..d18571c 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -26,9 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -113,6 +114,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
113 | if (m_scenePresence.IsChildAgent) | 114 | if (m_scenePresence.IsChildAgent) |
114 | return; | 115 | return; |
115 | 116 | ||
117 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name); | ||
118 | |||
116 | if (m_animations.Remove(animID)) | 119 | if (m_animations.Remove(animID)) |
117 | SendAnimPack(); | 120 | SendAnimPack(); |
118 | } | 121 | } |
@@ -519,6 +522,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
519 | if (m_scenePresence.IsChildAgent) | 522 | if (m_scenePresence.IsChildAgent) |
520 | return; | 523 | return; |
521 | 524 | ||
525 | // m_log.DebugFormat( | ||
526 | // "[SCENE PRESENCE ANIMATOR]: Sending anim pack with animations '{0}', sequence '{1}', uuids '{2}'", | ||
527 | // string.Join(",", Array.ConvertAll<UUID, string>(animations, a => a.ToString())), | ||
528 | // string.Join(",", Array.ConvertAll<int, string>(seqs, s => s.ToString())), | ||
529 | // string.Join(",", Array.ConvertAll<UUID, string>(objectIDs, o => o.ToString()))); | ||
530 | |||
522 | m_scenePresence.Scene.ForEachClient( | 531 | m_scenePresence.Scene.ForEachClient( |
523 | delegate(IClientAPI client) | 532 | delegate(IClientAPI client) |
524 | { | 533 | { |
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index b788a3c..7181313 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.Framework.Scenes | 36 | namespace OpenSim.Region.Framework.Scenes |
36 | { | 37 | { |
@@ -38,7 +39,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
38 | { | 39 | { |
39 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | 41 | ||
41 | private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>(); | 42 | private readonly DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase> m_entities |
43 | = new DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase>(); | ||
42 | 44 | ||
43 | public int Count | 45 | public int Count |
44 | { | 46 | { |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 5b1c9f4..ac5f433 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -755,7 +755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | public event ScriptTimerEvent OnScriptTimerEvent; | 755 | public event ScriptTimerEvent OnScriptTimerEvent; |
756 | */ | 756 | */ |
757 | 757 | ||
758 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | 758 | public delegate void EstateToolsSunUpdate(ulong regionHandle); |
759 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 759 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
760 | 760 | ||
761 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; | 761 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; |
@@ -2536,13 +2536,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2536 | } | 2536 | } |
2537 | 2537 | ||
2538 | /// <summary> | 2538 | /// <summary> |
2539 | /// Updates the system as to how the position of the sun should be handled. | 2539 | /// Called when the sun's position parameters have changed in the Region and/or Estate |
2540 | /// </summary> | 2540 | /// </summary> |
2541 | /// <param name="regionHandle"></param> | 2541 | /// <param name="regionHandle">The region that changed</param> |
2542 | /// <param name="FixedTime">True if the Sun Position is fixed</param> | 2542 | public void TriggerEstateToolsSunUpdate(ulong regionHandle) |
2543 | /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param> | ||
2544 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> | ||
2545 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) | ||
2546 | { | 2543 | { |
2547 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; | 2544 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; |
2548 | if (handlerEstateToolsSunUpdate != null) | 2545 | if (handlerEstateToolsSunUpdate != null) |
@@ -2551,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2551 | { | 2548 | { |
2552 | try | 2549 | try |
2553 | { | 2550 | { |
2554 | d(regionHandle, FixedTime, useEstateTime, FixedSunHour); | 2551 | d(regionHandle); |
2555 | } | 2552 | } |
2556 | catch (Exception e) | 2553 | catch (Exception e) |
2557 | { | 2554 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c9d1205..65c50bf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -683,12 +683,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
683 | itemCopy.SalePrice = item.SalePrice; | 683 | itemCopy.SalePrice = item.SalePrice; |
684 | itemCopy.SaleType = item.SaleType; | 684 | itemCopy.SaleType = item.SaleType; |
685 | 685 | ||
686 | if (AddInventoryItem(itemCopy)) | 686 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
687 | { | 687 | if (invAccess != null) |
688 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 688 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); |
689 | if (invAccess != null) | 689 | AddInventoryItem(itemCopy); |
690 | Util.FireAndForget(delegate { invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); }); | ||
691 | } | ||
692 | 690 | ||
693 | if (!Permissions.BypassPermissions()) | 691 | if (!Permissions.BypassPermissions()) |
694 | { | 692 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 23006f2..784fc91 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -70,12 +70,77 @@ namespace OpenSim.Region.Framework.Scenes | |||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Show debug information about teleports. | 71 | /// Show debug information about teleports. |
72 | /// </summary> | 72 | /// </summary> |
73 | public bool DebugTeleporting { get; private set; } | 73 | public bool DebugTeleporting { get; set; } |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// Show debug information about the scene loop. | 76 | /// Show debug information about the scene loop. |
77 | /// </summary> | 77 | /// </summary> |
78 | public bool DebugUpdates { get; private set; } | 78 | public bool DebugUpdates { get; set; } |
79 | |||
80 | /// <summary> | ||
81 | /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and | ||
82 | /// if objects meet required conditions (m_dontPersistBefore and m_dontPersistAfter). | ||
83 | /// </summary> | ||
84 | /// <remarks> | ||
85 | /// Even if false, the scene will still be saved on clean shutdown. | ||
86 | /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels. | ||
87 | /// This needs to be fixed. | ||
88 | /// </remarks> | ||
89 | public bool PeriodicBackup { get; set; } | ||
90 | |||
91 | /// <summary> | ||
92 | /// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even | ||
93 | /// if the scene is being shut down for the final time. | ||
94 | /// </summary> | ||
95 | public bool UseBackup { get; set; } | ||
96 | |||
97 | /// <summary> | ||
98 | /// If false then physical objects are disabled, though collisions will continue as normal. | ||
99 | /// </summary> | ||
100 | public bool PhysicsEnabled { get; set; } | ||
101 | |||
102 | /// <summary> | ||
103 | /// If false then scripts are not enabled on the smiulator | ||
104 | /// </summary> | ||
105 | public bool ScriptsEnabled | ||
106 | { | ||
107 | get { return m_scripts_enabled; } | ||
108 | set | ||
109 | { | ||
110 | if (m_scripts_enabled != value) | ||
111 | { | ||
112 | if (!value) | ||
113 | { | ||
114 | m_log.Info("Stopping all Scripts in Scene"); | ||
115 | |||
116 | EntityBase[] entities = Entities.GetEntities(); | ||
117 | foreach (EntityBase ent in entities) | ||
118 | { | ||
119 | if (ent is SceneObjectGroup) | ||
120 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | ||
121 | } | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | m_log.Info("Starting all Scripts in Scene"); | ||
126 | |||
127 | EntityBase[] entities = Entities.GetEntities(); | ||
128 | foreach (EntityBase ent in entities) | ||
129 | { | ||
130 | if (ent is SceneObjectGroup) | ||
131 | { | ||
132 | SceneObjectGroup sog = (SceneObjectGroup)ent; | ||
133 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); | ||
134 | sog.ResumeScripts(); | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | |||
139 | m_scripts_enabled = value; | ||
140 | } | ||
141 | } | ||
142 | } | ||
143 | private bool m_scripts_enabled; | ||
79 | 144 | ||
80 | public SynchronizeSceneHandler SynchronizeScene; | 145 | public SynchronizeSceneHandler SynchronizeScene; |
81 | 146 | ||
@@ -284,8 +349,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
284 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 349 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
285 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 350 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); |
286 | 351 | ||
287 | private bool m_physics_enabled = true; | ||
288 | private bool m_scripts_enabled = true; | ||
289 | private string m_defaultScriptEngine; | 352 | private string m_defaultScriptEngine; |
290 | 353 | ||
291 | /// <summary> | 354 | /// <summary> |
@@ -348,7 +411,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
348 | 411 | ||
349 | private Timer m_mapGenerationTimer = new Timer(); | 412 | private Timer m_mapGenerationTimer = new Timer(); |
350 | private bool m_generateMaptiles; | 413 | private bool m_generateMaptiles; |
351 | private bool m_useBackup = true; | ||
352 | 414 | ||
353 | #endregion Fields | 415 | #endregion Fields |
354 | 416 | ||
@@ -614,11 +676,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
614 | get { return m_authenticateHandler; } | 676 | get { return m_authenticateHandler; } |
615 | } | 677 | } |
616 | 678 | ||
617 | public bool UseBackup | ||
618 | { | ||
619 | get { return m_useBackup; } | ||
620 | } | ||
621 | |||
622 | // an instance to the physics plugin's Scene object. | 679 | // an instance to the physics plugin's Scene object. |
623 | public PhysicsScene PhysicsScene | 680 | public PhysicsScene PhysicsScene |
624 | { | 681 | { |
@@ -762,15 +819,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
762 | // | 819 | // |
763 | // Out of memory | 820 | // Out of memory |
764 | // Operating system has killed the plugin | 821 | // Operating system has killed the plugin |
765 | m_sceneGraph.UnRecoverableError += RestartNow; | 822 | m_sceneGraph.UnRecoverableError |
823 | += () => | ||
824 | { | ||
825 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | ||
826 | RestartNow(); | ||
827 | }; | ||
766 | 828 | ||
767 | RegisterDefaultSceneEvents(); | 829 | RegisterDefaultSceneEvents(); |
768 | 830 | ||
769 | DumpAssetsToFile = dumpAssetsToFile; | 831 | DumpAssetsToFile = dumpAssetsToFile; |
770 | 832 | ||
833 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled | ||
834 | // better in the future. | ||
771 | m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; | 835 | m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; |
772 | 836 | ||
773 | m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; | 837 | PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics; |
774 | 838 | ||
775 | m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; | 839 | m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; |
776 | 840 | ||
@@ -787,8 +851,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
787 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 851 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
788 | 852 | ||
789 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | 853 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
790 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | 854 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
791 | if (!m_useBackup) | 855 | if (!UseBackup) |
792 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 856 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
793 | 857 | ||
794 | //Animation states | 858 | //Animation states |
@@ -965,6 +1029,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | { | 1029 | { |
966 | PhysicalPrims = true; | 1030 | PhysicalPrims = true; |
967 | CollidablePrims = true; | 1031 | CollidablePrims = true; |
1032 | PhysicsEnabled = true; | ||
1033 | |||
1034 | PeriodicBackup = true; | ||
1035 | UseBackup = true; | ||
968 | 1036 | ||
969 | BordersLocked = true; | 1037 | BordersLocked = true; |
970 | Border northBorder = new Border(); | 1038 | Border northBorder = new Border(); |
@@ -1207,83 +1275,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1207 | } | 1275 | } |
1208 | } | 1276 | } |
1209 | 1277 | ||
1210 | public void SetSceneCoreDebug(Dictionary<string, string> options) | ||
1211 | { | ||
1212 | if (options.ContainsKey("active")) | ||
1213 | { | ||
1214 | bool active; | ||
1215 | |||
1216 | if (bool.TryParse(options["active"], out active)) | ||
1217 | Active = active; | ||
1218 | } | ||
1219 | |||
1220 | if (options.ContainsKey("scripting")) | ||
1221 | { | ||
1222 | bool enableScripts = true; | ||
1223 | if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts) | ||
1224 | { | ||
1225 | if (!enableScripts) | ||
1226 | { | ||
1227 | m_log.Info("Stopping all Scripts in Scene"); | ||
1228 | |||
1229 | EntityBase[] entities = Entities.GetEntities(); | ||
1230 | foreach (EntityBase ent in entities) | ||
1231 | { | ||
1232 | if (ent is SceneObjectGroup) | ||
1233 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | ||
1234 | } | ||
1235 | } | ||
1236 | else | ||
1237 | { | ||
1238 | m_log.Info("Starting all Scripts in Scene"); | ||
1239 | |||
1240 | EntityBase[] entities = Entities.GetEntities(); | ||
1241 | foreach (EntityBase ent in entities) | ||
1242 | { | ||
1243 | if (ent is SceneObjectGroup) | ||
1244 | { | ||
1245 | SceneObjectGroup sog = (SceneObjectGroup)ent; | ||
1246 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); | ||
1247 | sog.ResumeScripts(); | ||
1248 | } | ||
1249 | } | ||
1250 | } | ||
1251 | |||
1252 | m_scripts_enabled = enableScripts; | ||
1253 | } | ||
1254 | } | ||
1255 | |||
1256 | if (options.ContainsKey("physics")) | ||
1257 | { | ||
1258 | bool enablePhysics; | ||
1259 | if (bool.TryParse(options["physics"], out enablePhysics)) | ||
1260 | m_physics_enabled = enablePhysics; | ||
1261 | } | ||
1262 | |||
1263 | // if (options.ContainsKey("collisions")) | ||
1264 | // { | ||
1265 | // // TODO: Implement. If false, should stop objects colliding, though possibly should still allow | ||
1266 | // // the avatar themselves to collide with the ground. | ||
1267 | // } | ||
1268 | |||
1269 | if (options.ContainsKey("teleport")) | ||
1270 | { | ||
1271 | bool enableTeleportDebugging; | ||
1272 | if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) | ||
1273 | DebugTeleporting = enableTeleportDebugging; | ||
1274 | } | ||
1275 | |||
1276 | if (options.ContainsKey("updates")) | ||
1277 | { | ||
1278 | bool enableUpdateDebugging; | ||
1279 | if (bool.TryParse(options["updates"], out enableUpdateDebugging)) | ||
1280 | { | ||
1281 | DebugUpdates = enableUpdateDebugging; | ||
1282 | GcNotify.Enabled = DebugUpdates; | ||
1283 | } | ||
1284 | } | ||
1285 | } | ||
1286 | |||
1287 | public int GetInaccurateNeighborCount() | 1278 | public int GetInaccurateNeighborCount() |
1288 | { | 1279 | { |
1289 | return m_neighbours.Count; | 1280 | return m_neighbours.Count; |
@@ -1332,16 +1323,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1332 | 1323 | ||
1333 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1324 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1334 | 1325 | ||
1335 | EntityBase[] entities = GetEntities(); | 1326 | Backup(false); |
1336 | foreach (EntityBase entity in entities) | ||
1337 | { | ||
1338 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) | ||
1339 | { | ||
1340 | ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false); | ||
1341 | } | ||
1342 | } | ||
1343 | |||
1344 | m_log.Debug("[SCENE]: Graph close"); | ||
1345 | m_sceneGraph.Close(); | 1327 | m_sceneGraph.Close(); |
1346 | 1328 | ||
1347 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1329 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1568,7 +1550,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1568 | } | 1550 | } |
1569 | 1551 | ||
1570 | tmpMS = Util.EnvironmentTickCount(); | 1552 | tmpMS = Util.EnvironmentTickCount(); |
1571 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1553 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1572 | m_sceneGraph.UpdatePreparePhysics(); | 1554 | m_sceneGraph.UpdatePreparePhysics(); |
1573 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1555 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1574 | 1556 | ||
@@ -1583,7 +1565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1583 | tmpMS = Util.EnvironmentTickCount(); | 1565 | tmpMS = Util.EnvironmentTickCount(); |
1584 | if (Frame % m_update_physics == 0) | 1566 | if (Frame % m_update_physics == 0) |
1585 | { | 1567 | { |
1586 | if (m_physics_enabled) | 1568 | if (PhysicsEnabled) |
1587 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); | 1569 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); |
1588 | 1570 | ||
1589 | if (SynchronizeScene != null) | 1571 | if (SynchronizeScene != null) |
@@ -1625,7 +1607,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1625 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1607 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1626 | } | 1608 | } |
1627 | 1609 | ||
1628 | if (Frame % m_update_backup == 0) | 1610 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1629 | { | 1611 | { |
1630 | tmpMS = Util.EnvironmentTickCount(); | 1612 | tmpMS = Util.EnvironmentTickCount(); |
1631 | UpdateStorageBackup(); | 1613 | UpdateStorageBackup(); |
@@ -5615,33 +5597,7 @@ Environment.Exit(1); | |||
5615 | 5597 | ||
5616 | public void TriggerEstateSunUpdate() | 5598 | public void TriggerEstateSunUpdate() |
5617 | { | 5599 | { |
5618 | float sun; | 5600 | EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); |
5619 | if (RegionInfo.RegionSettings.UseEstateSun) | ||
5620 | { | ||
5621 | sun = (float)RegionInfo.EstateSettings.SunPosition; | ||
5622 | if (RegionInfo.EstateSettings.UseGlobalTime) | ||
5623 | { | ||
5624 | sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f; | ||
5625 | } | ||
5626 | |||
5627 | // | ||
5628 | EventManager.TriggerEstateToolsSunUpdate( | ||
5629 | RegionInfo.RegionHandle, | ||
5630 | RegionInfo.EstateSettings.FixedSun, | ||
5631 | RegionInfo.RegionSettings.UseEstateSun, | ||
5632 | sun); | ||
5633 | } | ||
5634 | else | ||
5635 | { | ||
5636 | // Use the Sun Position from the Region Settings | ||
5637 | sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f; | ||
5638 | |||
5639 | EventManager.TriggerEstateToolsSunUpdate( | ||
5640 | RegionInfo.RegionHandle, | ||
5641 | RegionInfo.RegionSettings.FixedSun, | ||
5642 | RegionInfo.RegionSettings.UseEstateSun, | ||
5643 | sun); | ||
5644 | } | ||
5645 | } | 5601 | } |
5646 | 5602 | ||
5647 | private void HandleReloadEstate(string module, string[] cmd) | 5603 | private void HandleReloadEstate(string module, string[] cmd) |
@@ -6037,10 +5993,17 @@ Environment.Exit(1); | |||
6037 | GC.Collect(); | 5993 | GC.Collect(); |
6038 | } | 5994 | } |
6039 | 5995 | ||
6040 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 5996 | /// <summary> |
6041 | // because we can't assign the asset service to physics directly - at the | 5997 | /// Wrappers to get physics modules retrieve assets. |
6042 | // time physics are instantiated it's not registered but it will be by | 5998 | /// </summary> |
6043 | // the time the first prim exists. | 5999 | /// <remarks> |
6000 | /// Has to be done this way | ||
6001 | /// because we can't assign the asset service to physics directly - at the | ||
6002 | /// time physics are instantiated it's not registered but it will be by | ||
6003 | /// the time the first prim exists. | ||
6004 | /// </remarks> | ||
6005 | /// <param name="assetID"></param> | ||
6006 | /// <param name="callback"></param> | ||
6044 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) | 6007 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) |
6045 | { | 6008 | { |
6046 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); | 6009 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b008e66..dd8541c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -101,6 +101,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | /// </summary> | 101 | /// </summary> |
102 | public partial class SceneObjectGroup : EntityBase, ISceneObject | 102 | public partial class SceneObjectGroup : EntityBase, ISceneObject |
103 | { | 103 | { |
104 | // Axis selection bitmask used by SetAxisRotation() | ||
105 | // Just happen to be the same bits used by llSetStatus() and defined in ScriptBaseClass. | ||
106 | public enum axisSelect : int | ||
107 | { | ||
108 | STATUS_ROTATE_X = 0x002, | ||
109 | STATUS_ROTATE_Y = 0x004, | ||
110 | STATUS_ROTATE_Z = 0x008, | ||
111 | } | ||
112 | |||
104 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; | 113 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; |
105 | 114 | ||
106 | /// <summary> | 115 | /// <summary> |
@@ -502,11 +511,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
502 | 511 | ||
503 | if (Scene != null) | 512 | if (Scene != null) |
504 | { | 513 | { |
505 | // if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 514 | if ( |
506 | // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | 515 | // (Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) |
507 | // && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 516 | // || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
508 | if ((Scene.TestBorderCross(val, Cardinals.E) || Scene.TestBorderCross(val, Cardinals.W) | 517 | // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) |
509 | || Scene.TestBorderCross(val, Cardinals.N) || Scene.TestBorderCross(val, Cardinals.S)) | 518 | // || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) |
519 | // Experimental change for better border crossings. | ||
520 | // The commented out original lines above would, it seems, trigger | ||
521 | // a border crossing a little early or late depending on which | ||
522 | // direction the object was moving. | ||
523 | (Scene.TestBorderCross(val, Cardinals.E) | ||
524 | || Scene.TestBorderCross(val, Cardinals.W) | ||
525 | || Scene.TestBorderCross(val, Cardinals.N) | ||
526 | || Scene.TestBorderCross(val, Cardinals.S)) | ||
510 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 527 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) |
511 | { | 528 | { |
512 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 529 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
@@ -925,6 +942,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
925 | /// </remarks> | 942 | /// </remarks> |
926 | public UUID FromFolderID { get; set; } | 943 | public UUID FromFolderID { get; set; } |
927 | 944 | ||
945 | /// <summary> | ||
946 | /// IDs of all avatars sat on this scene object. | ||
947 | /// </summary> | ||
948 | /// <remarks> | ||
949 | /// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts. | ||
950 | /// This must be locked before it is read or written. | ||
951 | /// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions. | ||
952 | /// No avatar should appear more than once in this list. | ||
953 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. | ||
954 | /// </remarks> | ||
955 | protected internal List<UUID> m_sittingAvatars = new List<UUID>(); | ||
956 | |||
928 | #endregion | 957 | #endregion |
929 | 958 | ||
930 | // ~SceneObjectGroup() | 959 | // ~SceneObjectGroup() |
@@ -4493,17 +4522,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4493 | } | 4522 | } |
4494 | 4523 | ||
4495 | /// <summary> | 4524 | /// <summary> |
4525 | /// Get a copy of the list of sitting avatars on all prims of this object. | ||
4526 | /// </summary> | ||
4527 | /// <remarks> | ||
4528 | /// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat | ||
4529 | /// down after it move one place down the list. | ||
4530 | /// </remarks> | ||
4531 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> | ||
4532 | public List<UUID> GetSittingAvatars() | ||
4533 | { | ||
4534 | lock (m_sittingAvatars) | ||
4535 | return new List<UUID>(m_sittingAvatars); | ||
4536 | } | ||
4537 | |||
4538 | /// <summary> | ||
4496 | /// Gets the number of sitting avatars. | 4539 | /// Gets the number of sitting avatars. |
4497 | /// </summary> | 4540 | /// </summary> |
4498 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> | 4541 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> |
4499 | /// <returns></returns> | 4542 | /// <returns></returns> |
4500 | public int GetSittingAvatarsCount() | 4543 | public int GetSittingAvatarsCount() |
4501 | { | 4544 | { |
4502 | int count = 0; | 4545 | lock (m_sittingAvatars) |
4503 | 4546 | return m_sittingAvatars.Count; | |
4504 | Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount()); | ||
4505 | |||
4506 | return count; | ||
4507 | } | 4547 | } |
4508 | 4548 | ||
4509 | public override string ToString() | 4549 | public override string ToString() |
@@ -4512,7 +4552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4512 | } | 4552 | } |
4513 | 4553 | ||
4514 | #region ISceneObject | 4554 | #region ISceneObject |
4515 | 4555 | ||
4516 | public virtual ISceneObject CloneForNewScene() | 4556 | public virtual ISceneObject CloneForNewScene() |
4517 | { | 4557 | { |
4518 | SceneObjectGroup sog = Copy(false); | 4558 | SceneObjectGroup sog = Copy(false); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ff4ae85..f21058b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1342,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | public UUID SitTargetAvatar { get; set; } | 1342 | public UUID SitTargetAvatar { get; set; } |
1343 | 1343 | ||
1344 | /// <summary> | 1344 | /// <summary> |
1345 | /// IDs of all avatars start on this object part. | 1345 | /// IDs of all avatars sat on this part. |
1346 | /// </summary> | 1346 | /// </summary> |
1347 | /// <remarks> | 1347 | /// <remarks> |
1348 | /// We need to track this so that we can stop sat upon prims from being attached. | 1348 | /// We need to track this so that we can stop sat upon prims from being attached. |
@@ -2431,11 +2431,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2431 | public int GetAxisRotation(int axis) | 2431 | public int GetAxisRotation(int axis) |
2432 | { | 2432 | { |
2433 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 2433 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
2434 | if (axis == 2)//STATUS_ROTATE_X | 2434 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) |
2435 | return STATUS_ROTATE_X; | 2435 | return STATUS_ROTATE_X; |
2436 | if (axis == 4)//STATUS_ROTATE_Y | 2436 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) |
2437 | return STATUS_ROTATE_Y; | 2437 | return STATUS_ROTATE_Y; |
2438 | if (axis == 8)//STATUS_ROTATE_Z | 2438 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) |
2439 | return STATUS_ROTATE_Z; | 2439 | return STATUS_ROTATE_Z; |
2440 | 2440 | ||
2441 | return 0; | 2441 | return 0; |
@@ -2895,11 +2895,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2895 | 2895 | ||
2896 | public void PhysicsOutOfBounds(Vector3 pos) | 2896 | public void PhysicsOutOfBounds(Vector3 pos) |
2897 | { | 2897 | { |
2898 | m_log.Error("[PHYSICS]: Physical Object went out of bounds."); | 2898 | // Note: This is only being called on the root prim at this time. |
2899 | |||
2900 | m_log.ErrorFormat( | ||
2901 | "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.", | ||
2902 | Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition); | ||
2899 | 2903 | ||
2900 | RemFlag(PrimFlags.Physics); | 2904 | RemFlag(PrimFlags.Physics); |
2901 | DoPhysicsPropertyUpdate(false, true); | 2905 | DoPhysicsPropertyUpdate(false, true); |
2902 | //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
2903 | } | 2906 | } |
2904 | 2907 | ||
2905 | public void PhysicsRequestingTerseUpdate() | 2908 | public void PhysicsRequestingTerseUpdate() |
@@ -3322,13 +3325,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3322 | ParentGroup.SetAxisRotation(axis, rotate); | 3325 | ParentGroup.SetAxisRotation(axis, rotate); |
3323 | 3326 | ||
3324 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 3327 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
3325 | if (axis == 2)//STATUS_ROTATE_X | 3328 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0) |
3326 | STATUS_ROTATE_X = rotate; | 3329 | STATUS_ROTATE_X = rotate; |
3327 | 3330 | ||
3328 | if (axis == 4)//STATUS_ROTATE_Y | 3331 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0) |
3329 | STATUS_ROTATE_Y = rotate; | 3332 | STATUS_ROTATE_Y = rotate; |
3330 | 3333 | ||
3331 | if (axis == 8)//STATUS_ROTATE_Z | 3334 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0) |
3332 | STATUS_ROTATE_Z = rotate; | 3335 | STATUS_ROTATE_Z = rotate; |
3333 | } | 3336 | } |
3334 | 3337 | ||
@@ -4558,7 +4561,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4558 | if (ParentGroup.RootPart == this) | 4561 | if (ParentGroup.RootPart == this) |
4559 | AngularVelocity = new Vector3(0, 0, 0); | 4562 | AngularVelocity = new Vector3(0, 0, 0); |
4560 | } | 4563 | } |
4561 | else | 4564 | else if (SetVD != wasVD) |
4562 | { | 4565 | { |
4563 | if (ParentGroup.Scene.CollidablePrims) | 4566 | if (ParentGroup.Scene.CollidablePrims) |
4564 | { | 4567 | { |
@@ -5202,18 +5205,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
5202 | /// <param name='avatarId'></param> | 5205 | /// <param name='avatarId'></param> |
5203 | protected internal bool AddSittingAvatar(UUID avatarId) | 5206 | protected internal bool AddSittingAvatar(UUID avatarId) |
5204 | { | 5207 | { |
5205 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5208 | lock (ParentGroup.m_sittingAvatars) |
5206 | SitTargetAvatar = avatarId; | 5209 | { |
5210 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | ||
5211 | SitTargetAvatar = avatarId; | ||
5212 | |||
5213 | if (m_sittingAvatars == null) | ||
5214 | m_sittingAvatars = new HashSet<UUID>(); | ||
5207 | 5215 | ||
5208 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5216 | if (m_sittingAvatars.Add(avatarId)) |
5217 | { | ||
5218 | ParentGroup.m_sittingAvatars.Add(avatarId); | ||
5209 | 5219 | ||
5210 | if (sittingAvatars == null) | 5220 | return true; |
5211 | sittingAvatars = new HashSet<UUID>(); | 5221 | } |
5212 | 5222 | ||
5213 | lock (sittingAvatars) | 5223 | return false; |
5214 | { | ||
5215 | m_sittingAvatars = sittingAvatars; | ||
5216 | return m_sittingAvatars.Add(avatarId); | ||
5217 | } | 5224 | } |
5218 | } | 5225 | } |
5219 | 5226 | ||
@@ -5227,27 +5234,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5227 | /// <param name='avatarId'></param> | 5234 | /// <param name='avatarId'></param> |
5228 | protected internal bool RemoveSittingAvatar(UUID avatarId) | 5235 | protected internal bool RemoveSittingAvatar(UUID avatarId) |
5229 | { | 5236 | { |
5230 | if (SitTargetAvatar == avatarId) | 5237 | lock (ParentGroup.m_sittingAvatars) |
5231 | SitTargetAvatar = UUID.Zero; | 5238 | { |
5232 | 5239 | if (SitTargetAvatar == avatarId) | |
5233 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5240 | SitTargetAvatar = UUID.Zero; |
5234 | 5241 | ||
5235 | // This can occur under a race condition where another thread | 5242 | if (m_sittingAvatars == null) |
5236 | if (sittingAvatars == null) | 5243 | return false; |
5237 | return false; | ||
5238 | 5244 | ||
5239 | lock (sittingAvatars) | 5245 | if (m_sittingAvatars.Remove(avatarId)) |
5240 | { | ||
5241 | if (sittingAvatars.Remove(avatarId)) | ||
5242 | { | 5246 | { |
5243 | if (sittingAvatars.Count == 0) | 5247 | if (m_sittingAvatars.Count == 0) |
5244 | m_sittingAvatars = null; | 5248 | m_sittingAvatars = null; |
5245 | 5249 | ||
5250 | ParentGroup.m_sittingAvatars.Remove(avatarId); | ||
5251 | |||
5246 | return true; | 5252 | return true; |
5247 | } | 5253 | } |
5248 | } | ||
5249 | 5254 | ||
5250 | return false; | 5255 | return false; |
5256 | } | ||
5251 | } | 5257 | } |
5252 | 5258 | ||
5253 | /// <summary> | 5259 | /// <summary> |
@@ -5257,16 +5263,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5257 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5263 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5258 | public HashSet<UUID> GetSittingAvatars() | 5264 | public HashSet<UUID> GetSittingAvatars() |
5259 | { | 5265 | { |
5260 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5266 | lock (ParentGroup.m_sittingAvatars) |
5261 | |||
5262 | if (sittingAvatars == null) | ||
5263 | { | 5267 | { |
5264 | return null; | 5268 | if (m_sittingAvatars == null) |
5265 | } | 5269 | return null; |
5266 | else | 5270 | else |
5267 | { | 5271 | return new HashSet<UUID>(m_sittingAvatars); |
5268 | lock (sittingAvatars) | ||
5269 | return new HashSet<UUID>(sittingAvatars); | ||
5270 | } | 5272 | } |
5271 | } | 5273 | } |
5272 | 5274 | ||
@@ -5277,13 +5279,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5277 | /// <returns></returns> | 5279 | /// <returns></returns> |
5278 | public int GetSittingAvatarsCount() | 5280 | public int GetSittingAvatarsCount() |
5279 | { | 5281 | { |
5280 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5282 | lock (ParentGroup.m_sittingAvatars) |
5281 | 5283 | { | |
5282 | if (sittingAvatars == null) | 5284 | if (m_sittingAvatars == null) |
5283 | return 0; | 5285 | return 0; |
5284 | 5286 | else | |
5285 | lock (sittingAvatars) | 5287 | return m_sittingAvatars.Count; |
5286 | return sittingAvatars.Count; | 5288 | } |
5287 | } | 5289 | } |
5288 | } | 5290 | } |
5289 | } | 5291 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a9195f7..1d6898b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -216,8 +216,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
216 | 216 | ||
217 | private Quaternion m_headrotation = Quaternion.Identity; | 217 | private Quaternion m_headrotation = Quaternion.Identity; |
218 | 218 | ||
219 | private string m_nextSitAnimation = String.Empty; | ||
220 | |||
221 | //PauPaw:Proper PID Controler for autopilot************ | 219 | //PauPaw:Proper PID Controler for autopilot************ |
222 | public bool MovingToTarget { get; private set; } | 220 | public bool MovingToTarget { get; private set; } |
223 | public Vector3 MoveToPositionTarget { get; private set; } | 221 | public Vector3 MoveToPositionTarget { get; private set; } |
@@ -591,18 +589,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
591 | set | 589 | set |
592 | { | 590 | { |
593 | m_bodyRot = value; | 591 | m_bodyRot = value; |
594 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); | ||
595 | if (PhysicsActor != null) | 592 | if (PhysicsActor != null) |
596 | { | 593 | { |
597 | try | 594 | try |
598 | { | 595 | { |
599 | PhysicsActor.Orientation = value; | 596 | PhysicsActor.Orientation = m_bodyRot; |
600 | } | 597 | } |
601 | catch (Exception e) | 598 | catch (Exception e) |
602 | { | 599 | { |
603 | m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message); | 600 | m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message); |
604 | } | 601 | } |
605 | } | 602 | } |
603 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); | ||
606 | } | 604 | } |
607 | } | 605 | } |
608 | 606 | ||
@@ -2202,25 +2200,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2202 | StandUp(); | 2200 | StandUp(); |
2203 | } | 2201 | } |
2204 | 2202 | ||
2205 | // if (!String.IsNullOrEmpty(sitAnimation)) | ||
2206 | // { | ||
2207 | // m_nextSitAnimation = sitAnimation; | ||
2208 | // } | ||
2209 | // else | ||
2210 | // { | ||
2211 | m_nextSitAnimation = "SIT"; | ||
2212 | // } | ||
2213 | |||
2214 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | ||
2215 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | 2203 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); |
2216 | 2204 | ||
2217 | if (part != null) | 2205 | if (part != null) |
2218 | { | 2206 | { |
2219 | if (!String.IsNullOrEmpty(part.SitAnimation)) | ||
2220 | { | ||
2221 | m_nextSitAnimation = part.SitAnimation; | ||
2222 | } | ||
2223 | |||
2224 | m_requestedSitTargetID = part.LocalId; | 2207 | m_requestedSitTargetID = part.LocalId; |
2225 | m_requestedSitTargetUUID = targetID; | 2208 | m_requestedSitTargetUUID = targetID; |
2226 | 2209 | ||
@@ -2341,18 +2324,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2341 | 2324 | ||
2342 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 2325 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
2343 | { | 2326 | { |
2344 | if (!String.IsNullOrEmpty(m_nextSitAnimation)) | ||
2345 | { | ||
2346 | HandleAgentSit(remoteClient, agentID, m_nextSitAnimation); | ||
2347 | } | ||
2348 | else | ||
2349 | { | ||
2350 | HandleAgentSit(remoteClient, agentID, "SIT"); | ||
2351 | } | ||
2352 | } | ||
2353 | |||
2354 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation) | ||
2355 | { | ||
2356 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 2327 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2357 | 2328 | ||
2358 | if (part != null) | 2329 | if (part != null) |
@@ -2425,7 +2396,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2425 | 2396 | ||
2426 | Velocity = Vector3.Zero; | 2397 | Velocity = Vector3.Zero; |
2427 | RemoveFromPhysicalScene(); | 2398 | RemoveFromPhysicalScene(); |
2428 | 2399 | ||
2400 | String sitAnimation = "SIT"; | ||
2401 | if (!String.IsNullOrEmpty(part.SitAnimation)) | ||
2402 | { | ||
2403 | sitAnimation = part.SitAnimation; | ||
2404 | } | ||
2429 | Animator.TrySetMovementAnimation(sitAnimation); | 2405 | Animator.TrySetMovementAnimation(sitAnimation); |
2430 | SendAvatarDataToAllAgents(); | 2406 | SendAvatarDataToAllAgents(); |
2431 | } | 2407 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index 4a21dc9..e209221 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Tests.Common; | |||
37 | namespace OpenSim.Region.Framework.Scenes.Tests | 37 | namespace OpenSim.Region.Framework.Scenes.Tests |
38 | { | 38 | { |
39 | [TestFixture] | 39 | [TestFixture] |
40 | public class BorderTests | 40 | public class BorderTests : OpenSimTestCase |
41 | { | 41 | { |
42 | [Test] | 42 | [Test] |
43 | public void TestCross() | 43 | public void TestCross() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index ea9fc93..766ce83 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common; | |||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
42 | { | 42 | { |
43 | [TestFixture, LongRunning] | 43 | [TestFixture, LongRunning] |
44 | public class EntityManagerTests | 44 | public class EntityManagerTests : OpenSimTestCase |
45 | { | 45 | { |
46 | static public Random random; | 46 | static public Random random; |
47 | SceneObjectGroup found; | 47 | SceneObjectGroup found; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index d23c965..575a081 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock; | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
41 | { | 41 | { |
42 | [TestFixture] | 42 | [TestFixture] |
43 | public class SceneGraphTests | 43 | public class SceneGraphTests : OpenSimTestCase |
44 | { | 44 | { |
45 | [Test] | 45 | [Test] |
46 | public void TestDuplicateObject() | 46 | public void TestDuplicateObject() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs index ab56f4e..2d831fa 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs | |||
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common.Mock; | |||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
42 | { | 42 | { |
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class SceneManagerTests | 44 | public class SceneManagerTests : OpenSimTestCase |
45 | { | 45 | { |
46 | [Test] | 46 | [Test] |
47 | public void TestClose() | 47 | public void TestClose() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 5b334c6..a07d64c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using Nini.Config; | ||
32 | using NUnit.Framework; | 33 | using NUnit.Framework; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -182,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
182 | /// <summary> | 183 | /// <summary> |
183 | /// Test deleting an object from a scene. | 184 | /// Test deleting an object from a scene. |
184 | /// </summary> | 185 | /// </summary> |
186 | /// <remarks> | ||
187 | /// This is the most basic form of delete. For all more sophisticated forms of derez (done asynchrnously | ||
188 | /// and where object can be taken to user inventory, etc.), see SceneObjectDeRezTests. | ||
189 | /// </remarks> | ||
185 | [Test] | 190 | [Test] |
186 | public void TestDeleteSceneObject() | 191 | public void TestDeleteSceneObject() |
187 | { | 192 | { |
@@ -201,100 +206,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
201 | } | 206 | } |
202 | 207 | ||
203 | /// <summary> | 208 | /// <summary> |
204 | /// Test deleting an object asynchronously | ||
205 | /// </summary> | ||
206 | [Test] | ||
207 | public void TestDeleteSceneObjectAsync() | ||
208 | { | ||
209 | TestHelpers.InMethod(); | ||
210 | //log4net.Config.XmlConfigurator.Configure(); | ||
211 | |||
212 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
213 | |||
214 | TestScene scene = new SceneHelpers().SetupScene(); | ||
215 | |||
216 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
217 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
218 | sogd.Enabled = false; | ||
219 | |||
220 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); | ||
221 | |||
222 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; | ||
223 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); | ||
224 | |||
225 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
226 | |||
227 | Assert.That(retrievedPart, Is.Not.Null); | ||
228 | |||
229 | Assert.That(so.IsDeleted, Is.False); | ||
230 | |||
231 | sogd.InventoryDeQueueAndDelete(); | ||
232 | |||
233 | Assert.That(so.IsDeleted, Is.True); | ||
234 | |||
235 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
236 | Assert.That(retrievedPart2, Is.Null); | ||
237 | } | ||
238 | |||
239 | /// <summary> | ||
240 | /// Test deleting an object asynchronously to user inventory. | ||
241 | /// </summary> | ||
242 | // [Test] | ||
243 | public void TestDeleteSceneObjectAsyncToUserInventory() | ||
244 | { | ||
245 | TestHelpers.InMethod(); | ||
246 | TestHelpers.EnableLogging(); | ||
247 | |||
248 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
249 | string myObjectName = "Fred"; | ||
250 | |||
251 | TestScene scene = new SceneHelpers().SetupScene(); | ||
252 | |||
253 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
254 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
255 | sogd.Enabled = false; | ||
256 | |||
257 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId); | ||
258 | |||
259 | // Assert.That( | ||
260 | // scene.CommsManager.UserAdminService.AddUser( | ||
261 | // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), | ||
262 | // Is.EqualTo(agentId)); | ||
263 | |||
264 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId); | ||
265 | InventoryFolderBase folder1 | ||
266 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1"); | ||
267 | |||
268 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; | ||
269 | scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID); | ||
270 | |||
271 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
272 | |||
273 | Assert.That(retrievedPart, Is.Not.Null); | ||
274 | Assert.That(so.IsDeleted, Is.False); | ||
275 | |||
276 | sogd.InventoryDeQueueAndDelete(); | ||
277 | |||
278 | Assert.That(so.IsDeleted, Is.True); | ||
279 | |||
280 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
281 | Assert.That(retrievedPart2, Is.Null); | ||
282 | |||
283 | // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | ||
284 | |||
285 | InventoryItemBase retrievedItem | ||
286 | = UserInventoryHelpers.GetInventoryItem( | ||
287 | scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName); | ||
288 | |||
289 | // Check that we now have the taken part in our inventory | ||
290 | Assert.That(retrievedItem, Is.Not.Null); | ||
291 | |||
292 | // Check that the taken part has actually disappeared | ||
293 | // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
294 | // Assert.That(retrievedPart, Is.Null); | ||
295 | } | ||
296 | |||
297 | /// <summary> | ||
298 | /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not | 209 | /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not |
299 | /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by | 210 | /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by |
300 | /// OpenSim. | 211 | /// OpenSim. |
@@ -329,4 +240,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
329 | Assert.That(sog.Parts.Length, Is.EqualTo(2)); | 240 | Assert.That(sog.Parts.Length, Is.EqualTo(2)); |
330 | } | 241 | } |
331 | } | 242 | } |
332 | } | 243 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 0076f41..c1522e7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -33,22 +33,24 @@ using NUnit.Framework; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
36 | using OpenSim.Region.CoreModules.World.Permissions; | 37 | using OpenSim.Region.CoreModules.World.Permissions; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Tests.Common; | 40 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 41 | using OpenSim.Tests.Common.Mock; |
40 | 42 | ||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 43 | namespace OpenSim.Region.Framework.Scenes.Tests |
42 | { | 44 | { |
43 | /// <summary> | 45 | /// <summary> |
44 | /// Tests derez of scene objects by users. | 46 | /// Tests derez of scene objects. |
45 | /// </summary> | 47 | /// </summary> |
46 | /// <remarks> | 48 | /// <remarks> |
47 | /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. | 49 | /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. |
48 | /// TODO: These tests are very incomplete - they only test for a few conditions. | 50 | /// TODO: These tests are incomplete - need to test more kinds of derez (e.g. return object). |
49 | /// </remarks> | 51 | /// </remarks> |
50 | [TestFixture] | 52 | [TestFixture] |
51 | public class SceneObjectDeRezTests | 53 | public class SceneObjectDeRezTests : OpenSimTestCase |
52 | { | 54 | { |
53 | /// <summary> | 55 | /// <summary> |
54 | /// Test deleting an object from a scene. | 56 | /// Test deleting an object from a scene. |
@@ -76,14 +78,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
76 | = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | 78 | = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); |
77 | part.Name = "obj1"; | 79 | part.Name = "obj1"; |
78 | scene.AddNewSceneObject(new SceneObjectGroup(part), false); | 80 | scene.AddNewSceneObject(new SceneObjectGroup(part), false); |
81 | |||
79 | List<uint> localIds = new List<uint>(); | 82 | List<uint> localIds = new List<uint>(); |
80 | localIds.Add(part.LocalId); | 83 | localIds.Add(part.LocalId); |
81 | |||
82 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); | 84 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); |
85 | |||
86 | // Check that object isn't deleted until we crank the sogd handle. | ||
87 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
88 | Assert.That(retrievedPart, Is.Not.Null); | ||
89 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
90 | |||
83 | sogd.InventoryDeQueueAndDelete(); | 91 | sogd.InventoryDeQueueAndDelete(); |
84 | 92 | ||
85 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 93 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); |
86 | Assert.That(retrievedPart, Is.Null); | 94 | Assert.That(retrievedPart2, Is.Null); |
87 | } | 95 | } |
88 | 96 | ||
89 | /// <summary> | 97 | /// <summary> |
@@ -124,6 +132,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
124 | // Object should still be in the scene. | 132 | // Object should still be in the scene. |
125 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 133 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
126 | Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); | 134 | Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); |
127 | } | 135 | } |
136 | |||
137 | /// <summary> | ||
138 | /// Test deleting an object asynchronously to user inventory. | ||
139 | /// </summary> | ||
140 | [Test] | ||
141 | public void TestDeleteSceneObjectAsyncToUserInventory() | ||
142 | { | ||
143 | TestHelpers.InMethod(); | ||
144 | // TestHelpers.EnableLogging(); | ||
145 | |||
146 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
147 | string myObjectName = "Fred"; | ||
148 | |||
149 | TestScene scene = new SceneHelpers().SetupScene(); | ||
150 | |||
151 | IConfigSource configSource = new IniConfigSource(); | ||
152 | IConfig config = configSource.AddConfig("Modules"); | ||
153 | config.Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
154 | SceneHelpers.SetupSceneModules( | ||
155 | scene, configSource, new object[] { new BasicInventoryAccessModule() }); | ||
156 | |||
157 | SceneHelpers.SetupSceneModules(scene, new object[] { }); | ||
158 | |||
159 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
160 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
161 | sogd.Enabled = false; | ||
162 | |||
163 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId); | ||
164 | |||
165 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId); | ||
166 | InventoryFolderBase folder1 | ||
167 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1"); | ||
168 | |||
169 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; | ||
170 | scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID); | ||
171 | |||
172 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
173 | |||
174 | Assert.That(retrievedPart, Is.Not.Null); | ||
175 | Assert.That(so.IsDeleted, Is.False); | ||
176 | |||
177 | sogd.InventoryDeQueueAndDelete(); | ||
178 | |||
179 | Assert.That(so.IsDeleted, Is.True); | ||
180 | |||
181 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
182 | Assert.That(retrievedPart2, Is.Null); | ||
183 | |||
184 | // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | ||
185 | |||
186 | InventoryItemBase retrievedItem | ||
187 | = UserInventoryHelpers.GetInventoryItem( | ||
188 | scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName); | ||
189 | |||
190 | // Check that we now have the taken part in our inventory | ||
191 | Assert.That(retrievedItem, Is.Not.Null); | ||
192 | |||
193 | // Check that the taken part has actually disappeared | ||
194 | // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
195 | // Assert.That(retrievedPart, Is.Null); | ||
196 | } | ||
128 | } | 197 | } |
129 | } \ No newline at end of file | 198 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 0e525c9..9378e20 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -40,7 +40,7 @@ using log4net; | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
41 | { | 41 | { |
42 | [TestFixture] | 42 | [TestFixture] |
43 | public class SceneObjectLinkingTests | 43 | public class SceneObjectLinkingTests : OpenSimTestCase |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index e931859..1182c96 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
41 | /// Basic scene object resize tests | 41 | /// Basic scene object resize tests |
42 | /// </summary> | 42 | /// </summary> |
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class SceneObjectResizeTests | 44 | public class SceneObjectResizeTests : OpenSimTestCase |
45 | { | 45 | { |
46 | /// <summary> | 46 | /// <summary> |
47 | /// Test resizing an object | 47 | /// Test resizing an object |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index d2361f8..a58e735 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs | |||
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock; | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
41 | { | 41 | { |
42 | [TestFixture] | 42 | [TestFixture] |
43 | public class SceneObjectScriptTests | 43 | public class SceneObjectScriptTests : OpenSimTestCase |
44 | { | 44 | { |
45 | [Test] | 45 | [Test] |
46 | public void TestAddScript() | 46 | public void TestAddScript() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs index 6d255aa..abaa1d1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs | |||
@@ -42,14 +42,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
42 | /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) | 42 | /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) |
43 | /// </summary> | 43 | /// </summary> |
44 | [TestFixture] | 44 | [TestFixture] |
45 | public class SceneObjectSpatialTests | 45 | public class SceneObjectSpatialTests : OpenSimTestCase |
46 | { | 46 | { |
47 | TestScene m_scene; | 47 | TestScene m_scene; |
48 | UUID m_ownerId = TestHelpers.ParseTail(0x1); | 48 | UUID m_ownerId = TestHelpers.ParseTail(0x1); |
49 | 49 | ||
50 | [SetUp] | 50 | [SetUp] |
51 | public void SetUp() | 51 | public override void SetUp() |
52 | { | 52 | { |
53 | base.SetUp(); | ||
54 | |||
53 | m_scene = new SceneHelpers().SetupScene(); | 55 | m_scene = new SceneHelpers().SetupScene(); |
54 | } | 56 | } |
55 | 57 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 742c769..8eb3191 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
42 | /// Basic scene object status tests | 42 | /// Basic scene object status tests |
43 | /// </summary> | 43 | /// </summary> |
44 | [TestFixture] | 44 | [TestFixture] |
45 | public class SceneObjectStatusTests | 45 | public class SceneObjectStatusTests : OpenSimTestCase |
46 | { | 46 | { |
47 | private TestScene m_scene; | 47 | private TestScene m_scene; |
48 | private UUID m_ownerId = TestHelpers.ParseTail(0x1); | 48 | private UUID m_ownerId = TestHelpers.ParseTail(0x1); |
@@ -78,6 +78,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
78 | } | 78 | } |
79 | 79 | ||
80 | [Test] | 80 | [Test] |
81 | public void TestSetNonPhysicsVolumeDetectSinglePrim() | ||
82 | { | ||
83 | TestHelpers.InMethod(); | ||
84 | |||
85 | m_scene.AddSceneObject(m_so1); | ||
86 | |||
87 | SceneObjectPart rootPart = m_so1.RootPart; | ||
88 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
89 | |||
90 | m_so1.ScriptSetVolumeDetect(true); | ||
91 | |||
92 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | ||
93 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); | ||
94 | |||
95 | m_so1.ScriptSetVolumeDetect(false); | ||
96 | |||
97 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
98 | } | ||
99 | |||
100 | [Test] | ||
81 | public void TestSetPhysicsSinglePrim() | 101 | public void TestSetPhysicsSinglePrim() |
82 | { | 102 | { |
83 | TestHelpers.InMethod(); | 103 | TestHelpers.InMethod(); |
@@ -89,13 +109,32 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
89 | 109 | ||
90 | m_so1.ScriptSetPhysicsStatus(true); | 110 | m_so1.ScriptSetPhysicsStatus(true); |
91 | 111 | ||
92 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | ||
93 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | 112 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); |
94 | 113 | ||
95 | m_so1.ScriptSetPhysicsStatus(false); | 114 | m_so1.ScriptSetPhysicsStatus(false); |
96 | 115 | ||
97 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | 116 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); |
98 | } | 117 | } |
118 | |||
119 | [Test] | ||
120 | public void TestSetPhysicsVolumeDetectSinglePrim() | ||
121 | { | ||
122 | TestHelpers.InMethod(); | ||
123 | |||
124 | m_scene.AddSceneObject(m_so1); | ||
125 | |||
126 | SceneObjectPart rootPart = m_so1.RootPart; | ||
127 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
128 | |||
129 | m_so1.ScriptSetPhysicsStatus(true); | ||
130 | m_so1.ScriptSetVolumeDetect(true); | ||
131 | |||
132 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics)); | ||
133 | |||
134 | m_so1.ScriptSetVolumeDetect(false); | ||
135 | |||
136 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
137 | } | ||
99 | 138 | ||
100 | [Test] | 139 | [Test] |
101 | public void TestSetPhysicsLinkset() | 140 | public void TestSetPhysicsLinkset() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 646e5fa..1cd8ae9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
51 | /// Scene presence animation tests | 51 | /// Scene presence animation tests |
52 | /// </summary> | 52 | /// </summary> |
53 | [TestFixture] | 53 | [TestFixture] |
54 | public class ScenePresenceAnimationTests | 54 | public class ScenePresenceAnimationTests : OpenSimTestCase |
55 | { | 55 | { |
56 | [Test] | 56 | [Test] |
57 | public void TestFlyingAnimation() | 57 | public void TestFlyingAnimation() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index 1d1ff88..d80afd3 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -42,7 +42,7 @@ using OpenSim.Tests.Common.Mock; | |||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 42 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 43 | { |
44 | [TestFixture] | 44 | [TestFixture] |
45 | public class ScenePresenceAutopilotTests | 45 | public class ScenePresenceAutopilotTests : OpenSimTestCase |
46 | { | 46 | { |
47 | private TestScene m_scene; | 47 | private TestScene m_scene; |
48 | 48 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 493ab70..acaeb90 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -43,7 +43,7 @@ using System.Threading; | |||
43 | namespace OpenSim.Region.Framework.Scenes.Tests | 43 | namespace OpenSim.Region.Framework.Scenes.Tests |
44 | { | 44 | { |
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class ScenePresenceSitTests | 46 | public class ScenePresenceSitTests : OpenSimTestCase |
47 | { | 47 | { |
48 | private TestScene m_scene; | 48 | private TestScene m_scene; |
49 | private ScenePresence m_sp; | 49 | private ScenePresence m_sp; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 37b5184..8dd1f3d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
49 | /// Teleport tests in a standalone OpenSim | 49 | /// Teleport tests in a standalone OpenSim |
50 | /// </summary> | 50 | /// </summary> |
51 | [TestFixture] | 51 | [TestFixture] |
52 | public class ScenePresenceTeleportTests | 52 | public class ScenePresenceTeleportTests : OpenSimTestCase |
53 | { | 53 | { |
54 | [TestFixtureSetUp] | 54 | [TestFixtureSetUp] |
55 | public void FixtureInit() | 55 | public void FixtureInit() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index ac3da1e..9d8eb0b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
50 | /// Scene presence tests | 50 | /// Scene presence tests |
51 | /// </summary> | 51 | /// </summary> |
52 | [TestFixture] | 52 | [TestFixture] |
53 | public class SceneTests | 53 | public class SceneTests : OpenSimTestCase |
54 | { | 54 | { |
55 | /// <summary> | 55 | /// <summary> |
56 | /// Very basic scene update test. Should become more elaborate with time. | 56 | /// Very basic scene update test. Should become more elaborate with time. |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index a51e4e3..0b461f5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -50,7 +50,7 @@ using OpenSim.Tests.Common.Mock; | |||
50 | namespace OpenSim.Region.Framework.Tests | 50 | namespace OpenSim.Region.Framework.Tests |
51 | { | 51 | { |
52 | [TestFixture] | 52 | [TestFixture] |
53 | public class TaskInventoryTests | 53 | public class TaskInventoryTests : OpenSimTestCase |
54 | { | 54 | { |
55 | [Test] | 55 | [Test] |
56 | public void TestAddTaskInventoryItem() | 56 | public void TestAddTaskInventoryItem() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 198e487..dd27294 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -38,7 +38,7 @@ using OpenSim.Tests.Common.Mock; | |||
38 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
39 | { | 39 | { |
40 | [TestFixture] | 40 | [TestFixture] |
41 | public class UuidGathererTests | 41 | public class UuidGathererTests : OpenSimTestCase |
42 | { | 42 | { |
43 | protected IAssetService m_assetService; | 43 | protected IAssetService m_assetService; |
44 | protected UuidGatherer m_uuidGatherer; | 44 | protected UuidGatherer m_uuidGatherer; |