Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2013-01-04 22:39:07 +00:00
commit e62b14024f
29 changed files with 747 additions and 1472 deletions

2
.gitignore vendored
View File

@ -98,3 +98,5 @@ OpenSim/Region/ScriptEngine/test-results/
OpenSim/Tests/Common/test-results/
OpenSim/Tests/test-results/
test-results/
doc/html
doc/doxygen.error.log

View File

@ -43,6 +43,7 @@
<delete dir="${distbindir}/Prebuild"/>
<delete dir="${distbindir}/%temp%"/>
<delete dir="${distbindir}/.nant"/>
<delete dir="${distbindir}/ThirdParty"/>
<delete>
<fileset basedir="${distbindir}">
<include name="compile.bat"/>

View File

@ -113,11 +113,14 @@ namespace OpenSim.Data.Null
// Find region data
List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values)
lock (m_regionData)
{
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
foreach (RegionData r in m_regionData.Values)
{
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
if (queryMatch(r.RegionName.ToLower()))
ret.Add(r);
}
}
if (ret.Count > 0)
@ -133,10 +136,13 @@ namespace OpenSim.Data.Null
List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values)
lock (m_regionData)
{
if (r.posX == posX && r.posY == posY)
ret.Add(r);
foreach (RegionData r in m_regionData.Values)
{
if (r.posX == posX && r.posY == posY)
ret.Add(r);
}
}
if (ret.Count > 0)
@ -150,8 +156,11 @@ namespace OpenSim.Data.Null
if (m_useStaticInstance && Instance != this)
return Instance.Get(regionID, scopeID);
if (m_regionData.ContainsKey(regionID))
return m_regionData[regionID];
lock (m_regionData)
{
if (m_regionData.ContainsKey(regionID))
return m_regionData[regionID];
}
return null;
}
@ -163,10 +172,13 @@ namespace OpenSim.Data.Null
List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values)
lock (m_regionData)
{
if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY)
ret.Add(r);
foreach (RegionData r in m_regionData.Values)
{
if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY)
ret.Add(r);
}
}
return ret;
@ -180,7 +192,10 @@ namespace OpenSim.Data.Null
// m_log.DebugFormat(
// "[NULL REGION DATA]: Storing region {0} {1}, scope {2}", data.RegionName, data.RegionID, data.ScopeID);
m_regionData[data.RegionID] = data;
lock (m_regionData)
{
m_regionData[data.RegionID] = data;
}
return true;
}
@ -190,10 +205,13 @@ namespace OpenSim.Data.Null
if (m_useStaticInstance && Instance != this)
return Instance.SetDataItem(regionID, item, value);
if (!m_regionData.ContainsKey(regionID))
return false;
lock (m_regionData)
{
if (!m_regionData.ContainsKey(regionID))
return false;
m_regionData[regionID].Data[item] = value;
m_regionData[regionID].Data[item] = value;
}
return true;
}
@ -205,10 +223,13 @@ namespace OpenSim.Data.Null
// m_log.DebugFormat("[NULL REGION DATA]: Deleting region {0}", regionID);
if (!m_regionData.ContainsKey(regionID))
return false;
lock (m_regionData)
{
if (!m_regionData.ContainsKey(regionID))
return false;
m_regionData.Remove(regionID);
m_regionData.Remove(regionID);
}
return true;
}
@ -238,10 +259,13 @@ namespace OpenSim.Data.Null
List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values)
lock (m_regionData)
{
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
ret.Add(r);
foreach (RegionData r in m_regionData.Values)
{
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
ret.Add(r);
}
}
return ret;

View File

@ -56,7 +56,7 @@ namespace OpenSim.Framework.Console
public List<ConsoleDisplayTableRow> Rows { get; private set; }
/// <summary>
/// Number of spaces to indent the table.
/// Number of spaces to indent the whole table.
/// </summary>
public int Indent { get; set; }
@ -84,7 +84,7 @@ namespace OpenSim.Framework.Console
Columns.Add(new ConsoleDisplayTableColumn(name, width));
}
public void AddRow(params string[] cells)
public void AddRow(params object[] cells)
{
Rows.Add(new ConsoleDisplayTableRow(cells));
}
@ -113,7 +113,8 @@ namespace OpenSim.Framework.Console
for (int i = 0; i < Columns.Count; i++)
{
formatSb.Append(' ', TableSpacing);
if (i != 0)
formatSb.Append(' ', TableSpacing);
// Can only do left formatting for now
formatSb.AppendFormat("{{{0},-{1}}}", i, Columns[i].Width);
@ -139,16 +140,16 @@ namespace OpenSim.Framework.Console
public struct ConsoleDisplayTableRow
{
public List<string> Cells { get; private set; }
public List<object> Cells { get; private set; }
public ConsoleDisplayTableRow(List<string> cells) : this()
public ConsoleDisplayTableRow(List<object> cells) : this()
{
Cells = cells;
}
public ConsoleDisplayTableRow(params string[] cells) : this()
public ConsoleDisplayTableRow(params object[] cells) : this()
{
Cells = new List<string>(cells);
Cells = new List<object>(cells);
}
}
}

