aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-07-31 12:31:31 +0000
committerMelanie Thielker2008-07-31 12:31:31 +0000
commitc441a03ea3120c52af3fdffb284194f2609127cf (patch)
tree539b48d22ab51f45dc09f930dbeb1b7f6ba703a8 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
parentThank you, HomerHorwitz, for a patch that add PERMISSION_CONTROL_CAMERA (diff)
downloadopensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.zip
opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.tar.gz
opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.tar.bz2
opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.tar.xz
Thank you, HomerHorwitz, for a patch that implements llSetCameraParams/llClearCameraParams.
Fixes Mantis #1867
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs68
1 files changed, 66 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 99af529..dadad02 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6695,13 +6695,77 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6695 public void llSetCameraParams(LSL_Types.list rules) 6695 public void llSetCameraParams(LSL_Types.list rules)
6696 { 6696 {
6697 m_host.AddScriptLPS(1); 6697 m_host.AddScriptLPS(1);
6698 NotImplemented("llSetCameraParams"); 6698
6699 // our key in the object we are in
6700 LLUUID invItemID=InventorySelf();
6701 if (invItemID == LLUUID.Zero) return;
6702
6703 // the object we are in
6704 LLUUID objectID = m_host.ParentUUID;
6705 if(objectID == LLUUID.Zero) return;
6706
6707 // we need the permission first, to know which avatar we want to set the camera for
6708 LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter;
6709 if (agentID == LLUUID.Zero) return;
6710 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
6711
6712 ScenePresence presence = World.GetScenePresence(agentID);
6713
6714 // we are not interested in child-agents
6715 if(presence.IsChildAgent) return;
6716
6717 SortedDictionary<int, float> parameters = new SortedDictionary<int, float>();
6718 object[] data = rules.Data;
6719 for(int i = 0; i < data.Length; ++i) {
6720 int type = Convert.ToInt32(data[i++]);
6721 if(i >= data.Length) break; // odd number of entries => ignore the last
6722
6723 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3)
6724 switch(type) {
6725 case ScriptBaseClass.CAMERA_FOCUS:
6726 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
6727 case ScriptBaseClass.CAMERA_POSITION:
6728 LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i];
6729 parameters.Add(type + 1, (float)v.x);
6730 parameters.Add(type + 2, (float)v.y);
6731 parameters.Add(type + 3, (float)v.z);
6732 break;
6733 default:
6734 // TODO: clean that up as soon as the implicit casts are in
6735 if(data[i] is LSL_Types.LSLFloat)
6736 parameters.Add(type, (float)((LSL_Types.LSLFloat)data[i]).value);
6737 else if(data[i] is LSL_Types.LSLInteger)
6738 parameters.Add(type, (float)((LSL_Types.LSLInteger)data[i]).value);
6739 else parameters.Add(type, Convert.ToSingle(data[i]));
6740 break;
6741 }
6742 }
6743 if(parameters.Count > 0) presence.ControllingClient.SendSetFollowCamProperties(objectID, parameters);
6699 } 6744 }
6700 6745
6701 public void llClearCameraParams() 6746 public void llClearCameraParams()
6702 { 6747 {
6703 m_host.AddScriptLPS(1); 6748 m_host.AddScriptLPS(1);
6704 NotImplemented("llClearCameraParams"); 6749
6750 // our key in the object we are in
6751 LLUUID invItemID=InventorySelf();
6752 if (invItemID == LLUUID.Zero) return;
6753
6754 // the object we are in
6755 LLUUID objectID = m_host.ParentUUID;
6756 if(objectID == LLUUID.Zero) return;
6757
6758 // we need the permission first, to know which avatar we want to clear the camera for
6759 LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter;
6760 if (agentID == LLUUID.Zero) return;
6761 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
6762
6763 ScenePresence presence = World.GetScenePresence(agentID);
6764
6765 // we are not interested in child-agents
6766 if(presence.IsChildAgent) return;
6767
6768 presence.ControllingClient.SendClearFollowCamProperties(objectID);
6705 } 6769 }
6706 6770
6707 public double llListStatistics(int operation, LSL_Types.list src) 6771 public double llListStatistics(int operation, LSL_Types.list src)