diff options
author | UbitUmarov | 2012-06-08 14:29:02 +0100 |
---|---|---|
committer | UbitUmarov | 2012-06-08 14:29:02 +0100 |
commit | 9d878591c821b46704f1cd16243422e14d68e842 (patch) | |
tree | 96a7776685099689d6bc53796c4a1dac95f5ec7b /OpenSim/Region | |
parent | Replace the stock libomv with our home grown 0.9.1 with the texture bug fixed. (diff) | |
download | opensim-SC_OLD-9d878591c821b46704f1cd16243422e14d68e842.zip opensim-SC_OLD-9d878591c821b46704f1cd16243422e14d68e842.tar.gz opensim-SC_OLD-9d878591c821b46704f1cd16243422e14d68e842.tar.bz2 opensim-SC_OLD-9d878591c821b46704f1cd16243422e14d68e842.tar.xz |
*UNTESTED* added PRIM_POS_LOCAL and PRIM_ROT_LOCAL in SetPrimParams for avatars. Stopped setting position twice in normal SetPrimParams
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 667aa93..d230b24 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7887,6 +7887,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7887 | } | 7887 | } |
7888 | break; | 7888 | break; |
7889 | 7889 | ||
7890 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
7891 | { | ||
7892 | if (remain < 1) | ||
7893 | return; | ||
7894 | LSL_Vector v; | ||
7895 | v = rules.GetVector3Item(idx++); | ||
7896 | |||
7897 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | ||
7898 | if (part == null) | ||
7899 | break; | ||
7900 | |||
7901 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | ||
7902 | |||
7903 | v += 2 * sitOffset; | ||
7904 | |||
7905 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | ||
7906 | av.SendAvatarDataToAllAgents(); | ||
7907 | |||
7908 | } | ||
7909 | break; | ||
7910 | |||
7890 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7911 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7891 | { | 7912 | { |
7892 | if (remain < 1) | 7913 | if (remain < 1) |
@@ -7907,6 +7928,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7907 | av.SendAvatarDataToAllAgents(); | 7928 | av.SendAvatarDataToAllAgents(); |
7908 | } | 7929 | } |
7909 | break; | 7930 | break; |
7931 | |||
7932 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
7933 | { | ||
7934 | if (remain < 1) | ||
7935 | return; | ||
7936 | |||
7937 | LSL_Rotation r; | ||
7938 | r = rules.GetQuaternionItem(idx++); | ||
7939 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | ||
7940 | av.SendAvatarDataToAllAgents(); | ||
7941 | } | ||
7942 | break; | ||
7943 | |||
7910 | } | 7944 | } |
7911 | } | 7945 | } |
7912 | } | 7946 | } |
@@ -7966,6 +8000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7966 | else | 8000 | else |
7967 | { | 8001 | { |
7968 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 8002 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
8003 | // sounds like sl bug that we need to replicate | ||
7969 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | 8004 | SceneObjectPart rootPart = part.ParentGroup.RootPart; |
7970 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | 8005 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
7971 | } | 8006 | } |
@@ -8335,6 +8370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8335 | } | 8370 | } |
8336 | finally | 8371 | finally |
8337 | { | 8372 | { |
8373 | /* | ||
8338 | if (positionChanged) | 8374 | if (positionChanged) |
8339 | { | 8375 | { |
8340 | if (part.ParentGroup.RootPart == part) | 8376 | if (part.ParentGroup.RootPart == part) |
@@ -8352,23 +8388,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8352 | parent.ScheduleGroupForTerseUpdate(); | 8388 | parent.ScheduleGroupForTerseUpdate(); |
8353 | } | 8389 | } |
8354 | } | 8390 | } |
8391 | */ | ||
8355 | } | 8392 | } |
8356 | 8393 | ||
8357 | if (positionChanged) | 8394 | if (positionChanged) |
8358 | { | 8395 | { |
8359 | if (part.ParentGroup.RootPart == part) | 8396 | SceneObjectGroup parentgrp = part.ParentGroup; |
8397 | if (parentgrp == null) | ||
8398 | return; | ||
8399 | |||
8400 | if (parentgrp.RootPart == part) | ||
8360 | { | 8401 | { |
8361 | SceneObjectGroup parent = part.ParentGroup; | 8402 | |
8362 | Util.FireAndForget(delegate(object x) { | 8403 | Util.FireAndForget(delegate(object x) { |
8363 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | 8404 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); |
8364 | }); | 8405 | }); |
8365 | } | 8406 | } |
8366 | else | 8407 | else |
8367 | { | 8408 | { |
8368 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | 8409 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); |
8369 | SceneObjectGroup parent = part.ParentGroup; | 8410 | parentgrp.HasGroupChanged = true; |
8370 | parent.HasGroupChanged = true; | 8411 | parentgrp.ScheduleGroupForTerseUpdate(); |
8371 | parent.ScheduleGroupForTerseUpdate(); | ||
8372 | } | 8412 | } |
8373 | } | 8413 | } |
8374 | } | 8414 | } |