diff options
author | Teravus Ovares | 2008-05-30 11:25:21 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-30 11:25:21 +0000 |
commit | 334d05db05772c61d8ebb9f697ee4219965943f1 (patch) | |
tree | 3e99f1d8f01cbce32846e686fb75a33ebfaa022a | |
parent | Update svn properties. Formatting cleanup. (diff) | |
download | opensim-SC_OLD-334d05db05772c61d8ebb9f697ee4219965943f1.zip opensim-SC_OLD-334d05db05772c61d8ebb9f697ee4219965943f1.tar.gz opensim-SC_OLD-334d05db05772c61d8ebb9f697ee4219965943f1.tar.bz2 opensim-SC_OLD-334d05db05772c61d8ebb9f697ee4219965943f1.tar.xz |
* Fixed a dangling event hook that I added.
* Added a Non-finite avatar position reset. This will either handle the <0,0,0> avatar gracefully, or send the avatar to 127,127,127 if that also doesn't work. ( I've only been able to reproduce this error once on my development workstation )
Diffstat (limited to '')
4 files changed, 116 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index ff179da..6476a4b 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |||
@@ -183,6 +183,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
183 | // Time of day / fixed sun | 183 | // Time of day / fixed sun |
184 | m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; | 184 | m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; |
185 | m_scene.RegionInfo.EstateSettings.sunHour = SunHour; | 185 | m_scene.RegionInfo.EstateSettings.sunHour = SunHour; |
186 | m_scene.EventManager.TriggerEstateToolsTimeUpdate(m_scene.RegionInfo.RegionHandle, UseFixedSun, UseFixedSun, SunHour); | ||
186 | //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); | 187 | //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); |
187 | //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); | 188 | //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); |
188 | sendRegionInfoPacketToAll(); | 189 | sendRegionInfoPacketToAll(); |
diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index e1358db..7e4877c 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | |||
@@ -94,7 +94,8 @@ namespace OpenSim.Region.Environment.Modules | |||
94 | private LLVector3 Position = new LLVector3(0,0,0); | 94 | private LLVector3 Position = new LLVector3(0,0,0); |
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 | private float LindenEstateHour = 6f; | 97 | //private float LindenEstateHour = 6f; |
98 | private long LindenHourOffset = 0; | ||
98 | private bool sunFixed = false; | 99 | private bool sunFixed = false; |
99 | private long estateTicksOffset = 0; | 100 | private long estateTicksOffset = 0; |
100 | 101 | ||
@@ -104,13 +105,14 @@ namespace OpenSim.Region.Environment.Modules | |||
104 | private ulong CurrentTime | 105 | private ulong CurrentTime |
105 | { | 106 | { |
106 | get { | 107 | get { |
107 | 108 | //m_log.Debug("[LH]: " + LindenHourOffset.ToString()); | |
108 | return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset)/10000000); | 109 | return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset + LindenHourOffset)/10000000); |
109 | } | 110 | } |
110 | } | 111 | } |
112 | |||
111 | private float GetLindenEstateHourFromCurrentTime() | 113 | private float GetLindenEstateHourFromCurrentTime() |
112 | { | 114 | { |
113 | float ticksleftover = ((float)((ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset) / 10000000))) % ((float)SecondsPerSunCycle); | 115 | float ticksleftover = ((float)CurrentTime) % ((float)SecondsPerSunCycle); |
114 | //m_log.Debug("[TICKS]: " + ticksleftover.ToString()); | 116 | //m_log.Debug("[TICKS]: " + ticksleftover.ToString()); |
115 | float hour = (24 * (ticksleftover / SecondsPerSunCycle)) + 6; | 117 | float hour = (24 * (ticksleftover / SecondsPerSunCycle)) + 6; |
116 | //m_log.Debug("[LINDENHOUR]: " + hour.ToString()); | 118 | //m_log.Debug("[LINDENHOUR]: " + hour.ToString()); |
@@ -120,6 +122,33 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | return hour; | 122 | return hour; |
121 | } | 123 | } |
122 | 124 | ||
125 | private void SetTimeByLindenHour(float LindenHour) | ||
126 | { | ||
127 | if (LindenHour - 6 == 0) | ||
128 | { | ||
129 | LindenHourOffset = 0; | ||
130 | return; | ||
131 | } | ||
132 | //TimeZone local = TimeZone.CurrentTimeZone; | ||
133 | //TicksOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; | ||
134 | |||
135 | float ticksleftover = ((float)(((long)(CurrentTime * 10000000) - (long)LindenHourOffset)/ 10000000) % ((float)SecondsPerSunCycle)); | ||
136 | float hour = (24 * (ticksleftover / SecondsPerSunCycle)); | ||
137 | float offsethours = 0; | ||
138 | |||
139 | if (LindenHour - 6 > hour) | ||
140 | { | ||
141 | offsethours = hour + ((LindenHour-6) - hour); | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | offsethours = hour - (hour - (LindenHour - 6)); | ||
146 | } | ||
147 | //m_log.Debug("[OFFSET]: " + hour + " - " + LindenHour + " - " + offsethours.ToString()); | ||
148 | //LindenHourOffset = (long)((float)offsethours * (-14400000)); | ||
149 | //m_log.Debug("[SUN]: Using " + CurrentTime.ToString()); | ||
150 | |||
151 | } | ||
123 | // Called immediately after the module is loaded for a given region | 152 | // Called immediately after the module is loaded for a given region |
124 | // i.e. Immediately after instance creation. | 153 | // i.e. Immediately after instance creation. |
125 | 154 | ||
@@ -203,6 +232,7 @@ namespace OpenSim.Region.Environment.Modules | |||
203 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | 232 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; |
204 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 233 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
205 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 234 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
235 | scene.EventManager.OnEstateToolsTimeUpdate += EstateToolsTimeUpdate; | ||
206 | 236 | ||
207 | ready = true; | 237 | ready = true; |
208 | 238 | ||
@@ -226,8 +256,9 @@ namespace OpenSim.Region.Environment.Modules | |||
226 | m_scene.EventManager.OnFrame -= SunUpdate; | 256 | m_scene.EventManager.OnFrame -= SunUpdate; |
227 | // m_scene.EventManager.OnNewClient -= SunToClient; | 257 | // m_scene.EventManager.OnNewClient -= SunToClient; |
228 | m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; | 258 | m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; |
229 | m_scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 259 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; |
230 | m_scene.EventManager.OnClientClosed += ClientLoggedOut; | 260 | m_scene.EventManager.OnClientClosed -= ClientLoggedOut; |
261 | m_scene.EventManager.OnEstateToolsTimeUpdate -= EstateToolsTimeUpdate; | ||
231 | } | 262 | } |
232 | 263 | ||
233 | public string Name | 264 | public string Name |
@@ -273,7 +304,21 @@ namespace OpenSim.Region.Environment.Modules | |||
273 | m_scene.RegionInfo.EstateSettings.sunPosition = Position; | 304 | m_scene.RegionInfo.EstateSettings.sunPosition = Position; |
274 | m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime(); | 305 | m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime(); |
275 | } | 306 | } |
307 | public void ForceSunUpdateToAllClients() | ||
308 | { | ||
309 | GenSunPos(); // Generate shared values once | ||
310 | |||
311 | List<ScenePresence> avatars = m_scene.GetAvatars(); | ||
312 | foreach (ScenePresence avatar in avatars) | ||
313 | { | ||
314 | if (!avatar.IsChildAgent) | ||
315 | avatar.ControllingClient.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); | ||
316 | } | ||
276 | 317 | ||
318 | // set estate settings for region access to sun position | ||
319 | m_scene.RegionInfo.EstateSettings.sunPosition = Position; | ||
320 | m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime(); | ||
321 | } | ||
277 | /// <summary> | 322 | /// <summary> |
278 | /// Calculate the sun's orbital position and its velocity. | 323 | /// Calculate the sun's orbital position and its velocity. |
279 | /// </summary> | 324 | /// </summary> |
@@ -370,5 +415,20 @@ namespace OpenSim.Region.Environment.Modules | |||
370 | } | 415 | } |
371 | } | 416 | } |
372 | } | 417 | } |
418 | |||
419 | public void EstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float LindenHour) | ||
420 | { | ||
421 | if (m_scene.RegionInfo.RegionHandle == regionHandle) | ||
422 | { | ||
423 | SetTimeByLindenHour(LindenHour); | ||
424 | |||
425 | //if (useEstateTime) | ||
426 | //LindenHourOffset = 0; | ||
427 | |||
428 | //ForceSunUpdateToAllClients(); | ||
429 | //ready = true;// !FixedTime; | ||
430 | |||
431 | } | ||
432 | } | ||
373 | } | 433 | } |
374 | } | 434 | } |
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index e77bebc..c7d21c8 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -180,6 +180,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | 180 | ||
181 | public event ScriptTimerEvent OnScriptTimerEvent; | 181 | public event ScriptTimerEvent OnScriptTimerEvent; |
182 | 182 | ||
183 | public delegate void EstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | ||
184 | public event EstateToolsTimeUpdate OnEstateToolsTimeUpdate; | ||
183 | 185 | ||
184 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 186 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
185 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | 187 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; |
@@ -346,6 +348,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; | 348 | private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; |
347 | private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; | 349 | private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; |
348 | private ScriptTimerEvent handlerScriptTimerEvent = null; | 350 | private ScriptTimerEvent handlerScriptTimerEvent = null; |
351 | private EstateToolsTimeUpdate handlerEstateToolsTimeUpdate = null; | ||
349 | 352 | ||
350 | public void TriggerOnScriptChangedEvent(uint localID, uint change) | 353 | public void TriggerOnScriptChangedEvent(uint localID, uint change) |
351 | { | 354 | { |
@@ -798,5 +801,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
798 | } | 801 | } |
799 | 802 | ||
800 | } | 803 | } |
804 | |||
805 | public void TriggerEstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float LindenHour) | ||
806 | { | ||
807 | handlerEstateToolsTimeUpdate = OnEstateToolsTimeUpdate; | ||
808 | if (handlerEstateToolsTimeUpdate != null) | ||
809 | { | ||
810 | handlerEstateToolsTimeUpdate(regionHandle, FixedTime, useEstateTime, LindenHour); | ||
811 | } | ||
812 | } | ||
801 | } | 813 | } |
802 | } | 814 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 96adbe7..30075da 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -90,6 +90,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
90 | private short m_updateCount = 0; | 90 | private short m_updateCount = 0; |
91 | private uint m_requestedSitTargetID = 0; | 91 | private uint m_requestedSitTargetID = 0; |
92 | private LLVector3 m_requestedSitOffset = new LLVector3(); | 92 | private LLVector3 m_requestedSitOffset = new LLVector3(); |
93 | |||
94 | private LLVector3 m_LastFinitePos = new LLVector3(); | ||
95 | |||
93 | private float m_sitAvatarHeight = 2.0f; | 96 | private float m_sitAvatarHeight = 2.0f; |
94 | private float m_godlevel = 0; | 97 | private float m_godlevel = 0; |
95 | 98 | ||
@@ -750,6 +753,40 @@ namespace OpenSim.Region.Environment.Scenes | |||
750 | 753 | ||
751 | // Must check for standing up even when PhysicsActor is null, | 754 | // Must check for standing up even when PhysicsActor is null, |
752 | // since sitting currently removes avatar from physical scene | 755 | // since sitting currently removes avatar from physical scene |
756 | //m_log.Debug("agentPos:" + AbsolutePosition.ToString()); | ||
757 | |||
758 | // This is irritating. Really. | ||
759 | if (!AbsolutePosition.IsFinite()) | ||
760 | { | ||
761 | RemoveFromPhysicalScene(); | ||
762 | m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999902"); | ||
763 | |||
764 | m_pos = m_LastFinitePos; | ||
765 | if (!m_pos.IsFinite()) | ||
766 | { | ||
767 | m_pos.X = 127f; | ||
768 | m_pos.Y = 127f; | ||
769 | m_pos.Z = 127f; | ||
770 | m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903"); | ||
771 | } | ||
772 | |||
773 | AddToPhysicalScene(); | ||
774 | } | ||
775 | else | ||
776 | { | ||
777 | m_LastFinitePos = m_pos; | ||
778 | } | ||
779 | //m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true); | ||
780 | |||
781 | |||
782 | //ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
783 | //if (land != null) | ||
784 | //{ | ||
785 | //if (land.landData.landingType == (byte)1 && land.landData.userLocation != LLVector3.Zero) | ||
786 | //{ | ||
787 | // agent.startpos = land.landData.userLocation; | ||
788 | //} | ||
789 | //} | ||
753 | 790 | ||
754 | m_perfMonMS = System.Environment.TickCount; | 791 | m_perfMonMS = System.Environment.TickCount; |
755 | 792 | ||