Merge branch 'master' of /home/opensim/var/repo/opensim

integration
BlueWall 2012-05-26 11:28:28 -04:00
commit 192db34c41
6 changed files with 118 additions and 91 deletions

View File

@ -146,6 +146,7 @@ what it is today.
* Stefan_Boom / stoehr * Stefan_Boom / stoehr
* Strawberry Fride * Strawberry Fride
* Talun * Talun
* TechplexEngineer (Blake Bourque)
* TBG Renfold * TBG Renfold
* tglion * tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)

View File

@ -163,6 +163,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// </returns> /// </returns>
List<TaskInventoryItem> GetInventoryItems(); List<TaskInventoryItem> GetInventoryItems();
/// <summary>
/// Gets an inventory item by name
/// </summary>
/// <remarks>
/// This method returns the first inventory item that matches the given name. In SL this is all you need
/// since each item in a prim inventory must have a unique name.
/// </remarks>
/// <param name='name'></param>
/// <returns>
/// The inventory item. Null if no such item was found.
/// </returns>
TaskInventoryItem GetInventoryItem(string name);
/// <summary> /// <summary>
/// Get inventory items by name. /// Get inventory items by name.
/// </summary> /// </summary>

View File

@ -1032,13 +1032,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
m_log.Error("[REGION]: Closing");
Close();
if (PhysicsScene != null) if (PhysicsScene != null)
{ {
PhysicsScene.Dispose(); PhysicsScene.Dispose();
} }
m_log.Error("[REGION]: Closing");
Close();
m_log.Error("[REGION]: Firing Region Restart Message"); m_log.Error("[REGION]: Firing Region Restart Message");

View File

