diff options
author | UbitUmarov | 2015-12-16 22:16:51 +0000 |
---|---|---|
committer | UbitUmarov | 2015-12-16 22:16:51 +0000 |
commit | 41ae6f06e01e29ae4d9637d6682a47f6d4964f75 (patch) | |
tree | 2c52b24ee50170de1614ba3d33b946b5a5754845 /OpenSim | |
parent | make parcel bans do something on vehicles. Just a first code, far from good (diff) | |
download | opensim-SC_OLD-41ae6f06e01e29ae4d9637d6682a47f6d4964f75.zip opensim-SC_OLD-41ae6f06e01e29ae4d9637d6682a47f6d4964f75.tar.gz opensim-SC_OLD-41ae6f06e01e29ae4d9637d6682a47f6d4964f75.tar.bz2 opensim-SC_OLD-41ae6f06e01e29ae4d9637d6682a47f6d4964f75.tar.xz |
several changes to parcels access control and scenepresence updates rates
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 221 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 119 |
2 files changed, 169 insertions, 171 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 7b4c724..65aabac 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -98,6 +98,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
98 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 98 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
99 | 99 | ||
100 | private bool m_allowedForcefulBans = true; | 100 | private bool m_allowedForcefulBans = true; |
101 | private bool m_showBansLines = true; | ||
101 | private UUID DefaultGodParcelGroup; | 102 | private UUID DefaultGodParcelGroup; |
102 | private string DefaultGodParcelName; | 103 | private string DefaultGodParcelName; |
103 | 104 | ||
@@ -107,7 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
107 | /// <summary> | 108 | /// <summary> |
108 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. | 109 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. |
109 | /// </summary> | 110 | /// </summary> |
110 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); | 111 | private HashSet<UUID> forcedPosition = new HashSet<UUID>(); |
111 | 112 | ||
112 | 113 | ||
113 | // Enables limiting parcel layer info transmission when doing simple updates | 114 | // Enables limiting parcel layer info transmission when doing simple updates |
@@ -133,6 +134,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
133 | parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); | 134 | parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); |
134 | DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | 135 | DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); |
135 | DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel"); | 136 | DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel"); |
137 | bool disablebans = landManagementConfig.GetBoolean("DisableParcelBans", !m_allowedForcefulBans); | ||
138 | m_allowedForcefulBans = !disablebans; | ||
139 | m_showBansLines = landManagementConfig.GetBoolean("ShowParcelBansLines", m_showBansLines); | ||
136 | } | 140 | } |
137 | } | 141 | } |
138 | 142 | ||
@@ -212,15 +216,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
212 | client.OnParcelEjectUser += ClientOnParcelEjectUser; | 216 | client.OnParcelEjectUser += ClientOnParcelEjectUser; |
213 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; | 217 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; |
214 | client.OnSetStartLocationRequest += ClientOnSetHome; | 218 | client.OnSetStartLocationRequest += ClientOnSetHome; |
215 | |||
216 | /* avatar is still a child here position is unknown | ||
217 | EntityBase presenceEntity; | ||
218 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | ||
219 | { | ||
220 | SendLandUpdate((ScenePresence)presenceEntity, true); | ||
221 | SendParcelOverlay(client); | ||
222 | } | ||
223 | */ | ||
224 | } | 219 | } |
225 | 220 | ||
226 | public void EventMakeChildAgent(ScenePresence avatar) | 221 | public void EventMakeChildAgent(ScenePresence avatar) |
@@ -316,9 +311,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
316 | public List<ILandObject> ParcelsNearPoint(Vector3 position) | 311 | public List<ILandObject> ParcelsNearPoint(Vector3 position) |
317 | { | 312 | { |
318 | List<ILandObject> parcelsNear = new List<ILandObject>(); | 313 | List<ILandObject> parcelsNear = new List<ILandObject>(); |
319 | for (int x = -4; x <= 4; x += 4) | 314 | for (int x = -8; x <= 8; x += 4) |
320 | { | 315 | { |
321 | for (int y = -4; y <= 4; y += 4) | 316 | for (int y = -8; y <= 8; y += 4) |
322 | { | 317 | { |
323 | ILandObject check = GetLandObject(position.X + x, position.Y + y); | 318 | ILandObject check = GetLandObject(position.X + x, position.Y + y); |
324 | if (check != null) | 319 | if (check != null) |
@@ -334,17 +329,81 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
334 | return parcelsNear; | 329 | return parcelsNear; |
335 | } | 330 | } |
336 | 331 | ||
337 | public void SendYouAreBannedNotice(ScenePresence avatar) | 332 | // checks and enforces bans or restrictions |
333 | // returns true if enforced | ||
334 | public bool EnforceBans(ILandObject land, ScenePresence avatar) | ||
338 | { | 335 | { |
339 | if (AllowedForcefulBans) | 336 | Vector3 agentpos = avatar.AbsolutePosition; |
337 | float h = m_scene.GetGroundHeight(agentpos.X, agentpos.Y) + LandChannel.BAN_LINE_SAFETY_HEIGHT; | ||
338 | float zdif = avatar.AbsolutePosition.Z - h; | ||
339 | if (zdif > 0 ) | ||
340 | { | ||
341 | forcedPosition.Remove(avatar.UUID); | ||
342 | avatar.lastKnownAllowedPosition = agentpos; | ||
343 | return false; | ||
344 | } | ||
345 | |||
346 | bool ban = false; | ||
347 | string reason = ""; | ||
348 | if (land.IsRestrictedFromLand(avatar.UUID)) | ||
340 | { | 349 | { |
341 | avatar.ControllingClient.SendAlertMessage( | 350 | reason = "You do not have access to the parcel"; |
342 | "You are not allowed on this parcel because you are banned. Please go away."); | 351 | ban = true; |
352 | } | ||
353 | |||
354 | if (land.IsBannedFromLand(avatar.UUID)) | ||
355 | { | ||
356 | if ( m_allowedForcefulBans) | ||
357 | { | ||
358 | reason ="You are banned from parcel"; | ||
359 | ban = true; | ||
360 | } | ||
361 | else if(!ban) | ||
362 | { | ||
363 | if (forcedPosition.Contains(avatar.UUID)) | ||
364 | avatar.ControllingClient.SendAlertMessage("You are banned from parcel, please leave by your own will"); | ||
365 | forcedPosition.Remove(avatar.UUID); | ||
366 | avatar.lastKnownAllowedPosition = agentpos; | ||
367 | return false; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | if(ban) | ||
372 | { | ||
373 | if (!forcedPosition.Contains(avatar.UUID)) | ||
374 | avatar.ControllingClient.SendAlertMessage(reason); | ||
375 | |||
376 | if(zdif > -4f) | ||
377 | { | ||
378 | |||
379 | agentpos.Z = h + 4.0f; | ||
380 | ForceAvatarToPosition(avatar, agentpos); | ||
381 | return true; | ||
382 | } | ||
383 | |||
384 | if (land.ContainsPoint((int)avatar.lastKnownAllowedPosition.X, | ||
385 | (int) avatar.lastKnownAllowedPosition.Y)) | ||
386 | { | ||
387 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
388 | if (pos == null) | ||
389 | { | ||
390 | forcedPosition.Remove(avatar.UUID); | ||
391 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
392 | } | ||
393 | else | ||
394 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
395 | } | ||
396 | else | ||
397 | { | ||
398 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
399 | } | ||
400 | return true; | ||
343 | } | 401 | } |
344 | else | 402 | else |
345 | { | 403 | { |
346 | avatar.ControllingClient.SendAlertMessage( | 404 | forcedPosition.Remove(avatar.UUID); |
347 | "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim!"); | 405 | avatar.lastKnownAllowedPosition = agentpos; |
406 | return false; | ||
348 | } | 407 | } |
349 | } | 408 | } |
350 | 409 | ||
@@ -360,12 +419,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
360 | avatar.Velocity = Vector3.Zero; | 419 | avatar.Velocity = Vector3.Zero; |
361 | if(avatar.IsSatOnObject) | 420 | if(avatar.IsSatOnObject) |
362 | avatar.StandUp(); | 421 | avatar.StandUp(); |
363 | } | 422 | forcedPosition.Add(avatar.UUID); |
364 | |||
365 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | ||
366 | { | ||
367 | avatar.ControllingClient.SendAlertMessage( | ||
368 | "You are not allowed on this parcel because the land owner has restricted access."); | ||
369 | } | 423 | } |
370 | 424 | ||
371 | public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) | 425 | public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) |
@@ -378,15 +432,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
378 | parcelAvatarIsEntering = m_landList[localLandID]; | 432 | parcelAvatarIsEntering = m_landList[localLandID]; |
379 | } | 433 | } |
380 | 434 | ||
381 | if (parcelAvatarIsEntering != null) | 435 | if (parcelAvatarIsEntering != null && |
436 | avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) | ||
437 | { | ||
438 | SendLandUpdate(avatar, parcelAvatarIsEntering); | ||
439 | avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; | ||
382 | EnforceBans(parcelAvatarIsEntering, avatar); | 440 | EnforceBans(parcelAvatarIsEntering, avatar); |
441 | } | ||
383 | } | 442 | } |
384 | } | 443 | } |
385 | 444 | ||
386 | public void SendOutNearestBanLine(IClientAPI client) | 445 | public void SendOutNearestBanLine(IClientAPI client) |
387 | { | 446 | { |
388 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | 447 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
389 | if (sp == null) | 448 | if (sp == null || sp.IsDeleted) |
390 | return; | 449 | return; |
391 | 450 | ||
392 | List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); | 451 | List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); |
@@ -413,7 +472,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
413 | if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar)) | 472 | if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar)) |
414 | return; | 473 | return; |
415 | 474 | ||
416 | |||
417 | if (!avatar.IsChildAgent) | 475 | if (!avatar.IsChildAgent) |
418 | { | 476 | { |
419 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 477 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
@@ -426,77 +484,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
426 | SendParcelOverlay(remoteClient); | 484 | SendParcelOverlay(remoteClient); |
427 | } | 485 | } |
428 | 486 | ||
429 | public void SendLandUpdate(ScenePresence avatar, bool force) | 487 | public void SendLandUpdate(ScenePresence avatar, ILandObject over) |
430 | { | 488 | { |
431 | if (avatar.IsChildAgent) | 489 | if (avatar.IsChildAgent) |
432 | return; | 490 | return; |
433 | 491 | ||
434 | ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
435 | |||
436 | if (over != null) | 492 | if (over != null) |
437 | { | 493 | { |
438 | bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID); | 494 | over.SendLandUpdateToClient(avatar.ControllingClient); |
439 | if (force || NotsameID) | ||
440 | { | ||
441 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
442 | // sl doesnt seem to send this now, as it used 2 | 495 | // sl doesnt seem to send this now, as it used 2 |
443 | // SendParcelOverlay(avatar.ControllingClient); | 496 | // SendParcelOverlay(avatar.ControllingClient); |
444 | avatar.currentParcelUUID = over.LandData.GlobalID; | ||
445 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
446 | m_scene.RegionInfo.RegionID); | ||
447 | } | ||
448 | } | 497 | } |
449 | } | 498 | } |
450 | 499 | ||
451 | public void SendLandUpdate(ScenePresence avatar) | 500 | public void EventManagerOnSignificantClientMovement(ScenePresence avatar) |
452 | { | 501 | { |
453 | SendLandUpdate(avatar, false); | 502 | if (avatar.IsChildAgent) |
454 | } | 503 | return; |
455 | 504 | ||
456 | public void EventManagerOnSignificantClientMovement(ScenePresence clientAvatar) | 505 | if ( m_allowedForcefulBans && m_showBansLines) |
457 | { | 506 | SendOutNearestBanLine(avatar.ControllingClient); |
458 | SendLandUpdate(clientAvatar); | ||
459 | SendOutNearestBanLine(clientAvatar.ControllingClient); | ||
460 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | ||
461 | if (parcel != null) | ||
462 | { | ||
463 | if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HEIGHT && | ||
464 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | ||
465 | { | ||
466 | EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, | ||
467 | m_scene.RegionInfo.RegionID); | ||
468 | //They are going under the safety line! | ||
469 | if (!parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
470 | { | ||
471 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | ||
472 | } | ||
473 | } | ||
474 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HEIGHT && | ||
475 | parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
476 | { | ||
477 | //once we've sent the message once, keep going toward the target until we are done | ||
478 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
479 | { | ||
480 | SendYouAreBannedNotice(clientAvatar); | ||
481 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
482 | } | ||
483 | } | ||
484 | else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) | ||
485 | { | ||
486 | //once we've sent the message once, keep going toward the target until we are done | ||
487 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
488 | { | ||
489 | SendYouAreRestrictedNotice(clientAvatar); | ||
490 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
491 | } | ||
492 | } | ||
493 | else | ||
494 | { | ||
495 | //when we are finally in a safe place, lets release the forced position lock | ||
496 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | ||
497 | } | ||
498 | EnforceBans(parcel, clientAvatar); | ||
499 | } | ||
500 | } | 507 | } |
501 | 508 | ||
502 | /// <summary> | 509 | /// <summary> |
@@ -505,12 +512,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
505 | /// <param name="avatar"></param> | 512 | /// <param name="avatar"></param> |
506 | public void EventManagerOnClientMovement(ScenePresence avatar) | 513 | public void EventManagerOnClientMovement(ScenePresence avatar) |
507 | { | 514 | { |
515 | if (avatar.IsChildAgent) | ||
516 | return; | ||
517 | |||
508 | Vector3 pos = avatar.AbsolutePosition; | 518 | Vector3 pos = avatar.AbsolutePosition; |
509 | ILandObject over = GetLandObject(pos.X, pos.Y); | 519 | ILandObject over = GetLandObject(pos.X, pos.Y); |
510 | if (over != null) | 520 | if (over != null) |
511 | { | 521 | { |
512 | if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || pos.Z >= LandChannel.BAN_LINE_SAFETY_HEIGHT)) | 522 | EnforceBans(over, avatar); |
513 | avatar.lastKnownAllowedPosition = pos; | 523 | pos = avatar.AbsolutePosition; |
524 | ILandObject newover = GetLandObject(pos.X, pos.Y); | ||
525 | if(over != newover || avatar.currentParcelUUID != newover.LandData.GlobalID) | ||
526 | { | ||
527 | avatar.currentParcelUUID = newover.LandData.GlobalID; | ||
528 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, | ||
529 | newover.LandData.LocalID, m_scene.RegionInfo.RegionID); | ||
530 | } | ||
514 | } | 531 | } |
515 | } | 532 | } |
516 | 533 | ||
@@ -1216,7 +1233,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1216 | } | 1233 | } |
1217 | } | 1234 | } |
1218 | } | 1235 | } |
1219 | |||
1220 | } | 1236 | } |
1221 | 1237 | ||
1222 | if (byteArrayCount > 0) | 1238 | if (byteArrayCount > 0) |
@@ -1965,8 +1981,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1965 | returns.Add(e); | 1981 | returns.Add(e); |
1966 | } | 1982 | } |
1967 | } | 1983 | } |
1968 | } | 1984 | }); |
1969 | ); | ||
1970 | } | 1985 | } |
1971 | if (flags == 4) //not target parcel, scripted object | 1986 | if (flags == 4) //not target parcel, scripted object |
1972 | { | 1987 | { |
@@ -1983,8 +1998,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1983 | } | 1998 | } |
1984 | } | 1999 | } |
1985 | } | 2000 | } |
1986 | } | 2001 | }); |
1987 | ); | ||
1988 | } | 2002 | } |
1989 | foreach (SceneObjectGroup ol in returns) | 2003 | foreach (SceneObjectGroup ol in returns) |
1990 | { | 2004 | { |
@@ -2044,7 +2058,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2044 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | 2058 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); |
2045 | } | 2059 | } |
2046 | 2060 | ||
2047 | |||
2048 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | 2061 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) |
2049 | { | 2062 | { |
2050 | ScenePresence targetAvatar = null; | 2063 | ScenePresence targetAvatar = null; |
@@ -2247,28 +2260,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2247 | 2260 | ||
2248 | } | 2261 | } |
2249 | 2262 | ||
2250 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
2251 | { | ||
2252 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HEIGHT) | ||
2253 | return; | ||
2254 | |||
2255 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
2256 | { | ||
2257 | if (land.ContainsPoint((int)avatar.lastKnownAllowedPosition.X, (int)avatar.lastKnownAllowedPosition.Y)) | ||
2258 | { | ||
2259 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
2260 | if (pos == null) | ||
2261 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
2262 | else | ||
2263 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
2264 | } | ||
2265 | else | ||
2266 | { | ||
2267 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
2268 | } | ||
2269 | } | ||
2270 | } | ||
2271 | |||
2272 | private void AppendParcelReport(StringBuilder report, ILandObject lo) | 2263 | private void AppendParcelReport(StringBuilder report, ILandObject lo) |
2273 | { | 2264 | { |
2274 | LandData ld = lo.LandData; | 2265 | LandData ld = lo.LandData; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4c3bc67..4c62127 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -150,8 +150,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | /// Movement updates for agents in neighboring regions are sent directly to clients. | 150 | /// Movement updates for agents in neighboring regions are sent directly to clients. |
151 | /// This value only affects how often agent positions are sent to neighbor regions | 151 | /// This value only affects how often agent positions are sent to neighbor regions |
152 | /// for things such as distance-based update prioritization | 152 | /// for things such as distance-based update prioritization |
153 | /// this are the square of real distances | ||
153 | /// </summary> | 154 | /// </summary> |
154 | public static readonly float SIGNIFICANT_MOVEMENT = 2.0f; | 155 | public static readonly float MOVEMENT = .25f; |
156 | public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; | ||
157 | public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; | ||
158 | public static readonly float CHILDUPDATES_TIME = 10000f; // min time between child updates (ms) | ||
155 | 159 | ||
156 | private UUID m_previusParcelUUID = UUID.Zero; | 160 | private UUID m_previusParcelUUID = UUID.Zero; |
157 | private UUID m_currentParcelUUID = UUID.Zero; | 161 | private UUID m_currentParcelUUID = UUID.Zero; |
@@ -189,6 +193,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | 193 | ||
190 | public void sitSOGmoved() | 194 | public void sitSOGmoved() |
191 | { | 195 | { |
196 | /* | ||
192 | if (IsDeleted || !IsSatOnObject) | 197 | if (IsDeleted || !IsSatOnObject) |
193 | //what me? nahh | 198 | //what me? nahh |
194 | return; | 199 | return; |
@@ -201,6 +206,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
201 | UUID parcelID = land.LandData.GlobalID; | 206 | UUID parcelID = land.LandData.GlobalID; |
202 | if (m_currentParcelUUID != parcelID) | 207 | if (m_currentParcelUUID != parcelID) |
203 | currentParcelUUID = parcelID; | 208 | currentParcelUUID = parcelID; |
209 | */ | ||
204 | } | 210 | } |
205 | 211 | ||
206 | 212 | ||
@@ -325,6 +331,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | 331 | ||
326 | private float m_sitAvatarHeight = 2.0f; | 332 | private float m_sitAvatarHeight = 2.0f; |
327 | 333 | ||
334 | private bool childUpdatesActive = false; | ||
335 | private int lastChildUpdatesTime; | ||
328 | private Vector3 m_lastChildAgentUpdatePosition; | 336 | private Vector3 m_lastChildAgentUpdatePosition; |
329 | // private Vector3 m_lastChildAgentUpdateCamPosition; | 337 | // private Vector3 m_lastChildAgentUpdateCamPosition; |
330 | 338 | ||
@@ -417,6 +425,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
417 | /// Position at which a significant movement was made | 425 | /// Position at which a significant movement was made |
418 | /// </summary> | 426 | /// </summary> |
419 | private Vector3 posLastSignificantMove; | 427 | private Vector3 posLastSignificantMove; |
428 | private Vector3 posLastMove; | ||
420 | 429 | ||
421 | #region For teleports and crossings callbacks | 430 | #region For teleports and crossings callbacks |
422 | 431 | ||
@@ -1021,9 +1030,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1021 | 1030 | ||
1022 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); | 1031 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); |
1023 | 1032 | ||
1024 | AbsolutePosition = posLastSignificantMove = CameraPosition = | 1033 | AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = |
1025 | m_lastCameraPosition = ControllingClient.StartPos; | 1034 | m_lastCameraPosition = ControllingClient.StartPos; |
1026 | 1035 | ||
1036 | childUpdatesActive = true; // disable it for now | ||
1037 | |||
1027 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); | 1038 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); |
1028 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 1039 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
1029 | m_reprioritization_timer.AutoReset = false; | 1040 | m_reprioritization_timer.AutoReset = false; |
@@ -2024,6 +2035,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2024 | { | 2035 | { |
2025 | m_agentTransfer.EnableChildAgents(this); | 2036 | m_agentTransfer.EnableChildAgents(this); |
2026 | } | 2037 | } |
2038 | // let updates be sent, with some delay | ||
2039 | lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; | ||
2040 | childUpdatesActive = false; // allow them | ||
2027 | } | 2041 | } |
2028 | } | 2042 | } |
2029 | 2043 | ||
@@ -2502,7 +2516,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2502 | if ((State & (uint)AgentState.Editing) != 0) | 2516 | if ((State & (uint)AgentState.Editing) != 0) |
2503 | SendAgentTerseUpdate(this); | 2517 | SendAgentTerseUpdate(this); |
2504 | 2518 | ||
2505 | m_scene.EventManager.TriggerOnClientMovement(this); | 2519 | // m_scene.EventManager.TriggerOnClientMovement(this); |
2506 | } | 2520 | } |
2507 | 2521 | ||
2508 | 2522 | ||
@@ -3464,7 +3478,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) | 3478 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) |
3465 | SendAvatarDataToAllAgents(); | 3479 | SendAvatarDataToAllAgents(); |
3466 | 3480 | ||
3467 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 3481 | if (!IsSatOnObject || |
3482 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | ||
3468 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 3483 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
3469 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 3484 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
3470 | { | 3485 | { |
@@ -3865,63 +3880,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
3865 | /// </summary> | 3880 | /// </summary> |
3866 | protected void CheckForSignificantMovement() | 3881 | protected void CheckForSignificantMovement() |
3867 | { | 3882 | { |
3868 | if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT) | 3883 | Vector3 pos = AbsolutePosition; |
3884 | |||
3885 | Vector3 diff = pos - posLastMove; | ||
3886 | if (diff.LengthSquared() > MOVEMENT) | ||
3869 | { | 3887 | { |
3870 | posLastSignificantMove = AbsolutePosition; | 3888 | posLastMove = pos; |
3889 | m_scene.EventManager.TriggerOnClientMovement(this); | ||
3890 | } | ||
3891 | |||
3892 | diff = pos - posLastSignificantMove; | ||
3893 | if (diff.LengthSquared() > SIGNIFICANT_MOVEMENT) | ||
3894 | { | ||
3895 | posLastSignificantMove = pos; | ||
3871 | m_scene.EventManager.TriggerSignificantClientMovement(this); | 3896 | m_scene.EventManager.TriggerSignificantClientMovement(this); |
3872 | } | 3897 | } |
3873 | 3898 | ||
3874 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m | 3899 | if(!childUpdatesActive) |
3875 | if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance) | ||
3876 | { | 3900 | { |
3877 | m_lastChildAgentUpdatePosition = AbsolutePosition; | 3901 | int tdiff = Util.EnvironmentTickCountSubtract(lastChildUpdatesTime); |
3878 | // m_lastChildAgentUpdateCamPosition = CameraPosition; | 3902 | if(tdiff > CHILDUPDATES_TIME) |
3879 | 3903 | { | |
3880 | /* cadu is not used | 3904 | diff = pos - m_lastChildAgentUpdatePosition; |
3881 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 3905 | if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) |
3882 | cadu.ActiveGroupID = UUID.Zero.Guid; | 3906 | { |
3883 | cadu.AgentID = UUID.Guid; | 3907 | childUpdatesActive = true; |
3884 | cadu.alwaysrun = SetAlwaysRun; | 3908 | m_lastChildAgentUpdatePosition = pos; |
3885 | cadu.AVHeight = Appearance.AvatarHeight; | 3909 | // m_lastChildAgentUpdateCamPosition = CameraPosition; |
3886 | cadu.cameraPosition = CameraPosition; | 3910 | |
3887 | cadu.drawdistance = DrawDistance; | 3911 | AgentPosition agentpos = new AgentPosition(); |
3888 | cadu.GroupAccess = 0; | 3912 | agentpos.AgentID = new UUID(UUID.Guid); |
3889 | cadu.Position = AbsolutePosition; | 3913 | agentpos.SessionID = ControllingClient.SessionId; |
3890 | cadu.regionHandle = RegionHandle; | 3914 | agentpos.Size = Appearance.AvatarSize; |
3891 | 3915 | agentpos.Center = CameraPosition; | |
3892 | // Throttles | 3916 | agentpos.Far = DrawDistance; |
3893 | float multiplier = 1; | 3917 | agentpos.Position = AbsolutePosition; |
3894 | 3918 | agentpos.Velocity = Velocity; | |
3895 | int childRegions = KnownRegionCount; | 3919 | agentpos.RegionHandle = RegionHandle; |
3896 | if (childRegions != 0) | 3920 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); |
3897 | multiplier = 1f / childRegions; | 3921 | |
3898 | 3922 | // Let's get this out of the update loop | |
3899 | // Minimum throttle for a child region is 1/4 of the root region throttle | 3923 | Util.FireAndForget( |
3900 | if (multiplier <= 0.25f) | 3924 | o => |
3901 | multiplier = 0.25f; | 3925 | { |
3902 | 3926 | m_scene.SendOutChildAgentUpdates(agentpos, this); | |
3903 | cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); | 3927 | lastChildUpdatesTime = Util.EnvironmentTickCount(); |
3904 | cadu.Velocity = Velocity; | 3928 | childUpdatesActive= false; |
3905 | */ | 3929 | }, null, "ScenePresence.SendOutChildAgentUpdates"); |
3906 | AgentPosition agentpos = new AgentPosition(); | 3930 | } |
3907 | // agentpos.CopyFrom(cadu, ControllingClient.SessionId); | 3931 | } |
3908 | |||
3909 | agentpos.AgentID = new UUID(UUID.Guid); | ||
3910 | agentpos.SessionID = ControllingClient.SessionId; | ||
3911 | |||
3912 | agentpos.Size = Appearance.AvatarSize; | ||
3913 | |||
3914 | agentpos.Center = CameraPosition; | ||
3915 | agentpos.Far = DrawDistance; | ||
3916 | agentpos.Position = AbsolutePosition; | ||
3917 | agentpos.Velocity = Velocity; | ||
3918 | agentpos.RegionHandle = RegionHandle; | ||
3919 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); | ||
3920 | |||
3921 | |||
3922 | // Let's get this out of the update loop | ||
3923 | Util.FireAndForget( | ||
3924 | o => m_scene.SendOutChildAgentUpdates(agentpos, this), null, "ScenePresence.SendOutChildAgentUpdates"); | ||
3925 | } | 3932 | } |
3926 | } | 3933 | } |
3927 | 3934 | ||