aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs68
1 files changed, 66 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index c386e38..bdca67c 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -6917,13 +6917,77 @@ namespace OpenSim.Region.ScriptEngine.Common
6917 public void llSetCameraParams(LSL_Types.list rules) 6917 public void llSetCameraParams(LSL_Types.list rules)
6918 { 6918 {
6919 m_host.AddScriptLPS(1); 6919 m_host.AddScriptLPS(1);
6920 NotImplemented("llSetCameraParams"); 6920
6921 // our key in the object we are in
6922 LLUUID invItemID=InventorySelf();
6923 if (invItemID == LLUUID.Zero) return;
6924
6925 // the object we are in
6926 LLUUID objectID = m_host.ParentUUID;
6927 if(objectID == LLUUID.Zero) return;
6928
6929 // we need the permission first, to know which avatar we want to set the camera for
6930 LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter;
6931 if (agentID == LLUUID.Zero) return;
6932 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
6933
6934 ScenePresence presence = World.GetScenePresence(agentID);
6935
6936 // we are not interested in child-agents
6937 if(presence.IsChildAgent) return;
6938
6939 SortedDictionary<int, float> parameters = new SortedDictionary<int, float>();
6940 object[] data = rules.Data;
6941 for(int i = 0; i < data.Length; ++i) {
6942 int type = Convert.ToInt32(data[i++]);
6943 if(i >= data.Length) break; // odd number of entries => ignore the last
6944
6945 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3)
6946 switch(type) {
6947 case BuiltIn_Commands_BaseClass.CAMERA_FOCUS:
6948 case BuiltIn_Commands_BaseClass.CAMERA_FOCUS_OFFSET:
6949 case BuiltIn_Commands_BaseClass.CAMERA_POSITION:
6950 LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i];
6951 parameters.Add(type + 1, (float)v.x);
6952 parameters.Add(type + 2, (float)v.y);
6953 parameters.Add(type + 3, (float)v.z);
6954 break;
6955 default:
6956 // TODO: clean that up as soon as the implicit casts are in
6957 if(data[i] is LSL_Types.LSLFloat)
6958 parameters.Add(type, (float)((LSL_Types.LSLFloat)data[i]).value);
6959 else if(data[i] is LSL_Types.LSLInteger)
6960 parameters.Add(type, (float)((LSL_Types.LSLInteger)data[i]).value);
6961 else parameters.Add(type, Convert.ToSingle(data[i]));
6962 break;
6963 }
6964 }
6965 if(parameters.Count > 0) presence.ControllingClient.SendSetFollowCamProperties(objectID, parameters);
6921 } 6966 }
6922 6967
6923 public void llClearCameraParams() 6968 public void llClearCameraParams()
6924 { 6969 {
6925 m_host.AddScriptLPS(1); 6970 m_host.AddScriptLPS(1);
6926 NotImplemented("llClearCameraParams"); 6971
6972 // our key in the object we are in
6973 LLUUID invItemID=InventorySelf();
6974 if (invItemID == LLUUID.Zero) return;
6975
6976 // the object we are in
6977 LLUUID objectID = m_host.ParentUUID;
6978 if(objectID == LLUUID.Zero) return;
6979
6980 // we need the permission first, to know which avatar we want to clear the camera for
6981 LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter;
6982 if (agentID == LLUUID.Zero) return;
6983 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
6984
6985 ScenePresence presence = World.GetScenePresence(agentID);
6986
6987 // we are not interested in child-agents
6988 if(presence.IsChildAgent) return;
6989
6990 presence.ControllingClient.SendClearFollowCamProperties(objectID);
6927 } 6991 }
6928 6992
6929 public double llListStatistics(int operation, LSL_Types.list src) 6993 public double llListStatistics(int operation, LSL_Types.list src)