View File

@ -2114,5 +2114,16 @@ namespace OpenSim.Framework
return firstName + "." + lastName + " " + "@" + uri.Authority;
}
#endregion
/// <summary>
/// Escapes the special characters used in "LIKE".
/// </summary>
/// <remarks>
/// For example: EscapeForLike("foo_bar%baz") = "foo\_bar\%baz"
/// </remarks>
public static string EscapeForLike(string str)
{
return str.Replace("_", "\\_").Replace("%", "\\%");
}
}
}

View File

@ -722,15 +722,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!silent)
{
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (so.IsSelected)
{
m_scene.SendKillObject(new List<uint> { so.RootPart.LocalId });
}
else if (so.HasPrivateAttachmentPoint)
if (so.HasPrivateAttachmentPoint)
{
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}",
@ -745,7 +737,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
});
}
so.IsSelected = false; // fudge....
// Fudge below is an extremely unhelpful comment. It's probably here so that the scheduled full update
// will succeed, as that will not update if an attachment is selected.
so.IsSelected = false; // fudge....
so.ScheduleGroupForFullUpdate();
}

View File

@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
SaveAssets = true;
}
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut)
{
Exception reportedException = null;
bool succeeded = true;
@ -143,6 +143,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_saveStream.Close();
}
if (timedOut)
{
succeeded = false;
reportedException = new Exception("Loading assets timed out");
}
m_module.TriggerInventoryArchiveSaved(
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
}
@ -350,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
m_log.DebugFormat("[INVENTORY ARCHIVER]: Not saving assets since --noassets was specified");
ReceivedAllAssets(new List<UUID>(), new List<UUID>());
ReceivedAllAssets(new List<UUID>(), new List<UUID>(), false);
}
}
catch (Exception)

View File

@ -622,13 +622,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <returns></returns>
private bool ResolveUserUuid(Scene scene, UUID uuid)
{
if (!m_validUserUuids.ContainsKey(uuid))
lock (m_validUserUuids)
{
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid);
m_validUserUuids.Add(uuid, account != null);
}
if (!m_validUserUuids.ContainsKey(uuid))
{
// Note: we call GetUserAccount() inside the lock because this UserID is likely
// to occur many times, and we only want to query the users service once.
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid);
m_validUserUuids.Add(uuid, account != null);
}
return m_validUserUuids[uuid];
return m_validUserUuids[uuid];
}
}
/// <summary>
@ -641,19 +646,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (uuid == UUID.Zero)
return true; // this means the object has no group
if (!m_validGroupUuids.ContainsKey(uuid))
lock (m_validGroupUuids)
{
bool exists;
if (m_groupsModule == null)
exists = false;
else
exists = (m_groupsModule.GetGroupRecord(uuid) != null);
if (!m_validGroupUuids.ContainsKey(uuid))
{
bool exists;
if (m_groupsModule == null)
{
exists = false;
}
else
{
// Note: we call GetGroupRecord() inside the lock because this GroupID is likely
// to occur many times, and we only want to query the groups service once.
exists = (m_groupsModule.GetGroupRecord(uuid) != null);
}
m_validGroupUuids.Add(uuid, exists);
}
m_validGroupUuids.Add(uuid, exists);
return m_validGroupUuids[uuid];
}
return m_validGroupUuids[uuid];
}
/// Load an asset

View File

@ -587,19 +587,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
protected void ReceivedAllAssets(
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut)
{
foreach (UUID uuid in assetsNotFoundUuids)
string errorMessage;
if (timedOut)
{
m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
errorMessage = "Loading assets timed out";
}
else
{
foreach (UUID uuid in assetsNotFoundUuids)
{
m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
}
// m_log.InfoFormat(
// "[ARCHIVER]: Received {0} of {1} assets requested",
// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
// m_log.InfoFormat(
// "[ARCHIVER]: Received {0} of {1} assets requested",
// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
CloseArchive(String.Empty);
errorMessage = String.Empty;
}
CloseArchive(errorMessage);
}
/// <summary>
@ -626,4 +636,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage);
}
}
}
}

View File

@ -150,12 +150,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", m_assetsWritten);
}
/// <summary>
/// Only call this if you need to force a close on the underlying writer.
/// </summary>
public void ForceClose()
{
m_archiveWriter.Close();
}
}
}

View File

