Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-10-27 20:49:27 +01:00
commit 05dbe4f2c4
11 changed files with 68 additions and 73 deletions

View File

@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules
/// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise.
/// </summary> /// </summary>
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// //
// Global Constants used to determine where in the sky the sun is // Global Constants used to determine where in the sky the sun is
// //
@ -128,15 +126,12 @@ namespace OpenSim.Region.CoreModules
private Vector3 Velocity = Vector3.Zero; private Vector3 Velocity = Vector3.Zero;
private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f);
// Used to fix the sun in the sky so it doesn't move based on current time // Used to fix the sun in the sky so it doesn't move based on current time
private bool m_SunFixed = false; private bool m_SunFixed = false;
private float m_SunFixedHour = 0f; private float m_SunFixedHour = 0f;
private const int TICKS_PER_SECOND = 10000000; private const int TICKS_PER_SECOND = 10000000;
// Current time in elapsed seconds since Jan 1st 1970 // Current time in elapsed seconds since Jan 1st 1970
private ulong CurrentTime private ulong CurrentTime
{ {
@ -149,8 +144,6 @@ namespace OpenSim.Region.CoreModules
// Time in seconds since UTC to use to calculate sun position. // Time in seconds since UTC to use to calculate sun position.
ulong PosTime = 0; ulong PosTime = 0;
/// <summary> /// <summary>
/// Calculate the sun's orbital position and its velocity. /// Calculate the sun's orbital position and its velocity.
/// </summary> /// </summary>
@ -202,7 +195,6 @@ namespace OpenSim.Region.CoreModules
PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds);
} }
} }
} }
TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians
@ -251,7 +243,6 @@ namespace OpenSim.Region.CoreModules
Velocity.X = 0; Velocity.X = 0;
Velocity.Y = 0; Velocity.Y = 0;
Velocity.Z = 0; Velocity.Z = 0;
} }
else else
{ {
@ -271,9 +262,7 @@ namespace OpenSim.Region.CoreModules
private float GetCurrentTimeAsLindenSunHour() private float GetCurrentTimeAsLindenSunHour()
{ {
if (m_SunFixed) if (m_SunFixed)
{
return m_SunFixedHour + 6; return m_SunFixedHour + 6;
}
return GetCurrentSunHour() + 6.0f; return GetCurrentSunHour() + 6.0f;
} }
@ -297,8 +286,6 @@ namespace OpenSim.Region.CoreModules
m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
} }
TimeZone local = TimeZone.CurrentTimeZone; TimeZone local = TimeZone.CurrentTimeZone;
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
@ -325,13 +312,11 @@ namespace OpenSim.Region.CoreModules
// must hard code to ~.5 to match sun position in LL based viewers // must hard code to ~.5 to match sun position in LL based viewers
m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);
// Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours
m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale);
// Update frequency in frames // Update frequency in frames
m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod);
} }
catch (Exception e) catch (Exception e)
{ {
@ -391,10 +376,8 @@ namespace OpenSim.Region.CoreModules
} }
scene.RegisterModuleInterface<ISunModule>(this); scene.RegisterModuleInterface<ISunModule>(this);
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
@ -419,6 +402,7 @@ namespace OpenSim.Region.CoreModules
{ {
get { return false; } get { return false; }
} }
#endregion #endregion
#region EventManager Events #region EventManager Events
@ -446,9 +430,7 @@ namespace OpenSim.Region.CoreModules
public void SunUpdate() public void SunUpdate()
{ {
if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate)
{
return; return;
}
GenSunPos(); // Generate shared values once GenSunPos(); // Generate shared values once
@ -484,7 +466,6 @@ namespace OpenSim.Region.CoreModules
while (FixedSunHour < 0) while (FixedSunHour < 0)
FixedSunHour += 24; FixedSunHour += 24;
m_SunFixedHour = FixedSunHour; m_SunFixedHour = FixedSunHour;
m_SunFixed = FixedSun; m_SunFixed = FixedSun;
@ -499,14 +480,12 @@ namespace OpenSim.Region.CoreModules
// When sun settings are updated, we should update all clients with new settings. // When sun settings are updated, we should update all clients with new settings.
SunUpdateToAllClients(); SunUpdateToAllClients();
m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString());
} }
} }
#endregion #endregion
private void SunUpdateToAllClients() private void SunUpdateToAllClients()
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence sp) m_scene.ForEachScenePresence(delegate(ScenePresence sp)
@ -553,7 +532,6 @@ namespace OpenSim.Region.CoreModules
{ {
float ticksleftover = CurrentTime % SecondsPerSunCycle; float ticksleftover = CurrentTime % SecondsPerSunCycle;
return (24.0f * (ticksleftover / SecondsPerSunCycle)); return (24.0f * (ticksleftover / SecondsPerSunCycle));
} }
@ -666,7 +644,6 @@ namespace OpenSim.Region.CoreModules
// When sun settings are updated, we should update all clients with new settings. // When sun settings are updated, we should update all clients with new settings.
SunUpdateToAllClients(); SunUpdateToAllClients();
} }
return Output; return Output;

