aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs57
5 files changed, 27 insertions, 50 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index d76ff47..4359c01 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
238 } 238 }
239 239
240 (scene as Scene).EventManager.TriggerOnChatToClients( 240 (scene as Scene).EventManager.TriggerOnChatToClients(
241 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); 241 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
242 } 242 }
243 243
244 static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); 244 static private Vector3 CenterOfRegion = new Vector3(128, 128, 30);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 5500557..046b05f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
143 if (filePath == ArchiveConstants.CONTROL_FILE_PATH) 143 if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
144 { 144 {
145 LoadControlFile(filePath, data); 145 LoadControlFile(filePath, data);
146 } 146 }
147 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 147 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
148 { 148 {
149 if (LoadAsset(filePath, data)) 149 if (LoadAsset(filePath, data))
@@ -479,11 +479,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
479 /// <param name="path"></param> 479 /// <param name="path"></param>
480 /// <param name="data"></param> 480 /// <param name="data"></param>
481 protected void LoadControlFile(string path, byte[] data) 481 protected void LoadControlFile(string path, byte[] data)
482 { 482 {
483 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); 483 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
484 XElement archiveElement = doc.Element("archive"); 484 XElement archiveElement = doc.Element("archive");
485 int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); 485 int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value);
486 int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); 486 int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value);
487 string version = string.Format("{0}.{1}", majorVersion, minorVersion); 487 string version = string.Format("{0}.{1}", majorVersion, minorVersion);
488 488
489 if (majorVersion > MAX_MAJOR_VERSION) 489 if (majorVersion > MAX_MAJOR_VERSION)
@@ -492,7 +492,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
492 string.Format( 492 string.Format(
493 "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", 493 "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below",
494 majorVersion, MAX_MAJOR_VERSION)); 494 majorVersion, MAX_MAJOR_VERSION));
495 } 495 }
496 496
497 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); 497 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
498 } 498 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 249a8b4..9080e1c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
213 public void Execute() 213 public void Execute()
214 { 214 {
215 try 215 try
216 { 216 {
217 InventoryFolderBase inventoryFolder = null; 217 InventoryFolderBase inventoryFolder = null;
218 InventoryItemBase inventoryItem = null; 218 InventoryItemBase inventoryItem = null;
219 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); 219 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
@@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
277 // Write out control file. This has to be done first so that subsequent loaders will see this file first 277 // Write out control file. This has to be done first so that subsequent loaders will see this file first
278 // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this 278 // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
279 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); 279 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
280 m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); 280 m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive.");
281 281
282 if (inventoryFolder != null) 282 if (inventoryFolder != null)
283 { 283 {
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 1687d06..3182079 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -199,13 +199,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
199 { 199 {
200 majorVersion = 1; 200 majorVersion = 1;
201 minorVersion = 0; 201 minorVersion = 0;
202 } 202 }
203 */ 203 */
204 204
205 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 205 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
206// if (majorVersion == 1) 206// if (majorVersion == 1)
207// { 207// {
208// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); 208// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
209// } 209// }
210 210
211 211
@@ -232,6 +232,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
232 sw.Close(); 232 sw.Close();
233 233
234 return s; 234 return s;
235 } 235 }
236 } 236 }
237} 237}
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index a6dc2ec..cea7c78 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules
44 /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. 44 /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise.
45 /// </summary> 45 /// </summary>
46 46
47
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 48
50
51 // 49 //
52 // Global Constants used to determine where in the sky the sun is 50 // Global Constants used to determine where in the sky the sun is
53 // 51 //
@@ -108,26 +106,25 @@ namespace OpenSim.Region.CoreModules
108 private Scene m_scene = null; 106 private Scene m_scene = null;
109 107
110 // Calculated Once in the lifetime of a region 108 // Calculated Once in the lifetime of a region
111 private long TicksToEpoch; // Elapsed time for 1/1/1970 109 private long TicksToEpoch; // Elapsed time for 1/1/1970
112 private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds 110 private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds
113 private uint SecondsPerYear; // Length of a virtual year in RW seconds 111 private uint SecondsPerYear; // Length of a virtual year in RW seconds
114 private double SunSpeed; // Rate of passage in radians/second 112 private double SunSpeed; // Rate of passage in radians/second
115 private double SeasonSpeed; // Rate of change for seasonal effects 113 private double SeasonSpeed; // Rate of change for seasonal effects
116 // private double HoursToRadians; // Rate of change for seasonal effects 114 // private double HoursToRadians; // Rate of change for seasonal effects
117 private long TicksUTCOffset = 0; // seconds offset from UTC 115 private long TicksUTCOffset = 0; // seconds offset from UTC
118 // Calculated every update 116 // Calculated every update
119 private float OrbitalPosition; // Orbital placement at a point in time 117 private float OrbitalPosition; // Orbital placement at a point in time
120 private double HorizonShift; // Axis offset to skew day and night 118 private double HorizonShift; // Axis offset to skew day and night
121 private double TotalDistanceTravelled; // Distance since beginning of time (in radians) 119 private double TotalDistanceTravelled; // Distance since beginning of time (in radians)
122 private double SeasonalOffset; // Seaonal variation of tilt 120 private double SeasonalOffset; // Seaonal variation of tilt
123 private float Magnitude; // Normal tilt 121 private float Magnitude; // Normal tilt
124 // private double VWTimeRatio; // VW time as a ratio of real time 122 // private double VWTimeRatio; // VW time as a ratio of real time
125 123
126 // Working values 124 // Working values
127 private Vector3 Position = Vector3.Zero; 125 private Vector3 Position = Vector3.Zero;
128 private Vector3 Velocity = Vector3.Zero; 126 private Vector3 Velocity = Vector3.Zero;
129 private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); 127 private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f);
130
131 128
132 // Used to fix the sun in the sky so it doesn't move based on current time 129 // Used to fix the sun in the sky so it doesn't move based on current time
133 private bool m_SunFixed = false; 130 private bool m_SunFixed = false;
@@ -135,8 +132,6 @@ namespace OpenSim.Region.CoreModules
135 132
136 private const int TICKS_PER_SECOND = 10000000; 133 private const int TICKS_PER_SECOND = 10000000;
137 134
138
139
140 // Current time in elapsed seconds since Jan 1st 1970 135 // Current time in elapsed seconds since Jan 1st 1970
141 private ulong CurrentTime 136 private ulong CurrentTime
142 { 137 {
@@ -149,8 +144,6 @@ namespace OpenSim.Region.CoreModules
149 // Time in seconds since UTC to use to calculate sun position. 144 // Time in seconds since UTC to use to calculate sun position.
150 ulong PosTime = 0; 145 ulong PosTime = 0;
151 146
152
153
154 /// <summary> 147 /// <summary>
155 /// Calculate the sun's orbital position and its velocity. 148 /// Calculate the sun's orbital position and its velocity.
156 /// </summary> 149 /// </summary>
@@ -202,7 +195,6 @@ namespace OpenSim.Region.CoreModules
202 PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); 195 PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds);
203 } 196 }
204 } 197 }
205
206 } 198 }
207 199
208 TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians 200 TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians
@@ -251,7 +243,6 @@ namespace OpenSim.Region.CoreModules
251 Velocity.X = 0; 243 Velocity.X = 0;
252 Velocity.Y = 0; 244 Velocity.Y = 0;
253 Velocity.Z = 0; 245 Velocity.Z = 0;
254
255 } 246 }
256 else 247 else
257 { 248 {
@@ -271,9 +262,7 @@ namespace OpenSim.Region.CoreModules
271 private float GetCurrentTimeAsLindenSunHour() 262 private float GetCurrentTimeAsLindenSunHour()
272 { 263 {
273 if (m_SunFixed) 264 if (m_SunFixed)
274 {
275 return m_SunFixedHour + 6; 265 return m_SunFixedHour + 6;
276 }
277 266
278 return GetCurrentSunHour() + 6.0f; 267 return GetCurrentSunHour() + 6.0f;
279 } 268 }
@@ -297,8 +286,6 @@ namespace OpenSim.Region.CoreModules
297 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); 286 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
298 } 287 }
299 288
300
301
302 TimeZone local = TimeZone.CurrentTimeZone; 289 TimeZone local = TimeZone.CurrentTimeZone;
303 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 290 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
304 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); 291 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
@@ -325,13 +312,11 @@ namespace OpenSim.Region.CoreModules
325 // must hard code to ~.5 to match sun position in LL based viewers 312 // must hard code to ~.5 to match sun position in LL based viewers
326 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); 313 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);
327 314
328
329 // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours 315 // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours
330 m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); 316 m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale);
331 317
332 // Update frequency in frames 318 // Update frequency in frames
333 m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); 319 m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod);
334
335 } 320 }
336 catch (Exception e) 321 catch (Exception e)
337 { 322 {
@@ -391,10 +376,8 @@ namespace OpenSim.Region.CoreModules
391 } 376 }
392 377
393 scene.RegisterModuleInterface<ISunModule>(this); 378 scene.RegisterModuleInterface<ISunModule>(this);
394
395 } 379 }
396 380
397
398 public void PostInitialise() 381 public void PostInitialise()
399 { 382 {
400 } 383 }
@@ -402,7 +385,7 @@ namespace OpenSim.Region.CoreModules
402 public void Close() 385 public void Close()
403 { 386 {
404 ready = false; 387 ready = false;
405 388
406 // Remove our hooks 389 // Remove our hooks
407 m_scene.EventManager.OnFrame -= SunUpdate; 390 m_scene.EventManager.OnFrame -= SunUpdate;
408 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; 391 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
@@ -419,6 +402,7 @@ namespace OpenSim.Region.CoreModules
419 { 402 {
420 get { return false; } 403 get { return false; }
421 } 404 }
405
422 #endregion 406 #endregion
423 407
424 #region EventManager Events 408 #region EventManager Events
@@ -446,9 +430,7 @@ namespace OpenSim.Region.CoreModules
446 public void SunUpdate() 430 public void SunUpdate()
447 { 431 {
448 if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) 432 if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate)
449 {
450 return; 433 return;
451 }
452 434
453 GenSunPos(); // Generate shared values once 435 GenSunPos(); // Generate shared values once
454 436
@@ -467,7 +449,7 @@ namespace OpenSim.Region.CoreModules
467 } 449 }
468 450
469 /// <summary> 451 /// <summary>
470 /// 452 ///
471 /// </summary> 453 /// </summary>
472 /// <param name="regionHandle"></param> 454 /// <param name="regionHandle"></param>
473 /// <param name="FixedTime">Is the sun's position fixed?</param> 455 /// <param name="FixedTime">Is the sun's position fixed?</param>
@@ -484,7 +466,6 @@ namespace OpenSim.Region.CoreModules
484 while (FixedSunHour < 0) 466 while (FixedSunHour < 0)
485 FixedSunHour += 24; 467 FixedSunHour += 24;
486 468
487
488 m_SunFixedHour = FixedSunHour; 469 m_SunFixedHour = FixedSunHour;
489 m_SunFixed = FixedSun; 470 m_SunFixed = FixedSun;
490 471
@@ -499,14 +480,12 @@ namespace OpenSim.Region.CoreModules
499 // When sun settings are updated, we should update all clients with new settings. 480 // When sun settings are updated, we should update all clients with new settings.
500 SunUpdateToAllClients(); 481 SunUpdateToAllClients();
501 482
502
503 m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); 483 m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString());
504 } 484 }
505 } 485 }
506 486
507 #endregion 487 #endregion
508 488
509
510 private void SunUpdateToAllClients() 489 private void SunUpdateToAllClients()
511 { 490 {
512 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 491 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -553,7 +532,6 @@ namespace OpenSim.Region.CoreModules
553 { 532 {
554 float ticksleftover = CurrentTime % SecondsPerSunCycle; 533 float ticksleftover = CurrentTime % SecondsPerSunCycle;
555 534
556
557 return (24.0f * (ticksleftover / SecondsPerSunCycle)); 535 return (24.0f * (ticksleftover / SecondsPerSunCycle));
558 } 536 }
559 537
@@ -666,7 +644,6 @@ namespace OpenSim.Region.CoreModules
666 644
667 // When sun settings are updated, we should update all clients with new settings. 645 // When sun settings are updated, we should update all clients with new settings.
668 SunUpdateToAllClients(); 646 SunUpdateToAllClients();
669
670 } 647 }
671 648
672 return Output; 649 return Output;