diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 178 |
1 files changed, 165 insertions, 13 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..523a6ca 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7843,7 +7843,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7843 | protected void SetPrimParams(ScenePresence av, LSL_List rules) | 7843 | protected void SetPrimParams(ScenePresence av, LSL_List rules) |
7844 | { | 7844 | { |
7845 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. | 7845 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. |
7846 | //We only support PRIM_POSITION and PRIM_ROTATION | ||
7847 | 7846 | ||
7848 | int idx = 0; | 7847 | int idx = 0; |
7849 | 7848 | ||
@@ -7878,7 +7877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7878 | v /= localRot; | 7877 | v /= localRot; |
7879 | 7878 | ||
7880 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | 7879 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); |
7881 | 7880 | ||
7882 | v = v + 2 * sitOffset; | 7881 | v = v + 2 * sitOffset; |
7883 | 7882 | ||
7884 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | 7883 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); |
@@ -7887,6 +7886,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7887 | } | 7886 | } |
7888 | break; | 7887 | break; |
7889 | 7888 | ||
7889 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
7890 | { | ||
7891 | if (remain < 1) | ||
7892 | return; | ||
7893 | LSL_Vector v; | ||
7894 | v = rules.GetVector3Item(idx++); | ||
7895 | |||
7896 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | ||
7897 | if (part == null) | ||
7898 | break; | ||
7899 | |||
7900 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | ||
7901 | |||
7902 | v += 2 * sitOffset; | ||
7903 | |||
7904 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | ||
7905 | av.SendAvatarDataToAllAgents(); | ||
7906 | |||
7907 | } | ||
7908 | break; | ||
7909 | |||
7890 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7910 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7891 | { | 7911 | { |
7892 | if (remain < 1) | 7912 | if (remain < 1) |
@@ -7907,6 +7927,109 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7907 | av.SendAvatarDataToAllAgents(); | 7927 | av.SendAvatarDataToAllAgents(); |
7908 | } | 7928 | } |
7909 | break; | 7929 | break; |
7930 | |||
7931 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
7932 | { | ||
7933 | if (remain < 1) | ||
7934 | return; | ||
7935 | |||
7936 | LSL_Rotation r; | ||
7937 | r = rules.GetQuaternionItem(idx++); | ||
7938 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | ||
7939 | av.SendAvatarDataToAllAgents(); | ||
7940 | } | ||
7941 | break; | ||
7942 | |||
7943 | // parse rest doing nothing but number of parameters error check | ||
7944 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
7945 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
7946 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
7947 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
7948 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
7949 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
7950 | case (int)ScriptBaseClass.PRIM_NAME: | ||
7951 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7952 | if (remain < 1) | ||
7953 | return; | ||
7954 | idx++; | ||
7955 | break; | ||
7956 | |||
7957 | case (int)ScriptBaseClass.PRIM_GLOW: | ||
7958 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | ||
7959 | case (int)ScriptBaseClass.PRIM_TEXGEN: | ||
7960 | if (remain < 2) | ||
7961 | return; | ||
7962 | idx += 2; | ||
7963 | break; | ||
7964 | |||
7965 | case (int)ScriptBaseClass.PRIM_TYPE: | ||
7966 | if (remain < 3) | ||
7967 | return; | ||
7968 | code = (int)rules.GetLSLIntegerItem(idx++); | ||
7969 | remain = rules.Length - idx; | ||
7970 | switch (code) | ||
7971 | { | ||
7972 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | ||
7973 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | ||
7974 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | ||
7975 | if (remain < 6) | ||
7976 | return; | ||
7977 | idx += 6; | ||
7978 | break; | ||
7979 | |||
7980 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | ||
7981 | if (remain < 5) | ||
7982 | return; | ||
7983 | idx += 5; | ||
7984 | break; | ||
7985 | |||
7986 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | ||
7987 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | ||
7988 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | ||
7989 | if (remain < 11) | ||
7990 | return; | ||
7991 | idx += 11; | ||
7992 | break; | ||
7993 | |||
7994 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | ||
7995 | if (remain < 2) | ||
7996 | return; | ||
7997 | idx += 2; | ||
7998 | break; | ||
7999 | } | ||
8000 | break; | ||
8001 | |||
8002 | case (int)ScriptBaseClass.PRIM_COLOR: | ||
8003 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
8004 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
8005 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
8006 | if (remain < 3) | ||
8007 | return; | ||
8008 | idx += 3; | ||
8009 | break; | ||
8010 | |||
8011 | case (int)ScriptBaseClass.PRIM_TEXTURE: | ||
8012 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | ||
8013 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: | ||
8014 | if (remain < 5) | ||
8015 | return; | ||
8016 | idx += 5; | ||
8017 | break; | ||
8018 | |||
8019 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | ||
8020 | if (remain < 7) | ||
8021 | return; | ||
8022 | |||
8023 | idx += 7; | ||
8024 | break; | ||
8025 | |||
8026 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
8027 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
8028 | return; | ||
8029 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
8030 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
8031 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
8032 | return; | ||
7910 | } | 8033 | } |
7911 | } | 8034 | } |
7912 | } | 8035 | } |
@@ -7918,6 +8041,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7918 | 8041 | ||
7919 | int idx = 0; | 8042 | int idx = 0; |
7920 | 8043 | ||
8044 | SceneObjectGroup parentgrp = part.ParentGroup; | ||
8045 | |||
7921 | bool positionChanged = false; | 8046 | bool positionChanged = false; |
7922 | LSL_Vector currentPosition = GetPartLocalPos(part); | 8047 | LSL_Vector currentPosition = GetPartLocalPos(part); |
7923 | 8048 | ||
@@ -7957,8 +8082,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7957 | return; | 8082 | return; |
7958 | 8083 | ||
7959 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 8084 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
8085 | SceneObjectPart rootPart = parentgrp.RootPart; | ||
7960 | // try to let this work as in SL... | 8086 | // try to let this work as in SL... |
7961 | if (part.ParentID == 0) | 8087 | if (rootPart == part) |
7962 | { | 8088 | { |
7963 | // special case: If we are root, rotate complete SOG to new rotation | 8089 | // special case: If we are root, rotate complete SOG to new rotation |
7964 | SetRot(part, Rot2Quaternion(q)); | 8090 | SetRot(part, Rot2Quaternion(q)); |
@@ -7966,7 +8092,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7966 | else | 8092 | else |
7967 | { | 8093 | { |
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. | 8094 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
7969 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | 8095 | // sounds like sl bug that we need to replicate |
7970 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | 8096 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
7971 | } | 8097 | } |
7972 | 8098 | ||
@@ -8219,7 +8345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8219 | return; | 8345 | return; |
8220 | 8346 | ||
8221 | string ph = rules.Data[idx++].ToString(); | 8347 | string ph = rules.Data[idx++].ToString(); |
8222 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | 8348 | parentgrp.ScriptSetPhantomStatus(ph.Equals("1")); |
8223 | 8349 | ||
8224 | break; | 8350 | break; |
8225 | 8351 | ||
@@ -8272,7 +8398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8272 | return; | 8398 | return; |
8273 | string temp = rules.Data[idx++].ToString(); | 8399 | string temp = rules.Data[idx++].ToString(); |
8274 | 8400 | ||
8275 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); | 8401 | parentgrp.ScriptSetTemporaryStatus(temp.Equals("1")); |
8276 | 8402 | ||
8277 | break; | 8403 | break; |
8278 | 8404 | ||
@@ -8325,16 +8451,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8325 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8451 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8326 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8452 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8327 | return; | 8453 | return; |
8454 | |||
8455 | // do a pending position change | ||
8456 | if (positionChanged) | ||
8457 | { | ||
8458 | if (parentgrp == null) | ||
8459 | return; | ||
8460 | |||
8461 | if (parentgrp.RootPart == part) | ||
8462 | { | ||
8463 | |||
8464 | Util.FireAndForget(delegate(object x) | ||
8465 | { | ||
8466 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8467 | }); | ||
8468 | } | ||
8469 | else | ||
8470 | { | ||
8471 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8472 | parentgrp.HasGroupChanged = true; | ||
8473 | parentgrp.ScheduleGroupForTerseUpdate(); | ||
8474 | } | ||
8475 | } | ||
8476 | |||
8328 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 8477 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
8329 | LSL_List new_rules = rules.GetSublist(idx, -1); | 8478 | LSL_List new_rules = rules.GetSublist(idx, -1); |
8330 | setLinkPrimParams((int)new_linknumber, new_rules); | 8479 | setLinkPrimParams((int)new_linknumber, new_rules); |
8331 | |||
8332 | return; | 8480 | return; |
8333 | } | 8481 | } |
8334 | } | 8482 | } |
8335 | } | 8483 | } |
8336 | finally | 8484 | finally |
8337 | { | 8485 | { |
8486 | /* | ||
8338 | if (positionChanged) | 8487 | if (positionChanged) |
8339 | { | 8488 | { |
8340 | if (part.ParentGroup.RootPart == part) | 8489 | if (part.ParentGroup.RootPart == part) |
@@ -8352,23 +8501,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8352 | parent.ScheduleGroupForTerseUpdate(); | 8501 | parent.ScheduleGroupForTerseUpdate(); |
8353 | } | 8502 | } |
8354 | } | 8503 | } |
8504 | */ | ||
8355 | } | 8505 | } |
8356 | 8506 | ||
8357 | if (positionChanged) | 8507 | if (positionChanged) |
8358 | { | 8508 | { |
8359 | if (part.ParentGroup.RootPart == part) | 8509 | if (parentgrp == null) |
8510 | return; | ||
8511 | |||
8512 | if (parentgrp.RootPart == part) | ||
8360 | { | 8513 | { |
8361 | SceneObjectGroup parent = part.ParentGroup; | 8514 | |
8362 | Util.FireAndForget(delegate(object x) { | 8515 | Util.FireAndForget(delegate(object x) { |
8363 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | 8516 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); |
8364 | }); | 8517 | }); |
8365 | } | 8518 | } |
8366 | else | 8519 | else |
8367 | { | 8520 | { |
8368 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | 8521 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); |
8369 | SceneObjectGroup parent = part.ParentGroup; | 8522 | parentgrp.HasGroupChanged = true; |
8370 | parent.HasGroupChanged = true; | 8523 | parentgrp.ScheduleGroupForTerseUpdate(); |
8371 | parent.ScheduleGroupForTerseUpdate(); | ||
8372 | } | 8524 | } |
8373 | } | 8525 | } |
8374 | } | 8526 | } |