Merge branch 'master' of /home/opensim/var/repo/opensim
commit
234e55077a
|
@ -41,8 +41,8 @@ namespace OpenSim.Framework
|
||||||
/// <summary>Timer interval in milliseconds for the watchdog timer</summary>
|
/// <summary>Timer interval in milliseconds for the watchdog timer</summary>
|
||||||
const double WATCHDOG_INTERVAL_MS = 2500.0d;
|
const double WATCHDOG_INTERVAL_MS = 2500.0d;
|
||||||
|
|
||||||
/// <summary>Maximum timeout in milliseconds before a thread is considered dead</summary>
|
/// <summary>Default timeout in milliseconds before a thread is considered dead</summary>
|
||||||
public const int WATCHDOG_TIMEOUT_MS = 5000;
|
public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerDisplay("{Thread.Name}")]
|
[System.Diagnostics.DebuggerDisplay("{Thread.Name}")]
|
||||||
public class ThreadWatchdogInfo
|
public class ThreadWatchdogInfo
|
||||||
|
@ -122,7 +122,7 @@ namespace OpenSim.Framework
|
||||||
public static Thread StartThread(
|
public static Thread StartThread(
|
||||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
|
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
|
||||||
{
|
{
|
||||||
return StartThread(start, name, priority, isBackground, alarmIfTimeout, null, WATCHDOG_TIMEOUT_MS);
|
return StartThread(start, name, priority, isBackground, alarmIfTimeout, null, DEFAULT_WATCHDOG_TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -270,7 +270,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
GetWatchdogIncomingAlarmData,
|
GetWatchdogIncomingAlarmData,
|
||||||
Watchdog.WATCHDOG_TIMEOUT_MS);
|
Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
|
||||||
|
|
||||||
Watchdog.StartThread(
|
Watchdog.StartThread(
|
||||||
OutgoingPacketHandler,
|
OutgoingPacketHandler,
|
||||||
|
@ -279,7 +279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
GetWatchdogOutgoingAlarmData,
|
GetWatchdogOutgoingAlarmData,
|
||||||
Watchdog.WATCHDOG_TIMEOUT_MS);
|
Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
|
||||||
|
|
||||||
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
string attName = "att";
|
string attName = "att";
|
||||||
|
|
||||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup;
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
||||||
|
|
||||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false);
|
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
MediaEntry me = new MediaEntry();
|
MediaEntry me = new MediaEntry();
|
||||||
|
|
||||||
m_module.SetMediaEntry(part, 1, me);
|
m_module.SetMediaEntry(part, 1, me);
|
||||||
|
@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
|
||||||
|
|
||||||
string homeUrl = "opensimulator.org";
|
string homeUrl = "opensimulator.org";
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
|
MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
|
||||||
|
|
||||||
m_module.SetMediaEntry(part, 1, me);
|
m_module.SetMediaEntry(part, 1, me);
|
||||||
|
|
|
@ -1108,6 +1108,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
CheckForTerrainUpdates();
|
CheckForTerrainUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InterfaceMinTerrain(Object[] args)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
for (x = 0; x < m_channel.Width; x++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < m_channel.Height; y++)
|
||||||
|
{
|
||||||
|
m_channel[x, y] = Math.Max((double)args[0], m_channel[x, y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckForTerrainUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InterfaceMaxTerrain(Object[] args)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
for (x = 0; x < m_channel.Width; x++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < m_channel.Height; y++)
|
||||||
|
{
|
||||||
|
m_channel[x, y] = Math.Min((double)args[0], m_channel[x, y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckForTerrainUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
private void InterfaceShowDebugStats(Object[] args)
|
private void InterfaceShowDebugStats(Object[] args)
|
||||||
{
|
{
|
||||||
double max = Double.MinValue;
|
double max = Double.MinValue;
|
||||||
|
@ -1248,6 +1274,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
rescaleCommand.AddArgument("min", "min terrain height after rescaling", "Double");
|
rescaleCommand.AddArgument("min", "min terrain height after rescaling", "Double");
|
||||||
rescaleCommand.AddArgument("max", "max terrain height after rescaling", "Double");
|
rescaleCommand.AddArgument("max", "max terrain height after rescaling", "Double");
|
||||||
|
|
||||||
|
Command minCommand = new Command("min", CommandIntentions.COMMAND_HAZARDOUS, InterfaceMinTerrain, "Sets the minimum terrain height to the specified value.");
|
||||||
|
minCommand.AddArgument("min", "terrain height to use as minimum", "Double");
|
||||||
|
|
||||||
|
Command maxCommand = new Command("max", CommandIntentions.COMMAND_HAZARDOUS, InterfaceMaxTerrain, "Sets the maximum terrain height to the specified value.");
|
||||||
|
maxCommand.AddArgument("min", "terrain height to use as maximum", "Double");
|
||||||
|
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
Command showDebugStatsCommand =
|
Command showDebugStatsCommand =
|
||||||
|
@ -1279,6 +1311,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
m_commander.RegisterCommand("effect", pluginRunCommand);
|
m_commander.RegisterCommand("effect", pluginRunCommand);
|
||||||
m_commander.RegisterCommand("flip", flipCommand);
|
m_commander.RegisterCommand("flip", flipCommand);
|
||||||
m_commander.RegisterCommand("rescale", rescaleCommand);
|
m_commander.RegisterCommand("rescale", rescaleCommand);
|
||||||
|
m_commander.RegisterCommand("min", minCommand);
|
||||||
|
m_commander.RegisterCommand("max", maxCommand);
|
||||||
|
|
||||||
// Add this to our scene so scripts can call these functions
|
// Add this to our scene so scripts can call these functions
|
||||||
m_scene.RegisterModuleCommander(m_commander);
|
m_scene.RegisterModuleCommander(m_commander);
|
||||||
|
|
|
@ -121,6 +121,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_defaultDrawDistance; }
|
get { return m_defaultDrawDistance; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<string> m_AllowedViewers = new List<string>();
|
||||||
|
private List<string> m_BannedViewers = new List<string>();
|
||||||
|
|
||||||
// TODO: need to figure out how allow client agents but deny
|
// TODO: need to figure out how allow client agents but deny
|
||||||
// root agents when ACL denies access to root agent
|
// root agents when ACL denies access to root agent
|
||||||
public bool m_strictAccessControl = true;
|
public bool m_strictAccessControl = true;
|
||||||
|
@ -779,6 +782,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string grant = startupConfig.GetString("AllowedViewerList", String.Empty);
|
||||||
|
if (grant.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (string viewer in grant.Split(','))
|
||||||
|
{
|
||||||
|
m_AllowedViewers.Add(viewer.Trim().ToLower());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grant = startupConfig.GetString("BannedViewerList", String.Empty);
|
||||||
|
if (grant.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (string viewer in grant.Split(','))
|
||||||
|
{
|
||||||
|
m_BannedViewers.Add(viewer.Trim().ToLower());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
|
MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
|
||||||
m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
|
m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
|
||||||
m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
|
m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
|
||||||
|
@ -3417,6 +3438,50 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if the viewer is banned or in the viewer access list
|
||||||
|
//We check if the substring is listed for higher flexebility
|
||||||
|
bool ViewerDenied = true;
|
||||||
|
|
||||||
|
//Check if the specific viewer is listed in the allowed viewer list
|
||||||
|
if (m_AllowedViewers.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (string viewer in m_AllowedViewers)
|
||||||
|
{
|
||||||
|
if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower())
|
||||||
|
{
|
||||||
|
ViewerDenied = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewerDenied = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if the viewer is in the banned list
|
||||||
|
if (m_BannedViewers.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (string viewer in m_BannedViewers)
|
||||||
|
{
|
||||||
|
if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower())
|
||||||
|
{
|
||||||
|
ViewerDenied = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ViewerDenied)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[SCENE]: Access denied for {0} {1} using {2}",
|
||||||
|
agent.firstname, agent.lastname, agent.Viewer);
|
||||||
|
reason = "Access denied, your viewer is banned by the region owner";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ScenePresence sp = GetScenePresence(agent.AgentID);
|
ScenePresence sp = GetScenePresence(agent.AgentID);
|
||||||
|
|
||||||
if (sp != null && !sp.IsChildAgent)
|
if (sp != null && !sp.IsChildAgent)
|
||||||
|
|
|
@ -108,6 +108,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private long timeFirstChanged;
|
private long timeFirstChanged;
|
||||||
private long timeLastChanged;
|
private long timeLastChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This indicates whether the object has changed such that it needs to be repersisted to permenant storage
|
||||||
|
/// (the database).
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ultimately, this should be managed such that region modules can change it at the end of a set of operations
|
||||||
|
/// so that either all changes are preserved or none at all. However, currently, a large amount of internal
|
||||||
|
/// code will set this anyway when some object properties are changed.
|
||||||
|
/// </remarks>
|
||||||
public bool HasGroupChanged
|
public bool HasGroupChanged
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
|
@ -1817,8 +1826,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Schedule a full update for this scene object
|
/// Schedule a full update for this scene object to all interested viewers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ultimately, this should be managed such that region modules can invoke it at the end of a set of operations
|
||||||
|
/// so that either all changes are sent at once. However, currently, a large amount of internal
|
||||||
|
/// code will set this anyway when some object properties are changed.
|
||||||
|
/// </remarks>
|
||||||
public void ScheduleGroupForFullUpdate()
|
public void ScheduleGroupForFullUpdate()
|
||||||
{
|
{
|
||||||
// if (IsAttachment)
|
// if (IsAttachment)
|
||||||
|
@ -1837,8 +1851,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Schedule a terse update for this scene object
|
/// Schedule a terse update for this scene object to all interested viewers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ultimately, this should be managed such that region modules can invoke it at the end of a set of operations
|
||||||
|
/// so that either all changes are sent at once. However, currently, a large amount of internal
|
||||||
|
/// code will set this anyway when some object properties are changed.
|
||||||
|
/// </remarks>
|
||||||
public void ScheduleGroupForTerseUpdate()
|
public void ScheduleGroupForTerseUpdate()
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID);
|
// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID);
|
||||||
|
|
|
@ -220,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private void QueryScriptStates()
|
private void QueryScriptStates()
|
||||||
{
|
{
|
||||||
if (m_part == null || m_part.ParentGroup == null)
|
if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||||
|
|
|
@ -186,15 +186,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
TestScene scene = new SceneHelpers().SetupScene();
|
TestScene scene = new SceneHelpers().SetupScene();
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
|
||||||
|
|
||||||
Assert.That(part.ParentGroup.IsDeleted, Is.False);
|
Assert.That(so.IsDeleted, Is.False);
|
||||||
|
|
||||||
scene.DeleteSceneObject(part.ParentGroup, false);
|
scene.DeleteSceneObject(so, false);
|
||||||
|
|
||||||
Assert.That(part.ParentGroup.IsDeleted, Is.True);
|
Assert.That(so.IsDeleted, Is.True);
|
||||||
|
|
||||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
|
||||||
Assert.That(retrievedPart, Is.Null);
|
Assert.That(retrievedPart, Is.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,22 +215,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
||||||
sogd.Enabled = false;
|
sogd.Enabled = false;
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
|
||||||
|
|
||||||
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
|
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
|
||||||
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
|
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
|
||||||
|
|
||||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
|
||||||
|
|
||||||
Assert.That(retrievedPart, Is.Not.Null);
|
Assert.That(retrievedPart, Is.Not.Null);
|
||||||
|
|
||||||
Assert.That(part.ParentGroup.IsDeleted, Is.False);
|
Assert.That(so.IsDeleted, Is.False);
|
||||||
|
|
||||||
sogd.InventoryDeQueueAndDelete();
|
sogd.InventoryDeQueueAndDelete();
|
||||||
|
|
||||||
Assert.That(part.ParentGroup.IsDeleted, Is.True);
|
Assert.That(so.IsDeleted, Is.True);
|
||||||
|
|
||||||
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
|
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
|
||||||
Assert.That(retrievedPart2, Is.Null);
|
Assert.That(retrievedPart2, Is.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
bool debugtest = false;
|
bool debugtest = false;
|
||||||
|
|
||||||
Scene scene = new SceneHelpers().SetupScene();
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene);
|
||||||
SceneObjectGroup grp1 = part1.ParentGroup;
|
SceneObjectPart part1 = grp1.RootPart;
|
||||||
SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene);
|
||||||
SceneObjectGroup grp2 = part2.ParentGroup;
|
SceneObjectPart part2 = grp2.RootPart;
|
||||||
|
|
||||||
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
||||||
grp2.AbsolutePosition = Vector3.Zero;
|
grp2.AbsolutePosition = Vector3.Zero;
|
||||||
|
@ -154,14 +154,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
bool debugtest = false;
|
bool debugtest = false;
|
||||||
|
|
||||||
Scene scene = new SceneHelpers().SetupScene();
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene);
|
||||||
SceneObjectGroup grp1 = part1.ParentGroup;
|
SceneObjectPart part1 = grp1.RootPart;
|
||||||
SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene);
|
||||||
SceneObjectGroup grp2 = part2.ParentGroup;
|
SceneObjectPart part2 = grp2.RootPart;
|
||||||
SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup grp3 = SceneHelpers.AddSceneObject(scene);
|
||||||
SceneObjectGroup grp3 = part3.ParentGroup;
|
SceneObjectPart part3 = grp3.RootPart;
|
||||||
SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene);
|
SceneObjectGroup grp4 = SceneHelpers.AddSceneObject(scene);
|
||||||
SceneObjectGroup grp4 = part4.ParentGroup;
|
SceneObjectPart part4 = grp4.RootPart;
|
||||||
|
|
||||||
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
||||||
grp2.AbsolutePosition = Vector3.Zero;
|
grp2.AbsolutePosition = Vector3.Zero;
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = new SceneHelpers().SetupScene();
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup;
|
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||||
|
|
||||||
g1.GroupResize(new Vector3(2, 3, 4));
|
g1.GroupResize(new Vector3(2, 3, 4));
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Vector3 startPos = new Vector3(10.1f, 0, 0);
|
Vector3 startPos = new Vector3(10.1f, 0, 0);
|
||||||
m_sp.AbsolutePosition = startPos;
|
m_sp.AbsolutePosition = startPos;
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
|
|
||||||
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Vector3 startPos = new Vector3(9.9f, 0, 0);
|
Vector3 startPos = new Vector3(9.9f, 0, 0);
|
||||||
m_sp.AbsolutePosition = startPos;
|
m_sp.AbsolutePosition = startPos;
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
|
|
||||||
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Vector3 startPos = new Vector3(1, 1, 1);
|
Vector3 startPos = new Vector3(1, 1, 1);
|
||||||
m_sp.AbsolutePosition = startPos;
|
m_sp.AbsolutePosition = startPos;
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
|
|
||||||
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Vector3 startPos = new Vector3(128, 128, 30);
|
Vector3 startPos = new Vector3(128, 128, 30);
|
||||||
m_sp.AbsolutePosition = startPos;
|
m_sp.AbsolutePosition = startPos;
|
||||||
|
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
part.SitTargetPosition = new Vector3(0, 0, 1);
|
part.SitTargetPosition = new Vector3(0, 0, 1);
|
||||||
|
|
||||||
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
|
||||||
|
|
|
@ -128,7 +128,9 @@ namespace OpenSim.Region.Framework.Tests
|
||||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||||
SceneObjectPart sop1 = sog1.RootPart;
|
SceneObjectPart sop1 = sog1.RootPart;
|
||||||
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
|
TaskInventoryItem sopItem1
|
||||||
|
= TaskInventoryHelpers.AddNotecard(
|
||||||
|
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||||
|
|
||||||
InventoryFolderBase folder
|
InventoryFolderBase folder
|
||||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
|
||||||
|
@ -156,8 +158,11 @@ namespace OpenSim.Region.Framework.Tests
|
||||||
Scene scene = new SceneHelpers().SetupScene();
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||||
|
|
||||||
SceneObjectPart sop1 = sog1.RootPart;
|
SceneObjectPart sop1 = sog1.RootPart;
|
||||||
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
|
TaskInventoryItem sopItem1
|
||||||
|
= TaskInventoryHelpers.AddNotecard(
|
||||||
|
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||||
|
|
||||||
// Perform test
|
// Perform test
|
||||||
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
|
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
|
||||||
|
|
|
@ -301,7 +301,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||||
|
|
||||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
|
|
||||||
part.SitTargetPosition = new Vector3(0, 0, 1);
|
part.SitTargetPosition = new Vector3(0, 0, 1);
|
||||||
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
||||||
|
@ -333,7 +333,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||||
|
|
||||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
|
||||||
|
|
||||||
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if ((item = ScriptByName(name)) != UUID.Zero)
|
if ((item = GetScriptByName(name)) != UUID.Zero)
|
||||||
m_ScriptEngine.ResetScript(item);
|
m_ScriptEngine.ResetScript(item);
|
||||||
else
|
else
|
||||||
ShoutError("llResetOtherScript: script "+name+" not found");
|
ShoutError("llResetOtherScript: script "+name+" not found");
|
||||||
|
@ -204,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if ((item = ScriptByName(name)) != UUID.Zero)
|
if ((item = GetScriptByName(name)) != UUID.Zero)
|
||||||
{
|
{
|
||||||
return m_ScriptEngine.GetScriptState(item) ?1:0;
|
return m_ScriptEngine.GetScriptState(item) ?1:0;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// These functions are supposed to be robust,
|
// These functions are supposed to be robust,
|
||||||
// so get the state one step at a time.
|
// so get the state one step at a time.
|
||||||
|
|
||||||
if ((item = ScriptByName(name)) != UUID.Zero)
|
if ((item = GetScriptByName(name)) != UUID.Zero)
|
||||||
{
|
{
|
||||||
m_ScriptEngine.SetScriptState(item, run == 0 ? false : true);
|
m_ScriptEngine.SetScriptState(item, run == 0 ? false : true);
|
||||||
}
|
}
|
||||||
|
@ -2738,24 +2738,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
Util.FireAndForget(delegate (object x)
|
Util.FireAndForget(x =>
|
||||||
{
|
{
|
||||||
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
|
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float dist = (float)llVecDist(llGetPos(), pos);
|
float dist = (float)llVecDist(llGetPos(), pos);
|
||||||
|
|
||||||
if (dist > m_ScriptDistanceFactor * 10.0f)
|
if (dist > m_ScriptDistanceFactor * 10.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Clone is thread-safe
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
|
||||||
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
if (item == null)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == inventory)
|
llSay(0, "Could not find object " + inventory);
|
||||||
{
|
return;
|
||||||
// make sure we're an object.
|
}
|
||||||
if (inv.Value.InvType != (int)InventoryType.Object)
|
|
||||||
|
if (item.InvType != (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
llSay(0, "Unable to create requested object. Object is missing from database.");
|
llSay(0, "Unable to create requested object. Object is missing from database.");
|
||||||
return;
|
return;
|
||||||
|
@ -2767,11 +2768,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// need the magnitude later
|
// need the magnitude later
|
||||||
// float velmag = (float)Util.GetMagnitude(llvel);
|
// float velmag = (float)Util.GetMagnitude(llvel);
|
||||||
|
|
||||||
SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
|
SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param);
|
||||||
|
|
||||||
// If either of these are null, then there was an unknown error.
|
// If either of these are null, then there was an unknown error.
|
||||||
if (new_group == null)
|
if (new_group == null)
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
// objects rezzed with this method are die_at_edge by default.
|
// objects rezzed with this method are die_at_edge by default.
|
||||||
new_group.RootPart.SetDieAtEdge(true);
|
new_group.RootPart.SetDieAtEdge(true);
|
||||||
|
@ -2794,11 +2795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
|
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
|
||||||
}
|
}
|
||||||
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
|
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
llSay(0, "Could not find object " + inventory);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//ScriptSleep((int)((groupmass * velmag) / 10));
|
//ScriptSleep((int)((groupmass * velmag) / 10));
|
||||||
|
@ -3860,11 +3856,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llGiveInventory(string destination, string inventory)
|
public void llGiveInventory(string destination, string inventory)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
bool found = false;
|
|
||||||
UUID destId = UUID.Zero;
|
UUID destId = UUID.Zero;
|
||||||
UUID objId = UUID.Zero;
|
|
||||||
int assetType = 0;
|
|
||||||
string objName = String.Empty;
|
|
||||||
|
|
||||||
if (!UUID.TryParse(destination, out destId))
|
if (!UUID.TryParse(destination, out destId))
|
||||||
{
|
{
|
||||||
|
@ -3872,28 +3865,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the first object found with this inventory name
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Name == inventory)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
objId = inv.Key;
|
|
||||||
assetType = inv.Value.Type;
|
|
||||||
objName = inv.Value.Name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
if (item == null)
|
||||||
{
|
{
|
||||||
llSay(0, String.Format("Could not find object '{0}'", inventory));
|
llSay(0, String.Format("Could not find object '{0}'", inventory));
|
||||||
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
|
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UUID objId = item.ItemID;
|
||||||
|
|
||||||
// check if destination is an object
|
// check if destination is an object
|
||||||
if (World.GetSceneObjectPart(destId) != null)
|
if (World.GetSceneObjectPart(destId) != null)
|
||||||
{
|
{
|
||||||
|
@ -3924,21 +3905,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
|
|
||||||
byte[] bucket = new byte[17];
|
byte[] bucket = new byte[17];
|
||||||
bucket[0] = (byte)assetType;
|
bucket[0] = (byte)item.Type;
|
||||||
byte[] objBytes = agentItem.ID.GetBytes();
|
byte[] objBytes = agentItem.ID.GetBytes();
|
||||||
Array.Copy(objBytes, 0, bucket, 1, 16);
|
Array.Copy(objBytes, 0, bucket, 1, 16);
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage(World,
|
GridInstantMessage msg = new GridInstantMessage(World,
|
||||||
m_host.UUID, m_host.Name+", an object owned by "+
|
m_host.UUID, m_host.Name + ", an object owned by " +
|
||||||
resolveName(m_host.OwnerID)+",", destId,
|
resolveName(m_host.OwnerID) + ",", destId,
|
||||||
(byte)InstantMessageDialog.TaskInventoryOffered,
|
(byte)InstantMessageDialog.TaskInventoryOffered,
|
||||||
false, objName+"\n"+m_host.Name+" is located at "+
|
false, item.Name + "\n" + m_host.Name + " is located at " +
|
||||||
World.RegionInfo.RegionName+" "+
|
World.RegionInfo.RegionName+" "+
|
||||||
m_host.AbsolutePosition.ToString(),
|
m_host.AbsolutePosition.ToString(),
|
||||||
agentItem.ID, true, m_host.AbsolutePosition,
|
agentItem.ID, true, m_host.AbsolutePosition,
|
||||||
bucket);
|
bucket);
|
||||||
|
|
||||||
if (m_TransferModule != null)
|
if (m_TransferModule != null)
|
||||||
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
|
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
|
||||||
|
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3947,20 +3930,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
if (item == null)
|
||||||
{
|
return;
|
||||||
if (item.Name == name)
|
|
||||||
{
|
|
||||||
if (item.ItemID == m_item.ItemID)
|
if (item.ItemID == m_item.ItemID)
|
||||||
throw new ScriptDeleteException();
|
throw new ScriptDeleteException();
|
||||||
else
|
else
|
||||||
m_host.Inventory.RemoveInventoryItem(item.ItemID);
|
m_host.Inventory.RemoveInventoryItem(item.ItemID);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetText(string text, LSL_Vector color, double alpha)
|
public void llSetText(string text, LSL_Vector color, double alpha)
|
||||||
|
@ -4102,9 +4080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems())
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in itemDictionary.Values)
|
|
||||||
{
|
{
|
||||||
if (item.Type == 3 && item.Name == name)
|
if (item.Type == 3 && item.Name == name)
|
||||||
{
|
{
|
||||||
|
@ -4136,6 +4112,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return tid.ToString();
|
return tid.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptSleep(1000);
|
ScriptSleep(1000);
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
@ -4308,18 +4285,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID soundId = UUID.Zero;
|
UUID soundId = UUID.Zero;
|
||||||
if (!UUID.TryParse(impact_sound, out soundId))
|
if (!UUID.TryParse(impact_sound, out soundId))
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(impact_sound);
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
if (item != null && item.Type == (int)AssetType.Sound)
|
||||||
{
|
|
||||||
if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
|
|
||||||
{
|
|
||||||
soundId = item.AssetID;
|
soundId = item.AssetID;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_host.CollisionSound = soundId;
|
m_host.CollisionSound = soundId;
|
||||||
m_host.CollisionSoundVolume = (float)impact_volume;
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
}
|
}
|
||||||
|
@ -4358,9 +4329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID partItemID;
|
UUID partItemID;
|
||||||
foreach (SceneObjectPart part in parts)
|
foreach (SceneObjectPart part in parts)
|
||||||
{
|
{
|
||||||
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
|
foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems())
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in itemsDictionary.Values)
|
|
||||||
{
|
{
|
||||||
if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT)
|
if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT)
|
||||||
{
|
{
|
||||||
|
@ -4730,22 +4699,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
if (item == null)
|
||||||
{
|
|
||||||
if (inv.Value.Name == name)
|
|
||||||
{
|
|
||||||
if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
|
|
||||||
{
|
|
||||||
return inv.Value.AssetID.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
|
||||||
}
|
if ((item.CurrentPermissions
|
||||||
}
|
& (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
|
||||||
|
== (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
|
||||||
|
{
|
||||||
|
return item.AssetID.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
|
@ -6329,20 +6292,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UUID GetTaskInventoryItem(string name)
|
|
||||||
{
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Name == name)
|
|
||||||
return inv.Key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void llGiveInventoryList(string destination, string category, LSL_List inventory)
|
public void llGiveInventoryList(string destination, string category, LSL_List inventory)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -6355,16 +6304,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
foreach (Object item in inventory.Data)
|
foreach (Object item in inventory.Data)
|
||||||
{
|
{
|
||||||
|
string rawItemString = item.ToString();
|
||||||
|
|
||||||
UUID itemID;
|
UUID itemID;
|
||||||
if (UUID.TryParse(item.ToString(), out itemID))
|
if (UUID.TryParse(rawItemString, out itemID))
|
||||||
{
|
{
|
||||||
itemList.Add(itemID);
|
itemList.Add(itemID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemID = GetTaskInventoryItem(item.ToString());
|
TaskInventoryItem taskItem = m_host.Inventory.GetInventoryItem(rawItemString);
|
||||||
if (itemID != UUID.Zero)
|
|
||||||
itemList.Add(itemID);
|
if (taskItem != null)
|
||||||
|
itemList.Add(taskItem.ItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6382,11 +6334,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
Array.Copy(objBytes, 0, bucket, 1, 16);
|
Array.Copy(objBytes, 0, bucket, 1, 16);
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage(World,
|
GridInstantMessage msg = new GridInstantMessage(World,
|
||||||
m_host.UUID, m_host.Name+", an object owned by "+
|
m_host.UUID, m_host.Name + ", an object owned by " +
|
||||||
resolveName(m_host.OwnerID)+",", destID,
|
resolveName(m_host.OwnerID) + ",", destID,
|
||||||
(byte)InstantMessageDialog.InventoryOffered,
|
(byte)InstantMessageDialog.InventoryOffered,
|
||||||
false, category+"\n"+m_host.Name+" is located at "+
|
false, category + "\n" + m_host.Name + " is located at " +
|
||||||
World.RegionInfo.RegionName+" "+
|
World.RegionInfo.RegionName + " " +
|
||||||
m_host.AbsolutePosition.ToString(),
|
m_host.AbsolutePosition.ToString(),
|
||||||
folderID, true, m_host.AbsolutePosition,
|
folderID, true, m_host.AbsolutePosition,
|
||||||
bucket);
|
bucket);
|
||||||
|
@ -6688,9 +6640,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
|
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
bool found = false;
|
|
||||||
UUID destId = UUID.Zero;
|
UUID destId = UUID.Zero;
|
||||||
UUID srcId = UUID.Zero;
|
|
||||||
|
|
||||||
if (!UUID.TryParse(target, out destId))
|
if (!UUID.TryParse(target, out destId))
|
||||||
{
|
{
|
||||||
|
@ -6705,31 +6656,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the first script found with this inventory name
|
// copy the first script found with this inventory name
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Name == name)
|
|
||||||
{
|
|
||||||
// make sure the object is a script
|
|
||||||
if (10 == inv.Value.Type)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
srcId = inv.Key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
// make sure the object is a script
|
||||||
|
if (item == null || item.Type != 10)
|
||||||
{
|
{
|
||||||
llSay(0, "Could not find script " + name);
|
llSay(0, "Could not find script " + name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the rest of the permission checks are done in RezScript, so check the pin there as well
|
// the rest of the permission checks are done in RezScript, so check the pin there as well
|
||||||
World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param);
|
World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param);
|
||||||
|
|
||||||
// this will cause the delay even if the script pin or permissions were wrong - seems ok
|
// this will cause the delay even if the script pin or permissions were wrong - seems ok
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
|
@ -9091,94 +9028,83 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetInventoryPermMask(string item, int mask)
|
public LSL_Integer llGetInventoryPermMask(string itemName, int mask)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
if (item == null)
|
||||||
{
|
return -1;
|
||||||
if (inv.Value.Name == item)
|
|
||||||
{
|
|
||||||
switch (mask)
|
switch (mask)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return (int)inv.Value.BasePermissions;
|
return (int)item.BasePermissions;
|
||||||
case 1:
|
case 1:
|
||||||
return (int)inv.Value.CurrentPermissions;
|
return (int)item.CurrentPermissions;
|
||||||
case 2:
|
case 2:
|
||||||
return (int)inv.Value.GroupPermissions;
|
return (int)item.GroupPermissions;
|
||||||
case 3:
|
case 3:
|
||||||
return (int)inv.Value.EveryonePermissions;
|
return (int)item.EveryonePermissions;
|
||||||
case 4:
|
case 4:
|
||||||
return (int)inv.Value.NextPermissions;
|
return (int)item.NextPermissions;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetInventoryPermMask(string item, int mask, int value)
|
public void llSetInventoryPermMask(string itemName, int mask, int value)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
|
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
|
||||||
{
|
{
|
||||||
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
|
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
if (item != null)
|
||||||
{
|
|
||||||
if (inv.Value.Name == item)
|
|
||||||
{
|
{
|
||||||
switch (mask)
|
switch (mask)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
inv.Value.BasePermissions = (uint)value;
|
item.BasePermissions = (uint)value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
inv.Value.CurrentPermissions = (uint)value;
|
item.CurrentPermissions = (uint)value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
inv.Value.GroupPermissions = (uint)value;
|
item.GroupPermissions = (uint)value;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
inv.Value.EveryonePermissions = (uint)value;
|
item.EveryonePermissions = (uint)value;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
inv.Value.NextPermissions = (uint)value;
|
item.NextPermissions = (uint)value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public LSL_String llGetInventoryCreator(string item)
|
public LSL_String llGetInventoryCreator(string itemName)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Name == item)
|
|
||||||
{
|
|
||||||
return inv.Value.CreatorID.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
llSay(0, "No item name '" + item + "'");
|
llSay(0, "No item name '" + item + "'");
|
||||||
|
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return item.CreatorID.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public void llOwnerSay(string msg)
|
public void llOwnerSay(string msg)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -9726,18 +9652,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Name == name)
|
|
||||||
{
|
|
||||||
return inv.Value.Type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
return item.Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetPayPrice(int price, LSL_List quick_pay_buttons)
|
public void llSetPayPrice(int price, LSL_List quick_pay_buttons)
|
||||||
|
@ -10531,18 +10451,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal UUID ScriptByName(string name)
|
internal UUID GetScriptByName(string name)
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
|
||||||
{
|
|
||||||
if (item.Type == 10 && item.Name == name)
|
|
||||||
return item.ItemID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (item == null || item.Type != 10)
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
|
||||||
|
return item.ItemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ShoutError(string msg)
|
internal void ShoutError(string msg)
|
||||||
|
@ -10582,20 +10498,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
|
||||||
|
|
||||||
UUID assetID = UUID.Zero;
|
UUID assetID = UUID.Zero;
|
||||||
|
|
||||||
if (!UUID.TryParse(name, out assetID))
|
if (!UUID.TryParse(name, out assetID))
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in itemsDictionary.Values)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
if (item.Type == 7 && item.Name == name)
|
if (item != null && item.Type == 7)
|
||||||
{
|
|
||||||
assetID = item.AssetID;
|
assetID = item.AssetID;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (assetID == UUID.Zero)
|
if (assetID == UUID.Zero)
|
||||||
|
@ -10644,20 +10554,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
|
||||||
|
|
||||||
UUID assetID = UUID.Zero;
|
UUID assetID = UUID.Zero;
|
||||||
|
|
||||||
if (!UUID.TryParse(name, out assetID))
|
if (!UUID.TryParse(name, out assetID))
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in itemsDictionary.Values)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
if (item.Type == 7 && item.Name == name)
|
if (item != null && item.Type == 7)
|
||||||
{
|
|
||||||
assetID = item.AssetID;
|
assetID = item.AssetID;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (assetID == UUID.Zero)
|
if (assetID == UUID.Zero)
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
|
public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public const string GridInfoServiceConfigSectionName = "GridInfoService";
|
public const string GridInfoServiceConfigSectionName = "GridInfoService";
|
||||||
|
|
||||||
|
@ -3151,6 +3151,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint);
|
((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory");
|
||||||
|
|
||||||
|
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||||
|
|
||||||
|
if (attachmentsModule == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
InitLSL();
|
||||||
|
|
||||||
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
((LSL_Api)m_LSL_Api).llSay(0, string.Format("Could not find object '{0}'", itemName));
|
||||||
|
throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.InvType != (int)InventoryType.Object)
|
||||||
|
{
|
||||||
|
// FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set
|
||||||
|
// up the api reference.
|
||||||
|
if (m_LSL_Api != null)
|
||||||
|
((LSL_Api)m_LSL_Api).llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName));
|
||||||
|
|
||||||
|
throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
|
||||||
|
|
||||||
|
if (sp == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID);
|
||||||
|
|
||||||
|
if (newItem == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}",
|
||||||
|
itemName, m_host.Name, attachmentPoint, World.Name);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
attachmentsModule.RezSingleAttachmentFromInventory(sp, newItem.ID, (uint)attachmentPoint);
|
||||||
|
}
|
||||||
|
|
||||||
public void osForceDetachFromAvatar()
|
public void osForceDetachFromAvatar()
|
||||||
{
|
{
|
||||||
CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar");
|
CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar");
|
||||||
|
|
|
@ -106,6 +106,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
/// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
|
/// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
|
||||||
void osForceAttachToAvatar(int attachment);
|
void osForceAttachToAvatar(int attachment);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attach the inventory item in the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='itemName'>Tha name of the item. If this is not found then a warning is said to the owner</param>
|
||||||
|
/// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
|
||||||
|
void osForceAttachToAvatarFromInventory(string itemName, int attachment);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH
|
/// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -296,6 +296,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint);
|
m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint);
|
||||||
|
}
|
||||||
|
|
||||||
public void osForceDetachFromAvatar()
|
public void osForceDetachFromAvatar()
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osForceDetachFromAvatar();
|
m_OSSL_Functions.osForceDetachFromAvatar();
|
||||||
|
|
|
@ -89,7 +89,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
|
|
||||||
// FIXME: This should really be a script item (with accompanying script)
|
// FIXME: This should really be a script item (with accompanying script)
|
||||||
TaskInventoryItem grp1Item
|
TaskInventoryItem grp1Item
|
||||||
= TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart);
|
= TaskInventoryHelpers.AddNotecard(
|
||||||
|
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||||
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||||
|
|
||||||
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
|
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
|
||||||
|
@ -122,7 +123,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
|
|
||||||
// FIXME: This should really be a script item (with accompanying script)
|
// FIXME: This should really be a script item (with accompanying script)
|
||||||
TaskInventoryItem grp1Item
|
TaskInventoryItem grp1Item
|
||||||
= TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart);
|
= TaskInventoryHelpers.AddNotecard(
|
||||||
|
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||||
|
|
||||||
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||||
|
|
||||||
LSL_Api apiGrp1 = new LSL_Api();
|
LSL_Api apiGrp1 = new LSL_Api();
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
config.Set("Enabled", "true");
|
config.Set("Enabled", "true");
|
||||||
|
|
||||||
Scene scene = new SceneHelpers().SetupScene();
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
SceneObjectPart part = SceneHelpers.AddSceneObject(scene).RootPart;
|
||||||
|
|
||||||
XEngine.XEngine engine = new XEngine.XEngine();
|
XEngine.XEngine engine = new XEngine.XEngine();
|
||||||
engine.Initialise(initConfigSource);
|
engine.Initialise(initConfigSource);
|
||||||
|
|
|
@ -0,0 +1,178 @@
|
||||||
|
/*
|
||||||
|
* 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.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Assets;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.CoreModules.Avatar.Attachments;
|
||||||
|
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tests for OSSL attachment functions
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// TODO: Add tests for all functions
|
||||||
|
/// </remarks>
|
||||||
|
[TestFixture]
|
||||||
|
public class OSSL_ApiAttachmentTests : OpenSimTestCase
|
||||||
|
{
|
||||||
|
protected Scene m_scene;
|
||||||
|
protected XEngine.XEngine m_engine;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public override void SetUp()
|
||||||
|
{
|
||||||
|
base.SetUp();
|
||||||
|
|
||||||
|
IConfigSource initConfigSource = new IniConfigSource();
|
||||||
|
|
||||||
|
IConfig xengineConfig = initConfigSource.AddConfig("XEngine");
|
||||||
|
xengineConfig.Set("Enabled", "true");
|
||||||
|
xengineConfig.Set("AllowOSFunctions", "true");
|
||||||
|
xengineConfig.Set("OSFunctionThreatLevel", "Severe");
|
||||||
|
|
||||||
|
IConfig modulesConfig = initConfigSource.AddConfig("Modules");
|
||||||
|
modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||||
|
|
||||||
|
m_scene = new SceneHelpers().SetupScene();
|
||||||
|
SceneHelpers.SetupSceneModules(
|
||||||
|
m_scene, initConfigSource, new AttachmentsModule(), new BasicInventoryAccessModule());
|
||||||
|
|
||||||
|
m_engine = new XEngine.XEngine();
|
||||||
|
m_engine.Initialise(initConfigSource);
|
||||||
|
m_engine.AddRegion(m_scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOsForceAttachToAvatarFromInventory()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
|
string taskInvObjItemName = "sphere";
|
||||||
|
UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
|
||||||
|
AttachmentPoint attachPoint = AttachmentPoint.Chin;
|
||||||
|
|
||||||
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
|
||||||
|
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
|
||||||
|
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);
|
||||||
|
|
||||||
|
new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
|
||||||
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
|
osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
|
||||||
|
|
||||||
|
// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
|
||||||
|
|
||||||
|
// Create an object embedded inside the first
|
||||||
|
TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
|
||||||
|
|
||||||
|
osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint);
|
||||||
|
|
||||||
|
// Check scene presence status
|
||||||
|
Assert.That(sp.HasAttachments(), Is.True);
|
||||||
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
|
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||||
|
SceneObjectGroup attSo = attachments[0];
|
||||||
|
Assert.That(attSo.Name, Is.EqualTo(taskInvObjItemName));
|
||||||
|
Assert.That(attSo.AttachmentPoint, Is.EqualTo((uint)attachPoint));
|
||||||
|
Assert.That(attSo.IsAttachment);
|
||||||
|
Assert.That(attSo.UsesPhysics, Is.False);
|
||||||
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
|
||||||
|
// Check appearance status
|
||||||
|
List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments();
|
||||||
|
Assert.That(attachmentsInAppearance.Count, Is.EqualTo(1));
|
||||||
|
Assert.That(sp.Appearance.GetAttachpoint(attachmentsInAppearance[0].ItemID), Is.EqualTo((uint)attachPoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Make sure we can't force attach anything other than objects.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestOsForceAttachToAvatarFromInventoryNotObject()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
|
string taskInvObjItemName = "sphere";
|
||||||
|
UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
|
||||||
|
AttachmentPoint attachPoint = AttachmentPoint.Chin;
|
||||||
|
|
||||||
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
|
||||||
|
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
|
||||||
|
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);
|
||||||
|
|
||||||
|
new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
|
||||||
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
|
osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
|
||||||
|
|
||||||
|
// Create an object embedded inside the first
|
||||||
|
TaskInventoryHelpers.AddNotecard(
|
||||||
|
m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900));
|
||||||
|
|
||||||
|
bool exceptionCaught = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
exceptionCaught = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(exceptionCaught, Is.True);
|
||||||
|
|
||||||
|
// Check scene presence status
|
||||||
|
Assert.That(sp.HasAttachments(), Is.False);
|
||||||
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
|
Assert.That(attachments.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// Check appearance status
|
||||||
|
List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments();
|
||||||
|
Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,14 +52,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
/// Tests for OSSL NPC API
|
/// Tests for OSSL NPC API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class OSSL_NpcApiAppearanceTest
|
public class OSSL_NpcApiAppearanceTest : OpenSimTestCase
|
||||||
{
|
{
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
protected XEngine.XEngine m_engine;
|
protected XEngine.XEngine m_engine;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public override void SetUp()
|
||||||
{
|
{
|
||||||
|
base.SetUp();
|
||||||
|
|
||||||
IConfigSource initConfigSource = new IniConfigSource();
|
IConfigSource initConfigSource = new IniConfigSource();
|
||||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||||
config.Set("Enabled", "true");
|
config.Set("Enabled", "true");
|
||||||
|
|
|
@ -564,7 +564,7 @@ namespace OpenSim.Tests.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SceneObjectPart AddSceneObject(Scene scene)
|
public static SceneObjectGroup AddSceneObject(Scene scene)
|
||||||
{
|
{
|
||||||
return AddSceneObject(scene, "Test Object", UUID.Zero);
|
return AddSceneObject(scene, "Test Object", UUID.Zero);
|
||||||
}
|
}
|
||||||
|
@ -576,16 +576,16 @@ namespace OpenSim.Tests.Common
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="ownerId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SceneObjectPart AddSceneObject(Scene scene, string name, UUID ownerId)
|
public static SceneObjectGroup AddSceneObject(Scene scene, string name, UUID ownerId)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), ownerId);
|
SceneObjectGroup so = new SceneObjectGroup(CreateSceneObjectPart(name, UUID.Random(), ownerId));
|
||||||
|
|
||||||
//part.UpdatePrimFlags(false, false, true);
|
//part.UpdatePrimFlags(false, false, true);
|
||||||
//part.ObjectFlags |= (uint)PrimFlags.Phantom;
|
//part.ObjectFlags |= (uint)PrimFlags.Phantom;
|
||||||
|
|
||||||
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
|
scene.AddNewSceneObject(so, false);
|
||||||
|
|
||||||
return part;
|
return so;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -45,29 +45,66 @@ namespace OpenSim.Tests.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="part"></param>
|
/// <param name="part"></param>
|
||||||
|
/// <param name="itemName"></param>
|
||||||
|
/// <param name="itemID"></param>
|
||||||
|
/// <param name="assetID"></param>
|
||||||
/// <returns>The item that was added</returns>
|
/// <returns>The item that was added</returns>
|
||||||
public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part)
|
public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID)
|
||||||
{
|
{
|
||||||
AssetNotecard nc = new AssetNotecard();
|
AssetNotecard nc = new AssetNotecard();
|
||||||
nc.BodyText = "Hello World!";
|
nc.BodyText = "Hello World!";
|
||||||
nc.Encode();
|
nc.Encode();
|
||||||
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
|
|
||||||
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
|
|
||||||
AssetBase ncAsset
|
AssetBase ncAsset
|
||||||
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
= AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
||||||
scene.AssetService.Store(ncAsset);
|
scene.AssetService.Store(ncAsset);
|
||||||
|
|
||||||
TaskInventoryItem ncItem
|
TaskInventoryItem ncItem
|
||||||
= new TaskInventoryItem
|
= new TaskInventoryItem
|
||||||
{ Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
|
{ Name = itemName, AssetID = assetID, ItemID = itemID,
|
||||||
Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
|
Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
|
||||||
part.Inventory.AddInventoryItem(ncItem, true);
|
part.Inventory.AddInventoryItem(ncItem, true);
|
||||||
|
|
||||||
return ncItem;
|
return ncItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a blank script to the given part.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
|
||||||
|
/// functions more than once in a test.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <param name="part"></param>
|
||||||
|
/// <returns>The item that was added</returns>
|
||||||
|
public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part)
|
||||||
|
{
|
||||||
|
AssetScriptText ast = new AssetScriptText();
|
||||||
|
ast.Encode();
|
||||||
|
|
||||||
|
UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000");
|
||||||
|
UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000");
|
||||||
|
AssetBase asset
|
||||||
|
= AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero);
|
||||||
|
scene.AssetService.Store(asset);
|
||||||
|
TaskInventoryItem item
|
||||||
|
= new TaskInventoryItem
|
||||||
|
{ Name = "scriptItem", AssetID = assetUuid, ItemID = itemUuid,
|
||||||
|
Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL };
|
||||||
|
part.Inventory.AddInventoryItem(item, true);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a scene object item to the given part.
|
/// Add a scene object item to the given part.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
|
||||||
|
/// functions more than once in a test.
|
||||||
|
/// </remarks>
|
||||||
|
///
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="sop"></param>
|
/// <param name="sop"></param>
|
||||||
/// <param name="itemName"></param>
|
/// <param name="itemName"></param>
|
||||||
|
|
|
@ -254,6 +254,23 @@
|
||||||
;; default is false
|
;; default is false
|
||||||
; TelehubAllowLandmark = false
|
; TelehubAllowLandmark = false
|
||||||
|
|
||||||
|
;# Comma separated list of viewers which may gain access to the regions.
|
||||||
|
;; One can use a Substring of the viewer name to enable only certain subversions
|
||||||
|
;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
|
||||||
|
;; - "Imprudence" has access
|
||||||
|
;; - "Imprudence 1.3" has access
|
||||||
|
;; - "Imprudence 1.3.1" has no access
|
||||||
|
;; AllowedViewerList =
|
||||||
|
|
||||||
|
;# Comma separated list of viewers which may not gain access to the regions.
|
||||||
|
;; One can use a Substring of the viewer name to disable only certain subversions
|
||||||
|
;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
|
||||||
|
;; - "Imprudence" has no access
|
||||||
|
;; - "Imprudence 1.3" has no access
|
||||||
|
;; - "Imprudence 1.3.1" has access
|
||||||
|
; BannedViewerList =
|
||||||
|
|
||||||
|
|
||||||
[Estates]
|
[Estates]
|
||||||
; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
|
; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
|
||||||
; If these values are uncommented then they will be used to create a default estate as necessary.
|
; If these values are uncommented then they will be used to create a default estate as necessary.
|
||||||
|
|
Loading…
Reference in New Issue