aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2012-04-07 04:52:14 +0100
committerMelanie2012-04-07 04:52:14 +0100
commitb39de2425cac4c2a94a7fdd6c77100ef831d66b4 (patch)
tree9258928681a82d68b408354e534c32bcf283ad3a /OpenSim/Region/ScriptEngine
parentMerge branch 'ubitwork' (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.zip
opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.gz
opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.bz2
opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs OpenSim/Region/CoreModules/World/Land/LandObject.cs OpenSim/Region/Framework/Scenes/Scene.Inventory.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs125
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs10
2 files changed, 118 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5268ade..7cf284d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2271,11 +2271,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2271 protected LSL_Vector GetPartLocalPos(SceneObjectPart part) 2271 protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
2272 { 2272 {
2273 m_host.AddScriptLPS(1); 2273 m_host.AddScriptLPS(1);
2274 if (part.ParentID == 0) 2274
2275 Vector3 pos;
2276
2277 if (!part.IsRoot)
2275 { 2278 {
2276 return new LSL_Vector(part.AbsolutePosition.X, 2279 pos = part.OffsetPosition;
2277 part.AbsolutePosition.Y,
2278 part.AbsolutePosition.Z);
2279 } 2280 }
2280 else 2281 else
2281 { 2282 {
@@ -2287,11 +2288,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2287 } 2288 }
2288 else 2289 else
2289 { 2290 {
2290 return new LSL_Vector(part.OffsetPosition.X, 2291 pos = part.AbsolutePosition;
2291 part.OffsetPosition.Y,
2292 part.OffsetPosition.Z);
2293 } 2292 }
2294 } 2293 }
2294
2295// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
2296
2297 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2295 } 2298 }
2296 2299
2297 public void llSetRot(LSL_Rotation rot) 2300 public void llSetRot(LSL_Rotation rot)
@@ -3165,7 +3168,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3165 public LSL_Float llGetMass() 3168 public LSL_Float llGetMass()
3166 { 3169 {
3167 m_host.AddScriptLPS(1); 3170 m_host.AddScriptLPS(1);
3168 return m_host.GetMass(); 3171
3172 if (m_host.ParentGroup.IsAttachment)
3173 {
3174 ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
3175
3176 if (attachedAvatar != null)
3177 {
3178 return attachedAvatar.GetMass();
3179 }
3180 else
3181 {
3182 return 0;
3183 }
3184 }
3185 else
3186 {
3187 if (m_host.IsRoot)
3188 {
3189 return m_host.ParentGroup.GetMass();
3190 }
3191 else
3192 {
3193 return m_host.GetMass();
3194 }
3195 }
3169 } 3196 }
3170 3197
3171 public void llCollisionFilter(string name, string id, int accept) 3198 public void llCollisionFilter(string name, string id, int accept)
@@ -3334,7 +3361,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3334 SceneObjectPart host = (SceneObjectPart)o; 3361 SceneObjectPart host = (SceneObjectPart)o;
3335 3362
3336 SceneObjectGroup grp = host.ParentGroup; 3363 SceneObjectGroup grp = host.ParentGroup;
3337 UUID itemID = grp.GetFromItemID(); 3364 UUID itemID = grp.FromItemID;
3338 ScenePresence presence = World.GetScenePresence(host.OwnerID); 3365 ScenePresence presence = World.GetScenePresence(host.OwnerID);
3339 3366
3340 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3367 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
@@ -7782,14 +7809,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7782 switch (code) 7809 switch (code)
7783 { 7810 {
7784 case (int)ScriptBaseClass.PRIM_POSITION: 7811 case (int)ScriptBaseClass.PRIM_POSITION:
7785 if (remain < 1)
7786 return;
7787
7788 v=rules.GetVector3Item(idx++);
7789 positionChanged = true;
7790 currentPosition = GetSetPosTarget(part, v, currentPosition);
7791
7792 break;
7793 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 7812 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
7794 if (remain < 1) 7813 if (remain < 1)
7795 return; 7814 return;
@@ -11154,6 +11173,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11154 case ScriptBaseClass.OBJECT_CREATOR: 11173 case ScriptBaseClass.OBJECT_CREATOR:
11155 ret.Add(new LSL_String(UUID.Zero.ToString())); 11174 ret.Add(new LSL_String(UUID.Zero.ToString()));
11156 break; 11175 break;
11176 // For the following 8 see the Object version below
11177 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
11178 ret.Add(new LSL_Integer(0));
11179 break;
11180 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
11181 ret.Add(new LSL_Integer(0));
11182 break;
11183 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
11184 ret.Add(new LSL_Integer(0));
11185 break;
11186 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
11187 ret.Add(new LSL_Float(0));
11188 break;
11189 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
11190 ret.Add(new LSL_Integer(0));
11191 break;
11192 case ScriptBaseClass.OBJECT_SERVER_COST:
11193 ret.Add(new LSL_Float(0));
11194 break;
11195 case ScriptBaseClass.OBJECT_STREAMING_COST:
11196 ret.Add(new LSL_Float(0));
11197 break;
11198 case ScriptBaseClass.OBJECT_PHYSICS_COST:
11199 ret.Add(new LSL_Float(0));
11200 break;
11201 default:
11202 // Invalid or unhandled constant.
11203 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
11204 break;
11157 } 11205 }
11158 } 11206 }
11159 11207
@@ -11191,6 +11239,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11191 case ScriptBaseClass.OBJECT_CREATOR: 11239 case ScriptBaseClass.OBJECT_CREATOR:
11192 ret.Add(new LSL_String(obj.CreatorID.ToString())); 11240 ret.Add(new LSL_String(obj.CreatorID.ToString()));
11193 break; 11241 break;
11242 // The following 8 I have intentionaly coded to return zero. They are part of
11243 // "Land Impact" calculations. These calculations are probably not applicable
11244 // to OpenSim, required figures (cpu/memory usage) are not currently tracked
11245 // I have intentionally left these all at zero rather than return possibly
11246 // missleading numbers
11247 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
11248 // in SL this currently includes crashed scripts
11249 ret.Add(new LSL_Integer(0));
11250 break;
11251 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
11252 ret.Add(new LSL_Integer(0));
11253 break;
11254 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
11255 // The value returned in SL for mono scripts is 65536 * number of active scripts
11256 ret.Add(new LSL_Integer(0));
11257 break;
11258 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
11259 // Average cpu time per simulator frame expended on all scripts in the objetc
11260 ret.Add(new LSL_Float(0));
11261 break;
11262 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
11263 // according to the SL wiki A prim or linkset will have prim
11264 // equivalent of the number of prims in a linkset if it does not
11265 // contain a mesh anywhere in the link set or is not a normal prim
11266 // The value returned in SL for normal prims is prim count
11267 ret.Add(new LSL_Integer(0));
11268 break;
11269 case ScriptBaseClass.OBJECT_SERVER_COST:
11270 // The value returned in SL for normal prims is prim count
11271 ret.Add(new LSL_Float(0));
11272 break;
11273 case ScriptBaseClass.OBJECT_STREAMING_COST:
11274 // The value returned in SL for normal prims is prim count * 0.06
11275 ret.Add(new LSL_Float(0));
11276 break;
11277 case ScriptBaseClass.OBJECT_PHYSICS_COST:
11278 // The value returned in SL for normal prims is prim count
11279 ret.Add(new LSL_Float(0));
11280 break;
11281 default:
11282 // Invalid or unhandled constant.
11283 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
11284 break;
11194 } 11285 }
11195 } 11286 }
11196 11287
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 4ce3cf1..6246b57 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -481,6 +481,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
481 public const int DEBUG_CHANNEL = 0x7FFFFFFF; 481 public const int DEBUG_CHANNEL = 0x7FFFFFFF;
482 public const int PUBLIC_CHANNEL = 0x00000000; 482 public const int PUBLIC_CHANNEL = 0x00000000;
483 483
484 // Constants for llGetObjectDetails
485 public const int OBJECT_UNKNOWN_DETAIL = -1;
484 public const int OBJECT_NAME = 1; 486 public const int OBJECT_NAME = 1;
485 public const int OBJECT_DESC = 2; 487 public const int OBJECT_DESC = 2;
486 public const int OBJECT_POS = 3; 488 public const int OBJECT_POS = 3;
@@ -489,6 +491,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
489 public const int OBJECT_OWNER = 6; 491 public const int OBJECT_OWNER = 6;
490 public const int OBJECT_GROUP = 7; 492 public const int OBJECT_GROUP = 7;
491 public const int OBJECT_CREATOR = 8; 493 public const int OBJECT_CREATOR = 8;
494 public const int OBJECT_RUNNING_SCRIPT_COUNT = 9;
495 public const int OBJECT_TOTAL_SCRIPT_COUNT = 10;
496 public const int OBJECT_SCRIPT_MEMORY = 11;
497 public const int OBJECT_SCRIPT_TIME = 12;
498 public const int OBJECT_PRIM_EQUIVALENCE = 13;
499 public const int OBJECT_SERVER_COST = 14;
500 public const int OBJECT_STREAMING_COST = 15;
501 public const int OBJECT_PHYSICS_COST = 16;
492 502
493 // Can not be public const? 503 // Can not be public const?
494 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); 504 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);