* Consistently lock part.TaskInventory as pointed out in http://opensimulator.org/mantis/view.php?id=3159
* Not locking causes enumeration exceptions as described in this matis * part.TaskInventory needs to be locked for every access as it's a dictionary * Extra locking will hopefully not cause any major issues - in places where the enumeration of the dictionary performs other lock or long running operations, the dictionary is cloned insteadGenericGridServerConcept
parent
c28b2f799a
commit
01f70de2ea
|
@ -36,9 +36,9 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A dictionary for task inventory.
|
/// A dictionary for task inventory.
|
||||||
///
|
|
||||||
/// This class is not thread safe. Callers must synchronize on Dictionary methods.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
|
||||||
|
/// iterating over it.
|
||||||
public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
|
public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
|
||||||
ICloneable, IXmlSerializable
|
ICloneable, IXmlSerializable
|
||||||
{
|
{
|
||||||
|
|
|
@ -202,6 +202,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// Fix ownership/creator of inventory items
|
// Fix ownership/creator of inventory items
|
||||||
// Not doing so results in inventory items
|
// Not doing so results in inventory items
|
||||||
// being no copy/no mod for everyone
|
// being no copy/no mod for everyone
|
||||||
|
lock (part.TaskInventory)
|
||||||
|
{
|
||||||
TaskInventoryDictionary inv = part.TaskInventory;
|
TaskInventoryDictionary inv = part.TaskInventory;
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
|
||||||
{
|
{
|
||||||
|
@ -215,6 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
|
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
|
||||||
{
|
{
|
||||||
|
|
|
@ -226,11 +226,14 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
{
|
{
|
||||||
TaskInventoryDictionary tinv = sog.RootPart.TaskInventory;
|
TaskInventoryDictionary tinv = sog.RootPart.TaskInventory;
|
||||||
|
|
||||||
|
lock (tinv)
|
||||||
|
{
|
||||||
foreach (TaskInventoryItem titem in tinv.Values)
|
foreach (TaskInventoryItem titem in tinv.Values)
|
||||||
{
|
{
|
||||||
uuids.Add(titem.AssetID, (InventoryType)titem.Type == InventoryType.Texture);
|
uuids.Add(titem.AssetID, (InventoryType)titem.Type == InventoryType.Texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset)
|
private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1713,10 +1713,13 @@ if (m_shape != null) {
|
||||||
|
|
||||||
Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();
|
Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();
|
||||||
|
|
||||||
|
lock (TaskInventory)
|
||||||
|
{
|
||||||
foreach (UUID id in TaskInventory.Keys)
|
foreach (UUID id in TaskInventory.Keys)
|
||||||
{
|
{
|
||||||
TaskInventory_work.Add(id.Guid, TaskInventory[id]);
|
TaskInventory_work.Add(id.Guid, TaskInventory[id]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
info.AddValue("TaskInventory", TaskInventory_work);
|
info.AddValue("TaskInventory", TaskInventory_work);
|
||||||
|
|
||||||
|
@ -2166,8 +2169,10 @@ if (m_shape != null) {
|
||||||
{
|
{
|
||||||
//Trys to fetch sound id from prim's inventory.
|
//Trys to fetch sound id from prim's inventory.
|
||||||
//Prim's inventory doesn't support non script items yet
|
//Prim's inventory doesn't support non script items yet
|
||||||
SceneObjectPart op = this;
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory)
|
lock (TaskInventory)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
|
||||||
{
|
{
|
||||||
if (item.Value.Name == sound)
|
if (item.Value.Name == sound)
|
||||||
{
|
{
|
||||||
|
@ -2176,6 +2181,7 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
|
List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
|
||||||
foreach (ScenePresence p in avatarts)
|
foreach (ScenePresence p in avatarts)
|
||||||
|
@ -2486,8 +2492,9 @@ if (m_shape != null) {
|
||||||
if (!UUID.TryParse(sound, out soundID))
|
if (!UUID.TryParse(sound, out soundID))
|
||||||
{
|
{
|
||||||
// search sound file from inventory
|
// search sound file from inventory
|
||||||
SceneObjectPart op = this;
|
lock (TaskInventory)
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory)
|
{
|
||||||
|
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
|
||||||
{
|
{
|
||||||
if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
|
if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
|
||||||
{
|
{
|
||||||
|
@ -2496,6 +2503,7 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (soundID == UUID.Zero)
|
if (soundID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -141,8 +141,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part.Shape.SculptTexture != UUID.Zero)
|
if (part.Shape.SculptTexture != UUID.Zero)
|
||||||
assetUuids[part.Shape.SculptTexture] = 1;
|
assetUuids[part.Shape.SculptTexture] = 1;
|
||||||
|
|
||||||
|
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
|
||||||
|
|
||||||
// Now analyze this prim's inventory items to preserve all the uuids that they reference
|
// Now analyze this prim's inventory items to preserve all the uuids that they reference
|
||||||
foreach (TaskInventoryItem tii in part.TaskInventory.Values)
|
foreach (TaskInventoryItem tii in taskDictionary.Values)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type);
|
//m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type);
|
||||||
|
|
||||||
|
|
|
@ -250,6 +250,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
UUID invItemID = new UUID();
|
UUID invItemID = new UUID();
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
|
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
|
||||||
|
@ -258,6 +260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return invItemID;
|
return invItemID;
|
||||||
}
|
}
|
||||||
|
@ -265,6 +268,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
private UUID InventoryKey(string name, int type)
|
private UUID InventoryKey(string name, int type)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == name)
|
if (inv.Value.Name == name)
|
||||||
|
@ -275,12 +281,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return inv.Value.AssetID;
|
return inv.Value.AssetID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UUID InventoryKey(string name)
|
private UUID InventoryKey(string name)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == name)
|
if (inv.Value.Name == name)
|
||||||
|
@ -288,6 +299,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return inv.Value.AssetID;
|
return inv.Value.AssetID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2376,10 +2389,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
TaskInventoryItem item = m_host.TaskInventory[invItemID];
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
item = m_host.TaskInventory[invItemID];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.PermsGranter == UUID.Zero)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||||
{
|
{
|
||||||
LSLError("No permissions to give money");
|
LSLError("No permissions to give money");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2401,7 +2421,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
bool result
|
||||||
|
= money.ObjectGiveMoney(
|
||||||
|
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2448,7 +2470,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (dist > m_ScriptDistanceFactor * 10.0f)
|
if (dist > m_ScriptDistanceFactor * 10.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||||
|
|
||||||
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == inventory)
|
if (inv.Value.Name == inventory)
|
||||||
{
|
{
|
||||||
|
@ -2500,6 +2524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llSay(0, "Could not find object " + inventory);
|
llSay(0, "Could not find object " + inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2571,18 +2596,23 @@ 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)
|
||||||
{
|
{
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
TaskInventoryItem item;
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
|
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
item = m_host.TaskInventory[InventorySelf()];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_host.TaskInventory[InventorySelf()].PermsGranter != UUID.Zero)
|
if (item.PermsGranter != UUID.Zero)
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter);
|
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID);
|
presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID);
|
||||||
}
|
}
|
||||||
|
@ -2594,25 +2624,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void llReleaseControls()
|
public void llReleaseControls()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
TaskInventoryItem item;
|
||||||
|
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
|
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
item = m_host.TaskInventory[InventorySelf()];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_host.TaskInventory[InventorySelf()].PermsGranter != UUID.Zero)
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if (item.PermsGranter != UUID.Zero)
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter);
|
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
// Unregister controls from Presence
|
// Unregister controls from Presence
|
||||||
presence.UnRegisterControlEventsToScript(m_localID, m_itemID);
|
presence.UnRegisterControlEventsToScript(m_localID, m_itemID);
|
||||||
// Remove Take Control permission.
|
// Remove Take Control permission.
|
||||||
m_host.TaskInventory[InventorySelf()].PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
|
item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2842,12 +2877,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (invItemID == UUID.Zero)
|
if (invItemID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
TaskInventoryItem item;
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
item = m_host.TaskInventory[InventorySelf()];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.PermsGranter == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
|
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -2869,10 +2914,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (invItemID == UUID.Zero)
|
if (invItemID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
TaskInventoryItem item;
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
item = m_host.TaskInventory[InventorySelf()];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.PermsGranter == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
||||||
{
|
{
|
||||||
UUID animID = new UUID();
|
UUID animID = new UUID();
|
||||||
|
|
||||||
|
@ -2881,7 +2936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
animID=InventoryKey(anim);
|
animID=InventoryKey(anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
|
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -2939,12 +2994,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (invItemID == UUID.Zero)
|
if (invItemID == UUID.Zero)
|
||||||
return; // Not in a prim? How??
|
return; // Not in a prim? How??
|
||||||
|
|
||||||
|
TaskInventoryItem item;
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
item = m_host.TaskInventory[invItemID];
|
||||||
|
}
|
||||||
|
|
||||||
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
||||||
{
|
{
|
||||||
llReleaseControls();
|
llReleaseControls();
|
||||||
|
|
||||||
m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero;
|
item.PermsGranter = UUID.Zero;
|
||||||
m_host.TaskInventory[invItemID].PermsMask=0;
|
item.PermsMask = 0;
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
|
@ -2954,7 +3016,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_host.TaskInventory[invItemID].PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
||||||
llReleaseControls();
|
llReleaseControls();
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -2968,9 +3030,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
ScriptBaseClass.PERMISSION_ATTACH;
|
ScriptBaseClass.PERMISSION_ATTACH;
|
||||||
|
|
||||||
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
|
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
|
||||||
|
{
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[invItemID].PermsMask = perm;
|
m_host.TaskInventory[invItemID].PermsMask = perm;
|
||||||
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
|
@ -2989,9 +3054,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
|
ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
|
||||||
|
|
||||||
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
|
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
|
||||||
|
{
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[invItemID].PermsMask = perm;
|
m_host.TaskInventory[invItemID].PermsMask = perm;
|
||||||
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
|
@ -3011,14 +3079,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
ownerName = "(hippos)";
|
ownerName = "(hippos)";
|
||||||
|
|
||||||
if (!m_waitingForScriptAnswer)
|
if (!m_waitingForScriptAnswer)
|
||||||
|
{
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[invItemID].PermsMask = 0;
|
m_host.TaskInventory[invItemID].PermsMask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
|
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
|
||||||
m_waitingForScriptAnswer=true;
|
m_waitingForScriptAnswer=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
presence.ControllingClient.SendScriptQuestion(m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm);
|
presence.ControllingClient.SendScriptQuestion(
|
||||||
|
m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3045,7 +3119,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
||||||
llReleaseControls();
|
llReleaseControls();
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsMask = answer;
|
m_host.TaskInventory[invItemID].PermsMask = answer;
|
||||||
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
new LSL_Integer(answer) },
|
new LSL_Integer(answer) },
|
||||||
|
@ -3056,6 +3134,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 10 && item.ItemID == m_itemID)
|
if (item.Type == 10 && item.ItemID == m_itemID)
|
||||||
|
@ -3063,6 +3143,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return item.PermsGranter.ToString();
|
return item.PermsGranter.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
|
@ -3071,6 +3152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 10 && item.ItemID == m_itemID)
|
if (item.Type == 10 && item.ItemID == m_itemID)
|
||||||
|
@ -3081,6 +3164,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3111,7 +3195,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
UUID invItemID = InventorySelf();
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
|
||||||
|
TaskInventoryItem item;
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
item = m_host.TaskInventory[invItemID];
|
||||||
|
}
|
||||||
|
|
||||||
|
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!");
|
||||||
|
@ -3119,7 +3210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
IClientAPI client = null;
|
IClientAPI client = null;
|
||||||
ScenePresence sp = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
|
ScenePresence sp = World.GetScenePresence(item.PermsGranter);
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
client = sp.ControllingClient;
|
client = sp.ControllingClient;
|
||||||
|
|
||||||
|
@ -3162,18 +3253,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
UUID invItemID = InventorySelf();
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
if ((m_host.TaskInventory[invItemID].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!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (linknum < ScriptBaseClass.LINK_THIS)
|
if (linknum < ScriptBaseClass.LINK_THIS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SceneObjectGroup parentPrim = m_host.ParentGroup;
|
SceneObjectGroup parentPrim = m_host.ParentGroup;
|
||||||
|
|
||||||
if (parentPrim.RootPart.AttachmentPoint != 0)
|
if (parentPrim.RootPart.AttachmentPoint != 0)
|
||||||
return; // Fail silently if attached
|
return; // Fail silently if attached
|
||||||
SceneObjectPart childPrim = null;
|
SceneObjectPart childPrim = null;
|
||||||
|
|
||||||
switch (linknum)
|
switch (linknum)
|
||||||
{
|
{
|
||||||
case ScriptBaseClass.LINK_ROOT:
|
case ScriptBaseClass.LINK_ROOT:
|
||||||
|
@ -3236,8 +3335,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
SceneObjectGroup parentPrim = m_host.ParentGroup;
|
SceneObjectGroup parentPrim = m_host.ParentGroup;
|
||||||
if (parentPrim.RootPart.AttachmentPoint != 0)
|
if (parentPrim.RootPart.AttachmentPoint != 0)
|
||||||
return; // Fail silently if attached
|
return; // Fail silently if attached
|
||||||
|
|
||||||
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
|
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
|
||||||
parts.Remove(parentPrim.RootPart);
|
parts.Remove(parentPrim.RootPart);
|
||||||
|
|
||||||
foreach (SceneObjectPart part in parts)
|
foreach (SceneObjectPart part in parts)
|
||||||
{
|
{
|
||||||
parentPrim.DelinkFromGroup(part.LocalId, true);
|
parentPrim.DelinkFromGroup(part.LocalId, true);
|
||||||
|
@ -3330,6 +3431,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Type == type || type == -1)
|
if (inv.Value.Type == type || type == -1)
|
||||||
|
@ -3337,6 +3441,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
count = count + 1;
|
count = count + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3344,6 +3450,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
ArrayList keys = new ArrayList();
|
ArrayList keys = new ArrayList();
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Type == type || type == -1)
|
if (inv.Value.Type == type || type == -1)
|
||||||
|
@ -3351,6 +3460,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
keys.Add(inv.Value.Name);
|
keys.Add(inv.Value.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (keys.Count == 0)
|
if (keys.Count == 0)
|
||||||
{
|
{
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
@ -3386,6 +3497,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the first object found with this inventory name
|
// move the first object found with this inventory name
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == inventory)
|
if (inv.Value.Name == inventory)
|
||||||
|
@ -3397,6 +3510,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
@ -3443,6 +3557,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llRemoveInventory(string name)
|
public void llRemoveInventory(string name)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
if (item.Name == name)
|
if (item.Name == name)
|
||||||
|
@ -3452,6 +3569,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void llSetText(string text, LSL_Vector color, double alpha)
|
public void llSetText(string text, LSL_Vector color, double alpha)
|
||||||
{
|
{
|
||||||
|
@ -3536,7 +3654,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in itemDictionary.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 3 && item.Name == name)
|
if (item.Type == 3 && item.Name == name)
|
||||||
{
|
{
|
||||||
|
@ -3622,6 +3742,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// TODO: Parameter check logic required.
|
// TODO: Parameter check logic required.
|
||||||
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)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
|
@ -3632,6 +3754,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_host.CollisionSound = soundId;
|
m_host.CollisionSound = soundId;
|
||||||
m_host.CollisionSoundVolume = (float)impact_volume;
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
}
|
}
|
||||||
|
@ -3675,7 +3798,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID partItemID;
|
UUID partItemID;
|
||||||
foreach (SceneObjectPart part in parts)
|
foreach (SceneObjectPart part in parts)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in part.TaskInventory.Values)
|
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in itemsDictionary.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT)
|
if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT)
|
||||||
{
|
{
|
||||||
|
@ -3684,7 +3809,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (m_host.ParentGroup.Children.Count == 1)
|
if (m_host.ParentGroup.Children.Count == 1)
|
||||||
linkNumber = 0;
|
linkNumber = 0;
|
||||||
|
|
||||||
|
|
||||||
object[] resobj = new object[]
|
object[] resobj = new object[]
|
||||||
{
|
{
|
||||||
new LSL_Integer(linkNumber), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
|
new LSL_Integer(linkNumber), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
|
||||||
|
@ -3875,11 +3999,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public LSL_String llGetScriptName()
|
public LSL_String llGetScriptName()
|
||||||
{
|
{
|
||||||
|
|
||||||
string result = String.Empty;
|
string result = String.Empty;
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 10 && item.ItemID == m_itemID)
|
if (item.Type == 10 && item.ItemID == m_itemID)
|
||||||
|
@ -3888,9 +4013,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function to understand which shape it is (taken from meshmerizer)
|
// this function to understand which shape it is (taken from meshmerizer)
|
||||||
|
@ -4142,6 +4267,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_String llGetInventoryKey(string name)
|
public LSL_String llGetInventoryKey(string name)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == name)
|
if (inv.Value.Name == name)
|
||||||
|
@ -4156,6 +4284,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5539,12 +5669,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
private UUID GetTaskInventoryItem(string name)
|
private UUID GetTaskInventoryItem(string name)
|
||||||
|
{
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == name)
|
if (inv.Value.Name == name)
|
||||||
return inv.Key;
|
return inv.Key;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5853,6 +5987,8 @@ 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)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == name)
|
if (inv.Value.Name == name)
|
||||||
|
@ -5866,6 +6002,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
@ -7614,6 +7751,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llGetInventoryPermMask(string item, int mask)
|
public LSL_Integer llGetInventoryPermMask(string item, int mask)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == item)
|
if (inv.Value.Name == item)
|
||||||
|
@ -7633,6 +7773,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7645,6 +7787,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_String llGetInventoryCreator(string item)
|
public LSL_String llGetInventoryCreator(string item)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == item)
|
if (inv.Value.Name == item)
|
||||||
|
@ -7652,7 +7797,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return inv.Value.CreatorID.ToString();
|
return inv.Value.CreatorID.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
llSay(0, "No item name '" + item + "'");
|
llSay(0, "No item name '" + item + "'");
|
||||||
|
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8143,6 +8291,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llGetInventoryType(string name)
|
public LSL_Integer llGetInventoryType(string name)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == name)
|
if (inv.Value.Name == name)
|
||||||
|
@ -8150,6 +8301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return inv.Value.Type;
|
return inv.Value.Type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8175,15 +8328,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
UUID invItemID = InventorySelf();
|
||||||
|
|
||||||
if (invItemID == UUID.Zero)
|
if (invItemID == UUID.Zero)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
if ((m_host.TaskInventory[invItemID].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();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -8199,18 +8359,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID invItemID = InventorySelf();
|
UUID invItemID = InventorySelf();
|
||||||
if (invItemID == UUID.Zero)
|
if (invItemID == UUID.Zero)
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
|
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
if ((m_host.TaskInventory[invItemID].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();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W);
|
return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8352,10 +8519,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID objectID = m_host.ParentUUID;
|
UUID objectID = m_host.ParentUUID;
|
||||||
if (objectID == UUID.Zero) return;
|
if (objectID == UUID.Zero) return;
|
||||||
|
|
||||||
|
UUID agentID;
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
// 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 = m_host.TaskInventory[invItemID].PermsGranter;
|
agentID = m_host.TaskInventory[invItemID].PermsGranter;
|
||||||
|
|
||||||
if (agentID == UUID.Zero) return;
|
if (agentID == UUID.Zero) return;
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
|
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
|
||||||
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(agentID);
|
ScenePresence presence = World.GetScenePresence(agentID);
|
||||||
|
|
||||||
|
@ -8404,9 +8576,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (objectID == UUID.Zero) return;
|
if (objectID == UUID.Zero) return;
|
||||||
|
|
||||||
// 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 = m_host.TaskInventory[invItemID].PermsGranter;
|
UUID agentID;
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
agentID = m_host.TaskInventory[invItemID].PermsGranter;
|
||||||
if (agentID == UUID.Zero) return;
|
if (agentID == UUID.Zero) return;
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
|
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
|
||||||
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(agentID);
|
ScenePresence presence = World.GetScenePresence(agentID);
|
||||||
|
|
||||||
|
@ -8816,14 +8992,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal UUID ScriptByName(string name)
|
internal UUID ScriptByName(string name)
|
||||||
|
{
|
||||||
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 10 && item.Name == name)
|
if (item.Type == 10 && item.Name == name)
|
||||||
return item.ItemID;
|
return item.ItemID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8858,7 +9037,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in itemsDictionary.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 7 && item.Name == name)
|
if (item.Type == 7 && item.Name == name)
|
||||||
{
|
{
|
||||||
|
@ -8900,7 +9081,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in itemsDictionary.Values)
|
||||||
{
|
{
|
||||||
if (item.Type == 7 && item.Name == name)
|
if (item.Type == 7 && item.Name == name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -231,10 +231,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_stateSource = stateSource;
|
m_stateSource = stateSource;
|
||||||
m_postOnRez = postOnRez;
|
m_postOnRez = postOnRez;
|
||||||
|
|
||||||
if (part != null && part.TaskInventory.ContainsKey(m_ItemID))
|
if (part != null)
|
||||||
|
{
|
||||||
|
lock (part.TaskInventory)
|
||||||
|
{
|
||||||
|
if (part.TaskInventory.ContainsKey(m_ItemID))
|
||||||
{
|
{
|
||||||
m_thisScriptTask = part.TaskInventory[m_ItemID];
|
m_thisScriptTask = part.TaskInventory[m_ItemID];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ApiManager am = new ApiManager();
|
ApiManager am = new ApiManager();
|
||||||
|
|
||||||
|
@ -400,14 +406,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
private void ReleaseControls()
|
private void ReleaseControls()
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(m_LocalID);
|
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||||
if (part != null && part.TaskInventory.ContainsKey(m_ItemID))
|
|
||||||
|
if (part != null)
|
||||||
{
|
{
|
||||||
UUID permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
|
int permsMask;
|
||||||
int permsMask = part.TaskInventory[m_ItemID].PermsMask;
|
UUID permsGranter;
|
||||||
|
lock (part.TaskInventory)
|
||||||
|
{
|
||||||
|
if (!part.TaskInventory.ContainsKey(m_ItemID))
|
||||||
|
return;
|
||||||
|
|
||||||
|
permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
|
||||||
|
permsMask = part.TaskInventory[m_ItemID].PermsMask;
|
||||||
|
}
|
||||||
|
|
||||||
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter);
|
ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter);
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID);
|
presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID);
|
||||||
|
|
Loading…
Reference in New Issue