@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// Method called when all the necessary assets for an archive request have been received.
/// </summary>
public delegate void AssetsRequestCallback(
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids);
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut);
enum RequestState
{
@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (m_repliesRequired == 0)
{
m_requestState = RequestState.Completed;
PerformAssetsRequestCallback(null);
PerformAssetsRequestCallback(false);
return;
}
@ -164,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
{
bool close = true;
bool timedOut = true;
try
{
@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// the final request came in (assuming that such a thing is possible)
if (m_requestState == RequestState.Completed)
{
close = false;
timedOut = false;
return;
}
@ -223,8 +223,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
finally
{
if (close)
m_assetsArchiver.ForceClose();
if (timedOut)
Util.FireAndForget(PerformAssetsRequestCallback, true);
}
}
@ -290,7 +290,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// We want to stop using the asset cache thread asap
// as we now need to do the work of producing the rest of the archive
Util.FireAndForget(PerformAssetsRequestCallback);
Util.FireAndForget(PerformAssetsRequestCallback, false);
}
else
{
@ -311,9 +311,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
Culture.SetCurrentCulture();
Boolean timedOut = (Boolean)o;
try
{
m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids);
m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids, timedOut);
}
catch (Exception e)
{

View File

@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
uint sun = 0;
if (!Scene.RegionInfo.EstateSettings.UseGlobalTime)
if (Scene.RegionInfo.EstateSettings.FixedSun)
sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800;
UUID estateOwner;
estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
@ -1128,6 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
Scene.RegionInfo.EstateSettings.UseGlobalTime = false;
Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0;
// Warning: FixedSun should be set to True, otherwise this sun position won't be used.
}
if ((parms1 & 0x00000010) != 0)

View File

@ -141,6 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Land
m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent;
m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
@ -221,6 +222,11 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
public void EventMakeChildAgent(ScenePresence avatar)
{
avatar.currentParcelUUID = UUID.Zero;
}
void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
}
@ -249,17 +255,15 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.LocalID = local_id;
ILandObject landobj = null;
ILandObject land;
lock (m_landList)
{
if (m_landList.ContainsKey(local_id))
{
m_landList[local_id].LandData = newData;
landobj = m_landList[local_id];
// m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
}
if (m_landList.TryGetValue(local_id, out land))
land.LandData = newData;
}
if(landobj != null)
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landobj);
if (land != null)
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
}
public bool AllowedForcefulBans
@ -584,7 +588,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// Only now can we add the prim counts to the land object - we rely on the global ID which is generated
// as a random UUID inside LandData initialization
if (m_primCountModule != null)
new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
lock (m_landList)
{
@ -621,6 +625,7 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <param name="local_id">Land.localID of the peice of land to remove.</param>
public void removeLandObject(int local_id)
{
ILandObject land;
lock (m_landList)
{
for (int x = 0; x < 64; x++)
@ -637,9 +642,11 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID);
land = m_landList[local_id];
m_landList.Remove(local_id);
}
m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
}
/// <summary>
@ -1399,25 +1406,72 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
{
ILandObject selectedParcel = null;
lock (m_landList)
if (localID != -1)
{
m_landList.TryGetValue(localID, out selectedParcel);
ILandObject selectedParcel = null;
lock (m_landList)
{
m_landList.TryGetValue(localID, out selectedParcel);
}
if (selectedParcel == null)
return;
selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
}
else
{
if (returnType != 1)
{
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown return type {0}", returnType);
return;
}
if (selectedParcel == null) return;
// We get here when the user returns objects from the list of Top Colliders or Top Scripts.
// In that case we receive specific object UUID's, but no parcel ID.
selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
Dictionary<UUID, HashSet<SceneObjectGroup>> returns = new Dictionary<UUID, HashSet<SceneObjectGroup>>();
foreach (UUID groupID in taskIDs)
{
SceneObjectGroup obj = m_scene.GetSceneObjectGroup(groupID);
if (obj != null)
{
if (!returns.ContainsKey(obj.OwnerID))
returns[obj.OwnerID] = new HashSet<SceneObjectGroup>();
returns[obj.OwnerID].Add(obj);
}
else
{
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown object {0}", groupID);
}
}
int num = 0;
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
num += objs.Count;
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Returning {0} specific object(s)", num);
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
{
List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2))
{
m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId);
}
else
{
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}",
objs2.Count, objs2[0].OwnerID);
}
}
}
}
public void EventManagerOnNoLandDataFromStorage()
{
// called methods already have locks
// lock (m_landList)
{
ResetSimLandObjects();
CreateDefaultParcel();
}
ResetSimLandObjects();
CreateDefaultParcel();
}
#endregion

View File

@ -490,11 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land
m_Scene.ForEachSOG(AddObject);
List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys);
foreach (UUID k in primcountKeys)
lock (m_PrimCounts)
{
if (!m_OwnerMap.ContainsKey(k))
m_PrimCounts.Remove(k);
List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys);
foreach (UUID k in primcountKeys)
{
if (!m_OwnerMap.ContainsKey(k))
m_PrimCounts.Remove(k);
}
}
m_Tainted = false;

View File