View File

@ -3394,7 +3394,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
} }
/// <summary> /// <summary>
/// Do the work necessary to initiate a new user connection for a particular scene. /// Do the work necessary to initiate a new user connection for a particular scene.
/// At the moment, this consists of setting up the caps infrastructure /// At the moment, this consists of setting up the caps infrastructure
@ -3406,6 +3405,23 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>True if the region accepts this agent. False if it does not. False will /// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns> /// also return a reason.</returns>
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
{
return NewUserConnection(agent, teleportFlags, out reason, true);
}
/// <summary>
/// Do the work necessary to initiate a new user connection for a particular scene.
/// At the moment, this consists of setting up the caps infrastructure
/// The return bool should allow for connections to be refused, but as not all calling paths
/// take proper notice of it let, we allowed banned users in still.
/// </summary>
/// <param name="agent">CircuitData of the agent who is connecting</param>
/// <param name="reason">Outputs the reason for the false response on this string</param>
/// <param name="requirePresenceLookup">True for normal presence. False for NPC
/// or other applications where a full grid/Hypergrid presence may not be required.</param>
/// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns>
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
{ {
bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
@ -3456,7 +3472,8 @@ namespace OpenSim.Region.Framework.Scenes
if (sp == null) // We don't have an [child] agent here already if (sp == null) // We don't have an [child] agent here already
{ {
if (requirePresenceLookup)
{
try try
{ {
if (!VerifyUserPresence(agent, out reason)) if (!VerifyUserPresence(agent, out reason))
@ -3467,6 +3484,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
return false; return false;
} }
}
try try
{ {

View File

@ -428,11 +428,14 @@ namespace OpenSim.Region.Framework.Scenes
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{ {
EntityBase entity; EntityBase entity;
if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
return false; return false;
SceneObjectGroup grp = (SceneObjectGroup)entity; SceneObjectGroup grp = (SceneObjectGroup)entity;
if (entity == null)
return false;
if (!resultOfObjectLinked) if (!resultOfObjectLinked)
{ {
m_numPrim -= grp.PrimCount; m_numPrim -= grp.PrimCount;

View File

@ -304,7 +304,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public void PostInitialise() public void PostInitialise()
{ {
} }
public void Close() public void Close()
@ -350,7 +349,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
if (!Directory.Exists(tmp)) if (!Directory.Exists(tmp))
Directory.CreateDirectory(tmp); Directory.CreateDirectory(tmp);
m_log.Info("MRM 2"); m_log.Info("MRM 2");
try try
@ -396,8 +394,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
parameters.IncludeDebugInformation = true; parameters.IncludeDebugInformation = true;
string rootPath = string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
List<string> libraries = new List<string>(); List<string> libraries = new List<string>();
string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries); string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries);