Merge branch 'master' of /home/opensim/var/repo/opensim
commit
668912be6f
|
@ -480,6 +480,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
|
public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
|
||||||
public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
|
public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
|
||||||
|
|
||||||
|
public delegate void ScenePresenceUpdated(ScenePresence sp);
|
||||||
|
public event ScenePresenceUpdated OnScenePresenceUpdated;
|
||||||
|
|
||||||
public delegate void RegionUp(GridRegion region);
|
public delegate void RegionUp(GridRegion region);
|
||||||
public event RegionUp OnRegionUp;
|
public event RegionUp OnRegionUp;
|
||||||
|
|
||||||
|
@ -2343,6 +2346,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TriggerScenePresenceUpdated(ScenePresence sp)
|
||||||
|
{
|
||||||
|
ScenePresenceUpdated handler = OnScenePresenceUpdated;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
foreach (ScenePresenceUpdated d in handler.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(sp);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
|
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
|
||||||
int local_id, IClientAPI remote_client)
|
int local_id, IClientAPI remote_client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,8 +92,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
|
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lock to prevent object group update, linking and delinking operations from running concurrently.
|
/// Lock to prevent object group update, linking, delinking and duplication operations from running concurrently.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// These operations rely on the parts composition of the object. If allowed to run concurrently then race
|
||||||
|
/// conditions can occur.
|
||||||
|
/// </remarks>
|
||||||
private Object m_updateLock = new Object();
|
private Object m_updateLock = new Object();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1844,18 +1848,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="AgentID"></param>
|
/// <param name="AgentID"></param>
|
||||||
/// <param name="GroupID"></param>
|
/// <param name="GroupID"></param>
|
||||||
/// <param name="rot"></param>
|
/// <param name="rot"></param>
|
||||||
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
|
/// <returns>null if duplication fails, otherwise the duplicated object</returns>
|
||||||
|
public SceneObjectGroup DuplicateObject(
|
||||||
|
uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
|
||||||
|
{
|
||||||
|
Monitor.Enter(m_updateLock);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
|
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
|
||||||
// originalPrimID, offset, AgentID);
|
// originalPrimID, offset, AgentID);
|
||||||
|
|
||||||
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
||||||
if (original != null)
|
if (original == null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanDuplicateObject(
|
m_log.WarnFormat(
|
||||||
|
"[SCENEGRAPH]: Attempt to duplicate nonexistant prim id {0} by {1}", originalPrimID, AgentID);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_parentScene.Permissions.CanDuplicateObject(
|
||||||
original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
|
original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
|
||||||
{
|
return null;
|
||||||
|
|
||||||
SceneObjectGroup copy = original.Copy(true);
|
SceneObjectGroup copy = original.Copy(true);
|
||||||
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
||||||
|
|
||||||
|
@ -1927,13 +1944,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
}
|
finally
|
||||||
else
|
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID);
|
Monitor.Exit(m_updateLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3321,10 +3321,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SetVehicleFlags(int param, bool remove)
|
public void SetVehicleFlags(int param, bool remove)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.VehicleFlags(param, remove);
|
if (pa != null)
|
||||||
}
|
pa.VehicleFlags(param, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGroup(UUID groupID, IClientAPI client)
|
public void SetGroup(UUID groupID, IClientAPI client)
|
||||||
|
@ -3356,10 +3356,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SetPhysicsAxisRotation()
|
public void SetPhysicsAxisRotation()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
PhysActor.LockAngularMotion(RotationAxis);
|
pa.LockAngularMotion(RotationAxis);
|
||||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// {
|
// {
|
||||||
// m_log.Debug("[SCENE PRESENCE] Destructor called");
|
// m_log.Debug("[SCENE PRESENCE] Destructor called");
|
||||||
// }
|
// }
|
||||||
|
private void TriggerScenePresenceUpdated()
|
||||||
|
{
|
||||||
|
if (m_scene != null)
|
||||||
|
m_scene.EventManager.TriggerScenePresenceUpdated(this);
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -489,6 +494,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//m_log.DebugFormat(
|
//m_log.DebugFormat(
|
||||||
// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
|
// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
|
||||||
// Scene.RegionInfo.RegionName, Name, m_pos);
|
// Scene.RegionInfo.RegionName, Name, m_pos);
|
||||||
|
TriggerScenePresenceUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,6 +514,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_pos = value;
|
m_pos = value;
|
||||||
|
TriggerScenePresenceUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,6 +1003,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
||||||
{
|
{
|
||||||
|
if (ParentID != (uint)0)
|
||||||
|
StandUp();
|
||||||
bool isFlying = Flying;
|
bool isFlying = Flying;
|
||||||
Vector3 vel = Velocity;
|
Vector3 vel = Velocity;
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
|
@ -1523,6 +1532,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||||
|
TriggerScenePresenceUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2419,6 +2429,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||||
}
|
}
|
||||||
|
TriggerScenePresenceUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||||
|
@ -3195,6 +3206,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Velocity = force;
|
Velocity = force;
|
||||||
|
|
||||||
m_forceToApply = null;
|
m_forceToApply = null;
|
||||||
|
TriggerScenePresenceUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,17 +27,22 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Interfaces
|
namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
{
|
{
|
||||||
public interface IScriptApi
|
public interface IScriptApi
|
||||||
{
|
{
|
||||||
//
|
/// <summary>
|
||||||
// Each API has an identifier, which is used to load the
|
/// Initialize the API
|
||||||
// proper runtime assembly at load time.
|
/// </summary>
|
||||||
//
|
/// <remarks>
|
||||||
void Initialize(IScriptEngine engine, SceneObjectPart part, uint localID, UUID item);
|
/// Each API has an identifier, which is used to load the
|
||||||
|
/// proper runtime assembly at load time.
|
||||||
|
/// <param name='engine'>/param>
|
||||||
|
/// <param name='part'></param>
|
||||||
|
/// <param name='item'></param>
|
||||||
|
void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -84,12 +84,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
protected IScriptEngine m_ScriptEngine;
|
protected IScriptEngine m_ScriptEngine;
|
||||||
protected SceneObjectPart m_host;
|
protected SceneObjectPart m_host;
|
||||||
protected uint m_localID;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UUID of the item that hosts this script
|
/// The item that hosts this script
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected UUID m_itemID;
|
protected TaskInventoryItem m_item;
|
||||||
|
|
||||||
protected bool throwErrorOnNotImplemented = true;
|
protected bool throwErrorOnNotImplemented = true;
|
||||||
protected AsyncCommandManager AsyncCommands = null;
|
protected AsyncCommandManager AsyncCommands = null;
|
||||||
|
@ -108,12 +107,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
|
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
|
||||||
new Dictionary<UUID, UserInfoCacheEntry>();
|
new Dictionary<UUID, UserInfoCacheEntry>();
|
||||||
|
|
||||||
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
|
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
m_ScriptEngine = ScriptEngine;
|
m_ScriptEngine = ScriptEngine;
|
||||||
m_host = host;
|
m_host = host;
|
||||||
m_localID = localID;
|
m_item = item;
|
||||||
m_itemID = itemID;
|
|
||||||
|
|
||||||
m_ScriptDelayFactor =
|
m_ScriptDelayFactor =
|
||||||
m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
|
m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
|
||||||
|
@ -163,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void state(string newState)
|
public void state(string newState)
|
||||||
{
|
{
|
||||||
m_ScriptEngine.SetState(m_itemID, newState);
|
m_ScriptEngine.SetState(m_item.ItemID, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -173,7 +171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llResetScript()
|
public void llResetScript()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
m_ScriptEngine.ApiResetScript(m_itemID);
|
m_ScriptEngine.ApiResetScript(m_item.ItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llResetOtherScript(string name)
|
public void llResetOtherScript(string name)
|
||||||
|
@ -272,20 +270,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the inventory item that hosts ourselves.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need
|
|
||||||
/// to keep looking ourselves up.
|
|
||||||
/// </remarks>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected TaskInventoryItem GetSelfInventoryItem()
|
|
||||||
{
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
return m_host.TaskInventory[m_itemID];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected UUID InventoryKey(string name, int type)
|
protected UUID InventoryKey(string name, int type)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -857,7 +841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID.TryParse(ID, out keyID);
|
UUID.TryParse(ID, out keyID);
|
||||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||||
if (wComm != null)
|
if (wComm != null)
|
||||||
return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg);
|
return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -867,7 +851,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||||
if (wComm != null)
|
if (wComm != null)
|
||||||
wComm.ListenControl(m_itemID, number, active);
|
wComm.ListenControl(m_item.ItemID, number, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llListenRemove(int number)
|
public void llListenRemove(int number)
|
||||||
|
@ -875,7 +859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||||
if (wComm != null)
|
if (wComm != null)
|
||||||
wComm.ListenRemove(m_itemID, number);
|
wComm.ListenRemove(m_item.ItemID, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSensor(string name, string id, int type, double range, double arc)
|
public void llSensor(string name, string id, int type, double range, double arc)
|
||||||
|
@ -884,7 +868,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID keyID = UUID.Zero;
|
UUID keyID = UUID.Zero;
|
||||||
UUID.TryParse(id, out keyID);
|
UUID.TryParse(id, out keyID);
|
||||||
|
|
||||||
AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host);
|
AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
|
public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
|
||||||
|
@ -893,13 +877,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID keyID = UUID.Zero;
|
UUID keyID = UUID.Zero;
|
||||||
UUID.TryParse(id, out keyID);
|
UUID.TryParse(id, out keyID);
|
||||||
|
|
||||||
AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host);
|
AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSensorRemove()
|
public void llSensorRemove()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_itemID);
|
AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_host.LocalId, m_item.ItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string resolveName(UUID objecUUID)
|
public string resolveName(UUID objecUUID)
|
||||||
|
@ -940,7 +924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_String llDetectedName(int number)
|
public LSL_String llDetectedName(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
return detectedParams.Name;
|
return detectedParams.Name;
|
||||||
|
@ -949,7 +933,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_String llDetectedKey(int number)
|
public LSL_String llDetectedKey(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
return detectedParams.Key.ToString();
|
return detectedParams.Key.ToString();
|
||||||
|
@ -958,7 +942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_String llDetectedOwner(int number)
|
public LSL_String llDetectedOwner(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
return detectedParams.Owner.ToString();
|
return detectedParams.Owner.ToString();
|
||||||
|
@ -967,7 +951,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llDetectedType(int number)
|
public LSL_Integer llDetectedType(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return 0;
|
return 0;
|
||||||
return new LSL_Integer(detectedParams.Type);
|
return new LSL_Integer(detectedParams.Type);
|
||||||
|
@ -976,7 +960,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedPos(int number)
|
public LSL_Vector llDetectedPos(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
return detectedParams.Position;
|
return detectedParams.Position;
|
||||||
|
@ -985,7 +969,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedVel(int number)
|
public LSL_Vector llDetectedVel(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
return detectedParams.Velocity;
|
return detectedParams.Velocity;
|
||||||
|
@ -994,7 +978,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedGrab(int number)
|
public LSL_Vector llDetectedGrab(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (parms == null)
|
if (parms == null)
|
||||||
return new LSL_Vector(0, 0, 0);
|
return new LSL_Vector(0, 0, 0);
|
||||||
|
|
||||||
|
@ -1004,7 +988,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Rotation llDetectedRot(int number)
|
public LSL_Rotation llDetectedRot(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
return detectedParams.Rotation;
|
return detectedParams.Rotation;
|
||||||
|
@ -1013,7 +997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llDetectedGroup(int number)
|
public LSL_Integer llDetectedGroup(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Integer(0);
|
return new LSL_Integer(0);
|
||||||
if (m_host.GroupID == detectedParams.Group)
|
if (m_host.GroupID == detectedParams.Group)
|
||||||
|
@ -1024,7 +1008,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llDetectedLinkNumber(int number)
|
public LSL_Integer llDetectedLinkNumber(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number);
|
DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||||
if (parms == null)
|
if (parms == null)
|
||||||
return new LSL_Integer(0);
|
return new LSL_Integer(0);
|
||||||
|
|
||||||
|
@ -1037,7 +1021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedTouchBinormal(int index)
|
public LSL_Vector llDetectedTouchBinormal(int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
return detectedParams.TouchBinormal;
|
return detectedParams.TouchBinormal;
|
||||||
|
@ -1049,7 +1033,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llDetectedTouchFace(int index)
|
public LSL_Integer llDetectedTouchFace(int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Integer(-1);
|
return new LSL_Integer(-1);
|
||||||
return new LSL_Integer(detectedParams.TouchFace);
|
return new LSL_Integer(detectedParams.TouchFace);
|
||||||
|
@ -1061,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedTouchNormal(int index)
|
public LSL_Vector llDetectedTouchNormal(int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
return detectedParams.TouchNormal;
|
return detectedParams.TouchNormal;
|
||||||
|
@ -1073,7 +1057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedTouchPos(int index)
|
public LSL_Vector llDetectedTouchPos(int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
return detectedParams.TouchPos;
|
return detectedParams.TouchPos;
|
||||||
|
@ -1085,7 +1069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedTouchST(int index)
|
public LSL_Vector llDetectedTouchST(int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector(-1.0, -1.0, 0.0);
|
return new LSL_Vector(-1.0, -1.0, 0.0);
|
||||||
return detectedParams.TouchST;
|
return detectedParams.TouchST;
|
||||||
|
@ -1097,7 +1081,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llDetectedTouchUV(int index)
|
public LSL_Vector llDetectedTouchUV(int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
|
||||||
if (detectedParams == null)
|
if (detectedParams == null)
|
||||||
return new LSL_Vector(-1.0, -1.0, 0.0);
|
return new LSL_Vector(-1.0, -1.0, 0.0);
|
||||||
return detectedParams.TouchUV;
|
return detectedParams.TouchUV;
|
||||||
|
@ -2702,12 +2686,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||||
{
|
{
|
||||||
LSLError("No permissions to give money");
|
LSLError("No permissions to give money");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2890,7 +2872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
sec = m_MinTimerInterval;
|
sec = m_MinTimerInterval;
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
// Setting timer repeat
|
// Setting timer repeat
|
||||||
AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_itemID, sec);
|
AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void llSleep(double sec)
|
public virtual void llSleep(double sec)
|
||||||
|
@ -2945,17 +2927,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void llTakeControls(int controls, int accept, int pass_on)
|
public void llTakeControls(int controls, int accept, int pass_on)
|
||||||
{
|
{
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter != UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter != UUID.Zero)
|
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID);
|
presence.RegisterControlEventsToScript(controls, accept, pass_on, m_host.LocalId, m_item.ItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2967,20 +2947,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter != UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter != UUID.Zero)
|
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
// Unregister controls from Presence
|
// Unregister controls from Presence
|
||||||
presence.UnRegisterControlEventsToScript(m_localID, m_itemID);
|
presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID);
|
||||||
// Remove Take Control permission.
|
// Remove Take Control permission.
|
||||||
item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
|
m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3042,12 +3020,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
|
// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter != m_host.OwnerID)
|
||||||
|
|
||||||
if (item.PermsGranter != m_host.OwnerID)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
||||||
AttachToAvatar(attachmentPoint);
|
AttachToAvatar(attachmentPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3058,12 +3034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (m_host.ParentGroup.AttachmentPoint == 0)
|
if (m_host.ParentGroup.AttachmentPoint == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter != m_host.OwnerID)
|
||||||
|
|
||||||
if (item.PermsGranter != m_host.OwnerID)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
||||||
DetachFromAvatar();
|
DetachFromAvatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3245,7 +3219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_ScriptEngine.SetMinEventDelay(m_itemID, delay);
|
m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay);
|
||||||
}
|
}
|
||||||
catch (NotImplementedException)
|
catch (NotImplementedException)
|
||||||
{
|
{
|
||||||
|
@ -3298,14 +3272,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -3323,12 +3295,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
||||||
{
|
{
|
||||||
UUID animID = new UUID();
|
UUID animID = new UUID();
|
||||||
|
|
||||||
|
@ -3337,7 +3307,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
animID = InventoryKey(anim);
|
animID = InventoryKey(anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -3373,7 +3343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llGetStartParameter()
|
public LSL_Integer llGetStartParameter()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
return m_ScriptEngine.GetStartParameter(m_itemID);
|
return m_ScriptEngine.GetStartParameter(m_item.ItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llRequestPermissions(string agent, int perm)
|
public void llRequestPermissions(string agent, int perm)
|
||||||
|
@ -3383,16 +3353,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (!UUID.TryParse(agent, out agentID))
|
if (!UUID.TryParse(agent, out agentID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
|
||||||
|
|
||||||
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
||||||
{
|
{
|
||||||
llReleaseControls();
|
llReleaseControls();
|
||||||
|
|
||||||
item.PermsGranter = UUID.Zero;
|
m_item.PermsGranter = UUID.Zero;
|
||||||
item.PermsMask = 0;
|
m_item.PermsMask = 0;
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
new LSL_Integer(0) },
|
new LSL_Integer(0) },
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
|
@ -3400,7 +3368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
if (m_item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
||||||
llReleaseControls();
|
llReleaseControls();
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -3417,11 +3385,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[m_itemID].PermsGranter = agentID;
|
m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[m_itemID].PermsMask = perm;
|
m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
new LSL_Integer(perm) },
|
new LSL_Integer(perm) },
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
|
@ -3441,11 +3409,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[m_itemID].PermsGranter = agentID;
|
m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[m_itemID].PermsMask = perm;
|
m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
new LSL_Integer(perm) },
|
new LSL_Integer(perm) },
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
|
@ -3466,8 +3434,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[m_itemID].PermsGranter = agentID;
|
m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[m_itemID].PermsMask = 0;
|
m_host.TaskInventory[m_item.ItemID].PermsMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
|
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
|
||||||
|
@ -3475,13 +3443,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
presence.ControllingClient.SendScriptQuestion(
|
presence.ControllingClient.SendScriptQuestion(
|
||||||
m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm);
|
m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_item.ItemID, perm);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requested agent is not in range, refuse perms
|
// Requested agent is not in range, refuse perms
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
new LSL_Integer(0) },
|
new LSL_Integer(0) },
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
|
@ -3500,10 +3468,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[m_itemID].PermsMask = answer;
|
m_host.TaskInventory[m_item.ItemID].PermsMask = answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
new LSL_Integer(answer) },
|
new LSL_Integer(answer) },
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
|
@ -3513,14 +3481,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
return GetSelfInventoryItem().PermsGranter.ToString();
|
return m_item.PermsGranter.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetPermissions()
|
public LSL_Integer llGetPermissions()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
int perms = GetSelfInventoryItem().PermsMask;
|
int perms = m_item.PermsMask;
|
||||||
|
|
||||||
if (m_automaticLinkPermission)
|
if (m_automaticLinkPermission)
|
||||||
perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||||
|
@ -3558,9 +3526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (!UUID.TryParse(target, out targetID))
|
if (!UUID.TryParse(target, out targetID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
|
||||||
&& !m_automaticLinkPermission)
|
&& !m_automaticLinkPermission)
|
||||||
{
|
{
|
||||||
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
|
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
|
||||||
|
@ -3568,7 +3534,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
IClientAPI client = null;
|
IClientAPI client = null;
|
||||||
ScenePresence sp = World.GetScenePresence(item.PermsGranter);
|
ScenePresence sp = World.GetScenePresence(m_item.PermsGranter);
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
client = sp.ControllingClient;
|
client = sp.ControllingClient;
|
||||||
|
|
||||||
|
@ -3615,7 +3581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
||||||
&& !m_automaticLinkPermission)
|
&& !m_automaticLinkPermission)
|
||||||
{
|
{
|
||||||
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
|
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
|
||||||
|
@ -3986,7 +3952,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
if (item.Name == name)
|
if (item.Name == name)
|
||||||
{
|
{
|
||||||
if (item.ItemID == m_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);
|
||||||
|
@ -4121,8 +4087,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID rq = UUID.Random();
|
UUID rq = UUID.Random();
|
||||||
|
|
||||||
UUID tid = AsyncCommands.
|
UUID tid = AsyncCommands.
|
||||||
DataserverPlugin.RegisterRequest(m_localID,
|
DataserverPlugin.RegisterRequest(m_host.LocalId,
|
||||||
m_itemID, rq.ToString());
|
m_item.ItemID, rq.ToString());
|
||||||
|
|
||||||
AsyncCommands.
|
AsyncCommands.
|
||||||
DataserverPlugin.DataserverReply(rq.ToString(), reply);
|
DataserverPlugin.DataserverReply(rq.ToString(), reply);
|
||||||
|
@ -4142,8 +4108,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (item.Type == 3 && item.Name == name)
|
if (item.Type == 3 && item.Name == name)
|
||||||
{
|
{
|
||||||
UUID tid = AsyncCommands.
|
UUID tid = AsyncCommands.
|
||||||
DataserverPlugin.RegisterRequest(m_localID,
|
DataserverPlugin.RegisterRequest(m_host.LocalId,
|
||||||
m_itemID, item.AssetID.ToString());
|
m_item.ItemID, item.AssetID.ToString());
|
||||||
|
|
||||||
Vector3 region = new Vector3(
|
Vector3 region = new Vector3(
|
||||||
World.RegionInfo.RegionLocX * Constants.RegionSize,
|
World.RegionInfo.RegionLocX * Constants.RegionSize,
|
||||||
|
@ -4498,9 +4464,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
return m_item.Name != null ? m_item.Name : String.Empty;
|
||||||
|
|
||||||
return item.Name != null ? item.Name : String.Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetLinkNumberOfSides(int link)
|
public LSL_Integer llGetLinkNumberOfSides(int link)
|
||||||
|
@ -5565,6 +5529,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
return "en-us";
|
return "en-us";
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// http://wiki.secondlife.com/wiki/LlGetAgentList
|
||||||
|
/// The list of options is currently not used in SL
|
||||||
|
/// scope is one of:-
|
||||||
|
/// AGENT_LIST_REGION - all in the region
|
||||||
|
/// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
|
||||||
|
/// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
|
||||||
|
/// current parcel.
|
||||||
|
/// </summary>
|
||||||
|
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
// the constants are 1, 2 and 4 so bits are being set, but you
|
||||||
|
// get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
|
||||||
|
bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
|
||||||
|
bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER;
|
||||||
|
bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL;
|
||||||
|
|
||||||
|
LSL_List result = new LSL_List();
|
||||||
|
|
||||||
|
if (!regionWide && !parcelOwned && !parcel)
|
||||||
|
{
|
||||||
|
result.Add("INVALID_SCOPE");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ILandObject land;
|
||||||
|
Vector3 pos;
|
||||||
|
UUID id = UUID.Zero;
|
||||||
|
if (parcel || parcelOwned)
|
||||||
|
{
|
||||||
|
pos = m_host.ParentGroup.RootPart.GetWorldPosition();
|
||||||
|
land = World.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
|
if (land == null)
|
||||||
|
{
|
||||||
|
id = UUID.Zero;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (parcelOwned)
|
||||||
|
{
|
||||||
|
id = land.LandData.OwnerID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id = land.LandData.GlobalID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<UUID> presenceIds = new List<UUID>();
|
||||||
|
|
||||||
|
World.ForEachRootScenePresence(
|
||||||
|
delegate (ScenePresence ssp)
|
||||||
|
{
|
||||||
|
// Gods are not listed in SL
|
||||||
|
if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent)
|
||||||
|
{
|
||||||
|
if (!regionWide)
|
||||||
|
{
|
||||||
|
pos = ssp.AbsolutePosition;
|
||||||
|
land = World.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
|
if (land != null)
|
||||||
|
{
|
||||||
|
if (parcelOwned && land.LandData.OwnerID == id ||
|
||||||
|
parcel && land.LandData.GlobalID == id)
|
||||||
|
{
|
||||||
|
result.Add(ssp.UUID.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Add(ssp.UUID.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Maximum of 100 results
|
||||||
|
if (result.Length > 99)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public void llAdjustSoundVolume(double volume)
|
public void llAdjustSoundVolume(double volume)
|
||||||
{
|
{
|
||||||
|
@ -6598,14 +6647,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||||
if (xmlrpcMod.IsEnabled())
|
if (xmlrpcMod.IsEnabled())
|
||||||
{
|
{
|
||||||
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
|
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
|
||||||
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||||
if (xmlRpcRouter != null)
|
if (xmlRpcRouter != null)
|
||||||
{
|
{
|
||||||
string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
|
string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
|
||||||
|
|
||||||
xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
|
xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
|
||||||
m_itemID, String.Format("http://{0}:{1}/", ExternalHostName,
|
m_item.ItemID, String.Format("http://{0}:{1}/", ExternalHostName,
|
||||||
xmlrpcMod.Port.ToString()));
|
xmlrpcMod.Port.ToString()));
|
||||||
}
|
}
|
||||||
object[] resobj = new object[]
|
object[] resobj = new object[]
|
||||||
|
@ -6617,7 +6666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
new LSL_Integer(0),
|
new LSL_Integer(0),
|
||||||
new LSL_String(String.Empty)
|
new LSL_String(String.Empty)
|
||||||
};
|
};
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj,
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj,
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
}
|
}
|
||||||
ScriptSleep(1000);
|
ScriptSleep(1000);
|
||||||
|
@ -6628,7 +6677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString();
|
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
|
public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
|
||||||
|
@ -9049,13 +9098,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (m_UrlModule != null)
|
if (m_UrlModule != null)
|
||||||
return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString();
|
return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString();
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_String llRequestSimulatorData(string simulator, int data)
|
public LSL_String llRequestSimulatorData(string simulator, int data)
|
||||||
{
|
{
|
||||||
IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL");
|
IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -9117,7 +9166,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID rq = UUID.Random();
|
UUID rq = UUID.Random();
|
||||||
|
|
||||||
UUID tid = AsyncCommands.
|
UUID tid = AsyncCommands.
|
||||||
DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString());
|
DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString());
|
||||||
|
|
||||||
AsyncCommands.
|
AsyncCommands.
|
||||||
DataserverPlugin.DataserverReply(rq.ToString(), reply);
|
DataserverPlugin.DataserverReply(rq.ToString(), reply);
|
||||||
|
@ -9136,7 +9185,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_UrlModule != null)
|
if (m_UrlModule != null)
|
||||||
return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString();
|
return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString();
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9602,12 +9651,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
||||||
{
|
{
|
||||||
ShoutError("No permissions to track the camera");
|
ShoutError("No permissions to track the camera");
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
|
@ -9626,12 +9673,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
||||||
{
|
{
|
||||||
ShoutError("No permissions to track the camera");
|
ShoutError("No permissions to track the camera");
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
|
@ -9696,7 +9741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt)
|
public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0);
|
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0);
|
||||||
if (detectedParams == null) return; // only works on the first detected avatar
|
if (detectedParams == null) return; // only works on the first detected avatar
|
||||||
|
|
||||||
ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
|
ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
|
||||||
|
@ -9813,15 +9858,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (objectID == UUID.Zero)
|
if (objectID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
|
||||||
|
|
||||||
// we need the permission first, to know which avatar we want to set the camera for
|
// we need the permission first, to know which avatar we want to set the camera for
|
||||||
UUID agentID = item.PermsGranter;
|
UUID agentID = m_item.PermsGranter;
|
||||||
|
|
||||||
if (agentID == UUID.Zero)
|
if (agentID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(agentID);
|
ScenePresence presence = World.GetScenePresence(agentID);
|
||||||
|
@ -9867,15 +9910,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (objectID == UUID.Zero)
|
if (objectID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TaskInventoryItem item = GetSelfInventoryItem();
|
|
||||||
|
|
||||||
// we need the permission first, to know which avatar we want to clear the camera for
|
// we need the permission first, to know which avatar we want to clear the camera for
|
||||||
UUID agentID = item.PermsGranter;
|
UUID agentID = m_item.PermsGranter;
|
||||||
|
|
||||||
if (agentID == UUID.Zero)
|
if (agentID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(agentID);
|
ScenePresence presence = World.GetScenePresence(agentID);
|
||||||
|
@ -10024,8 +10065,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID reqID = httpScriptMod.
|
UUID reqID
|
||||||
StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body);
|
= httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body);
|
||||||
|
|
||||||
if (reqID != UUID.Zero)
|
if (reqID != UUID.Zero)
|
||||||
return reqID.ToString();
|
return reqID.ToString();
|
||||||
|
@ -10455,7 +10496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
// was: UUID tid = tid = AsyncCommands.
|
// was: UUID tid = tid = AsyncCommands.
|
||||||
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString());
|
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString());
|
||||||
|
|
||||||
if (NotecardCache.IsCached(assetID))
|
if (NotecardCache.IsCached(assetID))
|
||||||
{
|
{
|
||||||
|
@ -10517,7 +10558,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
// was: UUID tid = tid = AsyncCommands.
|
// was: UUID tid = tid = AsyncCommands.
|
||||||
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString());
|
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString());
|
||||||
|
|
||||||
if (NotecardCache.IsCached(assetID))
|
if (NotecardCache.IsCached(assetID))
|
||||||
{
|
{
|
||||||
|
@ -10575,7 +10616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void print(string str)
|
public void print(string str)
|
||||||
{
|
{
|
||||||
// yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print
|
// yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print
|
||||||
IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL");
|
IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL");
|
||||||
if (ossl != null)
|
if (ossl != null)
|
||||||
{
|
{
|
||||||
ossl.CheckThreatLevel(ThreatLevel.High, "print");
|
ossl.CheckThreatLevel(ThreatLevel.High, "print");
|
||||||
|
@ -10603,7 +10644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
UUID rq = UUID.Random();
|
UUID rq = UUID.Random();
|
||||||
|
|
||||||
AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString());
|
AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString());
|
||||||
|
|
||||||
AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
|
AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
|
||||||
|
|
||||||
|
@ -10619,7 +10660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
UUID rq = UUID.Random();
|
UUID rq = UUID.Random();
|
||||||
|
|
||||||
AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString());
|
AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString());
|
||||||
|
|
||||||
AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
|
AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
|
||||||
|
|
||||||
|
|
|
@ -58,17 +58,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
internal IScriptEngine m_ScriptEngine;
|
internal IScriptEngine m_ScriptEngine;
|
||||||
internal SceneObjectPart m_host;
|
internal SceneObjectPart m_host;
|
||||||
internal uint m_localID;
|
|
||||||
internal UUID m_itemID;
|
|
||||||
internal bool m_LSFunctionsEnabled = false;
|
internal bool m_LSFunctionsEnabled = false;
|
||||||
internal IScriptModuleComms m_comms = null;
|
internal IScriptModuleComms m_comms = null;
|
||||||
|
|
||||||
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
|
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
m_ScriptEngine = ScriptEngine;
|
m_ScriptEngine = ScriptEngine;
|
||||||
m_host = host;
|
m_host = host;
|
||||||
m_localID = localID;
|
|
||||||
m_itemID = itemID;
|
|
||||||
|
|
||||||
if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
|
if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
|
||||||
m_LSFunctionsEnabled = true;
|
m_LSFunctionsEnabled = true;
|
||||||
|
|
|
@ -57,17 +57,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
internal IScriptEngine m_ScriptEngine;
|
internal IScriptEngine m_ScriptEngine;
|
||||||
internal SceneObjectPart m_host;
|
internal SceneObjectPart m_host;
|
||||||
internal uint m_localID;
|
internal TaskInventoryItem m_item;
|
||||||
internal UUID m_itemID;
|
|
||||||
internal bool m_MODFunctionsEnabled = false;
|
internal bool m_MODFunctionsEnabled = false;
|
||||||
internal IScriptModuleComms m_comms = null;
|
internal IScriptModuleComms m_comms = null;
|
||||||
|
|
||||||
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
|
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
m_ScriptEngine = ScriptEngine;
|
m_ScriptEngine = ScriptEngine;
|
||||||
m_host = host;
|
m_host = host;
|
||||||
m_localID = localID;
|
m_item = item;
|
||||||
m_itemID = itemID;
|
|
||||||
|
|
||||||
if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false))
|
if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false))
|
||||||
m_MODFunctionsEnabled = true;
|
m_MODFunctionsEnabled = true;
|
||||||
|
@ -252,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// non-null but don't trust it completely
|
// non-null but don't trust it completely
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms);
|
object result = m_comms.InvokeOperation(m_host.UUID, m_item.ItemID, fname, convertedParms);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -279,7 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
UUID req = UUID.Random();
|
UUID req = UUID.Random();
|
||||||
|
|
||||||
m_comms.RaiseEvent(m_itemID, req.ToString(), module, command, k);
|
m_comms.RaiseEvent(m_item.ItemID, req.ToString(), module, command, k);
|
||||||
|
|
||||||
return req.ToString();
|
return req.ToString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,20 +133,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
internal IScriptEngine m_ScriptEngine;
|
internal IScriptEngine m_ScriptEngine;
|
||||||
internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
|
internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
|
||||||
internal SceneObjectPart m_host;
|
internal SceneObjectPart m_host;
|
||||||
internal uint m_localID;
|
internal TaskInventoryItem m_item;
|
||||||
internal UUID m_itemID;
|
|
||||||
internal bool m_OSFunctionsEnabled = false;
|
internal bool m_OSFunctionsEnabled = false;
|
||||||
internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
|
internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
|
||||||
internal float m_ScriptDelayFactor = 1.0f;
|
internal float m_ScriptDelayFactor = 1.0f;
|
||||||
internal float m_ScriptDistanceFactor = 1.0f;
|
internal float m_ScriptDistanceFactor = 1.0f;
|
||||||
internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
|
internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
|
||||||
|
|
||||||
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
|
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
m_ScriptEngine = ScriptEngine;
|
m_ScriptEngine = ScriptEngine;
|
||||||
m_host = host;
|
m_host = host;
|
||||||
m_localID = localID;
|
m_item = item;
|
||||||
m_itemID = itemID;
|
|
||||||
|
|
||||||
if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
|
if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
|
||||||
m_OSFunctionsEnabled = true;
|
m_OSFunctionsEnabled = true;
|
||||||
|
@ -224,7 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (m_LSL_Api != null)
|
if (m_LSL_Api != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_itemID, "LSL");
|
m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -343,22 +341,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID);
|
UUID ownerID = m_item.OwnerID;
|
||||||
if (ti == null)
|
|
||||||
{
|
|
||||||
OSSLError(
|
|
||||||
String.Format("{0} permission error. Can't find script in prim inventory.",
|
|
||||||
function));
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID ownerID = ti.OwnerID;
|
|
||||||
|
|
||||||
//OSSL only may be used if object is in the same group as the parcel
|
//OSSL only may be used if object is in the same group as the parcel
|
||||||
if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER"))
|
if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER"))
|
||||||
{
|
{
|
||||||
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||||
|
|
||||||
if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero)
|
if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -394,13 +384,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID))
|
if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID))
|
||||||
OSSLError(
|
OSSLError(
|
||||||
String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
|
String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
|
||||||
function));
|
function));
|
||||||
if (ti.CreatorID != ownerID)
|
|
||||||
|
if (m_item.CreatorID != ownerID)
|
||||||
{
|
{
|
||||||
if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
|
if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
|
||||||
OSSLError(
|
OSSLError(
|
||||||
String.Format("{0} permission denied. Script permissions error.",
|
String.Format("{0} permission denied. Script permissions error.",
|
||||||
function));
|
function));
|
||||||
|
@ -1183,7 +1174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
CheckThreatLevel(ThreatLevel.High, "osSetStateEvents");
|
CheckThreatLevel(ThreatLevel.High, "osSetStateEvents");
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
m_host.SetScriptEvents(m_itemID, events);
|
m_host.SetScriptEvents(m_item.ItemID, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osSetRegionWaterHeight(double height)
|
public void osSetRegionWaterHeight(double height)
|
||||||
|
|
|
@ -109,6 +109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_Vector llGetAccel();
|
LSL_Vector llGetAccel();
|
||||||
LSL_Integer llGetAgentInfo(string id);
|
LSL_Integer llGetAgentInfo(string id);
|
||||||
LSL_String llGetAgentLanguage(string id);
|
LSL_String llGetAgentLanguage(string id);
|
||||||
|
LSL_List llGetAgentList(LSL_Integer scope, LSL_List options);
|
||||||
LSL_Vector llGetAgentSize(string id);
|
LSL_Vector llGetAgentSize(string id);
|
||||||
LSL_Float llGetAlpha(int face);
|
LSL_Float llGetAlpha(int face);
|
||||||
LSL_Float llGetAndResetTime();
|
LSL_Float llGetAndResetTime();
|
||||||
|
|
|
@ -501,6 +501,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int OBJECT_STREAMING_COST = 15;
|
public const int OBJECT_STREAMING_COST = 15;
|
||||||
public const int OBJECT_PHYSICS_COST = 16;
|
public const int OBJECT_PHYSICS_COST = 16;
|
||||||
|
|
||||||
|
// for llGetAgentList
|
||||||
|
public const int AGENT_LIST_PARCEL = 1;
|
||||||
|
public const int AGENT_LIST_PARCEL_OWNER = 2;
|
||||||
|
public const int AGENT_LIST_REGION = 4;
|
||||||
|
|
||||||
// Can not be public const?
|
// Can not be public const?
|
||||||
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
|
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
|
||||||
public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0);
|
public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
|
@ -389,6 +389,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_LSL_Functions.llGetAgentLanguage(id);
|
return m_LSL_Functions.llGetAgentLanguage(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
|
||||||
|
{
|
||||||
|
return m_LSL_Functions.llGetAgentList(scope, options);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_Vector llGetAgentSize(string id)
|
public LSL_Vector llGetAgentSize(string id)
|
||||||
{
|
{
|
||||||
return m_LSL_Functions.llGetAgentSize(id);
|
return m_LSL_Functions.llGetAgentSize(id);
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
foreach (string api in am.GetApis())
|
foreach (string api in am.GetApis())
|
||||||
{
|
{
|
||||||
m_Apis[api] = am.CreateApi(api);
|
m_Apis[api] = am.CreateApi(api);
|
||||||
m_Apis[api].Initialize(engine, part, LocalID, itemID);
|
m_Apis[api].Initialize(engine, part, ScriptTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
|
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
|
||||||
|
|
||||||
LSL_Api api = new LSL_Api();
|
LSL_Api api = new LSL_Api();
|
||||||
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
|
api.Initialize(m_engine, so1.RootPart, null);
|
||||||
|
|
||||||
// Create a second object
|
// Create a second object
|
||||||
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
|
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
|
||||||
|
@ -124,7 +124,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||||
m_scene.AddSceneObject(so1);
|
m_scene.AddSceneObject(so1);
|
||||||
LSL_Api api = new LSL_Api();
|
LSL_Api api = new LSL_Api();
|
||||||
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
|
api.Initialize(m_engine, so1.RootPart, null);
|
||||||
|
|
||||||
// Create an object embedded inside the first
|
// Create an object embedded inside the first
|
||||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||||
|
@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
|
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
|
||||||
m_scene.AddSceneObject(so2);
|
m_scene.AddSceneObject(so2);
|
||||||
LSL_Api api2 = new LSL_Api();
|
LSL_Api api2 = new LSL_Api();
|
||||||
api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);
|
api2.Initialize(m_engine, so2.RootPart, null);
|
||||||
|
|
||||||
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
|
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
|
||||||
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
|
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
/*
|
||||||
|
* 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.AvatarFactory;
|
||||||
|
using OpenSim.Region.OptionalModules.World.NPC;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tests for linking functions in LSL
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This relates to LSL. Actual linking functionality should be tested in the main
|
||||||
|
/// OpenSim.Region.Framework.Scenes.Tests.SceneObjectLinkingTests.
|
||||||
|
/// </remarks>
|
||||||
|
[TestFixture]
|
||||||
|
public class LSL_ApiLinkingTests
|
||||||
|
{
|
||||||
|
protected Scene m_scene;
|
||||||
|
protected XEngine.XEngine m_engine;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
IConfigSource initConfigSource = new IniConfigSource();
|
||||||
|
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||||
|
config.Set("Enabled", "true");
|
||||||
|
|
||||||
|
m_scene = new SceneHelpers().SetupScene();
|
||||||
|
SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
|
||||||
|
|
||||||
|
m_engine = new XEngine.XEngine();
|
||||||
|
m_engine.Initialise(initConfigSource);
|
||||||
|
m_engine.AddRegion(m_scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestllCreateLink()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
UUID ownerId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
|
SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10);
|
||||||
|
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
||||||
|
m_scene.AddSceneObject(grp1);
|
||||||
|
|
||||||
|
// FIXME: This should really be a script item (with accompanying script)
|
||||||
|
TaskInventoryItem grp1Item
|
||||||
|
= TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart);
|
||||||
|
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||||
|
|
||||||
|
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
|
||||||
|
grp2.AbsolutePosition = new Vector3(20, 20, 20);
|
||||||
|
|
||||||
|
// <180,0,0>
|
||||||
|
grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
|
||||||
|
|
||||||
|
m_scene.AddSceneObject(grp2);
|
||||||
|
|
||||||
|
LSL_Api apiGrp1 = new LSL_Api();
|
||||||
|
apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
|
||||||
|
|
||||||
|
apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE);
|
||||||
|
|
||||||
|
Assert.That(grp1.Parts.Length, Is.EqualTo(4));
|
||||||
|
Assert.That(grp2.IsDeleted, Is.True);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestllBreakLink()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
UUID ownerId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
|
SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10);
|
||||||
|
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
||||||
|
m_scene.AddSceneObject(grp1);
|
||||||
|
|
||||||
|
// FIXME: This should really be a script item (with accompanying script)
|
||||||
|
TaskInventoryItem grp1Item
|
||||||
|
= TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart);
|
||||||
|
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||||
|
|
||||||
|
LSL_Api apiGrp1 = new LSL_Api();
|
||||||
|
apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
|
||||||
|
|
||||||
|
apiGrp1.llBreakLink(2);
|
||||||
|
|
||||||
|
Assert.That(grp1.Parts.Length, Is.EqualTo(1));
|
||||||
|
|
||||||
|
SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1");
|
||||||
|
Assert.That(grp2, Is.Not.Null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -66,8 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
engine.AddRegion(scene);
|
engine.AddRegion(scene);
|
||||||
|
|
||||||
m_lslApi = new LSL_Api();
|
m_lslApi = new LSL_Api();
|
||||||
m_lslApi.Initialize(engine, part, part.LocalId, part.UUID);
|
m_lslApi.Initialize(engine, part, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
m_scene.AddSceneObject(so);
|
m_scene.AddSceneObject(so);
|
||||||
|
|
||||||
OSSL_Api osslApi = new OSSL_Api();
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
|
osslApi.Initialize(m_engine, part, null);
|
||||||
|
|
||||||
string notecardName = "appearanceNc";
|
string notecardName = "appearanceNc";
|
||||||
osslApi.osOwnerSaveAppearance(notecardName);
|
osslApi.osOwnerSaveAppearance(notecardName);
|
||||||
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
m_scene.AddSceneObject(so);
|
m_scene.AddSceneObject(so);
|
||||||
|
|
||||||
OSSL_Api osslApi = new OSSL_Api();
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
|
osslApi.Initialize(m_engine, part, null);
|
||||||
|
|
||||||
string notecardName = "appearanceNc";
|
string notecardName = "appearanceNc";
|
||||||
osslApi.osOwnerSaveAppearance(notecardName);
|
osslApi.osOwnerSaveAppearance(notecardName);
|
||||||
|
@ -161,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
m_scene.AddSceneObject(so);
|
m_scene.AddSceneObject(so);
|
||||||
|
|
||||||
OSSL_Api osslApi = new OSSL_Api();
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
|
osslApi.Initialize(m_engine, part, null);
|
||||||
|
|
||||||
string notecardName = "appearanceNc";
|
string notecardName = "appearanceNc";
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
m_scene.AddSceneObject(so);
|
m_scene.AddSceneObject(so);
|
||||||
|
|
||||||
OSSL_Api osslApi = new OSSL_Api();
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
|
osslApi.Initialize(m_engine, part, null);
|
||||||
|
|
||||||
string notecardName = "appearanceNc";
|
string notecardName = "appearanceNc";
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
m_scene.AddSceneObject(otherSo);
|
m_scene.AddSceneObject(otherSo);
|
||||||
|
|
||||||
OSSL_Api osslApi = new OSSL_Api();
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
|
osslApi.Initialize(m_engine, part, null);
|
||||||
|
|
||||||
OSSL_Api otherOsslApi = new OSSL_Api();
|
OSSL_Api otherOsslApi = new OSSL_Api();
|
||||||
otherOsslApi.Initialize(m_engine, otherPart, otherPart.LocalId, otherPart.UUID);
|
otherOsslApi.Initialize(m_engine, otherPart, null);
|
||||||
|
|
||||||
string notecardName = "appearanceNc";
|
string notecardName = "appearanceNc";
|
||||||
osslApi.osOwnerSaveAppearance(notecardName);
|
osslApi.osOwnerSaveAppearance(notecardName);
|
||||||
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
m_scene.AddSceneObject(so);
|
m_scene.AddSceneObject(so);
|
||||||
|
|
||||||
OSSL_Api osslApi = new OSSL_Api();
|
OSSL_Api osslApi = new OSSL_Api();
|
||||||
osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
|
osslApi.Initialize(m_engine, part, null);
|
||||||
|
|
||||||
string notecardName = "appearanceNc";
|
string notecardName = "appearanceNc";
|
||||||
osslApi.osOwnerSaveAppearance(notecardName);
|
osslApi.osOwnerSaveAppearance(notecardName);
|
||||||
|
|
Loading…
Reference in New Issue