diff options
author | Melanie | 2012-03-04 16:23:46 +0000 |
---|---|---|
committer | Melanie | 2012-03-04 16:23:46 +0000 |
commit | 182f5efbe94881c22af82bc71566c49dd02ed8f8 (patch) | |
tree | 2b26c2657cfb91464008d8e305566500bc3cdd9e /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Zero velocity when drag-copying (diff) | |
download | opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.zip opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.gz opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.bz2 opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.xz |
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 164 |
1 files changed, 162 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 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 |