aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-28 05:20:23 +0000
committerTeravus Ovares2008-02-28 05:20:23 +0000
commit1afe38b319d8306b372b639ac2ad2c8e71c3e75d (patch)
treea888a2e24fbd6487b2561b54559b4ce209be36df /OpenSim/Region/Environment
parent* OnSignificantClientMovement was never being called. So we got no land updat... (diff)
downloadopensim-SC-1afe38b319d8306b372b639ac2ad2c8e71c3e75d.zip
opensim-SC-1afe38b319d8306b372b639ac2ad2c8e71c3e75d.tar.gz
opensim-SC-1afe38b319d8306b372b639ac2ad2c8e71c3e75d.tar.bz2
opensim-SC-1afe38b319d8306b372b639ac2ad2c8e71c3e75d.tar.xz
* Added a way for the friends module to definitively know if an avatar's root agent is on the instance and if so, which region the avatar's root agent is in.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs54
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs2
4 files changed, 70 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 4f6015a..83ed3cf 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -775,6 +775,8 @@ namespace OpenSim.Region.Environment.LandManagement
775 if (!avatar.IsChildAgent) 775 if (!avatar.IsChildAgent)
776 { 776 {
777 over.sendLandUpdateToClient(avatar.ControllingClient); 777 over.sendLandUpdateToClient(avatar.ControllingClient);
778 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID,
779 m_scene.RegionInfo.RegionID);
778 } 780 }
779 } 781 }
780 782
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index 4081a75..e1d3e2a 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Region.Environment.Modules
45 45
46 private List<Scene> m_scene = new List<Scene>(); 46 private List<Scene> m_scene = new List<Scene>();
47 47
48
49 Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
48 Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>(); 50 Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
49 51
50 public void Initialise(Scene scene, IConfigSource config) 52 public void Initialise(Scene scene, IConfigSource config)
@@ -62,6 +64,9 @@ namespace OpenSim.Region.Environment.Modules
62 scene.EventManager.OnNewClient += OnNewClient; 64 scene.EventManager.OnNewClient += OnNewClient;
63 scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage; 65 scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
64 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 66 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
67 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
68 scene.EventManager.OnClientClosed += ClientLoggedOut;
69
65 70
66 71
67 } 72 }
@@ -86,13 +91,60 @@ namespace OpenSim.Region.Environment.Modules
86 client.OnTerminateFriendship += OnTerminateFriendship; 91 client.OnTerminateFriendship += OnTerminateFriendship;
87 92
88 93
94
89 95
90 96
91 } 97 }
92 98
99 private void ClientLoggedOut(LLUUID AgentId)
100 {
101 lock (m_rootAgents)
102 {
103 if (m_rootAgents.ContainsKey(AgentId))
104 {
105 m_rootAgents.Remove(AgentId);
106 m_log.Info("[FRIEND]: Removing " + AgentId + ". Agent logged out.");
107 }
108 }
109 }
110
93 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID) 111 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
94 { 112 {
95 int i = 0; 113 lock (m_rootAgents)
114 {
115 if (m_rootAgents.ContainsKey(avatar.UUID))
116 {
117 if (avatar.RegionHandle != m_rootAgents[avatar.UUID])
118 {
119 m_rootAgents[avatar.UUID] = avatar.RegionHandle;
120 m_log.Info("[FRIEND]: Claiming " + avatar.Firstname + " " + avatar.Lastname + " in region:" + avatar.RegionHandle + ".");
121 // Claim User! my user! Mine mine mine!
122 }
123 }
124 else
125 {
126 m_rootAgents.Add(avatar.UUID, avatar.RegionHandle);
127 m_log.Info("[FRIEND]: Claiming " + avatar.Firstname + " " + avatar.Lastname + " in region:" + avatar.RegionHandle + ".");
128 }
129 }
130 //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString());
131 }
132 private void MakeChildAgent(ScenePresence avatar)
133 {
134
135 lock (m_rootAgents)
136 {
137 if (m_rootAgents.ContainsKey(avatar.UUID))
138 {
139 if (m_rootAgents[avatar.UUID] == avatar.RegionHandle)
140 {
141 m_rootAgents.Remove(avatar.UUID);
142 m_log.Info("[FRIEND]: Removing " + avatar.Firstname + " " + avatar.Lastname + " as a root agent");
143 }
144
145 }
146 }
147
96 } 148 }
97 149
98 private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID, 150 private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID,
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 5389ec4..62011ea 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -133,6 +133,9 @@ namespace OpenSim.Region.Environment.Scenes
133 133
134 public event ScriptChangedEvent OnScriptChangedEvent; 134 public event ScriptChangedEvent OnScriptChangedEvent;
135 135
136 public event OnNewPresenceDelegate OnMakeChildAgent;
137
138
136 public class MoneyTransferArgs : System.EventArgs 139 public class MoneyTransferArgs : System.EventArgs
137 { 140 {
138 public LLUUID sender; 141 public LLUUID sender;
@@ -185,6 +188,7 @@ namespace OpenSim.Region.Environment.Scenes
185 private NewGridInstantMessage handler023 = null; //OnGridInstantMessageToIMModule; 188 private NewGridInstantMessage handler023 = null; //OnGridInstantMessageToIMModule;
186 private NewGridInstantMessage handler024 = null; //OnGridInstantMessageToFriendsModule; 189 private NewGridInstantMessage handler024 = null; //OnGridInstantMessageToFriendsModule;
187 private ClientClosed handler025 = null; //OnClientClosed; 190 private ClientClosed handler025 = null; //OnClientClosed;
191 private OnNewPresenceDelegate handler026 = null; //OnMakeChildAgent;
188 192
189 public void TriggerOnScriptChangedEvent(uint localID, uint change) 193 public void TriggerOnScriptChangedEvent(uint localID, uint change)
190 { 194 {
@@ -405,6 +409,16 @@ namespace OpenSim.Region.Environment.Scenes
405 handler025(ClientID); 409 handler025(ClientID);
406 } 410 }
407 } 411 }
412
413 public void TriggerOnMakeChildAgent(ScenePresence presence)
414 {
415 handler026 = OnMakeChildAgent;
416 if (handler026 != null)
417 {
418 handler026(presence);
419 }
420
421 }
408 422
409 } 423 }
410} \ No newline at end of file 424} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 9f3c924..ef23432 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
547 m_isChildAgent = true; 547 m_isChildAgent = true;
548 m_scene.SwapRootAgentCount(true); 548 m_scene.SwapRootAgentCount(true);
549 RemoveFromPhysicalScene(); 549 RemoveFromPhysicalScene();
550 550 m_scene.EventManager.TriggerOnMakeChildAgent(this);
551 //this.Pos = new LLVector3(128, 128, 70); 551 //this.Pos = new LLVector3(128, 128, 70);
552 } 552 }
553 553