aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorBlueWall2012-03-22 21:27:03 -0400
committerBlueWall2012-03-22 21:27:03 -0400
commitc0672cb7dbceee42f452ef869432507bc473f3b2 (patch)
treefcd2169872f913de7d4c38942e09b35856a8f294 /OpenSim/Region
parentMerge branch 'master' of /home/opensim/src/opensim (diff)
parentRename Scene.StartTimer() to Start() - this method no longer uses a timer. C... (diff)
downloadopensim-SC_OLD-c0672cb7dbceee42f452ef869432507bc473f3b2.zip
opensim-SC_OLD-c0672cb7dbceee42f452ef869432507bc473f3b2.tar.gz
opensim-SC_OLD-c0672cb7dbceee42f452ef869432507bc473f3b2.tar.bz2
opensim-SC_OLD-c0672cb7dbceee42f452ef869432507bc473f3b2.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs (renamed from OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs)4
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs100
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs168
15 files changed, 306 insertions, 98 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index c6956fc..484159c 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -430,7 +430,7 @@ namespace OpenSim
430 430
431 mscene = scene; 431 mscene = scene;
432 432
433 scene.StartTimer(); 433 scene.Start();
434 434
435 scene.StartScripts(); 435 scene.StartScripts();
436 436
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
index 61c6a30..1fa4dd6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
@@ -48,15 +48,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
48 if (Util.ParseUniversalUserIdentifier(ids[0], out friendID, out tmp, out tmp, out tmp, out tmp)) 48 if (Util.ParseUniversalUserIdentifier(ids[0], out friendID, out tmp, out tmp, out tmp, out tmp))
49 { 49 {
50 string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI"); 50 string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI");
51 HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI); 51 if (friendsServerURI != string.Empty)
52 {
53 HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI);
52 54
53 List<UUID> friendsOnline = fConn.StatusNotification(ids, userID, online); 55 List<UUID> friendsOnline = fConn.StatusNotification(ids, userID, online);
54 56
55 if (online && friendsOnline.Count > 0) 57 if (online && friendsOnline.Count > 0)
56 { 58 {
57 IClientAPI client = m_FriendsModule.LocateClientObject(userID); 59 IClientAPI client = m_FriendsModule.LocateClientObject(userID);
58 if (client != null) 60 if (client != null)
59 client.SendAgentOnline(friendsOnline.ToArray()); 61 client.SendAgentOnline(friendsOnline.ToArray());
62 }
60 } 63 }
61 } 64 }
62 } 65 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index cc42f7f..a0ed5a5 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land
448 448
449 public bool IsRestrictedFromLand(UUID avatar) 449 public bool IsRestrictedFromLand(UUID avatar)
450 { 450 {
451 ExpireAccessList();
452
453 if (m_scene.Permissions.IsAdministrator(avatar)) 451 if (m_scene.Permissions.IsAdministrator(avatar))
454 return false; 452 return false;
455 453
@@ -459,20 +457,27 @@ namespace OpenSim.Region.CoreModules.World.Land
459 if (avatar == LandData.OwnerID) 457 if (avatar == LandData.OwnerID)
460 return false; 458 return false;
461 459
462 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 460 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
461 return false;
462
463 return (!IsInLandAccessList(avatar));
464 }
465
466 public bool IsInLandAccessList(UUID avatar)
467 {
468 ExpireAccessList();
469
470 if (LandData.ParcelAccessList.FindIndex(
471 delegate(LandAccessEntry e)
472 {
473 if (e.AgentID == avatar && e.Flags == AccessList.Access)
474 return true;
475 return false;
476 }) == -1)
463 { 477 {
464 if (LandData.ParcelAccessList.FindIndex( 478 return false;
465 delegate(LandAccessEntry e)
466 {
467 if (e.AgentID == avatar && e.Flags == AccessList.Access)
468 return true;
469 return false;
470 }) == -1)
471 {
472 return true;
473 }
474 } 479 }
475 return false; 480 return true;
476 } 481 }
477 482
478 public void SendLandUpdateToClient(IClientAPI remote_client) 483 public void SendLandUpdateToClient(IClientAPI remote_client)
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 6018c39..ac03747 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
94 private bool m_RegionOwnerIsGod = false; 94 private bool m_RegionOwnerIsGod = false;
95 private bool m_RegionManagerIsGod = false; 95 private bool m_RegionManagerIsGod = false;
96 private bool m_ParcelOwnerIsGod = false; 96 private bool m_ParcelOwnerIsGod = false;
97 97
98 private bool m_SimpleBuildPermissions = false;
99
98 /// <value> 100 /// <value>
99 /// The set of users that are allowed to create scripts. This is only active if permissions are not being 101 /// The set of users that are allowed to create scripts. This is only active if permissions are not being
100 /// bypassed. This overrides normal permissions. 102 /// bypassed. This overrides normal permissions.
@@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
139 m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); 141 m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
140 m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); 142 m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false);
141 m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); 143 m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
142 144
145 m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
146
143 m_allowedScriptCreators 147 m_allowedScriptCreators
144 = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); 148 = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
145 m_allowedScriptEditors 149 m_allowedScriptEditors
@@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
824 permission = true; 828 permission = true;
825 } 829 }
826 830
831 if (m_SimpleBuildPermissions &&
832 (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
833 permission = true;
834
827 return permission; 835 return permission;
828 } 836 }
829 837
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index ef9c95c..9cd8f2b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -598,6 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
598 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", 598 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
599 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); 599 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
600 } 600 }
601// else
602// {
603// m_log.ErrorFormat(
604// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
605// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
606// }
601 } 607 }
602 608
603 /// <summary> 609 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 15060fd..1334905 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -155,6 +155,15 @@ namespace OpenSim.Region.Framework.Interfaces
155 TaskInventoryItem GetInventoryItem(UUID itemId); 155 TaskInventoryItem GetInventoryItem(UUID itemId);
156 156
157 /// <summary> 157 /// <summary>
158 /// Get all inventory items.
159 /// </summary>
160 /// <param name="name"></param>
161 /// <returns>
162 /// If there are no inventory items then an empty list is returned.
163 /// </returns>
164 List<TaskInventoryItem> GetInventoryItems();
165
166 /// <summary>
158 /// Get inventory items by name. 167 /// Get inventory items by name.
159 /// </summary> 168 /// </summary>
160 /// <param name="name"></param> 169 /// <param name="name"></param>
@@ -162,7 +171,7 @@ namespace OpenSim.Region.Framework.Interfaces
162 /// A list of inventory items with that name. 171 /// A list of inventory items with that name.
163 /// If no inventory item has that name then an empty list is returned. 172 /// If no inventory item has that name then an empty list is returned.
164 /// </returns> 173 /// </returns>
165 IList<TaskInventoryItem> GetInventoryItems(string name); 174 List<TaskInventoryItem> GetInventoryItems(string name);
166 175
167 /// <summary> 176 /// <summary>
168 /// Get the scene object referenced by an inventory item. 177 /// Get the scene object referenced by an inventory item.
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 240a424..33041e9 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -138,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
138// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", 138// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
139// anim, sequenceNum, objectID); 139// anim, sequenceNum, objectID);
140 140
141 if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) 141 if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim))
142 { 142 {
143 return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); 143 return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
144 } 144 }
145 return false; 145 return false;
146 } 146 }
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
index ec928f4..c2b0468 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
@@ -33,7 +33,7 @@ using OpenMetaverse;
33 33
34namespace OpenSim.Region.Framework.Scenes.Animation 34namespace OpenSim.Region.Framework.Scenes.Animation
35{ 35{
36 public class AvatarAnimations 36 public class DefaultAvatarAnimations
37 { 37 {
38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39 39
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
43 public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>(); 43 public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
44 public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>(); 44 public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
45 45
46 static AvatarAnimations() 46 static DefaultAvatarAnimations()
47 { 47 {
48 LoadAnimations(DefaultAnimationsPath); 48 LoadAnimations(DefaultAnimationsPath);
49 } 49 }
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 9038ebc..f5623bd 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
99 99
100 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations 100 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
101 // are referenced with lower case names! 101 // are referenced with lower case names!
102 UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); 102 UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
103 if (animID == UUID.Zero) 103 if (animID == UUID.Zero)
104 return; 104 return;
105 105
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
125 125
126 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations 126 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
127 // are referenced with lower case names! 127 // are referenced with lower case names!
128 UUID animID = AvatarAnimations.GetDefaultAnimation(name); 128 UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
129 if (animID == UUID.Zero) 129 if (animID == UUID.Zero)
130 return; 130 return;
131 131
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 6ae4adc..5abd74f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
1210 /// <summary> 1210 /// <summary>
1211 /// Copy a task (prim) inventory item to another task (prim) 1211 /// Copy a task (prim) inventory item to another task (prim)
1212 /// </summary> 1212 /// </summary>
1213 /// <param name="destId"></param> 1213 /// <param name="destId">ID of destination part</param>
1214 /// <param name="part"></param> 1214 /// <param name="part">Source part</param>
1215 /// <param name="itemId"></param> 1215 /// <param name="itemId">Source item id to transfer</param>
1216 public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) 1216 public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
1217 { 1217 {
1218 TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); 1218 TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
@@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes
1238 return; 1238 return;
1239 } 1239 }
1240 1240
1241 // Can't transfer this 1241 if (part.OwnerID != destPart.OwnerID)
1242 //
1243 if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
1244 return;
1245
1246 if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1247 { 1242 {
1248 // object cannot copy items to an object owned by a different owner 1243 // Source must have transfer permissions
1249 // unless llAllowInventoryDrop has been called 1244 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
1245 return;
1250 1246
1251 return; 1247 // Object cannot copy items to an object owned by a different owner
1248 // unless llAllowInventoryDrop has been called on the destination
1249 if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1250 return;
1252 } 1251 }
1253 1252
1254 // must have both move and modify permission to put an item in an object 1253 // must have both move and modify permission to put an item in an object
1255 if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) 1254 if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0)
1256 {
1257 return; 1255 return;
1258 }
1259 1256
1260 TaskInventoryItem destTaskItem = new TaskInventoryItem(); 1257 TaskInventoryItem destTaskItem = new TaskInventoryItem();
1261 1258
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 76e632e..d354ef0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -211,14 +211,12 @@ namespace OpenSim.Region.Framework.Scenes
211 /// </summary> 211 /// </summary>
212 private bool m_cleaningTemps = false; 212 private bool m_cleaningTemps = false;
213 213
214 private Object m_heartbeatLock = new Object(); 214// private Object m_heartbeatLock = new Object();
215 215
216 // TODO: Possibly stop other classes being able to manipulate this directly. 216 // TODO: Possibly stop other classes being able to manipulate this directly.
217 private SceneGraph m_sceneGraph; 217 private SceneGraph m_sceneGraph;
218 private volatile int m_bordersLocked; 218 private volatile int m_bordersLocked;
219// private int m_RestartTimerCounter;
220 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing 219 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
221// private int m_incrementsof15seconds;
222 private volatile bool m_backingup; 220 private volatile bool m_backingup;
223 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 221 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
224 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 222 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
@@ -226,12 +224,17 @@ namespace OpenSim.Region.Framework.Scenes
226 private bool m_physics_enabled = true; 224 private bool m_physics_enabled = true;
227 private bool m_scripts_enabled = true; 225 private bool m_scripts_enabled = true;
228 private string m_defaultScriptEngine; 226 private string m_defaultScriptEngine;
227
228 /// <summary>
229 /// Tick at which the last login occurred.
230 /// </summary>
229 private int m_LastLogin; 231 private int m_LastLogin;
232
230 private Thread HeartbeatThread; 233 private Thread HeartbeatThread;
231 private volatile bool shuttingdown; 234 private volatile bool shuttingdown;
232 235
233 private int m_lastUpdate; 236// private int m_lastUpdate;
234 private bool m_firstHeartbeat = true; 237// private bool m_firstHeartbeat = true;
235 238
236 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; 239 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
237 private bool m_reprioritizationEnabled = true; 240 private bool m_reprioritizationEnabled = true;
@@ -801,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes
801 804
802 m_permissions = new ScenePermissions(this); 805 m_permissions = new ScenePermissions(this);
803 806
804 m_lastUpdate = Util.EnvironmentTickCount(); 807// m_lastUpdate = Util.EnvironmentTickCount();
805 } 808 }
806 809
807 #endregion 810 #endregion
@@ -1074,6 +1077,12 @@ namespace OpenSim.Region.Framework.Scenes
1074 m_physics_enabled = enablePhysics; 1077 m_physics_enabled = enablePhysics;
1075 } 1078 }
1076 1079
1080// if (options.ContainsKey("collisions"))
1081// {
1082// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
1083// // the avatar themselves to collide with the ground.
1084// }
1085
1077 if (options.ContainsKey("teleport")) 1086 if (options.ContainsKey("teleport"))
1078 { 1087 {
1079 bool enableTeleportDebugging; 1088 bool enableTeleportDebugging;
@@ -1150,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes
1150 } 1159 }
1151 1160
1152 /// <summary> 1161 /// <summary>
1153 /// Start the timer which triggers regular scene updates 1162 /// Start the scene
1154 /// </summary> 1163 /// </summary>
1155 public void StartTimer() 1164 public void Start()
1156 { 1165 {
1157// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); 1166// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
1158 1167
@@ -1164,7 +1173,7 @@ namespace OpenSim.Region.Framework.Scenes
1164 HeartbeatThread.Abort(); 1173 HeartbeatThread.Abort();
1165 HeartbeatThread = null; 1174 HeartbeatThread = null;
1166 } 1175 }
1167 m_lastUpdate = Util.EnvironmentTickCount(); 1176// m_lastUpdate = Util.EnvironmentTickCount();
1168 1177
1169 HeartbeatThread 1178 HeartbeatThread
1170 = Watchdog.StartThread( 1179 = Watchdog.StartThread(
@@ -1197,33 +1206,34 @@ namespace OpenSim.Region.Framework.Scenes
1197 /// </summary> 1206 /// </summary>
1198 private void Heartbeat() 1207 private void Heartbeat()
1199 { 1208 {
1200 if (!Monitor.TryEnter(m_heartbeatLock)) 1209// if (!Monitor.TryEnter(m_heartbeatLock))
1201 { 1210// {
1202 Watchdog.RemoveThread(); 1211// Watchdog.RemoveThread();
1203 return; 1212// return;
1204 } 1213// }
1205 1214
1206 try 1215// try
1207 { 1216// {
1208 m_eventManager.TriggerOnRegionStarted(this);
1209 1217
1210 // The first frame can take a very long time due to physics actors being added on startup. Therefore, 1218 m_eventManager.TriggerOnRegionStarted(this);
1211 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1212 // alarms for scenes with many objects.
1213 Update(1);
1214 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1215 1219
1216 while (!shuttingdown) 1220 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
1217 Update(-1); 1221 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1222 // alarms for scenes with many objects.
1223 Update(1);
1224 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1218 1225
1219 m_lastUpdate = Util.EnvironmentTickCount(); 1226 while (!shuttingdown)
1220 m_firstHeartbeat = false; 1227 Update(-1);
1221 } 1228
1222 finally 1229// m_lastUpdate = Util.EnvironmentTickCount();
1223 { 1230// m_firstHeartbeat = false;
1224 Monitor.Pulse(m_heartbeatLock); 1231// }
1225 Monitor.Exit(m_heartbeatLock); 1232// finally
1226 } 1233// {
1234// Monitor.Pulse(m_heartbeatLock);
1235// Monitor.Exit(m_heartbeatLock);
1236// }
1227 1237
1228 Watchdog.RemoveThread(); 1238 Watchdog.RemoveThread();
1229 } 1239 }
@@ -2535,7 +2545,7 @@ namespace OpenSim.Region.Framework.Scenes
2535 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 2545 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
2536 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2546 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2537 2547
2538 CheckHeartbeat(); 2548// CheckHeartbeat();
2539 2549
2540 ScenePresence sp = GetScenePresence(client.AgentId); 2550 ScenePresence sp = GetScenePresence(client.AgentId);
2541 2551
@@ -3111,7 +3121,7 @@ namespace OpenSim.Region.Framework.Scenes
3111 3121
3112 public override void RemoveClient(UUID agentID, bool closeChildAgents) 3122 public override void RemoveClient(UUID agentID, bool closeChildAgents)
3113 { 3123 {
3114 CheckHeartbeat(); 3124// CheckHeartbeat();
3115 bool isChildAgent = false; 3125 bool isChildAgent = false;
3116 ScenePresence avatar = GetScenePresence(agentID); 3126 ScenePresence avatar = GetScenePresence(agentID);
3117 if (avatar != null) 3127 if (avatar != null)
@@ -4498,8 +4508,8 @@ namespace OpenSim.Region.Framework.Scenes
4498 // 4508 //
4499 int health=1; // Start at 1, means we're up 4509 int health=1; // Start at 1, means we're up
4500 4510
4501 if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) 4511 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
4502 health+=1; 4512 health += 1;
4503 else 4513 else
4504 return health; 4514 return health;
4505 4515
@@ -4510,7 +4520,7 @@ namespace OpenSim.Region.Framework.Scenes
4510 else 4520 else
4511 return health; 4521 return health;
4512 4522
4513 CheckHeartbeat(); 4523// CheckHeartbeat();
4514 4524
4515 return health; 4525 return health;
4516 } 4526 }
@@ -4698,14 +4708,14 @@ namespace OpenSim.Region.Framework.Scenes
4698 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; 4708 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
4699 } 4709 }
4700 4710
4701 private void CheckHeartbeat() 4711// private void CheckHeartbeat()
4702 { 4712// {
4703 if (m_firstHeartbeat) 4713// if (m_firstHeartbeat)
4704 return; 4714// return;
4705 4715//
4706 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) 4716// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000)
4707 StartTimer(); 4717// StartTimer();
4708 } 4718// }
4709 4719
4710 public override ISceneObject DeserializeObject(string representation) 4720 public override ISceneObject DeserializeObject(string representation)
4711 { 4721 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f2d1915..71a9084 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes
590 /// A list of inventory items with that name. 590 /// A list of inventory items with that name.
591 /// If no inventory item has that name then an empty list is returned. 591 /// If no inventory item has that name then an empty list is returned.
592 /// </returns> 592 /// </returns>
593 public IList<TaskInventoryItem> GetInventoryItems(string name) 593 public List<TaskInventoryItem> GetInventoryItems(string name)
594 { 594 {
595 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); 595 List<TaskInventoryItem> items = new List<TaskInventoryItem>();
596 596
597 lock (m_items) 597 lock (m_items)
598 { 598 {
@@ -1100,7 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes
1100 1100
1101 public List<TaskInventoryItem> GetInventoryItems() 1101 public List<TaskInventoryItem> GetInventoryItems()
1102 { 1102 {
1103 List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); 1103 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
1104 1104
1105 lock (m_items) 1105 lock (m_items)
1106 ret = new List<TaskInventoryItem>(m_items.Values); 1106 ret = new List<TaskInventoryItem>(m_items.Values);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index e16903c..55c80f5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests
113 } 113 }
114 114
115 /// <summary> 115 /// <summary>
116 /// Test MoveTaskInventoryItem where the item has no parent folder assigned. 116 /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
117 /// </summary> 117 /// </summary>
118 /// <remarks> 118 /// <remarks>
119 /// This should place it in the most suitable user folder. 119 /// This should place it in the most suitable user folder.
@@ -142,9 +142,11 @@ namespace OpenSim.Region.Framework.Tests
142 } 142 }
143 143
144 /// <summary> 144 /// <summary>
145 /// Test MoveTaskInventoryItem where the item has no parent folder assigned. 145 /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
146 /// </summary> 146 /// </summary>
147 /// <remarks>
147 /// This should place it in the most suitable user folder. 148 /// This should place it in the most suitable user folder.
149 /// </remarks>
148 [Test] 150 [Test]
149 public void TestMoveTaskInventoryItemNoParent() 151 public void TestMoveTaskInventoryItemNoParent()
150 { 152 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 27f7c03..d7a629b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4314,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4314 4314
4315 if (m_host.RegionHandle == presence.RegionHandle) 4315 if (m_host.RegionHandle == presence.RegionHandle)
4316 { 4316 {
4317 Dictionary<UUID, string> animationstateNames = AvatarAnimations.AnimStateNames; 4317 Dictionary<UUID, string> animationstateNames = DefaultAvatarAnimations.AnimStateNames;
4318 4318
4319 if (presence != null) 4319 if (presence != null)
4320 { 4320 {
@@ -5600,7 +5600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5600 } 5600 }
5601 5601
5602 if (agent.Animator.Animations.DefaultAnimation.AnimID 5602 if (agent.Animator.Animations.DefaultAnimation.AnimID
5603 == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 5603 == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
5604 { 5604 {
5605 flags |= ScriptBaseClass.AGENT_SITTING; 5605 flags |= ScriptBaseClass.AGENT_SITTING;
5606 } 5606 }
@@ -7714,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7714 LSL_Vector lower; 7714 LSL_Vector lower;
7715 LSL_Vector upper; 7715 LSL_Vector upper;
7716 if (presence.Animator.Animations.DefaultAnimation.AnimID 7716 if (presence.Animator.Animations.DefaultAnimation.AnimID
7717 == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 7717 == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
7718 { 7718 {
7719 // This is for ground sitting avatars 7719 // This is for ground sitting avatars
7720 float height = presence.Appearance.AvatarHeight / 2.66666667f; 7720 float height = presence.Appearance.AvatarHeight / 2.66666667f;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
new file mode 100644
index 0000000..e2d0db2
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -0,0 +1,168 @@
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 OpenSimulator 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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData;
38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47
48namespace OpenSim.Region.ScriptEngine.Shared.Tests
49{
50 /// <summary>
51 /// Tests for inventory functions in LSL
52 /// </summary>
53 [TestFixture]
54 public class LSL_ApiInventoryTests
55 {
56 protected Scene m_scene;
57 protected XEngine.XEngine m_engine;
58
59 [SetUp]
60 public void SetUp()
61 {
62 IConfigSource initConfigSource = new IniConfigSource();
63 IConfig config = initConfigSource.AddConfig("XEngine");
64 config.Set("Enabled", "true");
65
66 m_scene = SceneHelpers.SetupScene();
67 SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
68
69 m_engine = new XEngine.XEngine();
70 m_engine.Initialise(initConfigSource);
71 m_engine.AddRegion(m_scene);
72 }
73
74 /// <summary>
75 /// Test giving inventory from an object to an object where both are owned by the same user.
76 /// </summary>
77 [Test]
78 public void TestLlGiveInventoryO2OSameOwner()
79 {
80 TestHelpers.InMethod();
81// log4net.Config.XmlConfigurator.Configure();
82
83 UUID userId = TestHelpers.ParseTail(0x1);
84 string inventoryItemName = "item1";
85
86 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "so1", 0x10);
87 m_scene.AddSceneObject(so1);
88
89 // Create an object embedded inside the first
90 UUID itemId = TestHelpers.ParseTail(0x20);
91 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
92
93 LSL_Api api = new LSL_Api();
94 api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
95
96 // Create a second object
97 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
98 m_scene.AddSceneObject(so2);
99
100 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
101
102 // Item has copy permissions so original should stay intact.
103 List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
104 Assert.That(originalItems.Count, Is.EqualTo(1));
105
106 List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
107 Assert.That(copiedItems.Count, Is.EqualTo(1));
108 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
109 }
110
111 /// <summary>
112 /// Test giving inventory from an object to an object where they have different owners
113 /// </summary>
114 [Test]
115 public void TestLlGiveInventoryO2ODifferentOwners()
116 {
117 TestHelpers.InMethod();
118// log4net.Config.XmlConfigurator.Configure();
119
120 UUID user1Id = TestHelpers.ParseTail(0x1);
121 UUID user2Id = TestHelpers.ParseTail(0x2);
122 string inventoryItemName = "item1";
123
124 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
125 m_scene.AddSceneObject(so1);
126 LSL_Api api = new LSL_Api();
127 api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
128
129 // Create an object embedded inside the first
130 UUID itemId = TestHelpers.ParseTail(0x20);
131 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
132
133 // Create a second object
134 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
135 m_scene.AddSceneObject(so2);
136 LSL_Api api2 = new LSL_Api();
137 api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);
138
139 // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
140 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
141
142 {
143 // Item has copy permissions so original should stay intact.
144 List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
145 Assert.That(originalItems.Count, Is.EqualTo(1));
146
147 // Should have not copied
148 List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
149 Assert.That(copiedItems.Count, Is.EqualTo(0));
150 }
151
152 // *** Secondly, we turn on allow inventory drop in the target and retest. ***
153 api2.llAllowInventoryDrop(1);
154 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
155
156 {
157 // Item has copy permissions so original should stay intact.
158 List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
159 Assert.That(originalItems.Count, Is.EqualTo(1));
160
161 // Should now have copied.
162 List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
163 Assert.That(copiedItems.Count, Is.EqualTo(1));
164 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
165 }
166 }
167 }
168} \ No newline at end of file