aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs10
5 files changed, 37 insertions, 61 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index eb06fcc..d05abc5 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
118 { 118 {
119 uint sun = 0; 119 uint sun = 0;
120 120
121 if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) 121 if (Scene.RegionInfo.EstateSettings.FixedSun)
122 sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800; 122 sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800;
123 UUID estateOwner; 123 UUID estateOwner;
124 estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner; 124 estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1091,6 +1091,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1091 { 1091 {
1092 Scene.RegionInfo.EstateSettings.UseGlobalTime = false; 1092 Scene.RegionInfo.EstateSettings.UseGlobalTime = false;
1093 Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; 1093 Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0;
1094 // Warning: FixedSun should be set to True, otherwise this sun position won't be used.
1094 } 1095 }
1095 1096
1096 if ((parms1 & 0x00000010) != 0) 1097 if ((parms1 & 0x00000010) != 0)
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index a321c09..6f344c8 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -252,12 +252,11 @@ namespace OpenSim.Region.CoreModules
252 } 252 }
253 253
254 // TODO: Decouple this, so we can get rid of Linden Hour info 254 // TODO: Decouple this, so we can get rid of Linden Hour info
255 // Update Region infor with new Sun Position and Hour 255 // Update Region with new Sun Vector
256 // set estate settings for region access to sun position 256 // set estate settings for region access to sun position
257 if (receivedEstateToolsSunUpdate) 257 if (receivedEstateToolsSunUpdate)
258 { 258 {
259 m_scene.RegionInfo.RegionSettings.SunVector = Position; 259 m_scene.RegionInfo.RegionSettings.SunVector = Position;
260 m_scene.RegionInfo.RegionSettings.SunPosition = GetCurrentTimeAsLindenSunHour();
261 } 260 }
262 } 261 }
263 262
@@ -395,7 +394,7 @@ namespace OpenSim.Region.CoreModules
395 ready = false; 394 ready = false;
396 395
397 // Remove our hooks 396 // Remove our hooks
398 m_scene.EventManager.OnFrame -= SunUpdate; 397 m_scene.EventManager.OnFrame -= SunUpdate;
399 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; 398 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
400 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; 399 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
401 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; 400 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
@@ -459,26 +458,33 @@ namespace OpenSim.Region.CoreModules
459 SunToClient(avatar.ControllingClient); 458 SunToClient(avatar.ControllingClient);
460 } 459 }
461 460
462 /// <summary> 461 public void EstateToolsSunUpdate(ulong regionHandle)
463 ///
464 /// </summary>
465 /// <param name="regionHandle"></param>
466 /// <param name="FixedTime">Is the sun's position fixed?</param>
467 /// <param name="useEstateTime">Use the Region or Estate Sun hour?</param>
468 /// <param name="FixedSunHour">What hour of the day is the Sun Fixed at?</param>
469 public void EstateToolsSunUpdate(ulong regionHandle, bool FixedSun, bool useEstateTime, float FixedSunHour)
470 { 462 {
471 if (m_scene.RegionInfo.RegionHandle == regionHandle) 463 if (m_scene.RegionInfo.RegionHandle == regionHandle)
472 { 464 {
473 // Must limit the Sun Hour to 0 ... 24 465 float sunFixedHour;
474 while (FixedSunHour > 24.0f) 466 bool fixedSun;
475 FixedSunHour -= 24;
476 467
477 while (FixedSunHour < 0) 468 if (m_scene.RegionInfo.RegionSettings.UseEstateSun)
478 FixedSunHour += 24; 469 {
470 sunFixedHour = (float)m_scene.RegionInfo.EstateSettings.SunPosition;
471 fixedSun = m_scene.RegionInfo.EstateSettings.FixedSun;
472 }
473 else
474 {
475 sunFixedHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition - 6.0f;
476 fixedSun = m_scene.RegionInfo.RegionSettings.FixedSun;
477 }
478
479 // Must limit the Sun Hour to 0 ... 24
480 while (sunFixedHour > 24.0f)
481 sunFixedHour -= 24;
479 482
480 m_SunFixedHour = FixedSunHour; 483 while (sunFixedHour < 0)
481 m_SunFixed = FixedSun; 484 sunFixedHour += 24;
485
486 m_SunFixedHour = sunFixedHour;
487 m_SunFixed = fixedSun;
482 488
483 // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); 489 // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString());
484 // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); 490 // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString());
@@ -501,7 +507,7 @@ namespace OpenSim.Region.CoreModules
501 { 507 {
502 m_scene.ForEachRootClient(delegate(IClientAPI client) 508 m_scene.ForEachRootClient(delegate(IClientAPI client)
503 { 509 {
504 SunToClient(client); 510 SunToClient(client);
505 }); 511 });
506 } 512 }
507 513
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4c49b71..6b08e0f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -751,7 +751,7 @@ namespace OpenSim.Region.Framework.Scenes
751 public event ScriptTimerEvent OnScriptTimerEvent; 751 public event ScriptTimerEvent OnScriptTimerEvent;
752 */ 752 */
753 753
754 public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); 754 public delegate void EstateToolsSunUpdate(ulong regionHandle);
755 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 755 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
756 756
757 public event EstateToolsSunUpdate OnEstateToolsSunUpdate; 757 public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
@@ -2507,13 +2507,10 @@ namespace OpenSim.Region.Framework.Scenes
2507 } 2507 }
2508 2508
2509 /// <summary> 2509 /// <summary>
2510 /// Updates the system as to how the position of the sun should be handled. 2510 /// Called when the sun's position parameters have changed in the Region and/or Estate
2511 /// </summary> 2511 /// </summary>
2512 /// <param name="regionHandle"></param> 2512 /// <param name="regionHandle">The region that changed</param>
2513 /// <param name="FixedTime">True if the Sun Position is fixed</param> 2513 public void TriggerEstateToolsSunUpdate(ulong regionHandle)
2514 /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param>
2515 /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param>
2516 public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour)
2517 { 2514 {
2518 EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; 2515 EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
2519 if (handlerEstateToolsSunUpdate != null) 2516 if (handlerEstateToolsSunUpdate != null)
@@ -2522,7 +2519,7 @@ namespace OpenSim.Region.Framework.Scenes
2522 { 2519 {
2523 try 2520 try
2524 { 2521 {
2525 d(regionHandle, FixedTime, useEstateTime, FixedSunHour); 2522 d(regionHandle);
2526 } 2523 }
2527 catch (Exception e) 2524 catch (Exception e)
2528 { 2525 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cca295c..11b63b7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5345,33 +5345,7 @@ namespace OpenSim.Region.Framework.Scenes
5345 5345
5346 public void TriggerEstateSunUpdate() 5346 public void TriggerEstateSunUpdate()
5347 { 5347 {
5348 float sun; 5348 EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle);
5349 if (RegionInfo.RegionSettings.UseEstateSun)
5350 {
5351 sun = (float)RegionInfo.EstateSettings.SunPosition;
5352 if (RegionInfo.EstateSettings.UseGlobalTime)
5353 {
5354 sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
5355 }
5356
5357 //
5358 EventManager.TriggerEstateToolsSunUpdate(
5359 RegionInfo.RegionHandle,
5360 RegionInfo.EstateSettings.FixedSun,
5361 RegionInfo.RegionSettings.UseEstateSun,
5362 sun);
5363 }
5364 else
5365 {
5366 // Use the Sun Position from the Region Settings
5367 sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f;
5368
5369 EventManager.TriggerEstateToolsSunUpdate(
5370 RegionInfo.RegionHandle,
5371 RegionInfo.RegionSettings.FixedSun,
5372 RegionInfo.RegionSettings.UseEstateSun,
5373 sun);
5374 }
5375 } 5349 }
5376 5350
5377 private void HandleReloadEstate(string module, string[] cmd) 5351 private void HandleReloadEstate(string module, string[] cmd)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 828288d..33c02ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1205,12 +1205,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1205 sunHour += 24.0; 1205 sunHour += 24.0;
1206 1206
1207 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; 1207 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun;
1208 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 1208 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30
1209 World.RegionInfo.RegionSettings.FixedSun = sunFixed; 1209 World.RegionInfo.RegionSettings.FixedSun = sunFixed;
1210 World.RegionInfo.RegionSettings.Save(); 1210 World.RegionInfo.RegionSettings.Save();
1211 1211
1212 World.EventManager.TriggerEstateToolsSunUpdate( 1212 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1213 World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour);
1214 } 1213 }
1215 1214
1216 /// <summary> 1215 /// <summary>
@@ -1235,8 +1234,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1235 World.RegionInfo.EstateSettings.FixedSun = sunFixed; 1234 World.RegionInfo.EstateSettings.FixedSun = sunFixed;
1236 World.RegionInfo.EstateSettings.Save(); 1235 World.RegionInfo.EstateSettings.Save();
1237 1236
1238 World.EventManager.TriggerEstateToolsSunUpdate( 1237 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1239 World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour);
1240 } 1238 }
1241 1239
1242 /// <summary> 1240 /// <summary>