diff options
Diffstat (limited to 'OpenSim/Region/Framework')
52 files changed, 2227 insertions, 969 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 32f4eea..c605fc1 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -166,6 +166,19 @@ namespace OpenSim.Region.Framework.Interfaces | |||
166 | List<TaskInventoryItem> GetInventoryItems(); | 166 | List<TaskInventoryItem> GetInventoryItems(); |
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// Gets an inventory item by name | ||
170 | /// </summary> | ||
171 | /// <remarks> | ||
172 | /// This method returns the first inventory item that matches the given name. In SL this is all you need | ||
173 | /// since each item in a prim inventory must have a unique name. | ||
174 | /// </remarks> | ||
175 | /// <param name='name'></param> | ||
176 | /// <returns> | ||
177 | /// The inventory item. Null if no such item was found. | ||
178 | /// </returns> | ||
179 | TaskInventoryItem GetInventoryItem(string name); | ||
180 | |||
181 | /// <summary> | ||
169 | /// Get inventory items by name. | 182 | /// Get inventory items by name. |
170 | /// </summary> | 183 | /// </summary> |
171 | /// <param name="name"></param> | 184 | /// <param name="name"></param> |
@@ -174,7 +187,17 @@ namespace OpenSim.Region.Framework.Interfaces | |||
174 | /// If no inventory item has that name then an empty list is returned. | 187 | /// If no inventory item has that name then an empty list is returned. |
175 | /// </returns> | 188 | /// </returns> |
176 | List<TaskInventoryItem> GetInventoryItems(string name); | 189 | List<TaskInventoryItem> GetInventoryItems(string name); |
177 | 190 | ||
191 | /// <summary> | ||
192 | /// Get inventory items by type. | ||
193 | /// </summary> | ||
194 | /// <param type="name"></param> | ||
195 | /// <returns> | ||
196 | /// A list of inventory items of that type. | ||
197 | /// If no inventory items of that type then an empty list is returned. | ||
198 | /// </returns> | ||
199 | List<TaskInventoryItem> GetInventoryItems(InventoryType type); | ||
200 | |||
178 | /// <summary> | 201 | /// <summary> |
179 | /// Get the scene object referenced by an inventory item. | 202 | /// Get the scene object referenced by an inventory item. |
180 | /// </summary> | 203 | /// </summary> |
@@ -228,6 +251,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
228 | bool ContainsScripts(); | 251 | bool ContainsScripts(); |
229 | 252 | ||
230 | /// <summary> | 253 | /// <summary> |
254 | /// Returns the count of scripts contained | ||
255 | /// </summary></returns> | ||
256 | int ScriptCount(); | ||
257 | |||
258 | /// <summary> | ||
259 | /// Returns the count of running scripts contained | ||
260 | /// </summary></returns> | ||
261 | int RunningScriptCount(); | ||
262 | |||
263 | /// <summary> | ||
231 | /// Get the uuids of all items in this inventory | 264 | /// Get the uuids of all items in this inventory |
232 | /// </summary> | 265 | /// </summary> |
233 | /// <returns></returns> | 266 | /// <returns></returns> |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 76f1641..5bc8e51 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -39,13 +39,30 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | 39 | ||
40 | public interface IEntityTransferModule | 40 | public interface IEntityTransferModule |
41 | { | 41 | { |
42 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, | 42 | /// <summary> |
43 | Vector3 lookAt, uint teleportFlags); | 43 | /// Teleport an agent within the same or to a different region. |
44 | /// </summary> | ||
45 | /// <param name='agent'></param> | ||
46 | /// <param name='regionHandle'> | ||
47 | /// The handle of the destination region. If it's the same as the region currently | ||
48 | /// occupied by the agent then the teleport will be within that region. | ||
49 | /// </param> | ||
50 | /// <param name='position'></param> | ||
51 | /// <param name='lookAt'></param> | ||
52 | /// <param name='teleportFlags'></param> | ||
53 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags); | ||
44 | 54 | ||
45 | bool TeleportHome(UUID id, IClientAPI client); | 55 | bool TeleportHome(UUID id, IClientAPI client); |
46 | 56 | ||
47 | void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, | 57 | void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, |
48 | Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq); | 58 | Vector3 position, Vector3 lookAt, uint teleportFlags); |
59 | |||
60 | /// <summary> | ||
61 | /// Show whether the given agent is being teleported. | ||
62 | /// </summary> | ||
63 | /// <param name='id'>The agent ID</para></param> | ||
64 | /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> | ||
65 | bool IsInTransit(UUID id); | ||
49 | 66 | ||
50 | bool Cross(ScenePresence agent, bool isFlying); | 67 | bool Cross(ScenePresence agent, bool isFlying); |
51 | 68 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs b/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs new file mode 100644 index 0000000..7a7b782 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs | |||
@@ -0,0 +1,36 @@ | |||
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 OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Region.Framework.Interfaces | ||
31 | { | ||
32 | public interface IEnvironmentModule | ||
33 | { | ||
34 | void ResetEnvironmentSettings(UUID regionUUID); | ||
35 | } | ||
36 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 72e79ed..ca2ad94 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -47,5 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
47 | void sendRegionHandshakeToAll(); | 47 | void sendRegionHandshakeToAll(); |
48 | void TriggerEstateInfoChange(); | 48 | void TriggerEstateInfoChange(); |
49 | void TriggerRegionInfoChange(); | 49 | void TriggerRegionInfoChange(); |
50 | |||
51 | void setEstateTerrainBaseTexture(int level, UUID texture); | ||
52 | void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue); | ||
50 | } | 53 | } |
51 | } | 54 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 1904011..3576e35 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -49,11 +49,15 @@ namespace OpenSim.Region.Framework.Interfaces | |||
49 | /// <param name="folderID"></param> | 49 | /// <param name="folderID"></param> |
50 | /// <param name="objectGroups"></param> | 50 | /// <param name="objectGroups"></param> |
51 | /// <param name="remoteClient"></param> | 51 | /// <param name="remoteClient"></param> |
52 | /// <param name="asAttachment"> | ||
53 | /// Should be true if the object(s) are begin taken as attachments. False otherwise. | ||
54 | /// </param> | ||
52 | /// <returns> | 55 | /// <returns> |
53 | /// Returns the UUID of the newly created item asset (not the item itself). | 56 | /// A list of the items created. If there was more than one object and objects are not being coaleseced in |
54 | /// FIXME: This is not very useful. It would be far more useful to return a list of items instead. | 57 | /// inventory, then the order of items is in the same order as the input objects. |
55 | /// </returns> | 58 | /// </returns> |
56 | UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient); | 59 | List<InventoryItemBase> CopyToInventory( |
60 | DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment); | ||
57 | 61 | ||
58 | /// <summary> | 62 | /// <summary> |
59 | /// Rez an object into the scene from the user's inventory | 63 | /// Rez an object into the scene from the user's inventory |
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs new file mode 100644 index 0000000..baac6e8 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public delegate void TakeValueCallback(string s); | ||
35 | |||
36 | public interface IJsonStoreModule | ||
37 | { | ||
38 | bool CreateStore(string value, out UUID result); | ||
39 | bool DestroyStore(UUID storeID); | ||
40 | bool TestPath(UUID storeID, string path, bool useJson); | ||
41 | bool SetValue(UUID storeID, string path, string value, bool useJson); | ||
42 | bool RemoveValue(UUID storeID, string path); | ||
43 | bool GetValue(UUID storeID, string path, bool useJson, out string value); | ||
44 | |||
45 | void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | ||
46 | void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | ||
47 | } | ||
48 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index dc3ff89..860483d 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs | |||
@@ -113,9 +113,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
113 | /// </param> | 113 | /// </param> |
114 | /// <param name="landAtTarget"> | 114 | /// <param name="landAtTarget"> |
115 | /// If true and the avatar is flying when it reaches the target, land. | 115 | /// If true and the avatar is flying when it reaches the target, land. |
116 | /// </param> | 116 | /// </param> name="running"> |
117 | /// If true, NPC moves with running speed. | ||
117 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | 118 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> |
118 | bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget); | 119 | /// |
120 | bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running); | ||
119 | 121 | ||
120 | /// <summary> | 122 | /// <summary> |
121 | /// Stop the NPC's current movement. | 123 | /// Stop the NPC's current movement. |
@@ -135,6 +137,36 @@ namespace OpenSim.Region.Framework.Interfaces | |||
135 | bool Say(UUID agentID, Scene scene, string text); | 137 | bool Say(UUID agentID, Scene scene, string text); |
136 | 138 | ||
137 | /// <summary> | 139 | /// <summary> |
140 | /// Get the NPC to say something. | ||
141 | /// </summary> | ||
142 | /// <param name="agentID">The UUID of the NPC</param> | ||
143 | /// <param name="scene"></param> | ||
144 | /// <param name="text"></param> | ||
145 | /// <param name="channel"></param> | ||
146 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
147 | bool Say(UUID agentID, Scene scene, string text, int channel); | ||
148 | |||
149 | /// <summary> | ||
150 | /// Get the NPC to shout something. | ||
151 | /// </summary> | ||
152 | /// <param name="agentID">The UUID of the NPC</param> | ||
153 | /// <param name="scene"></param> | ||
154 | /// <param name="text"></param> | ||
155 | /// <param name="channel"></param> | ||
156 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
157 | bool Shout(UUID agentID, Scene scene, string text, int channel); | ||
158 | |||
159 | /// <summary> | ||
160 | /// Get the NPC to whisper something. | ||
161 | /// </summary> | ||
162 | /// <param name="agentID">The UUID of the NPC</param> | ||
163 | /// <param name="scene"></param> | ||
164 | /// <param name="text"></param> | ||
165 | /// <param name="channel"></param> | ||
166 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
167 | bool Whisper(UUID agentID, Scene scene, string text, int channel); | ||
168 | |||
169 | /// <summary> | ||
138 | /// Sit the NPC. | 170 | /// Sit the NPC. |
139 | /// </summary> | 171 | /// </summary> |
140 | /// <param name="agentID"></param> | 172 | /// <param name="agentID"></param> |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs new file mode 100644 index 0000000..e03ac5a --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs | |||
@@ -0,0 +1,59 @@ | |||
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.Linq; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using System.IO; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Region.Framework.Interfaces | ||
37 | { | ||
38 | public interface IRegionCombinerModule | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Does the given id belong to the root region of a megaregion? | ||
42 | /// </summary> | ||
43 | bool IsRootForMegaregion(UUID regionId); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Gets the size of megaregion. | ||
47 | /// </summary> | ||
48 | /// <remarks> | ||
49 | /// Returns size in meters. | ||
50 | /// Do not rely on this method remaining the same - this area is actively under development. | ||
51 | /// </remarks> | ||
52 | /// <param name="sceneId"> | ||
53 | /// The id of the root region for a megaregion. | ||
54 | /// This may change in the future to allow any region id that makes up a megaregion. | ||
55 | /// Currently, will throw an exception if this does not match a root region. | ||
56 | /// </param> | ||
57 | Vector2 GetSizeOfMegaregion(UUID regionId); | ||
58 | } | ||
59 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index ce66100..143af48 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | 71 | ||
72 | bool HasScript(UUID itemID, out bool running); | 72 | bool HasScript(UUID itemID, out bool running); |
73 | 73 | ||
74 | /// <summary> | ||
75 | /// Returns true if a script is running. | ||
76 | /// </summary> | ||
77 | /// <param name="itemID">The item ID of the script.</param> | ||
78 | bool GetScriptState(UUID itemID); | ||
79 | |||
74 | void SaveAllState(); | 80 | void SaveAllState(); |
75 | 81 | ||
76 | /// <summary> | 82 | /// <summary> |
@@ -79,6 +85,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
79 | void StartProcessing(); | 85 | void StartProcessing(); |
80 | 86 | ||
81 | /// <summary> | 87 | /// <summary> |
88 | /// Get the execution times of all scripts in the given array if they are currently running. | ||
89 | /// </summary> | ||
90 | /// <returns> | ||
91 | /// A float the value is a representative execution time in milliseconds of all scripts in that Array. | ||
92 | /// </returns> | ||
93 | float GetScriptExecutionTime(List<UUID> itemIDs); | ||
94 | |||
95 | /// <summary> | ||
82 | /// Get the execution times of all scripts in each object. | 96 | /// Get the execution times of all scripts in each object. |
83 | /// </summary> | 97 | /// </summary> |
84 | /// <returns> | 98 | /// <returns> |
@@ -87,4 +101,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
87 | /// </returns> | 101 | /// </returns> |
88 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); | 102 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); |
89 | } | 103 | } |
90 | } \ No newline at end of file | 104 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs index 5b69616..ccb583d 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs | |||
@@ -96,6 +96,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
96 | void StoreRegionWindlightSettings(RegionLightShareData wl); | 96 | void StoreRegionWindlightSettings(RegionLightShareData wl); |
97 | void RemoveRegionWindlightSettings(UUID regionID); | 97 | void RemoveRegionWindlightSettings(UUID regionID); |
98 | 98 | ||
99 | /// <summary> | ||
100 | /// Load Environment settings from region storage | ||
101 | /// </summary> | ||
102 | /// <param name="regionUUID">the region UUID</param> | ||
103 | /// <returns>LLSD string for viewer</returns> | ||
104 | string LoadRegionEnvironmentSettings(UUID regionUUID); | ||
105 | |||
106 | /// <summary> | ||
107 | /// Store Environment settings into region storage | ||
108 | /// </summary> | ||
109 | /// <param name="regionUUID">the region UUID</param> | ||
110 | /// <param name="settings">LLSD string from viewer</param> | ||
111 | void StoreRegionEnvironmentSettings(UUID regionUUID, string settings); | ||
112 | |||
113 | /// <summary> | ||
114 | /// Delete Environment settings from region storage | ||
115 | /// </summary> | ||
116 | /// <param name="regionUUID">the region UUID</param> | ||
117 | void RemoveRegionEnvironmentSettings(UUID regionUUID); | ||
118 | |||
99 | UUID[] GetObjectIDs(UUID regionID); | 119 | UUID[] GetObjectIDs(UUID regionID); |
100 | } | 120 | } |
101 | } | 121 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index b7d9cfa..d7c80f7 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs | |||
@@ -108,6 +108,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
108 | void RemoveRegionWindlightSettings(UUID regionID); | 108 | void RemoveRegionWindlightSettings(UUID regionID); |
109 | UUID[] GetObjectIDs(UUID regionID); | 109 | UUID[] GetObjectIDs(UUID regionID); |
110 | 110 | ||
111 | /// <summary> | ||
112 | /// Load Environment settings from region storage | ||
113 | /// </summary> | ||
114 | /// <param name="regionUUID">the region UUID</param> | ||
115 | /// <returns>LLSD string for viewer</returns> | ||
116 | string LoadRegionEnvironmentSettings(UUID regionUUID); | ||
117 | |||
118 | /// <summary> | ||
119 | /// Store Environment settings into region storage | ||
120 | /// </summary> | ||
121 | /// <param name="regionUUID">the region UUID</param> | ||
122 | /// <param name="settings">LLSD string from viewer</param> | ||
123 | void StoreRegionEnvironmentSettings(UUID regionUUID, string settings); | ||
124 | |||
125 | /// <summary> | ||
126 | /// Delete Environment settings from region storage | ||
127 | /// </summary> | ||
128 | /// <param name="regionUUID">the region UUID</param> | ||
129 | void RemoveRegionEnvironmentSettings(UUID regionUUID); | ||
130 | |||
111 | void Shutdown(); | 131 | void Shutdown(); |
112 | } | 132 | } |
113 | } | 133 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs index 1b91166..457444c 100644 --- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs | |||
@@ -34,6 +34,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | public interface IUrlModule | 35 | public interface IUrlModule |
36 | { | 36 | { |
37 | string ExternalHostNameForLSL { get; } | ||
37 | UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 38 | UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
38 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
39 | void ReleaseURL(string url); | 40 | void ReleaseURL(string url); |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index e8e375e..4e74781 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
103 | /// <param name='msg'> | 103 | /// <param name='msg'> |
104 | /// Message. | 104 | /// Message. |
105 | /// </param> | 105 | /// </param> |
106 | bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error); | 106 | void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg); |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
109 | /// Are there any listen events ready to be dispatched? | 109 | /// Are there any listen events ready to be dispatched? |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index e577958..9ddac19 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -294,6 +294,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
294 | return "FALLDOWN"; | 294 | return "FALLDOWN"; |
295 | } | 295 | } |
296 | 296 | ||
297 | // Check if the user has stopped walking just now | ||
298 | if (CurrentMovementAnimation == "WALK" && (move == Vector3.Zero)) | ||
299 | return "STAND"; | ||
300 | |||
297 | return CurrentMovementAnimation; | 301 | return CurrentMovementAnimation; |
298 | } | 302 | } |
299 | 303 | ||
@@ -418,13 +422,16 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
418 | /// </summary> | 422 | /// </summary> |
419 | public void UpdateMovementAnimations() | 423 | public void UpdateMovementAnimations() |
420 | { | 424 | { |
421 | CurrentMovementAnimation = DetermineMovementAnimation(); | 425 | lock (m_animations) |
426 | { | ||
427 | CurrentMovementAnimation = DetermineMovementAnimation(); | ||
422 | 428 | ||
423 | // m_log.DebugFormat( | 429 | // m_log.DebugFormat( |
424 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | 430 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", |
425 | // CurrentMovementAnimation, m_scenePresence.Name); | 431 | // CurrentMovementAnimation, m_scenePresence.Name); |
426 | 432 | ||
427 | TrySetMovementAnimation(CurrentMovementAnimation); | 433 | TrySetMovementAnimation(CurrentMovementAnimation); |
434 | } | ||
428 | } | 435 | } |
429 | 436 | ||
430 | public UUID[] GetAnimationArray() | 437 | public UUID[] GetAnimationArray() |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs index 9cb5674..d9d2e64 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | if (fh.Client.IsLoggingOut) | 140 | if (!fh.Client.IsActive) |
141 | continue; | 141 | continue; |
142 | 142 | ||
143 | // m_log.DebugFormat( | 143 | // m_log.DebugFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index f678d07..f555b49 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
117 | 117 | ||
118 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) | 118 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) |
119 | { | 119 | { |
120 | m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop"); | 120 | // m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop"); |
121 | 121 | ||
122 | // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved | 122 | // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved |
123 | // in a culture where decimal points are commas and then reloaded in a culture which just treats them as | 123 | // in a culture where decimal points are commas and then reloaded in a culture which just treats them as |
@@ -147,15 +147,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | { | 147 | { |
148 | x = m_inventoryDeletes.Dequeue(); | 148 | x = m_inventoryDeletes.Dequeue(); |
149 | 149 | ||
150 | m_log.DebugFormat( | 150 | // m_log.DebugFormat( |
151 | "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", | 151 | // "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", |
152 | left, x.action, x.objectGroups.Count); | 152 | // left, x.action, x.objectGroups.Count); |
153 | 153 | ||
154 | try | 154 | try |
155 | { | 155 | { |
156 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 156 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
157 | if (invAccess != null) | 157 | if (invAccess != null) |
158 | invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient); | 158 | invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient, false); |
159 | 159 | ||
160 | if (x.permissionToDelete) | 160 | if (x.permissionToDelete) |
161 | { | 161 | { |
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
185 | e.StackTrace); | 185 | e.StackTrace); |
186 | } | 186 | } |
187 | 187 | ||
188 | m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue."); | 188 | // m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue."); |
189 | 189 | ||
190 | return false; | 190 | return false; |
191 | } | 191 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 2365cfe..76a952b 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -53,6 +53,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
53 | 53 | ||
54 | public event ClientMovement OnClientMovement; | 54 | public event ClientMovement OnClientMovement; |
55 | 55 | ||
56 | public delegate void OnTerrainTaintedDelegate(); | ||
57 | |||
58 | public event OnTerrainTaintedDelegate OnTerrainTainted; | ||
59 | |||
56 | public delegate void OnTerrainTickDelegate(); | 60 | public delegate void OnTerrainTickDelegate(); |
57 | 61 | ||
58 | public delegate void OnTerrainUpdateDelegate(); | 62 | public delegate void OnTerrainUpdateDelegate(); |
@@ -484,6 +488,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
484 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop); | 488 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop); |
485 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; | 489 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; |
486 | 490 | ||
491 | public delegate void ScenePresenceUpdated(ScenePresence sp); | ||
492 | public event ScenePresenceUpdated OnScenePresenceUpdated; | ||
493 | |||
487 | public delegate void RegionUp(GridRegion region); | 494 | public delegate void RegionUp(GridRegion region); |
488 | public event RegionUp OnRegionUp; | 495 | public event RegionUp OnRegionUp; |
489 | 496 | ||
@@ -935,6 +942,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
935 | } | 942 | } |
936 | } | 943 | } |
937 | 944 | ||
945 | public void TriggerTerrainTainted() | ||
946 | { | ||
947 | OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted; | ||
948 | if (handlerTerrainTainted != null) | ||
949 | { | ||
950 | foreach (OnTerrainTaintedDelegate d in handlerTerrainTainted.GetInvocationList()) | ||
951 | { | ||
952 | try | ||
953 | { | ||
954 | d(); | ||
955 | } | ||
956 | catch (Exception e) | ||
957 | { | ||
958 | m_log.ErrorFormat( | ||
959 | "[EVENT MANAGER]: Delegate for TriggerTerrainTainted failed - continuing. {0} {1}", | ||
960 | e.Message, e.StackTrace); | ||
961 | } | ||
962 | } | ||
963 | } | ||
964 | } | ||
965 | |||
938 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) | 966 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) |
939 | { | 967 | { |
940 | OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; | 968 | OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; |
@@ -2367,6 +2395,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2367 | } | 2395 | } |
2368 | } | 2396 | } |
2369 | 2397 | ||
2398 | public void TriggerScenePresenceUpdated(ScenePresence sp) | ||
2399 | { | ||
2400 | ScenePresenceUpdated handler = OnScenePresenceUpdated; | ||
2401 | if (handler != null) | ||
2402 | { | ||
2403 | foreach (ScenePresenceUpdated d in handler.GetInvocationList()) | ||
2404 | { | ||
2405 | try | ||
2406 | { | ||
2407 | d(sp); | ||
2408 | } | ||
2409 | catch (Exception e) | ||
2410 | { | ||
2411 | m_log.ErrorFormat( | ||
2412 | "[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}", | ||
2413 | e.Message, e.StackTrace); | ||
2414 | } | ||
2415 | } | ||
2416 | } | ||
2417 | } | ||
2418 | |||
2370 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, | 2419 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, |
2371 | int local_id, IClientAPI remote_client) | 2420 | int local_id, IClientAPI remote_client) |
2372 | { | 2421 | { |
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index 6c5685c..1365831 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs | |||
@@ -48,16 +48,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
48 | { | 48 | { |
49 | public class RegionStatsHandler : IStreamedRequestHandler | 49 | public class RegionStatsHandler : IStreamedRequestHandler |
50 | { | 50 | { |
51 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
51 | private string osRXStatsURI = String.Empty; | 53 | private string osRXStatsURI = String.Empty; |
52 | private string osXStatsURI = String.Empty; | 54 | private string osXStatsURI = String.Empty; |
53 | //private string osSecret = String.Empty; | 55 | //private string osSecret = String.Empty; |
54 | private OpenSim.Framework.RegionInfo regionInfo; | 56 | private OpenSim.Framework.RegionInfo regionInfo; |
55 | public string localZone = TimeZone.CurrentTimeZone.StandardName; | 57 | public string localZone = TimeZone.CurrentTimeZone.StandardName; |
56 | public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); | 58 | public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); |
57 | |||
58 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | 59 | ||
60 | public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info) | 60 | public string Name { get { return "RegionStats"; } } |
61 | public string Description { get { return "Region Statistics"; } } | ||
62 | |||
63 | public RegionStatsHandler(RegionInfo region_info) | ||
61 | { | 64 | { |
62 | regionInfo = region_info; | 65 | regionInfo = region_info; |
63 | osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); | 66 | osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 29465c0..e1281a6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -300,6 +300,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
300 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId); | 300 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId); |
301 | AssetService.Store(asset); | 301 | AssetService.Store(asset); |
302 | 302 | ||
303 | // m_log.DebugFormat( | ||
304 | // "[PRIM INVENTORY]: Stored asset {0} when updating item {1} in prim {2} for {3}", | ||
305 | // asset.ID, item.Name, part.Name, remoteClient.Name); | ||
306 | |||
303 | if (isScriptRunning) | 307 | if (isScriptRunning) |
304 | { | 308 | { |
305 | part.Inventory.RemoveScriptInstance(item.ItemID, false); | 309 | part.Inventory.RemoveScriptInstance(item.ItemID, false); |
@@ -431,10 +435,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | } | 435 | } |
432 | else | 436 | else |
433 | { | 437 | { |
434 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); | 438 | if (AgentTransactionsModule != null) |
435 | if (agentTransactions != null) | ||
436 | { | 439 | { |
437 | agentTransactions.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); | 440 | AgentTransactionsModule.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); |
438 | } | 441 | } |
439 | } | 442 | } |
440 | } | 443 | } |
@@ -950,8 +953,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
950 | sbyte invType, sbyte type, UUID olditemID) | 953 | sbyte invType, sbyte type, UUID olditemID) |
951 | { | 954 | { |
952 | // m_log.DebugFormat( | 955 | // m_log.DebugFormat( |
953 | // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", | 956 | // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}, assetType {4}, inventoryType {5}", |
954 | // remoteClient.Name, name, folderID, olditemID); | 957 | // remoteClient.Name, name, folderID, olditemID, (AssetType)type, (InventoryType)invType); |
955 | 958 | ||
956 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 959 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
957 | return; | 960 | return; |
@@ -984,10 +987,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
984 | asset.Type = type; | 987 | asset.Type = type; |
985 | asset.Name = name; | 988 | asset.Name = name; |
986 | asset.Description = description; | 989 | asset.Description = description; |
987 | 990 | ||
988 | CreateNewInventoryItem( | 991 | CreateNewInventoryItem( |
989 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, | 992 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, |
990 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, | 993 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, |
991 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); | 994 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); |
992 | } | 995 | } |
993 | else | 996 | else |
@@ -1562,21 +1565,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1562 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the | 1565 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the |
1563 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) | 1566 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) |
1564 | // will not pass in a transaction ID in the update message. | 1567 | // will not pass in a transaction ID in the update message. |
1565 | if (transactionID != UUID.Zero) | 1568 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) |
1566 | { | 1569 | { |
1567 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); | 1570 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1568 | if (agentTransactions != null) | 1571 | remoteClient, part, transactionID, currentItem); |
1569 | { | 1572 | |
1570 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1573 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1571 | remoteClient, part, transactionID, currentItem); | 1574 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1572 | 1575 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | |
1573 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1576 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1574 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1577 | // else |
1575 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1578 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1576 | // remoteClient.SendAgentAlertMessage("Script saved", false); | ||
1577 | // else | ||
1578 | // remoteClient.SendAgentAlertMessage("Item saved", false); | ||
1579 | } | ||
1580 | } | 1579 | } |
1581 | 1580 | ||
1582 | // Base ALWAYS has move | 1581 | // Base ALWAYS has move |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 3ef1e29..cf68ff4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -38,8 +38,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
38 | { | 38 | { |
39 | public partial class Scene | 39 | public partial class Scene |
40 | { | 40 | { |
41 | |||
41 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 42 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
42 | UUID fromID, bool fromAgent, bool broadcast) | 43 | UUID fromID, UUID targetID, bool fromAgent, bool broadcast) |
43 | { | 44 | { |
44 | OSChatMessage args = new OSChatMessage(); | 45 | OSChatMessage args = new OSChatMessage(); |
45 | 46 | ||
@@ -63,14 +64,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
63 | } | 64 | } |
64 | 65 | ||
65 | args.From = fromName; | 66 | args.From = fromName; |
66 | //args. | 67 | args.TargetUUID = targetID; |
67 | 68 | ||
68 | if (broadcast) | 69 | if (broadcast) |
69 | EventManager.TriggerOnChatBroadcast(this, args); | 70 | EventManager.TriggerOnChatBroadcast(this, args); |
70 | else | 71 | else |
71 | EventManager.TriggerOnChatFromWorld(this, args); | 72 | EventManager.TriggerOnChatFromWorld(this, args); |
72 | } | 73 | } |
73 | 74 | ||
75 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | ||
76 | UUID fromID, bool fromAgent, bool broadcast) | ||
77 | { | ||
78 | SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast); | ||
79 | } | ||
80 | |||
74 | /// <summary> | 81 | /// <summary> |
75 | /// | 82 | /// |
76 | /// </summary> | 83 | /// </summary> |
@@ -108,6 +115,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
108 | { | 115 | { |
109 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); | 116 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); |
110 | } | 117 | } |
118 | /// <summary> | ||
119 | /// | ||
120 | /// </summary> | ||
121 | /// <param name="message"></param> | ||
122 | /// <param name="type"></param> | ||
123 | /// <param name="fromPos"></param> | ||
124 | /// <param name="fromName"></param> | ||
125 | /// <param name="fromAgentID"></param> | ||
126 | /// <param name="targetID"></param> | ||
127 | public void SimChatToAgent(UUID targetID, byte[] message, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent) | ||
128 | { | ||
129 | SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false); | ||
130 | } | ||
111 | 131 | ||
112 | /// <summary> | 132 | /// <summary> |
113 | /// Invoked when the client requests a prim. | 133 | /// Invoked when the client requests a prim. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4..535d87a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); | 67 | public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); |
68 | public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); | 68 | public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); |
69 | public delegate bool IsGodHandler(UUID user, Scene requestFromScene); | 69 | public delegate bool IsGodHandler(UUID user, Scene requestFromScene); |
70 | public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); | ||
70 | public delegate bool IsAdministratorHandler(UUID user); | 71 | public delegate bool IsAdministratorHandler(UUID user); |
71 | public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); | 72 | public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); |
72 | public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); | 73 | public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); |
@@ -134,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
134 | public event RunConsoleCommandHandler OnRunConsoleCommand; | 135 | public event RunConsoleCommandHandler OnRunConsoleCommand; |
135 | public event IssueEstateCommandHandler OnIssueEstateCommand; | 136 | public event IssueEstateCommandHandler OnIssueEstateCommand; |
136 | public event IsGodHandler OnIsGod; | 137 | public event IsGodHandler OnIsGod; |
138 | public event IsGridGodHandler OnIsGridGod; | ||
137 | public event IsAdministratorHandler OnIsAdministrator; | 139 | public event IsAdministratorHandler OnIsAdministrator; |
138 | // public event EditParcelHandler OnEditParcel; | 140 | // public event EditParcelHandler OnEditParcel; |
139 | public event EditParcelPropertiesHandler OnEditParcelProperties; | 141 | public event EditParcelPropertiesHandler OnEditParcelProperties; |
@@ -728,6 +730,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
728 | return true; | 730 | return true; |
729 | } | 731 | } |
730 | 732 | ||
733 | public bool IsGridGod(UUID user) | ||
734 | { | ||
735 | IsGridGodHandler handler = OnIsGridGod; | ||
736 | if (handler != null) | ||
737 | { | ||
738 | Delegate[] list = handler.GetInvocationList(); | ||
739 | foreach (IsGridGodHandler h in list) | ||
740 | { | ||
741 | if (h(user, m_scene) == false) | ||
742 | return false; | ||
743 | } | ||
744 | } | ||
745 | return true; | ||
746 | } | ||
747 | |||
731 | public bool IsAdministrator(UUID user) | 748 | public bool IsAdministrator(UUID user) |
732 | { | 749 | { |
733 | IsAdministratorHandler handler = OnIsAdministrator; | 750 | IsAdministratorHandler handler = OnIsAdministrator; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6a120c1..85bae9a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -77,7 +77,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | public bool DebugUpdates { get; private set; } | 77 | public bool DebugUpdates { get; private set; } |
78 | 78 | ||
79 | public SynchronizeSceneHandler SynchronizeScene; | 79 | public SynchronizeSceneHandler SynchronizeScene; |
80 | public SimStatsReporter StatsReporter; | 80 | |
81 | /// <summary> | ||
82 | /// Statistical information for this scene. | ||
83 | /// </summary> | ||
84 | public SimStatsReporter StatsReporter { get; private set; } | ||
85 | |||
81 | public List<Border> NorthBorders = new List<Border>(); | 86 | public List<Border> NorthBorders = new List<Border>(); |
82 | public List<Border> EastBorders = new List<Border>(); | 87 | public List<Border> EastBorders = new List<Border>(); |
83 | public List<Border> SouthBorders = new List<Border>(); | 88 | public List<Border> SouthBorders = new List<Border>(); |
@@ -103,6 +108,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | public bool m_trustBinaries; | 108 | public bool m_trustBinaries; |
104 | public bool m_allowScriptCrossings; | 109 | public bool m_allowScriptCrossings; |
105 | public bool m_useFlySlow; | 110 | public bool m_useFlySlow; |
111 | public bool m_useTrashOnDelete = true; | ||
106 | 112 | ||
107 | /// <summary> | 113 | /// <summary> |
108 | /// Temporarily setting to trigger appearance resends at 60 second intervals. | 114 | /// Temporarily setting to trigger appearance resends at 60 second intervals. |
@@ -163,7 +169,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
163 | protected IConfigSource m_config; | 169 | protected IConfigSource m_config; |
164 | protected IRegionSerialiserModule m_serialiser; | 170 | protected IRegionSerialiserModule m_serialiser; |
165 | protected IDialogModule m_dialogModule; | 171 | protected IDialogModule m_dialogModule; |
166 | protected IEntityTransferModule m_teleportModule; | ||
167 | protected ICapabilitiesModule m_capsModule; | 172 | protected ICapabilitiesModule m_capsModule; |
168 | protected IGroupsModule m_groupsModule; | 173 | protected IGroupsModule m_groupsModule; |
169 | 174 | ||
@@ -217,6 +222,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | private int backupMS; | 222 | private int backupMS; |
218 | private int terrainMS; | 223 | private int terrainMS; |
219 | private int landMS; | 224 | private int landMS; |
225 | private int spareMS; | ||
220 | 226 | ||
221 | /// <summary> | 227 | /// <summary> |
222 | /// Tick at which the last frame was processed. | 228 | /// Tick at which the last frame was processed. |
@@ -458,6 +464,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | { | 464 | { |
459 | if (m_simulationService == null) | 465 | if (m_simulationService == null) |
460 | m_simulationService = RequestModuleInterface<ISimulationService>(); | 466 | m_simulationService = RequestModuleInterface<ISimulationService>(); |
467 | |||
461 | return m_simulationService; | 468 | return m_simulationService; |
462 | } | 469 | } |
463 | } | 470 | } |
@@ -513,6 +520,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
513 | } | 520 | } |
514 | 521 | ||
515 | public IAttachmentsModule AttachmentsModule { get; set; } | 522 | public IAttachmentsModule AttachmentsModule { get; set; } |
523 | public IEntityTransferModule EntityTransferModule { get; private set; } | ||
524 | public IAgentAssetTransactions AgentTransactionsModule { get; private set; } | ||
516 | 525 | ||
517 | public IAvatarFactoryModule AvatarFactory | 526 | public IAvatarFactoryModule AvatarFactory |
518 | { | 527 | { |
@@ -589,6 +598,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | get { return m_sceneGraph.Entities; } | 598 | get { return m_sceneGraph.Entities; } |
590 | } | 599 | } |
591 | 600 | ||
601 | |||
602 | // used in sequence see: SpawnPoint() | ||
603 | private int m_SpawnPoint; | ||
604 | // can be closest/random/sequence | ||
605 | public string SpawnPointRouting | ||
606 | { | ||
607 | get; private set; | ||
608 | } | ||
609 | // allow landmarks to pass | ||
610 | public bool TelehubAllowLandmarks | ||
611 | { | ||
612 | get; private set; | ||
613 | } | ||
614 | |||
592 | #endregion Properties | 615 | #endregion Properties |
593 | 616 | ||
594 | #region Constructors | 617 | #region Constructors |
@@ -606,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
606 | 629 | ||
607 | Random random = new Random(); | 630 | Random random = new Random(); |
608 | 631 | ||
609 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); | 632 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); |
610 | m_moduleLoader = moduleLoader; | 633 | m_moduleLoader = moduleLoader; |
611 | m_authenticateHandler = authen; | 634 | m_authenticateHandler = authen; |
612 | m_sceneGridService = sceneGridService; | 635 | m_sceneGridService = sceneGridService; |
@@ -726,6 +749,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
726 | m_maxPhys = RegionInfo.PhysPrimMax; | 749 | m_maxPhys = RegionInfo.PhysPrimMax; |
727 | } | 750 | } |
728 | 751 | ||
752 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
753 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
754 | |||
729 | // Here, if clamping is requested in either global or | 755 | // Here, if clamping is requested in either global or |
730 | // local config, it will be used | 756 | // local config, it will be used |
731 | // | 757 | // |
@@ -735,6 +761,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
735 | m_clampPrimSize = true; | 761 | m_clampPrimSize = true; |
736 | } | 762 | } |
737 | 763 | ||
764 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); | ||
738 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 765 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
739 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 766 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
740 | m_dontPersistBefore = | 767 | m_dontPersistBefore = |
@@ -833,13 +860,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
833 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 860 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
834 | } | 861 | } |
835 | 862 | ||
836 | /// <summary> | ||
837 | /// Mock constructor for scene group persistency unit tests. | ||
838 | /// SceneObjectGroup RegionId property is delegated to Scene. | ||
839 | /// </summary> | ||
840 | /// <param name="regInfo"></param> | ||
841 | public Scene(RegionInfo regInfo) | 863 | public Scene(RegionInfo regInfo) |
842 | { | 864 | { |
865 | PhysicalPrims = true; | ||
866 | CollidablePrims = true; | ||
867 | |||
843 | BordersLocked = true; | 868 | BordersLocked = true; |
844 | Border northBorder = new Border(); | 869 | Border northBorder = new Border(); |
845 | northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- | 870 | northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- |
@@ -866,8 +891,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
866 | m_eventManager = new EventManager(); | 891 | m_eventManager = new EventManager(); |
867 | 892 | ||
868 | m_permissions = new ScenePermissions(this); | 893 | m_permissions = new ScenePermissions(this); |
869 | |||
870 | // m_lastUpdate = Util.EnvironmentTickCount(); | ||
871 | } | 894 | } |
872 | 895 | ||
873 | #endregion | 896 | #endregion |
@@ -936,8 +959,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
936 | List<ulong> old = new List<ulong>(); | 959 | List<ulong> old = new List<ulong>(); |
937 | old.Add(otherRegion.RegionHandle); | 960 | old.Add(otherRegion.RegionHandle); |
938 | agent.DropOldNeighbours(old); | 961 | agent.DropOldNeighbours(old); |
939 | if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) | 962 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
940 | m_teleportModule.EnableChildAgent(agent, otherRegion); | 963 | EntityTransferModule.EnableChildAgent(agent, otherRegion); |
941 | }); | 964 | }); |
942 | } | 965 | } |
943 | catch (NullReferenceException) | 966 | catch (NullReferenceException) |
@@ -950,7 +973,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
950 | else | 973 | else |
951 | { | 974 | { |
952 | m_log.InfoFormat( | 975 | m_log.InfoFormat( |
953 | "[INTERGRID]: Got notice about far away Region: {0} at ({1}, {2})", | 976 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", |
954 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); | 977 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); |
955 | } | 978 | } |
956 | } | 979 | } |
@@ -1044,13 +1067,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1044 | } | 1067 | } |
1045 | } | 1068 | } |
1046 | 1069 | ||
1070 | m_log.Error("[REGION]: Closing"); | ||
1071 | Close(); | ||
1072 | |||
1047 | if (PhysicsScene != null) | 1073 | if (PhysicsScene != null) |
1048 | { | 1074 | { |
1049 | PhysicsScene.Dispose(); | 1075 | PhysicsScene.Dispose(); |
1050 | } | 1076 | } |
1051 | |||
1052 | m_log.Error("[REGION]: Closing"); | ||
1053 | Close(); | ||
1054 | 1077 | ||
1055 | m_log.Error("[REGION]: Firing Region Restart Message"); | 1078 | m_log.Error("[REGION]: Firing Region Restart Message"); |
1056 | 1079 | ||
@@ -1074,8 +1097,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1074 | { | 1097 | { |
1075 | ForEachRootScenePresence(delegate(ScenePresence agent) | 1098 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1076 | { | 1099 | { |
1077 | if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) | 1100 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1078 | m_teleportModule.EnableChildAgent(agent, r); | 1101 | EntityTransferModule.EnableChildAgent(agent, r); |
1079 | }); | 1102 | }); |
1080 | } | 1103 | } |
1081 | catch (NullReferenceException) | 1104 | catch (NullReferenceException) |
@@ -1265,8 +1288,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1265 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1288 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1266 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1289 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1267 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1290 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
1268 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); | 1291 | EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); |
1269 | m_groupsModule = RequestModuleInterface<IGroupsModule>(); | 1292 | m_groupsModule = RequestModuleInterface<IGroupsModule>(); |
1293 | AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>(); | ||
1270 | } | 1294 | } |
1271 | 1295 | ||
1272 | #endregion | 1296 | #endregion |
@@ -1387,37 +1411,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
1387 | endFrame = Frame + frames; | 1411 | endFrame = Frame + frames; |
1388 | 1412 | ||
1389 | float physicsFPS = 0f; | 1413 | float physicsFPS = 0f; |
1390 | int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; | 1414 | int previousFrameTick, tmpMS; |
1391 | int previousFrameTick; | 1415 | int maintc = Util.EnvironmentTickCount(); |
1392 | int maintc; | ||
1393 | int sleepMS; | ||
1394 | int framestart; | ||
1395 | 1416 | ||
1396 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) | 1417 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) |
1397 | { | 1418 | { |
1398 | framestart = Util.EnvironmentTickCount(); | ||
1399 | ++Frame; | 1419 | ++Frame; |
1400 | 1420 | ||
1401 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1421 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1402 | 1422 | ||
1403 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1423 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; |
1404 | 1424 | ||
1405 | try | 1425 | try |
1406 | { | 1426 | { |
1407 | tmpPhysicsMS2 = Util.EnvironmentTickCount(); | 1427 | // Apply taints in terrain module to terrain in physics scene |
1428 | if (Frame % m_update_terrain == 0) | ||
1429 | { | ||
1430 | tmpMS = Util.EnvironmentTickCount(); | ||
1431 | UpdateTerrain(); | ||
1432 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1433 | } | ||
1434 | |||
1435 | tmpMS = Util.EnvironmentTickCount(); | ||
1408 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1436 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1409 | m_sceneGraph.UpdatePreparePhysics(); | 1437 | m_sceneGraph.UpdatePreparePhysics(); |
1410 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); | 1438 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1411 | 1439 | ||
1412 | // Apply any pending avatar force input to the avatar's velocity | 1440 | // Apply any pending avatar force input to the avatar's velocity |
1413 | tmpAgentMS = Util.EnvironmentTickCount(); | 1441 | tmpMS = Util.EnvironmentTickCount(); |
1414 | if (Frame % m_update_entitymovement == 0) | 1442 | if (Frame % m_update_entitymovement == 0) |
1415 | m_sceneGraph.UpdateScenePresenceMovement(); | 1443 | m_sceneGraph.UpdateScenePresenceMovement(); |
1416 | agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); | 1444 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1417 | 1445 | ||
1418 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1446 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1419 | // velocity | 1447 | // velocity |
1420 | tmpPhysicsMS = Util.EnvironmentTickCount(); | 1448 | tmpMS = Util.EnvironmentTickCount(); |
1421 | if (Frame % m_update_physics == 0) | 1449 | if (Frame % m_update_physics == 0) |
1422 | { | 1450 | { |
1423 | if (m_physics_enabled) | 1451 | if (m_physics_enabled) |
@@ -1426,9 +1454,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1426 | if (SynchronizeScene != null) | 1454 | if (SynchronizeScene != null) |
1427 | SynchronizeScene(this); | 1455 | SynchronizeScene(this); |
1428 | } | 1456 | } |
1429 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); | 1457 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1430 | 1458 | ||
1431 | tmpAgentMS = Util.EnvironmentTickCount(); | 1459 | tmpMS = Util.EnvironmentTickCount(); |
1432 | 1460 | ||
1433 | // Check if any objects have reached their targets | 1461 | // Check if any objects have reached their targets |
1434 | CheckAtTargets(); | 1462 | CheckAtTargets(); |
@@ -1443,36 +1471,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1443 | if (Frame % m_update_presences == 0) | 1471 | if (Frame % m_update_presences == 0) |
1444 | m_sceneGraph.UpdatePresences(); | 1472 | m_sceneGraph.UpdatePresences(); |
1445 | 1473 | ||
1446 | agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); | 1474 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1447 | 1475 | ||
1448 | // Delete temp-on-rez stuff | 1476 | // Delete temp-on-rez stuff |
1449 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1477 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
1450 | { | 1478 | { |
1451 | tmpTempOnRezMS = Util.EnvironmentTickCount(); | 1479 | tmpMS = Util.EnvironmentTickCount(); |
1452 | m_cleaningTemps = true; | 1480 | m_cleaningTemps = true; |
1453 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | 1481 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); |
1454 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | 1482 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1455 | } | 1483 | } |
1456 | 1484 | ||
1457 | if (Frame % m_update_events == 0) | 1485 | if (Frame % m_update_events == 0) |
1458 | { | 1486 | { |
1459 | evMS = Util.EnvironmentTickCount(); | 1487 | tmpMS = Util.EnvironmentTickCount(); |
1460 | UpdateEvents(); | 1488 | UpdateEvents(); |
1461 | eventMS = Util.EnvironmentTickCountSubtract(evMS); | 1489 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1462 | } | 1490 | } |
1463 | 1491 | ||
1464 | if (Frame % m_update_backup == 0) | 1492 | if (Frame % m_update_backup == 0) |
1465 | { | 1493 | { |
1466 | backMS = Util.EnvironmentTickCount(); | 1494 | tmpMS = Util.EnvironmentTickCount(); |
1467 | UpdateStorageBackup(); | 1495 | UpdateStorageBackup(); |
1468 | backupMS = Util.EnvironmentTickCountSubtract(backMS); | 1496 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1469 | } | ||
1470 | |||
1471 | if (Frame % m_update_terrain == 0) | ||
1472 | { | ||
1473 | terMS = Util.EnvironmentTickCount(); | ||
1474 | UpdateTerrain(); | ||
1475 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | ||
1476 | } | 1497 | } |
1477 | 1498 | ||
1478 | //if (Frame % m_update_land == 0) | 1499 | //if (Frame % m_update_land == 0) |
@@ -1481,29 +1502,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1481 | // UpdateLand(); | 1502 | // UpdateLand(); |
1482 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1503 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1483 | //} | 1504 | //} |
1484 | |||
1485 | // frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1486 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1487 | |||
1488 | // if (Frame%m_update_avatars == 0) | ||
1489 | // UpdateInWorldTime(); | ||
1490 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1491 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1492 | StatsReporter.AddFPS(1); | ||
1493 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | ||
1494 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); | ||
1495 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | ||
1496 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | ||
1497 | |||
1498 | // frameMS currently records work frame times, not total frame times (work + any required sleep to | ||
1499 | // reach min frame time. | ||
1500 | // StatsReporter.addFrameMS(frameMS); | ||
1501 | |||
1502 | StatsReporter.addAgentMS(agentMS); | ||
1503 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1504 | StatsReporter.addOtherMS(otherMS); | ||
1505 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | ||
1506 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1507 | 1505 | ||
1508 | if (LoginsDisabled && Frame == 20) | 1506 | if (LoginsDisabled && Frame == 20) |
1509 | { | 1507 | { |
@@ -1554,23 +1552,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
1554 | 1552 | ||
1555 | previousFrameTick = m_lastFrameTick; | 1553 | previousFrameTick = m_lastFrameTick; |
1556 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1554 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1557 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); | 1555 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); |
1558 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1556 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1559 | 1557 | ||
1560 | m_firstHeartbeat = false; | 1558 | m_firstHeartbeat = false; |
1561 | 1559 | ||
1560 | if (tmpMS > 0) | ||
1561 | { | ||
1562 | Thread.Sleep(tmpMS); | ||
1563 | spareMS += tmpMS; | ||
1564 | } | ||
1565 | |||
1566 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1567 | maintc = Util.EnvironmentTickCount(); | ||
1562 | 1568 | ||
1563 | sleepMS = Util.EnvironmentTickCount(); | 1569 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; |
1564 | 1570 | ||
1565 | if (maintc > 0) | 1571 | // if (Frame%m_update_avatars == 0) |
1566 | Thread.Sleep(maintc); | 1572 | // UpdateInWorldTime(); |
1573 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1574 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1575 | StatsReporter.AddFPS(1); | ||
1567 | 1576 | ||
1568 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); | ||
1569 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
1570 | StatsReporter.addSleepMS(sleepMS); | ||
1571 | StatsReporter.addFrameMS(frameMS); | 1577 | StatsReporter.addFrameMS(frameMS); |
1572 | 1578 | StatsReporter.addAgentMS(agentMS); | |
1573 | // Optionally warn if a frame takes double the amount of time that it should. | 1579 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); |
1580 | StatsReporter.addOtherMS(otherMS); | ||
1581 | StatsReporter.AddSpareMS(spareMS); | ||
1582 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1583 | |||
1584 | // Optionally warn if a frame takes double the amount of time that it should. | ||
1574 | if (DebugUpdates | 1585 | if (DebugUpdates |
1575 | && Util.EnvironmentTickCountSubtract( | 1586 | && Util.EnvironmentTickCountSubtract( |
1576 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) | 1587 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) |
@@ -2363,8 +2374,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2363 | return; | 2374 | return; |
2364 | } | 2375 | } |
2365 | 2376 | ||
2366 | if (m_teleportModule != null) | 2377 | if (EntityTransferModule != null) |
2367 | m_teleportModule.Cross(grp, attemptedPosition, silent); | 2378 | EntityTransferModule.Cross(grp, attemptedPosition, silent); |
2368 | } | 2379 | } |
2369 | 2380 | ||
2370 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2381 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) |
@@ -2684,10 +2695,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | { | 2695 | { |
2685 | SceneObjectGroup grp = sceneObject; | 2696 | SceneObjectGroup grp = sceneObject; |
2686 | 2697 | ||
2687 | m_log.DebugFormat( | 2698 | // m_log.DebugFormat( |
2688 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); | 2699 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2689 | m_log.DebugFormat( | 2700 | // m_log.DebugFormat( |
2690 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2701 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2691 | 2702 | ||
2692 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2703 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2693 | 2704 | ||
@@ -2783,7 +2794,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2783 | if (sp == null) | 2794 | if (sp == null) |
2784 | { | 2795 | { |
2785 | m_log.DebugFormat( | 2796 | m_log.DebugFormat( |
2786 | "[SCENE]: Adding new child scene presence {0} to scene {1} at pos {2}", client.Name, RegionInfo.RegionName, client.StartPos); | 2797 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2798 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | ||
2787 | 2799 | ||
2788 | m_clientManager.Add(client); | 2800 | m_clientManager.Add(client); |
2789 | SubscribeToClientEvents(client); | 2801 | SubscribeToClientEvents(client); |
@@ -3207,8 +3219,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3207 | /// <param name="client">The IClientAPI for the client</param> | 3219 | /// <param name="client">The IClientAPI for the client</param> |
3208 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) | 3220 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3209 | { | 3221 | { |
3210 | if (m_teleportModule != null) | 3222 | if (EntityTransferModule != null) |
3211 | return m_teleportModule.TeleportHome(agentId, client); | 3223 | { |
3224 | EntityTransferModule.TeleportHome(agentId, client); | ||
3225 | } | ||
3212 | else | 3226 | else |
3213 | { | 3227 | { |
3214 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3228 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
@@ -3370,55 +3384,70 @@ namespace OpenSim.Region.Framework.Scenes | |||
3370 | // CheckHeartbeat(); | 3384 | // CheckHeartbeat(); |
3371 | bool isChildAgent = false; | 3385 | bool isChildAgent = false; |
3372 | ScenePresence avatar = GetScenePresence(agentID); | 3386 | ScenePresence avatar = GetScenePresence(agentID); |
3373 | if (avatar != null) | 3387 | |
3388 | if (avatar == null) | ||
3389 | { | ||
3390 | m_log.WarnFormat( | ||
3391 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); | ||
3392 | |||
3393 | return; | ||
3394 | } | ||
3395 | |||
3396 | try | ||
3374 | { | 3397 | { |
3375 | isChildAgent = avatar.IsChildAgent; | 3398 | isChildAgent = avatar.IsChildAgent; |
3376 | 3399 | ||
3377 | if (avatar.ParentID != 0) | 3400 | m_log.DebugFormat( |
3401 | "[SCENE]: Removing {0} agent {1} {2} from {3}", | ||
3402 | (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); | ||
3403 | |||
3404 | // Don't do this to root agents, it's not nice for the viewer | ||
3405 | if (closeChildAgents && isChildAgent) | ||
3378 | { | 3406 | { |
3379 | avatar.StandUp(); | 3407 | // Tell a single agent to disconnect from the region. |
3408 | IEventQueue eq = RequestModuleInterface<IEventQueue>(); | ||
3409 | if (eq != null) | ||
3410 | { | ||
3411 | eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); | ||
3412 | } | ||
3413 | else | ||
3414 | { | ||
3415 | avatar.ControllingClient.SendShutdownConnectionNotice(); | ||
3416 | } | ||
3380 | } | 3417 | } |
3381 | 3418 | ||
3382 | try | 3419 | // Only applies to root agents. |
3420 | if (avatar.ParentID != 0) | ||
3383 | { | 3421 | { |
3384 | m_log.DebugFormat( | 3422 | avatar.StandUp(); |
3385 | "[SCENE]: Removing {0} agent {1} from region {2}", | 3423 | } |
3386 | (isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName); | ||
3387 | 3424 | ||
3388 | m_sceneGraph.removeUserCount(!isChildAgent); | 3425 | m_sceneGraph.removeUserCount(!isChildAgent); |
3389 | 3426 | ||
3390 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3427 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3391 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3428 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3392 | if (closeChildAgents && CapsModule != null) | 3429 | if (closeChildAgents && CapsModule != null) |
3393 | CapsModule.RemoveCaps(agentID); | 3430 | CapsModule.RemoveCaps(agentID); |
3394 | 3431 | ||
3395 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3432 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3396 | // this method is doing is HORRIBLE!!! | 3433 | // this method is doing is HORRIBLE!!! |
3397 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); | 3434 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3398 | 3435 | ||
3399 | if (closeChildAgents && !avatar.IsChildAgent) | 3436 | if (closeChildAgents && !isChildAgent) |
3400 | { | ||
3401 | List<ulong> regions = avatar.KnownRegionHandles; | ||
3402 | regions.Remove(RegionInfo.RegionHandle); | ||
3403 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | ||
3404 | } | ||
3405 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3406 | m_eventManager.TriggerClientClosed(agentID, this); | ||
3407 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3408 | } | ||
3409 | catch (NullReferenceException) | ||
3410 | { | 3437 | { |
3411 | // We don't know which count to remove it from | 3438 | List<ulong> regions = avatar.KnownRegionHandles; |
3412 | // Avatar is already disposed :/ | 3439 | regions.Remove(RegionInfo.RegionHandle); |
3440 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | ||
3413 | } | 3441 | } |
3414 | 3442 | ||
3415 | try | 3443 | m_eventManager.TriggerClientClosed(agentID, this); |
3444 | m_eventManager.TriggerOnRemovePresence(agentID); | ||
3445 | |||
3446 | if (!isChildAgent) | ||
3416 | { | 3447 | { |
3417 | m_eventManager.TriggerOnRemovePresence(agentID); | 3448 | if (AttachmentsModule != null && avatar.PresenceType != PresenceType.Npc) |
3418 | |||
3419 | if (AttachmentsModule != null && !isChildAgent && avatar.PresenceType != PresenceType.Npc) | ||
3420 | { | 3449 | { |
3421 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); | 3450 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); |
3422 | // Don't save attachments for HG visitors, it | 3451 | // Don't save attachments for HG visitors, it |
3423 | // messes up their inventory. When a HG visitor logs | 3452 | // messes up their inventory. When a HG visitor logs |
3424 | // out on a foreign grid, their attachments will be | 3453 | // out on a foreign grid, their attachments will be |
@@ -3428,7 +3457,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3428 | if (uMan == null || uMan.IsLocalGridUser(avatar.UUID)) | 3457 | if (uMan == null || uMan.IsLocalGridUser(avatar.UUID)) |
3429 | AttachmentsModule.SaveChangedAttachments(avatar, false); | 3458 | AttachmentsModule.SaveChangedAttachments(avatar, false); |
3430 | } | 3459 | } |
3431 | 3460 | ||
3432 | ForEachClient( | 3461 | ForEachClient( |
3433 | delegate(IClientAPI client) | 3462 | delegate(IClientAPI client) |
3434 | { | 3463 | { |
@@ -3436,43 +3465,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
3436 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } | 3465 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } |
3437 | catch (NullReferenceException) { } | 3466 | catch (NullReferenceException) { } |
3438 | }); | 3467 | }); |
3439 | |||
3440 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); | ||
3441 | if (agentTransactions != null) | ||
3442 | { | ||
3443 | agentTransactions.RemoveAgentAssetTransactions(agentID); | ||
3444 | } | ||
3445 | } | ||
3446 | finally | ||
3447 | { | ||
3448 | // Always clean these structures up so that any failure above doesn't cause them to remain in the | ||
3449 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | ||
3450 | // the same cleanup exception continually. | ||
3451 | // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE | ||
3452 | // since this would hide the underlying failure and other associated problems. | ||
3453 | m_sceneGraph.RemoveScenePresence(agentID); | ||
3454 | m_clientManager.Remove(agentID); | ||
3455 | } | 3468 | } |
3456 | 3469 | ||
3457 | try | 3470 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3458 | { | 3471 | if (AgentTransactionsModule != null) |
3459 | avatar.Close(); | 3472 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3460 | } | 3473 | |
3461 | catch (NullReferenceException) | 3474 | avatar.Close(); |
3462 | { | 3475 | |
3463 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | ||
3464 | } | ||
3465 | catch (Exception e) | ||
3466 | { | ||
3467 | m_log.ErrorFormat("[SCENE] Scene.cs:RemoveClient exception {0}{1}", e.Message, e.StackTrace); | ||
3468 | } | ||
3469 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | ||
3470 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3476 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3471 | // CleanDroppedAttachments(); | ||
3472 | m_log.Debug("[Scene] The avatar has left the building"); | 3477 | m_log.Debug("[Scene] The avatar has left the building"); |
3473 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | ||
3474 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | ||
3475 | } | 3478 | } |
3479 | catch (Exception e) | ||
3480 | { | ||
3481 | m_log.Error( | ||
3482 | string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e); | ||
3483 | } | ||
3484 | finally | ||
3485 | { | ||
3486 | // Always clean these structures up so that any failure above doesn't cause them to remain in the | ||
3487 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | ||
3488 | // the same cleanup exception continually. | ||
3489 | // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE | ||
3490 | // since this would hide the underlying failure and other associated problems. | ||
3491 | m_sceneGraph.RemoveScenePresence(agentID); | ||
3492 | m_clientManager.Remove(agentID); | ||
3493 | } | ||
3494 | |||
3495 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | ||
3496 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | ||
3476 | } | 3497 | } |
3477 | 3498 | ||
3478 | /// <summary> | 3499 | /// <summary> |
@@ -3554,7 +3575,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3554 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) | 3575 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) |
3555 | { | 3576 | { |
3556 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3577 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3557 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3578 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
3558 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); | 3579 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); |
3559 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); | 3580 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); |
3560 | 3581 | ||
@@ -3570,8 +3591,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3570 | // Don't disable this log message - it's too helpful | 3591 | // Don't disable this log message - it's too helpful |
3571 | m_log.DebugFormat( | 3592 | m_log.DebugFormat( |
3572 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", | 3593 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", |
3573 | RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, | 3594 | RegionInfo.RegionName, |
3574 | agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); | 3595 | (agent.child ? "child" : "root"), |
3596 | agent.firstname, | ||
3597 | agent.lastname, | ||
3598 | agent.AgentID, | ||
3599 | agent.circuitcode, | ||
3600 | agent.IPAddress, | ||
3601 | agent.Viewer, | ||
3602 | ((TPFlags)teleportFlags).ToString(), | ||
3603 | agent.startpos | ||
3604 | ); | ||
3575 | 3605 | ||
3576 | if (LoginsDisabled) | 3606 | if (LoginsDisabled) |
3577 | { | 3607 | { |
@@ -3586,7 +3616,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3586 | // We have a zombie from a crashed session. | 3616 | // We have a zombie from a crashed session. |
3587 | // Or the same user is trying to be root twice here, won't work. | 3617 | // Or the same user is trying to be root twice here, won't work. |
3588 | // Kill it. | 3618 | // Kill it. |
3589 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | 3619 | m_log.DebugFormat( |
3620 | "[SCENE]: Zombie scene presence detected for {0} {1} in {2}", | ||
3621 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3622 | |||
3590 | sp.ControllingClient.Close(); | 3623 | sp.ControllingClient.Close(); |
3591 | sp = null; | 3624 | sp = null; |
3592 | } | 3625 | } |
@@ -3613,8 +3646,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3613 | { | 3646 | { |
3614 | if (!VerifyUserPresence(agent, out reason)) | 3647 | if (!VerifyUserPresence(agent, out reason)) |
3615 | return false; | 3648 | return false; |
3616 | } | 3649 | } catch (Exception e) |
3617 | catch (Exception e) | ||
3618 | { | 3650 | { |
3619 | m_log.ErrorFormat( | 3651 | m_log.ErrorFormat( |
3620 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3652 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
@@ -3649,8 +3681,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3649 | CapsModule.SetAgentCapsSeeds(agent); | 3681 | CapsModule.SetAgentCapsSeeds(agent); |
3650 | CapsModule.CreateCaps(agent.AgentID); | 3682 | CapsModule.CreateCaps(agent.AgentID); |
3651 | } | 3683 | } |
3652 | } | 3684 | } else |
3653 | else | ||
3654 | { | 3685 | { |
3655 | // Let the SP know how we got here. This has a lot of interesting | 3686 | // Let the SP know how we got here. This has a lot of interesting |
3656 | // uses down the line. | 3687 | // uses down the line. |
@@ -3673,7 +3704,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3673 | agent.teleportFlags = teleportFlags; | 3704 | agent.teleportFlags = teleportFlags; |
3674 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3705 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3675 | 3706 | ||
3676 | if (vialogin) | 3707 | if (vialogin) |
3677 | { | 3708 | { |
3678 | // CleanDroppedAttachments(); | 3709 | // CleanDroppedAttachments(); |
3679 | 3710 | ||
@@ -3714,8 +3745,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3714 | agent.startpos.Z = 720; | 3745 | agent.startpos.Z = 720; |
3715 | } | 3746 | } |
3716 | } | 3747 | } |
3717 | } | 3748 | } else |
3718 | else | ||
3719 | { | 3749 | { |
3720 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) | 3750 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) |
3721 | { | 3751 | { |
@@ -3741,10 +3771,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3741 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 3771 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); |
3742 | // Can have multiple SpawnPoints | 3772 | // Can have multiple SpawnPoints |
3743 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); | 3773 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); |
3744 | if ( spawnpoints.Count > 1) | 3774 | if (spawnpoints.Count > 1) |
3745 | { | 3775 | { |
3746 | // We have multiple SpawnPoints, Route the agent to a random one | 3776 | // We have multiple SpawnPoints, Route the agent to a random or sequential one |
3747 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 3777 | if (SpawnPointRouting == "random") |
3778 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | ||
3779 | telehub.AbsolutePosition, | ||
3780 | telehub.GroupRotation | ||
3781 | ); | ||
3782 | else | ||
3783 | agent.startpos = spawnpoints[SpawnPoint()].GetLocation( | ||
3784 | telehub.AbsolutePosition, | ||
3785 | telehub.GroupRotation | ||
3786 | ); | ||
3748 | } | 3787 | } |
3749 | else | 3788 | else |
3750 | { | 3789 | { |
@@ -3981,41 +4020,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
3981 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); | 4020 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); |
3982 | } | 4021 | } |
3983 | 4022 | ||
3984 | /// <summary> | 4023 | // /// <summary> |
3985 | /// The Grid has requested that we log-off a user. Log them off. | 4024 | // /// The Grid has requested that we log-off a user. Log them off. |
3986 | /// </summary> | 4025 | // /// </summary> |
3987 | /// <param name="AvatarID">Unique ID of the avatar to log-off</param> | 4026 | // /// <param name="AvatarID">Unique ID of the avatar to log-off</param> |
3988 | /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> | 4027 | // /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> |
3989 | /// <param name="message">message to display to the user. Reason for being logged off</param> | 4028 | // /// <param name="message">message to display to the user. Reason for being logged off</param> |
3990 | public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) | 4029 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) |
3991 | { | 4030 | // { |
3992 | ScenePresence loggingOffUser = GetScenePresence(AvatarID); | 4031 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); |
3993 | if (loggingOffUser != null) | 4032 | // if (loggingOffUser != null) |
3994 | { | 4033 | // { |
3995 | UUID localRegionSecret = UUID.Zero; | 4034 | // UUID localRegionSecret = UUID.Zero; |
3996 | bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); | 4035 | // bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); |
3997 | 4036 | // | |
3998 | // Region Secret is used here in case a new sessionid overwrites an old one on the user server. | 4037 | // // Region Secret is used here in case a new sessionid overwrites an old one on the user server. |
3999 | // Will update the user server in a few revisions to use it. | 4038 | // // Will update the user server in a few revisions to use it. |
4000 | 4039 | // | |
4001 | if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) | 4040 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) |
4002 | { | 4041 | // { |
4003 | m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); | 4042 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); |
4004 | loggingOffUser.ControllingClient.Kick(message); | 4043 | // loggingOffUser.ControllingClient.Kick(message); |
4005 | // Give them a second to receive the message! | 4044 | // // Give them a second to receive the message! |
4006 | Thread.Sleep(1000); | 4045 | // Thread.Sleep(1000); |
4007 | loggingOffUser.ControllingClient.Close(); | 4046 | // loggingOffUser.ControllingClient.Close(); |
4008 | } | 4047 | // } |
4009 | else | 4048 | // else |
4010 | { | 4049 | // { |
4011 | m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); | 4050 | // m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); |
4012 | } | 4051 | // } |
4013 | } | 4052 | // } |
4014 | else | 4053 | // else |
4015 | { | 4054 | // { |
4016 | m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); | 4055 | // m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); |
4017 | } | 4056 | // } |
4018 | } | 4057 | // } |
4019 | 4058 | ||
4020 | /// <summary> | 4059 | /// <summary> |
4021 | /// Triggered when an agent crosses into this sim. Also happens on initial login. | 4060 | /// Triggered when an agent crosses into this sim. Also happens on initial login. |
@@ -4068,21 +4107,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4068 | return false; | 4107 | return false; |
4069 | } | 4108 | } |
4070 | 4109 | ||
4110 | // TODO: This check should probably be in QueryAccess(). | ||
4071 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4111 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4072 | if (nearestParcel == null) | 4112 | if (nearestParcel == null) |
4073 | { | 4113 | { |
4074 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: no allowed parcel", cAgentData.AgentID); | 4114 | m_log.DebugFormat( |
4075 | return false; | 4115 | "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", |
4076 | } | 4116 | cAgentData.AgentID, RegionInfo.RegionName); |
4077 | |||
4078 | int num = m_sceneGraph.GetNumberOfScenePresences(); | ||
4079 | 4117 | ||
4080 | if (num >= RegionInfo.RegionSettings.AgentLimit) | 4118 | return false; |
4081 | { | ||
4082 | if (!Permissions.IsAdministrator(cAgentData.AgentID)) | ||
4083 | return false; | ||
4084 | } | 4119 | } |
4085 | 4120 | ||
4121 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4122 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4086 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 4123 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
4087 | 4124 | ||
4088 | if (childAgentUpdate != null) | 4125 | if (childAgentUpdate != null) |
@@ -4126,14 +4163,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4126 | return false; | 4163 | return false; |
4127 | } | 4164 | } |
4128 | 4165 | ||
4166 | /// <summary> | ||
4167 | /// Poll until the requested ScenePresence appears or we timeout. | ||
4168 | /// </summary> | ||
4169 | /// <returns>The scene presence is found, else null.</returns> | ||
4170 | /// <param name='agentID'></param> | ||
4129 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4171 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4130 | { | 4172 | { |
4131 | int ntimes = 10; | 4173 | int ntimes = 10; |
4132 | ScenePresence childAgentUpdate = null; | 4174 | ScenePresence sp = null; |
4133 | while ((childAgentUpdate = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4175 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4134 | Thread.Sleep(1000); | 4176 | Thread.Sleep(1000); |
4135 | return childAgentUpdate; | ||
4136 | 4177 | ||
4178 | if (sp == null) | ||
4179 | m_log.WarnFormat( | ||
4180 | "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", | ||
4181 | agentID, RegionInfo.RegionName); | ||
4182 | // else | ||
4183 | // m_log.DebugFormat( | ||
4184 | // "[SCENE PRESENCE]: Found presence {0} {1} {2} in {3} after {4} waits", | ||
4185 | // sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 10 - ntimes); | ||
4186 | |||
4187 | return sp; | ||
4137 | } | 4188 | } |
4138 | 4189 | ||
4139 | public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent) | 4190 | public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent) |
@@ -4171,33 +4222,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4171 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4222 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4172 | if (presence != null) | 4223 | if (presence != null) |
4173 | { | 4224 | { |
4174 | // Nothing is removed here, so down count it as such | 4225 | presence.ControllingClient.Close(); |
4175 | if (presence.IsChildAgent) | ||
4176 | { | ||
4177 | m_sceneGraph.removeUserCount(false); | ||
4178 | } | ||
4179 | else if (!childOnly) | ||
4180 | { | ||
4181 | m_sceneGraph.removeUserCount(true); | ||
4182 | } | ||
4183 | |||
4184 | // Don't do this to root agents on logout, it's not nice for the viewer | ||
4185 | if (presence.IsChildAgent) | ||
4186 | { | ||
4187 | // Tell a single agent to disconnect from the region. | ||
4188 | IEventQueue eq = RequestModuleInterface<IEventQueue>(); | ||
4189 | if (eq != null) | ||
4190 | { | ||
4191 | eq.DisableSimulator(RegionInfo.RegionHandle, agentID); | ||
4192 | } | ||
4193 | else | ||
4194 | presence.ControllingClient.SendShutdownConnectionNotice(); | ||
4195 | presence.ControllingClient.Close(false); | ||
4196 | } | ||
4197 | else if (!childOnly) | ||
4198 | { | ||
4199 | presence.ControllingClient.Close(true); | ||
4200 | } | ||
4201 | return true; | 4226 | return true; |
4202 | } | 4227 | } |
4203 | 4228 | ||
@@ -4283,8 +4308,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4283 | position.Y -= shifty; | 4308 | position.Y -= shifty; |
4284 | } | 4309 | } |
4285 | 4310 | ||
4286 | if (m_teleportModule != null) | 4311 | if (EntityTransferModule != null) |
4287 | m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); | 4312 | { |
4313 | EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); | ||
4314 | } | ||
4288 | else | 4315 | else |
4289 | { | 4316 | { |
4290 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); | 4317 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); |
@@ -4295,8 +4322,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4295 | 4322 | ||
4296 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 4323 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
4297 | { | 4324 | { |
4298 | if (m_teleportModule != null) | 4325 | if (EntityTransferModule != null) |
4299 | return m_teleportModule.Cross(agent, isFlying); | 4326 | { |
4327 | return EntityTransferModule.Cross(agent, isFlying); | ||
4328 | } | ||
4300 | else | 4329 | else |
4301 | { | 4330 | { |
4302 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | 4331 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); |
@@ -5444,29 +5473,58 @@ Environment.Exit(1); | |||
5444 | throw new Exception(error); | 5473 | throw new Exception(error); |
5445 | } | 5474 | } |
5446 | 5475 | ||
5447 | // This method is called across the simulation connector to | 5476 | /// <summary> |
5448 | // determine if a given agent is allowed in this region | 5477 | /// This method is called across the simulation connector to |
5449 | // AS A ROOT AGENT. Returning false here will prevent them | 5478 | /// determine if a given agent is allowed in this region |
5450 | // from logging into the region, teleporting into the region | 5479 | /// AS A ROOT AGENT |
5451 | // or corssing the broder walking, but will NOT prevent | 5480 | /// </summary> |
5452 | // child agent creation, thereby emulating the SL behavior. | 5481 | /// <remarks> |
5482 | /// Returning false here will prevent them | ||
5483 | /// from logging into the region, teleporting into the region | ||
5484 | /// or corssing the broder walking, but will NOT prevent | ||
5485 | /// child agent creation, thereby emulating the SL behavior. | ||
5486 | /// </remarks> | ||
5487 | /// <param name='agentID'></param> | ||
5488 | /// <param name='position'></param> | ||
5489 | /// <param name='reason'></param> | ||
5490 | /// <returns></returns> | ||
5453 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5491 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5454 | { | 5492 | { |
5455 | reason = "You are banned from the region"; | 5493 | reason = "You are banned from the region"; |
5456 | 5494 | ||
5495 | if (EntityTransferModule.IsInTransit(agentID)) | ||
5496 | { | ||
5497 | reason = "Agent is still in transit from this region"; | ||
5498 | |||
5499 | m_log.WarnFormat( | ||
5500 | "[SCENE]: Denying agent {0} entry into {1} since region still has them registered as in transit", | ||
5501 | agentID, RegionInfo.RegionName); | ||
5502 | |||
5503 | return false; | ||
5504 | } | ||
5505 | |||
5457 | if (Permissions.IsGod(agentID)) | 5506 | if (Permissions.IsGod(agentID)) |
5458 | { | 5507 | { |
5459 | reason = String.Empty; | 5508 | reason = String.Empty; |
5460 | return true; | 5509 | return true; |
5461 | } | 5510 | } |
5462 | 5511 | ||
5463 | int num = m_sceneGraph.GetNumberOfScenePresences(); | 5512 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5513 | // However, the long term fix is to make sure root agent count is always accurate. | ||
5514 | m_sceneGraph.RecalculateStats(); | ||
5515 | |||
5516 | int num = m_sceneGraph.GetRootAgentCount(); | ||
5464 | 5517 | ||
5465 | if (num >= RegionInfo.RegionSettings.AgentLimit) | 5518 | if (num >= RegionInfo.RegionSettings.AgentLimit) |
5466 | { | 5519 | { |
5467 | if (!Permissions.IsAdministrator(agentID)) | 5520 | if (!Permissions.IsAdministrator(agentID)) |
5468 | { | 5521 | { |
5469 | reason = "The region is full"; | 5522 | reason = "The region is full"; |
5523 | |||
5524 | m_log.DebugFormat( | ||
5525 | "[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}", | ||
5526 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); | ||
5527 | |||
5470 | return false; | 5528 | return false; |
5471 | } | 5529 | } |
5472 | } | 5530 | } |
@@ -5637,5 +5695,19 @@ Environment.Exit(1); | |||
5637 | } | 5695 | } |
5638 | } | 5696 | } |
5639 | } | 5697 | } |
5698 | |||
5699 | // manage and select spawn points in sequence | ||
5700 | public int SpawnPoint() | ||
5701 | { | ||
5702 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; | ||
5703 | |||
5704 | if (spawnpoints == 0) | ||
5705 | return 0; | ||
5706 | |||
5707 | m_SpawnPoint++; | ||
5708 | if (m_SpawnPoint > spawnpoints) | ||
5709 | m_SpawnPoint = 1; | ||
5710 | return m_SpawnPoint - 1; | ||
5711 | } | ||
5640 | } | 5712 | } |
5641 | } | 5713 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index b806d91..c1414ee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -84,16 +84,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
84 | if (neighbourService != null) | 84 | if (neighbourService != null) |
85 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); | 85 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); |
86 | else | 86 | else |
87 | m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region"); | 87 | m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: No neighbour service provided for informing neigbhours of this region"); |
88 | 88 | ||
89 | if (neighbour != null) | 89 | if (neighbour != null) |
90 | { | 90 | { |
91 | // m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize); | 91 | m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize); |
92 | m_scene.EventManager.TriggerOnRegionUp(neighbour); | 92 | m_scene.EventManager.TriggerOnRegionUp(neighbour); |
93 | } | 93 | } |
94 | else | 94 | else |
95 | { | 95 | { |
96 | m_log.InfoFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize); | 96 | m_log.InfoFormat("[SCENE COMMUNICATION SERVICE]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); | 102 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); |
103 | 103 | ||
104 | List<GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); | 104 | List<GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); |
105 | //m_log.DebugFormat("[INTERGRID]: Informing {0} neighbours that this region is up", neighbours.Count); | 105 | m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that this region is up", neighbours.Count); |
106 | foreach (GridRegion n in neighbours) | 106 | foreach (GridRegion n in neighbours) |
107 | { | 107 | { |
108 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | 108 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; |
@@ -156,7 +156,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // that the region position is cached or performance will degrade | 156 | // that the region position is cached or performance will degrade |
157 | Utils.LongToUInts(regionHandle, out x, out y); | 157 | Utils.LongToUInts(regionHandle, out x, out y); |
158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | 158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
159 | // bool v = true; | 159 | if (dest == null) |
160 | continue; | ||
161 | |||
160 | if (!simulatorList.Contains(dest.ServerURI)) | 162 | if (!simulatorList.Contains(dest.ServerURI)) |
161 | { | 163 | { |
162 | // we havent seen this simulator before, add it to the list | 164 | // we havent seen this simulator before, add it to the list |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b7466be..4c12496 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -101,6 +101,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | /// </summary> | 101 | /// </summary> |
102 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); | 102 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); |
103 | 103 | ||
104 | /// <summary> | ||
105 | /// Lock to prevent object group update, linking, delinking and duplication operations from running concurrently. | ||
106 | /// </summary> | ||
107 | /// <remarks> | ||
108 | /// These operations rely on the parts composition of the object. If allowed to run concurrently then race | ||
109 | /// conditions can occur. | ||
110 | /// </remarks> | ||
104 | private Object m_updateLock = new Object(); | 111 | private Object m_updateLock = new Object(); |
105 | 112 | ||
106 | #endregion | 113 | #endregion |
@@ -775,12 +782,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
775 | 782 | ||
776 | public int GetChildAgentCount() | 783 | public int GetChildAgentCount() |
777 | { | 784 | { |
778 | // some network situations come in where child agents get closed twice. | ||
779 | if (m_numChildAgents < 0) | ||
780 | { | ||
781 | m_numChildAgents = 0; | ||
782 | } | ||
783 | |||
784 | return m_numChildAgents; | 785 | return m_numChildAgents; |
785 | } | 786 | } |
786 | 787 | ||
@@ -852,11 +853,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
852 | return m_scenePresenceArray; | 853 | return m_scenePresenceArray; |
853 | } | 854 | } |
854 | 855 | ||
855 | public int GetNumberOfScenePresences() | ||
856 | { | ||
857 | return m_scenePresenceArray.Count; | ||
858 | } | ||
859 | |||
860 | /// <summary> | 856 | /// <summary> |
861 | /// Request a scene presence by UUID. Fast, indexed lookup. | 857 | /// Request a scene presence by UUID. Fast, indexed lookup. |
862 | /// </summary> | 858 | /// </summary> |
@@ -2063,12 +2059,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2063 | /// <param name="AgentID"></param> | 2059 | /// <param name="AgentID"></param> |
2064 | /// <param name="GroupID"></param> | 2060 | /// <param name="GroupID"></param> |
2065 | /// <param name="rot"></param> | 2061 | /// <param name="rot"></param> |
2062 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> | ||
2063 | /// <summary> | ||
2066 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 2064 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) |
2067 | { | 2065 | { |
2068 | // m_log.DebugFormat( | 2066 | // m_log.DebugFormat( |
2069 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | 2067 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", |
2070 | // originalPrimID, offset, AgentID); | 2068 | // originalPrimID, offset, AgentID); |
2071 | 2069 | ||
2072 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 2070 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
2073 | if (original != null) | 2071 | if (original != null) |
2074 | { | 2072 | { |
@@ -2098,25 +2096,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2098 | 2096 | ||
2099 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() | 2097 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() |
2100 | Entities.Add(copy); | 2098 | Entities.Add(copy); |
2101 | 2099 | ||
2102 | lock (SceneObjectGroupsByFullID) | 2100 | lock (SceneObjectGroupsByFullID) |
2103 | SceneObjectGroupsByFullID[copy.UUID] = copy; | 2101 | SceneObjectGroupsByFullID[copy.UUID] = copy; |
2104 | 2102 | ||
2105 | SceneObjectPart[] children = copy.Parts; | 2103 | SceneObjectPart[] children = copy.Parts; |
2106 | 2104 | ||
2107 | lock (SceneObjectGroupsByFullPartID) | 2105 | lock (SceneObjectGroupsByFullPartID) |
2108 | { | 2106 | { |
2109 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | 2107 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; |
2110 | foreach (SceneObjectPart part in children) | 2108 | foreach (SceneObjectPart part in children) |
2111 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | 2109 | SceneObjectGroupsByFullPartID[part.UUID] = copy; |
2112 | } | 2110 | } |
2113 | 2111 | ||
2114 | lock (SceneObjectGroupsByLocalPartID) | 2112 | lock (SceneObjectGroupsByLocalPartID) |
2115 | { | 2113 | { |
2116 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | 2114 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; |
2117 | foreach (SceneObjectPart part in children) | 2115 | foreach (SceneObjectPart part in children) |
2118 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; | 2116 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; |
2119 | } | 2117 | } |
2120 | // PROBABLE END OF FIXME | 2118 | // PROBABLE END OF FIXME |
2121 | 2119 | ||
2122 | // Since we copy from a source group that is in selected | 2120 | // Since we copy from a source group that is in selected |
@@ -2148,11 +2146,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2148 | { | 2146 | { |
2149 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); | 2147 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); |
2150 | } | 2148 | } |
2151 | 2149 | ||
2152 | return null; | 2150 | return null; |
2153 | } | 2151 | } |
2154 | 2152 | ||
2155 | /// <summary> | ||
2156 | /// Calculates the distance between two Vector3s | 2153 | /// Calculates the distance between two Vector3s |
2157 | /// </summary> | 2154 | /// </summary> |
2158 | /// <param name="v1"></param> | 2155 | /// <param name="v1"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index aab6a49..8ed58a6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -244,6 +244,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | /// <summary> | ||
248 | /// If this scene object has an attachment point then indicate whether there is a point where | ||
249 | /// attachments are perceivable by avatars other than the avatar to which this object is attached. | ||
250 | /// </summary> | ||
251 | /// <remarks> | ||
252 | /// HUDs are not perceivable by other avatars. | ||
253 | /// </remarks> | ||
254 | public bool HasPrivateAttachmentPoint | ||
255 | { | ||
256 | get | ||
257 | { | ||
258 | return AttachmentPoint >= (uint)OpenMetaverse.AttachmentPoint.HUDCenter2 | ||
259 | && AttachmentPoint <= (uint)OpenMetaverse.AttachmentPoint.HUDBottomRight; | ||
260 | } | ||
261 | } | ||
262 | |||
247 | public void ClearPartAttachmentData() | 263 | public void ClearPartAttachmentData() |
248 | { | 264 | { |
249 | AttachmentPoint = 0; | 265 | AttachmentPoint = 0; |
@@ -2670,6 +2686,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2670 | /// <summary> | 2686 | /// <summary> |
2671 | /// Link the prims in a given group to this group | 2687 | /// Link the prims in a given group to this group |
2672 | /// </summary> | 2688 | /// </summary> |
2689 | /// <remarks> | ||
2690 | /// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads. | ||
2691 | /// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition. | ||
2692 | /// </remarks> | ||
2673 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> | 2693 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> |
2674 | public void LinkToGroup(SceneObjectGroup objectGroup) | 2694 | public void LinkToGroup(SceneObjectGroup objectGroup) |
2675 | { | 2695 | { |
@@ -2751,6 +2771,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2751 | } | 2771 | } |
2752 | 2772 | ||
2753 | linkPart.LinkNum = linkNum++; | 2773 | linkPart.LinkNum = linkNum++; |
2774 | linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); | ||
2754 | 2775 | ||
2755 | SceneObjectPart[] ogParts = objectGroup.Parts; | 2776 | SceneObjectPart[] ogParts = objectGroup.Parts; |
2756 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) | 2777 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) |
@@ -2802,6 +2823,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2802 | /// Delink the given prim from this group. The delinked prim is established as | 2823 | /// Delink the given prim from this group. The delinked prim is established as |
2803 | /// an independent SceneObjectGroup. | 2824 | /// an independent SceneObjectGroup. |
2804 | /// </summary> | 2825 | /// </summary> |
2826 | /// <remarks> | ||
2827 | /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race | ||
2828 | /// condition. But currently there is no | ||
2829 | /// alternative method that does take a lonk to delink a single prim. | ||
2830 | /// </remarks> | ||
2805 | /// <param name="partID"></param> | 2831 | /// <param name="partID"></param> |
2806 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> | 2832 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> |
2807 | public SceneObjectGroup DelinkFromGroup(uint partID) | 2833 | public SceneObjectGroup DelinkFromGroup(uint partID) |
@@ -2813,6 +2839,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2813 | /// Delink the given prim from this group. The delinked prim is established as | 2839 | /// Delink the given prim from this group. The delinked prim is established as |
2814 | /// an independent SceneObjectGroup. | 2840 | /// an independent SceneObjectGroup. |
2815 | /// </summary> | 2841 | /// </summary> |
2842 | /// <remarks> | ||
2843 | /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race | ||
2844 | /// condition. But currently there is no | ||
2845 | /// alternative method that does take a lonk to delink a single prim. | ||
2846 | /// </remarks> | ||
2816 | /// <param name="partID"></param> | 2847 | /// <param name="partID"></param> |
2817 | /// <param name="sendEvents"></param> | 2848 | /// <param name="sendEvents"></param> |
2818 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> | 2849 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> |
@@ -2838,6 +2869,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2838 | /// Delink the given prim from this group. The delinked prim is established as | 2869 | /// Delink the given prim from this group. The delinked prim is established as |
2839 | /// an independent SceneObjectGroup. | 2870 | /// an independent SceneObjectGroup. |
2840 | /// </summary> | 2871 | /// </summary> |
2872 | /// <remarks> | ||
2873 | /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race | ||
2874 | /// condition. But currently there is no | ||
2875 | /// alternative method that does take a lonk to delink a single prim. | ||
2876 | /// </remarks> | ||
2841 | /// <param name="partID"></param> | 2877 | /// <param name="partID"></param> |
2842 | /// <param name="sendEvents"></param> | 2878 | /// <param name="sendEvents"></param> |
2843 | /// <returns>The object group of the newly delinked prim.</returns> | 2879 | /// <returns>The object group of the newly delinked prim.</returns> |
@@ -2971,6 +3007,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2971 | oldRot = part.RotationOffset; | 3007 | oldRot = part.RotationOffset; |
2972 | Quaternion newRot = Quaternion.Conjugate(parentRot) * worldRot; | 3008 | Quaternion newRot = Quaternion.Conjugate(parentRot) * worldRot; |
2973 | part.RotationOffset = newRot; | 3009 | part.RotationOffset = newRot; |
3010 | |||
3011 | part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); | ||
2974 | } | 3012 | } |
2975 | 3013 | ||
2976 | /// <summary> | 3014 | /// <summary> |
@@ -3486,7 +3524,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3486 | 3524 | ||
3487 | //we need to do a terse update even if the move wasn't allowed | 3525 | //we need to do a terse update even if the move wasn't allowed |
3488 | // so that the position is reset in the client (the object snaps back) | 3526 | // so that the position is reset in the client (the object snaps back) |
3489 | ScheduleGroupForTerseUpdate(); | 3527 | RootPart.ScheduleTerseUpdate(); |
3490 | } | 3528 | } |
3491 | 3529 | ||
3492 | /// <summary> | 3530 | /// <summary> |
@@ -4187,7 +4225,72 @@ namespace OpenSim.Region.Framework.Scenes | |||
4187 | for (int i = 0; i < parts.Length; i++) | 4225 | for (int i = 0; i < parts.Length; i++) |
4188 | parts[i].TriggerScriptChangedEvent(val); | 4226 | parts[i].TriggerScriptChangedEvent(val); |
4189 | } | 4227 | } |
4190 | 4228 | ||
4229 | /// <summary> | ||
4230 | /// Returns a count of the number of scripts in this groups parts. | ||
4231 | /// </summary> | ||
4232 | public int ScriptCount() | ||
4233 | { | ||
4234 | int count = 0; | ||
4235 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4236 | for (int i = 0; i < parts.Length; i++) | ||
4237 | count += parts[i].Inventory.ScriptCount(); | ||
4238 | |||
4239 | return count; | ||
4240 | } | ||
4241 | |||
4242 | /// <summary> | ||
4243 | /// A float the value is a representative execution time in milliseconds of all scripts in the link set. | ||
4244 | /// </summary> | ||
4245 | public float ScriptExecutionTime() | ||
4246 | { | ||
4247 | IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>(); | ||
4248 | |||
4249 | if (engines.Length == 0) // No engine at all | ||
4250 | return 0.0f; | ||
4251 | |||
4252 | float time = 0.0f; | ||
4253 | |||
4254 | // get all the scripts in all parts | ||
4255 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4256 | List<TaskInventoryItem> scripts = new List<TaskInventoryItem>(); | ||
4257 | for (int i = 0; i < parts.Length; i++) | ||
4258 | { | ||
4259 | scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); | ||
4260 | } | ||
4261 | // extract the UUIDs | ||
4262 | List<UUID> ids = new List<UUID>(scripts.Count); | ||
4263 | foreach (TaskInventoryItem script in scripts) | ||
4264 | { | ||
4265 | if (!ids.Contains(script.ItemID)) | ||
4266 | { | ||
4267 | ids.Add(script.ItemID); | ||
4268 | } | ||
4269 | } | ||
4270 | // Offer the list of script UUIDs to each engine found and accumulate the time | ||
4271 | foreach (IScriptModule e in engines) | ||
4272 | { | ||
4273 | if (e != null) | ||
4274 | { | ||
4275 | time += e.GetScriptExecutionTime(ids); | ||
4276 | } | ||
4277 | } | ||
4278 | return time; | ||
4279 | } | ||
4280 | |||
4281 | /// <summary> | ||
4282 | /// Returns a count of the number of running scripts in this groups parts. | ||
4283 | /// </summary> | ||
4284 | public int RunningScriptCount() | ||
4285 | { | ||
4286 | int count = 0; | ||
4287 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4288 | for (int i = 0; i < parts.Length; i++) | ||
4289 | count += parts[i].Inventory.RunningScriptCount(); | ||
4290 | |||
4291 | return count; | ||
4292 | } | ||
4293 | |||
4191 | public override string ToString() | 4294 | public override string ToString() |
4192 | { | 4295 | { |
4193 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 4296 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8e74dc8..c1fe6a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1016,7 +1016,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1016 | public int LinkNum | 1016 | public int LinkNum |
1017 | { | 1017 | { |
1018 | get { return m_linkNum; } | 1018 | get { return m_linkNum; } |
1019 | set { m_linkNum = value; } | 1019 | set |
1020 | { | ||
1021 | // if (ParentGroup != null) | ||
1022 | // { | ||
1023 | // m_log.DebugFormat( | ||
1024 | // "[SCENE OBJECT PART]: Setting linknum of {0}@{1} to {2} from {3}", | ||
1025 | // Name, AbsolutePosition, value, m_linkNum); | ||
1026 | // Util.PrintCallStack(); | ||
1027 | // } | ||
1028 | |||
1029 | m_linkNum = value; | ||
1030 | } | ||
1020 | } | 1031 | } |
1021 | 1032 | ||
1022 | public byte ClickAction | 1033 | public byte ClickAction |
@@ -2153,6 +2164,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2153 | /// <param name="isNew"></param> | 2164 | /// <param name="isNew"></param> |
2154 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 2165 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
2155 | { | 2166 | { |
2167 | if (ParentGroup.Scene == null) | ||
2168 | return; | ||
2169 | |||
2156 | if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) | 2170 | if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) |
2157 | return; | 2171 | return; |
2158 | 2172 | ||
@@ -3111,8 +3125,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3111 | if (ParentGroup.IsDeleted) | 3125 | if (ParentGroup.IsDeleted) |
3112 | return; | 3126 | return; |
3113 | 3127 | ||
3114 | if (ParentGroup.IsAttachment && (ParentGroup.AttachedAvatar != remoteClient.AgentId) && | 3128 | if (ParentGroup.IsAttachment |
3115 | (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38)) | 3129 | && ParentGroup.AttachedAvatar != remoteClient.AgentId |
3130 | && ParentGroup.HasPrivateAttachmentPoint) | ||
3116 | return; | 3131 | return; |
3117 | 3132 | ||
3118 | if (remoteClient.AgentId == OwnerID) | 3133 | if (remoteClient.AgentId == OwnerID) |
@@ -3631,7 +3646,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3631 | hasProfileCut = hasDimple; // is it the same thing? | 3646 | hasProfileCut = hasDimple; // is it the same thing? |
3632 | } | 3647 | } |
3633 | 3648 | ||
3634 | |||
3635 | public void SetGroup(UUID groupID, IClientAPI client) | 3649 | public void SetGroup(UUID groupID, IClientAPI client) |
3636 | { | 3650 | { |
3637 | // Scene.AddNewPrims() calls with client == null so can't use this. | 3651 | // Scene.AddNewPrims() calls with client == null so can't use this. |
@@ -3661,10 +3675,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3661 | 3675 | ||
3662 | public void SetPhysicsAxisRotation() | 3676 | public void SetPhysicsAxisRotation() |
3663 | { | 3677 | { |
3664 | if (PhysActor != null) | 3678 | PhysicsActor pa = PhysActor; |
3679 | |||
3680 | if (pa != null) | ||
3665 | { | 3681 | { |
3666 | PhysActor.LockAngularMotion(RotationAxis); | 3682 | pa.LockAngularMotion(RotationAxis); |
3667 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 3683 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3668 | } | 3684 | } |
3669 | } | 3685 | } |
3670 | 3686 | ||
@@ -4381,7 +4397,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4381 | // For now, we use the NINJA naming scheme for identifying joints. | 4397 | // For now, we use the NINJA naming scheme for identifying joints. |
4382 | // In the future, we can support other joint specification schemes such as a | 4398 | // In the future, we can support other joint specification schemes such as a |
4383 | // custom checkbox in the viewer GUI. | 4399 | // custom checkbox in the viewer GUI. |
4384 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4400 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4385 | { | 4401 | { |
4386 | string hingeString = "hingejoint"; | 4402 | string hingeString = "hingejoint"; |
4387 | return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); | 4403 | return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); |
@@ -4397,7 +4413,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4397 | // For now, we use the NINJA naming scheme for identifying joints. | 4413 | // For now, we use the NINJA naming scheme for identifying joints. |
4398 | // In the future, we can support other joint specification schemes such as a | 4414 | // In the future, we can support other joint specification schemes such as a |
4399 | // custom checkbox in the viewer GUI. | 4415 | // custom checkbox in the viewer GUI. |
4400 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4416 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4401 | { | 4417 | { |
4402 | string ballString = "balljoint"; | 4418 | string ballString = "balljoint"; |
4403 | return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); | 4419 | return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); |
@@ -4413,7 +4429,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4413 | // For now, we use the NINJA naming scheme for identifying joints. | 4429 | // For now, we use the NINJA naming scheme for identifying joints. |
4414 | // In the future, we can support other joint specification schemes such as a | 4430 | // In the future, we can support other joint specification schemes such as a |
4415 | // custom checkbox in the viewer GUI. | 4431 | // custom checkbox in the viewer GUI. |
4416 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4432 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4417 | { | 4433 | { |
4418 | return IsHingeJoint() || IsBallJoint(); | 4434 | return IsHingeJoint() || IsBallJoint(); |
4419 | } | 4435 | } |
@@ -4534,7 +4550,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4534 | } | 4550 | } |
4535 | */ | 4551 | */ |
4536 | } | 4552 | } |
4537 | |||
4538 | else // it already has a physical representation | 4553 | else // it already has a physical representation |
4539 | { | 4554 | { |
4540 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. | 4555 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 959046a..81477e7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -176,16 +176,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
176 | /// <param name="ownerId"></param> | 176 | /// <param name="ownerId"></param> |
177 | public void ChangeInventoryOwner(UUID ownerId) | 177 | public void ChangeInventoryOwner(UUID ownerId) |
178 | { | 178 | { |
179 | m_items.LockItemsForWrite(true); | 179 | List<TaskInventoryItem> items = GetInventoryItems(); |
180 | if (0 == Items.Count) | 180 | |
181 | { | 181 | if (items.Count == 0) |
182 | m_items.LockItemsForWrite(false); | ||
183 | return; | 182 | return; |
184 | } | ||
185 | 183 | ||
184 | m_items.LockItemsForWrite(true); | ||
186 | HasInventoryChanged = true; | 185 | HasInventoryChanged = true; |
187 | m_part.ParentGroup.HasGroupChanged = true; | 186 | m_part.ParentGroup.HasGroupChanged = true; |
188 | List<TaskInventoryItem> items = GetInventoryItems(); | ||
189 | foreach (TaskInventoryItem item in items) | 187 | foreach (TaskInventoryItem item in items) |
190 | { | 188 | { |
191 | if (ownerId != item.OwnerID) | 189 | if (ownerId != item.OwnerID) |
@@ -267,14 +265,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
267 | /// </summary> | 265 | /// </summary> |
268 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 266 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
269 | { | 267 | { |
270 | Items.LockItemsForRead(true); | 268 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
271 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 269 | foreach (TaskInventoryItem item in scripts) |
272 | Items.LockItemsForRead(false); | 270 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
273 | foreach (TaskInventoryItem item in items) | ||
274 | { | ||
275 | if ((int)InventoryType.LSL == item.InvType) | ||
276 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
277 | } | ||
278 | } | 271 | } |
279 | 272 | ||
280 | public ArrayList GetScriptErrors(UUID itemID) | 273 | public ArrayList GetScriptErrors(UUID itemID) |
@@ -305,17 +298,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
305 | /// </param> | 298 | /// </param> |
306 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 299 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
307 | { | 300 | { |
308 | Items.LockItemsForRead(true); | 301 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
309 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 302 | foreach (TaskInventoryItem item in scripts) |
310 | Items.LockItemsForRead(false); | ||
311 | |||
312 | foreach (TaskInventoryItem item in items) | ||
313 | { | 303 | { |
314 | if ((int)InventoryType.LSL == item.InvType) | 304 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
315 | { | 305 | m_part.RemoveScriptEvents(item.ItemID); |
316 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); | ||
317 | m_part.RemoveScriptEvents(item.ItemID); | ||
318 | } | ||
319 | } | 306 | } |
320 | } | 307 | } |
321 | 308 | ||
@@ -770,14 +757,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
770 | return item; | 757 | return item; |
771 | } | 758 | } |
772 | 759 | ||
773 | /// <summary> | 760 | public TaskInventoryItem GetInventoryItem(string name) |
774 | /// Get inventory items by name. | 761 | { |
775 | /// </summary> | 762 | m_items.LockItemsForRead(true); |
776 | /// <param name="name"></param> | 763 | foreach (TaskInventoryItem item in m_items.Values) |
777 | /// <returns> | 764 | { |
778 | /// A list of inventory items with that name. | 765 | if (item.Name == name) |
779 | /// If no inventory item has that name then an empty list is returned. | 766 | { |
780 | /// </returns> | 767 | m_items.LockItemsForRead(false); |
768 | return item; | ||
769 | } | ||
770 | } | ||
771 | m_items.LockItemsForRead(false); | ||
772 | |||
773 | return null; | ||
774 | } | ||
775 | |||
781 | public List<TaskInventoryItem> GetInventoryItems(string name) | 776 | public List<TaskInventoryItem> GetInventoryItems(string name) |
782 | { | 777 | { |
783 | List<TaskInventoryItem> items = new List<TaskInventoryItem>(); | 778 | List<TaskInventoryItem> items = new List<TaskInventoryItem>(); |
@@ -1247,10 +1242,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1247 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 1242 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) |
1248 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 1243 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; |
1249 | } | 1244 | } |
1250 | item.OwnerChanged = true; | ||
1251 | item.CurrentPermissions &= item.NextPermissions; | 1245 | item.CurrentPermissions &= item.NextPermissions; |
1252 | item.BasePermissions &= item.NextPermissions; | 1246 | item.BasePermissions &= item.NextPermissions; |
1253 | item.EveryonePermissions &= item.NextPermissions; | 1247 | item.EveryonePermissions &= item.NextPermissions; |
1248 | item.OwnerChanged = true; | ||
1254 | item.PermsMask = 0; | 1249 | item.PermsMask = 0; |
1255 | item.PermsGranter = UUID.Zero; | 1250 | item.PermsGranter = UUID.Zero; |
1256 | } | 1251 | } |
@@ -1281,9 +1276,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | return true; | 1276 | return true; |
1282 | } | 1277 | } |
1283 | } | 1278 | } |
1279 | |||
1284 | return false; | 1280 | return false; |
1285 | } | 1281 | } |
1286 | 1282 | ||
1283 | /// <summary> | ||
1284 | /// Returns the count of scripts in this parts inventory. | ||
1285 | /// </summary> | ||
1286 | /// <returns></returns> | ||
1287 | public int ScriptCount() | ||
1288 | { | ||
1289 | int count = 0; | ||
1290 | Items.LockItemsForRead(true); | ||
1291 | foreach (TaskInventoryItem item in m_items.Values) | ||
1292 | { | ||
1293 | if (item.InvType == (int)InventoryType.LSL) | ||
1294 | { | ||
1295 | count++; | ||
1296 | } | ||
1297 | } | ||
1298 | Items.LockItemsForRead(false); | ||
1299 | return count; | ||
1300 | } | ||
1301 | /// <summary> | ||
1302 | /// Returns the count of running scripts in this parts inventory. | ||
1303 | /// </summary> | ||
1304 | /// <returns></returns> | ||
1305 | public int RunningScriptCount() | ||
1306 | { | ||
1307 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
1308 | if (engines.Length == 0) | ||
1309 | return 0; | ||
1310 | |||
1311 | int count = 0; | ||
1312 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | ||
1313 | |||
1314 | foreach (TaskInventoryItem item in scripts) | ||
1315 | { | ||
1316 | foreach (IScriptModule engine in engines) | ||
1317 | { | ||
1318 | if (engine != null) | ||
1319 | { | ||
1320 | if (engine.GetScriptState(item.ItemID)) | ||
1321 | { | ||
1322 | count++; | ||
1323 | } | ||
1324 | } | ||
1325 | } | ||
1326 | } | ||
1327 | return count; | ||
1328 | } | ||
1329 | |||
1287 | public List<UUID> GetInventoryList() | 1330 | public List<UUID> GetInventoryList() |
1288 | { | 1331 | { |
1289 | List<UUID> ret = new List<UUID>(); | 1332 | List<UUID> ret = new List<UUID>(); |
@@ -1298,22 +1341,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1298 | { | 1341 | { |
1299 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | 1342 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); |
1300 | 1343 | ||
1301 | lock (m_items) | 1344 | Items.LockItemsForRead(true); |
1302 | ret = new List<TaskInventoryItem>(m_items.Values); | 1345 | ret = new List<TaskInventoryItem>(m_items.Values); |
1346 | Items.LockItemsForRead(false); | ||
1303 | 1347 | ||
1304 | return ret; | 1348 | return ret; |
1305 | } | 1349 | } |
1306 | 1350 | ||
1307 | public List<TaskInventoryItem> GetInventoryScripts() | 1351 | public List<TaskInventoryItem> GetInventoryItems(InventoryType type) |
1308 | { | 1352 | { |
1309 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | 1353 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); |
1310 | 1354 | ||
1311 | lock (m_items) | 1355 | Items.LockItemsForRead(true); |
1312 | { | 1356 | |
1313 | foreach (TaskInventoryItem item in m_items.Values) | 1357 | foreach (TaskInventoryItem item in m_items.Values) |
1314 | if (item.InvType == (int)InventoryType.LSL) | 1358 | if (item.InvType == (int)type) |
1315 | ret.Add(item); | 1359 | ret.Add(item); |
1316 | } | 1360 | |
1361 | Items.LockItemsForRead(false); | ||
1317 | 1362 | ||
1318 | return ret; | 1363 | return ret; |
1319 | } | 1364 | } |
@@ -1335,35 +1380,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1335 | if (engines.Length == 0) // No engine at all | 1380 | if (engines.Length == 0) // No engine at all |
1336 | return ret; | 1381 | return ret; |
1337 | 1382 | ||
1338 | Items.LockItemsForRead(true); | 1383 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
1339 | foreach (TaskInventoryItem item in m_items.Values) | 1384 | |
1385 | foreach (TaskInventoryItem item in scripts) | ||
1340 | { | 1386 | { |
1341 | if (item.InvType == (int)InventoryType.LSL) | 1387 | foreach (IScriptModule e in engines) |
1342 | { | 1388 | { |
1343 | foreach (IScriptModule e in engines) | 1389 | if (e != null) |
1344 | { | 1390 | { |
1345 | if (e != null) | 1391 | string n = e.GetXMLState(item.ItemID); |
1392 | if (n != String.Empty) | ||
1346 | { | 1393 | { |
1347 | string n = e.GetXMLState(item.ItemID); | 1394 | if (oldIDs) |
1348 | if (n != String.Empty) | 1395 | { |
1396 | if (!ret.ContainsKey(item.OldItemID)) | ||
1397 | ret[item.OldItemID] = n; | ||
1398 | } | ||
1399 | else | ||
1349 | { | 1400 | { |
1350 | if (oldIDs) | 1401 | if (!ret.ContainsKey(item.ItemID)) |
1351 | { | 1402 | ret[item.ItemID] = n; |
1352 | if (!ret.ContainsKey(item.OldItemID)) | ||
1353 | ret[item.OldItemID] = n; | ||
1354 | } | ||
1355 | else | ||
1356 | { | ||
1357 | if (!ret.ContainsKey(item.ItemID)) | ||
1358 | ret[item.ItemID] = n; | ||
1359 | } | ||
1360 | break; | ||
1361 | } | 1403 | } |
1404 | break; | ||
1362 | } | 1405 | } |
1363 | } | 1406 | } |
1364 | } | 1407 | } |
1365 | } | 1408 | } |
1366 | Items.LockItemsForRead(false); | ||
1367 | return ret; | 1409 | return ret; |
1368 | } | 1410 | } |
1369 | 1411 | ||
@@ -1373,27 +1415,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1373 | if (engines.Length == 0) | 1415 | if (engines.Length == 0) |
1374 | return; | 1416 | return; |
1375 | 1417 | ||
1418 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | ||
1376 | 1419 | ||
1377 | Items.LockItemsForRead(true); | 1420 | foreach (TaskInventoryItem item in scripts) |
1378 | |||
1379 | foreach (TaskInventoryItem item in m_items.Values) | ||
1380 | { | 1421 | { |
1381 | if (item.InvType == (int)InventoryType.LSL) | 1422 | foreach (IScriptModule engine in engines) |
1382 | { | 1423 | { |
1383 | foreach (IScriptModule engine in engines) | 1424 | if (engine != null) |
1384 | { | 1425 | { |
1385 | if (engine != null) | 1426 | // m_log.DebugFormat( |
1386 | { | 1427 | // "[PRIM INVENTORY]: Resuming script {0} {1} for {2}, OwnerChanged {3}", |
1387 | if (item.OwnerChanged) | 1428 | // item.Name, item.ItemID, item.OwnerID, item.OwnerChanged); |
1388 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | 1429 | |
1389 | item.OwnerChanged = false; | 1430 | engine.ResumeScript(item.ItemID); |
1390 | engine.ResumeScript(item.ItemID); | 1431 | |
1391 | } | 1432 | if (item.OwnerChanged) |
1433 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | ||
1434 | |||
1435 | item.OwnerChanged = false; | ||
1392 | } | 1436 | } |
1393 | } | 1437 | } |
1394 | } | 1438 | } |
1395 | |||
1396 | Items.LockItemsForRead(false); | ||
1397 | } | 1439 | } |
1398 | } | 1440 | } |
1399 | } | 1441 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 87b4d9f..1fc9790 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -45,6 +45,7 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; | |||
45 | 45 | ||
46 | namespace OpenSim.Region.Framework.Scenes | 46 | namespace OpenSim.Region.Framework.Scenes |
47 | { | 47 | { |
48 | [Flags] | ||
48 | enum ScriptControlled : uint | 49 | enum ScriptControlled : uint |
49 | { | 50 | { |
50 | CONTROL_ZERO = 0, | 51 | CONTROL_ZERO = 0, |
@@ -76,6 +77,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
76 | // { | 77 | // { |
77 | // m_log.Debug("[SCENE PRESENCE] Destructor called"); | 78 | // m_log.Debug("[SCENE PRESENCE] Destructor called"); |
78 | // } | 79 | // } |
80 | private void TriggerScenePresenceUpdated() | ||
81 | { | ||
82 | if (m_scene != null) | ||
83 | m_scene.EventManager.TriggerScenePresenceUpdated(this); | ||
84 | } | ||
79 | 85 | ||
80 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 86 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
81 | 87 | ||
@@ -497,6 +503,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
497 | //m_log.DebugFormat( | 503 | //m_log.DebugFormat( |
498 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", | 504 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", |
499 | // Scene.RegionInfo.RegionName, Name, m_pos); | 505 | // Scene.RegionInfo.RegionName, Name, m_pos); |
506 | TriggerScenePresenceUpdated(); | ||
500 | } | 507 | } |
501 | } | 508 | } |
502 | 509 | ||
@@ -516,6 +523,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
516 | return; | 523 | return; |
517 | 524 | ||
518 | m_pos = value; | 525 | m_pos = value; |
526 | TriggerScenePresenceUpdated(); | ||
519 | } | 527 | } |
520 | } | 528 | } |
521 | 529 | ||
@@ -1086,23 +1094,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1086 | /// <param name="pos"></param> | 1094 | /// <param name="pos"></param> |
1087 | public void Teleport(Vector3 pos) | 1095 | public void Teleport(Vector3 pos) |
1088 | { | 1096 | { |
1089 | bool isFlying = Flying; | 1097 | TeleportWithMomentum(pos, Vector3.Zero); |
1090 | RemoveFromPhysicalScene(); | ||
1091 | Velocity = Vector3.Zero; | ||
1092 | CheckLandingPoint(ref pos); | ||
1093 | AbsolutePosition = pos; | ||
1094 | AddToPhysicalScene(isFlying); | ||
1095 | |||
1096 | SendTerseUpdateToAllClients(); | ||
1097 | } | ||
1098 | |||
1099 | public void TeleportWithMomentum(Vector3 pos) | ||
1100 | { | ||
1101 | TeleportWithMomentum(pos, null); | ||
1102 | } | 1098 | } |
1103 | 1099 | ||
1104 | public void TeleportWithMomentum(Vector3 pos, Vector3? v) | 1100 | public void TeleportWithMomentum(Vector3 pos, Vector3? v) |
1105 | { | 1101 | { |
1102 | if (ParentID != (uint)0) | ||
1103 | StandUp(); | ||
1106 | bool isFlying = Flying; | 1104 | bool isFlying = Flying; |
1107 | Vector3 vel = Velocity; | 1105 | Vector3 vel = Velocity; |
1108 | RemoveFromPhysicalScene(); | 1106 | RemoveFromPhysicalScene(); |
@@ -1282,17 +1280,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1282 | 1280 | ||
1283 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1281 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1284 | MakeRootAgent(AbsolutePosition, flying); | 1282 | MakeRootAgent(AbsolutePosition, flying); |
1283 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
1284 | |||
1285 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | ||
1285 | 1286 | ||
1286 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1287 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1287 | { | 1288 | { |
1288 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | 1289 | // We cannot sleep here since this would hold up the inbound packet processing thread, as |
1290 | // CompleteMovement() is executed synchronously. However, it might be better to delay the release | ||
1291 | // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete | ||
1292 | // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this | ||
1293 | // region as the current region, meaning that a close sent before then will fail the teleport. | ||
1294 | // System.Threading.Thread.Sleep(2000); | ||
1295 | |||
1296 | m_log.DebugFormat( | ||
1297 | "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", | ||
1298 | client.Name, client.AgentId, m_callbackURI); | ||
1299 | |||
1289 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); | 1300 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); |
1290 | m_callbackURI = null; | 1301 | m_callbackURI = null; |
1291 | } | 1302 | } |
1303 | // else | ||
1304 | // { | ||
1305 | // m_log.DebugFormat( | ||
1306 | // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", | ||
1307 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); | ||
1308 | // } | ||
1292 | 1309 | ||
1293 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | ||
1294 | |||
1295 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
1296 | ValidateAndSendAppearanceAndAgentData(); | 1310 | ValidateAndSendAppearanceAndAgentData(); |
1297 | 1311 | ||
1298 | // Create child agents in neighbouring regions | 1312 | // Create child agents in neighbouring regions |
@@ -1307,7 +1321,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1307 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1321 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1308 | } | 1322 | } |
1309 | 1323 | ||
1310 | |||
1311 | // m_log.DebugFormat( | 1324 | // m_log.DebugFormat( |
1312 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", | 1325 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", |
1313 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); | 1326 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); |
@@ -1360,7 +1373,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1360 | { | 1373 | { |
1361 | // m_log.DebugFormat( | 1374 | // m_log.DebugFormat( |
1362 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", | 1375 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", |
1363 | // Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); | 1376 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
1364 | 1377 | ||
1365 | if (IsChildAgent) | 1378 | if (IsChildAgent) |
1366 | { | 1379 | { |
@@ -1470,14 +1483,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1470 | } | 1483 | } |
1471 | } | 1484 | } |
1472 | 1485 | ||
1473 | lock (scriptedcontrols) | 1486 | uint flagsForScripts = (uint)flags; |
1474 | { | 1487 | flags = RemoveIgnoredControls(flags, IgnoredControls); |
1475 | if (scriptedcontrols.Count > 0) | ||
1476 | { | ||
1477 | SendControlToScripts((uint)flags); | ||
1478 | flags = RemoveIgnoredControls(flags, IgnoredControls); | ||
1479 | } | ||
1480 | } | ||
1481 | 1488 | ||
1482 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) | 1489 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) |
1483 | HandleAgentSitOnGround(); | 1490 | HandleAgentSitOnGround(); |
@@ -1491,6 +1498,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1491 | PhysicsActor actor = PhysicsActor; | 1498 | PhysicsActor actor = PhysicsActor; |
1492 | if (actor == null) | 1499 | if (actor == null) |
1493 | { | 1500 | { |
1501 | SendControlsToScripts(flagsForScripts); | ||
1494 | return; | 1502 | return; |
1495 | } | 1503 | } |
1496 | 1504 | ||
@@ -1570,7 +1578,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1570 | MovementFlag |= (byte)nudgehack; | 1578 | MovementFlag |= (byte)nudgehack; |
1571 | } | 1579 | } |
1572 | 1580 | ||
1573 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); | 1581 | //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); |
1574 | MovementFlag += (byte)(uint)DCF; | 1582 | MovementFlag += (byte)(uint)DCF; |
1575 | update_movementflag = true; | 1583 | update_movementflag = true; |
1576 | } | 1584 | } |
@@ -1583,7 +1591,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1583 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) | 1591 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) |
1584 | ) // This or is for Nudge forward | 1592 | ) // This or is for Nudge forward |
1585 | { | 1593 | { |
1586 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); | 1594 | //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); |
1587 | MovementFlag -= ((byte)(uint)DCF); | 1595 | MovementFlag -= ((byte)(uint)DCF); |
1588 | update_movementflag = true; | 1596 | update_movementflag = true; |
1589 | 1597 | ||
@@ -1664,11 +1672,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1664 | // } | 1672 | // } |
1665 | // } | 1673 | // } |
1666 | 1674 | ||
1667 | // if (update_movementflag && ParentID == 0) | 1675 | if (update_movementflag && ParentID == 0) |
1668 | // Animator.UpdateMovementAnimations(); | 1676 | Animator.UpdateMovementAnimations(); |
1677 | |||
1678 | SendControlsToScripts(flagsForScripts); | ||
1669 | } | 1679 | } |
1670 | 1680 | ||
1671 | m_scene.EventManager.TriggerOnClientMovement(this); | 1681 | m_scene.EventManager.TriggerOnClientMovement(this); |
1682 | TriggerScenePresenceUpdated(); | ||
1672 | } | 1683 | } |
1673 | 1684 | ||
1674 | /// <summary> | 1685 | /// <summary> |
@@ -2042,9 +2053,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2042 | { | 2053 | { |
2043 | if (SitTargetUnOccupied) | 2054 | if (SitTargetUnOccupied) |
2044 | { | 2055 | { |
2045 | m_log.DebugFormat( | 2056 | // m_log.DebugFormat( |
2046 | "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", | 2057 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", |
2047 | Name, part.Name, part.LocalId); | 2058 | // Name, part.Name, part.LocalId); |
2048 | 2059 | ||
2049 | part.SitTargetAvatar = UUID; | 2060 | part.SitTargetAvatar = UUID; |
2050 | offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); | 2061 | offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); |
@@ -2056,9 +2067,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2056 | { | 2067 | { |
2057 | if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) | 2068 | if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) |
2058 | { | 2069 | { |
2059 | m_log.DebugFormat( | 2070 | // m_log.DebugFormat( |
2060 | "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", | 2071 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", |
2061 | Name, part.Name, part.LocalId); | 2072 | // Name, part.Name, part.LocalId); |
2062 | 2073 | ||
2063 | AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); | 2074 | AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); |
2064 | canSit = true; | 2075 | canSit = true; |
@@ -2614,6 +2625,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2614 | 2625 | ||
2615 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2626 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2616 | } | 2627 | } |
2628 | TriggerScenePresenceUpdated(); | ||
2617 | } | 2629 | } |
2618 | 2630 | ||
2619 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2631 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
@@ -2692,7 +2704,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2692 | // If we are using the the cached appearance then send it out to everyone | 2704 | // If we are using the the cached appearance then send it out to everyone |
2693 | if (cachedappearance) | 2705 | if (cachedappearance) |
2694 | { | 2706 | { |
2695 | m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); | 2707 | m_log.DebugFormat("[SCENE PRESENCE]: baked textures are in the cache for {0}", Name); |
2696 | 2708 | ||
2697 | // If the avatars baked textures are all in the cache, then we have a | 2709 | // If the avatars baked textures are all in the cache, then we have a |
2698 | // complete appearance... send it out, if not, then we'll send it when | 2710 | // complete appearance... send it out, if not, then we'll send it when |
@@ -3097,8 +3109,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3097 | x = x / Constants.RegionSize; | 3109 | x = x / Constants.RegionSize; |
3098 | y = y / Constants.RegionSize; | 3110 | y = y / Constants.RegionSize; |
3099 | 3111 | ||
3100 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3112 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3101 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3113 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |
3102 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) | 3114 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) |
3103 | { | 3115 | { |
3104 | byebyeRegions.Add(handle); | 3116 | byebyeRegions.Add(handle); |
@@ -3155,7 +3167,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3155 | 3167 | ||
3156 | public void ChildAgentDataUpdate(AgentData cAgentData) | 3168 | public void ChildAgentDataUpdate(AgentData cAgentData) |
3157 | { | 3169 | { |
3158 | //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); | 3170 | // m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); |
3159 | if (!IsChildAgent) | 3171 | if (!IsChildAgent) |
3160 | return; | 3172 | return; |
3161 | 3173 | ||
@@ -3299,6 +3311,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3299 | m_originRegionID = cAgent.RegionID; | 3311 | m_originRegionID = cAgent.RegionID; |
3300 | 3312 | ||
3301 | m_callbackURI = cAgent.CallbackURI; | 3313 | m_callbackURI = cAgent.CallbackURI; |
3314 | // m_log.DebugFormat( | ||
3315 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", | ||
3316 | // Name, m_scene.RegionInfo.RegionName, m_callbackURI); | ||
3302 | 3317 | ||
3303 | m_pos = cAgent.Position; | 3318 | m_pos = cAgent.Position; |
3304 | m_velocity = cAgent.Velocity; | 3319 | m_velocity = cAgent.Velocity; |
@@ -3400,6 +3415,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3400 | Velocity = force; | 3415 | Velocity = force; |
3401 | 3416 | ||
3402 | m_forceToApply = null; | 3417 | m_forceToApply = null; |
3418 | TriggerScenePresenceUpdated(); | ||
3403 | } | 3419 | } |
3404 | } | 3420 | } |
3405 | 3421 | ||
@@ -3507,23 +3523,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
3507 | 3523 | ||
3508 | RaiseCollisionScriptEvents(coldata); | 3524 | RaiseCollisionScriptEvents(coldata); |
3509 | 3525 | ||
3510 | if (Invulnerable || GodLevel >= 200) | 3526 | // Gods do not take damage and Invulnerable is set depending on parcel/region flags |
3527 | if (Invulnerable || GodLevel > 0) | ||
3511 | return; | 3528 | return; |
3512 | 3529 | ||
3530 | // The following may be better in the ICombatModule | ||
3531 | // probably tweaking of the values for ground and normal prim collisions will be needed | ||
3513 | float starthealth = Health; | 3532 | float starthealth = Health; |
3514 | uint killerObj = 0; | 3533 | uint killerObj = 0; |
3534 | SceneObjectPart part = null; | ||
3515 | foreach (uint localid in coldata.Keys) | 3535 | foreach (uint localid in coldata.Keys) |
3516 | { | 3536 | { |
3517 | SceneObjectPart part = Scene.GetSceneObjectPart(localid); | 3537 | if (localid == 0) |
3518 | 3538 | { | |
3519 | if (part != null && part.ParentGroup.Damage != -1.0f) | 3539 | part = null; |
3520 | Health -= part.ParentGroup.Damage; | 3540 | } |
3541 | else | ||
3542 | { | ||
3543 | part = Scene.GetSceneObjectPart(localid); | ||
3544 | } | ||
3545 | if (part != null) | ||
3546 | { | ||
3547 | // Ignore if it has been deleted or volume detect | ||
3548 | if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) | ||
3549 | { | ||
3550 | if (part.ParentGroup.Damage > 0.0f) | ||
3551 | { | ||
3552 | // Something with damage... | ||
3553 | Health -= part.ParentGroup.Damage; | ||
3554 | part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); | ||
3555 | } | ||
3556 | else | ||
3557 | { | ||
3558 | // An ordinary prim | ||
3559 | if (coldata[localid].PenetrationDepth >= 0.10f) | ||
3560 | Health -= coldata[localid].PenetrationDepth * 5.0f; | ||
3561 | } | ||
3562 | } | ||
3563 | } | ||
3521 | else | 3564 | else |
3522 | { | 3565 | { |
3523 | if (coldata[localid].PenetrationDepth >= 0.10f) | 3566 | // 0 is the ground |
3567 | // what about collisions with other avatars? | ||
3568 | if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f) | ||
3524 | Health -= coldata[localid].PenetrationDepth * 5.0f; | 3569 | Health -= coldata[localid].PenetrationDepth * 5.0f; |
3525 | } | 3570 | } |
3526 | 3571 | ||
3572 | |||
3527 | if (Health <= 0.0f) | 3573 | if (Health <= 0.0f) |
3528 | { | 3574 | { |
3529 | if (localid != 0) | 3575 | if (localid != 0) |
@@ -3539,7 +3585,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3539 | ControllingClient.SendHealth(Health); | 3585 | ControllingClient.SendHealth(Health); |
3540 | } | 3586 | } |
3541 | if (Health <= 0) | 3587 | if (Health <= 0) |
3588 | { | ||
3542 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3589 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3590 | } | ||
3591 | if (starthealth == Health && Health < 100.0f) | ||
3592 | { | ||
3593 | Health += 0.03f; | ||
3594 | if (Health > 100.0f) | ||
3595 | Health = 100.0f; | ||
3596 | ControllingClient.SendHealth(Health); | ||
3597 | } | ||
3543 | } | 3598 | } |
3544 | } | 3599 | } |
3545 | 3600 | ||
@@ -3551,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3551 | 3606 | ||
3552 | public void Close() | 3607 | public void Close() |
3553 | { | 3608 | { |
3554 | if (!IsChildAgent) | 3609 | if (!IsChildAgent && m_scene.AttachmentsModule != null) |
3555 | m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false); | 3610 | m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false); |
3556 | 3611 | ||
3557 | // Clear known regions | 3612 | // Clear known regions |
@@ -3621,6 +3676,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
3621 | return m_attachments.Count > 0; | 3676 | return m_attachments.Count > 0; |
3622 | } | 3677 | } |
3623 | 3678 | ||
3679 | /// <summary> | ||
3680 | /// Returns the total count of scripts in all parts inventories. | ||
3681 | /// </summary> | ||
3682 | public int ScriptCount() | ||
3683 | { | ||
3684 | int count = 0; | ||
3685 | lock (m_attachments) | ||
3686 | { | ||
3687 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3688 | { | ||
3689 | if (gobj != null) | ||
3690 | { | ||
3691 | count += gobj.ScriptCount(); | ||
3692 | } | ||
3693 | } | ||
3694 | } | ||
3695 | return count; | ||
3696 | } | ||
3697 | |||
3698 | /// <summary> | ||
3699 | /// A float the value is a representative execution time in milliseconds of all scripts in all attachments. | ||
3700 | /// </summary> | ||
3701 | public float ScriptExecutionTime() | ||
3702 | { | ||
3703 | float time = 0.0f; | ||
3704 | lock (m_attachments) | ||
3705 | { | ||
3706 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3707 | { | ||
3708 | if (gobj != null) | ||
3709 | { | ||
3710 | time += gobj.ScriptExecutionTime(); | ||
3711 | } | ||
3712 | } | ||
3713 | } | ||
3714 | return time; | ||
3715 | } | ||
3716 | |||
3717 | /// <summary> | ||
3718 | /// Returns the total count of running scripts in all parts. | ||
3719 | /// </summary> | ||
3720 | public int RunningScriptCount() | ||
3721 | { | ||
3722 | int count = 0; | ||
3723 | lock (m_attachments) | ||
3724 | { | ||
3725 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3726 | { | ||
3727 | if (gobj != null) | ||
3728 | { | ||
3729 | count += gobj.RunningScriptCount(); | ||
3730 | } | ||
3731 | } | ||
3732 | } | ||
3733 | return count; | ||
3734 | } | ||
3735 | |||
3624 | public bool HasScriptedAttachments() | 3736 | public bool HasScriptedAttachments() |
3625 | { | 3737 | { |
3626 | lock (m_attachments) | 3738 | lock (m_attachments) |
@@ -3838,77 +3950,92 @@ namespace OpenSim.Region.Framework.Scenes | |||
3838 | } | 3950 | } |
3839 | } | 3951 | } |
3840 | 3952 | ||
3841 | internal void SendControlToScripts(uint flags) | 3953 | private void SendControlsToScripts(uint flags) |
3842 | { | 3954 | { |
3843 | ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; | 3955 | // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script |
3844 | 3956 | // (e.g., a walking script) checks which animation is active it will be the correct animation. | |
3845 | if (MouseDown) | 3957 | lock (scriptedcontrols) |
3846 | { | 3958 | { |
3847 | allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); | 3959 | if (scriptedcontrols.Count <= 0) |
3848 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) | 3960 | return; |
3961 | |||
3962 | ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; | ||
3963 | |||
3964 | if (MouseDown) | ||
3849 | { | 3965 | { |
3850 | allflags = ScriptControlled.CONTROL_ZERO; | 3966 | allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); |
3967 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) | ||
3968 | { | ||
3969 | allflags = ScriptControlled.CONTROL_ZERO; | ||
3970 | MouseDown = true; | ||
3971 | } | ||
3972 | } | ||
3973 | |||
3974 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) | ||
3975 | { | ||
3976 | allflags |= ScriptControlled.CONTROL_ML_LBUTTON; | ||
3851 | MouseDown = true; | 3977 | MouseDown = true; |
3852 | } | 3978 | } |
3853 | } | 3979 | |
3980 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) | ||
3981 | { | ||
3982 | allflags |= ScriptControlled.CONTROL_LBUTTON; | ||
3983 | MouseDown = true; | ||
3984 | } | ||
3985 | |||
3986 | // find all activated controls, whether the scripts are interested in them or not | ||
3987 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) | ||
3988 | { | ||
3989 | allflags |= ScriptControlled.CONTROL_FWD; | ||
3990 | } | ||
3991 | |||
3992 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0) | ||
3993 | { | ||
3994 | allflags |= ScriptControlled.CONTROL_BACK; | ||
3995 | } | ||
3996 | |||
3997 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0) | ||
3998 | { | ||
3999 | allflags |= ScriptControlled.CONTROL_UP; | ||
4000 | } | ||
4001 | |||
4002 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0) | ||
4003 | { | ||
4004 | allflags |= ScriptControlled.CONTROL_DOWN; | ||
4005 | } | ||
3854 | 4006 | ||
3855 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) | 4007 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0) |
3856 | { | 4008 | { |
3857 | allflags |= ScriptControlled.CONTROL_ML_LBUTTON; | 4009 | allflags |= ScriptControlled.CONTROL_LEFT; |
3858 | MouseDown = true; | 4010 | } |
3859 | } | 4011 | |
3860 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) | 4012 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0) |
3861 | { | 4013 | { |
3862 | allflags |= ScriptControlled.CONTROL_LBUTTON; | 4014 | allflags |= ScriptControlled.CONTROL_RIGHT; |
3863 | MouseDown = true; | 4015 | } |
3864 | } | 4016 | |
4017 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | ||
4018 | { | ||
4019 | allflags |= ScriptControlled.CONTROL_ROT_RIGHT; | ||
4020 | } | ||
4021 | |||
4022 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0) | ||
4023 | { | ||
4024 | allflags |= ScriptControlled.CONTROL_ROT_LEFT; | ||
4025 | } | ||
3865 | 4026 | ||
3866 | // find all activated controls, whether the scripts are interested in them or not | 4027 | // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that |
3867 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) | 4028 | if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands) |
3868 | { | ||
3869 | allflags |= ScriptControlled.CONTROL_FWD; | ||
3870 | } | ||
3871 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0) | ||
3872 | { | ||
3873 | allflags |= ScriptControlled.CONTROL_BACK; | ||
3874 | } | ||
3875 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0) | ||
3876 | { | ||
3877 | allflags |= ScriptControlled.CONTROL_UP; | ||
3878 | } | ||
3879 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0) | ||
3880 | { | ||
3881 | allflags |= ScriptControlled.CONTROL_DOWN; | ||
3882 | } | ||
3883 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0) | ||
3884 | { | ||
3885 | allflags |= ScriptControlled.CONTROL_LEFT; | ||
3886 | } | ||
3887 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0) | ||
3888 | { | ||
3889 | allflags |= ScriptControlled.CONTROL_RIGHT; | ||
3890 | } | ||
3891 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | ||
3892 | { | ||
3893 | allflags |= ScriptControlled.CONTROL_ROT_RIGHT; | ||
3894 | } | ||
3895 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0) | ||
3896 | { | ||
3897 | allflags |= ScriptControlled.CONTROL_ROT_LEFT; | ||
3898 | } | ||
3899 | // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that | ||
3900 | if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands) | ||
3901 | { | ||
3902 | lock (scriptedcontrols) | ||
3903 | { | 4029 | { |
3904 | foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols) | 4030 | foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols) |
3905 | { | 4031 | { |
3906 | UUID scriptUUID = kvp.Key; | 4032 | UUID scriptUUID = kvp.Key; |
3907 | ScriptControllers scriptControlData = kvp.Value; | 4033 | ScriptControllers scriptControlData = kvp.Value; |
3908 | 4034 | ||
3909 | ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us | 4035 | ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us |
3910 | ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle | 4036 | ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle |
3911 | ScriptControlled localChange = localHeld ^ localLast; // the changed bits | 4037 | ScriptControlled localChange = localHeld ^ localLast; // the changed bits |
4038 | |||
3912 | if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) | 4039 | if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) |
3913 | { | 4040 | { |
3914 | // only send if still pressed or just changed | 4041 | // only send if still pressed or just changed |
@@ -3916,9 +4043,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3916 | } | 4043 | } |
3917 | } | 4044 | } |
3918 | } | 4045 | } |
4046 | |||
4047 | LastCommands = allflags; | ||
3919 | } | 4048 | } |
3920 | |||
3921 | LastCommands = allflags; | ||
3922 | } | 4049 | } |
3923 | 4050 | ||
3924 | internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored) | 4051 | internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored) |
@@ -3998,7 +4125,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3998 | land.LandData.UserLocation != Vector3.Zero && | 4125 | land.LandData.UserLocation != Vector3.Zero && |
3999 | land.LandData.OwnerID != m_uuid && | 4126 | land.LandData.OwnerID != m_uuid && |
4000 | (!m_scene.Permissions.IsGod(m_uuid)) && | 4127 | (!m_scene.Permissions.IsGod(m_uuid)) && |
4001 | (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) | 4128 | (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid))) |
4002 | { | 4129 | { |
4003 | float curr = Vector3.Distance(AbsolutePosition, pos); | 4130 | float curr = Vector3.Distance(AbsolutePosition, pos); |
4004 | if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) | 4131 | if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) |
@@ -4012,13 +4139,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4012 | { | 4139 | { |
4013 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | 4140 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == |
4014 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || | 4141 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || |
4015 | (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || | 4142 | (m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 )) || |
4016 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4143 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4017 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | 4144 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) |
4018 | { | 4145 | { |
4019 | if (GodLevel < 200 && | 4146 | if (GodLevel < 200 && |
4020 | ((!m_scene.Permissions.IsGod(m_uuid) && | 4147 | ((!m_scene.Permissions.IsGod(m_uuid) && |
4021 | !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || | 4148 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
4022 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4149 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4023 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | 4150 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) |
4024 | { | 4151 | { |
@@ -4026,28 +4153,92 @@ namespace OpenSim.Region.Framework.Scenes | |||
4026 | if (spawnPoints.Length == 0) | 4153 | if (spawnPoints.Length == 0) |
4027 | return; | 4154 | return; |
4028 | 4155 | ||
4029 | float distance = 9999; | 4156 | int index; |
4030 | int closest = -1; | 4157 | bool selected = false; |
4031 | 4158 | ||
4032 | for (int i = 0 ; i < spawnPoints.Length ; i++) | 4159 | switch (m_scene.SpawnPointRouting) |
4033 | { | 4160 | { |
4034 | Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4161 | case "random": |
4035 | Vector3 offset = spawnPosition - pos; | ||
4036 | float d = Vector3.Mag(offset); | ||
4037 | if (d >= distance) | ||
4038 | continue; | ||
4039 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4040 | if (land == null) | ||
4041 | continue; | ||
4042 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4043 | continue; | ||
4044 | distance = d; | ||
4045 | closest = i; | ||
4046 | } | ||
4047 | if (closest == -1) | ||
4048 | return; | ||
4049 | 4162 | ||
4050 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4163 | do |
4164 | { | ||
4165 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | ||
4166 | |||
4167 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4168 | telehub.AbsolutePosition, | ||
4169 | telehub.GroupRotation | ||
4170 | ); | ||
4171 | // SpawnPoint sp = spawnPoints[index]; | ||
4172 | |||
4173 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4174 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4175 | selected = false; | ||
4176 | else | ||
4177 | selected = true; | ||
4178 | |||
4179 | } while ( selected == false); | ||
4180 | |||
4181 | pos = spawnPoints[index].GetLocation( | ||
4182 | telehub.AbsolutePosition, | ||
4183 | telehub.GroupRotation | ||
4184 | ); | ||
4185 | return; | ||
4186 | |||
4187 | case "sequence": | ||
4188 | |||
4189 | do | ||
4190 | { | ||
4191 | index = m_scene.SpawnPoint(); | ||
4192 | |||
4193 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4194 | telehub.AbsolutePosition, | ||
4195 | telehub.GroupRotation | ||
4196 | ); | ||
4197 | // SpawnPoint sp = spawnPoints[index]; | ||
4198 | |||
4199 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4200 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4201 | selected = false; | ||
4202 | else | ||
4203 | selected = true; | ||
4204 | |||
4205 | } while (selected == false); | ||
4206 | |||
4207 | pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4208 | ; | ||
4209 | return; | ||
4210 | |||
4211 | default: | ||
4212 | case "closest": | ||
4213 | |||
4214 | float distance = 9999; | ||
4215 | int closest = -1; | ||
4216 | |||
4217 | for (int i = 0; i < spawnPoints.Length; i++) | ||
4218 | { | ||
4219 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
4220 | telehub.AbsolutePosition, | ||
4221 | telehub.GroupRotation | ||
4222 | ); | ||
4223 | Vector3 offset = spawnPosition - pos; | ||
4224 | float d = Vector3.Mag(offset); | ||
4225 | if (d >= distance) | ||
4226 | continue; | ||
4227 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4228 | if (land == null) | ||
4229 | continue; | ||
4230 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4231 | continue; | ||
4232 | distance = d; | ||
4233 | closest = i; | ||
4234 | } | ||
4235 | if (closest == -1) | ||
4236 | return; | ||
4237 | |||
4238 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4239 | return; | ||
4240 | |||
4241 | } | ||
4051 | } | 4242 | } |
4052 | } | 4243 | } |
4053 | } | 4244 | } |
@@ -4092,7 +4283,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4092 | GodLevel < 200 && | 4283 | GodLevel < 200 && |
4093 | ((land.LandData.OwnerID != m_uuid && | 4284 | ((land.LandData.OwnerID != m_uuid && |
4094 | !m_scene.Permissions.IsGod(m_uuid) && | 4285 | !m_scene.Permissions.IsGod(m_uuid) && |
4095 | !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || | 4286 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
4096 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4287 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4097 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | 4288 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) |
4098 | { | 4289 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 55455cc..a4f730d 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -47,14 +47,30 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
47 | /// </remarks> | 47 | /// </remarks> |
48 | public class CoalescedSceneObjectsSerializer | 48 | public class CoalescedSceneObjectsSerializer |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// Serialize coalesced objects to Xml | 53 | /// Serialize coalesced objects to Xml |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <param name="coa"></param> | 55 | /// <param name="coa"></param> |
56 | /// <param name="doScriptStates"> | ||
57 | /// If true then serialize script states. This will halt any running scripts | ||
58 | /// </param> | ||
56 | /// <returns></returns> | 59 | /// <returns></returns> |
57 | public static string ToXml(CoalescedSceneObjects coa) | 60 | public static string ToXml(CoalescedSceneObjects coa) |
61 | { | ||
62 | return ToXml(coa, true); | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Serialize coalesced objects to Xml | ||
67 | /// </summary> | ||
68 | /// <param name="coa"></param> | ||
69 | /// <param name="doScriptStates"> | ||
70 | /// If true then serialize script states. This will halt any running scripts | ||
71 | /// </param> | ||
72 | /// <returns></returns> | ||
73 | public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates) | ||
58 | { | 74 | { |
59 | using (StringWriter sw = new StringWriter()) | 75 | using (StringWriter sw = new StringWriter()) |
60 | { | 76 | { |
@@ -91,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
91 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); | 107 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); |
92 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); | 108 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); |
93 | 109 | ||
94 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true); | 110 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); |
95 | 111 | ||
96 | writer.WriteEndElement(); // SceneObjectGroup | 112 | writer.WriteEndElement(); // SceneObjectGroup |
97 | } | 113 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 151eba2..e223f47 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -1538,51 +1538,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1538 | } | 1538 | } |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | //////// Read ///////// | ||
1542 | public static bool Xml2ToSOG(XmlTextReader reader, SceneObjectGroup sog) | ||
1543 | { | ||
1544 | reader.Read(); | ||
1545 | reader.ReadStartElement("SceneObjectGroup"); | ||
1546 | SceneObjectPart root = Xml2ToSOP(reader); | ||
1547 | if (root != null) | ||
1548 | sog.SetRootPart(root); | ||
1549 | else | ||
1550 | { | ||
1551 | return false; | ||
1552 | } | ||
1553 | |||
1554 | if (sog.UUID == UUID.Zero) | ||
1555 | sog.UUID = sog.RootPart.UUID; | ||
1556 | |||
1557 | reader.Read(); // OtherParts | ||
1558 | |||
1559 | while (!reader.EOF) | ||
1560 | { | ||
1561 | switch (reader.NodeType) | ||
1562 | { | ||
1563 | case XmlNodeType.Element: | ||
1564 | if (reader.Name == "SceneObjectPart") | ||
1565 | { | ||
1566 | SceneObjectPart child = Xml2ToSOP(reader); | ||
1567 | if (child != null) | ||
1568 | sog.AddPart(child); | ||
1569 | } | ||
1570 | else | ||
1571 | { | ||
1572 | //Logger.Log("Found unexpected prim XML element " + reader.Name, Helpers.LogLevel.Debug); | ||
1573 | reader.Read(); | ||
1574 | } | ||
1575 | break; | ||
1576 | case XmlNodeType.EndElement: | ||
1577 | default: | ||
1578 | reader.Read(); | ||
1579 | break; | ||
1580 | } | ||
1581 | |||
1582 | } | ||
1583 | return true; | ||
1584 | } | ||
1585 | |||
1586 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) | 1541 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) |
1587 | { | 1542 | { |
1588 | SceneObjectPart obj = new SceneObjectPart(); | 1543 | SceneObjectPart obj = new SceneObjectPart(); |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index d214eba..a3485d2 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -223,50 +223,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
223 | 223 | ||
224 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) | 224 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) |
225 | { | 225 | { |
226 | XmlDocument doc = new XmlDocument(); | 226 | return SceneObjectSerializer.FromXml2Format(xmlString); |
227 | XmlNode rootNode; | ||
228 | |||
229 | XmlTextReader reader = new XmlTextReader(new StringReader(xmlString)); | ||
230 | reader.WhitespaceHandling = WhitespaceHandling.None; | ||
231 | doc.Load(reader); | ||
232 | reader.Close(); | ||
233 | rootNode = doc.FirstChild; | ||
234 | |||
235 | // This is to deal with neighbouring regions that are still surrounding the group xml with the <scene> | ||
236 | // tag. It should be possible to remove the first part of this if statement once we go past 0.5.9 (or | ||
237 | // when some other changes forces all regions to upgrade). | ||
238 | // This might seem rather pointless since prim crossing from this revision to an earlier revision remains | ||
239 | // broken. But it isn't much work to accomodate the old format here. | ||
240 | if (rootNode.LocalName.Equals("scene")) | ||
241 | { | ||
242 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | ||
243 | { | ||
244 | // There is only ever one prim. This oddity should be removeable post 0.5.9 | ||
245 | //return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml); | ||
246 | using (reader = new XmlTextReader(new StringReader(aPrimNode.OuterXml))) | ||
247 | { | ||
248 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
249 | if (SceneObjectSerializer.Xml2ToSOG(reader, obj)) | ||
250 | return obj; | ||
251 | |||
252 | return null; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | return null; | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | //return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml); | ||
261 | using (reader = new XmlTextReader(new StringReader(rootNode.OuterXml))) | ||
262 | { | ||
263 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
264 | if (SceneObjectSerializer.Xml2ToSOG(reader, obj)) | ||
265 | return obj; | ||
266 | |||
267 | return null; | ||
268 | } | ||
269 | } | ||
270 | } | 227 | } |
271 | 228 | ||
272 | /// <summary> | 229 | /// <summary> |
@@ -307,8 +264,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
307 | ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 264 | ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
308 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | 265 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) |
309 | { | 266 | { |
310 | SceneObjectGroup obj = CreatePrimFromXml2(scene, aPrimNode.OuterXml); | 267 | SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml); |
311 | if (obj != null && startScripts) | 268 | if (startScripts) |
312 | sceneObjects.Add(obj); | 269 | sceneObjects.Add(obj); |
313 | } | 270 | } |
314 | 271 | ||
@@ -319,27 +276,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
319 | } | 276 | } |
320 | } | 277 | } |
321 | 278 | ||
322 | /// <summary> | ||
323 | /// Create a prim from the xml2 representation. | ||
324 | /// </summary> | ||
325 | /// <param name="scene"></param> | ||
326 | /// <param name="xmlData"></param> | ||
327 | /// <returns>The scene object created. null if the scene object already existed</returns> | ||
328 | protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) | ||
329 | { | ||
330 | //SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData); | ||
331 | using (XmlTextReader reader = new XmlTextReader(new StringReader(xmlData))) | ||
332 | { | ||
333 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
334 | SceneObjectSerializer.Xml2ToSOG(reader, obj); | ||
335 | |||
336 | if (scene.AddRestoredSceneObject(obj, true, false)) | ||
337 | return obj; | ||
338 | else | ||
339 | return null; | ||
340 | } | ||
341 | } | ||
342 | |||
343 | #endregion | 279 | #endregion |
344 | } | 280 | } |
345 | } | 281 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index a4afd47..18e6ece 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -26,7 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | //using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using OpenMetaverse.Packets; | 31 | using OpenMetaverse.Packets; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -35,10 +35,18 @@ using OpenSim.Region.Framework.Interfaces; | |||
35 | 35 | ||
36 | namespace OpenSim.Region.Framework.Scenes | 36 | namespace OpenSim.Region.Framework.Scenes |
37 | { | 37 | { |
38 | /// <summary> | ||
39 | /// Collect statistics from the scene to send to the client and for access by other monitoring tools. | ||
40 | /// </summary> | ||
41 | /// <remarks> | ||
42 | /// FIXME: This should be a monitoring region module | ||
43 | /// </remarks> | ||
38 | public class SimStatsReporter | 44 | public class SimStatsReporter |
39 | { | 45 | { |
40 | // private static readonly log4net.ILog m_log | 46 | private static readonly log4net.ILog m_log |
41 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 47 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
48 | |||
49 | public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; | ||
42 | 50 | ||
43 | public delegate void SendStatResult(SimStats stats); | 51 | public delegate void SendStatResult(SimStats stats); |
44 | 52 | ||
@@ -48,10 +56,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
48 | 56 | ||
49 | public event YourStatsAreWrong OnStatsIncorrect; | 57 | public event YourStatsAreWrong OnStatsIncorrect; |
50 | 58 | ||
51 | private SendStatResult handlerSendStatResult = null; | 59 | private SendStatResult handlerSendStatResult; |
52 | 60 | ||
53 | private YourStatsAreWrong handlerStatsIncorrect = null; | 61 | private YourStatsAreWrong handlerStatsIncorrect; |
54 | 62 | ||
63 | /// <summary> | ||
64 | /// These are the IDs of stats sent in the StatsPacket to the viewer. | ||
65 | /// </summary> | ||
66 | /// <remarks> | ||
67 | /// Some of these are not relevant to OpenSimulator since it is architected differently to other simulators | ||
68 | /// (e.g. script instructions aren't executed as part of the frame loop so 'script time' is tricky). | ||
69 | /// </remarks> | ||
55 | public enum Stats : uint | 70 | public enum Stats : uint |
56 | { | 71 | { |
57 | TimeDilation = 0, | 72 | TimeDilation = 0, |
@@ -75,20 +90,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | OutPacketsPerSecond = 18, | 90 | OutPacketsPerSecond = 18, |
76 | PendingDownloads = 19, | 91 | PendingDownloads = 19, |
77 | PendingUploads = 20, | 92 | PendingUploads = 20, |
78 | VirtualSizeKB = 21, | 93 | VirtualSizeKb = 21, |
79 | ResidentSizeKB = 22, | 94 | ResidentSizeKb = 22, |
80 | PendingLocalUploads = 23, | 95 | PendingLocalUploads = 23, |
81 | UnAckedBytes = 24, | 96 | UnAckedBytes = 24, |
82 | PhysicsPinnedTasks = 25, | 97 | PhysicsPinnedTasks = 25, |
83 | PhysicsLODTasks = 26, | 98 | PhysicsLodTasks = 26, |
84 | PhysicsStepMS = 27, | 99 | SimPhysicsStepMs = 27, |
85 | PhysicsShapeMS = 28, | 100 | SimPhysicsShapeMs = 28, |
86 | PhysicsOtherMS = 29, | 101 | SimPhysicsOtherMs = 29, |
87 | PhysicsMemory = 30, | 102 | SimPhysicsMemory = 30, |
88 | ScriptEPS = 31, | 103 | ScriptEps = 31, |
89 | SimSpareTime = 32, | 104 | SimSpareMs = 32, |
90 | SimSleepTime = 33, | 105 | SimSleepMs = 33, |
91 | IOPumpTime = 34 | 106 | SimIoPumpTime = 34 |
92 | } | 107 | } |
93 | 108 | ||
94 | /// <summary> | 109 | /// <summary> |
@@ -113,11 +128,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | get { return lastReportedSimStats; } | 128 | get { return lastReportedSimStats; } |
114 | } | 129 | } |
115 | 130 | ||
131 | /// <summary> | ||
132 | /// Extra sim statistics that are used by monitors but not sent to the client. | ||
133 | /// </summary> | ||
134 | /// <value> | ||
135 | /// The keys are the stat names. | ||
136 | /// </value> | ||
137 | private Dictionary<string, float> m_lastReportedExtraSimStats = new Dictionary<string, float>(); | ||
138 | |||
116 | // Sending a stats update every 3 seconds- | 139 | // Sending a stats update every 3 seconds- |
117 | private int statsUpdatesEveryMS = 3000; | 140 | private int m_statsUpdatesEveryMS = 3000; |
118 | private float statsUpdateFactor = 0; | 141 | private float m_statsUpdateFactor; |
119 | private float m_timeDilation = 0; | 142 | private float m_timeDilation; |
120 | private int m_fps = 0; | 143 | private int m_fps; |
144 | |||
145 | /// <summary> | ||
146 | /// Number of the last frame on which we processed a stats udpate. | ||
147 | /// </summary> | ||
148 | private uint m_lastUpdateFrame; | ||
121 | 149 | ||
122 | /// <summary> | 150 | /// <summary> |
123 | /// Our nominal fps target, as expected in fps stats when a sim is running normally. | 151 | /// Our nominal fps target, as expected in fps stats when a sim is running normally. |
@@ -135,43 +163,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
135 | private float m_reportedFpsCorrectionFactor = 5; | 163 | private float m_reportedFpsCorrectionFactor = 5; |
136 | 164 | ||
137 | // saved last reported value so there is something available for llGetRegionFPS | 165 | // saved last reported value so there is something available for llGetRegionFPS |
138 | private float lastReportedSimFPS = 0; | 166 | private float lastReportedSimFPS; |
139 | private float[] lastReportedSimStats = new float[23]; | 167 | private float[] lastReportedSimStats = new float[22]; |
140 | private float m_pfps = 0; | 168 | private float m_pfps; |
141 | 169 | ||
142 | /// <summary> | 170 | /// <summary> |
143 | /// Number of agent updates requested in this stats cycle | 171 | /// Number of agent updates requested in this stats cycle |
144 | /// </summary> | 172 | /// </summary> |
145 | private int m_agentUpdates = 0; | 173 | private int m_agentUpdates; |
146 | 174 | ||
147 | /// <summary> | 175 | /// <summary> |
148 | /// Number of object updates requested in this stats cycle | 176 | /// Number of object updates requested in this stats cycle |
149 | /// </summary> | 177 | /// </summary> |
150 | private int m_objectUpdates; | 178 | private int m_objectUpdates; |
151 | 179 | ||
152 | private int m_frameMS = 0; | 180 | private int m_frameMS; |
153 | private int m_netMS = 0; | 181 | private int m_spareMS; |
154 | private int m_agentMS = 0; | 182 | private int m_netMS; |
155 | private int m_physicsMS = 0; | 183 | private int m_agentMS; |
156 | private int m_imageMS = 0; | 184 | private int m_physicsMS; |
157 | private int m_otherMS = 0; | 185 | private int m_imageMS; |
158 | private int m_sleeptimeMS = 0; | 186 | private int m_otherMS; |
159 | |||
160 | 187 | ||
161 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | 188 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. |
162 | //Ckrinke private int m_scriptMS = 0; | 189 | //Ckrinke private int m_scriptMS = 0; |
163 | 190 | ||
164 | private int m_rootAgents = 0; | 191 | private int m_rootAgents; |
165 | private int m_childAgents = 0; | 192 | private int m_childAgents; |
166 | private int m_numPrim = 0; | 193 | private int m_numPrim; |
167 | private int m_inPacketsPerSecond = 0; | 194 | private int m_inPacketsPerSecond; |
168 | private int m_outPacketsPerSecond = 0; | 195 | private int m_outPacketsPerSecond; |
169 | private int m_activePrim = 0; | 196 | private int m_activePrim; |
170 | private int m_unAckedBytes = 0; | 197 | private int m_unAckedBytes; |
171 | private int m_pendingDownloads = 0; | 198 | private int m_pendingDownloads; |
172 | private int m_pendingUploads = 0; | 199 | private int m_pendingUploads = 0; // FIXME: Not currently filled in |
173 | private int m_activeScripts = 0; | 200 | private int m_activeScripts; |
174 | private int m_scriptLinesPerSecond = 0; | 201 | private int m_scriptLinesPerSecond; |
175 | 202 | ||
176 | private int m_objectCapacity = 45000; | 203 | private int m_objectCapacity = 45000; |
177 | 204 | ||
@@ -187,13 +214,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
187 | { | 214 | { |
188 | m_scene = scene; | 215 | m_scene = scene; |
189 | m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; | 216 | m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; |
190 | statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); | 217 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
191 | ReportingRegion = scene.RegionInfo; | 218 | ReportingRegion = scene.RegionInfo; |
192 | 219 | ||
193 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; | 220 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; |
194 | m_report.AutoReset = true; | 221 | m_report.AutoReset = true; |
195 | m_report.Interval = statsUpdatesEveryMS; | 222 | m_report.Interval = m_statsUpdatesEveryMS; |
196 | m_report.Elapsed += statsHeartBeat; | 223 | m_report.Elapsed += TriggerStatsHeartbeat; |
197 | m_report.Enabled = true; | 224 | m_report.Enabled = true; |
198 | 225 | ||
199 | if (StatsManager.SimExtraStats != null) | 226 | if (StatsManager.SimExtraStats != null) |
@@ -202,20 +229,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
202 | 229 | ||
203 | public void Close() | 230 | public void Close() |
204 | { | 231 | { |
205 | m_report.Elapsed -= statsHeartBeat; | 232 | m_report.Elapsed -= TriggerStatsHeartbeat; |
206 | m_report.Close(); | 233 | m_report.Close(); |
207 | } | 234 | } |
208 | 235 | ||
236 | /// <summary> | ||
237 | /// Sets the number of milliseconds between stat updates. | ||
238 | /// </summary> | ||
239 | /// <param name='ms'></param> | ||
209 | public void SetUpdateMS(int ms) | 240 | public void SetUpdateMS(int ms) |
210 | { | 241 | { |
211 | statsUpdatesEveryMS = ms; | 242 | m_statsUpdatesEveryMS = ms; |
212 | statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); | 243 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
213 | m_report.Interval = statsUpdatesEveryMS; | 244 | m_report.Interval = m_statsUpdatesEveryMS; |
245 | } | ||
246 | |||
247 | private void TriggerStatsHeartbeat(object sender, EventArgs args) | ||
248 | { | ||
249 | try | ||
250 | { | ||
251 | statsHeartBeat(sender, args); | ||
252 | } | ||
253 | catch (Exception e) | ||
254 | { | ||
255 | m_log.Warn(string.Format( | ||
256 | "[SIM STATS REPORTER] Update for {0} failed with exception ", | ||
257 | m_scene.RegionInfo.RegionName), e); | ||
258 | } | ||
214 | } | 259 | } |
215 | 260 | ||
216 | private void statsHeartBeat(object sender, EventArgs e) | 261 | private void statsHeartBeat(object sender, EventArgs e) |
217 | { | 262 | { |
218 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; | 263 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22]; |
219 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 264 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
220 | 265 | ||
221 | // Know what's not thread safe in Mono... modifying timers. | 266 | // Know what's not thread safe in Mono... modifying timers. |
@@ -242,7 +287,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
242 | int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | 287 | int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); |
243 | 288 | ||
244 | // save the reported value so there is something available for llGetRegionFPS | 289 | // save the reported value so there is something available for llGetRegionFPS |
245 | lastReportedSimFPS = reportedFPS / statsUpdateFactor; | 290 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
246 | 291 | ||
247 | float physfps = ((m_pfps / 1000)); | 292 | float physfps = ((m_pfps / 1000)); |
248 | 293 | ||
@@ -253,7 +298,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
253 | physfps = 0; | 298 | physfps = 0; |
254 | 299 | ||
255 | #endregion | 300 | #endregion |
256 | float factor = 1 / statsUpdateFactor; | ||
257 | if (reportedFPS <= 0) | 301 | if (reportedFPS <= 0) |
258 | reportedFPS = 1; | 302 | reportedFPS = 1; |
259 | 303 | ||
@@ -264,32 +308,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | float targetframetime = 1100.0f / (float)m_nominalReportedFps; | 308 | float targetframetime = 1100.0f / (float)m_nominalReportedFps; |
265 | 309 | ||
266 | float sparetime; | 310 | float sparetime; |
267 | float sleeptime; | ||
268 | if (TotalFrameTime > targetframetime) | 311 | if (TotalFrameTime > targetframetime) |
269 | { | 312 | { |
270 | sparetime = 0; | 313 | sparetime = 0; |
271 | sleeptime = 0; | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | sparetime = m_frameMS - m_physicsMS - m_agentMS; | ||
276 | sparetime *= perframe; | ||
277 | if (sparetime < 0) | ||
278 | sparetime = 0; | ||
279 | else if (sparetime > TotalFrameTime) | ||
280 | sparetime = TotalFrameTime; | ||
281 | sleeptime = m_sleeptimeMS * perframe; | ||
282 | } | 314 | } |
315 | |||
316 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); | ||
317 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); | ||
318 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); | ||
319 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); | ||
320 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); | ||
321 | |||
322 | // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code | ||
323 | // so that stat numbers are always consistent. | ||
324 | CheckStatSanity(); | ||
283 | 325 | ||
284 | // other MS is actually simulation time | 326 | // other MS is actually simulation time |
285 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; | 327 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; |
286 | // m_imageMS m_netMS are not included in m_frameMS | 328 | // m_imageMS m_netMS are not included in m_frameMS |
287 | 329 | ||
288 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; | 330 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS; |
289 | if (m_otherMS < 0) | 331 | if (m_otherMS < 0) |
290 | m_otherMS = 0; | 332 | m_otherMS = 0; |
291 | 333 | ||
292 | for (int i = 0; i < 23; i++) | 334 | uint thisFrame = m_scene.Frame; |
335 | float framesUpdated = (float)(thisFrame - m_lastUpdateFrame) * m_reportedFpsCorrectionFactor; | ||
336 | m_lastUpdateFrame = thisFrame; | ||
337 | |||
338 | // Avoid div-by-zero if somehow we've not updated any frames. | ||
339 | if (framesUpdated == 0) | ||
340 | framesUpdated = 1; | ||
341 | |||
342 | for (int i = 0; i < 22; i++) | ||
293 | { | 343 | { |
294 | sb[i] = new SimStatsPacket.StatBlock(); | 344 | sb[i] = new SimStatsPacket.StatBlock(); |
295 | } | 345 | } |
@@ -298,13 +348,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
298 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 348 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
299 | 349 | ||
300 | sb[1].StatID = (uint) Stats.SimFPS; | 350 | sb[1].StatID = (uint) Stats.SimFPS; |
301 | sb[1].StatValue = reportedFPS / statsUpdateFactor; | 351 | sb[1].StatValue = reportedFPS / m_statsUpdateFactor; |
302 | 352 | ||
303 | sb[2].StatID = (uint) Stats.PhysicsFPS; | 353 | sb[2].StatID = (uint) Stats.PhysicsFPS; |
304 | sb[2].StatValue = physfps / statsUpdateFactor; | 354 | sb[2].StatValue = physfps / m_statsUpdateFactor; |
305 | 355 | ||
306 | sb[3].StatID = (uint) Stats.AgentUpdates; | 356 | sb[3].StatID = (uint) Stats.AgentUpdates; |
307 | sb[3].StatValue = (m_agentUpdates / statsUpdateFactor); | 357 | sb[3].StatValue = (m_agentUpdates / m_statsUpdateFactor); |
308 | 358 | ||
309 | sb[4].StatID = (uint) Stats.Agents; | 359 | sb[4].StatID = (uint) Stats.Agents; |
310 | sb[4].StatValue = m_rootAgents; | 360 | sb[4].StatValue = m_rootAgents; |
@@ -319,38 +369,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
319 | sb[7].StatValue = m_activePrim; | 369 | sb[7].StatValue = m_activePrim; |
320 | 370 | ||
321 | sb[8].StatID = (uint)Stats.FrameMS; | 371 | sb[8].StatID = (uint)Stats.FrameMS; |
322 | // sb[8].StatValue = m_frameMS / statsUpdateFactor; | 372 | sb[8].StatValue = m_frameMS / framesUpdated; |
323 | sb[8].StatValue = TotalFrameTime; | ||
324 | 373 | ||
325 | sb[9].StatID = (uint)Stats.NetMS; | 374 | sb[9].StatID = (uint)Stats.NetMS; |
326 | // sb[9].StatValue = m_netMS / statsUpdateFactor; | 375 | sb[9].StatValue = m_netMS / framesUpdated; |
327 | sb[9].StatValue = m_netMS * perframe; | ||
328 | 376 | ||
329 | sb[10].StatID = (uint)Stats.PhysicsMS; | 377 | sb[10].StatID = (uint)Stats.PhysicsMS; |
330 | // sb[10].StatValue = m_physicsMS / statsUpdateFactor; | 378 | sb[10].StatValue = m_physicsMS / framesUpdated; |
331 | sb[10].StatValue = m_physicsMS * perframe; | ||
332 | 379 | ||
333 | sb[11].StatID = (uint)Stats.ImageMS ; | 380 | sb[11].StatID = (uint)Stats.ImageMS ; |
334 | // sb[11].StatValue = m_imageMS / statsUpdateFactor; | 381 | sb[11].StatValue = m_imageMS / framesUpdated; |
335 | sb[11].StatValue = m_imageMS * perframe; | ||
336 | 382 | ||
337 | sb[12].StatID = (uint)Stats.OtherMS; | 383 | sb[12].StatID = (uint)Stats.OtherMS; |
338 | // sb[12].StatValue = m_otherMS / statsUpdateFactor; | 384 | sb[12].StatValue = m_otherMS / framesUpdated; |
339 | sb[12].StatValue = m_otherMS * perframe; | ||
340 | |||
341 | 385 | ||
342 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 386 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
343 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); | 387 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); |
344 | 388 | ||
345 | sb[14].StatID = (uint)Stats.OutPacketsPerSecond; | 389 | sb[14].StatID = (uint)Stats.OutPacketsPerSecond; |
346 | sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor); | 390 | sb[14].StatValue = (m_outPacketsPerSecond / m_statsUpdateFactor); |
347 | 391 | ||
348 | sb[15].StatID = (uint)Stats.UnAckedBytes; | 392 | sb[15].StatID = (uint)Stats.UnAckedBytes; |
349 | sb[15].StatValue = m_unAckedBytes; | 393 | sb[15].StatValue = m_unAckedBytes; |
350 | 394 | ||
351 | sb[16].StatID = (uint)Stats.AgentMS; | 395 | sb[16].StatID = (uint)Stats.AgentMS; |
352 | // sb[16].StatValue = m_agentMS / statsUpdateFactor; | 396 | sb[16].StatValue = m_agentMS / framesUpdated; |
353 | sb[16].StatValue = m_agentMS * perframe; | ||
354 | 397 | ||
355 | sb[17].StatID = (uint)Stats.PendingDownloads; | 398 | sb[17].StatID = (uint)Stats.PendingDownloads; |
356 | sb[17].StatValue = m_pendingDownloads; | 399 | sb[17].StatValue = m_pendingDownloads; |
@@ -362,15 +405,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
362 | sb[19].StatValue = m_activeScripts; | 405 | sb[19].StatValue = m_activeScripts; |
363 | 406 | ||
364 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 407 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; |
365 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; | 408 | sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; |
366 | 409 | ||
367 | sb[21].StatID = (uint)Stats.SimSpareTime; | 410 | sb[21].StatID = (uint)Stats.SimSpareMs; |
368 | sb[21].StatValue = sparetime; | 411 | sb[21].StatValue = m_spareMS / framesUpdated; |
369 | 412 | ||
370 | sb[22].StatID = (uint)Stats.SimSleepTime; | 413 | for (int i = 0; i < 22; i++) |
371 | sb[22].StatValue = sleeptime; | ||
372 | |||
373 | for (int i = 0; i < 23; i++) | ||
374 | { | 414 | { |
375 | lastReportedSimStats[i] = sb[i].StatValue; | 415 | lastReportedSimStats[i] = sb[i].StatValue; |
376 | } | 416 | } |
@@ -387,13 +427,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | } | 427 | } |
388 | 428 | ||
389 | // Extra statistics that aren't currently sent to clients | 429 | // Extra statistics that aren't currently sent to clients |
390 | LastReportedObjectUpdates = m_objectUpdates / statsUpdateFactor; | 430 | lock (m_lastReportedExtraSimStats) |
431 | { | ||
432 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; | ||
433 | |||
434 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | ||
435 | |||
436 | if (physicsStats != null) | ||
437 | { | ||
438 | foreach (KeyValuePair<string, float> tuple in physicsStats) | ||
439 | { | ||
440 | // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second | ||
441 | // Need to change things so that stats source can indicate whether they are per second or | ||
442 | // per frame. | ||
443 | if (tuple.Key.EndsWith("MS")) | ||
444 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated; | ||
445 | else | ||
446 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; | ||
447 | } | ||
448 | } | ||
449 | } | ||
391 | 450 | ||
392 | resetvalues(); | 451 | ResetValues(); |
393 | } | 452 | } |
394 | } | 453 | } |
395 | 454 | ||
396 | private void resetvalues() | 455 | private void ResetValues() |
397 | { | 456 | { |
398 | m_timeDilation = 0; | 457 | m_timeDilation = 0; |
399 | m_fps = 0; | 458 | m_fps = 0; |
@@ -411,7 +470,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
411 | m_physicsMS = 0; | 470 | m_physicsMS = 0; |
412 | m_imageMS = 0; | 471 | m_imageMS = 0; |
413 | m_otherMS = 0; | 472 | m_otherMS = 0; |
414 | m_sleeptimeMS = 0; | 473 | m_spareMS = 0; |
415 | 474 | ||
416 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 475 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
417 | //Ckrinke m_scriptMS = 0; | 476 | //Ckrinke m_scriptMS = 0; |
@@ -433,13 +492,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
433 | m_timeDilation = td; | 492 | m_timeDilation = td; |
434 | } | 493 | } |
435 | 494 | ||
436 | public void SetRootAgents(int rootAgents) | ||
437 | { | ||
438 | m_rootAgents = rootAgents; | ||
439 | CheckStatSanity(); | ||
440 | |||
441 | } | ||
442 | |||
443 | internal void CheckStatSanity() | 495 | internal void CheckStatSanity() |
444 | { | 496 | { |
445 | if (m_rootAgents < 0 || m_childAgents < 0) | 497 | if (m_rootAgents < 0 || m_childAgents < 0) |
@@ -456,22 +508,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
456 | } | 508 | } |
457 | } | 509 | } |
458 | 510 | ||
459 | public void SetChildAgents(int childAgents) | ||
460 | { | ||
461 | m_childAgents = childAgents; | ||
462 | CheckStatSanity(); | ||
463 | } | ||
464 | |||
465 | public void SetObjects(int objects) | ||
466 | { | ||
467 | m_numPrim = objects; | ||
468 | } | ||
469 | |||
470 | public void SetActiveObjects(int objects) | ||
471 | { | ||
472 | m_activePrim = objects; | ||
473 | } | ||
474 | |||
475 | public void AddFPS(int frames) | 511 | public void AddFPS(int frames) |
476 | { | 512 | { |
477 | m_fps += frames; | 513 | m_fps += frames; |
@@ -513,6 +549,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
513 | m_frameMS += ms; | 549 | m_frameMS += ms; |
514 | } | 550 | } |
515 | 551 | ||
552 | public void AddSpareMS(int ms) | ||
553 | { | ||
554 | m_spareMS += ms; | ||
555 | } | ||
556 | |||
516 | public void addNetMS(int ms) | 557 | public void addNetMS(int ms) |
517 | { | 558 | { |
518 | m_netMS += ms; | 559 | m_netMS += ms; |
@@ -538,15 +579,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
538 | m_otherMS += ms; | 579 | m_otherMS += ms; |
539 | } | 580 | } |
540 | 581 | ||
541 | public void addSleepMS(int ms) | ||
542 | { | ||
543 | m_sleeptimeMS += ms; | ||
544 | } | ||
545 | |||
546 | public void AddPendingDownloads(int count) | 582 | public void AddPendingDownloads(int count) |
547 | { | 583 | { |
548 | m_pendingDownloads += count; | 584 | m_pendingDownloads += count; |
549 | if (m_pendingDownloads < 0) m_pendingDownloads = 0; | 585 | |
586 | if (m_pendingDownloads < 0) | ||
587 | m_pendingDownloads = 0; | ||
588 | |||
550 | //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); | 589 | //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); |
551 | } | 590 | } |
552 | 591 | ||
@@ -555,11 +594,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
555 | m_scriptLinesPerSecond += count; | 594 | m_scriptLinesPerSecond += count; |
556 | } | 595 | } |
557 | 596 | ||
558 | public void SetActiveScripts(int count) | ||
559 | { | ||
560 | m_activeScripts = count; | ||
561 | } | ||
562 | |||
563 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) | 597 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) |
564 | { | 598 | { |
565 | AddInPackets(inPackets); | 599 | AddInPackets(inPackets); |
@@ -568,5 +602,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
568 | } | 602 | } |
569 | 603 | ||
570 | #endregion | 604 | #endregion |
605 | |||
606 | public Dictionary<string, float> GetExtraSimStats() | ||
607 | { | ||
608 | lock (m_lastReportedExtraSimStats) | ||
609 | return new Dictionary<string, float>(m_lastReportedExtraSimStats); | ||
610 | } | ||
571 | } | 611 | } |
572 | } | 612 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index ab6311b..4a21dc9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Text; | 31 | using System.Text; |
31 | using NUnit.Framework; | 32 | using NUnit.Framework; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
@@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
68 | Vector3 position = new Vector3(200,200,21); | 69 | Vector3 position = new Vector3(200,200,21); |
69 | 70 | ||
70 | foreach (Border b in testborders) | 71 | foreach (Border b in testborders) |
71 | { | ||
72 | Assert.That(!b.TestCross(position)); | 72 | Assert.That(!b.TestCross(position)); |
73 | 73 | ||
74 | } | ||
75 | |||
76 | position = new Vector3(200,280,21); | 74 | position = new Vector3(200,280,21); |
77 | Assert.That(NorthBorder.TestCross(position)); | 75 | Assert.That(NorthBorder.TestCross(position)); |
78 | 76 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index a5d2b23..ea9fc93 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
45 | { | 45 | { |
46 | static public Random random; | 46 | static public Random random; |
47 | SceneObjectGroup found; | 47 | SceneObjectGroup found; |
48 | Scene scene = SceneHelpers.SetupScene(); | 48 | Scene scene = new SceneHelpers().SetupScene(); |
49 | 49 | ||
50 | [Test] | 50 | [Test] |
51 | public void T010_AddObjects() | 51 | public void T010_AddObjects() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 9a60e50..d23c965 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | ||
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -44,7 +46,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
44 | public void TestDuplicateObject() | 46 | public void TestDuplicateObject() |
45 | { | 47 | { |
46 | TestHelpers.InMethod(); | 48 | TestHelpers.InMethod(); |
47 | Scene scene = SceneHelpers.SetupScene(); | 49 | // TestHelpers.EnableLogging(); |
50 | |||
51 | Scene scene = new SceneHelpers().SetupScene(); | ||
48 | 52 | ||
49 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); | 53 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); |
50 | string part1Name = "part1"; | 54 | string part1Name = "part1"; |
@@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
82 | Assert.That(dupePart1.PhysActor, Is.Not.Null); | 86 | Assert.That(dupePart1.PhysActor, Is.Not.Null); |
83 | Assert.That(dupePart2.PhysActor, Is.Not.Null); | 87 | Assert.That(dupePart2.PhysActor, Is.Not.Null); |
84 | */ | 88 | */ |
89 | |||
90 | // TestHelpers.DisableLogging(); | ||
85 | } | 91 | } |
86 | } | 92 | } |
87 | } \ No newline at end of file | 93 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 7737d8e..453e077 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
88 | { | 88 | { |
89 | TestHelpers.InMethod(); | 89 | TestHelpers.InMethod(); |
90 | 90 | ||
91 | Scene scene = SceneHelpers.SetupScene(); | 91 | Scene scene = new SceneHelpers().SetupScene(); |
92 | int partsToTestCount = 3; | 92 | int partsToTestCount = 3; |
93 | 93 | ||
94 | SceneObjectGroup so | 94 | SceneObjectGroup so |
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
118 | { | 118 | { |
119 | TestHelpers.InMethod(); | 119 | TestHelpers.InMethod(); |
120 | 120 | ||
121 | Scene scene = SceneHelpers.SetupScene(); | 121 | Scene scene = new SceneHelpers().SetupScene(); |
122 | 122 | ||
123 | string obj1Name = "Alfred"; | 123 | string obj1Name = "Alfred"; |
124 | string obj2Name = "Betty"; | 124 | string obj2Name = "Betty"; |
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
152 | { | 152 | { |
153 | TestHelpers.InMethod(); | 153 | TestHelpers.InMethod(); |
154 | 154 | ||
155 | Scene scene = SceneHelpers.SetupScene(); | 155 | Scene scene = new SceneHelpers().SetupScene(); |
156 | int partsToTestCount = 3; | 156 | int partsToTestCount = 3; |
157 | 157 | ||
158 | SceneObjectGroup so | 158 | SceneObjectGroup so |
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
185 | { | 185 | { |
186 | TestHelpers.InMethod(); | 186 | TestHelpers.InMethod(); |
187 | 187 | ||
188 | TestScene scene = SceneHelpers.SetupScene(); | 188 | TestScene scene = new SceneHelpers().SetupScene(); |
189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
190 | scene.DeleteSceneObject(part.ParentGroup, false); | 190 | scene.DeleteSceneObject(part.ParentGroup, false); |
191 | 191 | ||
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
204 | 204 | ||
205 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 205 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
206 | 206 | ||
207 | TestScene scene = SceneHelpers.SetupScene(); | 207 | TestScene scene = new SceneHelpers().SetupScene(); |
208 | 208 | ||
209 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 209 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
210 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 210 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 654b1a2..0076f41 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
61 | 61 | ||
62 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 62 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
63 | 63 | ||
64 | TestScene scene = SceneHelpers.SetupScene(); | 64 | TestScene scene = new SceneHelpers().SetupScene(); |
65 | IConfigSource configSource = new IniConfigSource(); | 65 | IConfigSource configSource = new IniConfigSource(); |
66 | IConfig config = configSource.AddConfig("Startup"); | 66 | IConfig config = configSource.AddConfig("Startup"); |
67 | config.Set("serverside_object_permissions", true); | 67 | config.Set("serverside_object_permissions", true); |
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
100 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 100 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
101 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); | 101 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); |
102 | 102 | ||
103 | TestScene scene = SceneHelpers.SetupScene(); | 103 | TestScene scene = new SceneHelpers().SetupScene(); |
104 | IConfigSource configSource = new IniConfigSource(); | 104 | IConfigSource configSource = new IniConfigSource(); |
105 | IConfig config = configSource.AddConfig("Startup"); | 105 | IConfig config = configSource.AddConfig("Startup"); |
106 | config.Set("serverside_object_permissions", true); | 106 | config.Set("serverside_object_permissions", true); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index be5b4a8..1add3dd 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
55 | UUID ownerId = TestHelpers.ParseTail(0x1); | 55 | UUID ownerId = TestHelpers.ParseTail(0x1); |
56 | int nParts = 3; | 56 | int nParts = 3; |
57 | 57 | ||
58 | TestScene scene = SceneHelpers.SetupScene(); | 58 | TestScene scene = new SceneHelpers().SetupScene(); |
59 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10); | 59 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10); |
60 | scene.AddSceneObject(sog1); | 60 | scene.AddSceneObject(sog1); |
61 | scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId }); | 61 | scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId }); |
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
71 | 71 | ||
72 | bool debugtest = false; | 72 | bool debugtest = false; |
73 | 73 | ||
74 | Scene scene = SceneHelpers.SetupScene(); | 74 | Scene scene = new SceneHelpers().SetupScene(); |
75 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); | 75 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); |
76 | SceneObjectGroup grp1 = part1.ParentGroup; | 76 | SceneObjectGroup grp1 = part1.ParentGroup; |
77 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); | 77 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); |
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
153 | 153 | ||
154 | bool debugtest = false; | 154 | bool debugtest = false; |
155 | 155 | ||
156 | Scene scene = SceneHelpers.SetupScene(); | 156 | Scene scene = new SceneHelpers().SetupScene(); |
157 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); | 157 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); |
158 | SceneObjectGroup grp1 = part1.ParentGroup; | 158 | SceneObjectGroup grp1 = part1.ParentGroup; |
159 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); | 159 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); |
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
286 | TestHelpers.InMethod(); | 286 | TestHelpers.InMethod(); |
287 | //log4net.Config.XmlConfigurator.Configure(); | 287 | //log4net.Config.XmlConfigurator.Configure(); |
288 | 288 | ||
289 | TestScene scene = SceneHelpers.SetupScene(); | 289 | TestScene scene = new SceneHelpers().SetupScene(); |
290 | 290 | ||
291 | string rootPartName = "rootpart"; | 291 | string rootPartName = "rootpart"; |
292 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 292 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
@@ -325,7 +325,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
325 | TestHelpers.InMethod(); | 325 | TestHelpers.InMethod(); |
326 | //log4net.Config.XmlConfigurator.Configure(); | 326 | //log4net.Config.XmlConfigurator.Configure(); |
327 | 327 | ||
328 | TestScene scene = SceneHelpers.SetupScene(); | 328 | TestScene scene = new SceneHelpers().SetupScene(); |
329 | 329 | ||
330 | string rootPartName = "rootpart"; | 330 | string rootPartName = "rootpart"; |
331 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 331 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index b49c6e7..0a94c19 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
52 | TestHelpers.InMethod(); | 52 | TestHelpers.InMethod(); |
53 | // log4net.Config.XmlConfigurator.Configure(); | 53 | // log4net.Config.XmlConfigurator.Configure(); |
54 | 54 | ||
55 | Scene scene = SceneHelpers.SetupScene(); | 55 | Scene scene = new SceneHelpers().SetupScene(); |
56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; | 56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; |
57 | 57 | ||
58 | g1.GroupResize(new Vector3(2, 3, 4)); | 58 | g1.GroupResize(new Vector3(2, 3, 4)); |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
75 | TestHelpers.InMethod(); | 75 | TestHelpers.InMethod(); |
76 | //log4net.Config.XmlConfigurator.Configure(); | 76 | //log4net.Config.XmlConfigurator.Configure(); |
77 | 77 | ||
78 | Scene scene = SceneHelpers.SetupScene(); | 78 | Scene scene = new SceneHelpers().SetupScene(); |
79 | 79 | ||
80 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); | 80 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); |
81 | g1.RootPart.Scale = new Vector3(2, 3, 4); | 81 | g1.RootPart.Scale = new Vector3(2, 3, 4); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index c582cf6..d2361f8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
52 | // UUID itemId = TestHelpers.ParseTail(0x2); | 52 | // UUID itemId = TestHelpers.ParseTail(0x2); |
53 | string itemName = "Test Script Item"; | 53 | string itemName = "Test Script Item"; |
54 | 54 | ||
55 | Scene scene = SceneHelpers.SetupScene(); | 55 | Scene scene = new SceneHelpers().SetupScene(); |
56 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 56 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); |
57 | scene.AddNewSceneObject(so, true); | 57 | scene.AddNewSceneObject(so, true); |
58 | 58 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs new file mode 100644 index 0000000..6d255aa --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs | |||
@@ -0,0 +1,154 @@ | |||
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.Reflection; | ||
30 | using System.Threading; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Tests.Common; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | |||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) | ||
43 | /// </summary> | ||
44 | [TestFixture] | ||
45 | public class SceneObjectSpatialTests | ||
46 | { | ||
47 | TestScene m_scene; | ||
48 | UUID m_ownerId = TestHelpers.ParseTail(0x1); | ||
49 | |||
50 | [SetUp] | ||
51 | public void SetUp() | ||
52 | { | ||
53 | m_scene = new SceneHelpers().SetupScene(); | ||
54 | } | ||
55 | |||
56 | [Test] | ||
57 | public void TestGetSceneObjectGroupPosition() | ||
58 | { | ||
59 | TestHelpers.InMethod(); | ||
60 | |||
61 | Vector3 position = new Vector3(10, 20, 30); | ||
62 | |||
63 | SceneObjectGroup so | ||
64 | = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10); | ||
65 | so.AbsolutePosition = position; | ||
66 | m_scene.AddNewSceneObject(so, false); | ||
67 | |||
68 | Assert.That(so.AbsolutePosition, Is.EqualTo(position)); | ||
69 | } | ||
70 | |||
71 | [Test] | ||
72 | public void TestGetRootPartPosition() | ||
73 | { | ||
74 | TestHelpers.InMethod(); | ||
75 | |||
76 | Vector3 partPosition = new Vector3(10, 20, 30); | ||
77 | |||
78 | SceneObjectGroup so | ||
79 | = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10); | ||
80 | so.AbsolutePosition = partPosition; | ||
81 | m_scene.AddNewSceneObject(so, false); | ||
82 | |||
83 | Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition)); | ||
84 | Assert.That(so.RootPart.GroupPosition, Is.EqualTo(partPosition)); | ||
85 | Assert.That(so.RootPart.GetWorldPosition(), Is.EqualTo(partPosition)); | ||
86 | Assert.That(so.RootPart.RelativePosition, Is.EqualTo(partPosition)); | ||
87 | Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero)); | ||
88 | } | ||
89 | |||
90 | [Test] | ||
91 | public void TestGetChildPartPosition() | ||
92 | { | ||
93 | TestHelpers.InMethod(); | ||
94 | |||
95 | Vector3 rootPartPosition = new Vector3(10, 20, 30); | ||
96 | Vector3 childOffsetPosition = new Vector3(2, 3, 4); | ||
97 | |||
98 | SceneObjectGroup so | ||
99 | = SceneHelpers.CreateSceneObject(2, m_ownerId, "obj1", 0x10); | ||
100 | so.AbsolutePosition = rootPartPosition; | ||
101 | so.Parts[1].OffsetPosition = childOffsetPosition; | ||
102 | |||
103 | m_scene.AddNewSceneObject(so, false); | ||
104 | |||
105 | // Calculate child absolute position. | ||
106 | Vector3 childPosition = new Vector3(rootPartPosition + childOffsetPosition); | ||
107 | |||
108 | SceneObjectPart childPart = so.Parts[1]; | ||
109 | Assert.That(childPart.AbsolutePosition, Is.EqualTo(childPosition)); | ||
110 | Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition)); | ||
111 | Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition)); | ||
112 | Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition)); | ||
113 | Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition)); | ||
114 | } | ||
115 | |||
116 | [Test] | ||
117 | public void TestGetChildPartPositionAfterObjectRotation() | ||
118 | { | ||
119 | TestHelpers.InMethod(); | ||
120 | |||
121 | Vector3 rootPartPosition = new Vector3(10, 20, 30); | ||
122 | Vector3 childOffsetPosition = new Vector3(2, 3, 4); | ||
123 | |||
124 | SceneObjectGroup so | ||
125 | = SceneHelpers.CreateSceneObject(2, m_ownerId, "obj1", 0x10); | ||
126 | so.AbsolutePosition = rootPartPosition; | ||
127 | so.Parts[1].OffsetPosition = childOffsetPosition; | ||
128 | |||
129 | m_scene.AddNewSceneObject(so, false); | ||
130 | |||
131 | so.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 0, -90 * Utils.DEG_TO_RAD)); | ||
132 | |||
133 | // Calculate child absolute position. | ||
134 | Vector3 rotatedChildOffsetPosition | ||
135 | = new Vector3(childOffsetPosition.Y, -childOffsetPosition.X, childOffsetPosition.Z); | ||
136 | |||
137 | Vector3 childPosition = new Vector3(rootPartPosition + rotatedChildOffsetPosition); | ||
138 | |||
139 | SceneObjectPart childPart = so.Parts[1]; | ||
140 | |||
141 | // FIXME: Should be childPosition after rotation? | ||
142 | Assert.That(childPart.AbsolutePosition, Is.EqualTo(rootPartPosition + childOffsetPosition)); | ||
143 | |||
144 | Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition)); | ||
145 | Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition)); | ||
146 | |||
147 | // Relative to root part as (0, 0, 0) | ||
148 | Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition)); | ||
149 | |||
150 | // Relative to root part as (0, 0, 0) | ||
151 | Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition)); | ||
152 | } | ||
153 | } | ||
154 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 2a342d5..742c769 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
@@ -43,24 +44,141 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
43 | [TestFixture] | 44 | [TestFixture] |
44 | public class SceneObjectStatusTests | 45 | public class SceneObjectStatusTests |
45 | { | 46 | { |
47 | private TestScene m_scene; | ||
48 | private UUID m_ownerId = TestHelpers.ParseTail(0x1); | ||
49 | private SceneObjectGroup m_so1; | ||
50 | private SceneObjectGroup m_so2; | ||
51 | |||
52 | [SetUp] | ||
53 | public void Init() | ||
54 | { | ||
55 | m_scene = new SceneHelpers().SetupScene(); | ||
56 | m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10); | ||
57 | m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20); | ||
58 | } | ||
59 | |||
46 | [Test] | 60 | [Test] |
47 | public void TestSetPhantom() | 61 | public void TestSetPhantomSinglePrim() |
48 | { | 62 | { |
49 | TestHelpers.InMethod(); | 63 | TestHelpers.InMethod(); |
50 | 64 | ||
51 | // Scene scene = SceneSetupHelpers.SetupScene(); | 65 | m_scene.AddSceneObject(m_so1); |
52 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); | 66 | |
53 | SceneObjectPart rootPart = so.RootPart; | 67 | SceneObjectPart rootPart = m_so1.RootPart; |
54 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | 68 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); |
55 | 69 | ||
56 | so.ScriptSetPhantomStatus(true); | 70 | m_so1.ScriptSetPhantomStatus(true); |
57 | 71 | ||
58 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | 72 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); |
59 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); | 73 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); |
60 | 74 | ||
61 | so.ScriptSetPhantomStatus(false); | 75 | m_so1.ScriptSetPhantomStatus(false); |
62 | 76 | ||
63 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | 77 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); |
64 | } | 78 | } |
79 | |||
80 | [Test] | ||
81 | public void TestSetPhysicsSinglePrim() | ||
82 | { | ||
83 | TestHelpers.InMethod(); | ||
84 | |||
85 | m_scene.AddSceneObject(m_so1); | ||
86 | |||
87 | SceneObjectPart rootPart = m_so1.RootPart; | ||
88 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
89 | |||
90 | m_so1.ScriptSetPhysicsStatus(true); | ||
91 | |||
92 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | ||
93 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
94 | |||
95 | m_so1.ScriptSetPhysicsStatus(false); | ||
96 | |||
97 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
98 | } | ||
99 | |||
100 | [Test] | ||
101 | public void TestSetPhysicsLinkset() | ||
102 | { | ||
103 | TestHelpers.InMethod(); | ||
104 | |||
105 | m_scene.AddSceneObject(m_so1); | ||
106 | m_scene.AddSceneObject(m_so2); | ||
107 | |||
108 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
109 | |||
110 | m_so1.ScriptSetPhysicsStatus(true); | ||
111 | |||
112 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
113 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
114 | |||
115 | m_so1.ScriptSetPhysicsStatus(false); | ||
116 | |||
117 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
118 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None)); | ||
119 | |||
120 | m_so1.ScriptSetPhysicsStatus(true); | ||
121 | |||
122 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
123 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Test that linking results in the correct physical status for all linkees. | ||
128 | /// </summary> | ||
129 | [Test] | ||
130 | public void TestLinkPhysicsBothPhysical() | ||
131 | { | ||
132 | TestHelpers.InMethod(); | ||
133 | |||
134 | m_scene.AddSceneObject(m_so1); | ||
135 | m_scene.AddSceneObject(m_so2); | ||
136 | |||
137 | m_so1.ScriptSetPhysicsStatus(true); | ||
138 | m_so2.ScriptSetPhysicsStatus(true); | ||
139 | |||
140 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
141 | |||
142 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
143 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
144 | } | ||
145 | |||
146 | /// <summary> | ||
147 | /// Test that linking results in the correct physical status for all linkees. | ||
148 | /// </summary> | ||
149 | [Test] | ||
150 | public void TestLinkPhysicsRootPhysicalOnly() | ||
151 | { | ||
152 | TestHelpers.InMethod(); | ||
153 | |||
154 | m_scene.AddSceneObject(m_so1); | ||
155 | m_scene.AddSceneObject(m_so2); | ||
156 | |||
157 | m_so1.ScriptSetPhysicsStatus(true); | ||
158 | |||
159 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
160 | |||
161 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
162 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Test that linking results in the correct physical status for all linkees. | ||
167 | /// </summary> | ||
168 | [Test] | ||
169 | public void TestLinkPhysicsChildPhysicalOnly() | ||
170 | { | ||
171 | TestHelpers.InMethod(); | ||
172 | |||
173 | m_scene.AddSceneObject(m_so1); | ||
174 | m_scene.AddSceneObject(m_so2); | ||
175 | |||
176 | m_so2.ScriptSetPhysicsStatus(true); | ||
177 | |||
178 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
179 | |||
180 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
181 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None)); | ||
182 | } | ||
65 | } | 183 | } |
66 | } \ No newline at end of file | 184 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index c13d82e..c7eaff9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
58 | 58 | ||
59 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 59 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
60 | 60 | ||
61 | TestScene scene = SceneHelpers.SetupScene(); | 61 | TestScene scene = new SceneHelpers().SetupScene(); |
62 | IConfigSource configSource = new IniConfigSource(); | 62 | IConfigSource configSource = new IniConfigSource(); |
63 | 63 | ||
64 | IConfig startupConfig = configSource.AddConfig("Startup"); | 64 | IConfig startupConfig = configSource.AddConfig("Startup"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index ed9b179..02c45ef 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -67,10 +67,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
67 | public void Init() | 67 | public void Init() |
68 | { | 68 | { |
69 | TestHelpers.InMethod(); | 69 | TestHelpers.InMethod(); |
70 | 70 | ||
71 | scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | 71 | SceneHelpers sh = new SceneHelpers(); |
72 | scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | 72 | |
73 | scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); | 73 | scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); |
74 | scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | ||
75 | scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); | ||
74 | 76 | ||
75 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 77 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
76 | interregionComms.Initialise(new IniConfigSource()); | 78 | interregionComms.Initialise(new IniConfigSource()); |
@@ -99,9 +101,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
99 | public void TestCloseAgent() | 101 | public void TestCloseAgent() |
100 | { | 102 | { |
101 | TestHelpers.InMethod(); | 103 | TestHelpers.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 104 | // TestHelpers.EnableLogging(); |
103 | 105 | ||
104 | TestScene scene = SceneHelpers.SetupScene(); | 106 | TestScene scene = new SceneHelpers().SetupScene(); |
105 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 107 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
106 | 108 | ||
107 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); | 109 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); |
@@ -112,6 +114,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
112 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); | 114 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); |
113 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); | 115 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); |
114 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); | 116 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); |
117 | |||
118 | // TestHelpers.DisableLogging(); | ||
115 | } | 119 | } |
116 | 120 | ||
117 | [Test] | 121 | [Test] |
@@ -126,7 +130,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
126 | IConfig config = configSource.AddConfig("Modules"); | 130 | IConfig config = configSource.AddConfig("Modules"); |
127 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); | 131 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); |
128 | 132 | ||
129 | TestScene scene = SceneHelpers.SetupScene(); | 133 | SceneHelpers sceneHelpers = new SceneHelpers(); |
134 | TestScene scene = sceneHelpers.SetupScene(); | ||
130 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); | 135 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); |
131 | 136 | ||
132 | UUID agentId = TestHelpers.ParseTail(0x01); | 137 | UUID agentId = TestHelpers.ParseTail(0x01); |
@@ -176,8 +181,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
176 | 181 | ||
177 | // UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 182 | // UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
178 | 183 | ||
179 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | 184 | TestScene myScene1 = new SceneHelpers().SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
180 | TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | 185 | TestScene myScene2 = new SceneHelpers().SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
181 | 186 | ||
182 | IConfigSource configSource = new IniConfigSource(); | 187 | IConfigSource configSource = new IniConfigSource(); |
183 | IConfig config = configSource.AddConfig("Startup"); | 188 | IConfig config = configSource.AddConfig("Startup"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 89f8007..646e5fa 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
59 | TestHelpers.InMethod(); | 59 | TestHelpers.InMethod(); |
60 | // log4net.Config.XmlConfigurator.Configure(); | 60 | // log4net.Config.XmlConfigurator.Configure(); |
61 | 61 | ||
62 | TestScene scene = SceneHelpers.SetupScene(); | 62 | TestScene scene = new SceneHelpers().SetupScene(); |
63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
64 | sp.Flying = true; | 64 | sp.Flying = true; |
65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); | 65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index cfea10d..1d1ff88 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
64 | [SetUp] | 64 | [SetUp] |
65 | public void Init() | 65 | public void Init() |
66 | { | 66 | { |
67 | m_scene = SceneHelpers.SetupScene(); | 67 | m_scene = new SceneHelpers().SetupScene(); |
68 | } | 68 | } |
69 | 69 | ||
70 | [Test] | 70 | [Test] |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index b7b8db4..313e350 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
50 | [SetUp] | 50 | [SetUp] |
51 | public void Init() | 51 | public void Init() |
52 | { | 52 | { |
53 | m_scene = SceneHelpers.SetupScene(); | 53 | m_scene = new SceneHelpers().SetupScene(); |
54 | m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); | 54 | m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index bebc10c..a407f01 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -34,10 +34,14 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.CoreModules.Framework; | ||
38 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
37 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
40 | using OpenSim.Region.CoreModules.World.Permissions; | ||
38 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 42 | using OpenSim.Tests.Common.Mock; |
40 | using System.Threading; | 43 | using System.IO; |
44 | using System.Text; | ||
41 | 45 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 46 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 47 | { |
@@ -47,145 +51,367 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | [TestFixture] | 51 | [TestFixture] |
48 | public class ScenePresenceTeleportTests | 52 | public class ScenePresenceTeleportTests |
49 | { | 53 | { |
50 | /// <summary> | 54 | [TestFixtureSetUp] |
51 | /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. | 55 | public void FixtureInit() |
52 | /// </summary> | 56 | { |
53 | /// Does not yet do what is says on the tin. | 57 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. |
54 | /// Commenting for now | 58 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; |
55 | //[Test, LongRunning] | 59 | } |
56 | public void TestSimpleNotNeighboursTeleport() | 60 | |
61 | [TestFixtureTearDown] | ||
62 | public void TearDown() | ||
63 | { | ||
64 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
65 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
66 | // tests really shouldn't). | ||
67 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
68 | } | ||
69 | |||
70 | [Test] | ||
71 | public void TestSameRegionTeleport() | ||
57 | { | 72 | { |
58 | TestHelpers.InMethod(); | 73 | TestHelpers.InMethod(); |
59 | ThreadRunResults results = new ThreadRunResults(); | 74 | // log4net.Config.XmlConfigurator.Configure(); |
60 | results.Result = false; | 75 | |
61 | results.Message = "Test did not run"; | 76 | EntityTransferModule etm = new EntityTransferModule(); |
62 | TestRunning testClass = new TestRunning(results); | 77 | |
78 | IConfigSource config = new IniConfigSource(); | ||
79 | config.AddConfig("Modules"); | ||
80 | // Not strictly necessary since FriendsModule assumes it is the default (!) | ||
81 | config.Configs["Modules"].Set("EntityTransferModule", etm.Name); | ||
82 | |||
83 | TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
84 | SceneHelpers.SetupSceneModules(scene, config, etm); | ||
85 | |||
86 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
87 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
88 | |||
89 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
90 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
91 | scene.RequestTeleportLocation( | ||
92 | sp.ControllingClient, | ||
93 | scene.RegionInfo.RegionHandle, | ||
94 | teleportPosition, | ||
95 | teleportLookAt, | ||
96 | (uint)TeleportFlags.ViaLocation); | ||
63 | 97 | ||
64 | Thread testThread = new Thread(testClass.run); | 98 | Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition)); |
65 | 99 | ||
66 | // Seems kind of redundant to start a thread and then join it, however.. We need to protect against | 100 | Assert.That(scene.GetRootAgentCount(), Is.EqualTo(1)); |
67 | // A thread abort exception in the simulator code. | 101 | Assert.That(scene.GetChildAgentCount(), Is.EqualTo(0)); |
68 | testThread.Start(); | ||
69 | testThread.Join(); | ||
70 | 102 | ||
71 | Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); | 103 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera |
72 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | 104 | // position instead). |
105 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
73 | } | 106 | } |
74 | 107 | ||
75 | [TearDown] | 108 | [Test] |
76 | public void TearDown() | 109 | public void TestSameSimulatorSeparatedRegionsTeleport() |
77 | { | 110 | { |
78 | try | 111 | TestHelpers.InMethod(); |
79 | { | 112 | // log4net.Config.XmlConfigurator.Configure(); |
80 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | 113 | |
81 | } | 114 | UUID userId = TestHelpers.ParseTail(0x1); |
82 | catch (NullReferenceException) | 115 | |
83 | { } | 116 | EntityTransferModule etmA = new EntityTransferModule(); |
117 | EntityTransferModule etmB = new EntityTransferModule(); | ||
118 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
119 | |||
120 | IConfigSource config = new IniConfigSource(); | ||
121 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
122 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
123 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
124 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
125 | |||
126 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
127 | // for a callback from the destination scene before removing its avatar data. | ||
128 | entityTransferConfig.Set("wait_for_callback", false); | ||
129 | |||
130 | SceneHelpers sh = new SceneHelpers(); | ||
131 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
132 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
133 | |||
134 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
135 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
136 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
137 | |||
138 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
139 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
140 | |||
141 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
142 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
143 | |||
144 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | ||
145 | // UDP stack (?) | ||
146 | // ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; | ||
147 | |||
148 | sceneA.RequestTeleportLocation( | ||
149 | sp.ControllingClient, | ||
150 | sceneB.RegionInfo.RegionHandle, | ||
151 | teleportPosition, | ||
152 | teleportLookAt, | ||
153 | (uint)TeleportFlags.ViaLocation); | ||
154 | |||
155 | ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
156 | |||
157 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | ||
158 | |||
159 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); | ||
160 | Assert.That(sceneBSp, Is.Not.Null); | ||
161 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
162 | Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
163 | |||
164 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | ||
165 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
166 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); | ||
167 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
168 | |||
169 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
170 | |||
171 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
172 | // position instead). | ||
173 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
84 | } | 174 | } |
85 | 175 | ||
86 | } | 176 | /// <summary> |
177 | /// Test teleport procedures when the target simulator returns false when queried about access. | ||
178 | /// </summary> | ||
179 | [Test] | ||
180 | public void TestSameSimulatorSeparatedRegionsQueryAccessFails() | ||
181 | { | ||
182 | TestHelpers.InMethod(); | ||
183 | // TestHelpers.EnableLogging(); | ||
87 | 184 | ||
88 | public class ThreadRunResults | 185 | UUID userId = TestHelpers.ParseTail(0x1); |
89 | { | 186 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); |
90 | public bool Result = false; | ||
91 | public string Message = string.Empty; | ||
92 | } | ||
93 | 187 | ||
94 | public class TestRunning | 188 | EntityTransferModule etmA = new EntityTransferModule(); |
95 | { | 189 | EntityTransferModule etmB = new EntityTransferModule(); |
96 | public ThreadRunResults results; | 190 | |
97 | public TestRunning(ThreadRunResults t) | 191 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
192 | |||
193 | IConfigSource config = new IniConfigSource(); | ||
194 | config.AddConfig("Modules"); | ||
195 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); | ||
196 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | ||
197 | |||
198 | config.AddConfig("EntityTransfer"); | ||
199 | |||
200 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
201 | // for a callback from the destination scene before removing its avatar data. | ||
202 | config.Configs["EntityTransfer"].Set("wait_for_callback", false); | ||
203 | |||
204 | config.AddConfig("Startup"); | ||
205 | config.Configs["Startup"].Set("serverside_object_permissions", true); | ||
206 | |||
207 | SceneHelpers sh = new SceneHelpers(); | ||
208 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
209 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
210 | |||
211 | SceneHelpers.SetupSceneModules(sceneA, config, etmA ); | ||
212 | |||
213 | // We need to set up the permisions module on scene B so that our later use of agent limit to deny | ||
214 | // QueryAccess won't succeed anyway because administrators are always allowed in and the default | ||
215 | // IsAdministrator if no permissions module is present is true. | ||
216 | SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); | ||
217 | |||
218 | // Shared scene modules | ||
219 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
220 | |||
221 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
222 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
223 | |||
224 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
225 | sp.AbsolutePosition = preTeleportPosition; | ||
226 | |||
227 | // Make sceneB return false on query access | ||
228 | sceneB.RegionInfo.RegionSettings.AgentLimit = 0; | ||
229 | |||
230 | sceneA.RequestTeleportLocation( | ||
231 | sp.ControllingClient, | ||
232 | sceneB.RegionInfo.RegionHandle, | ||
233 | teleportPosition, | ||
234 | teleportLookAt, | ||
235 | (uint)TeleportFlags.ViaLocation); | ||
236 | |||
237 | // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
238 | |||
239 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | ||
240 | |||
241 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | ||
242 | Assert.That(sceneASp, Is.Not.Null); | ||
243 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | ||
244 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | ||
245 | |||
246 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | ||
247 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
248 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); | ||
249 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
250 | |||
251 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
252 | |||
253 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
254 | // position instead). | ||
255 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
256 | |||
257 | // TestHelpers.DisableLogging(); | ||
258 | } | ||
259 | |||
260 | /// <summary> | ||
261 | /// Test teleport procedures when the target simulator create agent step is refused. | ||
262 | /// </summary> | ||
263 | [Test] | ||
264 | public void TestSameSimulatorSeparatedRegionsCreateAgentFails() | ||
98 | { | 265 | { |
99 | results = t; | 266 | TestHelpers.InMethod(); |
267 | // TestHelpers.EnableLogging(); | ||
268 | |||
269 | UUID userId = TestHelpers.ParseTail(0x1); | ||
270 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); | ||
271 | |||
272 | EntityTransferModule etmA = new EntityTransferModule(); | ||
273 | EntityTransferModule etmB = new EntityTransferModule(); | ||
274 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
275 | |||
276 | IConfigSource config = new IniConfigSource(); | ||
277 | config.AddConfig("Modules"); | ||
278 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); | ||
279 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | ||
280 | |||
281 | config.AddConfig("EntityTransfer"); | ||
282 | |||
283 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
284 | // for a callback from the destination scene before removing its avatar data. | ||
285 | config.Configs["EntityTransfer"].Set("wait_for_callback", false); | ||
286 | |||
287 | SceneHelpers sh = new SceneHelpers(); | ||
288 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
289 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
290 | |||
291 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
292 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
293 | |||
294 | // Shared scene modules | ||
295 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
296 | |||
297 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
298 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
299 | |||
300 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
301 | sp.AbsolutePosition = preTeleportPosition; | ||
302 | |||
303 | // Make sceneB refuse CreateAgent | ||
304 | sceneB.LoginsDisabled = true; | ||
305 | |||
306 | sceneA.RequestTeleportLocation( | ||
307 | sp.ControllingClient, | ||
308 | sceneB.RegionInfo.RegionHandle, | ||
309 | teleportPosition, | ||
310 | teleportLookAt, | ||
311 | (uint)TeleportFlags.ViaLocation); | ||
312 | |||
313 | // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
314 | |||
315 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | ||
316 | |||
317 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | ||
318 | Assert.That(sceneASp, Is.Not.Null); | ||
319 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | ||
320 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | ||
321 | |||
322 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | ||
323 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
324 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); | ||
325 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
326 | |||
327 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
328 | |||
329 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
330 | // position instead). | ||
331 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
332 | |||
333 | // TestHelpers.DisableLogging(); | ||
100 | } | 334 | } |
101 | public void run(object o) | 335 | |
336 | [Test] | ||
337 | public void TestSameSimulatorNeighbouringRegionsTeleport() | ||
102 | { | 338 | { |
103 | 339 | TestHelpers.InMethod(); | |
104 | //results.Result = true; | 340 | // TestHelpers.EnableLogging(); |
105 | log4net.Config.XmlConfigurator.Configure(); | 341 | |
106 | 342 | UUID userId = TestHelpers.ParseTail(0x1); | |
107 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); | 343 | |
108 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); | 344 | EntityTransferModule etmA = new EntityTransferModule(); |
109 | 345 | EntityTransferModule etmB = new EntityTransferModule(); | |
110 | // shared module | 346 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
111 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 347 | |
112 | 348 | IConfigSource config = new IniConfigSource(); | |
113 | 349 | IConfig modulesConfig = config.AddConfig("Modules"); | |
114 | Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); | 350 | modulesConfig.Set("EntityTransferModule", etmA.Name); |
115 | SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 351 | modulesConfig.Set("SimulationServices", lscm.Name); |
116 | sceneB.RegisterRegionWithGrid(); | 352 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); |
117 | 353 | ||
118 | Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); | 354 | // In order to run a single threaded regression test we do not want the entity transfer module waiting |
119 | SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 355 | // for a callback from the destination scene before removing its avatar data. |
120 | sceneA.RegisterRegionWithGrid(); | 356 | entityTransferConfig.Set("wait_for_callback", false); |
121 | 357 | ||
122 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); | 358 | SceneHelpers sh = new SceneHelpers(); |
123 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; | 359 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
124 | 360 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | |
125 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); | 361 | |
126 | 362 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | |
127 | results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); | 363 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); |
128 | 364 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | |
129 | if (!results.Result) | 365 | |
130 | { | 366 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
131 | results.Message = "Incorrect caps object path set up in sceneA"; | 367 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
132 | return; | 368 | |
133 | } | 369 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); |
134 | 370 | originalSp.AbsolutePosition = new Vector3(30, 31, 32); | |
135 | /* | 371 | |
136 | Assert.That( | 372 | ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId); |
137 | sceneACapsModule.GetCapsPath(agentId), | 373 | Assert.That(beforeSceneASp, Is.Not.Null); |
138 | Is.EqualTo(client.CapsSeedUrl), | 374 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); |
139 | "Incorrect caps object path set up in sceneA"); | 375 | |
140 | */ | 376 | ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId); |
141 | // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. | 377 | Assert.That(beforeSceneBSp, Is.Not.Null); |
142 | 378 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); | |
143 | 379 | ||
144 | client.TeleportTargetScene = sceneB; | 380 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole |
145 | client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); | 381 | // UDP stack (?) |
146 | 382 | // ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB; | |
147 | results.Result = (sceneB.GetScenePresence(agentId) != null); | 383 | |
148 | if (!results.Result) | 384 | sceneA.RequestTeleportLocation( |
149 | { | 385 | beforeSceneASp.ControllingClient, |
150 | results.Message = "Client does not have an agent in sceneB"; | 386 | sceneB.RegionInfo.RegionHandle, |
151 | return; | 387 | teleportPosition, |
152 | } | 388 | teleportLookAt, |
153 | 389 | (uint)TeleportFlags.ViaLocation); | |
154 | //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); | 390 | |
155 | 391 | ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide(); | |
156 | //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); | 392 | |
157 | 393 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | |
158 | results.Result = (sceneA.GetScenePresence(agentId) == null); | 394 | Assert.That(afterSceneASp, Is.Not.Null); |
159 | if (!results.Result) | 395 | Assert.That(afterSceneASp.IsChildAgent, Is.True); |
160 | { | 396 | |
161 | results.Message = "Client still had an agent in sceneA"; | 397 | ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId); |
162 | return; | 398 | Assert.That(afterSceneBSp, Is.Not.Null); |
163 | } | 399 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); |
164 | 400 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | |
165 | ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); | 401 | Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); |
166 | 402 | ||
167 | 403 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | |
168 | results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + | 404 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); |
169 | "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); | 405 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); |
170 | if (!results.Result) | 406 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); |
171 | { | 407 | |
172 | results.Message = "Incorrect caps object path set up in sceneB"; | 408 | // TODO: Add assertions to check correct circuit details in both scenes. |
173 | return; | 409 | |
174 | } | 410 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera |
175 | 411 | // position instead). | |
176 | // Temporary assertion - caps url construction should at least be doable through a method. | 412 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); |
177 | /* | 413 | |
178 | Assert.That( | 414 | // TestHelpers.DisableLogging(); |
179 | "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", | ||
180 | Is.EqualTo(client.CapsSeedUrl), | ||
181 | "Incorrect caps object path set up in sceneB"); | ||
182 | */ | ||
183 | // This assertion will currently fail since we don't remove the caps paths when no longer needed | ||
184 | //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); | ||
185 | |||
186 | // TODO: Check that more of everything is as it should be | ||
187 | |||
188 | // TODO: test what happens if we try to teleport to a region that doesn't exist | ||
189 | } | 415 | } |
190 | } | 416 | } |
191 | } | 417 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 5c9a77d..d722a09 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
60 | { | 60 | { |
61 | TestHelpers.InMethod(); | 61 | TestHelpers.InMethod(); |
62 | 62 | ||
63 | Scene scene = SceneHelpers.SetupScene(); | 63 | Scene scene = new SceneHelpers().SetupScene(); |
64 | scene.Update(1); | 64 | scene.Update(1); |
65 | 65 | ||
66 | Assert.That(scene.Frame, Is.EqualTo(1)); | 66 | Assert.That(scene.Frame, Is.EqualTo(1)); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 55c80f5..d15141b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests | |||
58 | TestHelpers.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
63 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 63 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
64 | SceneObjectPart sop1 = sog1.RootPart; | 64 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Framework.Tests | |||
81 | TestHelpers.InMethod(); | 81 | TestHelpers.InMethod(); |
82 | // log4net.Config.XmlConfigurator.Configure(); | 82 | // log4net.Config.XmlConfigurator.Configure(); |
83 | 83 | ||
84 | Scene scene = SceneHelpers.SetupScene(); | 84 | Scene scene = new SceneHelpers().SetupScene(); |
85 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 85 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
86 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 86 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
87 | SceneObjectPart sop1 = sog1.RootPart; | 87 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Framework.Tests | |||
124 | TestHelpers.InMethod(); | 124 | TestHelpers.InMethod(); |
125 | // log4net.Config.XmlConfigurator.Configure(); | 125 | // log4net.Config.XmlConfigurator.Configure(); |
126 | 126 | ||
127 | Scene scene = SceneHelpers.SetupScene(); | 127 | Scene scene = new SceneHelpers().SetupScene(); |
128 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 128 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
129 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 129 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
130 | SceneObjectPart sop1 = sog1.RootPart; | 130 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Tests | |||
153 | TestHelpers.InMethod(); | 153 | TestHelpers.InMethod(); |
154 | // log4net.Config.XmlConfigurator.Configure(); | 154 | // log4net.Config.XmlConfigurator.Configure(); |
155 | 155 | ||
156 | Scene scene = SceneHelpers.SetupScene(); | 156 | Scene scene = new SceneHelpers().SetupScene(); |
157 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 157 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
158 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 158 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
159 | SceneObjectPart sop1 = sog1.RootPart; | 159 | SceneObjectPart sop1 = sog1.RootPart; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 55fc1e7..44d2d45 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests | |||
58 | TestHelpers.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); | 64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Tests | |||
85 | TestHelpers.InMethod(); | 85 | TestHelpers.InMethod(); |
86 | // log4net.Config.XmlConfigurator.Configure(); | 86 | // log4net.Config.XmlConfigurator.Configure(); |
87 | 87 | ||
88 | Scene scene = SceneHelpers.SetupScene(); | 88 | Scene scene = new SceneHelpers().SetupScene(); |
89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
91 | InventoryFolderBase folder1 | 91 | InventoryFolderBase folder1 |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index d9fe87c..198e487 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | public void Init() | 47 | public void Init() |
48 | { | 48 | { |
49 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. | 49 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. |
50 | Scene scene = SceneHelpers.SetupScene(); | 50 | Scene scene = new SceneHelpers().SetupScene(); |
51 | m_assetService = scene.AssetService; | 51 | m_assetService = scene.AssetService; |
52 | m_uuidGatherer = new UuidGatherer(m_assetService); | 52 | m_uuidGatherer = new UuidGatherer(m_assetService); |
53 | } | 53 | } |