diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 888 |
1 files changed, 809 insertions, 79 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fe99ae5..deb8d39 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -105,9 +105,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
105 | /// <summary> | 105 | /// <summary> |
106 | /// If false then physical objects are disabled, though collisions will continue as normal. | 106 | /// If false then physical objects are disabled, though collisions will continue as normal. |
107 | /// </summary> | 107 | /// </summary> |
108 | <<<<<<< HEAD | ||
108 | public bool PhysicsEnabled | 109 | public bool PhysicsEnabled |
109 | { | 110 | { |
110 | get | 111 | get |
112 | ======= | ||
113 | public bool PhysicsEnabled | ||
114 | { | ||
115 | get | ||
116 | >>>>>>> avn/ubitvar | ||
111 | { | 117 | { |
112 | return m_physicsEnabled; | 118 | return m_physicsEnabled; |
113 | } | 119 | } |
@@ -228,9 +234,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
228 | public bool m_allowScriptCrossings = true; | 234 | public bool m_allowScriptCrossings = true; |
229 | 235 | ||
230 | /// <summary> | 236 | /// <summary> |
237 | <<<<<<< HEAD | ||
231 | /// Can avatars cross from and to this region? | 238 | /// Can avatars cross from and to this region? |
232 | /// </summary> | 239 | /// </summary> |
233 | public bool AllowAvatarCrossing { get; set; } | 240 | public bool AllowAvatarCrossing { get; set; } |
241 | ======= | ||
242 | /// Max prims an Physical object will hold | ||
243 | /// </summary> | ||
244 | /// | ||
245 | public int m_linksetPhysCapacity = 0; | ||
246 | >>>>>>> avn/ubitvar | ||
234 | 247 | ||
235 | public bool m_useFlySlow; | 248 | public bool m_useFlySlow; |
236 | public bool m_useTrashOnDelete = true; | 249 | public bool m_useTrashOnDelete = true; |
@@ -281,14 +294,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
281 | } | 294 | } |
282 | } | 295 | } |
283 | 296 | ||
297 | protected float m_maxDrawDistance = 512.0f; | ||
298 | // protected float m_maxDrawDistance = 256.0f; | ||
299 | public float MaxDrawDistance | ||
300 | { | ||
301 | get { return m_maxDrawDistance; } | ||
302 | } | ||
303 | |||
284 | private List<string> m_AllowedViewers = new List<string>(); | 304 | private List<string> m_AllowedViewers = new List<string>(); |
285 | private List<string> m_BannedViewers = new List<string>(); | 305 | private List<string> m_BannedViewers = new List<string>(); |
286 | 306 | ||
287 | // TODO: need to figure out how allow client agents but deny | 307 | // TODO: need to figure out how allow client agents but deny |
288 | // root agents when ACL denies access to root agent | 308 | // root agents when ACL denies access to root agent |
289 | public bool m_strictAccessControl = true; | 309 | public bool m_strictAccessControl = true; |
290 | 310 | public bool m_seeIntoBannedRegion = false; | |
291 | public int MaxUndoCount { get; set; } | 311 | public int MaxUndoCount = 5; |
292 | 312 | ||
293 | public bool SeeIntoRegion { get; set; } | 313 | public bool SeeIntoRegion { get; set; } |
294 | 314 | ||
@@ -306,11 +326,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
306 | 326 | ||
307 | protected int m_splitRegionID; | 327 | protected int m_splitRegionID; |
308 | protected Timer m_restartWaitTimer = new Timer(); | 328 | protected Timer m_restartWaitTimer = new Timer(); |
329 | protected Timer m_timerWatchdog = new Timer(); | ||
309 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 330 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
310 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 331 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
311 | protected string m_simulatorVersion = "OpenSimulator Server"; | 332 | protected string m_simulatorVersion = "OpenSimulator Server"; |
312 | protected AgentCircuitManager m_authenticateHandler; | 333 | protected AgentCircuitManager m_authenticateHandler; |
313 | protected SceneCommunicationService m_sceneGridService; | 334 | protected SceneCommunicationService m_sceneGridService; |
335 | protected ISnmpModule m_snmpService = null; | ||
314 | 336 | ||
315 | protected ISimulationDataService m_SimulationDataService; | 337 | protected ISimulationDataService m_SimulationDataService; |
316 | protected IEstateDataService m_EstateDataService; | 338 | protected IEstateDataService m_EstateDataService; |
@@ -406,8 +428,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | private int m_update_presences = 1; // Update scene presence movements | 428 | private int m_update_presences = 1; // Update scene presence movements |
407 | private int m_update_events = 1; | 429 | private int m_update_events = 1; |
408 | private int m_update_backup = 200; | 430 | private int m_update_backup = 200; |
431 | <<<<<<< HEAD | ||
409 | private int m_update_terrain = 50; | 432 | private int m_update_terrain = 50; |
410 | // private int m_update_land = 1; | 433 | // private int m_update_land = 1; |
434 | ======= | ||
435 | private int m_update_terrain = 1000; | ||
436 | private int m_update_land = 10; | ||
437 | >>>>>>> avn/ubitvar | ||
411 | private int m_update_coarse_locations = 50; | 438 | private int m_update_coarse_locations = 50; |
412 | private int m_update_temp_cleaning = 180; | 439 | private int m_update_temp_cleaning = 180; |
413 | 440 | ||
@@ -421,7 +448,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | private int backupMS; | 448 | private int backupMS; |
422 | private int terrainMS; | 449 | private int terrainMS; |
423 | private int landMS; | 450 | private int landMS; |
424 | private int spareMS; | ||
425 | 451 | ||
426 | // A temporary configuration flag to enable using FireAndForget to process | 452 | // A temporary configuration flag to enable using FireAndForget to process |
427 | // collisions from the physics engine. There is a problem with collisions | 453 | // collisions from the physics engine. There is a problem with collisions |
@@ -439,6 +465,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
439 | /// </summary> | 465 | /// </summary> |
440 | private int m_lastFrameTick; | 466 | private int m_lastFrameTick; |
441 | 467 | ||
468 | public bool CombineRegions = false; | ||
442 | /// <summary> | 469 | /// <summary> |
443 | /// Tick at which the last maintenance run occurred. | 470 | /// Tick at which the last maintenance run occurred. |
444 | /// </summary> | 471 | /// </summary> |
@@ -470,7 +497,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
470 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 497 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
471 | private volatile bool m_backingup; | 498 | private volatile bool m_backingup; |
472 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 499 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
473 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 500 | private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); |
474 | 501 | ||
475 | private string m_defaultScriptEngine; | 502 | private string m_defaultScriptEngine; |
476 | 503 | ||
@@ -485,6 +512,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
485 | /// </summary> | 512 | /// </summary> |
486 | private int m_LastLogin; | 513 | private int m_LastLogin; |
487 | 514 | ||
515 | private int m_lastIncoming; | ||
516 | private int m_lastOutgoing; | ||
517 | private int m_hbRestarts = 0; | ||
518 | |||
519 | |||
488 | /// <summary> | 520 | /// <summary> |
489 | /// Thread that runs the scene loop. | 521 | /// Thread that runs the scene loop. |
490 | /// </summary> | 522 | /// </summary> |
@@ -527,11 +559,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
527 | } | 559 | } |
528 | private volatile bool m_active; | 560 | private volatile bool m_active; |
529 | 561 | ||
562 | <<<<<<< HEAD | ||
530 | /// <summary> | 563 | /// <summary> |
531 | /// If true then updates are running. This may be true for a short period after a scene is de-activated. | 564 | /// If true then updates are running. This may be true for a short period after a scene is de-activated. |
532 | /// </summary> | 565 | /// </summary> |
533 | public bool IsRunning { get { return m_isRunning; } } | 566 | public bool IsRunning { get { return m_isRunning; } } |
534 | private volatile bool m_isRunning; | 567 | private volatile bool m_isRunning; |
568 | ======= | ||
569 | // private int m_lastUpdate; | ||
570 | private bool m_firstHeartbeat = true; | ||
571 | |||
572 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | ||
573 | private bool m_reprioritizationEnabled = true; | ||
574 | private double m_reprioritizationInterval = 5000.0; | ||
575 | private double m_rootReprioritizationDistance = 10.0; | ||
576 | private double m_childReprioritizationDistance = 20.0; | ||
577 | >>>>>>> avn/ubitvar | ||
535 | 578 | ||
536 | private Timer m_mapGenerationTimer = new Timer(); | 579 | private Timer m_mapGenerationTimer = new Timer(); |
537 | private bool m_generateMaptiles; | 580 | private bool m_generateMaptiles; |
@@ -564,6 +607,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
564 | get { return m_sceneGridService; } | 607 | get { return m_sceneGridService; } |
565 | } | 608 | } |
566 | 609 | ||
610 | public ISnmpModule SnmpService | ||
611 | { | ||
612 | get | ||
613 | { | ||
614 | if (m_snmpService == null) | ||
615 | { | ||
616 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
617 | } | ||
618 | |||
619 | return m_snmpService; | ||
620 | } | ||
621 | } | ||
622 | |||
567 | public ISimulationDataService SimulationDataService | 623 | public ISimulationDataService SimulationDataService |
568 | { | 624 | { |
569 | get | 625 | get |
@@ -868,6 +924,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
868 | m_sceneGridService = sceneGridService; | 924 | m_sceneGridService = sceneGridService; |
869 | m_SimulationDataService = simDataService; | 925 | m_SimulationDataService = simDataService; |
870 | m_EstateDataService = estateDataService; | 926 | m_EstateDataService = estateDataService; |
927 | <<<<<<< HEAD | ||
928 | ======= | ||
929 | m_regionHandle = RegionInfo.RegionHandle; | ||
930 | m_lastIncoming = 0; | ||
931 | m_lastOutgoing = 0; | ||
932 | >>>>>>> avn/ubitvar | ||
871 | 933 | ||
872 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 934 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
873 | m_asyncSceneObjectDeleter.Enabled = true; | 935 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -926,6 +988,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
926 | EventManager.OnLandObjectRemoved += | 988 | EventManager.OnLandObjectRemoved += |
927 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 989 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
928 | 990 | ||
991 | <<<<<<< HEAD | ||
992 | ======= | ||
993 | m_sceneGraph = new SceneGraph(this); | ||
994 | m_sceneGraph.PhysicsScene = physicsScene; | ||
995 | |||
996 | // If the scene graph has an Unrecoverable error, restart this sim. | ||
997 | // Currently the only thing that causes it to happen is two kinds of specific | ||
998 | // Physics based crashes. | ||
999 | // | ||
1000 | // Out of memory | ||
1001 | // Operating system has killed the plugin | ||
1002 | m_sceneGraph.UnRecoverableError | ||
1003 | += () => | ||
1004 | { | ||
1005 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | ||
1006 | RestartNow(); | ||
1007 | }; | ||
1008 | |||
1009 | >>>>>>> avn/ubitvar | ||
929 | RegisterDefaultSceneEvents(); | 1010 | RegisterDefaultSceneEvents(); |
930 | 1011 | ||
931 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled | 1012 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled |
@@ -947,6 +1028,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
947 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 1028 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
948 | 1029 | ||
949 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 1030 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); |
1031 | m_defaultDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); | ||
950 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 1032 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
951 | if (!UseBackup) | 1033 | if (!UseBackup) |
952 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 1034 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
@@ -958,9 +1040,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
958 | 1040 | ||
959 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | 1041 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); |
960 | 1042 | ||
961 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | 1043 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
962 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | 1044 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
963 | |||
964 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 1045 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
965 | if (RegionInfo.NonphysPrimMin > 0) | 1046 | if (RegionInfo.NonphysPrimMin > 0) |
966 | { | 1047 | { |
@@ -980,11 +1061,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
980 | } | 1061 | } |
981 | 1062 | ||
982 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 1063 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
1064 | |||
983 | if (RegionInfo.PhysPrimMax > 0) | 1065 | if (RegionInfo.PhysPrimMax > 0) |
984 | { | 1066 | { |
985 | m_maxPhys = RegionInfo.PhysPrimMax; | 1067 | m_maxPhys = RegionInfo.PhysPrimMax; |
986 | } | 1068 | } |
987 | 1069 | ||
1070 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | ||
1071 | if (RegionInfo.LinksetCapacity > 0) | ||
1072 | { | ||
1073 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
1074 | } | ||
1075 | |||
1076 | m_linksetPhysCapacity = startupConfig.GetInt("LinksetPhysPrims", m_linksetPhysCapacity); | ||
1077 | |||
1078 | |||
1079 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
1080 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
1081 | |||
988 | // Here, if clamping is requested in either global or | 1082 | // Here, if clamping is requested in either global or |
989 | // local config, it will be used | 1083 | // local config, it will be used |
990 | // | 1084 | // |
@@ -994,13 +1088,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
994 | m_clampPrimSize = true; | 1088 | m_clampPrimSize = true; |
995 | } | 1089 | } |
996 | 1090 | ||
997 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 1091 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
998 | if (RegionInfo.LinksetCapacity > 0) | ||
999 | { | ||
1000 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
1001 | } | ||
1002 | |||
1003 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | ||
1004 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 1092 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
1005 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 1093 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
1006 | m_dontPersistBefore = | 1094 | m_dontPersistBefore = |
@@ -1011,11 +1099,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1011 | m_persistAfter *= 10000000; | 1099 | m_persistAfter *= 10000000; |
1012 | 1100 | ||
1013 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 1101 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
1014 | 1102 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | |
1015 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
1016 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
1017 | 1103 | ||
1018 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 1104 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
1105 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
1106 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
1019 | 1107 | ||
1020 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 1108 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
1021 | 1109 | ||
@@ -1061,7 +1149,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1061 | 1149 | ||
1062 | if (grant.Length > 0) | 1150 | if (grant.Length > 0) |
1063 | { | 1151 | { |
1064 | foreach (string viewer in grant.Split('|')) | 1152 | foreach (string viewer in grant.Split(',')) |
1065 | { | 1153 | { |
1066 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 1154 | m_AllowedViewers.Add(viewer.Trim().ToLower()); |
1067 | } | 1155 | } |
@@ -1073,7 +1161,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1073 | 1161 | ||
1074 | if (grant.Length > 0) | 1162 | if (grant.Length > 0) |
1075 | { | 1163 | { |
1076 | foreach (string viewer in grant.Split('|')) | 1164 | foreach (string viewer in grant.Split(',')) |
1077 | { | 1165 | { |
1078 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 1166 | m_BannedViewers.Add(viewer.Trim().ToLower()); |
1079 | } | 1167 | } |
@@ -1191,6 +1279,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1191 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1279 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1192 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1280 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1193 | 1281 | ||
1282 | <<<<<<< HEAD | ||
1283 | ======= | ||
1284 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
1285 | >>>>>>> avn/ubitvar | ||
1194 | } | 1286 | } |
1195 | 1287 | ||
1196 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) | 1288 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) |
@@ -1214,13 +1306,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1214 | 1306 | ||
1215 | PhysicalPrims = true; | 1307 | PhysicalPrims = true; |
1216 | CollidablePrims = true; | 1308 | CollidablePrims = true; |
1217 | PhysicsEnabled = true; | 1309 | // this is done above acording to config |
1310 | // PhysicsEnabled = true; | ||
1218 | 1311 | ||
1219 | AllowAvatarCrossing = true; | 1312 | AllowAvatarCrossing = true; |
1220 | 1313 | ||
1221 | PeriodicBackup = true; | 1314 | PeriodicBackup = true; |
1222 | UseBackup = true; | 1315 | UseBackup = true; |
1223 | 1316 | ||
1317 | <<<<<<< HEAD | ||
1224 | IsReprioritizationEnabled = true; | 1318 | IsReprioritizationEnabled = true; |
1225 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; | 1319 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; |
1226 | ReprioritizationInterval = 5000; | 1320 | ReprioritizationInterval = 5000; |
@@ -1231,9 +1325,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1231 | RootReprioritizationDistance = 10.0; | 1325 | RootReprioritizationDistance = 10.0; |
1232 | ChildReprioritizationDistance = 20.0; | 1326 | ChildReprioritizationDistance = 20.0; |
1233 | 1327 | ||
1328 | ======= | ||
1329 | >>>>>>> avn/ubitvar | ||
1234 | m_eventManager = new EventManager(); | 1330 | m_eventManager = new EventManager(); |
1235 | 1331 | ||
1236 | m_permissions = new ScenePermissions(this); | 1332 | m_permissions = new ScenePermissions(this); |
1333 | |||
1237 | } | 1334 | } |
1238 | 1335 | ||
1239 | #endregion | 1336 | #endregion |
@@ -1279,6 +1376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1279 | { | 1376 | { |
1280 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 1377 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
1281 | { | 1378 | { |
1379 | <<<<<<< HEAD | ||
1282 | //// If these are cast to INT because long + negative values + abs returns invalid data | 1380 | //// If these are cast to INT because long + negative values + abs returns invalid data |
1283 | //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX); | 1381 | //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX); |
1284 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); | 1382 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); |
@@ -1293,6 +1391,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1293 | // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY); | 1391 | // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY); |
1294 | 1392 | ||
1295 | if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY)) | 1393 | if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY)) |
1394 | ======= | ||
1395 | if (isNeighborRegion(otherRegion)) | ||
1396 | >>>>>>> avn/ubitvar | ||
1296 | { | 1397 | { |
1297 | // Let the grid service module know, so this can be cached | 1398 | // Let the grid service module know, so this can be cached |
1298 | m_eventManager.TriggerOnRegionUp(otherRegion); | 1399 | m_eventManager.TriggerOnRegionUp(otherRegion); |
@@ -1327,6 +1428,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1327 | } | 1428 | } |
1328 | } | 1429 | } |
1329 | 1430 | ||
1431 | public bool isNeighborRegion(GridRegion otherRegion) | ||
1432 | { | ||
1433 | int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; ; | ||
1434 | |||
1435 | if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX) | ||
1436 | return false; | ||
1437 | |||
1438 | tmp = otherRegion.RegionLocY - (int)RegionInfo.WorldLocY; | ||
1439 | |||
1440 | if (tmp < -otherRegion.RegionSizeY && tmp > RegionInfo.RegionSizeY) | ||
1441 | return false; | ||
1442 | |||
1443 | return true; | ||
1444 | } | ||
1445 | |||
1330 | public void AddNeighborRegion(RegionInfo region) | 1446 | public void AddNeighborRegion(RegionInfo region) |
1331 | { | 1447 | { |
1332 | lock (m_neighbours) | 1448 | lock (m_neighbours) |
@@ -1458,8 +1574,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1458 | // Stop all client threads. | 1574 | // Stop all client threads. |
1459 | ForEachScenePresence(delegate(ScenePresence avatar) { CloseAgent(avatar.UUID, false); }); | 1575 | ForEachScenePresence(delegate(ScenePresence avatar) { CloseAgent(avatar.UUID, false); }); |
1460 | 1576 | ||
1461 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1577 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1462 | EventManager.TriggerSceneShuttingDown(this); | 1578 | EventManager.TriggerSceneShuttingDown(this); |
1579 | |||
1580 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1581 | |||
1463 | Backup(false); | 1582 | Backup(false); |
1464 | m_sceneGraph.Close(); | 1583 | m_sceneGraph.Close(); |
1465 | 1584 | ||
@@ -1473,6 +1592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1473 | // attempt to reference a null or disposed physics scene. | 1592 | // attempt to reference a null or disposed physics scene. |
1474 | if (PhysicsScene != null) | 1593 | if (PhysicsScene != null) |
1475 | { | 1594 | { |
1595 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1476 | PhysicsScene phys = PhysicsScene; | 1596 | PhysicsScene phys = PhysicsScene; |
1477 | // remove the physics engine from both Scene and SceneGraph | 1597 | // remove the physics engine from both Scene and SceneGraph |
1478 | PhysicsScene = null; | 1598 | PhysicsScene = null; |
@@ -1504,10 +1624,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1504 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1624 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1505 | if (m_heartbeatThread != null) | 1625 | if (m_heartbeatThread != null) |
1506 | { | 1626 | { |
1627 | m_hbRestarts++; | ||
1628 | if(m_hbRestarts > 10) | ||
1629 | Environment.Exit(1); | ||
1630 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1631 | |||
1632 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1633 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1634 | //proc.EnableRaisingEvents=false; | ||
1635 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1636 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1637 | //proc.Start(); | ||
1638 | //proc.WaitForExit(); | ||
1639 | //Thread.Sleep(1000); | ||
1640 | //Environment.Exit(1); | ||
1507 | m_heartbeatThread.Abort(); | 1641 | m_heartbeatThread.Abort(); |
1642 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1508 | m_heartbeatThread = null; | 1643 | m_heartbeatThread = null; |
1509 | } | 1644 | } |
1510 | 1645 | ||
1646 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1647 | |||
1648 | |||
1511 | m_heartbeatThread | 1649 | m_heartbeatThread |
1512 | = WorkManager.StartThread( | 1650 | = WorkManager.StartThread( |
1513 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); | 1651 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); |
@@ -1687,6 +1825,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1687 | endFrame = Frame + frames; | 1825 | endFrame = Frame + frames; |
1688 | 1826 | ||
1689 | float physicsFPS = 0f; | 1827 | float physicsFPS = 0f; |
1828 | <<<<<<< HEAD | ||
1690 | int previousFrameTick, tmpMS; | 1829 | int previousFrameTick, tmpMS; |
1691 | 1830 | ||
1692 | // These variables will be used to save the precise frame time using the | 1831 | // These variables will be used to save the precise frame time using the |
@@ -1703,22 +1842,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
1703 | // Begin the stopwatch to keep track of the time that the frame | 1842 | // Begin the stopwatch to keep track of the time that the frame |
1704 | // started running to determine how long the frame took to complete | 1843 | // started running to determine how long the frame took to complete |
1705 | totalFrameStopwatch.Start(); | 1844 | totalFrameStopwatch.Start(); |
1845 | ======= | ||
1846 | int tmpMS; | ||
1847 | int previousFrameTick; | ||
1848 | int maintc; | ||
1849 | int sleepMS; | ||
1850 | int framestart; | ||
1851 | >>>>>>> avn/ubitvar | ||
1706 | 1852 | ||
1707 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1853 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1708 | { | 1854 | { |
1855 | framestart = Util.EnvironmentTickCount(); | ||
1709 | ++Frame; | 1856 | ++Frame; |
1710 | 1857 | ||
1711 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1858 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1712 | 1859 | ||
1860 | <<<<<<< HEAD | ||
1713 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1861 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; |
1862 | ======= | ||
1863 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | ||
1864 | >>>>>>> avn/ubitvar | ||
1714 | 1865 | ||
1715 | try | 1866 | try |
1716 | { | 1867 | { |
1717 | EventManager.TriggerRegionHeartbeatStart(this); | 1868 | EventManager.TriggerRegionHeartbeatStart(this); |
1718 | 1869 | ||
1719 | // Apply taints in terrain module to terrain in physics scene | 1870 | // Apply taints in terrain module to terrain in physics scene |
1871 | |||
1872 | tmpMS = Util.EnvironmentTickCount(); | ||
1873 | if (Frame % 4 == 0) | ||
1874 | { | ||
1875 | CheckTerrainUpdates(); | ||
1876 | } | ||
1877 | |||
1720 | if (Frame % m_update_terrain == 0) | 1878 | if (Frame % m_update_terrain == 0) |
1721 | { | 1879 | { |
1880 | <<<<<<< HEAD | ||
1722 | // At several points inside the code there was a need to | 1881 | // At several points inside the code there was a need to |
1723 | // create a more precise measurement of time elapsed. | 1882 | // create a more precise measurement of time elapsed. |
1724 | // This led to the addition of variables that have a | 1883 | // This led to the addition of variables that have a |
@@ -1749,6 +1908,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1749 | // feel right modifying the code to that degree at this | 1908 | // feel right modifying the code to that degree at this |
1750 | // point in time, the precise values all begin with the | 1909 | // point in time, the precise values all begin with the |
1751 | // keyword precise | 1910 | // keyword precise |
1911 | ======= | ||
1912 | UpdateTerrain(); | ||
1913 | } | ||
1914 | |||
1915 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1916 | >>>>>>> avn/ubitvar | ||
1752 | 1917 | ||
1753 | tmpMS = Util.EnvironmentTickCount(); | 1918 | tmpMS = Util.EnvironmentTickCount(); |
1754 | 1919 | ||
@@ -1816,6 +1981,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1816 | 1981 | ||
1817 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1982 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1818 | 1983 | ||
1984 | <<<<<<< HEAD | ||
1985 | ======= | ||
1986 | |||
1987 | // Delete temp-on-rez stuff | ||
1988 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | ||
1989 | { | ||
1990 | tmpMS = Util.EnvironmentTickCount(); | ||
1991 | m_cleaningTemps = true; | ||
1992 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | ||
1993 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1994 | } | ||
1995 | |||
1996 | >>>>>>> avn/ubitvar | ||
1819 | if (Frame % m_update_events == 0) | 1997 | if (Frame % m_update_events == 0) |
1820 | { | 1998 | { |
1821 | tmpMS = Util.EnvironmentTickCount(); | 1999 | tmpMS = Util.EnvironmentTickCount(); |
@@ -1891,6 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1891 | preciseSimFrameTime += | 2069 | preciseSimFrameTime += |
1892 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 2070 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1893 | 2071 | ||
2072 | <<<<<<< HEAD | ||
1894 | if (!UpdateOnTimer) | 2073 | if (!UpdateOnTimer) |
1895 | { | 2074 | { |
1896 | Watchdog.UpdateThread(); | 2075 | Watchdog.UpdateThread(); |
@@ -1918,13 +2097,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1918 | previousFrameTick = m_lastFrameTick; | 2097 | previousFrameTick = m_lastFrameTick; |
1919 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 2098 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1920 | m_lastFrameTick = Util.EnvironmentTickCount(); | 2099 | m_lastFrameTick = Util.EnvironmentTickCount(); |
2100 | ======= | ||
2101 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1921 | 2102 | ||
1922 | // if (Frame%m_update_avatars == 0) | ||
1923 | // UpdateInWorldTime(); | ||
1924 | StatsReporter.AddPhysicsFPS(physicsFPS); | 2103 | StatsReporter.AddPhysicsFPS(physicsFPS); |
1925 | StatsReporter.AddTimeDilation(TimeDilation); | 2104 | StatsReporter.AddTimeDilation(TimeDilation); |
1926 | StatsReporter.AddFPS(1); | 2105 | StatsReporter.AddFPS(1); |
1927 | 2106 | ||
2107 | StatsReporter.addAgentMS(agentMS); | ||
2108 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
2109 | StatsReporter.addOtherMS(otherMS); | ||
2110 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
2111 | |||
2112 | previousFrameTick = m_lastFrameTick; | ||
2113 | m_lastFrameTick = Util.EnvironmentTickCount(); | ||
2114 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); | ||
2115 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | ||
2116 | |||
2117 | m_firstHeartbeat = false; | ||
2118 | |||
2119 | sleepMS = Util.EnvironmentTickCount(); | ||
2120 | |||
2121 | if (tmpMS > 0) | ||
2122 | Thread.Sleep(tmpMS); | ||
2123 | |||
2124 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); | ||
2125 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
2126 | StatsReporter.addSleepMS(sleepMS); | ||
2127 | StatsReporter.addFrameMS(frameMS); | ||
2128 | >>>>>>> avn/ubitvar | ||
2129 | |||
2130 | // if (Frame%m_update_avatars == 0) | ||
2131 | // UpdateInWorldTime(); | ||
2132 | |||
2133 | <<<<<<< HEAD | ||
1928 | StatsReporter.addFrameMS(frameMS); | 2134 | StatsReporter.addFrameMS(frameMS); |
1929 | StatsReporter.addAgentMS(agentMS); | 2135 | StatsReporter.addAgentMS(agentMS); |
1930 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | 2136 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); |
@@ -1932,6 +2138,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1932 | StatsReporter.AddSpareMS(spareMS); | 2138 | StatsReporter.AddSpareMS(spareMS); |
1933 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | 2139 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); |
1934 | StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime()); | 2140 | StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime()); |
2141 | ======= | ||
2142 | >>>>>>> avn/ubitvar | ||
1935 | 2143 | ||
1936 | // Send the correct time values to the stats reporter for the | 2144 | // Send the correct time values to the stats reporter for the |
1937 | // frame times | 2145 | // frame times |
@@ -1982,7 +2190,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1982 | public void AddGroupTarget(SceneObjectGroup grp) | 2190 | public void AddGroupTarget(SceneObjectGroup grp) |
1983 | { | 2191 | { |
1984 | lock (m_groupsWithTargets) | 2192 | lock (m_groupsWithTargets) |
1985 | m_groupsWithTargets[grp.UUID] = grp; | 2193 | m_groupsWithTargets[grp.UUID] = 0; |
1986 | } | 2194 | } |
1987 | 2195 | ||
1988 | public void RemoveGroupTarget(SceneObjectGroup grp) | 2196 | public void RemoveGroupTarget(SceneObjectGroup grp) |
@@ -1993,18 +2201,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | 2201 | ||
1994 | private void CheckAtTargets() | 2202 | private void CheckAtTargets() |
1995 | { | 2203 | { |
1996 | List<SceneObjectGroup> objs = null; | 2204 | List<UUID> objs = null; |
1997 | 2205 | ||
1998 | lock (m_groupsWithTargets) | 2206 | lock (m_groupsWithTargets) |
1999 | { | 2207 | { |
2000 | if (m_groupsWithTargets.Count != 0) | 2208 | if (m_groupsWithTargets.Count != 0) |
2001 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 2209 | objs = new List<UUID>(m_groupsWithTargets.Keys); |
2002 | } | 2210 | } |
2003 | 2211 | ||
2004 | if (objs != null) | 2212 | if (objs != null) |
2005 | { | 2213 | { |
2006 | foreach (SceneObjectGroup entry in objs) | 2214 | foreach (UUID entry in objs) |
2007 | entry.checkAtTargets(); | 2215 | { |
2216 | SceneObjectGroup grp = GetSceneObjectGroup(entry); | ||
2217 | if (grp == null) | ||
2218 | m_groupsWithTargets.Remove(entry); | ||
2219 | else | ||
2220 | grp.checkAtTargets(); | ||
2221 | } | ||
2008 | } | 2222 | } |
2009 | } | 2223 | } |
2010 | 2224 | ||
@@ -2028,6 +2242,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2028 | EventManager.TriggerTerrainTick(); | 2242 | EventManager.TriggerTerrainTick(); |
2029 | } | 2243 | } |
2030 | 2244 | ||
2245 | private void CheckTerrainUpdates() | ||
2246 | { | ||
2247 | EventManager.TriggerTerrainCheckUpdates(); | ||
2248 | } | ||
2249 | |||
2031 | /// <summary> | 2250 | /// <summary> |
2032 | /// Back up queued up changes | 2251 | /// Back up queued up changes |
2033 | /// </summary> | 2252 | /// </summary> |
@@ -2079,7 +2298,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2079 | msg.fromAgentName = "Server"; | 2298 | msg.fromAgentName = "Server"; |
2080 | msg.dialog = (byte)19; // Object msg | 2299 | msg.dialog = (byte)19; // Object msg |
2081 | msg.fromGroup = false; | 2300 | msg.fromGroup = false; |
2082 | msg.offline = (byte)0; | 2301 | msg.offline = (byte)1; |
2083 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 2302 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
2084 | msg.Position = Vector3.Zero; | 2303 | msg.Position = Vector3.Zero; |
2085 | msg.RegionID = RegionInfo.RegionID.Guid; | 2304 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2315,7 +2534,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2315 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2534 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2316 | } | 2535 | } |
2317 | 2536 | ||
2318 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2537 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
2319 | { | 2538 | { |
2320 | if (PhysicsScene == null) | 2539 | if (PhysicsScene == null) |
2321 | return null; | 2540 | return null; |
@@ -2337,14 +2556,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2337 | /// <returns></returns> | 2556 | /// <returns></returns> |
2338 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2557 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2339 | { | 2558 | { |
2559 | |||
2560 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2561 | Vector3 wpos = Vector3.Zero; | ||
2562 | // Check for water surface intersection from above | ||
2563 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2564 | { | ||
2565 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2566 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2567 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2568 | wpos.Z = wheight; | ||
2569 | } | ||
2570 | |||
2340 | Vector3 pos = Vector3.Zero; | 2571 | Vector3 pos = Vector3.Zero; |
2341 | if (RayEndIsIntersection == (byte)1) | 2572 | if (RayEndIsIntersection == (byte)1) |
2342 | { | 2573 | { |
2343 | pos = RayEnd; | 2574 | pos = RayEnd; |
2344 | return pos; | ||
2345 | } | 2575 | } |
2346 | 2576 | else if (RayTargetID != UUID.Zero) | |
2347 | if (RayTargetID != UUID.Zero) | ||
2348 | { | 2577 | { |
2349 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2578 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2350 | 2579 | ||
@@ -2389,13 +2618,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2389 | //pos.Z -= 0.25F; | 2618 | //pos.Z -= 0.25F; |
2390 | 2619 | ||
2391 | } | 2620 | } |
2392 | |||
2393 | return pos; | ||
2394 | } | 2621 | } |
2395 | else | 2622 | else |
2396 | { | 2623 | { |
2397 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2624 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2398 | |||
2399 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2625 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2400 | 2626 | ||
2401 | // Un-comment the following line to print the raytrace results to the console. | 2627 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2403,15 +2629,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2403 | 2629 | ||
2404 | if (ei.HitTF) | 2630 | if (ei.HitTF) |
2405 | { | 2631 | { |
2632 | <<<<<<< HEAD | ||
2406 | pos = ei.ipoint; | 2633 | pos = ei.ipoint; |
2407 | } | 2634 | } |
2635 | ======= | ||
2636 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | ||
2637 | } | ||
2638 | >>>>>>> avn/ubitvar | ||
2408 | else | 2639 | else |
2409 | { | 2640 | { |
2410 | // fall back to our stupid functionality | 2641 | // fall back to our stupid functionality |
2411 | pos = RayEnd; | 2642 | pos = RayEnd; |
2412 | } | 2643 | } |
2413 | |||
2414 | return pos; | ||
2415 | } | 2644 | } |
2416 | } | 2645 | } |
2417 | else | 2646 | else |
@@ -2422,8 +2651,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2422 | //increase height so its above the ground. | 2651 | //increase height so its above the ground. |
2423 | //should be getting the normal of the ground at the rez point and using that? | 2652 | //should be getting the normal of the ground at the rez point and using that? |
2424 | pos.Z += scale.Z / 2f; | 2653 | pos.Z += scale.Z / 2f; |
2425 | return pos; | 2654 | // return pos; |
2426 | } | 2655 | } |
2656 | |||
2657 | // check against posible water intercept | ||
2658 | if (wpos.Z > pos.Z) pos = wpos; | ||
2659 | return pos; | ||
2427 | } | 2660 | } |
2428 | 2661 | ||
2429 | 2662 | ||
@@ -2514,12 +2747,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2514 | { | 2747 | { |
2515 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2748 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2516 | { | 2749 | { |
2750 | sceneObject.IsDeleted = false; | ||
2517 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2751 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2518 | return true; | 2752 | return true; |
2519 | } | 2753 | } |
2520 | 2754 | ||
2521 | return false; | 2755 | return false; |
2522 | |||
2523 | } | 2756 | } |
2524 | 2757 | ||
2525 | /// <summary> | 2758 | /// <summary> |
@@ -2611,6 +2844,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2611 | /// </summary> | 2844 | /// </summary> |
2612 | public void DeleteAllSceneObjects() | 2845 | public void DeleteAllSceneObjects() |
2613 | { | 2846 | { |
2847 | DeleteAllSceneObjects(false); | ||
2848 | } | ||
2849 | |||
2850 | /// <summary> | ||
2851 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2852 | /// </summary> | ||
2853 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2854 | { | ||
2855 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2614 | lock (Entities) | 2856 | lock (Entities) |
2615 | { | 2857 | { |
2616 | EntityBase[] entities = Entities.GetEntities(); | 2858 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2619,11 +2861,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2619 | if (e is SceneObjectGroup) | 2861 | if (e is SceneObjectGroup) |
2620 | { | 2862 | { |
2621 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2863 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2622 | if (!sog.IsAttachment) | 2864 | if (sog != null && !sog.IsAttachment) |
2623 | DeleteSceneObject((SceneObjectGroup)e, false); | 2865 | { |
2866 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2867 | { | ||
2868 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2869 | } | ||
2870 | else | ||
2871 | { | ||
2872 | toReturn.Add((SceneObjectGroup)e); | ||
2873 | } | ||
2874 | } | ||
2624 | } | 2875 | } |
2625 | } | 2876 | } |
2626 | } | 2877 | } |
2878 | if (toReturn.Count > 0) | ||
2879 | { | ||
2880 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2881 | } | ||
2627 | } | 2882 | } |
2628 | 2883 | ||
2629 | /// <summary> | 2884 | /// <summary> |
@@ -2654,6 +2909,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2654 | else | 2909 | else |
2655 | group.StopScriptInstances(); | 2910 | group.StopScriptInstances(); |
2656 | 2911 | ||
2912 | List<UUID> avatars = group.GetSittingAvatars(); | ||
2913 | foreach (UUID av in avatars) | ||
2914 | { | ||
2915 | ScenePresence p = GetScenePresence(av); | ||
2916 | if (p != null && p.ParentUUID == UUID.Zero) | ||
2917 | p.StandUp(); | ||
2918 | } | ||
2919 | |||
2657 | SceneObjectPart[] partList = group.Parts; | 2920 | SceneObjectPart[] partList = group.Parts; |
2658 | 2921 | ||
2659 | foreach (SceneObjectPart part in partList) | 2922 | foreach (SceneObjectPart part in partList) |
@@ -2681,6 +2944,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2681 | } | 2944 | } |
2682 | 2945 | ||
2683 | group.DeleteGroupFromScene(silent); | 2946 | group.DeleteGroupFromScene(silent); |
2947 | if (!silent) | ||
2948 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2684 | 2949 | ||
2685 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2950 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2686 | } | 2951 | } |
@@ -2717,6 +2982,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2717 | return false; | 2982 | return false; |
2718 | } | 2983 | } |
2719 | 2984 | ||
2985 | |||
2986 | public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp) | ||
2987 | { | ||
2988 | m_sceneGraph.updateScenePartGroup(part, grp); | ||
2989 | } | ||
2720 | /// <summary> | 2990 | /// <summary> |
2721 | /// Move the given scene object into a new region depending on which region its absolute position has moved | 2991 | /// Move the given scene object into a new region depending on which region its absolute position has moved |
2722 | /// into. | 2992 | /// into. |
@@ -2743,10 +3013,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
2743 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); | 3013 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); |
2744 | } | 3014 | } |
2745 | return; | 3015 | return; |
3016 | <<<<<<< HEAD | ||
3017 | ======= | ||
3018 | } | ||
3019 | |||
3020 | if (grp.RootPart.RETURN_AT_EDGE) | ||
3021 | { | ||
3022 | // We remove the object here | ||
3023 | try | ||
3024 | { | ||
3025 | List<SceneObjectGroup> objects = new List<SceneObjectGroup>(); | ||
3026 | objects.Add(grp); | ||
3027 | SceneObjectGroup[] objectsArray = objects.ToArray(); | ||
3028 | returnObjects(objectsArray, UUID.Zero); | ||
3029 | } | ||
3030 | catch (Exception) | ||
3031 | { | ||
3032 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); | ||
3033 | } | ||
3034 | return; | ||
3035 | } | ||
3036 | |||
3037 | if (EntityTransferModule != null) | ||
3038 | EntityTransferModule.Cross(grp, attemptedPosition, silent); | ||
3039 | } | ||
3040 | |||
3041 | // Simple test to see if a position is in the current region. | ||
3042 | // This test is mostly used to see if a region crossing is necessary. | ||
3043 | // Assuming the position is relative to the region so anything outside its bounds. | ||
3044 | // Return 'true' if position inside region. | ||
3045 | public bool PositionIsInCurrentRegion(Vector3 pos) | ||
3046 | { | ||
3047 | bool ret = false; | ||
3048 | int xx = (int)Math.Floor(pos.X); | ||
3049 | int yy = (int)Math.Floor(pos.Y); | ||
3050 | if (xx < 0 || yy < 0) | ||
3051 | return false; | ||
3052 | |||
3053 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); | ||
3054 | if (regionCombinerModule == null) | ||
3055 | { | ||
3056 | // Regular region. Just check for region size | ||
3057 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | ||
3058 | ret = true; | ||
3059 | >>>>>>> avn/ubitvar | ||
2746 | } | 3060 | } |
2747 | 3061 | ||
2748 | if (grp.RootPart.RETURN_AT_EDGE) | 3062 | if (grp.RootPart.RETURN_AT_EDGE) |
2749 | { | 3063 | { |
3064 | <<<<<<< HEAD | ||
2750 | // We remove the object here | 3065 | // We remove the object here |
2751 | try | 3066 | try |
2752 | { | 3067 | { |
@@ -2795,6 +3110,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2795 | 3110 | ||
2796 | } | 3111 | } |
2797 | 3112 | ||
3113 | ======= | ||
3114 | // We're in a mega-region so see if we are still in that larger region | ||
3115 | ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy); | ||
3116 | } | ||
3117 | |||
3118 | return ret; | ||
3119 | |||
3120 | } | ||
3121 | |||
3122 | >>>>>>> avn/ubitvar | ||
2798 | /// <summary> | 3123 | /// <summary> |
2799 | /// Called when objects or attachments cross the border, or teleport, between regions. | 3124 | /// Called when objects or attachments cross the border, or teleport, between regions. |
2800 | /// </summary> | 3125 | /// </summary> |
@@ -2816,8 +3141,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
2816 | return false; | 3141 | return false; |
2817 | } | 3142 | } |
2818 | 3143 | ||
3144 | <<<<<<< HEAD | ||
2819 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) | 3145 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) |
2820 | return false; | 3146 | return false; |
3147 | ======= | ||
3148 | // If the user is banned, we won't let any of their objects | ||
3149 | // enter. Period. | ||
3150 | // | ||
3151 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) | ||
3152 | { | ||
3153 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | ||
3154 | return false; | ||
3155 | } | ||
3156 | |||
3157 | if (newPosition != Vector3.Zero) | ||
3158 | newObject.RootPart.GroupPosition = newPosition; | ||
3159 | |||
3160 | if (!AddSceneObject(newObject)) | ||
3161 | { | ||
3162 | m_log.DebugFormat( | ||
3163 | "[INTERREGION]: Problem adding scene object {0} in {1} ", newObject.UUID, RegionInfo.RegionName); | ||
3164 | return false; | ||
3165 | } | ||
3166 | |||
3167 | if (!newObject.IsAttachment) | ||
3168 | { | ||
3169 | // FIXME: It would be better to never add the scene object at all rather than add it and then delete | ||
3170 | // it | ||
3171 | if (!Permissions.CanObjectEntry(newObject.UUID, true, newObject.AbsolutePosition)) | ||
3172 | { | ||
3173 | // Deny non attachments based on parcel settings | ||
3174 | // | ||
3175 | m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings"); | ||
3176 | |||
3177 | DeleteSceneObject(newObject, false); | ||
3178 | |||
3179 | return false; | ||
3180 | } | ||
3181 | |||
3182 | // For attachments, we need to wait until the agent is root | ||
3183 | // before we restart the scripts, or else some functions won't work. | ||
3184 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); | ||
3185 | newObject.ResumeScripts(); | ||
3186 | |||
3187 | // AddSceneObject already does this and doing it again messes | ||
3188 | // up region crossings, so don't. | ||
3189 | //if (newObject.RootPart.KeyframeMotion != null) | ||
3190 | // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
3191 | } | ||
3192 | >>>>>>> avn/ubitvar | ||
2821 | 3193 | ||
2822 | // Do this as late as possible so that listeners have full access to the incoming object | 3194 | // Do this as late as possible so that listeners have full access to the incoming object |
2823 | EventManager.TriggerOnIncomingSceneObject(newObject); | 3195 | EventManager.TriggerOnIncomingSceneObject(newObject); |
@@ -2834,6 +3206,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2834 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 3206 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2835 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 3207 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2836 | { | 3208 | { |
3209 | if (sceneObject.OwnerID == UUID.Zero) | ||
3210 | { | ||
3211 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
3212 | return false; | ||
3213 | } | ||
3214 | |||
3215 | // If the user is banned, we won't let any of their objects | ||
3216 | // enter. Period. | ||
3217 | // | ||
3218 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
3219 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
3220 | { | ||
3221 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
3222 | |||
3223 | return false; | ||
3224 | } | ||
3225 | |||
2837 | // Force allocation of new LocalId | 3226 | // Force allocation of new LocalId |
2838 | // | 3227 | // |
2839 | SceneObjectPart[] parts = sceneObject.Parts; | 3228 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2870,22 +3259,64 @@ namespace OpenSim.Region.Framework.Scenes | |||
2870 | // information that this is due to a teleport/border cross rather than an ordinary attachment. | 3259 | // information that this is due to a teleport/border cross rather than an ordinary attachment. |
2871 | // We currently do this in Scene.MakeRootAgent() instead. | 3260 | // We currently do this in Scene.MakeRootAgent() instead. |
2872 | if (AttachmentsModule != null) | 3261 | if (AttachmentsModule != null) |
2873 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 3262 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false, true); |
2874 | } | 3263 | } |
2875 | else | 3264 | else |
2876 | { | 3265 | { |
3266 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2877 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 3267 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2878 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 3268 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2879 | } | 3269 | } |
3270 | if (sceneObject.OwnerID == UUID.Zero) | ||
3271 | { | ||
3272 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
3273 | return false; | ||
3274 | } | ||
2880 | } | 3275 | } |
2881 | else | 3276 | else |
2882 | { | 3277 | { |
3278 | if (sceneObject.OwnerID == UUID.Zero) | ||
3279 | { | ||
3280 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
3281 | return false; | ||
3282 | } | ||
2883 | AddRestoredSceneObject(sceneObject, true, false); | 3283 | AddRestoredSceneObject(sceneObject, true, false); |
2884 | } | 3284 | } |
2885 | 3285 | ||
2886 | return true; | 3286 | return true; |
2887 | } | 3287 | } |
2888 | 3288 | ||
3289 | <<<<<<< HEAD | ||
3290 | ======= | ||
3291 | private int GetStateSource(SceneObjectGroup sog) | ||
3292 | { | ||
3293 | ScenePresence sp = GetScenePresence(sog.OwnerID); | ||
3294 | |||
3295 | if (sp != null) | ||
3296 | return sp.GetStateSource(); | ||
3297 | |||
3298 | return 2; // StateSource.PrimCrossing | ||
3299 | } | ||
3300 | |||
3301 | public int GetUserFlags(UUID user) | ||
3302 | { | ||
3303 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
3304 | /* | ||
3305 | ScenePresence sp; | ||
3306 | if (TryGetScenePresence(user, out sp)) | ||
3307 | { | ||
3308 | return sp.UserFlags; | ||
3309 | } | ||
3310 | else | ||
3311 | { | ||
3312 | */ | ||
3313 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
3314 | if (uac == null) | ||
3315 | return 0; | ||
3316 | return uac.UserFlags; | ||
3317 | //} | ||
3318 | } | ||
3319 | >>>>>>> avn/ubitvar | ||
2889 | #endregion | 3320 | #endregion |
2890 | 3321 | ||
2891 | #region Add/Remove Avatar Methods | 3322 | #region Add/Remove Avatar Methods |
@@ -2921,9 +3352,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2921 | vialogin | 3352 | vialogin |
2922 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 3353 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2923 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 3354 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
3355 | <<<<<<< HEAD | ||
2924 | 3356 | ||
2925 | // CheckHeartbeat(); | 3357 | // CheckHeartbeat(); |
2926 | 3358 | ||
3359 | ======= | ||
3360 | |||
3361 | CheckHeartbeat(); | ||
3362 | |||
3363 | >>>>>>> avn/ubitvar | ||
2927 | sp = GetScenePresence(client.AgentId); | 3364 | sp = GetScenePresence(client.AgentId); |
2928 | 3365 | ||
2929 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this | 3366 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this |
@@ -2933,6 +3370,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2933 | if (sp == null) | 3370 | if (sp == null) |
2934 | { | 3371 | { |
2935 | m_log.DebugFormat( | 3372 | m_log.DebugFormat( |
3373 | <<<<<<< HEAD | ||
2936 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", | 3374 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2937 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | 3375 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); |
2938 | 3376 | ||
@@ -2954,6 +3392,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
2954 | m_eventManager.TriggerOnNewPresence(sp); | 3392 | m_eventManager.TriggerOnNewPresence(sp); |
2955 | 3393 | ||
2956 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 3394 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
3395 | ======= | ||
3396 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", | ||
3397 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, | ||
3398 | ((TPFlags)aCircuit.teleportFlags).ToString()); | ||
3399 | |||
3400 | m_clientManager.Add(client); | ||
3401 | SubscribeToClientEvents(client); | ||
3402 | |||
3403 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | ||
3404 | |||
3405 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | ||
3406 | |||
3407 | /* done in completMovement | ||
3408 | InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); | ||
3409 | if (cof == null) | ||
3410 | sp.COF = UUID.Zero; | ||
3411 | else | ||
3412 | sp.COF = cof.ID; | ||
3413 | |||
3414 | m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); | ||
3415 | */ | ||
3416 | m_eventManager.TriggerOnNewPresence(sp); | ||
3417 | |||
3418 | >>>>>>> avn/ubitvar | ||
2957 | } | 3419 | } |
2958 | else | 3420 | else |
2959 | { | 3421 | { |
@@ -2992,6 +3454,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2992 | return sp; | 3454 | return sp; |
2993 | } | 3455 | } |
2994 | 3456 | ||
3457 | public string GetAgentHomeURI(UUID agentID) | ||
3458 | { | ||
3459 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); | ||
3460 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) | ||
3461 | return circuit.ServiceURLs["HomeURI"].ToString(); | ||
3462 | else | ||
3463 | return null; | ||
3464 | } | ||
3465 | |||
2995 | /// <summary> | 3466 | /// <summary> |
2996 | /// Returns the Home URI of the agent, or null if unknown. | 3467 | /// Returns the Home URI of the agent, or null if unknown. |
2997 | /// </summary> | 3468 | /// </summary> |
@@ -3088,19 +3559,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3088 | // and the scene presence and the client, if they exist | 3559 | // and the scene presence and the client, if they exist |
3089 | try | 3560 | try |
3090 | { | 3561 | { |
3091 | // We need to wait for the client to make UDP contact first. | ||
3092 | // It's the UDP contact that creates the scene presence | ||
3093 | ScenePresence sp = WaitGetScenePresence(agentID); | 3562 | ScenePresence sp = WaitGetScenePresence(agentID); |
3563 | |||
3094 | if (sp != null) | 3564 | if (sp != null) |
3095 | { | 3565 | { |
3096 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3566 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
3097 | 3567 | ||
3098 | CloseAgent(sp.UUID, false); | 3568 | CloseAgent(sp.UUID, false); |
3099 | } | 3569 | } |
3100 | else | 3570 | |
3101 | { | ||
3102 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
3103 | } | ||
3104 | // BANG! SLASH! | 3571 | // BANG! SLASH! |
3105 | m_authenticateHandler.RemoveCircuit(agentID); | 3572 | m_authenticateHandler.RemoveCircuit(agentID); |
3106 | 3573 | ||
@@ -3137,7 +3604,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3137 | 3604 | ||
3138 | public virtual void SubscribeToClientTerrainEvents(IClientAPI client) | 3605 | public virtual void SubscribeToClientTerrainEvents(IClientAPI client) |
3139 | { | 3606 | { |
3140 | client.OnRegionHandShakeReply += SendLayerData; | 3607 | // client.OnRegionHandShakeReply += SendLayerData; |
3141 | } | 3608 | } |
3142 | 3609 | ||
3143 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 3610 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
@@ -3145,6 +3612,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3145 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3612 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
3146 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3613 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
3147 | 3614 | ||
3615 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3616 | |||
3148 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3617 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3149 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3618 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3150 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3619 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3201,6 +3670,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3201 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3670 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3202 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3671 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3203 | client.OnCopyInventoryItem += CopyInventoryItem; | 3672 | client.OnCopyInventoryItem += CopyInventoryItem; |
3673 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3204 | client.OnMoveInventoryItem += MoveInventoryItem; | 3674 | client.OnMoveInventoryItem += MoveInventoryItem; |
3205 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3675 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3206 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3676 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3262,7 +3732,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3262 | 3732 | ||
3263 | public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) | 3733 | public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) |
3264 | { | 3734 | { |
3265 | client.OnRegionHandShakeReply -= SendLayerData; | 3735 | // client.OnRegionHandShakeReply -= SendLayerData; |
3266 | } | 3736 | } |
3267 | 3737 | ||
3268 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) | 3738 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) |
@@ -3270,6 +3740,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3270 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3740 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3271 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3741 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3272 | 3742 | ||
3743 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3744 | |||
3273 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3745 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3274 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3746 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3275 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3747 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3518,6 +3990,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3518 | /// <param name='closeChildAgents'> | 3990 | /// <param name='closeChildAgents'> |
3519 | /// Close the neighbour child agents associated with this client. | 3991 | /// Close the neighbour child agents associated with this client. |
3520 | /// </param> | 3992 | /// </param> |
3993 | /// | ||
3994 | |||
3995 | private object m_removeClientPrivLock = new Object(); | ||
3996 | |||
3521 | public void RemoveClient(UUID agentID, bool closeChildAgents) | 3997 | public void RemoveClient(UUID agentID, bool closeChildAgents) |
3522 | { | 3998 | { |
3523 | AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID); | 3999 | AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID); |
@@ -3534,8 +4010,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3534 | } | 4010 | } |
3535 | 4011 | ||
3536 | // TODO: Can we now remove this lock? | 4012 | // TODO: Can we now remove this lock? |
4013 | <<<<<<< HEAD | ||
3537 | lock (acd) | 4014 | lock (acd) |
3538 | { | 4015 | { |
4016 | ======= | ||
4017 | lock (m_removeClientPrivLock) | ||
4018 | { | ||
4019 | >>>>>>> avn/ubitvar | ||
3539 | bool isChildAgent = false; | 4020 | bool isChildAgent = false; |
3540 | 4021 | ||
3541 | ScenePresence avatar = GetScenePresence(agentID); | 4022 | ScenePresence avatar = GetScenePresence(agentID); |
@@ -3579,8 +4060,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3579 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 4060 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3580 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 4061 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3581 | if (closeChildAgents && CapsModule != null) | 4062 | if (closeChildAgents && CapsModule != null) |
4063 | <<<<<<< HEAD | ||
3582 | CapsModule.RemoveCaps(agentID); | 4064 | CapsModule.RemoveCaps(agentID); |
3583 | 4065 | ||
4066 | ======= | ||
4067 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); | ||
4068 | |||
4069 | >>>>>>> avn/ubitvar | ||
3584 | if (closeChildAgents && !isChildAgent) | 4070 | if (closeChildAgents && !isChildAgent) |
3585 | { | 4071 | { |
3586 | List<ulong> regions = avatar.KnownRegionHandles; | 4072 | List<ulong> regions = avatar.KnownRegionHandles; |
@@ -3591,13 +4077,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3591 | } | 4077 | } |
3592 | 4078 | ||
3593 | m_eventManager.TriggerClientClosed(agentID, this); | 4079 | m_eventManager.TriggerClientClosed(agentID, this); |
4080 | // m_log.Debug("[Scene]TriggerClientClosed done"); | ||
3594 | m_eventManager.TriggerOnRemovePresence(agentID); | 4081 | m_eventManager.TriggerOnRemovePresence(agentID); |
4082 | <<<<<<< HEAD | ||
3595 | 4083 | ||
4084 | ======= | ||
4085 | // m_log.Debug("[Scene]TriggerOnRemovePresence done"); | ||
4086 | |||
4087 | >>>>>>> avn/ubitvar | ||
3596 | if (!isChildAgent) | 4088 | if (!isChildAgent) |
3597 | { | 4089 | { |
3598 | if (AttachmentsModule != null) | 4090 | if (AttachmentsModule != null) |
3599 | { | 4091 | { |
4092 | // m_log.Debug("[Scene]DeRezAttachments"); | ||
3600 | AttachmentsModule.DeRezAttachments(avatar); | 4093 | AttachmentsModule.DeRezAttachments(avatar); |
4094 | // m_log.Debug("[Scene]DeRezAttachments done"); | ||
3601 | } | 4095 | } |
3602 | 4096 | ||
3603 | ForEachClient( | 4097 | ForEachClient( |
@@ -3611,7 +4105,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | 4105 | ||
3612 | // It's possible for child agents to have transactions if changes are being made cross-border. | 4106 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3613 | if (AgentTransactionsModule != null) | 4107 | if (AgentTransactionsModule != null) |
4108 | { | ||
4109 | // m_log.Debug("[Scene]RemoveAgentAssetTransactions"); | ||
3614 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 4110 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
4111 | } | ||
4112 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3615 | } | 4113 | } |
3616 | catch (Exception e) | 4114 | catch (Exception e) |
3617 | { | 4115 | { |
@@ -3730,7 +4228,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3730 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> | 4228 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> |
3731 | /// <returns>True if the region accepts this agent. False if it does not. False will | 4229 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3732 | /// also return a reason.</returns> | 4230 | /// also return a reason.</returns> |
4231 | <<<<<<< HEAD | ||
3733 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) | 4232 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) |
4233 | ======= | ||
4234 | /// | ||
4235 | private object m_newUserConnLock = new object(); | ||
4236 | |||
4237 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) | ||
4238 | >>>>>>> avn/ubitvar | ||
3734 | { | 4239 | { |
3735 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 4240 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3736 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 4241 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
@@ -3763,6 +4268,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3763 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) | 4268 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) |
3764 | ); | 4269 | ); |
3765 | 4270 | ||
4271 | // m_log.DebugFormat("NewUserConnection stack {0}", Environment.StackTrace); | ||
4272 | |||
3766 | if (!LoginsEnabled) | 4273 | if (!LoginsEnabled) |
3767 | { | 4274 | { |
3768 | reason = "Logins Disabled"; | 4275 | reason = "Logins Disabled"; |
@@ -3890,7 +4397,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3890 | } | 4397 | } |
3891 | 4398 | ||
3892 | // TODO: can we remove this lock? | 4399 | // TODO: can we remove this lock? |
3893 | lock (acd) | 4400 | lock (m_newUserConnLock) |
3894 | { | 4401 | { |
3895 | if (sp != null && !sp.IsChildAgent) | 4402 | if (sp != null && !sp.IsChildAgent) |
3896 | { | 4403 | { |
@@ -3917,6 +4424,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3917 | // We need the circuit data here for some of the subsequent checks. (groups, for example) | 4424 | // We need the circuit data here for some of the subsequent checks. (groups, for example) |
3918 | // If the checks fail, we remove the circuit. | 4425 | // If the checks fail, we remove the circuit. |
3919 | acd.teleportFlags = teleportFlags; | 4426 | acd.teleportFlags = teleportFlags; |
4427 | |||
4428 | // Remove any preexisting circuit - we don't want duplicates | ||
4429 | // This is a stab at preventing avatar "ghosting" | ||
4430 | if (vialogin) | ||
4431 | m_authenticateHandler.RemoveCircuit(acd.AgentID); | ||
4432 | |||
3920 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | 4433 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); |
3921 | 4434 | ||
3922 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); | 4435 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); |
@@ -3924,6 +4437,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3924 | // On login test land permisions | 4437 | // On login test land permisions |
3925 | if (vialogin) | 4438 | if (vialogin) |
3926 | { | 4439 | { |
4440 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); | ||
4441 | if (cache != null) | ||
4442 | cache.Remove(acd.firstname + " " + acd.lastname); | ||
3927 | if (land != null && !TestLandRestrictions(acd.AgentID, out reason, ref acd.startpos.X, ref acd.startpos.Y)) | 4443 | if (land != null && !TestLandRestrictions(acd.AgentID, out reason, ref acd.startpos.X, ref acd.startpos.Y)) |
3928 | { | 4444 | { |
3929 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 4445 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
@@ -3978,7 +4494,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3978 | if (CapsModule != null) | 4494 | if (CapsModule != null) |
3979 | { | 4495 | { |
3980 | CapsModule.SetAgentCapsSeeds(acd); | 4496 | CapsModule.SetAgentCapsSeeds(acd); |
3981 | CapsModule.CreateCaps(acd.AgentID); | 4497 | CapsModule.CreateCaps(acd.AgentID, acd.circuitcode); |
3982 | } | 4498 | } |
3983 | } | 4499 | } |
3984 | else | 4500 | else |
@@ -3991,15 +4507,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3991 | { | 4507 | { |
3992 | m_log.DebugFormat( | 4508 | m_log.DebugFormat( |
3993 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 4509 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
4510 | <<<<<<< HEAD | ||
3994 | acd.AgentID, RegionInfo.RegionName); | 4511 | acd.AgentID, RegionInfo.RegionName); |
3995 | 4512 | ||
3996 | sp.AdjustKnownSeeds(); | 4513 | sp.AdjustKnownSeeds(); |
4514 | ======= | ||
4515 | acd.AgentID, RegionInfo.RegionName); | ||
4516 | >>>>>>> avn/ubitvar | ||
3997 | 4517 | ||
3998 | if (CapsModule != null) | 4518 | if (CapsModule != null) |
3999 | { | 4519 | { |
4000 | CapsModule.SetAgentCapsSeeds(acd); | 4520 | CapsModule.SetAgentCapsSeeds(acd); |
4001 | CapsModule.CreateCaps(acd.AgentID); | 4521 | CapsModule.CreateCaps(acd.AgentID, acd.circuitcode); |
4002 | } | 4522 | } |
4523 | |||
4524 | sp.AdjustKnownSeeds(); | ||
4003 | } | 4525 | } |
4004 | } | 4526 | } |
4005 | 4527 | ||
@@ -4009,6 +4531,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4009 | CacheUserName(null, acd); | 4531 | CacheUserName(null, acd); |
4010 | } | 4532 | } |
4011 | 4533 | ||
4534 | if (CapsModule != null) | ||
4535 | { | ||
4536 | CapsModule.ActivateCaps(acd.circuitcode); | ||
4537 | } | ||
4538 | |||
4012 | if (vialogin) | 4539 | if (vialogin) |
4013 | { | 4540 | { |
4014 | // CleanDroppedAttachments(); | 4541 | // CleanDroppedAttachments(); |
@@ -4078,6 +4605,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4078 | } | 4605 | } |
4079 | 4606 | ||
4080 | // Honor parcel landing type and position. | 4607 | // Honor parcel landing type and position. |
4608 | /* | ||
4609 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
4081 | if (land != null) | 4610 | if (land != null) |
4082 | { | 4611 | { |
4083 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4612 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -4092,6 +4621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4092 | } | 4621 | } |
4093 | } | 4622 | } |
4094 | } | 4623 | } |
4624 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
4095 | } | 4625 | } |
4096 | 4626 | ||
4097 | return true; | 4627 | return true; |
@@ -4116,12 +4646,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4116 | { | 4646 | { |
4117 | if (posX < 0) | 4647 | if (posX < 0) |
4118 | posX = 0; | 4648 | posX = 0; |
4649 | <<<<<<< HEAD | ||
4119 | else if (posX >= (float)RegionInfo.RegionSizeX) | 4650 | else if (posX >= (float)RegionInfo.RegionSizeX) |
4120 | posX = (float)RegionInfo.RegionSizeX - 0.001f; | 4651 | posX = (float)RegionInfo.RegionSizeX - 0.001f; |
4121 | if (posY < 0) | 4652 | if (posY < 0) |
4122 | posY = 0; | 4653 | posY = 0; |
4123 | else if (posY >= (float)RegionInfo.RegionSizeY) | 4654 | else if (posY >= (float)RegionInfo.RegionSizeY) |
4124 | posY = (float)RegionInfo.RegionSizeY - 0.001f; | 4655 | posY = (float)RegionInfo.RegionSizeY - 0.001f; |
4656 | ======= | ||
4657 | else if (posX >= RegionInfo.RegionSizeX) | ||
4658 | posX = RegionInfo.RegionSizeX - 0.5f; | ||
4659 | if (posY < 0) | ||
4660 | posY = 0; | ||
4661 | else if (posY >= RegionInfo.RegionSizeY) | ||
4662 | posY = RegionInfo.RegionSizeY - 0.5f; | ||
4663 | >>>>>>> avn/ubitvar | ||
4125 | 4664 | ||
4126 | reason = String.Empty; | 4665 | reason = String.Empty; |
4127 | if (Permissions.IsGod(agentID)) | 4666 | if (Permissions.IsGod(agentID)) |
@@ -4225,7 +4764,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4225 | { | 4764 | { |
4226 | if (RegionInfo.EstateSettings != null) | 4765 | if (RegionInfo.EstateSettings != null) |
4227 | { | 4766 | { |
4228 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4767 | int flags = GetUserFlags(agent.AgentID); |
4768 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, flags)) | ||
4229 | { | 4769 | { |
4230 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4770 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
4231 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4771 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4414,6 +4954,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
4414 | m_log.DebugFormat( | 4954 | m_log.DebugFormat( |
4415 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 4955 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
4416 | 4956 | ||
4957 | if (!LoginsEnabled) | ||
4958 | { | ||
4959 | // reason = "Logins Disabled"; | ||
4960 | m_log.DebugFormat( | ||
4961 | "[SCENE]: update for {0} in {1} refused: Logins Disabled", cAgentData.AgentID, RegionInfo.RegionName); | ||
4962 | return false; | ||
4963 | } | ||
4964 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4965 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4966 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4967 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4968 | { | ||
4969 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4970 | return false; | ||
4971 | } | ||
4972 | |||
4417 | // TODO: This check should probably be in QueryAccess(). | 4973 | // TODO: This check should probably be in QueryAccess(). |
4418 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); | 4974 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); |
4419 | if (nearestParcel == null) | 4975 | if (nearestParcel == null) |
@@ -4431,8 +4987,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4431 | // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence. | 4987 | // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence. |
4432 | ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID); | 4988 | ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID); |
4433 | 4989 | ||
4434 | if (sp != null) | 4990 | if (sp != null) |
4435 | { | 4991 | { |
4992 | if (!sp.IsChildAgent) | ||
4993 | { | ||
4994 | m_log.WarnFormat("[SCENE]: Ignoring a child update on a root agent {0} {1} in {2}", | ||
4995 | sp.Name, sp.UUID, Name); | ||
4996 | return false; | ||
4997 | } | ||
4436 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) | 4998 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) |
4437 | { | 4999 | { |
4438 | m_log.WarnFormat( | 5000 | m_log.WarnFormat( |
@@ -4517,7 +5079,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4517 | /// <param name='agentID'></param> | 5079 | /// <param name='agentID'></param> |
4518 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 5080 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4519 | { | 5081 | { |
4520 | int ntimes = 20; | 5082 | int ntimes = 30; |
4521 | ScenePresence sp = null; | 5083 | ScenePresence sp = null; |
4522 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 5084 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4523 | Thread.Sleep(1000); | 5085 | Thread.Sleep(1000); |
@@ -4567,6 +5129,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4567 | return false; | 5129 | return false; |
4568 | } | 5130 | } |
4569 | 5131 | ||
5132 | // public bool IncomingCloseAgent(UUID agentID) | ||
5133 | // { | ||
5134 | // return IncomingCloseAgent(agentID, false); | ||
5135 | // } | ||
5136 | |||
5137 | // public bool IncomingCloseChildAgent(UUID agentID) | ||
5138 | // { | ||
5139 | // return IncomingCloseAgent(agentID, true); | ||
5140 | // } | ||
5141 | |||
4570 | /// <summary> | 5142 | /// <summary> |
4571 | /// Tell a single client to prepare to close. | 5143 | /// Tell a single client to prepare to close. |
4572 | /// </summary> | 5144 | /// </summary> |
@@ -4629,6 +5201,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4629 | 5201 | ||
4630 | if (sp == null) | 5202 | if (sp == null) |
4631 | { | 5203 | { |
5204 | // If there is no scene presence, we may be handling a dead | ||
5205 | // client. These can keep an avatar from reentering a region | ||
5206 | // and since they don't get cleaned up they will stick | ||
5207 | // around until region restart. So, if there is no SP, | ||
5208 | // remove the client as well. | ||
5209 | IClientAPI client = null; | ||
5210 | if (m_clientManager.TryGetValue(agentID, out client)) | ||
5211 | { | ||
5212 | m_clientManager.Remove(agentID); | ||
5213 | if (CapsModule != null) | ||
5214 | CapsModule.RemoveCaps(agentID, 0); | ||
5215 | m_log.DebugFormat( "[SCENE]: Dead client for agent ID {0} was cleaned up in {1}", agentID, Name); | ||
5216 | return true; | ||
5217 | } | ||
4632 | m_log.DebugFormat( | 5218 | m_log.DebugFormat( |
4633 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", | 5219 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", |
4634 | agentID, Name); | 5220 | agentID, Name); |
@@ -4663,7 +5249,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4663 | sp.LifecycleState = ScenePresenceState.Removing; | 5249 | sp.LifecycleState = ScenePresenceState.Removing; |
4664 | } | 5250 | } |
4665 | 5251 | ||
5252 | <<<<<<< HEAD | ||
4666 | sp.ControllingClient.Close(force); | 5253 | sp.ControllingClient.Close(force); |
5254 | ======= | ||
5255 | if (sp != null) | ||
5256 | { | ||
5257 | sp.ControllingClient.Close(force, force); | ||
5258 | return true; | ||
5259 | } | ||
5260 | >>>>>>> avn/ubitvar | ||
4667 | 5261 | ||
4668 | return true; | 5262 | return true; |
4669 | } | 5263 | } |
@@ -4825,7 +5419,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4825 | 5419 | ||
4826 | public LandData GetLandData(float x, float y) | 5420 | public LandData GetLandData(float x, float y) |
4827 | { | 5421 | { |
4828 | return LandChannel.GetLandObject(x, y).LandData; | 5422 | ILandObject parcel = LandChannel.GetLandObject(x, y); |
5423 | if (parcel == null) | ||
5424 | return null; | ||
5425 | return parcel.LandData; | ||
4829 | } | 5426 | } |
4830 | 5427 | ||
4831 | /// <summary> | 5428 | /// <summary> |
@@ -4841,7 +5438,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4841 | public LandData GetLandData(uint x, uint y) | 5438 | public LandData GetLandData(uint x, uint y) |
4842 | { | 5439 | { |
4843 | m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); | 5440 | m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); |
4844 | return LandChannel.GetLandObject((int)x, (int)y).LandData; | 5441 | ILandObject parcel = LandChannel.GetLandObject((int)x, (int)y); |
5442 | if (parcel == null) | ||
5443 | return null; | ||
5444 | return parcel.LandData; | ||
4845 | } | 5445 | } |
4846 | 5446 | ||
4847 | #endregion | 5447 | #endregion |
@@ -5229,7 +5829,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5229 | { | 5829 | { |
5230 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5830 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
5231 | { | 5831 | { |
5232 | if (grp.RootPart.Expires <= DateTime.Now) | 5832 | if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) |
5233 | DeleteSceneObject(grp, false); | 5833 | DeleteSceneObject(grp, false); |
5234 | } | 5834 | } |
5235 | } | 5835 | } |
@@ -5243,35 +5843,85 @@ namespace OpenSim.Region.Framework.Scenes | |||
5243 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5843 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
5244 | } | 5844 | } |
5245 | 5845 | ||
5246 | public int GetHealth() | 5846 | public int GetHealth(out int flags, out string message) |
5247 | { | 5847 | { |
5248 | // Returns: | 5848 | // Returns: |
5249 | // 1 = sim is up and accepting http requests. The heartbeat has | 5849 | // 1 = sim is up and accepting http requests. The heartbeat has |
5250 | // stopped and the sim is probably locked up, but a remote | 5850 | // stopped and the sim is probably locked up, but a remote |
5251 | // admin restart may succeed | 5851 | // admin restart may succeed |
5252 | // | 5852 | // |
5253 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5853 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
5254 | // usable for people within and logins _may_ work | 5854 | // usable for people within |
5855 | // | ||
5856 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5857 | // unstable and will not accept new logins | ||
5255 | // | 5858 | // |
5256 | // 3 = We have seen a new user enter within the past 4 minutes | 5859 | // 4 = Sim is up and both packet threads are running. Sim is |
5860 | // likely usable | ||
5861 | // | ||
5862 | // 5 = We have seen a new user enter within the past 4 minutes | ||
5257 | // which can be seen as positive confirmation of sim health | 5863 | // which can be seen as positive confirmation of sim health |
5258 | // | 5864 | // |
5865 | <<<<<<< HEAD | ||
5259 | int health = 1; // Start at 1, means we're up | 5866 | int health = 1; // Start at 1, means we're up |
5867 | ======= | ||
5868 | |||
5869 | flags = 0; | ||
5870 | message = String.Empty; | ||
5871 | |||
5872 | CheckHeartbeat(); | ||
5873 | |||
5874 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5875 | { | ||
5876 | // We're still starting | ||
5877 | // 0 means "in startup", it can't happen another way, since | ||
5878 | // to get here, we must be able to accept http connections | ||
5879 | return 0; | ||
5880 | } | ||
5881 | |||
5882 | int health=1; // Start at 1, means we're up | ||
5883 | >>>>>>> avn/ubitvar | ||
5260 | 5884 | ||
5261 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5885 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
5262 | health += 1; | 5886 | { |
5887 | health+=1; | ||
5888 | flags |= 1; | ||
5889 | } | ||
5890 | |||
5891 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5892 | { | ||
5893 | health+=1; | ||
5894 | flags |= 2; | ||
5895 | } | ||
5896 | |||
5897 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5898 | { | ||
5899 | health+=1; | ||
5900 | flags |= 4; | ||
5901 | } | ||
5263 | else | 5902 | else |
5903 | { | ||
5904 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5905 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5906 | proc.EnableRaisingEvents=false; | ||
5907 | proc.StartInfo.FileName = "/bin/kill"; | ||
5908 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5909 | proc.Start(); | ||
5910 | proc.WaitForExit(); | ||
5911 | Thread.Sleep(1000); | ||
5912 | Environment.Exit(1); | ||
5913 | } | ||
5914 | |||
5915 | if (flags != 7) | ||
5264 | return health; | 5916 | return health; |
5265 | 5917 | ||
5266 | // A login in the last 4 mins? We can't be doing too badly | 5918 | // A login in the last 4 mins? We can't be doing too badly |
5267 | // | 5919 | // |
5268 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5920 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
5269 | health++; | 5921 | health++; |
5270 | else | 5922 | else |
5271 | return health; | 5923 | return health; |
5272 | 5924 | ||
5273 | // CheckHeartbeat(); | ||
5274 | |||
5275 | return health; | 5925 | return health; |
5276 | } | 5926 | } |
5277 | 5927 | ||
@@ -5359,7 +6009,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5359 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 6009 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5360 | if (wasUsingPhysics) | 6010 | if (wasUsingPhysics) |
5361 | { | 6011 | { |
5362 | jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock | 6012 | jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock |
5363 | } | 6013 | } |
5364 | } | 6014 | } |
5365 | 6015 | ||
@@ -5462,14 +6112,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5462 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 6112 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5463 | } | 6113 | } |
5464 | 6114 | ||
5465 | // private void CheckHeartbeat() | 6115 | private void CheckHeartbeat() |
5466 | // { | 6116 | { |
5467 | // if (m_firstHeartbeat) | 6117 | if (m_firstHeartbeat) |
5468 | // return; | 6118 | return; |
5469 | // | 6119 | |
5470 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 6120 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5471 | // StartTimer(); | 6121 | Start(); |
5472 | // } | 6122 | } |
5473 | 6123 | ||
5474 | public override ISceneObject DeserializeObject(string representation) | 6124 | public override ISceneObject DeserializeObject(string representation) |
5475 | { | 6125 | { |
@@ -5526,8 +6176,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5526 | //Go to the edge, this happens in teleporting to a region with no available parcels | 6176 | //Go to the edge, this happens in teleporting to a region with no available parcels |
5527 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); | 6177 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); |
5528 | 6178 | ||
6179 | <<<<<<< HEAD | ||
5529 | //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | 6180 | //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); |
5530 | 6181 | ||
6182 | ======= | ||
6183 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | ||
6184 | |||
6185 | >>>>>>> avn/ubitvar | ||
5531 | return nearestRegionEdgePoint; | 6186 | return nearestRegionEdgePoint; |
5532 | } | 6187 | } |
5533 | 6188 | ||
@@ -5783,7 +6438,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5783 | mapModule.GenerateMaptile(); | 6438 | mapModule.GenerateMaptile(); |
5784 | } | 6439 | } |
5785 | 6440 | ||
5786 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 6441 | // public void CleanDroppedAttachments() |
6442 | // { | ||
6443 | // List<SceneObjectGroup> objectsToDelete = | ||
6444 | // new List<SceneObjectGroup>(); | ||
6445 | // | ||
6446 | // lock (m_cleaningAttachments) | ||
6447 | // { | ||
6448 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
6449 | // { | ||
6450 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
6451 | // { | ||
6452 | // UUID agentID = grp.OwnerID; | ||
6453 | // if (agentID == UUID.Zero) | ||
6454 | // { | ||
6455 | // objectsToDelete.Add(grp); | ||
6456 | // return; | ||
6457 | // } | ||
6458 | // | ||
6459 | // ScenePresence sp = GetScenePresence(agentID); | ||
6460 | // if (sp == null) | ||
6461 | // { | ||
6462 | // objectsToDelete.Add(grp); | ||
6463 | // return; | ||
6464 | // } | ||
6465 | // } | ||
6466 | // }); | ||
6467 | // } | ||
6468 | // | ||
6469 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
6470 | // { | ||
6471 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
6472 | // DeleteSceneObject(grp, true); | ||
6473 | // } | ||
6474 | // } | ||
6475 | |||
6476 | public void ThreadAlive(int threadCode) | ||
6477 | { | ||
6478 | switch(threadCode) | ||
6479 | { | ||
6480 | case 1: // Incoming | ||
6481 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
6482 | break; | ||
6483 | case 2: // Incoming | ||
6484 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
6485 | break; | ||
6486 | } | ||
6487 | } | ||
6488 | |||
6489 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5787 | { | 6490 | { |
5788 | RegenerateMaptile(); | 6491 | RegenerateMaptile(); |
5789 | 6492 | ||
@@ -5810,7 +6513,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5810 | /// <param name='position'></param> | 6513 | /// <param name='position'></param> |
5811 | /// <param name='reason'></param> | 6514 | /// <param name='reason'></param> |
5812 | /// <returns></returns> | 6515 | /// <returns></returns> |
6516 | <<<<<<< HEAD | ||
5813 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason) | 6517 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason) |
6518 | ======= | ||
6519 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) | ||
6520 | >>>>>>> avn/ubitvar | ||
5814 | { | 6521 | { |
5815 | reason = string.Empty; | 6522 | reason = string.Empty; |
5816 | 6523 | ||
@@ -5820,8 +6527,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5820 | return true; | 6527 | return true; |
5821 | } | 6528 | } |
5822 | 6529 | ||
6530 | <<<<<<< HEAD | ||
5823 | if (!AllowAvatarCrossing && !viaTeleport) | 6531 | if (!AllowAvatarCrossing && !viaTeleport) |
5824 | return false; | 6532 | return false; |
6533 | ======= | ||
6534 | |||
6535 | // if (!AllowAvatarCrossing && !viaTeleport) | ||
6536 | // return false; | ||
6537 | >>>>>>> avn/ubitvar | ||
5825 | 6538 | ||
5826 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 6539 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5827 | // However, the long term fix is to make sure root agent count is always accurate. | 6540 | // However, the long term fix is to make sure root agent count is always accurate. |
@@ -5949,7 +6662,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
5949 | return true; | 6662 | return true; |
5950 | } | 6663 | } |
5951 | 6664 | ||
5952 | /// <summary> | 6665 | public void StartTimerWatchdog() |
6666 | { | ||
6667 | m_timerWatchdog.Interval = 1000; | ||
6668 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
6669 | m_timerWatchdog.AutoReset = true; | ||
6670 | m_timerWatchdog.Start(); | ||
6671 | } | ||
6672 | |||
6673 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
6674 | { | ||
6675 | CheckHeartbeat(); | ||
6676 | } | ||
6677 | |||
5953 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 6678 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5954 | /// autopilot that moves an avatar to a sit target!. | 6679 | /// autopilot that moves an avatar to a sit target!. |
5955 | /// </summary> | 6680 | /// </summary> |
@@ -6028,6 +6753,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
6028 | return m_SpawnPoint - 1; | 6753 | return m_SpawnPoint - 1; |
6029 | } | 6754 | } |
6030 | 6755 | ||
6756 | private void HandleGcCollect(string module, string[] args) | ||
6757 | { | ||
6758 | GC.Collect(); | ||
6759 | } | ||
6760 | |||
6031 | /// <summary> | 6761 | /// <summary> |
6032 | /// Wrappers to get physics modules retrieve assets. | 6762 | /// Wrappers to get physics modules retrieve assets. |
6033 | /// </summary> | 6763 | /// </summary> |