diff options
Diffstat (limited to 'OpenSim/Region')
25 files changed, 631 insertions, 229 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/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b388b10..68aae14 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -11202,15 +11202,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11202 | scriptQuestion.Data.Questions = question; | 11202 | scriptQuestion.Data.Questions = question; |
11203 | scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName); | 11203 | scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName); |
11204 | scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName); | 11204 | scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName); |
11205 | 11205 | ||
11206 | OutPacket(scriptQuestion, ThrottleOutPacketType.Task); | 11206 | OutPacket(scriptQuestion, ThrottleOutPacketType.Task); |
11207 | } | 11207 | } |
11208 | 11208 | ||
11209 | public UUID GetDefaultAnimation(string name) | ||
11210 | { | ||
11211 | return SLUtil.GetDefaultAvatarAnimation(name); | ||
11212 | } | ||
11213 | |||
11214 | /// <summary> | 11209 | /// <summary> |
11215 | /// Handler called when we receive a logout packet. | 11210 | /// Handler called when we receive a logout packet. |
11216 | /// </summary> | 11211 | /// </summary> |
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 9176d3d..33041e9 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | |||
@@ -27,8 +27,10 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Framework; | 30 | using System.Reflection; |
31 | using log4net; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | ||
32 | 34 | ||
33 | using Animation = OpenSim.Framework.Animation; | 35 | using Animation = OpenSim.Framework.Animation; |
34 | 36 | ||
@@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
37 | [Serializable] | 39 | [Serializable] |
38 | public class AnimationSet | 40 | public class AnimationSet |
39 | { | 41 | { |
40 | public static AvatarAnimations Animations = new AvatarAnimations(); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 43 | ||
42 | private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); | 44 | private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); |
43 | private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); | 45 | private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); |
@@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
132 | /// </summary> | 134 | /// </summary> |
133 | public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) | 135 | public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) |
134 | { | 136 | { |
135 | if (Animations.AnimsUUID.ContainsKey(anim)) | 137 | // m_log.DebugFormat( |
138 | // "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", | ||
139 | // anim, sequenceNum, objectID); | ||
140 | |||
141 | if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim)) | ||
136 | { | 142 | { |
137 | return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID); | 143 | return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); |
138 | } | 144 | } |
139 | return false; | 145 | return false; |
140 | } | 146 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs deleted file mode 100644 index 659c3a5..0000000 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
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 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Xml; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Scenes.Animation | ||
33 | { | ||
34 | public class AvatarAnimations | ||
35 | { | ||
36 | public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>(); | ||
37 | public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>(); | ||
38 | public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>(); | ||
39 | |||
40 | public AvatarAnimations() | ||
41 | { | ||
42 | using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) | ||
43 | { | ||
44 | XmlDocument doc = new XmlDocument(); | ||
45 | doc.Load(reader); | ||
46 | foreach (XmlNode nod in doc.DocumentElement.ChildNodes) | ||
47 | { | ||
48 | if (nod.Attributes["name"] != null) | ||
49 | { | ||
50 | string name = (string)nod.Attributes["name"].Value; | ||
51 | UUID id = (UUID)nod.InnerText; | ||
52 | string animState = (string)nod.Attributes["state"].Value; | ||
53 | |||
54 | AnimsUUID.Add(name, id); | ||
55 | AnimsNames.Add(id, name); | ||
56 | if (animState != "") | ||
57 | AnimStateNames.Add(id, animState); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs new file mode 100644 index 0000000..c2b0468 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs | |||
@@ -0,0 +1,108 @@ | |||
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 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using System.Xml; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Scenes.Animation | ||
35 | { | ||
36 | public class DefaultAvatarAnimations | ||
37 | { | ||
38 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | |||
40 | public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; | ||
41 | |||
42 | public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>(); | ||
43 | public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>(); | ||
44 | public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>(); | ||
45 | |||
46 | static DefaultAvatarAnimations() | ||
47 | { | ||
48 | LoadAnimations(DefaultAnimationsPath); | ||
49 | } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Load the default SL avatar animations. | ||
53 | /// </summary> | ||
54 | /// <returns></returns> | ||
55 | private static void LoadAnimations(string path) | ||
56 | { | ||
57 | // Dictionary<string, UUID> animations = new Dictionary<string, UUID>(); | ||
58 | |||
59 | using (XmlTextReader reader = new XmlTextReader(path)) | ||
60 | { | ||
61 | XmlDocument doc = new XmlDocument(); | ||
62 | doc.Load(reader); | ||
63 | // if (doc.DocumentElement != null) | ||
64 | // { | ||
65 | foreach (XmlNode nod in doc.DocumentElement.ChildNodes) | ||
66 | { | ||
67 | if (nod.Attributes["name"] != null) | ||
68 | { | ||
69 | string name = nod.Attributes["name"].Value; | ||
70 | UUID id = (UUID)nod.InnerText; | ||
71 | string animState = (string)nod.Attributes["state"].Value; | ||
72 | |||
73 | AnimsUUID.Add(name, id); | ||
74 | AnimsNames.Add(id, name); | ||
75 | if (animState != "") | ||
76 | AnimStateNames.Add(id, animState); | ||
77 | |||
78 | // m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); | ||
79 | } | ||
80 | } | ||
81 | // } | ||
82 | } | ||
83 | |||
84 | // return animations; | ||
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Get the default avatar animation with the given name. | ||
89 | /// </summary> | ||
90 | /// <param name="name"></param> | ||
91 | /// <returns></returns> | ||
92 | public static UUID GetDefaultAnimation(string name) | ||
93 | { | ||
94 | // m_log.DebugFormat( | ||
95 | // "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); | ||
96 | |||
97 | if (AnimsUUID.ContainsKey(name)) | ||
98 | { | ||
99 | // m_log.DebugFormat( | ||
100 | // "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); | ||
101 | |||
102 | return AnimsUUID[name]; | ||
103 | } | ||
104 | |||
105 | return UUID.Zero; | ||
106 | } | ||
107 | } | ||
108 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3584cda..f5623bd 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
97 | if (m_scenePresence.IsChildAgent) | 97 | if (m_scenePresence.IsChildAgent) |
98 | return; | 98 | return; |
99 | 99 | ||
100 | UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); | 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! | ||
102 | UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); | ||
101 | if (animID == UUID.Zero) | 103 | if (animID == UUID.Zero) |
102 | return; | 104 | return; |
103 | 105 | ||
@@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
121 | if (m_scenePresence.IsChildAgent) | 123 | if (m_scenePresence.IsChildAgent) |
122 | return; | 124 | return; |
123 | 125 | ||
124 | UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); | 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! | ||
128 | UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); | ||
125 | if (animID == UUID.Zero) | 129 | if (animID == UUID.Zero) |
126 | return; | 130 | return; |
127 | 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..0dcbcdb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -104,6 +104,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | public bool m_allowScriptCrossings; | 104 | public bool m_allowScriptCrossings; |
105 | public bool m_useFlySlow; | 105 | public bool m_useFlySlow; |
106 | 106 | ||
107 | /// <summary> | ||
108 | /// Temporarily setting to trigger appearance resends at 60 second intervals. | ||
109 | /// </summary> | ||
110 | public bool SendPeriodicAppearanceUpdates { get; set; } | ||
111 | |||
107 | protected float m_defaultDrawDistance = 255.0f; | 112 | protected float m_defaultDrawDistance = 255.0f; |
108 | public float DefaultDrawDistance | 113 | public float DefaultDrawDistance |
109 | { | 114 | { |
@@ -169,6 +174,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | } | 174 | } |
170 | 175 | ||
171 | /// <summary> | 176 | /// <summary> |
177 | /// Current maintenance run number | ||
178 | /// </summary> | ||
179 | public uint MaintenanceRun { get; private set; } | ||
180 | |||
181 | /// <summary> | ||
172 | /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we | 182 | /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we |
173 | /// will sleep for the remaining period. | 183 | /// will sleep for the remaining period. |
174 | /// </summary> | 184 | /// </summary> |
@@ -178,6 +188,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
178 | /// </remarks> | 188 | /// </remarks> |
179 | public float MinFrameTime { get; private set; } | 189 | public float MinFrameTime { get; private set; } |
180 | 190 | ||
191 | /// <summary> | ||
192 | /// The minimum length of time in seconds that will be taken for a maintenance run. | ||
193 | /// </summary> | ||
194 | public float MinMaintenanceTime { get; private set; } | ||
195 | |||
181 | private int m_update_physics = 1; | 196 | private int m_update_physics = 1; |
182 | private int m_update_entitymovement = 1; | 197 | private int m_update_entitymovement = 1; |
183 | private int m_update_objects = 1; | 198 | private int m_update_objects = 1; |
@@ -206,19 +221,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | private int m_lastFrameTick; | 221 | private int m_lastFrameTick; |
207 | 222 | ||
208 | /// <summary> | 223 | /// <summary> |
224 | /// Tick at which the last maintenance run occurred. | ||
225 | /// </summary> | ||
226 | private int m_lastMaintenanceTick; | ||
227 | |||
228 | /// <summary> | ||
209 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched | 229 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched |
210 | /// asynchronously from the update loop. | 230 | /// asynchronously from the update loop. |
211 | /// </summary> | 231 | /// </summary> |
212 | private bool m_cleaningTemps = false; | 232 | private bool m_cleaningTemps = false; |
213 | 233 | ||
214 | private Object m_heartbeatLock = new Object(); | 234 | // private Object m_heartbeatLock = new Object(); |
215 | 235 | ||
216 | // TODO: Possibly stop other classes being able to manipulate this directly. | 236 | // TODO: Possibly stop other classes being able to manipulate this directly. |
217 | private SceneGraph m_sceneGraph; | 237 | private SceneGraph m_sceneGraph; |
218 | private volatile int m_bordersLocked; | 238 | private volatile int m_bordersLocked; |
219 | // private int m_RestartTimerCounter; | ||
220 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 239 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
221 | // private int m_incrementsof15seconds; | ||
222 | private volatile bool m_backingup; | 240 | private volatile bool m_backingup; |
223 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 241 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
224 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 242 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); |
@@ -226,12 +244,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | private bool m_physics_enabled = true; | 244 | private bool m_physics_enabled = true; |
227 | private bool m_scripts_enabled = true; | 245 | private bool m_scripts_enabled = true; |
228 | private string m_defaultScriptEngine; | 246 | private string m_defaultScriptEngine; |
247 | |||
248 | /// <summary> | ||
249 | /// Tick at which the last login occurred. | ||
250 | /// </summary> | ||
229 | private int m_LastLogin; | 251 | private int m_LastLogin; |
230 | private Thread HeartbeatThread; | ||
231 | private volatile bool shuttingdown; | ||
232 | 252 | ||
233 | private int m_lastUpdate; | 253 | /// <summary> |
234 | private bool m_firstHeartbeat = true; | 254 | /// Thread that runs the scene loop. |
255 | /// </summary> | ||
256 | private Thread m_heartbeatThread; | ||
257 | |||
258 | /// <summary> | ||
259 | /// True if these scene is in the process of shutting down or is shutdown. | ||
260 | /// </summary> | ||
261 | public bool ShuttingDown | ||
262 | { | ||
263 | get { return m_shuttingDown; } | ||
264 | } | ||
265 | private volatile bool m_shuttingDown; | ||
266 | |||
267 | // private int m_lastUpdate; | ||
268 | // private bool m_firstHeartbeat = true; | ||
235 | 269 | ||
236 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 270 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
237 | private bool m_reprioritizationEnabled = true; | 271 | private bool m_reprioritizationEnabled = true; |
@@ -546,6 +580,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
546 | { | 580 | { |
547 | m_config = config; | 581 | m_config = config; |
548 | MinFrameTime = 0.089f; | 582 | MinFrameTime = 0.089f; |
583 | MinMaintenanceTime = 1; | ||
549 | 584 | ||
550 | Random random = new Random(); | 585 | Random random = new Random(); |
551 | 586 | ||
@@ -731,6 +766,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
731 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 766 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
732 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 767 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
733 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 768 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
769 | |||
770 | SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates); | ||
734 | } | 771 | } |
735 | 772 | ||
736 | #endregion Region Config | 773 | #endregion Region Config |
@@ -801,18 +838,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
801 | 838 | ||
802 | m_permissions = new ScenePermissions(this); | 839 | m_permissions = new ScenePermissions(this); |
803 | 840 | ||
804 | m_lastUpdate = Util.EnvironmentTickCount(); | 841 | // m_lastUpdate = Util.EnvironmentTickCount(); |
805 | } | 842 | } |
806 | 843 | ||
807 | #endregion | 844 | #endregion |
808 | 845 | ||
809 | #region Startup / Close Methods | 846 | #region Startup / Close Methods |
810 | 847 | ||
811 | public bool ShuttingDown | ||
812 | { | ||
813 | get { return shuttingdown; } | ||
814 | } | ||
815 | |||
816 | /// <value> | 848 | /// <value> |
817 | /// The scene graph for this scene | 849 | /// The scene graph for this scene |
818 | /// </value> | 850 | /// </value> |
@@ -1074,6 +1106,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1074 | m_physics_enabled = enablePhysics; | 1106 | m_physics_enabled = enablePhysics; |
1075 | } | 1107 | } |
1076 | 1108 | ||
1109 | // if (options.ContainsKey("collisions")) | ||
1110 | // { | ||
1111 | // // TODO: Implement. If false, should stop objects colliding, though possibly should still allow | ||
1112 | // // the avatar themselves to collide with the ground. | ||
1113 | // } | ||
1114 | |||
1077 | if (options.ContainsKey("teleport")) | 1115 | if (options.ContainsKey("teleport")) |
1078 | { | 1116 | { |
1079 | bool enableTeleportDebugging; | 1117 | bool enableTeleportDebugging; |
@@ -1125,8 +1163,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1125 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1163 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1126 | 1164 | ||
1127 | // Stop updating the scene objects and agents. | 1165 | // Stop updating the scene objects and agents. |
1128 | //m_heartbeatTimer.Close(); | 1166 | m_shuttingDown = true; |
1129 | shuttingdown = true; | ||
1130 | 1167 | ||
1131 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1168 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1132 | EventManager.TriggerSceneShuttingDown(this); | 1169 | EventManager.TriggerSceneShuttingDown(this); |
@@ -1150,23 +1187,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1150 | } | 1187 | } |
1151 | 1188 | ||
1152 | /// <summary> | 1189 | /// <summary> |
1153 | /// Start the timer which triggers regular scene updates | 1190 | /// Start the scene |
1154 | /// </summary> | 1191 | /// </summary> |
1155 | public void StartTimer() | 1192 | public void Start() |
1156 | { | 1193 | { |
1157 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1194 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1158 | 1195 | ||
1159 | //m_heartbeatTimer.Enabled = true; | 1196 | //m_heartbeatTimer.Enabled = true; |
1160 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); | 1197 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); |
1161 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1198 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1162 | if (HeartbeatThread != null) | 1199 | if (m_heartbeatThread != null) |
1163 | { | 1200 | { |
1164 | HeartbeatThread.Abort(); | 1201 | m_heartbeatThread.Abort(); |
1165 | HeartbeatThread = null; | 1202 | m_heartbeatThread = null; |
1166 | } | 1203 | } |
1167 | m_lastUpdate = Util.EnvironmentTickCount(); | 1204 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1168 | 1205 | ||
1169 | HeartbeatThread | 1206 | m_heartbeatThread |
1170 | = Watchdog.StartThread( | 1207 | = Watchdog.StartThread( |
1171 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1208 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
1172 | } | 1209 | } |
@@ -1197,37 +1234,107 @@ namespace OpenSim.Region.Framework.Scenes | |||
1197 | /// </summary> | 1234 | /// </summary> |
1198 | private void Heartbeat() | 1235 | private void Heartbeat() |
1199 | { | 1236 | { |
1200 | if (!Monitor.TryEnter(m_heartbeatLock)) | 1237 | // if (!Monitor.TryEnter(m_heartbeatLock)) |
1201 | { | 1238 | // { |
1202 | Watchdog.RemoveThread(); | 1239 | // Watchdog.RemoveThread(); |
1203 | return; | 1240 | // return; |
1204 | } | 1241 | // } |
1205 | 1242 | ||
1206 | try | 1243 | // try |
1207 | { | 1244 | // { |
1208 | m_eventManager.TriggerOnRegionStarted(this); | ||
1209 | 1245 | ||
1210 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, | 1246 | 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 | 1247 | ||
1216 | while (!shuttingdown) | 1248 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, |
1217 | Update(-1); | 1249 | // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false |
1250 | // alarms for scenes with many objects. | ||
1251 | Update(1); | ||
1218 | 1252 | ||
1219 | m_lastUpdate = Util.EnvironmentTickCount(); | 1253 | Watchdog.StartThread( |
1220 | m_firstHeartbeat = false; | 1254 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); |
1221 | } | 1255 | |
1222 | finally | 1256 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1223 | { | 1257 | Update(-1); |
1224 | Monitor.Pulse(m_heartbeatLock); | 1258 | |
1225 | Monitor.Exit(m_heartbeatLock); | 1259 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1226 | } | 1260 | // m_firstHeartbeat = false; |
1261 | // } | ||
1262 | // finally | ||
1263 | // { | ||
1264 | // Monitor.Pulse(m_heartbeatLock); | ||
1265 | // Monitor.Exit(m_heartbeatLock); | ||
1266 | // } | ||
1267 | |||
1268 | Watchdog.RemoveThread(); | ||
1269 | } | ||
1270 | |||
1271 | private void Maintenance() | ||
1272 | { | ||
1273 | DoMaintenance(-1); | ||
1227 | 1274 | ||
1228 | Watchdog.RemoveThread(); | 1275 | Watchdog.RemoveThread(); |
1229 | } | 1276 | } |
1230 | 1277 | ||
1278 | public void DoMaintenance(int runs) | ||
1279 | { | ||
1280 | long? endRun = null; | ||
1281 | int runtc; | ||
1282 | int previousMaintenanceTick; | ||
1283 | |||
1284 | if (runs >= 0) | ||
1285 | endRun = MaintenanceRun + runs; | ||
1286 | |||
1287 | List<Vector3> coarseLocations; | ||
1288 | List<UUID> avatarUUIDs; | ||
1289 | |||
1290 | while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) | ||
1291 | { | ||
1292 | runtc = Util.EnvironmentTickCount(); | ||
1293 | ++MaintenanceRun; | ||
1294 | |||
1295 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | ||
1296 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) | ||
1297 | { | ||
1298 | SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); | ||
1299 | // Send coarse locations to clients | ||
1300 | ForEachScenePresence(delegate(ScenePresence presence) | ||
1301 | { | ||
1302 | presence.SendCoarseLocations(coarseLocations, avatarUUIDs); | ||
1303 | }); | ||
1304 | } | ||
1305 | |||
1306 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) | ||
1307 | { | ||
1308 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); | ||
1309 | |||
1310 | if (AvatarFactory != null) | ||
1311 | { | ||
1312 | ForEachRootScenePresence(sp => AvatarFactory.SendAppearance(sp.UUID)); | ||
1313 | } | ||
1314 | } | ||
1315 | |||
1316 | Watchdog.UpdateThread(); | ||
1317 | |||
1318 | previousMaintenanceTick = m_lastMaintenanceTick; | ||
1319 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); | ||
1320 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); | ||
1321 | runtc = (int)(MinMaintenanceTime * 1000) - runtc; | ||
1322 | |||
1323 | if (runtc > 0) | ||
1324 | Thread.Sleep(runtc); | ||
1325 | |||
1326 | // Optionally warn if a frame takes double the amount of time that it should. | ||
1327 | if (DebugUpdates | ||
1328 | && Util.EnvironmentTickCountSubtract( | ||
1329 | m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2)) | ||
1330 | m_log.WarnFormat( | ||
1331 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", | ||
1332 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), | ||
1333 | MinMaintenanceTime * 1000, | ||
1334 | RegionInfo.RegionName); | ||
1335 | } | ||
1336 | } | ||
1337 | |||
1231 | public override void Update(int frames) | 1338 | public override void Update(int frames) |
1232 | { | 1339 | { |
1233 | long? endFrame = null; | 1340 | long? endFrame = null; |
@@ -1239,10 +1346,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1239 | int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; | 1346 | int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; |
1240 | int previousFrameTick; | 1347 | int previousFrameTick; |
1241 | int maintc; | 1348 | int maintc; |
1242 | List<Vector3> coarseLocations; | ||
1243 | List<UUID> avatarUUIDs; | ||
1244 | 1349 | ||
1245 | while (!shuttingdown && (endFrame == null || Frame < endFrame)) | 1350 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) |
1246 | { | 1351 | { |
1247 | maintc = Util.EnvironmentTickCount(); | 1352 | maintc = Util.EnvironmentTickCount(); |
1248 | ++Frame; | 1353 | ++Frame; |
@@ -1292,17 +1397,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1292 | if (Frame % m_update_presences == 0) | 1397 | if (Frame % m_update_presences == 0) |
1293 | m_sceneGraph.UpdatePresences(); | 1398 | m_sceneGraph.UpdatePresences(); |
1294 | 1399 | ||
1295 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | ||
1296 | if (Frame % m_update_coarse_locations == 0) | ||
1297 | { | ||
1298 | SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); | ||
1299 | // Send coarse locations to clients | ||
1300 | ForEachScenePresence(delegate(ScenePresence presence) | ||
1301 | { | ||
1302 | presence.SendCoarseLocations(coarseLocations, avatarUUIDs); | ||
1303 | }); | ||
1304 | } | ||
1305 | |||
1306 | agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); | 1400 | agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); |
1307 | 1401 | ||
1308 | // Delete temp-on-rez stuff | 1402 | // Delete temp-on-rez stuff |
@@ -1410,7 +1504,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1410 | 1504 | ||
1411 | EventManager.TriggerRegionHeartbeatEnd(this); | 1505 | EventManager.TriggerRegionHeartbeatEnd(this); |
1412 | 1506 | ||
1413 | // Tell the watchdog that this thread is still alive | ||
1414 | Watchdog.UpdateThread(); | 1507 | Watchdog.UpdateThread(); |
1415 | 1508 | ||
1416 | previousFrameTick = m_lastFrameTick; | 1509 | previousFrameTick = m_lastFrameTick; |
@@ -2535,7 +2628,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2535 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2628 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2536 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2629 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2537 | 2630 | ||
2538 | CheckHeartbeat(); | 2631 | // CheckHeartbeat(); |
2539 | 2632 | ||
2540 | ScenePresence sp = GetScenePresence(client.AgentId); | 2633 | ScenePresence sp = GetScenePresence(client.AgentId); |
2541 | 2634 | ||
@@ -3111,7 +3204,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3111 | 3204 | ||
3112 | public override void RemoveClient(UUID agentID, bool closeChildAgents) | 3205 | public override void RemoveClient(UUID agentID, bool closeChildAgents) |
3113 | { | 3206 | { |
3114 | CheckHeartbeat(); | 3207 | // CheckHeartbeat(); |
3115 | bool isChildAgent = false; | 3208 | bool isChildAgent = false; |
3116 | ScenePresence avatar = GetScenePresence(agentID); | 3209 | ScenePresence avatar = GetScenePresence(agentID); |
3117 | if (avatar != null) | 3210 | if (avatar != null) |
@@ -4498,8 +4591,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4498 | // | 4591 | // |
4499 | int health=1; // Start at 1, means we're up | 4592 | int health=1; // Start at 1, means we're up |
4500 | 4593 | ||
4501 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4594 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4502 | health+=1; | 4595 | health += 1; |
4503 | else | 4596 | else |
4504 | return health; | 4597 | return health; |
4505 | 4598 | ||
@@ -4510,7 +4603,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4510 | else | 4603 | else |
4511 | return health; | 4604 | return health; |
4512 | 4605 | ||
4513 | CheckHeartbeat(); | 4606 | // CheckHeartbeat(); |
4514 | 4607 | ||
4515 | return health; | 4608 | return health; |
4516 | } | 4609 | } |
@@ -4698,14 +4791,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4698 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 4791 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
4699 | } | 4792 | } |
4700 | 4793 | ||
4701 | private void CheckHeartbeat() | 4794 | // private void CheckHeartbeat() |
4702 | { | 4795 | // { |
4703 | if (m_firstHeartbeat) | 4796 | // if (m_firstHeartbeat) |
4704 | return; | 4797 | // return; |
4705 | 4798 | // | |
4706 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4799 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) |
4707 | StartTimer(); | 4800 | // StartTimer(); |
4708 | } | 4801 | // } |
4709 | 4802 | ||
4710 | public override ISceneObject DeserializeObject(string representation) | 4803 | public override ISceneObject DeserializeObject(string representation) |
4711 | { | 4804 | { |
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/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index d3c96e2..5cf478a 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -1203,11 +1203,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1203 | 1203 | ||
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | public UUID GetDefaultAnimation(string name) | ||
1207 | { | ||
1208 | return UUID.Zero; | ||
1209 | } | ||
1210 | |||
1211 | public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID) | 1206 | public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID) |
1212 | { | 1207 | { |
1213 | 1208 | ||
diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs index a3f68e5..e452124 100755 --- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs +++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs | |||
@@ -264,14 +264,14 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters | |||
264 | 264 | ||
265 | private void WriteOut(string msg, params object[] args) | 265 | private void WriteOut(string msg, params object[] args) |
266 | { | 266 | { |
267 | m_log.InfoFormat(msg, args); | 267 | // m_log.InfoFormat(msg, args); |
268 | // MainConsole.Instance.OutputFormat(msg, args); | 268 | MainConsole.Instance.OutputFormat(msg, args); |
269 | } | 269 | } |
270 | 270 | ||
271 | private void WriteError(string msg, params object[] args) | 271 | private void WriteError(string msg, params object[] args) |
272 | { | 272 | { |
273 | m_log.ErrorFormat(msg, args); | 273 | // m_log.ErrorFormat(msg, args); |
274 | // MainConsole.Instance.OutputFormat(msg, args); | 274 | MainConsole.Instance.OutputFormat(msg, args); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } \ No newline at end of file | 277 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index d0142a4..0b9f875 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -70,8 +70,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
70 | 70 | ||
71 | public void Initialise(IConfigSource config) | 71 | public void Initialise(IConfigSource config) |
72 | { | 72 | { |
73 | //m_log.Info("[RegionReady] Initialising"); | ||
74 | |||
75 | m_config = config.Configs["RegionReady"]; | 73 | m_config = config.Configs["RegionReady"]; |
76 | if (m_config != null) | 74 | if (m_config != null) |
77 | { | 75 | { |
@@ -84,9 +82,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
84 | m_uri = m_config.GetString("alert_uri",string.Empty); | 82 | m_uri = m_config.GetString("alert_uri",string.Empty); |
85 | } | 83 | } |
86 | } | 84 | } |
87 | |||
88 | // if (!m_enabled) | ||
89 | // m_log.Info("[RegionReady] disabled."); | ||
90 | } | 85 | } |
91 | 86 | ||
92 | public void AddRegion(Scene scene) | 87 | public void AddRegion(Scene scene) |
@@ -113,7 +108,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
113 | { | 108 | { |
114 | scene.LoginLock = true; | 109 | scene.LoginLock = true; |
115 | scene.LoginsDisabled = true; | 110 | scene.LoginsDisabled = true; |
116 | m_log.InfoFormat("[RegionReady]: Logins disabled for {0}",m_scene.RegionInfo.RegionName); | 111 | m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName); |
117 | 112 | ||
118 | if(m_uri != string.Empty) | 113 | if(m_uri != string.Empty) |
119 | { | 114 | { |
@@ -167,7 +162,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
167 | 162 | ||
168 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) | 163 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) |
169 | { | 164 | { |
170 | m_log.InfoFormat("[RegionReady]: Script compile queue empty!"); | 165 | m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); |
171 | 166 | ||
172 | if (m_firstEmptyCompileQueue || m_oarFileLoading) | 167 | if (m_firstEmptyCompileQueue || m_oarFileLoading) |
173 | { | 168 | { |
@@ -194,7 +189,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
194 | c.SenderUUID = UUID.Zero; | 189 | c.SenderUUID = UUID.Zero; |
195 | c.Scene = m_scene; | 190 | c.Scene = m_scene; |
196 | 191 | ||
197 | m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", | 192 | m_log.DebugFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", |
198 | m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); | 193 | m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); |
199 | 194 | ||
200 | m_scene.EventManager.TriggerOnChatBroadcast(this, c); | 195 | m_scene.EventManager.TriggerOnChatBroadcast(this, c); |
@@ -210,7 +205,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
210 | { | 205 | { |
211 | m_lastOarLoadedOk = true; | 206 | m_lastOarLoadedOk = true; |
212 | } else { | 207 | } else { |
213 | m_log.InfoFormat("[RegionReady]: Oar file load errors: {0}", message); | 208 | m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); |
214 | m_lastOarLoadedOk = false; | 209 | m_lastOarLoadedOk = false; |
215 | } | 210 | } |
216 | } | 211 | } |
@@ -233,7 +228,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
233 | // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", | 228 | // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", |
234 | // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); | 229 | // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); |
235 | 230 | ||
236 | m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); | 231 | m_log.InfoFormat("[RegionReady]: Initialization complete - logins enabled for {0}", m_scene.RegionInfo.RegionName); |
237 | 232 | ||
238 | if ( m_uri != string.Empty ) | 233 | if ( m_uri != string.Empty ) |
239 | { | 234 | { |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 24b9e6b..16ec34f 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -133,11 +133,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
133 | 133 | ||
134 | } | 134 | } |
135 | 135 | ||
136 | public UUID GetDefaultAnimation(string name) | ||
137 | { | ||
138 | return SLUtil.GetDefaultAvatarAnimation(name); | ||
139 | } | ||
140 | |||
141 | public Vector3 Position | 136 | public Vector3 Position |
142 | { | 137 | { |
143 | get { return m_scene.Entities[m_uuid].AbsolutePosition; } | 138 | get { return m_scene.Entities[m_uuid].AbsolutePosition; } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 13d5e03..6963af5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -240,6 +240,15 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
240 | parms.avatarDensity = 60f; | 240 | parms.avatarDensity = 60f; |
241 | parms.avatarCapsuleRadius = 0.37f; | 241 | parms.avatarCapsuleRadius = 0.37f; |
242 | parms.avatarCapsuleHeight = 1.5f; // 2.140599f | 242 | parms.avatarCapsuleHeight = 1.5f; // 2.140599f |
243 | parms.avatarContactProcessingThreshold = 0.1f; | ||
244 | |||
245 | parms.maxPersistantManifoldPoolSize = 0f; | ||
246 | parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue; | ||
247 | parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse; | ||
248 | parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse; | ||
249 | parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse; | ||
250 | parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse; | ||
251 | parms.numberOfSolverIterations = 0f; // means use default | ||
243 | 252 | ||
244 | if (config != null) | 253 | if (config != null) |
245 | { | 254 | { |
@@ -285,11 +294,36 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
285 | parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); | 294 | parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); |
286 | parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); | 295 | parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); |
287 | parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); | 296 | parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); |
297 | parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold); | ||
298 | |||
299 | parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize); | ||
300 | parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation); | ||
301 | parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs); | ||
302 | parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder); | ||
303 | parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands); | ||
304 | parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching); | ||
305 | parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations); | ||
288 | } | 306 | } |
289 | } | 307 | } |
290 | m_params[0] = parms; | 308 | m_params[0] = parms; |
291 | } | 309 | } |
292 | 310 | ||
311 | // A helper function that handles a true/false parameter and returns the proper float number encoding | ||
312 | float ParamBoolean(IConfig config, string parmName, float deflt) | ||
313 | { | ||
314 | float ret = deflt; | ||
315 | if (config.Contains(parmName)) | ||
316 | { | ||
317 | ret = ConfigurationParameters.numericFalse; | ||
318 | if (config.GetBoolean(parmName, false)) | ||
319 | { | ||
320 | ret = ConfigurationParameters.numericTrue; | ||
321 | } | ||
322 | } | ||
323 | return ret; | ||
324 | } | ||
325 | |||
326 | |||
293 | // Called directly from unmanaged code so don't do much | 327 | // Called directly from unmanaged code so don't do much |
294 | private void BulletLogger(string msg) | 328 | private void BulletLogger(string msg) |
295 | { | 329 | { |
@@ -716,9 +750,20 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
716 | new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), | 750 | new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), |
717 | new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), | 751 | new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), |
718 | new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), | 752 | new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), |
719 | // new PhysParameterEntry("CcdMotionThreshold", "" ), | 753 | new PhysParameterEntry("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ), |
720 | // new PhysParameterEntry("CcdSweptSphereRadius", "" ), | 754 | new PhysParameterEntry("CcdSweptSphereRadius", "Continuious collision detection test radius" ), |
721 | new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), | 755 | new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), |
756 | // Can only change the following at initialization time. Change the INI file and reboot. | ||
757 | new PhysParameterEntry("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)"), | ||
758 | new PhysParameterEntry("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count"), | ||
759 | new PhysParameterEntry("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step"), | ||
760 | new PhysParameterEntry("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction"), | ||
761 | new PhysParameterEntry("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands"), | ||
762 | new PhysParameterEntry("ShouldEnableFrictionCaching", "Enable friction computation caching"), | ||
763 | new PhysParameterEntry("NumberOfSolverIterations", "Number of internal iterations (0 means default)"), | ||
764 | |||
765 | new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), | ||
766 | new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), | ||
722 | 767 | ||
723 | new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), | 768 | new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), |
724 | new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), | 769 | new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), |
@@ -730,7 +775,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
730 | new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), | 775 | new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), |
731 | new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), | 776 | new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), |
732 | new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), | 777 | new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), |
733 | new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ) | 778 | new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ), |
779 | new PhysParameterEntry("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions") | ||
780 | |||
734 | }; | 781 | }; |
735 | 782 | ||
736 | #region IPhysicsParameters | 783 | #region IPhysicsParameters |
@@ -774,6 +821,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
774 | case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; | 821 | case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; |
775 | case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; | 822 | case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; |
776 | case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; | 823 | case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; |
824 | // the following are used only at initialization time so setting them makes no sense | ||
825 | // case "maxPersistantmanifoldpoolSize": m_params[0].maxPersistantManifoldPoolSize = val; break; | ||
826 | // case "shoulddisablecontactpooldynamicallocation": m_params[0].shouldDisableContactPoolDynamicAllocation = val; break; | ||
827 | // case "shouldforceupdateallaabbs": m_params[0].shouldForceUpdateAllAabbs = val; break; | ||
828 | // case "shouldrandomizesolverorder": m_params[0].shouldRandomizeSolverOrder = val; break; | ||
829 | // case "shouldsplitsimulationislands": m_params[0].shouldSplitSimulationIslands = val; break; | ||
830 | // case "shouldenablefrictioncaching": m_params[0].shouldEnableFrictionCaching = val; break; | ||
831 | // case "numberofsolveriterations": m_params[0].numberOfSolverIterations = val; break; | ||
832 | |||
833 | case "friction": TaintedUpdateParameter(lparm, localID, val); break; | ||
834 | case "restitution": TaintedUpdateParameter(lparm, localID, val); break; | ||
777 | 835 | ||
778 | case "friction": TaintedUpdateParameter(lparm, localID, val); break; | 836 | case "friction": TaintedUpdateParameter(lparm, localID, val); break; |
779 | case "restitution": TaintedUpdateParameter(lparm, localID, val); break; | 837 | case "restitution": TaintedUpdateParameter(lparm, localID, val); break; |
@@ -788,6 +846,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
788 | case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; | 846 | case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; |
789 | case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; | 847 | case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; |
790 | case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; | 848 | case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; |
849 | case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break; | ||
791 | 850 | ||
792 | default: ret = false; break; | 851 | default: ret = false; break; |
793 | } | 852 | } |
@@ -880,6 +939,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
880 | case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; | 939 | case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; |
881 | case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; | 940 | case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; |
882 | case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; | 941 | case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; |
942 | case "maxPersistantmanifoldpoolSize": val = m_params[0].maxPersistantManifoldPoolSize; break; | ||
943 | case "shoulddisablecontactpooldynamicallocation": val = m_params[0].shouldDisableContactPoolDynamicAllocation; break; | ||
944 | case "shouldforceupdateallaabbs": val = m_params[0].shouldForceUpdateAllAabbs; break; | ||
945 | case "shouldrandomizesolverorder": val = m_params[0].shouldRandomizeSolverOrder; break; | ||
946 | case "shouldsplitsimulationislands": val = m_params[0].shouldSplitSimulationIslands; break; | ||
947 | case "shouldenablefrictioncaching": val = m_params[0].shouldEnableFrictionCaching; break; | ||
948 | case "numberofsolveriterations": val = m_params[0].numberOfSolverIterations; break; | ||
883 | 949 | ||
884 | case "terrainfriction": val = m_params[0].terrainFriction; break; | 950 | case "terrainfriction": val = m_params[0].terrainFriction; break; |
885 | case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; | 951 | case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; |
@@ -890,6 +956,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
890 | case "avatarrestitution": val = m_params[0].avatarRestitution; break; | 956 | case "avatarrestitution": val = m_params[0].avatarRestitution; break; |
891 | case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break; | 957 | case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break; |
892 | case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break; | 958 | case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break; |
959 | case "avatarcontactprocessingthreshold": val = m_params[0].avatarContactProcessingThreshold; break; | ||
893 | default: ret = false; break; | 960 | default: ret = false; break; |
894 | 961 | ||
895 | } | 962 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index aab0994..086f0dc 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -132,6 +132,15 @@ public struct ConfigurationParameters | |||
132 | public float avatarRestitution; | 132 | public float avatarRestitution; |
133 | public float avatarCapsuleRadius; | 133 | public float avatarCapsuleRadius; |
134 | public float avatarCapsuleHeight; | 134 | public float avatarCapsuleHeight; |
135 | public float avatarContactProcessingThreshold; | ||
136 | |||
137 | public float maxPersistantManifoldPoolSize; | ||
138 | public float shouldDisableContactPoolDynamicAllocation; | ||
139 | public float shouldForceUpdateAllAabbs; | ||
140 | public float shouldRandomizeSolverOrder; | ||
141 | public float shouldSplitSimulationIslands; | ||
142 | public float shouldEnableFrictionCaching; | ||
143 | public float numberOfSolverIterations; | ||
135 | 144 | ||
136 | public const float numericTrue = 1f; | 145 | public const float numericTrue = 1f; |
137 | public const float numericFalse = 0f; | 146 | public const float numericFalse = 0f; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bb374ed..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 = AnimationSet.Animations.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 | == AnimationSet.Animations.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 | == AnimationSet.Animations.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/Api/Runtime/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs index 04357a9..09a9a08 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs | |||
@@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
226 | break; | 226 | break; |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | int z = 0; | |
230 | try | 230 | try |
231 | { | 231 | { |
232 | if (gotMatch) | 232 | if (gotMatch) |
@@ -235,8 +235,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
235 | finally | 235 | finally |
236 | { | 236 | { |
237 | // Manually finalize all the iterators. | 237 | // Manually finalize all the iterators. |
238 | for (int i = 0; i < nIterators; ++i) | 238 | for (z = 0; z < nIterators; ++z) |
239 | iterators[i].Dispose(); | 239 | iterators[z].Dispose(); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs index d8f44c1..f2171dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs | |||
@@ -576,7 +576,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
576 | break; | 576 | break; |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | int z = 0; | |
580 | try | 580 | try |
581 | { | 581 | { |
582 | if (gotMatch) | 582 | if (gotMatch) |
@@ -585,8 +585,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
585 | finally | 585 | finally |
586 | { | 586 | { |
587 | // Manually finalize all the iterators. | 587 | // Manually finalize all the iterators. |
588 | for (int i = 0; i < nIterators; ++i) | 588 | for (z = 0; z < nIterators; ++z) |
589 | iterators[i].Dispose(); | 589 | iterators[z].Dispose(); |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using NUnit.Framework; | ||
35 | using OpenMetaverse; | ||
36 | using OpenMetaverse.Assets; | ||
37 | using OpenMetaverse.StructuredData; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; | ||
40 | using OpenSim.Region.OptionalModules.World.NPC; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Region.ScriptEngine.Shared; | ||
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
44 | using OpenSim.Services.Interfaces; | ||
45 | using OpenSim.Tests.Common; | ||
46 | using OpenSim.Tests.Common.Mock; | ||
47 | |||
48 | namespace 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 | ||