diff options
author | Teravus Ovares | 2008-05-30 00:48:57 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-30 00:48:57 +0000 |
commit | cdfb1f3623fc99429f638a589e91929d518a1ab4 (patch) | |
tree | 27746a7b2745c47134154aaa2e50ec1579d2ce0a | |
parent | * Caches UUIDName requests (diff) | |
download | opensim-SC_OLD-cdfb1f3623fc99429f638a589e91929d518a1ab4.zip opensim-SC_OLD-cdfb1f3623fc99429f638a589e91929d518a1ab4.tar.gz opensim-SC_OLD-cdfb1f3623fc99429f638a589e91929d518a1ab4.tar.bz2 opensim-SC_OLD-cdfb1f3623fc99429f638a589e91929d518a1ab4.tar.xz |
* Updated sun module to only send sun updates to root agents. Because it was sending updates to both root and child agents, you'll still get sun jitter until this revision is adopted by every region nearby.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index 1bdc702..6e8c28a 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | |||
@@ -95,6 +95,7 @@ namespace OpenSim.Region.Environment.Modules | |||
95 | private LLVector3 Velocity = new LLVector3(0,0,0); | 95 | private LLVector3 Velocity = new LLVector3(0,0,0); |
96 | private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); | 96 | private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); |
97 | 97 | ||
98 | private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); | ||
98 | 99 | ||
99 | // Current time in elpased seconds since Jan 1st 1970 | 100 | // Current time in elpased seconds since Jan 1st 1970 |
100 | private ulong CurrentTime | 101 | private ulong CurrentTime |
@@ -183,7 +184,10 @@ namespace OpenSim.Region.Environment.Modules | |||
183 | // Insert our event handling hooks | 184 | // Insert our event handling hooks |
184 | 185 | ||
185 | scene.EventManager.OnFrame += SunUpdate; | 186 | scene.EventManager.OnFrame += SunUpdate; |
186 | scene.EventManager.OnNewClient += SunToClient; | 187 | //scene.EventManager.OnNewClient += SunToClient; |
188 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | ||
189 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | ||
190 | scene.EventManager.OnClientClosed += ClientLoggedOut; | ||
187 | 191 | ||
188 | ready = true; | 192 | ready = true; |
189 | 193 | ||
@@ -205,7 +209,10 @@ namespace OpenSim.Region.Environment.Modules | |||
205 | ready = false; | 209 | ready = false; |
206 | // Remove our hooks | 210 | // Remove our hooks |
207 | m_scene.EventManager.OnFrame -= SunUpdate; | 211 | m_scene.EventManager.OnFrame -= SunUpdate; |
208 | m_scene.EventManager.OnNewClient -= SunToClient; | 212 | // m_scene.EventManager.OnNewClient -= SunToClient; |
213 | m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; | ||
214 | m_scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | ||
215 | m_scene.EventManager.OnClientClosed += ClientLoggedOut; | ||
209 | } | 216 | } |
210 | 217 | ||
211 | public string Name | 218 | public string Name |
@@ -243,7 +250,8 @@ namespace OpenSim.Region.Environment.Modules | |||
243 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 250 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
244 | foreach (ScenePresence avatar in avatars) | 251 | foreach (ScenePresence avatar in avatars) |
245 | { | 252 | { |
246 | avatar.ControllingClient.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); | 253 | if (!avatar.IsChildAgent) |
254 | avatar.ControllingClient.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); | ||
247 | } | 255 | } |
248 | 256 | ||
249 | // set estate settings for region access to sun position | 257 | // set estate settings for region access to sun position |
@@ -303,5 +311,48 @@ namespace OpenSim.Region.Environment.Modules | |||
303 | // m_log.Debug("[SUN] Velocity("+Velocity.X+","+Velocity.Y+","+Velocity.Z+")"); | 311 | // m_log.Debug("[SUN] Velocity("+Velocity.X+","+Velocity.Y+","+Velocity.Z+")"); |
304 | 312 | ||
305 | } | 313 | } |
314 | |||
315 | private void ClientLoggedOut(LLUUID AgentId) | ||
316 | { | ||
317 | lock (m_rootAgents) | ||
318 | { | ||
319 | if (m_rootAgents.ContainsKey(AgentId)) | ||
320 | { | ||
321 | m_rootAgents.Remove(AgentId); | ||
322 | m_log.Info("[SUN]: Removing " + AgentId + ". Agent logged out."); | ||
323 | } | ||
324 | } | ||
325 | } | ||
326 | |||
327 | private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID) | ||
328 | { | ||
329 | lock (m_rootAgents) | ||
330 | { | ||
331 | if (m_rootAgents.ContainsKey(avatar.UUID)) | ||
332 | { | ||
333 | m_rootAgents[avatar.UUID] = avatar.RegionHandle; | ||
334 | } | ||
335 | else | ||
336 | { | ||
337 | m_rootAgents.Add(avatar.UUID, avatar.RegionHandle); | ||
338 | SunToClient(avatar.ControllingClient); | ||
339 | } | ||
340 | } | ||
341 | //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString()); | ||
342 | } | ||
343 | |||
344 | private void MakeChildAgent(ScenePresence avatar) | ||
345 | { | ||
346 | lock (m_rootAgents) | ||
347 | { | ||
348 | if (m_rootAgents.ContainsKey(avatar.UUID)) | ||
349 | { | ||
350 | if (m_rootAgents[avatar.UUID] == avatar.RegionHandle) | ||
351 | { | ||
352 | m_rootAgents.Remove(avatar.UUID); | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | } | ||
306 | } | 357 | } |
307 | } | 358 | } |