@ -582,14 +582,20 @@ namespace OpenSim.Region.Framework.Scenes
return item; return item;
} }
/// <summary> public TaskInventoryItem GetInventoryItem(string name)
/// Get inventory items by name. {
/// </summary> lock (m_items)
/// <param name="name"></param> {
/// <returns> foreach (TaskInventoryItem item in m_items.Values)
/// A list of inventory items with that name. {
/// If no inventory item has that name then an empty list is returned. if (item.Name == name)
/// </returns> return item;
}
}
return null;
}
public List<TaskInventoryItem> GetInventoryItems(string name) public List<TaskInventoryItem> GetInventoryItems(string name)
{ {
List<TaskInventoryItem> items = new List<TaskInventoryItem>(); List<TaskInventoryItem> items = new List<TaskInventoryItem>();

View File

@ -104,9 +104,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected int m_scriptConsoleChannel = 0; protected int m_scriptConsoleChannel = 0;
protected bool m_scriptConsoleChannelEnabled = false; protected bool m_scriptConsoleChannelEnabled = false;
protected IUrlModule m_UrlModule = null; protected IUrlModule m_UrlModule = null;
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
new Dictionary<UUID, UserInfoCacheEntry>(); protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
{ {
@ -285,44 +284,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventoryKey(string name, int type) protected UUID InventoryKey(string name, int type)
{ {
m_host.AddScriptLPS(1); TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
lock (m_host.TaskInventory) if (item != null && item.Type == type)
{ return item.AssetID;
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) else
{ return UUID.Zero;
if (inv.Value.Name == name)
{
if (inv.Value.Type != type)
return UUID.Zero;
return inv.Value.AssetID;
}
}
}
return UUID.Zero;
} }
protected UUID InventoryKey(string name)
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == name)
{
return inv.Value.AssetID;
}
}
}
return UUID.Zero;
}
/// <summary> /// <summary>
/// accepts a valid UUID, -or- a name of an inventory item. /// accepts a valid UUID, -or- a name of an inventory item.
/// Returns a valid UUID or UUID.Zero if key invalid and item not found /// Returns a valid UUID or UUID.Zero if key invalid and item not found
@ -332,19 +301,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns> /// <returns></returns>
protected UUID KeyOrName(string k) protected UUID KeyOrName(string k)
{ {
UUID key = UUID.Zero; UUID key;
// if we can parse the string as a key, use it. // if we can parse the string as a key, use it.
if (UUID.TryParse(k, out key))
{
return key;
}
// else try to locate the name in inventory of object. found returns key, // else try to locate the name in inventory of object. found returns key,
// not found returns UUID.Zero which will translate to the default particle texture // not found returns UUID.Zero
else if (!UUID.TryParse(k, out key))
{ {
return InventoryKey(k); TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
if (item != null)
key = item.AssetID;
else
key = UUID.Zero;
} }
return key;
} }
// convert a LSL_Rotation to a Quaternion // convert a LSL_Rotation to a Quaternion
@ -1724,14 +1696,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return rgb; return rgb;
} }
if (face >= 0 && face < GetNumberOfSides(part)) if (face >= 0 && face < GetNumberOfSides(part))
{ {
texcolor = tex.GetFace((uint)face).RGBA; texcolor = tex.GetFace((uint)face).RGBA;
rgb.x = texcolor.R; rgb.x = texcolor.R;
rgb.y = texcolor.G; rgb.y = texcolor.G;
rgb.z = texcolor.B; rgb.z = texcolor.B;
return rgb; return rgb;
} }
else else
{ {
@ -3315,17 +3288,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
{ {
UUID animID = new UUID();
if (!UUID.TryParse(anim, out animID))
{
animID = InventoryKey(anim);
}
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
if (presence != null) if (presence != null)
{ {
UUID animID = KeyOrName(anim);
if (animID == UUID.Zero) if (animID == UUID.Zero)
presence.Animator.RemoveAnimation(anim); presence.Animator.RemoveAnimation(anim);
else else
@ -3438,9 +3406,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
ScenePresence presence = World.GetScenePresence(agentID); ScenePresence presence = World.GetScenePresence(agentID);
if (presence != null) if (presence != null)
{ {
// If permissions are being requested from an NPC and were not implicitly granted above then
// auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null && npcModule.IsNPC(agentID, World))
{
if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID)
{
lock (m_host.TaskInventory)
{
m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
}
m_ScriptEngine.PostScriptEvent(
m_item.ItemID,
new EventParams(
"run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0]));
}
// it is an NPC, exit even if the permissions werent granted above, they are not going to answer
// the question!
return;
}
string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID);
if (ownerName == String.Empty) if (ownerName == String.Empty)
ownerName = "(hippos)"; ownerName = "(hippos)";
@ -3464,10 +3455,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
// Requested agent is not in range, refuse perms // Requested agent is not in range, refuse perms
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( m_ScriptEngine.PostScriptEvent(
"run_time_permissions", new Object[] { m_item.ItemID,
new LSL_Integer(0) }, new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0]));
new DetectParams[0]));
} }
void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer)
@ -3486,10 +3476,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.TaskInventory[m_item.ItemID].PermsMask = answer; m_host.TaskInventory[m_item.ItemID].PermsMask = answer;
} }
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( m_ScriptEngine.PostScriptEvent(
"run_time_permissions", new Object[] { m_item.ItemID,
new LSL_Integer(answer) }, new EventParams("run_time_permissions", new Object[] { new LSL_Integer(answer) }, new DetectParams[0]));
new DetectParams[0]));
} }
public LSL_String llGetPermissionsKey() public LSL_String llGetPermissionsKey()
@ -9130,7 +9119,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
GridRegion info; GridRegion info;
if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator?
info = new GridRegion(m_ScriptEngine.World.RegionInfo); info = new GridRegion(m_ScriptEngine.World.RegionInfo);
else else
info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
@ -9143,10 +9133,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(1000); ScriptSleep(1000);
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
reply = new LSL_Vector( if (m_ScriptEngine.World.RegionInfo.RegionName != simulator)
info.RegionLocX, {
info.RegionLocY, //Hypergrid Region co-ordinates
0).ToString(); uint rx = 0, ry = 0;
Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry);
reply = new LSL_Vector(
rx,
ry,
0).ToString();
}
else
{
//Local-cooridnates
reply = new LSL_Vector(
info.RegionLocX,
info.RegionLocY,
0).ToString();
}
break; break;
case ScriptBaseClass.DATA_SIM_STATUS: case ScriptBaseClass.DATA_SIM_STATUS:
if (info != null) if (info != null)

View File

@ -952,23 +952,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarID = (UUID)avatar; UUID avatarID = (UUID)avatar;
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common
// method (though see that doesn't do the is animation check, which is probably a bug) and have both
// these functions call that common code. However, this does mean navigating the brain-dead requirement
// of calling InitLSL()
if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence)
{ {
ScenePresence target = (ScenePresence)World.Entities[avatarID]; ScenePresence target = (ScenePresence)World.Entities[avatarID];
if (target != null) if (target != null)
{ {
UUID animID = UUID.Zero; UUID animID;
lock (m_host.TaskInventory)
if (!UUID.TryParse(animation, out animID))
{ {
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation);
{ if (item != null && item.Type == (int)AssetType.Animation)
if (inv.Value.Name == animation) animID = item.AssetID;
{ else
if (inv.Value.Type == (int)AssetType.Animation) animID = UUID.Zero;
animID = inv.Value.AssetID;
continue;
}
}
} }
if (animID == UUID.Zero) if (animID == UUID.Zero)