aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorMelanie2012-03-04 16:23:46 +0000
committerMelanie2012-03-04 16:23:46 +0000
commit182f5efbe94881c22af82bc71566c49dd02ed8f8 (patch)
tree2b26c2657cfb91464008d8e305566500bc3cdd9e /OpenSim/Region/ScriptEngine/Shared/Api
parentMerge branch 'master' into careminster (diff)
parentZero velocity when drag-copying (diff)
downloadopensim-SC_OLD-182f5efbe94881c22af82bc71566c49dd02ed8f8.zip
opensim-SC_OLD-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.gz
opensim-SC_OLD-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.bz2
opensim-SC_OLD-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.xz
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs164
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs12
4 files changed, 188 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8708b99..4366626 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2484,13 +2484,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2484 public void llApplyRotationalImpulse(LSL_Vector force, int local) 2484 public void llApplyRotationalImpulse(LSL_Vector force, int local)
2485 { 2485 {
2486 m_host.AddScriptLPS(1); 2486 m_host.AddScriptLPS(1);
2487 m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); 2487 m_host.ParentGroup.RootPart.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0);
2488 } 2488 }
2489 2489
2490 public void llSetTorque(LSL_Vector torque, int local) 2490 public void llSetTorque(LSL_Vector torque, int local)
2491 { 2491 {
2492 m_host.AddScriptLPS(1); 2492 m_host.AddScriptLPS(1);
2493 m_host.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); 2493 m_host.ParentGroup.RootPart.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0);
2494 } 2494 }
2495 2495
2496 public LSL_Vector llGetTorque() 2496 public LSL_Vector llGetTorque()
@@ -4657,6 +4657,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4657 ScriptSleep(5000); 4657 ScriptSleep(5000);
4658 } 4658 }
4659 4659
4660 public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt)
4661 {
4662 m_host.AddScriptLPS(1);
4663 UUID agentId = new UUID();
4664 if (UUID.TryParse(agent, out agentId))
4665 {
4666 ScenePresence presence = World.GetScenePresence(agentId);
4667 if (presence != null)
4668 {
4669 // agent must not be a god
4670 if (presence.UserLevel >= 200) return;
4671
4672 // agent must be over the owners land
4673 if (m_host.OwnerID == World.LandChannel.GetLandObject(
4674 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4675 {
4676 World.RequestTeleportLocation(presence.ControllingClient, simname, new Vector3((float)pos.x, (float)pos.y, (float)pos.z), new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z), (uint)TeleportFlags.ViaLocation);
4677 }
4678 }
4679 }
4680 }
4681
4660 public void llTextBox(string agent, string message, int chatChannel) 4682 public void llTextBox(string agent, string message, int chatChannel)
4661 { 4683 {
4662 IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); 4684 IDialogModule dm = World.RequestModuleInterface<IDialogModule>();
@@ -11980,6 +12002,144 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11980 } 12002 }
11981 12003
11982 #endregion 12004 #endregion
12005
12006 public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
12007 {
12008 SceneObjectGroup group = m_host.ParentGroup;
12009
12010 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical)
12011 return;
12012 if (group.IsAttachment)
12013 return;
12014
12015 if (frames.Data.Length > 0) // We are getting a new motion
12016 {
12017 if (group.RootPart.KeyframeMotion != null)
12018 group.RootPart.KeyframeMotion.Stop();
12019 group.RootPart.KeyframeMotion = null;
12020
12021 int idx = 0;
12022
12023 KeyframeMotion.PlayMode mode = KeyframeMotion.PlayMode.Forward;
12024 KeyframeMotion.DataFormat data = KeyframeMotion.DataFormat.Translation | KeyframeMotion.DataFormat.Rotation;
12025
12026 while (idx < options.Data.Length)
12027 {
12028 int option = (int)options.GetLSLIntegerItem(idx++);
12029 int remain = options.Data.Length - idx;
12030
12031 switch (option)
12032 {
12033 case ScriptBaseClass.KFM_MODE:
12034 if (remain < 1)
12035 break;
12036 int modeval = (int)options.GetLSLIntegerItem(idx++);
12037 switch(modeval)
12038 {
12039 case ScriptBaseClass.KFM_FORWARD:
12040 mode = KeyframeMotion.PlayMode.Forward;
12041 break;
12042 case ScriptBaseClass.KFM_REVERSE:
12043 mode = KeyframeMotion.PlayMode.Reverse;
12044 break;
12045 case ScriptBaseClass.KFM_LOOP:
12046 mode = KeyframeMotion.PlayMode.Loop;
12047 break;
12048 case ScriptBaseClass.KFM_PING_PONG:
12049 mode = KeyframeMotion.PlayMode.PingPong;
12050 break;
12051 }
12052 break;
12053 case ScriptBaseClass.KFM_DATA:
12054 if (remain < 1)
12055 break;
12056 int dataval = (int)options.GetLSLIntegerItem(idx++);
12057 data = (KeyframeMotion.DataFormat)dataval;
12058 break;
12059 }
12060 }
12061
12062 group.RootPart.KeyframeMotion = new KeyframeMotion(group, mode, data);
12063
12064 idx = 0;
12065
12066 int elemLength = 2;
12067 if (data == (KeyframeMotion.DataFormat.Translation | KeyframeMotion.DataFormat.Rotation))
12068 elemLength = 3;
12069
12070 List<KeyframeMotion.Keyframe> keyframes = new List<KeyframeMotion.Keyframe>();
12071 while (idx < frames.Data.Length)
12072 {
12073 int remain = frames.Data.Length - idx;
12074
12075 if (remain < elemLength)
12076 break;
12077
12078 KeyframeMotion.Keyframe frame = new KeyframeMotion.Keyframe();
12079 frame.Position = null;
12080 frame.Rotation = null;
12081
12082 if ((data & KeyframeMotion.DataFormat.Translation) != 0)
12083 {
12084 LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++);
12085 frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z);
12086 }
12087 if ((data & KeyframeMotion.DataFormat.Rotation) != 0)
12088 {
12089 LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++);
12090 frame.Rotation = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s);
12091 }
12092
12093 float tempf = (float)frames.GetLSLFloatItem(idx++);
12094 frame.TimeMS = (int)(tempf * 1000.0f);
12095
12096 keyframes.Add(frame);
12097 }
12098
12099 group.RootPart.KeyframeMotion.SetKeyframes(keyframes.ToArray());
12100 group.RootPart.KeyframeMotion.Start();
12101 }
12102 else
12103 {
12104 if (group.RootPart.KeyframeMotion == null)
12105 return;
12106
12107 if (options.Data.Length == 0)
12108 {
12109 group.RootPart.KeyframeMotion.Stop();
12110 return;
12111 }
12112
12113 int code = (int)options.GetLSLIntegerItem(0);
12114
12115 int idx = 0;
12116
12117 while (idx < options.Data.Length)
12118 {
12119 int option = (int)options.GetLSLIntegerItem(idx++);
12120 int remain = options.Data.Length - idx;
12121
12122 switch (option)
12123 {
12124 case ScriptBaseClass.KFM_COMMAND:
12125 int cmd = (int)options.GetLSLIntegerItem(idx++);
12126 switch (cmd)
12127 {
12128 case ScriptBaseClass.KFM_CMD_PLAY:
12129 group.RootPart.KeyframeMotion.Start();
12130 break;
12131 case ScriptBaseClass.KFM_CMD_STOP:
12132 group.RootPart.KeyframeMotion.Stop();
12133 break;
12134 case ScriptBaseClass.KFM_CMD_PAUSE:
12135 group.RootPart.KeyframeMotion.Pause();
12136 break;
12137 }
12138 break;
12139 }
12140 }
12141 }
12142 }
11983 } 12143 }
11984 12144
11985 public class NotecardCache 12145 public class NotecardCache
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 55444dc..8d97a7c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -399,6 +399,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
399 void llTargetOmega(LSL_Vector axis, double spinrate, double gain); 399 void llTargetOmega(LSL_Vector axis, double spinrate, double gain);
400 void llTargetRemove(int number); 400 void llTargetRemove(int number);
401 void llTeleportAgentHome(string agent); 401 void llTeleportAgentHome(string agent);
402 void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt);
402 void llTextBox(string avatar, string message, int chat_channel); 403 void llTextBox(string avatar, string message, int chat_channel);
403 LSL_String llToLower(string source); 404 LSL_String llToLower(string source);
404 LSL_String llToUpper(string source); 405 LSL_String llToUpper(string source);
@@ -419,5 +420,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
419 420
420 void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); 421 void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
421 LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); 422 LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
423 void llSetKeyframedMotion(LSL_List frames, LSL_List options);
422 } 424 }
423} 425}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 3d0e5cb..a5e160d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -641,5 +641,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
641 public static readonly LSLInteger RCERR_UNKNOWN = -1; 641 public static readonly LSLInteger RCERR_UNKNOWN = -1;
642 public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; 642 public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2;
643 public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; 643 public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3;
644
645 public const int KFM_MODE = 1;
646 public const int KFM_LOOP = 1;
647 public const int KFM_REVERSE = 3;
648 public const int KFM_FORWARD = 0;
649 public const int KFM_PING_PONG = 2;
650 public const int KFM_DATA = 2;
651 public const int KFM_TRANSLATION = 2;
652 public const int KFM_ROTATION = 1;
653 public const int KFM_COMMAND = 0;
654 public const int KFM_CMD_PLAY = 0;
655 public const int KFM_CMD_STOP = 1;
656 public const int KFM_CMD_PAUSE = 2;
644 } 657 }
645} 658}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 5f9f0b9..a8d1ddb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1820,6 +1820,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1820 m_LSL_Functions.llTargetRemove(number); 1820 m_LSL_Functions.llTargetRemove(number);
1821 } 1821 }
1822 1822
1823 public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt)
1824 {
1825 m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt);
1826 }
1827
1823 public void llTeleportAgentHome(string agent) 1828 public void llTeleportAgentHome(string agent)
1824 { 1829 {
1825 m_LSL_Functions.llTeleportAgentHome(agent); 1830 m_LSL_Functions.llTeleportAgentHome(agent);
@@ -1937,7 +1942,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1937 1942
1938 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) 1943 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
1939 { 1944 {
1940 return m_LSL_Functions.llGetLinkNumberOfSides(link); 1945 return m_LSL_Functions.llGetLinkNumberOfSides(link);
1946 }
1947
1948 public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
1949 {
1950 m_LSL_Functions.llSetKeyframedMotion(frames, options);
1941 } 1951 }
1942 } 1952 }
1943} 1953}