From 60065f06b3fd6f680202405e117402b22d62f902 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 23 Apr 2012 22:23:47 +0100
Subject: refactor: Replace calls to InventorySelf() with existing m_itemID in
LSL_Api
There's no point look up an item ID that we already have.
---
.../Shared/Api/Implementation/LSL_Api.cs | 136 +++++++--------------
1 file changed, 42 insertions(+), 94 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 36c9d5e..6000293 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -85,7 +85,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected IScriptEngine m_ScriptEngine;
protected SceneObjectPart m_host;
protected uint m_localID;
+
+ ///
+ /// The UUID of the item that hosts this script
+ ///
protected UUID m_itemID;
+
protected bool throwErrorOnNotImplemented = true;
protected AsyncCommandManager AsyncCommands = null;
protected float m_ScriptDelayFactor = 1.0f;
@@ -267,25 +272,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
- protected UUID InventorySelf()
- {
- UUID invItemID = new UUID();
-
- lock (m_host.TaskInventory)
- {
- foreach (KeyValuePair inv in m_host.TaskInventory)
- {
- if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
- {
- invItemID = inv.Key;
- break;
- }
- }
- }
-
- return invItemID;
- }
-
protected UUID InventoryKey(string name, int type)
{
m_host.AddScriptLPS(1);
@@ -2697,17 +2683,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGiveMoney(string destination, int amount)
{
- UUID invItemID=InventorySelf();
- if (invItemID == UUID.Zero)
- return 0;
-
m_host.AddScriptLPS(1);
- TaskInventoryItem item = m_host.TaskInventory[invItemID];
+ TaskInventoryItem item;
lock (m_host.TaskInventory)
{
- item = m_host.TaskInventory[invItemID];
+ item = m_host.TaskInventory[m_itemID];
}
if (item.PermsGranter == UUID.Zero)
@@ -2955,10 +2937,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
lock (m_host.TaskInventory)
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ if (!m_host.TaskInventory.ContainsKey(m_itemID))
return;
else
- item = m_host.TaskInventory[InventorySelf()];
+ item = m_host.TaskInventory[m_itemID];
}
if (item.PermsGranter != UUID.Zero)
@@ -2983,10 +2965,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
lock (m_host.TaskInventory)
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ if (!m_host.TaskInventory.ContainsKey(m_itemID))
return;
else
- item = m_host.TaskInventory[InventorySelf()];
+ item = m_host.TaskInventory[m_itemID];
}
m_host.AddScriptLPS(1);
@@ -3026,10 +3008,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
lock (m_host.TaskInventory)
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ if (!m_host.TaskInventory.ContainsKey(m_itemID))
return;
else
- item = m_host.TaskInventory[InventorySelf()];
+ item = m_host.TaskInventory[m_itemID];
}
if (item.PermsGranter != m_host.OwnerID)
@@ -3058,10 +3040,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
lock (m_host.TaskInventory)
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ if (!m_host.TaskInventory.ContainsKey(m_itemID))
return;
else
- item = m_host.TaskInventory[InventorySelf()];
+ item = m_host.TaskInventory[m_itemID];
}
if (item.PermsGranter != m_host.OwnerID)
@@ -3313,18 +3295,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- UUID invItemID = InventorySelf();
- if (invItemID == UUID.Zero)
- return;
-
TaskInventoryItem item;
lock (m_host.TaskInventory)
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ if (!m_host.TaskInventory.ContainsKey(m_itemID))
return;
else
- item = m_host.TaskInventory[InventorySelf()];
+ item = m_host.TaskInventory[m_itemID];
}
if (item.PermsGranter == UUID.Zero)
@@ -3350,18 +3328,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- UUID invItemID=InventorySelf();
- if (invItemID == UUID.Zero)
- return;
-
TaskInventoryItem item;
lock (m_host.TaskInventory)
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ if (!m_host.TaskInventory.ContainsKey(m_itemID))
return;
else
- item = m_host.TaskInventory[InventorySelf()];
+ item = m_host.TaskInventory[m_itemID];
}
if (item.PermsGranter == UUID.Zero)
@@ -3417,21 +3391,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRequestPermissions(string agent, int perm)
{
- UUID agentID = new UUID();
+ UUID agentID;
if (!UUID.TryParse(agent, out agentID))
return;
- UUID invItemID = InventorySelf();
-
- if (invItemID == UUID.Zero)
- return; // Not in a prim? How??
-
TaskInventoryItem item;
lock (m_host.TaskInventory)
{
- item = m_host.TaskInventory[invItemID];
+ item = m_host.TaskInventory[m_itemID];
}
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
@@ -3466,8 +3435,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
lock (m_host.TaskInventory)
{
- m_host.TaskInventory[invItemID].PermsGranter = agentID;
- m_host.TaskInventory[invItemID].PermsMask = perm;
+ m_host.TaskInventory[m_itemID].PermsGranter = agentID;
+ m_host.TaskInventory[m_itemID].PermsMask = perm;
}
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
@@ -3490,8 +3459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
lock (m_host.TaskInventory)
{
- m_host.TaskInventory[invItemID].PermsGranter = agentID;
- m_host.TaskInventory[invItemID].PermsMask = perm;
+ m_host.TaskInventory[m_itemID].PermsGranter = agentID;
+ m_host.TaskInventory[m_itemID].PermsMask = perm;
}
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
@@ -3515,8 +3484,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
lock (m_host.TaskInventory)
{
- m_host.TaskInventory[invItemID].PermsGranter = agentID;
- m_host.TaskInventory[invItemID].PermsMask = 0;
+ m_host.TaskInventory[m_itemID].PermsGranter = agentID;
+ m_host.TaskInventory[m_itemID].PermsMask = 0;
}
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
@@ -3524,7 +3493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
presence.ControllingClient.SendScriptQuestion(
- m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm);
+ m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm);
return;
}
@@ -3541,20 +3510,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (taskID != m_host.UUID)
return;
- UUID invItemID = InventorySelf();
-
- if (invItemID == UUID.Zero)
- return;
-
- client.OnScriptAnswer-=handleScriptAnswer;
- m_waitingForScriptAnswer=false;
+ client.OnScriptAnswer -= handleScriptAnswer;
+ m_waitingForScriptAnswer = false;
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
llReleaseControls();
lock (m_host.TaskInventory)
{
- m_host.TaskInventory[invItemID].PermsMask = answer;
+ m_host.TaskInventory[m_itemID].PermsMask = answer;
}
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
@@ -3627,7 +3591,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCreateLink(string target, int parent)
{
m_host.AddScriptLPS(1);
- UUID invItemID = InventorySelf();
+
UUID targetID;
if (!UUID.TryParse(target, out targetID))
@@ -3636,7 +3600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
lock (m_host.TaskInventory)
{
- item = m_host.TaskInventory[invItemID];
+ item = m_host.TaskInventory[m_itemID];
}
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
@@ -3688,11 +3652,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llBreakLink(int linknum)
{
m_host.AddScriptLPS(1);
- UUID invItemID = InventorySelf();
lock (m_host.TaskInventory)
{
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
+ if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
@@ -9691,17 +9654,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetCameraPos()
{
m_host.AddScriptLPS(1);
- UUID invItemID = InventorySelf();
-
- if (invItemID == UUID.Zero)
- return new LSL_Vector();
lock (m_host.TaskInventory)
{
- if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
+ if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero)
return new LSL_Vector();
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
+ if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
{
ShoutError("No permissions to track the camera");
return new LSL_Vector();
@@ -9720,16 +9679,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Rotation llGetCameraRot()
{
m_host.AddScriptLPS(1);
- UUID invItemID = InventorySelf();
- if (invItemID == UUID.Zero)
- return new LSL_Rotation();
lock (m_host.TaskInventory)
{
- if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
+ if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero)
return new LSL_Rotation();
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
+ if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
{
ShoutError("No permissions to track the camera");
return new LSL_Rotation();
@@ -9907,10 +9863,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- // our key in the object we are in
- UUID invItemID = InventorySelf();
- if (invItemID == UUID.Zero) return;
-
// the object we are in
UUID objectID = m_host.ParentUUID;
if (objectID == UUID.Zero) return;
@@ -9919,10 +9871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
lock (m_host.TaskInventory)
{
// we need the permission first, to know which avatar we want to set the camera for
- agentID = m_host.TaskInventory[invItemID].PermsGranter;
+ agentID = m_host.TaskInventory[m_itemID].PermsGranter;
if (agentID == UUID.Zero) return;
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
+ if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
}
ScenePresence presence = World.GetScenePresence(agentID);
@@ -9963,10 +9915,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- // our key in the object we are in
- UUID invItemID=InventorySelf();
- if (invItemID == UUID.Zero) return;
-
// the object we are in
UUID objectID = m_host.ParentUUID;
if (objectID == UUID.Zero) return;
@@ -9975,9 +9923,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID agentID;
lock (m_host.TaskInventory)
{
- agentID = m_host.TaskInventory[invItemID].PermsGranter;
+ agentID = m_host.TaskInventory[m_itemID].PermsGranter;
if (agentID == UUID.Zero) return;
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
+ if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
}
ScenePresence presence = World.GetScenePresence(agentID);
--
cgit v1.1
From 1f8d1bcdcf7ae48ad0b3609e532ad87859f6300b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 23 Apr 2012 22:52:46 +0100
Subject: Replace common code to fetch self inventory item (as opposed to uuid)
with GetSelfInventoryItem()
However, at some point it would be far more convenient to receive the TaskInventoryItem in the constructor rather than just the item UUID, so we don't have to constantly refetch our self item.
---
.../Shared/Api/Implementation/LSL_Api.cs | 231 +++++++--------------
1 file changed, 76 insertions(+), 155 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6000293..a353b25 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -272,6 +272,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ ///
+ /// Get the inventory item that hosts ourselves.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ protected TaskInventoryItem GetSelfInventoryItem()
+ {
+ lock (m_host.TaskInventory)
+ return m_host.TaskInventory[m_itemID];
+ }
+
protected UUID InventoryKey(string name, int type)
{
m_host.AddScriptLPS(1);
@@ -2685,12 +2699,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (item.PermsGranter == UUID.Zero)
return 0;
@@ -2933,15 +2942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llTakeControls(int controls, int accept, int pass_on)
{
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- if (!m_host.TaskInventory.ContainsKey(m_itemID))
- return;
- else
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (item.PermsGranter != UUID.Zero)
{
@@ -2961,18 +2962,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llReleaseControls()
{
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- if (!m_host.TaskInventory.ContainsKey(m_itemID))
- return;
- else
- item = m_host.TaskInventory[m_itemID];
- }
-
m_host.AddScriptLPS(1);
+ TaskInventoryItem item = GetSelfInventoryItem();
+
if (item.PermsGranter != UUID.Zero)
{
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
@@ -3004,15 +2997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
// return;
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- if (!m_host.TaskInventory.ContainsKey(m_itemID))
- return;
- else
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (item.PermsGranter != m_host.OwnerID)
return;
@@ -3036,15 +3021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentGroup.AttachmentPoint == 0)
return;
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- if (!m_host.TaskInventory.ContainsKey(m_itemID))
- return;
- else
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (item.PermsGranter != m_host.OwnerID)
return;
@@ -3295,15 +3272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- if (!m_host.TaskInventory.ContainsKey(m_itemID))
- return;
- else
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (item.PermsGranter == UUID.Zero)
return;
@@ -3328,15 +3297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- if (!m_host.TaskInventory.ContainsKey(m_itemID))
- return;
- else
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (item.PermsGranter == UUID.Zero)
return;
@@ -3396,12 +3357,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(agent, out agentID))
return;
- TaskInventoryItem item;
-
- lock (m_host.TaskInventory)
- {
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
{
@@ -3531,39 +3487,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
- {
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
- {
- if (item.Type == 10 && item.ItemID == m_itemID)
- {
- return item.PermsGranter.ToString();
- }
- }
- }
-
- return UUID.Zero.ToString();
+ return GetSelfInventoryItem().PermsGranter.ToString();
}
public LSL_Integer llGetPermissions()
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
- {
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
- {
- if (item.Type == 10 && item.ItemID == m_itemID)
- {
- int perms = item.PermsMask;
- if (m_automaticLinkPermission)
- perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
- return perms;
- }
- }
- }
+ int perms = GetSelfInventoryItem().PermsMask;
- return 0;
+ if (m_automaticLinkPermission)
+ perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
+
+ return perms;
}
public LSL_Integer llGetLinkNumber()
@@ -3597,11 +3533,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(target, out targetID))
return;
- TaskInventoryItem item;
- lock (m_host.TaskInventory)
- {
- item = m_host.TaskInventory[m_itemID];
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
@@ -3653,14 +3585,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
+ && !m_automaticLinkPermission)
{
- if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
- && !m_automaticLinkPermission)
- {
- ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
- return;
- }
+ ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
+ return;
}
if (linknum < ScriptBaseClass.LINK_THIS)
@@ -4537,23 +4466,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetScriptName()
{
- string result = String.Empty;
-
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
- {
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
- {
- if (item.Type == 10 && item.ItemID == m_itemID)
- {
- result = item.Name != null ? item.Name : String.Empty;
- break;
- }
- }
- }
+ TaskInventoryItem item = GetSelfInventoryItem();
- return result;
+ return item.Name != null ? item.Name : String.Empty;
}
public LSL_Integer llGetLinkNumberOfSides(int link)
@@ -9655,16 +9572,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
- {
- if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero)
- return new LSL_Vector();
+ TaskInventoryItem item = GetSelfInventoryItem();
- if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
- {
- ShoutError("No permissions to track the camera");
- return new LSL_Vector();
- }
+ if (item.PermsGranter == UUID.Zero)
+ return new LSL_Vector();
+
+ if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
+ {
+ ShoutError("No permissions to track the camera");
+ return new LSL_Vector();
}
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
@@ -9680,16 +9596,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
- {
- if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero)
- return new LSL_Rotation();
+ TaskInventoryItem item = GetSelfInventoryItem();
- if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
- {
- ShoutError("No permissions to track the camera");
- return new LSL_Rotation();
- }
+ if (item.PermsGranter == UUID.Zero)
+ return new LSL_Rotation();
+
+ if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
+ {
+ ShoutError("No permissions to track the camera");
+ return new LSL_Rotation();
}
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
@@ -9865,17 +9780,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the object we are in
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
- agentID = m_host.TaskInventory[m_itemID].PermsGranter;
+ TaskInventoryItem item = GetSelfInventoryItem();
- if (agentID == UUID.Zero) return;
- if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
- }
+ // we need the permission first, to know which avatar we want to set the camera for
+ UUID agentID = item.PermsGranter;
+
+ if (agentID == UUID.Zero)
+ return;
+
+ if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
+ return;
ScenePresence presence = World.GetScenePresence(agentID);
@@ -9917,21 +9834,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the object we are in
UUID objectID = m_host.ParentUUID;
- if (objectID == UUID.Zero) return;
+ if (objectID == UUID.Zero)
+ return;
+
+ TaskInventoryItem item = GetSelfInventoryItem();
// we need the permission first, to know which avatar we want to clear the camera for
- UUID agentID;
- lock (m_host.TaskInventory)
- {
- agentID = m_host.TaskInventory[m_itemID].PermsGranter;
- if (agentID == UUID.Zero) return;
- if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
- }
+ UUID agentID = item.PermsGranter;
+
+ if (agentID == UUID.Zero)
+ return;
+
+ if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
+ return;
ScenePresence presence = World.GetScenePresence(agentID);
// we are not interested in child-agents
- if (presence.IsChildAgent) return;
+ if (presence.IsChildAgent)
+ return;
presence.ControllingClient.SendClearFollowCamProperties(objectID);
}
--
cgit v1.1
From 40e37d8b78379db08de541c8c7a9fed1d22ec5ef Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 24 Apr 2012 00:03:57 +0100
Subject: Add osForceAttachToAvatar() and osForceDetachFromAvatar()
These behave identically to llAttachToAvatar() and llDetachFromAvatar() except that they do not enforce the PERMISSION_ATTACH check
Intended for use in completely controlled dedicated environments where these checks are more a UI hinderance than a help.
Threat level high.
---
.../Shared/Api/Implementation/ApiManager.cs | 41 ++++++------
.../Shared/Api/Implementation/LSL_Api.cs | 73 +++++++++++++---------
.../Shared/Api/Implementation/OSSL_Api.cs | 28 +++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 14 +++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 13 +++-
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 7 +++
6 files changed, 127 insertions(+), 49 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs
index 47ed6ba..684138f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs
@@ -29,42 +29,43 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
+using log4net;
using OpenSim.Region.ScriptEngine.Interfaces;
namespace OpenSim.Region.ScriptEngine.Shared.Api
{
public class ApiManager
{
+// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
private Dictionary m_Apis = new Dictionary();
public string[] GetApis()
{
- if (m_Apis.Count > 0)
+ if (m_Apis.Count <= 0)
{
- List l = new List(m_Apis.Keys);
- return l.ToArray();
- }
+ Assembly a = Assembly.GetExecutingAssembly();
- Assembly a = Assembly.GetExecutingAssembly();
+ Type[] types = a.GetExportedTypes();
- Type[] types = a.GetExportedTypes();
-
- foreach (Type t in types)
- {
- string name = t.ToString();
- int idx = name.LastIndexOf('.');
- if (idx != -1)
- name = name.Substring(idx+1);
-
- if (name.EndsWith("_Api"))
+ foreach (Type t in types)
{
- name = name.Substring(0, name.Length - 4);
- m_Apis[name] = t;
+ string name = t.ToString();
+ int idx = name.LastIndexOf('.');
+ if (idx != -1)
+ name = name.Substring(idx+1);
+
+ if (name.EndsWith("_Api"))
+ {
+ name = name.Substring(0, name.Length - 4);
+ m_Apis[name] = t;
+ }
}
}
- List ret = new List(m_Apis.Keys);
- return ret.ToArray();
+// m_log.DebugFormat("[API MANAGER]: Found {0} apis", m_Apis.Keys.Count);
+
+ return new List(m_Apis.Keys).ToArray();
}
public IScriptApi CreateApi(string api)
@@ -76,4 +77,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9cb97f9..d4c872c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2994,7 +2994,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_UrlModule.ReleaseURL(url);
}
- public void llAttachToAvatar(int attachment)
+ ///
+ /// Attach the object containing this script to the avatar that owns it.
+ ///
+ /// The attachment point (e.g. ATTACH_CHEST)
+ /// true if the attach suceeded, false if it did not
+ public bool AttachToAvatar(int attachmentPoint)
+ {
+ SceneObjectGroup grp = m_host.ParentGroup;
+ ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
+
+ IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
+
+ if (attachmentsModule != null)
+ return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false);
+ else
+ return false;
+ }
+
+ ///
+ /// Detach the object containing this script from the avatar it is attached to.
+ ///
+ ///
+ /// Nothing happens if the object is not attached.
+ ///
+ public void DetachFromAvatar()
+ {
+ Util.FireAndForget(DetachWrapper, m_host);
+ }
+
+ private void DetachWrapper(object o)
+ {
+ SceneObjectPart host = (SceneObjectPart)o;
+
+ SceneObjectGroup grp = host.ParentGroup;
+ UUID itemID = grp.FromItemID;
+ ScenePresence presence = World.GetScenePresence(host.OwnerID);
+
+ IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
+ if (attachmentsModule != null)
+ attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
+ }
+
+ public void llAttachToAvatar(int attachmentPoint)
{
m_host.AddScriptLPS(1);
@@ -3007,15 +3049,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
- {
- SceneObjectGroup grp = m_host.ParentGroup;
-
- ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
-
- IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
- if (attachmentsModule != null)
- attachmentsModule.AttachObject(presence, grp, (uint)attachment, false);
- }
+ AttachToAvatar(attachmentPoint);
}
public void llDetachFromAvatar()
@@ -3031,24 +3065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
- {
- IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
- if (attachmentsModule != null)
- Util.FireAndForget(DetachWrapper, m_host);
- }
- }
-
- private void DetachWrapper(object o)
- {
- SceneObjectPart host = (SceneObjectPart)o;
-
- SceneObjectGroup grp = host.ParentGroup;
- UUID itemID = grp.FromItemID;
- ScenePresence presence = World.GetScenePresence(host.OwnerID);
-
- IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
- if (attachmentsModule != null)
- attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
+ DetachFromAvatar();
}
public void llTakeCamera(string avatar)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index fe94b79..3f261ea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -209,6 +209,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
throw new Exception("OSSL Runtime Error: " + msg);
}
+ ///
+ /// Initialize the LSL interface.
+ ///
+ ///
+ /// FIXME: This is an abomination. We should be able to set this up earlier but currently we have no
+ /// guarantee the interface is present on Initialize(). There needs to be another post initialize call from
+ /// ScriptInstance.
+ ///
private void InitLSL()
{
if (m_LSL_Api != null)
@@ -3093,5 +3101,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
}
}
+
+ public void osForceAttachToAvatar(int attachmentPoint)
+ {
+ CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar");
+
+ m_host.AddScriptLPS(1);
+
+ InitLSL();
+ ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint);
+ }
+
+ public void osForceDetachFromAvatar()
+ {
+ CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar");
+
+ m_host.AddScriptLPS(1);
+
+ InitLSL();
+ ((LSL_Api)m_LSL_Api).DetachFromAvatar();
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 545bbee..d0c852b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -98,6 +98,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
+ // Attachment commands
+
+ ///
+ /// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH
+ ///
+ /// The attachment point. For example, ATTACH_CHEST
+ void osForceAttachToAvatar(int attachment);
+
+ ///
+ /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH
+ ///
+ /// Nothing happens if the object is not attached.
+ void osForceDetachFromAvatar();
+
//texture draw functions
string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index b94b9bf..36ac0e3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -289,8 +289,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
}
+ // Avatar functions
- //Texture Draw functions
+ public void osForceAttachToAvatar(int attachmentPoint)
+ {
+ m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint);
+ }
+
+ public void osForceDetachFromAvatar()
+ {
+ m_OSSL_Functions.osForceDetachFromAvatar();
+ }
+
+ // Texture Draw functions
public string osMovePen(string drawList, int x, int y)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 6e36742..2c8af81 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -964,7 +964,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public IScriptApi GetApi(string name)
{
if (m_Apis.ContainsKey(name))
+ {
+// m_log.DebugFormat("[SCRIPT INSTANCE]: Found api {0} in {1}@{2}", name, ScriptName, PrimName);
+
return m_Apis[name];
+ }
+
+// m_log.DebugFormat("[SCRIPT INSTANCE]: Did not find api {0} in {1}@{2}", name, ScriptName, PrimName);
+
return null;
}
--
cgit v1.1
From 6c21e15cb9542c06e69fd8acd6d4c04aad2cd7da Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 24 Apr 2012 00:32:01 +0100
Subject: Add online/offline indicator to "friends show" region console
command.
Improve output table formatting.
---
.../Avatar/Friends/FriendsCommandsModule.cs | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs
index e68f9d0..2602050 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
private Scene m_scene;
private IFriendsModule m_friendsModule;
private IUserManagement m_userManagementModule;
+ private IPresenceService m_presenceService;
// private IAvatarFactoryModule m_avatarFactory;
@@ -99,8 +100,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
m_friendsModule = m_scene.RequestModuleInterface();
m_userManagementModule = m_scene.RequestModuleInterface();
+ m_presenceService = m_scene.RequestModuleInterface();
- if (m_friendsModule != null && m_userManagementModule != null)
+ if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
{
m_scene.AddCommand(
"Friends", this, "friends show",
@@ -162,7 +164,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
MainConsole.Instance.OutputFormat("Friends for {0} {1} {2}:", firstName, lastName, userId);
- MainConsole.Instance.OutputFormat("UUID, Name, MyFlags, TheirFlags");
+ MainConsole.Instance.OutputFormat(
+ "{0,-36} {1,-36} {2,-7} {3,7} {4,10}", "UUID", "Name", "Status", "MyFlags", "TheirFlags");
foreach (FriendInfo friend in friends)
{
@@ -175,14 +178,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
UUID friendId;
string friendName;
+ string onlineText;
if (UUID.TryParse(friend.Friend, out friendId))
friendName = m_userManagementModule.GetUserName(friendId);
else
friendName = friend.Friend;
+ OpenSim.Services.Interfaces.PresenceInfo[] pi = m_presenceService.GetAgents(new string[] { friend.Friend });
+ if (pi.Length > 0)
+ onlineText = "online";
+ else
+ onlineText = "offline";
+
MainConsole.Instance.OutputFormat(
- "{0} {1} {2} {3}", friend.Friend, friendName, friend.MyFlags, friend.TheirFlags);
+ "{0,-36} {1,-36} {2,-7} {3,-7} {4,-10}",
+ friend.Friend, friendName, onlineText, friend.MyFlags, friend.TheirFlags);
}
}
}
--
cgit v1.1
From fd279889788420a63d7454833ab33cb4060edf38 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Mon, 23 Apr 2012 21:29:18 -0700
Subject: Changed the Map-related messages from Info to Debug. They're debug
messages.
---
OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | 4 ++--
OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs | 4 ++--
OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | 4 ++--
OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index f86c790..aa306c7 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
int tc = 0;
double[,] hm = whichScene.Heightmap.GetDoubles();
tc = Environment.TickCount;
- m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
+ m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
EntityBase[] objs = whichScene.GetEntities();
Dictionary z_sort = new Dictionary();
//SortedList z_sort = new SortedList();
@@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
g.Dispose();
} // lock entities objs
- m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
+ m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
return mapbmp;
}
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
index eb1a27f..992bff3 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
public void TerrainToBitmap(Bitmap mapbmp)
{
int tc = Environment.TickCount;
- m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
+ m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
double[,] hm = m_scene.Heightmap.GetDoubles();
bool ShadowDebugContinue = true;
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
}
}
}
- m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
+ m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
}
}
}
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index 1d2141e..d13c2ef 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
public void TerrainToBitmap(Bitmap mapbmp)
{
int tc = Environment.TickCount;
- m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
+ m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
// These textures should be in the AssetCache anyway, as every client conneting to this
// region needs them. Except on start, when the map is recreated (before anyone connected),
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
}
}
}
- m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
+ m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
}
}
}
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
index 6163fd1..4f4e296 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
@@ -88,11 +88,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
if (renderers.Count > 0)
{
m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
- m_log.Info("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
+ m_log.Debug("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
}
else
{
- m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
+ m_log.Debug("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
}
m_scene.RegisterModuleInterface(this);
--
cgit v1.1
From c6f30e044b6cd2ed8493ad0e2914786eef4f7890 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 24 Apr 2012 19:49:52 +0100
Subject: Restore _parent_scene.actor_name_map[prim_geom] = this; accidentally
removed from ODEPrim.SetGeom.
This occurred in 7a574be3fd from Sat 21 Apr 2012.
This should fix collision detection.
Mnay thanks to tglion for the spot and the fix in http://opensimulator.org/mantis/view.php?id=5988
---
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 3f88353..0716214 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -338,6 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
_parent_scene.geom_name_map[prim_geom] = Name;
+ _parent_scene.actor_name_map[prim_geom] = this;
if (childPrim)
{
--
cgit v1.1
From 0e3053e4c97670e897496ffa98d7039bf686e6d2 Mon Sep 17 00:00:00 2001
From: Olivier van Helden and Gudule Lapointe (Speculoos.net)
Date: Thu, 19 Apr 2012 01:17:56 +0200
Subject: DST settings to match client default Pacific Time (mantis #5972)
---
OpenSim/Services/LLLoginService/LLLoginResponse.cs | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 844c5ae..8fdcf4e 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -349,7 +349,21 @@ namespace OpenSim.Services.LLLoginService
private void SetDefaultValues()
{
- DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
+ TimeZoneInfo gridTimeZone;
+ try
+ {
+ // First try to fetch DST from Pacific Standard Time, because this is
+ // the one expected by the viewer. "US/Pacific" is the string to search
+ // on linux and mac, and should work also on Windows (to confirm)
+ gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific");
+ }
+ catch (Exception e)
+ {
+ m_log.WarnFormat("[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", e.Message);
+ gridTimeZone = TimeZoneInfo.Local;
+ }
+ DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
+
StipendSinceLogin = "N";
Gendered = "Y";
EverLoggedIn = "Y";
--
cgit v1.1
From cbe889e10bc06f0a3e31b4094c88bf022635dff9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 24 Apr 2012 20:30:19 +0100
Subject: minor: formatting changes to top of
LLLoginResponse.SetDefaultValues(), chiefly some break up of the long line.
---
OpenSim/Services/LLLoginService/LLLoginResponse.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 8fdcf4e..10a44ed 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -350,6 +350,7 @@ namespace OpenSim.Services.LLLoginService
private void SetDefaultValues()
{
TimeZoneInfo gridTimeZone;
+
try
{
// First try to fetch DST from Pacific Standard Time, because this is
@@ -359,9 +360,13 @@ namespace OpenSim.Services.LLLoginService
}
catch (Exception e)
{
- m_log.WarnFormat("[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", e.Message);
+ m_log.WarnFormat(
+ "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time",
+ e.Message);
+
gridTimeZone = TimeZoneInfo.Local;
}
+
DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
StipendSinceLogin = "N";
--
cgit v1.1
From 6011bfa5e36d77ad58cf50ddd99b8c6289144f57 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 23 Apr 2012 19:19:08 +0300
Subject: OSSL: fixed the threat level check for osParseJSONNew
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 3f261ea..7fc7337 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1617,7 +1617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public Object osParseJSONNew(string JSON)
{
- CheckThreatLevel(ThreatLevel.None, "osParseJSON");
+ CheckThreatLevel(ThreatLevel.None, "osParseJSONNew");
m_host.AddScriptLPS(1);
--
cgit v1.1
From c70e85a3271aaa9e6d892240964cb55cbc2960c7 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 23 Apr 2012 18:38:21 +0300
Subject: When reading a region, use null objects to represent NULL fields.
Previously NULL fields were converted to an empty string due to the use of ToString(). But if the field was an Int (e.g., "locZ"), then the subsequent attempt to convert an empty string to an int caused an exception. Now the field is null so we don't try to convert it, so there's no exception.
---
OpenSim/Data/MySQL/MySQLRegionData.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index c20c392..948cdf3 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -187,7 +187,11 @@ namespace OpenSim.Data.MySQL
if (s == "locY")
continue;
- ret.Data[s] = result[s].ToString();
+ object value = result[s];
+ if (value is DBNull)
+ ret.Data[s] = null;
+ else
+ ret.Data[s] = result[s].ToString();
}
retList.Add(ret);
--
cgit v1.1
From da5fd53702ce97d13da2cb50da0753d507e6c11b Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 23 Apr 2012 18:39:23 +0300
Subject: Fixed problem with MySQL: it was possible for one thread to use an
incomplete list of column names if another thread was creating the list at
the same time. Now this is thread-safe.
---
OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 23 +++++++++++++-------
OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 6 ++++--
OpenSim/Data/MySQL/MySQLRegionData.cs | 29 ++++++++++++++++----------
3 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index 8d82f61..664ce84 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -79,14 +79,7 @@ namespace OpenSim.Data.MySQL
{
ret.PrincipalID = principalID;
- if (m_ColumnNames == null)
- {
- m_ColumnNames = new List();
-
- DataTable schemaTable = result.GetSchemaTable();
- foreach (DataRow row in schemaTable.Rows)
- m_ColumnNames.Add(row["ColumnName"].ToString());
- }
+ CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{
@@ -105,6 +98,20 @@ namespace OpenSim.Data.MySQL
}
}
+ private void CheckColumnNames(IDataReader result)
+ {
+ if (m_ColumnNames != null)
+ return;
+
+ List columnNames = new List();
+
+ DataTable schemaTable = result.GetSchemaTable();
+ foreach (DataRow row in schemaTable.Rows)
+ columnNames.Add(row["ColumnName"].ToString());
+
+ m_ColumnNames = columnNames;
+ }
+
public bool Store(AuthenticationData data)
{
if (data.Data.ContainsKey("UUID"))
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 754cf72..da8e958 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -91,15 +91,17 @@ namespace OpenSim.Data.MySQL
if (m_ColumnNames != null)
return;
- m_ColumnNames = new List();
+ List columnNames = new List();
DataTable schemaTable = reader.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
{
if (row["ColumnName"] != null &&
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
- m_ColumnNames.Add(row["ColumnName"].ToString());
+ columnNames.Add(row["ColumnName"].ToString());
}
+
+ m_ColumnNames = columnNames;
}
public virtual T[] Get(string field, string key)
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 948cdf3..d1f1932 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL
ret.sizeX = Convert.ToInt32(result["sizeX"]);
ret.sizeY = Convert.ToInt32(result["sizeY"]);
- if (m_ColumnNames == null)
- {
- m_ColumnNames = new List();
-
- DataTable schemaTable = result.GetSchemaTable();
- foreach (DataRow row in schemaTable.Rows)
- {
- if (row["ColumnName"] != null)
- m_ColumnNames.Add(row["ColumnName"].ToString());
- }
- }
+ CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{
@@ -202,6 +192,23 @@ namespace OpenSim.Data.MySQL
return retList;
}
+ private void CheckColumnNames(IDataReader result)
+ {
+ if (m_ColumnNames != null)
+ return;
+
+ List columnNames = new List();
+
+ DataTable schemaTable = result.GetSchemaTable();
+ foreach (DataRow row in schemaTable.Rows)
+ {
+ if (row["ColumnName"] != null)
+ columnNames.Add(row["ColumnName"].ToString());
+ }
+
+ m_ColumnNames = columnNames;
+ }
+
public bool Store(RegionData data)
{
if (data.Data.ContainsKey("uuid"))
--
cgit v1.1