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
* Strawberry Fride
* Talun
* TechplexEngineer (Blake Bourque)
* TBG Renfold
* tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)

View File

@ -163,6 +163,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// </returns>
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>
/// Get inventory items by name.
/// </summary>

View File

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

View File

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

View File

@ -104,8 +104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected int m_scriptConsoleChannel = 0;
protected bool m_scriptConsoleChannelEnabled = false;
protected IUrlModule m_UrlModule = null;
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
new Dictionary<UUID, UserInfoCacheEntry>();
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
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)
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == name)
{
if (inv.Value.Type != type)
return UUID.Zero;
return inv.Value.AssetID;
}
}
}
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
if (item != null && item.Type == type)
return item.AssetID;
else
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>
/// 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
@ -332,19 +301,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
protected UUID KeyOrName(string k)
{
UUID key = UUID.Zero;
UUID key;
// 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,
// not found returns UUID.Zero which will translate to the default particle texture
else
// not found returns UUID.Zero
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
@ -1724,14 +1696,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return rgb;
}
if (face >= 0 && face < GetNumberOfSides(part))
{
texcolor = tex.GetFace((uint)face).RGBA;
rgb.x = texcolor.R;
rgb.y = texcolor.G;
rgb.z = texcolor.B;
return rgb;
return rgb;
}
else
{
@ -3315,17 +3288,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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);
if (presence != null)
{
UUID animID = KeyOrName(anim);
if (animID == UUID.Zero)
presence.Animator.RemoveAnimation(anim);
else
@ -3438,9 +3406,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
ScenePresence presence = World.GetScenePresence(agentID);
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);
if (ownerName == String.Empty)
ownerName = "(hippos)";
@ -3464,10 +3455,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// Requested agent is not in range, refuse perms
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
"run_time_permissions", new Object[] {
new LSL_Integer(0) },
new DetectParams[0]));
m_ScriptEngine.PostScriptEvent(
m_item.ItemID,
new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0]));
}
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_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
"run_time_permissions", new Object[] {
new LSL_Integer(answer) },
new DetectParams[0]));
m_ScriptEngine.PostScriptEvent(
m_item.ItemID,
new EventParams("run_time_permissions", new Object[] { new LSL_Integer(answer) }, new DetectParams[0]));
}
public LSL_String llGetPermissionsKey()
@ -9130,7 +9119,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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);
else
info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
@ -9143,10 +9133,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(1000);
return UUID.Zero.ToString();
}
if (m_ScriptEngine.World.RegionInfo.RegionName != simulator)
{
//Hypergrid Region co-ordinates
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;
case ScriptBaseClass.DATA_SIM_STATUS:
if (info != null)

View File

@ -952,23 +952,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarID = (UUID)avatar;
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)
{
ScenePresence target = (ScenePresence)World.Entities[avatarID];
if (target != null)
{
UUID animID = UUID.Zero;
lock (m_host.TaskInventory)
UUID animID;
if (!UUID.TryParse(animation, out animID))
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == animation)
{
if (inv.Value.Type == (int)AssetType.Animation)
animID = inv.Value.AssetID;
continue;
}
}
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation);
if (item != null && item.Type == (int)AssetType.Animation)
animID = item.AssetID;
else
animID = UUID.Zero;
}
if (animID == UUID.Zero)