diff options
author | Diva Canto | 2012-04-06 20:35:01 -0700 |
---|---|---|
committer | Diva Canto | 2012-04-06 20:35:01 -0700 |
commit | 806082cd6eef607791aced965056eb4ce24ac5ce (patch) | |
tree | bda5bbedd106638459f2e6674a674b0d0a25ab73 /OpenSim/Region/ScriptEngine | |
parent | Moved the inventory manipulation from HGEntityTransferModule to HGInventoryAc... (diff) | |
parent | Rather than having a FromFolderID property on every single prim and only ever... (diff) | |
download | opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.zip opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.tar.gz opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.tar.bz2 opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 124 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 10 |
2 files changed, 121 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 8d25a62..291f52e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2022,27 +2022,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2022 | protected LSL_Vector GetPartLocalPos(SceneObjectPart part) | 2022 | protected LSL_Vector GetPartLocalPos(SceneObjectPart part) |
2023 | { | 2023 | { |
2024 | m_host.AddScriptLPS(1); | 2024 | m_host.AddScriptLPS(1); |
2025 | if (part.ParentID == 0) | 2025 | |
2026 | Vector3 pos; | ||
2027 | |||
2028 | if (!part.IsRoot) | ||
2026 | { | 2029 | { |
2027 | return new LSL_Vector(part.AbsolutePosition.X, | 2030 | pos = part.OffsetPosition; |
2028 | part.AbsolutePosition.Y, | ||
2029 | part.AbsolutePosition.Z); | ||
2030 | } | 2031 | } |
2031 | else | 2032 | else |
2032 | { | 2033 | { |
2033 | if (m_host.IsRoot) | 2034 | if (part.ParentGroup.IsAttachment) |
2034 | { | 2035 | { |
2035 | return new LSL_Vector(m_host.AttachedPos.X, | 2036 | pos = part.AttachedPos; |
2036 | m_host.AttachedPos.Y, | ||
2037 | m_host.AttachedPos.Z); | ||
2038 | } | 2037 | } |
2039 | else | 2038 | else |
2040 | { | 2039 | { |
2041 | return new LSL_Vector(part.OffsetPosition.X, | 2040 | pos = part.AbsolutePosition; |
2042 | part.OffsetPosition.Y, | ||
2043 | part.OffsetPosition.Z); | ||
2044 | } | 2041 | } |
2045 | } | 2042 | } |
2043 | |||
2044 | // m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos); | ||
2045 | |||
2046 | return new LSL_Vector(pos.X, pos.Y, pos.Z); | ||
2046 | } | 2047 | } |
2047 | 2048 | ||
2048 | public void llSetRot(LSL_Rotation rot) | 2049 | public void llSetRot(LSL_Rotation rot) |
@@ -2907,7 +2908,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2907 | public LSL_Float llGetMass() | 2908 | public LSL_Float llGetMass() |
2908 | { | 2909 | { |
2909 | m_host.AddScriptLPS(1); | 2910 | m_host.AddScriptLPS(1); |
2910 | return m_host.GetMass(); | 2911 | |
2912 | if (m_host.ParentGroup.IsAttachment) | ||
2913 | { | ||
2914 | ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); | ||
2915 | |||
2916 | if (attachedAvatar != null) | ||
2917 | { | ||
2918 | return attachedAvatar.GetMass(); | ||
2919 | } | ||
2920 | else | ||
2921 | { | ||
2922 | return 0; | ||
2923 | } | ||
2924 | } | ||
2925 | else | ||
2926 | { | ||
2927 | if (m_host.IsRoot) | ||
2928 | { | ||
2929 | return m_host.ParentGroup.GetMass(); | ||
2930 | } | ||
2931 | else | ||
2932 | { | ||
2933 | return m_host.GetMass(); | ||
2934 | } | ||
2935 | } | ||
2911 | } | 2936 | } |
2912 | 2937 | ||
2913 | public void llCollisionFilter(string name, string id, int accept) | 2938 | public void llCollisionFilter(string name, string id, int accept) |
@@ -3055,7 +3080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3055 | SceneObjectPart host = (SceneObjectPart)o; | 3080 | SceneObjectPart host = (SceneObjectPart)o; |
3056 | 3081 | ||
3057 | SceneObjectGroup grp = host.ParentGroup; | 3082 | SceneObjectGroup grp = host.ParentGroup; |
3058 | UUID itemID = grp.GetFromItemID(); | 3083 | UUID itemID = grp.FromItemID; |
3059 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | 3084 | ScenePresence presence = World.GetScenePresence(host.OwnerID); |
3060 | 3085 | ||
3061 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3086 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
@@ -7146,6 +7171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7146 | switch (code) | 7171 | switch (code) |
7147 | { | 7172 | { |
7148 | case (int)ScriptBaseClass.PRIM_POSITION: | 7173 | case (int)ScriptBaseClass.PRIM_POSITION: |
7174 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
7149 | if (remain < 1) | 7175 | if (remain < 1) |
7150 | return; | 7176 | return; |
7151 | 7177 | ||
@@ -10330,6 +10356,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10330 | case ScriptBaseClass.OBJECT_CREATOR: | 10356 | case ScriptBaseClass.OBJECT_CREATOR: |
10331 | ret.Add(new LSL_String(UUID.Zero.ToString())); | 10357 | ret.Add(new LSL_String(UUID.Zero.ToString())); |
10332 | break; | 10358 | break; |
10359 | // For the following 8 see the Object version below | ||
10360 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | ||
10361 | ret.Add(new LSL_Integer(0)); | ||
10362 | break; | ||
10363 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | ||
10364 | ret.Add(new LSL_Integer(0)); | ||
10365 | break; | ||
10366 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | ||
10367 | ret.Add(new LSL_Integer(0)); | ||
10368 | break; | ||
10369 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | ||
10370 | ret.Add(new LSL_Float(0)); | ||
10371 | break; | ||
10372 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | ||
10373 | ret.Add(new LSL_Integer(0)); | ||
10374 | break; | ||
10375 | case ScriptBaseClass.OBJECT_SERVER_COST: | ||
10376 | ret.Add(new LSL_Float(0)); | ||
10377 | break; | ||
10378 | case ScriptBaseClass.OBJECT_STREAMING_COST: | ||
10379 | ret.Add(new LSL_Float(0)); | ||
10380 | break; | ||
10381 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | ||
10382 | ret.Add(new LSL_Float(0)); | ||
10383 | break; | ||
10384 | default: | ||
10385 | // Invalid or unhandled constant. | ||
10386 | ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); | ||
10387 | break; | ||
10333 | } | 10388 | } |
10334 | } | 10389 | } |
10335 | 10390 | ||
@@ -10367,6 +10422,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10367 | case ScriptBaseClass.OBJECT_CREATOR: | 10422 | case ScriptBaseClass.OBJECT_CREATOR: |
10368 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 10423 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
10369 | break; | 10424 | break; |
10425 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
10426 | // "Land Impact" calculations. These calculations are probably not applicable | ||
10427 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
10428 | // I have intentionally left these all at zero rather than return possibly | ||
10429 | // missleading numbers | ||
10430 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | ||
10431 | // in SL this currently includes crashed scripts | ||
10432 | ret.Add(new LSL_Integer(0)); | ||
10433 | break; | ||
10434 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | ||
10435 | ret.Add(new LSL_Integer(0)); | ||
10436 | break; | ||
10437 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | ||
10438 | // The value returned in SL for mono scripts is 65536 * number of active scripts | ||
10439 | ret.Add(new LSL_Integer(0)); | ||
10440 | break; | ||
10441 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | ||
10442 | // Average cpu time per simulator frame expended on all scripts in the objetc | ||
10443 | ret.Add(new LSL_Float(0)); | ||
10444 | break; | ||
10445 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | ||
10446 | // according to the SL wiki A prim or linkset will have prim | ||
10447 | // equivalent of the number of prims in a linkset if it does not | ||
10448 | // contain a mesh anywhere in the link set or is not a normal prim | ||
10449 | // The value returned in SL for normal prims is prim count | ||
10450 | ret.Add(new LSL_Integer(0)); | ||
10451 | break; | ||
10452 | case ScriptBaseClass.OBJECT_SERVER_COST: | ||
10453 | // The value returned in SL for normal prims is prim count | ||
10454 | ret.Add(new LSL_Float(0)); | ||
10455 | break; | ||
10456 | case ScriptBaseClass.OBJECT_STREAMING_COST: | ||
10457 | // The value returned in SL for normal prims is prim count * 0.06 | ||
10458 | ret.Add(new LSL_Float(0)); | ||
10459 | break; | ||
10460 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | ||
10461 | // The value returned in SL for normal prims is prim count | ||
10462 | ret.Add(new LSL_Float(0)); | ||
10463 | break; | ||
10464 | default: | ||
10465 | // Invalid or unhandled constant. | ||
10466 | ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); | ||
10467 | break; | ||
10370 | } | 10468 | } |
10371 | } | 10469 | } |
10372 | 10470 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 5a53e15..f58f9d6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -479,6 +479,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
479 | public const int DEBUG_CHANNEL = 0x7FFFFFFF; | 479 | public const int DEBUG_CHANNEL = 0x7FFFFFFF; |
480 | public const int PUBLIC_CHANNEL = 0x00000000; | 480 | public const int PUBLIC_CHANNEL = 0x00000000; |
481 | 481 | ||
482 | // Constants for llGetObjectDetails | ||
483 | public const int OBJECT_UNKNOWN_DETAIL = -1; | ||
482 | public const int OBJECT_NAME = 1; | 484 | public const int OBJECT_NAME = 1; |
483 | public const int OBJECT_DESC = 2; | 485 | public const int OBJECT_DESC = 2; |
484 | public const int OBJECT_POS = 3; | 486 | public const int OBJECT_POS = 3; |
@@ -487,6 +489,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
487 | public const int OBJECT_OWNER = 6; | 489 | public const int OBJECT_OWNER = 6; |
488 | public const int OBJECT_GROUP = 7; | 490 | public const int OBJECT_GROUP = 7; |
489 | public const int OBJECT_CREATOR = 8; | 491 | public const int OBJECT_CREATOR = 8; |
492 | public const int OBJECT_RUNNING_SCRIPT_COUNT = 9; | ||
493 | public const int OBJECT_TOTAL_SCRIPT_COUNT = 10; | ||
494 | public const int OBJECT_SCRIPT_MEMORY = 11; | ||
495 | public const int OBJECT_SCRIPT_TIME = 12; | ||
496 | public const int OBJECT_PRIM_EQUIVALENCE = 13; | ||
497 | public const int OBJECT_SERVER_COST = 14; | ||
498 | public const int OBJECT_STREAMING_COST = 15; | ||
499 | public const int OBJECT_PHYSICS_COST = 16; | ||
490 | 500 | ||
491 | // Can not be public const? | 501 | // Can not be public const? |
492 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); | 502 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); |