diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 |
3 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index c5a2284..43eb95a 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -941,6 +941,27 @@ namespace OpenSim.Region.ClientStack | |||
941 | this.OutPacket(terse); | 941 | this.OutPacket(terse); |
942 | } | 942 | } |
943 | 943 | ||
944 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) | ||
945 | { | ||
946 | CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); | ||
947 | int total = CoarseLocations.Count; | ||
948 | CoarseLocationUpdatePacket.IndexBlock ib = | ||
949 | new CoarseLocationUpdatePacket.IndexBlock(); | ||
950 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; | ||
951 | for(int i=0; i<total; i++) { | ||
952 | CoarseLocationUpdatePacket.LocationBlock lb = | ||
953 | new CoarseLocationUpdatePacket.LocationBlock(); | ||
954 | lb.X = (byte)CoarseLocations[i].X; | ||
955 | lb.Y = (byte)CoarseLocations[i].Y; | ||
956 | lb.Z = (byte)(CoarseLocations[i].Z/4); | ||
957 | loc.Location[i] = lb; | ||
958 | } | ||
959 | ib.You = -1; | ||
960 | ib.Prey = -1; | ||
961 | loc.Index = ib; | ||
962 | this.OutPacket(loc); | ||
963 | } | ||
964 | |||
944 | #endregion | 965 | #endregion |
945 | 966 | ||
946 | #region Primitive Packet/data Sending Methods | 967 | #region Primitive Packet/data Sending Methods |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index c96d575..8cf0b98 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -64,6 +64,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
64 | 64 | ||
65 | private bool newForce = false; | 65 | private bool newForce = false; |
66 | private bool newAvatar = false; | 66 | private bool newAvatar = false; |
67 | private bool newCoarseLocations = false; | ||
67 | 68 | ||
68 | protected RegionInfo m_regionInfo; | 69 | protected RegionInfo m_regionInfo; |
69 | protected ulong crossingFromRegion = 0; | 70 | protected ulong crossingFromRegion = 0; |
@@ -462,6 +463,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
462 | { | 463 | { |
463 | this.SendPrimUpdates(); | 464 | this.SendPrimUpdates(); |
464 | 465 | ||
466 | if (this.newCoarseLocations) { | ||
467 | this.SendCoarseLocations(); | ||
468 | this.newCoarseLocations = false; | ||
469 | } | ||
470 | |||
465 | if (this.childAgent == false) | 471 | if (this.childAgent == false) |
466 | { | 472 | { |
467 | if (this.newForce) | 473 | if (this.newForce) |
@@ -515,6 +521,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
515 | } | 521 | } |
516 | } | 522 | } |
517 | 523 | ||
524 | |||
525 | public void SendCoarseLocations() | ||
526 | { | ||
527 | List<LLVector3> CoarseLocations = new List<LLVector3>(); | ||
528 | List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); | ||
529 | for (int i = 0; i < avatars.Count; i++) | ||
530 | { | ||
531 | if (avatars[i] != this) { | ||
532 | CoarseLocations.Add(avatars[i].AbsolutePosition); | ||
533 | } | ||
534 | } | ||
535 | this.ControllingClient.SendCoarseLocationUpdate(CoarseLocations); | ||
536 | } | ||
537 | |||
538 | public void CoarseLocationChange(ScenePresence avatar) | ||
539 | { | ||
540 | newCoarseLocations = true; | ||
541 | } | ||
542 | |||
543 | private void NotifyMyCoarseLocationChange() | ||
544 | { | ||
545 | List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); | ||
546 | for (int i = 0; i < avatars.Count; i++) { | ||
547 | if (avatars[i] != this) { | ||
548 | avatars[i].CoarseLocationChange(this); | ||
549 | } | ||
550 | } | ||
551 | |||
552 | } | ||
553 | |||
554 | |||
518 | /// <summary> | 555 | /// <summary> |
519 | /// | 556 | /// |
520 | /// </summary> | 557 | /// </summary> |
@@ -638,6 +675,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
638 | if (OnSignificantClientMovement != null) | 675 | if (OnSignificantClientMovement != null) |
639 | { | 676 | { |
640 | OnSignificantClientMovement(this.ControllingClient); | 677 | OnSignificantClientMovement(this.ControllingClient); |
678 | NotifyMyCoarseLocationChange(); | ||
641 | } | 679 | } |
642 | } | 680 | } |
643 | } | 681 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 7e1f5c1..7053c84 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -154,6 +154,7 @@ namespace SimpleApp | |||
154 | 154 | ||
155 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } | 155 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } |
156 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } | 156 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } |
157 | public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } | ||
157 | 158 | ||
158 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } | 159 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } |
159 | 160 | ||