@ -252,12 +252,11 @@ namespace OpenSim.Region.CoreModules
}
// TODO: Decouple this, so we can get rid of Linden Hour info
// Update Region infor with new Sun Position and Hour
// Update Region with new Sun Vector
// set estate settings for region access to sun position
if (receivedEstateToolsSunUpdate)
{
m_scene.RegionInfo.RegionSettings.SunVector = Position;
m_scene.RegionInfo.RegionSettings.SunPosition = GetCurrentTimeAsLindenSunHour();
}
}
@ -395,7 +394,7 @@ namespace OpenSim.Region.CoreModules
ready = false;
// Remove our hooks
m_scene.EventManager.OnFrame -= SunUpdate;
m_scene.EventManager.OnFrame -= SunUpdate;
m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
@ -459,26 +458,33 @@ namespace OpenSim.Region.CoreModules
SunToClient(avatar.ControllingClient);
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="FixedTime">Is the sun's position fixed?</param>
/// <param name="useEstateTime">Use the Region or Estate Sun hour?</param>
/// <param name="FixedSunHour">What hour of the day is the Sun Fixed at?</param>
public void EstateToolsSunUpdate(ulong regionHandle, bool FixedSun, bool useEstateTime, float FixedSunHour)
public void EstateToolsSunUpdate(ulong regionHandle)
{
if (m_scene.RegionInfo.RegionHandle == regionHandle)
{
float sunFixedHour;
bool fixedSun;
if (m_scene.RegionInfo.RegionSettings.UseEstateSun)
{
sunFixedHour = (float)m_scene.RegionInfo.EstateSettings.SunPosition;
fixedSun = m_scene.RegionInfo.EstateSettings.FixedSun;
}
else
{
sunFixedHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition - 6.0f;
fixedSun = m_scene.RegionInfo.RegionSettings.FixedSun;
}
// Must limit the Sun Hour to 0 ... 24
while (FixedSunHour > 24.0f)
FixedSunHour -= 24;
while (sunFixedHour > 24.0f)
sunFixedHour -= 24;
while (FixedSunHour < 0)
FixedSunHour += 24;
m_SunFixedHour = FixedSunHour;
m_SunFixed = FixedSun;
while (sunFixedHour < 0)
sunFixedHour += 24;
m_SunFixedHour = sunFixedHour;
m_SunFixed = fixedSun;
// m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString());
// m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString());
@ -501,7 +507,7 @@ namespace OpenSim.Region.CoreModules
{
m_scene.ForEachRootClient(delegate(IClientAPI client)
{
SunToClient(client);
SunToClient(client);
});
}

View File

@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
else
{
m_plugineffects[pluginName] = effect;
m_log.Warn("E ... " + pluginName + " (Replaced)");
m_log.Info("E ... " + pluginName + " (Replaced)");
}
}
}

View File

@ -755,7 +755,7 @@ namespace OpenSim.Region.Framework.Scenes
public event ScriptTimerEvent OnScriptTimerEvent;
*/
public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
public delegate void EstateToolsSunUpdate(ulong regionHandle);
public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
@ -2536,13 +2536,10 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Updates the system as to how the position of the sun should be handled.
/// Called when the sun's position parameters have changed in the Region and/or Estate
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="FixedTime">True if the Sun Position is fixed</param>
/// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param>
/// <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>
public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour)
/// <param name="regionHandle">The region that changed</param>
public void TriggerEstateToolsSunUpdate(ulong regionHandle)
{
EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
if (handlerEstateToolsSunUpdate != null)
@ -2551,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
d(regionHandle, FixedTime, useEstateTime, FixedSunHour);
d(regionHandle);
}
catch (Exception e)
{

View File

@ -5619,33 +5619,7 @@ Environment.Exit(1);
public void TriggerEstateSunUpdate()
{
float sun;
if (RegionInfo.RegionSettings.UseEstateSun)
{
sun = (float)RegionInfo.EstateSettings.SunPosition;
if (RegionInfo.EstateSettings.UseGlobalTime)
{
sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
}
//
EventManager.TriggerEstateToolsSunUpdate(
RegionInfo.RegionHandle,
RegionInfo.EstateSettings.FixedSun,
RegionInfo.RegionSettings.UseEstateSun,
sun);
}
else
{
// Use the Sun Position from the Region Settings
sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f;
EventManager.TriggerEstateToolsSunUpdate(
RegionInfo.RegionHandle,
RegionInfo.RegionSettings.FixedSun,
RegionInfo.RegionSettings.UseEstateSun,
sun);
}
EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle);
}
private void HandleReloadEstate(string module, string[] cmd)

View File

@ -945,6 +945,18 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks>
public UUID FromFolderID { get; set; }
/// <summary>
/// IDs of all avatars sat on this scene object.
/// </summary>
/// <remarks>
/// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts.
/// This must be locked before it is read or written.
/// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions.
/// No avatar should appear more than once in this list.
/// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
/// </remarks>
protected internal List<UUID> m_sittingAvatars = new List<UUID>();
#endregion
// ~SceneObjectGroup()
@ -4522,6 +4534,20 @@ namespace OpenSim.Region.Framework.Scenes
return count;
}
/// <summary>
/// Get a copy of the list of sitting avatars on all prims of this object.
/// </summary>
/// <remarks>
/// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat
/// down after it move one place down the list.
/// </remarks>
/// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
public List<UUID> GetSittingAvatars()
{
lock (m_sittingAvatars)
return new List<UUID>(m_sittingAvatars);
}
/// <summary>
/// Gets the number of sitting avatars.
/// </summary>
@ -4529,11 +4555,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
public int GetSittingAvatarsCount()
{
int count = 0;
Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount());
return count;
lock (m_sittingAvatars)
return m_sittingAvatars.Count;
}
public override string ToString()
@ -4542,7 +4565,7 @@ namespace OpenSim.Region.Framework.Scenes
}
#region ISceneObject
public virtual ISceneObject CloneForNewScene()
{
SceneObjectGroup sog = Copy(false);

View File

@ -1342,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes
public UUID SitTargetAvatar { get; set; }
/// <summary>
/// IDs of all avatars start on this object part.
/// IDs of all avatars sat on this part.
/// </summary>
/// <remarks>
/// We need to track this so that we can stop sat upon prims from being attached.
@ -5196,18 +5196,22 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name='avatarId'></param>
protected internal bool AddSittingAvatar(UUID avatarId)
{
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
SitTargetAvatar = avatarId;
HashSet<UUID> sittingAvatars = m_sittingAvatars;
if (sittingAvatars == null)
sittingAvatars = new HashSet<UUID>();
lock (sittingAvatars)
lock (ParentGroup.m_sittingAvatars)
{
m_sittingAvatars = sittingAvatars;
return m_sittingAvatars.Add(avatarId);
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
SitTargetAvatar = avatarId;
if (m_sittingAvatars == null)
m_sittingAvatars = new HashSet<UUID>();
if (m_sittingAvatars.Add(avatarId))
{
ParentGroup.m_sittingAvatars.Add(avatarId);
return true;
}
return false;
}
}
@ -5221,27 +5225,26 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name='avatarId'></param>
protected internal bool RemoveSittingAvatar(UUID avatarId)
{
if (SitTargetAvatar == avatarId)
SitTargetAvatar = UUID.Zero;
HashSet<UUID> sittingAvatars = m_sittingAvatars;
// This can occur under a race condition where another thread
if (sittingAvatars == null)
return false;
lock (sittingAvatars)
lock (ParentGroup.m_sittingAvatars)
{
if (sittingAvatars.Remove(avatarId))
if (SitTargetAvatar == avatarId)
SitTargetAvatar = UUID.Zero;
if (m_sittingAvatars == null)
return false;
if (m_sittingAvatars.Remove(avatarId))
{
if (sittingAvatars.Count == 0)
if (m_sittingAvatars.Count == 0)
m_sittingAvatars = null;
ParentGroup.m_sittingAvatars.Remove(avatarId);
return true;
}
}
return false;
return false;
}
}
/// <summary>
@ -5251,16 +5254,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
public HashSet<UUID> GetSittingAvatars()
{
HashSet<UUID> sittingAvatars = m_sittingAvatars;
if (sittingAvatars == null)
lock (ParentGroup.m_sittingAvatars)
{
return null;
}
else
{
lock (sittingAvatars)
return new HashSet<UUID>(sittingAvatars);
if (m_sittingAvatars == null)
return null;
else
return new HashSet<UUID>(m_sittingAvatars);
}
}
@ -5271,13 +5270,13 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
public int GetSittingAvatarsCount()
{
HashSet<UUID> sittingAvatars = m_sittingAvatars;
if (sittingAvatars == null)
return 0;
lock (sittingAvatars)
return sittingAvatars.Count;
lock (ParentGroup.m_sittingAvatars)
{
if (m_sittingAvatars == null)
return 0;
else
return m_sittingAvatars.Count;
}
}
}
}
}

View File

@ -0,0 +1,215 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Animation;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.OptionalModules.Avatar.Animations
{
/// <summary>
/// A module that just holds commands for inspecting avatar animations.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AnimationsCommandModule")]
public class AnimationsCommandModule : ISharedRegionModule
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_scenes = new List<Scene>();
public string Name { get { return "Animations Command Module"; } }
public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source)
{
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: INITIALIZED MODULE");
}
public void PostInitialise()
{
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: POST INITIALIZED MODULE");
}
public void Close()
{
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: CLOSED MODULE");
}
public void AddRegion(Scene scene)
{
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
}
public void RemoveRegion(Scene scene)
{
// m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
lock (m_scenes)
m_scenes.Remove(scene);
}
public void RegionLoaded(Scene scene)
{
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
lock (m_scenes)
m_scenes.Add(scene);
scene.AddCommand(
"Users", this, "show animations",
"show animations [<first-name> <last-name>]",
"Show animation information for avatars in this simulator.",
"If no name is supplied then information for all avatars is shown.\n"
+ "Please note that for inventory animations, the animation name is the name under which the animation was originally uploaded\n"
+ ", which is not necessarily the current inventory name.",
HandleShowAnimationsCommand);
}
protected void HandleShowAnimationsCommand(string module, string[] cmd)
{
if (cmd.Length != 2 && cmd.Length < 4)
{
MainConsole.Instance.OutputFormat("Usage: show animations [<first-name> <last-name>]");
return;
}
bool targetNameSupplied = false;
string optionalTargetFirstName = null;
string optionalTargetLastName = null;
if (cmd.Length >= 4)
{
targetNameSupplied = true;
optionalTargetFirstName = cmd[2];
optionalTargetLastName = cmd[3];
}
StringBuilder sb = new StringBuilder();
lock (m_scenes)
{
foreach (Scene scene in m_scenes)
{
if (targetNameSupplied)
{
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
if (sp != null && !sp.IsChildAgent)
GetAttachmentsReport(sp, sb);
}
else
{
scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb));
}
}
}
MainConsole.Instance.Output(sb.ToString());
}
private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
{
sb.AppendFormat("Animations for {0}\n", sp.Name);
ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 };
ScenePresenceAnimator spa = sp.Animator;
AnimationSet anims = sp.Animator.Animations;
string cma = spa.CurrentMovementAnimation;
cdl.AddRow(
"Current movement anim",
string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma));
UUID defaultAnimId = anims.DefaultAnimation.AnimID;
cdl.AddRow(
"Default anim",
string.Format("{0}, {1}", defaultAnimId, GetAnimName(sp.Scene.AssetService, defaultAnimId)));
UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID;
cdl.AddRow(
"Implicit default anim",
string.Format("{0}, {1}", implicitDefaultAnimId, GetAnimName(sp.Scene.AssetService, implicitDefaultAnimId)));
cdl.AddToStringBuilder(sb);
ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 };
cdt.AddColumn("Animation ID", 36);
cdt.AddColumn("Name", 20);
cdt.AddColumn("Seq", 3);
cdt.AddColumn("Object ID", 36);
UUID[] animIds;
int[] sequenceNumbers;
UUID[] objectIds;
sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds);
for (int i = 0; i < animIds.Length; i++)
{
UUID animId = animIds[i];
string animName = GetAnimName(sp.Scene.AssetService, animId);
int seq = sequenceNumbers[i];
UUID objectId = objectIds[i];
cdt.AddRow(animId, animName, seq, objectId);
}
cdt.AddToStringBuilder(sb);
sb.Append("\n");
}
private string GetAnimName(IAssetService assetService, UUID animId)
{
string animName;
if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName))
{
AssetMetadata amd = assetService.GetMetadata(animId.ToString());
if (amd != null)
animName = amd.Name;
else
animName = "Unknown";
}
return animName;
}
}
}

View File

@ -97,6 +97,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
"Users", this, "attachments show",
"attachments show [<first-name> <last-name>]",
"Show attachment information for avatars in this simulator.",
"If no name is supplied then information for all avatars is shown.",
HandleShowAttachmentsCommand);
}

View File

@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
/// (such as land transfers). There is no money code here! Use FORGE as an example for money code.
/// Demo Economy/Money Module. This is a purposely crippled module!
/// // To land transfer you need to add:
/// -helperuri <ADDRESS TO THIS SERVER>
/// -helperuri http://serveraddress:port/
/// to the command line parameters you use to start up your client
/// This commonly looks like -helperuri http://127.0.0.1:9000/
///
@ -116,10 +116,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
}
/// <summary>
/// Startup
/// Called on startup so the module can be configured.
/// </summary>
/// <param name="scene"></param>
/// <param name="config"></param>
/// <param name="config">Configuration source.</param>
public void Initialise(IConfigSource config)
{
m_gConfig = config;
@ -674,9 +673,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
}
/// <summary>
/// When the client closes the connection we remove their accounting info from memory to free up resources.
/// When the client closes the connection we remove their accounting
/// info from memory to free up resources.
/// </summary>
/// <param name="AgentID"></param>
/// <param name="AgentID">UUID of agent</param>
/// <param name="scene">Scene the agent was connected to.</param>
/// <see cref="OpenSim.Region.Framework.Scenes.EventManager.ClientClosed"/>
public void ClientClosed(UUID AgentID, Scene scene)
{

View File

@ -3298,7 +3298,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary>
/// Attach the object containing this script to the avatar that owns it.
/// </summary>
/// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param>
/// <param name='attachmentPoint'>
/// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
/// </param>
/// <returns>true if the attach suceeded, false if it did not</returns>
public bool AttachToAvatar(int attachmentPoint)
{
@ -3729,21 +3731,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
bool sitting = false;
if (m_host.SitTargetAvatar == agentID)
{
sitting = true;
}
else
{
foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
{
if (p.SitTargetAvatar == agentID)
sitting = true;
}
}
if (sitting)
if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID))
{
// When agent is sitting, certain permissions are implicit if requested from sitting agent
implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@ -3785,7 +3773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null && npcModule.IsNPC(agentID, World))
{
if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID)
if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
{
lock (m_host.TaskInventory)
{
@ -4160,62 +4148,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetLinkName(int linknum)
{
m_host.AddScriptLPS(1);
// simplest case, this prims link number
if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS)
return m_host.Name;
// parse for sitting avatare-names
List<String> nametable = new List<String>();
World.ForEachRootScenePresence(delegate(ScenePresence presence)
if (linknum < 0)
{
SceneObjectPart sitPart = presence.ParentPart;
if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
nametable.Add(presence.ControllingClient.Name);
});
int totalprims = m_host.ParentGroup.PrimCount + nametable.Count;
if (totalprims > m_host.ParentGroup.PrimCount)
{
// sitting Avatar-Name with negativ linknum / SinglePrim
if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
return nametable[0];
// Prim-Name / SinglePrim Sitting Avatar
if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
return m_host.Name;
// LinkNumber > of Real PrimSet = AvatarName
if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims)
return nametable[totalprims - linknum];
}
// Single prim
if (m_host.LinkNum == 0)
{
if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT)
if (linknum == ScriptBaseClass.LINK_THIS)
return m_host.Name;
else
return UUID.Zero.ToString();
return ScriptBaseClass.NULL_KEY;
}
// Link set
SceneObjectPart part = null;
if (m_host.LinkNum == 1) // this is the Root prim
int actualPrimCount = m_host.ParentGroup.PrimCount;
List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
// Special case for a single prim. In this case the linknum is zero. However, this will not match a single
// prim that has any avatars sat upon it (in which case the root prim is link 1).
if (linknum == 0)
{
if (linknum < 0)
part = m_host.ParentGroup.GetLinkNumPart(2);
else
part = m_host.ParentGroup.GetLinkNumPart(linknum);
if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
return m_host.Name;
return ScriptBaseClass.NULL_KEY;
}
else // this is a child prim
// Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
// here we must match 1 (ScriptBaseClass.LINK_ROOT).
else if (linknum == 1 && actualPrimCount == 1)
{
if (linknum < 2)
part = m_host.ParentGroup.GetLinkNumPart(1);
if (sittingAvatarIds.Count > 0)
return m_host.ParentGroup.RootPart.Name;
else
part = m_host.ParentGroup.GetLinkNumPart(linknum);
return ScriptBaseClass.NULL_KEY;
}
else if (linknum <= adjustedPrimCount)
{
if (linknum <= actualPrimCount)
{
return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
}
else
{
ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
if (sp != null)
return sp.Name;
else
return ScriptBaseClass.NULL_KEY;
}
}
if (part != null)
return part.Name;
else
return UUID.Zero.ToString();
{
return ScriptBaseClass.NULL_KEY;
}
}
public LSL_Integer llGetInventoryNumber(int type)
@ -5828,9 +5810,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
/// <summary>
/// Insert the list identified by <src> into the
/// list designated by <dest> such that the first
/// new element has the index specified by <index>
/// Insert the list identified by <paramref name="src"/> into the
/// list designated by <paramref name="dest"/> such that the first
/// new element has the index specified by <paramref name="index"/>
/// </summary>
public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
@ -6663,6 +6645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ps.BurstSpeedMax = 1.0f;
ps.BurstRate = 0.1f;
ps.PartMaxAge = 10.0f;
ps.BurstPartCount = 1;
return ps;
}
@ -6684,10 +6667,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetParticleSystem(m_host, rules);
}
private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
{
if (rules.Length == 0)
{
part.RemoveParticleSystem();
@ -13232,7 +13213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Get a notecard line.
/// </summary>
/// <param name="assetID"></param>
/// <param name="line">Lines start at index 0</param>
/// <param name="lineNumber">Lines start at index 0</param>
/// <returns></returns>
public static string GetLine(UUID assetID, int lineNumber)
{
@ -13261,9 +13242,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Get a notecard line.
/// </summary>
/// <param name="assetID"></param>
/// <param name="line">Lines start at index 0</param>
/// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para>
/// <returns></returns>
/// <param name="lineNumber">Lines start at index 0</param>
/// <param name="maxLength">
/// Maximum length of the returned line.
/// </param>
/// <returns>
/// If the line length is longer than <paramref name="maxLength"/>,
/// the return string will be truncated.
/// </returns>
public static string GetLine(UUID assetID, int lineNumber, int maxLength)
{
string line = GetLine(assetID, lineNumber);

View File

@ -1214,12 +1214,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
sunHour += 24.0;
World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun;
World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30
World.RegionInfo.RegionSettings.FixedSun = sunFixed;
World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30
World.RegionInfo.RegionSettings.FixedSun = sunFixed;
World.RegionInfo.RegionSettings.Save();
World.EventManager.TriggerEstateToolsSunUpdate(
World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour);
World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
}
/// <summary>
@ -1244,8 +1243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.RegionInfo.EstateSettings.FixedSun = sunFixed;
World.RegionInfo.EstateSettings.Save();
World.EventManager.TriggerEstateToolsSunUpdate(
World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour);
World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
}
/// <summary>

View File

@ -633,19 +633,44 @@ namespace OpenSim.Region.ScriptEngine.Shared
public LSL_Types.Vector3 GetVector3Item(int itemIndex)
{
if(m_data[itemIndex] is LSL_Types.Vector3)
if (m_data[itemIndex] is LSL_Types.Vector3)
{
return (LSL_Types.Vector3)m_data[itemIndex];
}
else if(m_data[itemIndex] is OpenMetaverse.Vector3)
{
return new LSL_Types.Vector3(
(OpenMetaverse.Vector3)m_data[itemIndex]);
}
else
{
throw new InvalidCastException(string.Format(
"{0} expected but {1} given",
typeof(LSL_Types.Vector3).Name,
m_data[itemIndex] != null ?
m_data[itemIndex].GetType().Name : "null"));
}
}
public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
{
return (LSL_Types.Quaternion)m_data[itemIndex];
if (m_data[itemIndex] is LSL_Types.Quaternion)
{
return (LSL_Types.Quaternion)m_data[itemIndex];
}
else if(m_data[itemIndex] is OpenMetaverse.Quaternion)
{
return new LSL_Types.Quaternion(
(OpenMetaverse.Quaternion)m_data[itemIndex]);
}
else
{
throw new InvalidCastException(string.Format(
"{0} expected but {1} given",
typeof(LSL_Types.Quaternion).Name,
m_data[itemIndex] != null ?
m_data[itemIndex].GetType().Name : "null"));
}
}
public LSL_Types.key GetKeyItem(int itemIndex)

View File

@ -185,15 +185,15 @@ namespace OpenSim.Services.GridService
if (!m_AllowDuplicateNames)
{
List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
List<RegionData> dupe = m_Database.Get(Util.EscapeForLike(regionInfos.RegionName), scopeID);
if (dupe != null && dupe.Count > 0)
{
foreach (RegionData d in dupe)
{
if (d.RegionID != regionInfos.RegionID)
{
m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
regionInfos.RegionName, regionInfos.RegionID);
m_log.WarnFormat("[GRID SERVICE]: Region tried to register using a duplicate name. New region: {0} ({1}), existing region: {2} ({3}).",
regionInfos.RegionName, regionInfos.RegionID, d.RegionName, d.RegionID);
return "Duplicate region name";
}
}
@ -359,7 +359,7 @@ namespace OpenSim.Services.GridService
public GridRegion GetRegionByName(UUID scopeID, string name)
{
List<RegionData> rdatas = m_Database.Get(name, scopeID);
List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(name), scopeID);
if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first
@ -377,7 +377,7 @@ namespace OpenSim.Services.GridService
{
// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
List<RegionData> rdatas = m_Database.Get(name + "%", scopeID);
List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(name) + "%", scopeID);
int count = 0;
List<GridRegion> rinfos = new List<GridRegion>();
@ -586,7 +586,7 @@ namespace OpenSim.Services.GridService
string regionName = cmd[3];
List<RegionData> regions = m_Database.Get(regionName, UUID.Zero);
List<RegionData> regions = m_Database.Get(Util.EscapeForLike(regionName), UUID.Zero);
if (regions == null || regions.Count < 1)
{
MainConsole.Instance.Output("No region with name {0} found", regionName);
@ -716,7 +716,7 @@ namespace OpenSim.Services.GridService
return;
}
List<RegionData> regions = m_Database.Get(cmd[3], UUID.Zero);
List<RegionData> regions = m_Database.Get(Util.EscapeForLike(cmd[3]), UUID.Zero);
if (regions == null || regions.Count < 1)
{
MainConsole.Instance.Output("Region not found");

View File

@ -387,7 +387,7 @@ namespace OpenSim.Services.GridService
m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName);
GridRegion regInfo = null;
List<RegionData> regions = m_Database.Get(mapName, m_ScopeID);
List<RegionData> regions = m_Database.Get(Util.EscapeForLike(mapName), m_ScopeID);
if (regions != null && regions.Count > 0)
{
OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]);

File diff suppressed because it is too large Load Diff