diff options
author | Kitto Flora | 2011-03-22 20:33:24 +0000 |
---|---|---|
committer | Kitto Flora | 2011-03-22 20:33:24 +0000 |
commit | 764e8c2a4371c24d1a0bd067c0bcbc806562064d (patch) | |
tree | 03dfb1bfe16c420fdbb6a1aa723c9203771d1beb /OpenSim/Region/Framework | |
parent | Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff) | |
parent | Add some more fields to Estate settings and make them work. (diff) | |
download | opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.zip opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.gz opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.bz2 opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.xz |
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework')
22 files changed, 577 insertions, 305 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index c850f7f..72e79ed 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -32,7 +32,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
32 | public delegate void ChangeDelegate(UUID regionID); | 32 | public delegate void ChangeDelegate(UUID regionID); |
33 | public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); | 33 | public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); |
34 | 34 | ||
35 | public interface IEstateModule : IRegionModule | 35 | public interface IEstateModule |
36 | { | 36 | { |
37 | event ChangeDelegate OnRegionInfoChange; | 37 | event ChangeDelegate OnRegionInfoChange; |
38 | event ChangeDelegate OnEstateInfoChange; | 38 | event ChangeDelegate OnEstateInfoChange; |
@@ -45,5 +45,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
45 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). | 45 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). |
46 | /// </summary> | 46 | /// </summary> |
47 | void sendRegionHandshakeToAll(); | 47 | void sendRegionHandshakeToAll(); |
48 | void TriggerEstateInfoChange(); | ||
49 | void TriggerRegionInfoChange(); | ||
48 | } | 50 | } |
49 | } | 51 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs index 7251d57..2397f22 100644 --- a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs +++ b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs | |||
@@ -36,5 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
36 | void Close(); | 36 | void Close(); |
37 | void QueuePartForUpdate(SceneObjectPart part); | 37 | void QueuePartForUpdate(SceneObjectPart part); |
38 | void SendPrimUpdates(); | 38 | void SendPrimUpdates(); |
39 | int GetPendingObjectsCount(); | ||
39 | } | 40 | } |
40 | } | 41 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9a93a26..bc892e0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -303,6 +303,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
303 | // Passing something to another avatar or a an object will already | 303 | // Passing something to another avatar or a an object will already |
304 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 304 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
305 | item = InventoryService.GetItem(item); | 305 | item = InventoryService.GetItem(item); |
306 | if (item.Owner != remoteClient.AgentId) | ||
307 | return; | ||
306 | 308 | ||
307 | if (item != null) | 309 | if (item != null) |
308 | { | 310 | { |
@@ -1227,6 +1229,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1227 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) | 1229 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) |
1228 | return; | 1230 | return; |
1229 | 1231 | ||
1232 | bool overrideNoMod = false; | ||
1233 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1234 | overrideNoMod = true; | ||
1235 | |||
1230 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | 1236 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) |
1231 | { | 1237 | { |
1232 | // object cannot copy items to an object owned by a different owner | 1238 | // object cannot copy items to an object owned by a different owner |
@@ -1236,7 +1242,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1236 | } | 1242 | } |
1237 | 1243 | ||
1238 | // must have both move and modify permission to put an item in an object | 1244 | // must have both move and modify permission to put an item in an object |
1239 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1245 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1240 | { | 1246 | { |
1241 | return; | 1247 | return; |
1242 | } | 1248 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2424194..e5c0f38 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
64 | 64 | ||
65 | #region Fields | 65 | #region Fields |
66 | 66 | ||
67 | public bool EmergencyMonitoring = false; | ||
68 | |||
67 | public SynchronizeSceneHandler SynchronizeScene; | 69 | public SynchronizeSceneHandler SynchronizeScene; |
68 | public SimStatsReporter StatsReporter; | 70 | public SimStatsReporter StatsReporter; |
69 | public List<Border> NorthBorders = new List<Border>(); | 71 | public List<Border> NorthBorders = new List<Border>(); |
@@ -81,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
81 | public bool m_useFlySlow; | 83 | public bool m_useFlySlow; |
82 | public bool m_usePreJump; | 84 | public bool m_usePreJump; |
83 | public bool m_seeIntoRegionFromNeighbor; | 85 | public bool m_seeIntoRegionFromNeighbor; |
86 | |||
87 | protected float m_defaultDrawDistance = 255.0f; | ||
88 | public float DefaultDrawDistance | ||
89 | { | ||
90 | get { return m_defaultDrawDistance; } | ||
91 | } | ||
92 | |||
84 | // TODO: need to figure out how allow client agents but deny | 93 | // TODO: need to figure out how allow client agents but deny |
85 | // root agents when ACL denies access to root agent | 94 | // root agents when ACL denies access to root agent |
86 | public bool m_strictAccessControl = true; | 95 | public bool m_strictAccessControl = true; |
@@ -129,7 +138,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | protected ICapabilitiesModule m_capsModule; | 138 | protected ICapabilitiesModule m_capsModule; |
130 | // Central Update Loop | 139 | // Central Update Loop |
131 | protected int m_fps = 10; | 140 | protected int m_fps = 10; |
132 | protected uint m_frame; | 141 | |
142 | /// <summary> | ||
143 | /// Current scene frame number | ||
144 | /// </summary> | ||
145 | public uint Frame | ||
146 | { | ||
147 | get; | ||
148 | protected set; | ||
149 | } | ||
150 | |||
133 | protected float m_timespan = 0.089f; | 151 | protected float m_timespan = 0.089f; |
134 | protected DateTime m_lastupdate = DateTime.UtcNow; | 152 | protected DateTime m_lastupdate = DateTime.UtcNow; |
135 | 153 | ||
@@ -638,6 +656,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
638 | // | 656 | // |
639 | IConfig startupConfig = m_config.Configs["Startup"]; | 657 | IConfig startupConfig = m_config.Configs["Startup"]; |
640 | 658 | ||
659 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | ||
660 | |||
641 | //Animation states | 661 | //Animation states |
642 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 662 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
643 | // TODO: Change default to true once the feature is supported | 663 | // TODO: Change default to true once the feature is supported |
@@ -1209,7 +1229,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1209 | 1229 | ||
1210 | try | 1230 | try |
1211 | { | 1231 | { |
1212 | Update(); | 1232 | while (!shuttingdown) |
1233 | Update(); | ||
1213 | } | 1234 | } |
1214 | catch (ThreadAbortException) | 1235 | catch (ThreadAbortException) |
1215 | { | 1236 | { |
@@ -1223,190 +1244,180 @@ namespace OpenSim.Region.Framework.Scenes | |||
1223 | Watchdog.RemoveThread(); | 1244 | Watchdog.RemoveThread(); |
1224 | } | 1245 | } |
1225 | 1246 | ||
1226 | /// <summary> | ||
1227 | /// Performs per-frame updates on the scene, this should be the central scene loop | ||
1228 | /// </summary> | ||
1229 | public override void Update() | 1247 | public override void Update() |
1230 | { | 1248 | { |
1231 | float physicsFPS; | 1249 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; |
1232 | int maintc; | 1250 | float physicsFPS = 0f; |
1233 | 1251 | ||
1234 | while (!shuttingdown) | 1252 | int maintc = Util.EnvironmentTickCount(); |
1253 | int tmpFrameMS = maintc; | ||
1254 | tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | ||
1255 | |||
1256 | // Increment the frame counter | ||
1257 | ++Frame; | ||
1258 | |||
1259 | try | ||
1235 | { | 1260 | { |
1236 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; | 1261 | // Check if any objects have reached their targets |
1237 | physicsFPS = 0f; | 1262 | CheckAtTargets(); |
1238 | 1263 | ||
1239 | maintc = Util.EnvironmentTickCount(); | 1264 | // Update SceneObjectGroups that have scheduled themselves for updates |
1240 | int tmpFrameMS = maintc; | 1265 | // Objects queue their updates onto all scene presences |
1241 | tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1266 | if (Frame % m_update_objects == 0) |
1267 | m_sceneGraph.UpdateObjectGroups(); | ||
1242 | 1268 | ||
1243 | // Increment the frame counter | 1269 | // Run through all ScenePresences looking for updates |
1244 | ++m_frame; | 1270 | // Presence updates and queued object updates for each presence are sent to clients |
1271 | if (Frame % m_update_presences == 0) | ||
1272 | m_sceneGraph.UpdatePresences(); | ||
1245 | 1273 | ||
1246 | try | 1274 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) |
1275 | if (Frame % m_update_coarse_locations == 0) | ||
1247 | { | 1276 | { |
1248 | // Check if any objects have reached their targets | 1277 | List<Vector3> coarseLocations; |
1249 | CheckAtTargets(); | 1278 | List<UUID> avatarUUIDs; |
1250 | 1279 | SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); | |
1251 | // Update SceneObjectGroups that have scheduled themselves for updates | 1280 | // Send coarse locations to clients |
1252 | // Objects queue their updates onto all scene presences | 1281 | ForEachScenePresence(delegate(ScenePresence presence) |
1253 | if (m_frame % m_update_objects == 0) | 1282 | { |
1254 | m_sceneGraph.UpdateObjectGroups(); | 1283 | presence.SendCoarseLocations(coarseLocations, avatarUUIDs); |
1284 | }); | ||
1285 | } | ||
1255 | 1286 | ||
1256 | // Run through all ScenePresences looking for updates | 1287 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); |
1257 | // Presence updates and queued object updates for each presence are sent to clients | 1288 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1258 | if (m_frame % m_update_presences == 0) | 1289 | m_sceneGraph.UpdatePreparePhysics(); |
1259 | m_sceneGraph.UpdatePresences(); | 1290 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); |
1260 | 1291 | ||
1261 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | 1292 | // Apply any pending avatar force input to the avatar's velocity |
1262 | if (m_frame % m_update_coarse_locations == 0) | 1293 | if (Frame % m_update_entitymovement == 0) |
1263 | { | 1294 | m_sceneGraph.UpdateScenePresenceMovement(); |
1264 | List<Vector3> coarseLocations; | ||
1265 | List<UUID> avatarUUIDs; | ||
1266 | SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); | ||
1267 | // Send coarse locations to clients | ||
1268 | ForEachScenePresence(delegate(ScenePresence presence) | ||
1269 | { | ||
1270 | presence.SendCoarseLocations(coarseLocations, avatarUUIDs); | ||
1271 | }); | ||
1272 | } | ||
1273 | 1295 | ||
1274 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); | 1296 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1275 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) | 1297 | // velocity |
1276 | m_sceneGraph.UpdatePreparePhysics(); | 1298 | int tmpPhysicsMS = Util.EnvironmentTickCount(); |
1277 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); | 1299 | if (Frame % m_update_physics == 0) |
1300 | { | ||
1301 | if (m_physics_enabled) | ||
1302 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); | ||
1303 | if (SynchronizeScene != null) | ||
1304 | SynchronizeScene(this); | ||
1305 | } | ||
1306 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); | ||
1278 | 1307 | ||
1279 | // Apply any pending avatar force input to the avatar's velocity | 1308 | // Delete temp-on-rez stuff |
1280 | if (m_frame % m_update_entitymovement == 0) | 1309 | if (Frame % 1000 == 0 && !m_cleaningTemps) |
1281 | m_sceneGraph.UpdateScenePresenceMovement(); | 1310 | { |
1311 | int tmpTempOnRezMS = Util.EnvironmentTickCount(); | ||
1312 | m_cleaningTemps = true; | ||
1313 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | ||
1314 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | ||
1315 | } | ||
1282 | 1316 | ||
1283 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1317 | if (RegionStatus != RegionStatus.SlaveScene) |
1284 | // velocity | 1318 | { |
1285 | int tmpPhysicsMS = Util.EnvironmentTickCount(); | 1319 | if (Frame % m_update_events == 0) |
1286 | if (m_frame % m_update_physics == 0) | ||
1287 | { | 1320 | { |
1288 | if (m_physics_enabled) | 1321 | int evMS = Util.EnvironmentTickCount(); |
1289 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); | 1322 | UpdateEvents(); |
1290 | if (SynchronizeScene != null) | 1323 | eventMS = Util.EnvironmentTickCountSubtract(evMS); ; |
1291 | SynchronizeScene(this); | ||
1292 | } | 1324 | } |
1293 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); | ||
1294 | 1325 | ||
1295 | // Delete temp-on-rez stuff | 1326 | if (Frame % m_update_backup == 0) |
1296 | if (m_frame % 1000 == 0 && !m_cleaningTemps) | ||
1297 | { | 1327 | { |
1298 | int tmpTempOnRezMS = Util.EnvironmentTickCount(); | 1328 | int backMS = Util.EnvironmentTickCount(); |
1299 | m_cleaningTemps = true; | 1329 | UpdateStorageBackup(); |
1300 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | 1330 | backupMS = Util.EnvironmentTickCountSubtract(backMS); |
1301 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | ||
1302 | } | 1331 | } |
1303 | 1332 | ||
1304 | if (RegionStatus != RegionStatus.SlaveScene) | 1333 | if (Frame % m_update_terrain == 0) |
1305 | { | 1334 | { |
1306 | if (m_frame % m_update_events == 0) | 1335 | int terMS = Util.EnvironmentTickCount(); |
1307 | { | 1336 | UpdateTerrain(); |
1308 | int evMS = Util.EnvironmentTickCount(); | 1337 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); |
1309 | UpdateEvents(); | ||
1310 | eventMS = Util.EnvironmentTickCountSubtract(evMS); ; | ||
1311 | } | ||
1312 | |||
1313 | if (m_frame % m_update_backup == 0) | ||
1314 | { | ||
1315 | int backMS = Util.EnvironmentTickCount(); | ||
1316 | UpdateStorageBackup(); | ||
1317 | backupMS = Util.EnvironmentTickCountSubtract(backMS); | ||
1318 | } | ||
1319 | |||
1320 | if (m_frame % m_update_terrain == 0) | ||
1321 | { | ||
1322 | int terMS = Util.EnvironmentTickCount(); | ||
1323 | UpdateTerrain(); | ||
1324 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | ||
1325 | } | ||
1326 | |||
1327 | if (m_frame % m_update_land == 0) | ||
1328 | { | ||
1329 | int ldMS = Util.EnvironmentTickCount(); | ||
1330 | UpdateLand(); | ||
1331 | landMS = Util.EnvironmentTickCountSubtract(ldMS); | ||
1332 | } | ||
1333 | |||
1334 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); | ||
1335 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1336 | lastCompletedFrame = Util.EnvironmentTickCount(); | ||
1337 | |||
1338 | // if (m_frame%m_update_avatars == 0) | ||
1339 | // UpdateInWorldTime(); | ||
1340 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1341 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1342 | StatsReporter.AddFPS(1); | ||
1343 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | ||
1344 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); | ||
1345 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | ||
1346 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | ||
1347 | StatsReporter.addFrameMS(frameMS); | ||
1348 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1349 | StatsReporter.addOtherMS(otherMS); | ||
1350 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | ||
1351 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1352 | } | 1338 | } |
1353 | 1339 | ||
1354 | if (LoginsDisabled && m_frame == 20) | 1340 | if (Frame % m_update_land == 0) |
1355 | { | 1341 | { |
1356 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | 1342 | int ldMS = Util.EnvironmentTickCount(); |
1357 | // this is a rare case where we know we have just went through a long cycle of heap | 1343 | UpdateLand(); |
1358 | // allocations, and there is no more work to be done until someone logs in | 1344 | landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1359 | GC.Collect(); | 1345 | } |
1360 | 1346 | ||
1361 | IConfig startupConfig = m_config.Configs["Startup"]; | 1347 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); |
1362 | if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) | 1348 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; |
1363 | { | 1349 | lastCompletedFrame = Util.EnvironmentTickCount(); |
1364 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | 1350 | |
1365 | LoginsDisabled = false; | 1351 | // if (Frame%m_update_avatars == 0) |
1366 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1352 | // UpdateInWorldTime(); |
1367 | } | 1353 | StatsReporter.AddPhysicsFPS(physicsFPS); |
1354 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1355 | StatsReporter.AddFPS(1); | ||
1356 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | ||
1357 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); | ||
1358 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | ||
1359 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | ||
1360 | StatsReporter.addFrameMS(frameMS); | ||
1361 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1362 | StatsReporter.addOtherMS(otherMS); | ||
1363 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | ||
1364 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1365 | } | ||
1366 | |||
1367 | if (LoginsDisabled && Frame == 20) | ||
1368 | { | ||
1369 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | ||
1370 | // this is a rare case where we know we have just went through a long cycle of heap | ||
1371 | // allocations, and there is no more work to be done until someone logs in | ||
1372 | GC.Collect(); | ||
1373 | |||
1374 | IConfig startupConfig = m_config.Configs["Startup"]; | ||
1375 | if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) | ||
1376 | { | ||
1377 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | ||
1378 | LoginsDisabled = false; | ||
1379 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | ||
1368 | } | 1380 | } |
1369 | } | 1381 | } |
1370 | catch (NotImplementedException) | 1382 | } |
1371 | { | 1383 | catch (NotImplementedException) |
1372 | throw; | 1384 | { |
1373 | } | 1385 | throw; |
1374 | catch (AccessViolationException e) | 1386 | } |
1375 | { | 1387 | catch (AccessViolationException e) |
1376 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1388 | { |
1377 | } | 1389 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1378 | //catch (NullReferenceException e) | 1390 | } |
1379 | //{ | 1391 | //catch (NullReferenceException e) |
1380 | // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1392 | //{ |
1381 | //} | 1393 | // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1382 | catch (InvalidOperationException e) | 1394 | //} |
1383 | { | 1395 | catch (InvalidOperationException e) |
1384 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1396 | { |
1385 | } | 1397 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1386 | catch (Exception e) | 1398 | } |
1387 | { | 1399 | catch (Exception e) |
1388 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1400 | { |
1389 | } | 1401 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1390 | finally | 1402 | } |
1391 | { | 1403 | finally |
1392 | m_lastupdate = DateTime.UtcNow; | 1404 | { |
1393 | } | 1405 | m_lastupdate = DateTime.UtcNow; |
1406 | } | ||
1394 | 1407 | ||
1395 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1408 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1396 | maintc = (int)(m_timespan * 1000) - maintc; | 1409 | maintc = (int)(m_timespan * 1000) - maintc; |
1397 | 1410 | ||
1398 | if (maintc > 0) | ||
1399 | Thread.Sleep(maintc); | ||
1400 | 1411 | ||
1401 | // Tell the watchdog that this thread is still alive | 1412 | m_lastUpdate = Util.EnvironmentTickCount(); |
1402 | Watchdog.UpdateThread(); | 1413 | m_firstHeartbeat = false; |
1403 | 1414 | ||
1404 | m_lastUpdate = Util.EnvironmentTickCount(); | 1415 | if (maintc > 0) |
1405 | m_firstHeartbeat = false; | 1416 | Thread.Sleep(maintc); |
1406 | } | ||
1407 | } | ||
1408 | 1417 | ||
1409 | 1418 | // Tell the watchdog that this thread is still alive | |
1419 | Watchdog.UpdateThread(); | ||
1420 | } | ||
1410 | 1421 | ||
1411 | public void AddGroupTarget(SceneObjectGroup grp) | 1422 | public void AddGroupTarget(SceneObjectGroup grp) |
1412 | { | 1423 | { |
@@ -3125,7 +3136,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3125 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); | 3136 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); |
3126 | 3137 | ||
3127 | m_sceneGraph.removeUserCount(!childagentYN); | 3138 | m_sceneGraph.removeUserCount(!childagentYN); |
3128 | CapsModule.RemoveCapsHandler(agentID); | 3139 | |
3140 | if (CapsModule != null) | ||
3141 | CapsModule.RemoveCapsHandler(agentID); | ||
3129 | 3142 | ||
3130 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3143 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3131 | // this method is doing is HORRIBLE!!! | 3144 | // this method is doing is HORRIBLE!!! |
@@ -3329,7 +3342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3329 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport | 3342 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport |
3330 | 3343 | ||
3331 | // Don't disable this log message - it's too helpful | 3344 | // Don't disable this log message - it's too helpful |
3332 | m_log.InfoFormat( | 3345 | m_log.DebugFormat( |
3333 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", | 3346 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", |
3334 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3347 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3335 | agent.AgentID, agent.circuitcode, teleportFlags); | 3348 | agent.AgentID, agent.circuitcode, teleportFlags); |
@@ -3403,8 +3416,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3403 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3416 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3404 | agent.AgentID, agent.circuitcode); | 3417 | agent.AgentID, agent.circuitcode); |
3405 | 3418 | ||
3406 | CapsModule.NewUserConnection(agent); | 3419 | if (CapsModule != null) |
3407 | CapsModule.AddCapsHandler(agent.AgentID); | 3420 | { |
3421 | CapsModule.NewUserConnection(agent); | ||
3422 | CapsModule.AddCapsHandler(agent.AgentID); | ||
3423 | } | ||
3408 | } | 3424 | } |
3409 | else | 3425 | else |
3410 | { | 3426 | { |
@@ -3419,7 +3435,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3419 | agent.AgentID, RegionInfo.RegionName); | 3435 | agent.AgentID, RegionInfo.RegionName); |
3420 | 3436 | ||
3421 | sp.AdjustKnownSeeds(); | 3437 | sp.AdjustKnownSeeds(); |
3422 | CapsModule.NewUserConnection(agent); | 3438 | |
3439 | if (CapsModule != null) | ||
3440 | CapsModule.NewUserConnection(agent); | ||
3423 | } | 3441 | } |
3424 | } | 3442 | } |
3425 | 3443 | ||
@@ -3506,6 +3524,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3506 | private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) | 3524 | private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3507 | { | 3525 | { |
3508 | reason = String.Empty; | 3526 | reason = String.Empty; |
3527 | if (Permissions.IsGod(agentID)) | ||
3528 | return true; | ||
3509 | 3529 | ||
3510 | ILandObject land = LandChannel.GetLandObject(posX, posY); | 3530 | ILandObject land = LandChannel.GetLandObject(posX, posY); |
3511 | if (land == null) | 3531 | if (land == null) |
@@ -3931,15 +3951,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3931 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 3951 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
3932 | Vector3 lookat, uint teleportFlags) | 3952 | Vector3 lookat, uint teleportFlags) |
3933 | { | 3953 | { |
3934 | GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); | 3954 | List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); |
3935 | if (regionInfo == null) | 3955 | if (regions == null || regions.Count == 0) |
3936 | { | 3956 | { |
3937 | // can't find the region: Tell viewer and abort | 3957 | // can't find the region: Tell viewer and abort |
3938 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); | 3958 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); |
3939 | return; | 3959 | return; |
3940 | } | 3960 | } |
3941 | 3961 | ||
3942 | RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); | 3962 | RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); |
3943 | } | 3963 | } |
3944 | 3964 | ||
3945 | /// <summary> | 3965 | /// <summary> |
@@ -5143,9 +5163,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5143 | // from logging into the region, teleporting into the region | 5163 | // from logging into the region, teleporting into the region |
5144 | // or corssing the broder walking, but will NOT prevent | 5164 | // or corssing the broder walking, but will NOT prevent |
5145 | // child agent creation, thereby emulating the SL behavior. | 5165 | // child agent creation, thereby emulating the SL behavior. |
5146 | public bool QueryAccess(UUID agentID, Vector3 position) | 5166 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5147 | { | 5167 | { |
5148 | string reason; | 5168 | reason = "You are banned from the region"; |
5169 | |||
5170 | if (Permissions.IsGod(agentID)) | ||
5171 | { | ||
5172 | reason = String.Empty; | ||
5173 | return true; | ||
5174 | } | ||
5149 | 5175 | ||
5150 | if (!AuthorizeUser(agentID, out reason)) | 5176 | if (!AuthorizeUser(agentID, out reason)) |
5151 | { | 5177 | { |
@@ -5176,6 +5202,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5176 | if (banned || restricted) | 5202 | if (banned || restricted) |
5177 | return false; | 5203 | return false; |
5178 | } | 5204 | } |
5205 | |||
5206 | reason = String.Empty; | ||
5179 | return true; | 5207 | return true; |
5180 | } | 5208 | } |
5181 | } | 5209 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c8af4c3..19cb0c1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -189,7 +189,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); | 192 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest); |
193 | |||
193 | 194 | ||
194 | /// <summary> | 195 | /// <summary> |
195 | /// This informs all neighboring regions about the settings of it's child agent. | 196 | /// This informs all neighboring regions about the settings of it's child agent. |
@@ -198,31 +199,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
198 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. | 199 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. |
199 | /// | 200 | /// |
200 | /// </summary> | 201 | /// </summary> |
201 | private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) | 202 | private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, GridRegion dest) |
202 | { | 203 | { |
203 | //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); | 204 | //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); |
204 | try | 205 | try |
205 | { | 206 | { |
206 | //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); | 207 | m_scene.SimulationService.UpdateAgent(dest, cAgentData); |
207 | uint x = 0, y = 0; | ||
208 | Utils.LongToUInts(regionHandle, out x, out y); | ||
209 | GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
210 | m_scene.SimulationService.UpdateAgent(destination, cAgentData); | ||
211 | } | 208 | } |
212 | catch | 209 | catch |
213 | { | 210 | { |
214 | // Ignore; we did our best | 211 | // Ignore; we did our best |
215 | } | 212 | } |
216 | |||
217 | //if (regionAccepted) | ||
218 | //{ | ||
219 | // //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent"); | ||
220 | //} | ||
221 | //else | ||
222 | //{ | ||
223 | // //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent"); | ||
224 | //} | ||
225 | |||
226 | } | 213 | } |
227 | 214 | ||
228 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) | 215 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) |
@@ -236,14 +223,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
236 | // This assumes that we know what our neighbors are. | 223 | // This assumes that we know what our neighbors are. |
237 | try | 224 | try |
238 | { | 225 | { |
226 | uint x = 0, y = 0; | ||
227 | List<string> simulatorList = new List<string>(); | ||
239 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) | 228 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) |
240 | { | 229 | { |
241 | if (regionHandle != m_regionInfo.RegionHandle) | 230 | if (regionHandle != m_regionInfo.RegionHandle) |
242 | { | 231 | { |
243 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | 232 | // we only want to send one update to each simulator; the simulator will |
244 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, | 233 | // hand it off to the regions where a child agent exists, this does assume |
245 | SendChildAgentDataUpdateCompleted, | 234 | // that the region position is cached or performance will degrade |
246 | d); | 235 | Utils.LongToUInts(regionHandle, out x, out y); |
236 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
237 | if (! simulatorList.Contains(dest.ServerURI)) | ||
238 | { | ||
239 | // we havent seen this simulator before, add it to the list | ||
240 | // and send it an update | ||
241 | simulatorList.Add(dest.ServerURI); | ||
242 | |||
243 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | ||
244 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, | ||
245 | SendChildAgentDataUpdateCompleted, | ||
246 | d); | ||
247 | } | ||
247 | } | 248 | } |
248 | } | 249 | } |
249 | } | 250 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 92fe2ab..e8cf4f4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -218,9 +218,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
218 | for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) | 218 | for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) |
219 | { | 219 | { |
220 | ScenePresence sp = presences[i]; | 220 | ScenePresence sp = presences[i]; |
221 | |||
221 | // If this presence is a child agent, we don't want its coarse locations | 222 | // If this presence is a child agent, we don't want its coarse locations |
222 | if (sp.IsChildAgent) | 223 | if (sp.IsChildAgent) |
223 | return; | 224 | continue; |
224 | 225 | ||
225 | if (sp.ParentID != 0) | 226 | if (sp.ParentID != 0) |
226 | { | 227 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6496a25..9b9f280 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2093,8 +2093,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2093 | 2093 | ||
2094 | public void GetProperties(IClientAPI client) | 2094 | public void GetProperties(IClientAPI client) |
2095 | { | 2095 | { |
2096 | //Viewer wants date in microseconds so multiply it by 1,000,000. | ||
2096 | client.SendObjectPropertiesReply( | 2097 | client.SendObjectPropertiesReply( |
2097 | m_fromUserInventoryItemID, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero, | 2098 | m_fromUserInventoryItemID, (ulong)_creationDate*(ulong)1e6, _creatorID, UUID.Zero, UUID.Zero, |
2098 | _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, | 2099 | _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, |
2099 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, | 2100 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, |
2100 | ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, | 2101 | ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, |
@@ -2141,7 +2142,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2141 | { | 2142 | { |
2142 | Quaternion newRot; | 2143 | Quaternion newRot; |
2143 | 2144 | ||
2144 | if (this.LinkNum < 2) //KF Single or root prim | 2145 | if (this.LinkNum == 0 || this.LinkNum == 1) |
2145 | { | 2146 | { |
2146 | newRot = RotationOffset; | 2147 | newRot = RotationOffset; |
2147 | } | 2148 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 7e59b10..854f1dc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1287,9 +1287,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1287 | 1287 | ||
1288 | public Dictionary<UUID, string> GetScriptStates(bool oldIDs) | 1288 | public Dictionary<UUID, string> GetScriptStates(bool oldIDs) |
1289 | { | 1289 | { |
1290 | Dictionary<UUID, string> ret = new Dictionary<UUID, string>(); | ||
1291 | |||
1292 | if (m_part.ParentGroup.Scene == null) // Group not in a scene | ||
1293 | return ret; | ||
1294 | |||
1290 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 1295 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
1291 | 1296 | ||
1292 | Dictionary<UUID, string> ret = new Dictionary<UUID, string>(); | ||
1293 | if (engines == null) // No engine at all | 1297 | if (engines == null) // No engine at all |
1294 | return ret; | 1298 | return ret; |
1295 | 1299 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b87275c..3a5b05d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -123,7 +123,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
123 | private SceneObjectGroup proxyObjectGroup; | 123 | private SceneObjectGroup proxyObjectGroup; |
124 | //private SceneObjectPart proxyObjectPart = null; | 124 | //private SceneObjectPart proxyObjectPart = null; |
125 | public Vector3 lastKnownAllowedPosition; | 125 | public Vector3 lastKnownAllowedPosition; |
126 | public bool sentMessageAboutRestrictedParcelFlyingDown; | ||
127 | public Vector4 CollisionPlane = Vector4.UnitW; | 126 | public Vector4 CollisionPlane = Vector4.UnitW; |
128 | 127 | ||
129 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation | 128 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation |
@@ -691,7 +690,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
691 | Utils.LongToUInts(handle, out x, out y); | 690 | Utils.LongToUInts(handle, out x, out y); |
692 | x = x / Constants.RegionSize; | 691 | x = x / Constants.RegionSize; |
693 | y = y / Constants.RegionSize; | 692 | y = y / Constants.RegionSize; |
694 | if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | 693 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) |
695 | { | 694 | { |
696 | old.Add(handle); | 695 | old.Add(handle); |
697 | } | 696 | } |
@@ -765,6 +764,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
765 | 764 | ||
766 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | 765 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() |
767 | { | 766 | { |
767 | m_DrawDistance = world.DefaultDrawDistance; | ||
768 | m_rootRegionHandle = reginfo.RegionHandle; | 768 | m_rootRegionHandle = reginfo.RegionHandle; |
769 | m_controllingClient = client; | 769 | m_controllingClient = client; |
770 | m_firstname = m_controllingClient.FirstName; | 770 | m_firstname = m_controllingClient.FirstName; |
@@ -1311,7 +1311,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1311 | if (m_agentTransfer != null) | 1311 | if (m_agentTransfer != null) |
1312 | m_agentTransfer.EnableChildAgents(this); | 1312 | m_agentTransfer.EnableChildAgents(this); |
1313 | else | 1313 | else |
1314 | m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); | 1314 | m_log.DebugFormat( |
1315 | "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}", | ||
1316 | m_scene.RegionInfo.RegionName); | ||
1315 | 1317 | ||
1316 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 1318 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
1317 | if (friendsModule != null) | 1319 | if (friendsModule != null) |
@@ -1428,7 +1430,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1428 | m_CameraUpAxis = agentData.CameraUpAxis; | 1430 | m_CameraUpAxis = agentData.CameraUpAxis; |
1429 | 1431 | ||
1430 | // The Agent's Draw distance setting | 1432 | // The Agent's Draw distance setting |
1431 | m_DrawDistance = agentData.Far; | 1433 | // When we get to the point of re-computing neighbors everytime this |
1434 | // changes, then start using the agent's drawdistance rather than the | ||
1435 | // region's draw distance. | ||
1436 | // m_DrawDistance = agentData.Far; | ||
1437 | m_DrawDistance = Scene.DefaultDrawDistance; | ||
1432 | 1438 | ||
1433 | // Check if Client has camera in 'follow cam' or 'build' mode. | 1439 | // Check if Client has camera in 'follow cam' or 'build' mode. |
1434 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); | 1440 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); |
@@ -2853,7 +2859,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2853 | // If we are using the the cached appearance then send it out to everyone | 2859 | // If we are using the the cached appearance then send it out to everyone |
2854 | if (cachedappearance) | 2860 | if (cachedappearance) |
2855 | { | 2861 | { |
2856 | m_log.InfoFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); | 2862 | m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); |
2857 | 2863 | ||
2858 | // If the avatars baked textures are all in the cache, then we have a | 2864 | // If the avatars baked textures are all in the cache, then we have a |
2859 | // complete appearance... send it out, if not, then we'll send it when | 2865 | // complete appearance... send it out, if not, then we'll send it when |
@@ -3070,8 +3076,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3070 | #region Border Crossing Methods | 3076 | #region Border Crossing Methods |
3071 | 3077 | ||
3072 | /// <summary> | 3078 | /// <summary> |
3073 | /// Checks to see if the avatar is in range of a border and calls CrossToNewRegion | 3079 | /// Starts the process of moving an avatar into another region if they are crossing the border. |
3074 | /// </summary> | 3080 | /// </summary> |
3081 | /// <remarks> | ||
3082 | /// Also removes the avatar from the physical scene if transit has started. | ||
3083 | /// </remarks> | ||
3075 | protected void CheckForBorderCrossing() | 3084 | protected void CheckForBorderCrossing() |
3076 | { | 3085 | { |
3077 | if (IsChildAgent) | 3086 | if (IsChildAgent) |
@@ -3139,7 +3148,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3139 | neighbor = HaveNeighbor(Cardinals.N, ref fix); | 3148 | neighbor = HaveNeighbor(Cardinals.N, ref fix); |
3140 | } | 3149 | } |
3141 | 3150 | ||
3142 | |||
3143 | // Makes sure avatar does not end up outside region | 3151 | // Makes sure avatar does not end up outside region |
3144 | if (neighbor <= 0) | 3152 | if (neighbor <= 0) |
3145 | { | 3153 | { |
@@ -3194,6 +3202,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3194 | } | 3202 | } |
3195 | else | 3203 | else |
3196 | { | 3204 | { |
3205 | // We must remove the agent from the physical scene if it has been placed in transit. If we don't, | ||
3206 | // then this method continues to be called from ScenePresence.Update() until the handover of the client between | ||
3207 | // regions is completed. Since this handover can take more than 1000ms (due to the 1000ms | ||
3208 | // event queue polling response from the server), this results in the avatar pausing on the border | ||
3209 | // for the handover period. | ||
3210 | RemoveFromPhysicalScene(); | ||
3211 | |||
3197 | // This constant has been inferred from experimentation | 3212 | // This constant has been inferred from experimentation |
3198 | // I'm not sure what this value should be, so I tried a few values. | 3213 | // I'm not sure what this value should be, so I tried a few values. |
3199 | timeStep = 0.04f; | 3214 | timeStep = 0.04f; |
@@ -3205,6 +3220,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3205 | } | 3220 | } |
3206 | } | 3221 | } |
3207 | 3222 | ||
3223 | /// <summary> | ||
3224 | /// Checks whether this region has a neighbour in the given direction. | ||
3225 | /// </summary> | ||
3226 | /// <param name="car"></param> | ||
3227 | /// <param name="fix"></param> | ||
3228 | /// <returns> | ||
3229 | /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8. | ||
3230 | /// Returns a positive integer if there is a region in that direction, a negative integer if not. | ||
3231 | /// </returns> | ||
3208 | protected int HaveNeighbor(Cardinals car, ref int[] fix) | 3232 | protected int HaveNeighbor(Cardinals car, ref int[] fix) |
3209 | { | 3233 | { |
3210 | uint neighbourx = m_regionInfo.RegionLocX; | 3234 | uint neighbourx = m_regionInfo.RegionLocX; |
@@ -3311,7 +3335,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3311 | 3335 | ||
3312 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3336 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3313 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3337 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |
3314 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | 3338 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) |
3315 | { | 3339 | { |
3316 | byebyeRegions.Add(handle); | 3340 | byebyeRegions.Add(handle); |
3317 | } | 3341 | } |
@@ -3387,7 +3411,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3387 | 3411 | ||
3388 | Vector3 offset = new Vector3(shiftx, shifty, 0f); | 3412 | Vector3 offset = new Vector3(shiftx, shifty, 0f); |
3389 | 3413 | ||
3390 | m_DrawDistance = cAgentData.Far; | 3414 | // When we get to the point of re-computing neighbors everytime this |
3415 | // changes, then start using the agent's drawdistance rather than the | ||
3416 | // region's draw distance. | ||
3417 | // m_DrawDistance = cAgentData.Far; | ||
3418 | m_DrawDistance = Scene.DefaultDrawDistance; | ||
3419 | |||
3391 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! | 3420 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! |
3392 | m_pos = cAgentData.Position + offset; | 3421 | m_pos = cAgentData.Position + offset; |
3393 | 3422 | ||
@@ -3538,7 +3567,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3538 | m_CameraLeftAxis = cAgent.LeftAxis; | 3567 | m_CameraLeftAxis = cAgent.LeftAxis; |
3539 | m_CameraUpAxis = cAgent.UpAxis; | 3568 | m_CameraUpAxis = cAgent.UpAxis; |
3540 | 3569 | ||
3541 | m_DrawDistance = cAgent.Far; | 3570 | // When we get to the point of re-computing neighbors everytime this |
3571 | // changes, then start using the agent's drawdistance rather than the | ||
3572 | // region's draw distance. | ||
3573 | // m_DrawDistance = cAgent.Far; | ||
3574 | m_DrawDistance = Scene.DefaultDrawDistance; | ||
3542 | 3575 | ||
3543 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) | 3576 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) |
3544 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); | 3577 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 40a73a9..1f4ec96 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -205,6 +205,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
205 | Reset(); | 205 | Reset(); |
206 | } | 206 | } |
207 | 207 | ||
208 | public int GetPendingObjectsCount() | ||
209 | { | ||
210 | if (m_pendingObjects != null) | ||
211 | return m_pendingObjects.Count; | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
208 | public class ScenePartUpdate | 216 | public class ScenePartUpdate |
209 | { | 217 | { |
210 | public UUID FullID; | 218 | public UUID FullID; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs new file mode 100644 index 0000000..855b589 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Timer=System.Timers.Timer; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
44 | using OpenSim.Tests.Common; | ||
45 | using OpenSim.Tests.Common.Mock; | ||
46 | using OpenSim.Tests.Common.Setup; | ||
47 | |||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// Attachment tests | ||
52 | /// </summary> | ||
53 | [TestFixture] | ||
54 | public class AttachmentTests | ||
55 | { | ||
56 | public Scene scene, scene2; | ||
57 | public UUID agent1; | ||
58 | public static Random random; | ||
59 | public ulong region1, region2; | ||
60 | public AgentCircuitData acd1; | ||
61 | public SceneObjectGroup sog1, sog2, sog3; | ||
62 | |||
63 | [TestFixtureSetUp] | ||
64 | public void Init() | ||
65 | { | ||
66 | TestHelper.InMethod(); | ||
67 | |||
68 | scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | ||
69 | scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | ||
70 | |||
71 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | ||
72 | interregionComms.Initialise(new IniConfigSource()); | ||
73 | interregionComms.PostInitialise(); | ||
74 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); | ||
75 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); | ||
76 | |||
77 | agent1 = UUID.Random(); | ||
78 | random = new Random(); | ||
79 | sog1 = NewSOG(UUID.Random(), scene, agent1); | ||
80 | sog2 = NewSOG(UUID.Random(), scene, agent1); | ||
81 | sog3 = NewSOG(UUID.Random(), scene, agent1); | ||
82 | |||
83 | //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | ||
84 | region1 = scene.RegionInfo.RegionHandle; | ||
85 | region2 = scene2.RegionInfo.RegionHandle; | ||
86 | |||
87 | SceneSetupHelpers.AddRootAgent(scene, agent1); | ||
88 | } | ||
89 | |||
90 | [Test] | ||
91 | public void T030_TestAddAttachments() | ||
92 | { | ||
93 | TestHelper.InMethod(); | ||
94 | |||
95 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
96 | |||
97 | presence.AddAttachment(sog1); | ||
98 | presence.AddAttachment(sog2); | ||
99 | presence.AddAttachment(sog3); | ||
100 | |||
101 | Assert.That(presence.HasAttachments(), Is.True); | ||
102 | Assert.That(presence.ValidateAttachments(), Is.True); | ||
103 | } | ||
104 | |||
105 | [Test] | ||
106 | public void T031_RemoveAttachments() | ||
107 | { | ||
108 | TestHelper.InMethod(); | ||
109 | |||
110 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
111 | presence.RemoveAttachment(sog1); | ||
112 | presence.RemoveAttachment(sog2); | ||
113 | presence.RemoveAttachment(sog3); | ||
114 | Assert.That(presence.HasAttachments(), Is.False); | ||
115 | } | ||
116 | |||
117 | // I'm commenting this test because scene setup NEEDS InventoryService to | ||
118 | // be non-null | ||
119 | //[Test] | ||
120 | public void T032_CrossAttachments() | ||
121 | { | ||
122 | TestHelper.InMethod(); | ||
123 | |||
124 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
125 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
126 | presence2.AddAttachment(sog1); | ||
127 | presence2.AddAttachment(sog2); | ||
128 | |||
129 | ISharedRegionModule serialiser = new SerialiserModule(); | ||
130 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
131 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
132 | |||
133 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
134 | |||
135 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | ||
136 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | ||
137 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | ||
138 | } | ||
139 | |||
140 | private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) | ||
141 | { | ||
142 | SceneObjectPart sop = new SceneObjectPart(); | ||
143 | sop.Name = RandomName(); | ||
144 | sop.Description = RandomName(); | ||
145 | sop.Text = RandomName(); | ||
146 | sop.SitName = RandomName(); | ||
147 | sop.TouchName = RandomName(); | ||
148 | sop.UUID = uuid; | ||
149 | sop.Shape = PrimitiveBaseShape.Default; | ||
150 | sop.Shape.State = 1; | ||
151 | sop.OwnerID = agent; | ||
152 | |||
153 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
154 | sog.SetScene(scene); | ||
155 | |||
156 | return sog; | ||
157 | } | ||
158 | |||
159 | private static string RandomName() | ||
160 | { | ||
161 | StringBuilder name = new StringBuilder(); | ||
162 | int size = random.Next(5,12); | ||
163 | char ch; | ||
164 | for (int i = 0; i < size; i++) | ||
165 | { | ||
166 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
167 | name.Append(ch); | ||
168 | } | ||
169 | |||
170 | return name.ToString(); | ||
171 | } | ||
172 | } | ||
173 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index b3c3e22..667b74e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -32,7 +32,6 @@ using System.Text; | |||
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using NUnit.Framework; | 34 | using NUnit.Framework; |
35 | using NUnit.Framework.SyntaxHelpers; | ||
36 | using OpenMetaverse; | 35 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 9244bc3..ca635d7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | ||
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 33 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 4969b09..a6a95ef 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | ||
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 33 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 39116b6..0d26026 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -30,7 +30,6 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using NUnit.Framework.SyntaxHelpers; | ||
34 | using OpenMetaverse; | 33 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index b84298f..bdfcd1d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using NUnit.Framework; | 31 | using NUnit.Framework; |
32 | using NUnit.Framework.SyntaxHelpers; | ||
33 | using OpenMetaverse; | 32 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index c78038f..8876a43 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -30,7 +30,6 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using NUnit.Framework.SyntaxHelpers; | ||
34 | using OpenMetaverse; | 33 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ef52363..efb757f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -34,12 +34,12 @@ using System.Timers; | |||
34 | using Timer=System.Timers.Timer; | 34 | using Timer=System.Timers.Timer; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenMetaverse; | 37 | using OpenMetaverse; |
39 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 43 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
@@ -116,9 +116,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | 116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); |
117 | agent.child = true; | 117 | agent.child = true; |
118 | 118 | ||
119 | if (scene.PresenceService == null) | ||
120 | Console.WriteLine("Presence Service is null"); | ||
121 | |||
122 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); | 119 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); |
123 | 120 | ||
124 | string reason; | 121 | string reason; |
@@ -175,25 +172,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
175 | 172 | ||
176 | Assert.That(neighbours.Count, Is.EqualTo(2)); | 173 | Assert.That(neighbours.Count, Is.EqualTo(2)); |
177 | } | 174 | } |
178 | |||
179 | public void fixNullPresence() | ||
180 | { | ||
181 | string firstName = "testfirstname"; | ||
182 | |||
183 | AgentCircuitData agent = new AgentCircuitData(); | ||
184 | agent.AgentID = agent1; | ||
185 | agent.firstname = firstName; | ||
186 | agent.lastname = "testlastname"; | ||
187 | agent.SessionID = UUID.Zero; | ||
188 | agent.SecureSessionID = UUID.Zero; | ||
189 | agent.circuitcode = 123; | ||
190 | agent.BaseFolder = UUID.Zero; | ||
191 | agent.InventoryFolder = UUID.Zero; | ||
192 | agent.startpos = Vector3.Zero; | ||
193 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
194 | |||
195 | acd1 = agent; | ||
196 | } | ||
197 | 175 | ||
198 | [Test] | 176 | [Test] |
199 | public void T013_TestRemoveNeighbourRegion() | 177 | public void T013_TestRemoveNeighbourRegion() |
@@ -211,24 +189,36 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
211 | CompleteAvatarMovement | 189 | CompleteAvatarMovement |
212 | */ | 190 | */ |
213 | } | 191 | } |
214 | 192 | ||
215 | // I'm commenting this test, because this is not supposed to happen here | 193 | /// <summary> |
216 | //[Test] | 194 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
217 | public void T020_TestMakeRootAgent() | 195 | /// </summary> |
196 | /// <remarks> | ||
197 | /// Please note that unlike the other tests here, this doesn't rely on structures | ||
198 | /// </remarks> | ||
199 | [Test] | ||
200 | public void TestChildAgentEstablished() | ||
218 | { | 201 | { |
219 | TestHelper.InMethod(); | 202 | TestHelper.InMethod(); |
220 | 203 | // log4net.Config.XmlConfigurator.Configure(); | |
221 | ScenePresence presence = scene.GetScenePresence(agent1); | 204 | |
222 | Assert.That(presence.IsChildAgent, Is.False, "Starts out as a root agent"); | 205 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
223 | 206 | ||
224 | presence.MakeChildAgent(); | 207 | TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
225 | Assert.That(presence.IsChildAgent, Is.True, "Did not change to child agent after MakeChildAgent"); | 208 | TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
226 | 209 | ||
227 | // Accepts 0 but rejects Constants.RegionSize | 210 | IConfigSource configSource = new IniConfigSource(); |
228 | Vector3 pos = new Vector3(0,unchecked(Constants.RegionSize-1),0); | 211 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); |
229 | presence.MakeRootAgent(pos,true); | 212 | EntityTransferModule etm = new EntityTransferModule(); |
230 | Assert.That(presence.IsChildAgent, Is.False, "Did not go back to root agent"); | 213 | |
231 | Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered"); | 214 | SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); |
215 | |||
216 | SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); | ||
217 | ScenePresence childPresence = myScene2.GetScenePresence(agent1); | ||
218 | |||
219 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | ||
220 | // Assert.That(childPresence, Is.Not.Null); | ||
221 | // Assert.That(childPresence.IsChildAgent, Is.True); | ||
232 | } | 222 | } |
233 | 223 | ||
234 | // I'm commenting this test because it does not represent | 224 | // I'm commenting this test because it does not represent |
@@ -333,63 +323,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
333 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); | 323 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); |
334 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); | 324 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); |
335 | } | 325 | } |
336 | 326 | ||
337 | [Test] | 327 | public void fixNullPresence() |
338 | public void T030_TestAddAttachments() | ||
339 | { | ||
340 | TestHelper.InMethod(); | ||
341 | |||
342 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
343 | |||
344 | presence.AddAttachment(sog1); | ||
345 | presence.AddAttachment(sog2); | ||
346 | presence.AddAttachment(sog3); | ||
347 | |||
348 | Assert.That(presence.HasAttachments(), Is.True); | ||
349 | Assert.That(presence.ValidateAttachments(), Is.True); | ||
350 | } | ||
351 | |||
352 | [Test] | ||
353 | public void T031_RemoveAttachments() | ||
354 | { | ||
355 | TestHelper.InMethod(); | ||
356 | |||
357 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
358 | presence.RemoveAttachment(sog1); | ||
359 | presence.RemoveAttachment(sog2); | ||
360 | presence.RemoveAttachment(sog3); | ||
361 | Assert.That(presence.HasAttachments(), Is.False); | ||
362 | } | ||
363 | |||
364 | // I'm commenting this test because scene setup NEEDS InventoryService to | ||
365 | // be non-null | ||
366 | //[Test] | ||
367 | public void T032_CrossAttachments() | ||
368 | { | 328 | { |
369 | TestHelper.InMethod(); | 329 | string firstName = "testfirstname"; |
370 | |||
371 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
372 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
373 | presence2.AddAttachment(sog1); | ||
374 | presence2.AddAttachment(sog2); | ||
375 | |||
376 | ISharedRegionModule serialiser = new SerialiserModule(); | ||
377 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
378 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
379 | |||
380 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
381 | 330 | ||
382 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | 331 | AgentCircuitData agent = new AgentCircuitData(); |
383 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | 332 | agent.AgentID = agent1; |
384 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | 333 | agent.firstname = firstName; |
385 | } | 334 | agent.lastname = "testlastname"; |
335 | agent.SessionID = UUID.Zero; | ||
336 | agent.SecureSessionID = UUID.Zero; | ||
337 | agent.circuitcode = 123; | ||
338 | agent.BaseFolder = UUID.Zero; | ||
339 | agent.InventoryFolder = UUID.Zero; | ||
340 | agent.startpos = Vector3.Zero; | ||
341 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
386 | 342 | ||
387 | [TearDown] | 343 | acd1 = agent; |
388 | public void TearDown() | ||
389 | { | ||
390 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | ||
391 | } | 344 | } |
392 | 345 | ||
393 | public static string GetRandomCapsObjectPath() | 346 | public static string GetRandomCapsObjectPath() |
394 | { | 347 | { |
395 | UUID caps = UUID.Random(); | 348 | UUID caps = UUID.Random(); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs new file mode 100644 index 0000000..abcce66 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Timer=System.Timers.Timer; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
44 | using OpenSim.Tests.Common; | ||
45 | using OpenSim.Tests.Common.Mock; | ||
46 | using OpenSim.Tests.Common.Setup; | ||
47 | |||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// Scene presence tests | ||
52 | /// </summary> | ||
53 | [TestFixture] | ||
54 | public class SceneTests | ||
55 | { | ||
56 | /// <summary> | ||
57 | /// Very basic scene update test. Should become more elaborate with time. | ||
58 | /// </summary> | ||
59 | [Test] | ||
60 | public void TestUpdateScene() | ||
61 | { | ||
62 | TestHelper.InMethod(); | ||
63 | |||
64 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
65 | scene.Update(); | ||
66 | |||
67 | Assert.That(scene.Frame, Is.EqualTo(1)); | ||
68 | } | ||
69 | } | ||
70 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index cafe48a..8588f7f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using NUnit.Framework; | 31 | using NUnit.Framework; |
32 | using NUnit.Framework.SyntaxHelpers; | ||
33 | using OpenMetaverse; | 32 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index fe59d4f..8138bcc 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -34,7 +34,6 @@ using System.Timers; | |||
34 | using Timer=System.Timers.Timer; | 34 | using Timer=System.Timers.Timer; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenMetaverse; | 37 | using OpenMetaverse; |
39 | using OpenMetaverse.Assets; | 38 | using OpenMetaverse.Assets; |
40 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 5e6124b..6b70865 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Text; | 29 | using System.Text; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | ||
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |