aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2018-11-18 22:39:08 +0000
committerUbitUmarov2018-11-18 22:39:08 +0000
commit01b84ef46b73510e6f5c24b1e0fba1967bfbc608 (patch)
tree475a825a6fa6da0256e05513ca7bbc1309bd838a /OpenSim/Region
parentupdate osslEnable (diff)
downloadopensim-SC-01b84ef46b73510e6f5c24b1e0fba1967bfbc608.zip
opensim-SC-01b84ef46b73510e6f5c24b1e0fba1967bfbc608.tar.gz
opensim-SC-01b84ef46b73510e6f5c24b1e0fba1967bfbc608.tar.bz2
opensim-SC-01b84ef46b73510e6f5c24b1e0fba1967bfbc608.tar.xz
some cleanup
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs774
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs6
3 files changed, 391 insertions, 397 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a72d4e9..f103de2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -12963,33 +12963,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12963 m_host.SetForceMouselook(mouselook != 0); 12963 m_host.SetForceMouselook(mouselook != 0);
12964 } 12964 }
12965 12965
12966 public LSL_Float llGetObjectMass(string id) 12966 public LSL_Float llGetObjectMass(LSL_Key id)
12967 { 12967 {
12968 m_host.AddScriptLPS(1); 12968 m_host.AddScriptLPS(1);
12969 UUID key = new UUID(); 12969 UUID key = new UUID();
12970 if (UUID.TryParse(id, out key)) 12970 if (!UUID.TryParse(id, out key))
12971 { 12971 return 0;
12972 // return total object mass
12973 SceneObjectPart part = World.GetSceneObjectPart(key);
12974 if (part != null)
12975 return part.ParentGroup.GetMass();
12976 12972
12977 // the object is null so the key is for an avatar 12973 // return total object mass
12978 ScenePresence avatar = World.GetScenePresence(key); 12974 SceneObjectPart part = World.GetSceneObjectPart(key);
12979 if (avatar != null) 12975 if (part != null)
12976 return part.ParentGroup.GetMass();
12977
12978 // the object is null so the key is for an avatar
12979 ScenePresence avatar = World.GetScenePresence(key);
12980 if (avatar != null)
12981 {
12982 if (avatar.IsChildAgent)
12980 { 12983 {
12981 if (avatar.IsChildAgent) 12984 // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
12982 { 12985 // child agents have a mass of 1.0
12983 // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass 12986 return 1;
12984 // child agents have a mass of 1.0 12987 }
12985 return 1; 12988 else
12986 } 12989 {
12987 else 12990 return avatar.GetMass();
12988 {
12989 return (double)avatar.GetMass();
12990 }
12991 } 12991 }
12992 } 12992 }
12993
12993 return 0; 12994 return 0;
12994 } 12995 }
12995 12996
@@ -14197,18 +14198,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14197 return ret; 14198 return ret;
14198 } 14199 }
14199 14200
14200 public LSL_Integer llGetObjectPrimCount(string object_id) 14201 public LSL_Integer llGetObjectPrimCount(LSL_Key object_id)
14201 { 14202 {
14202 m_host.AddScriptLPS(1); 14203 m_host.AddScriptLPS(1);
14203 SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id)); 14204 UUID id;
14205 if(!UUID.TryParse(object_id, out id))
14206 return 0;
14207
14208 SceneObjectPart part = World.GetSceneObjectPart(id);
14204 if (part == null) 14209 if (part == null)
14205 {
14206 return 0; 14210 return 0;
14207 } 14211
14208 else 14212 return part.ParentGroup.PrimCount;
14209 {
14210 return part.ParentGroup.PrimCount;
14211 }
14212 } 14213 }
14213 14214
14214 public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) 14215 public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
@@ -14265,406 +14266,399 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14265 return ret; 14266 return ret;
14266 } 14267 }
14267 14268
14268 public LSL_String llStringTrim(string src, int type) 14269 public LSL_String llStringTrim(LSL_String src, LSL_Integer type)
14269 { 14270 {
14270 m_host.AddScriptLPS(1); 14271 m_host.AddScriptLPS(1);
14271 if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); } 14272 if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return ((string)src).TrimStart(); }
14272 if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return src.TrimEnd(); } 14273 if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return ((string)src).TrimEnd(); }
14273 if (type == (int)ScriptBaseClass.STRING_TRIM) { return src.Trim(); } 14274 if (type == (int)ScriptBaseClass.STRING_TRIM) { return ((string)src).Trim(); }
14274 return src; 14275 return src;
14275 } 14276 }
14276 14277
14277 public LSL_List llGetObjectDetails(string id, LSL_List args) 14278 public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args)
14278 { 14279 {
14279 m_host.AddScriptLPS(1); 14280 m_host.AddScriptLPS(1);
14280
14281 LSL_List ret = new LSL_List(); 14281 LSL_List ret = new LSL_List();
14282 UUID key = new UUID(); 14282 UUID key = new UUID();
14283 if (!UUID.TryParse(id, out key))
14284 return ret;
14283 14285
14284 14286 ScenePresence av = World.GetScenePresence(key);
14285 if (UUID.TryParse(id, out key)) 14287 if (av != null)
14286 { 14288 {
14287 ScenePresence av = World.GetScenePresence(key); 14289 foreach (object o in args.Data)
14288
14289 if (av != null)
14290 { 14290 {
14291 foreach (object o in args.Data) 14291 switch (int.Parse(o.ToString()))
14292 { 14292 {
14293 switch (int.Parse(o.ToString())) 14293 case ScriptBaseClass.OBJECT_NAME:
14294 { 14294 ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
14295 case ScriptBaseClass.OBJECT_NAME: 14295 break;
14296 ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); 14296 case ScriptBaseClass.OBJECT_DESC:
14297 break; 14297 ret.Add(new LSL_String(""));
14298 case ScriptBaseClass.OBJECT_DESC: 14298 break;
14299 ret.Add(new LSL_String("")); 14299 case ScriptBaseClass.OBJECT_POS:
14300 break; 14300 Vector3 avpos;
14301 case ScriptBaseClass.OBJECT_POS:
14302 Vector3 avpos;
14303
14304 if (av.ParentID != 0 && av.ParentPart != null &&
14305 av.ParentPart.ParentGroup != null && av.ParentPart.ParentGroup.RootPart != null )
14306 {
14307 avpos = av.OffsetPosition;
14308
14309 if(!av.LegacySitOffsets)
14310 {
14311 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f);
14312 avpos -= sitOffset;
14313 }
14314 14301
14315 SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart; 14302 if (av.ParentID != 0 && av.ParentPart != null &&
14316 avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation(); 14303 av.ParentPart.ParentGroup != null && av.ParentPart.ParentGroup.RootPart != null )
14317 } 14304 {
14318 else 14305 avpos = av.OffsetPosition;
14319 avpos = av.AbsolutePosition;
14320 14306
14321 ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); 14307 if(!av.LegacySitOffsets)
14322 break;
14323 case ScriptBaseClass.OBJECT_ROT:
14324 Quaternion avrot = av.GetWorldRotation();
14325 ret.Add(new LSL_Rotation(avrot));
14326 break;
14327 case ScriptBaseClass.OBJECT_VELOCITY:
14328 Vector3 avvel = av.GetWorldVelocity();
14329 ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
14330 break;
14331 case ScriptBaseClass.OBJECT_OWNER:
14332 ret.Add(new LSL_String(id));
14333 break;
14334 case ScriptBaseClass.OBJECT_GROUP:
14335 ret.Add(new LSL_String(UUID.Zero.ToString()));
14336 break;
14337 case ScriptBaseClass.OBJECT_CREATOR:
14338 ret.Add(new LSL_String(UUID.Zero.ToString()));
14339 break;
14340 // For the following 8 see the Object version below
14341 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
14342 ret.Add(new LSL_Integer(av.RunningScriptCount()));
14343 break;
14344 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
14345 ret.Add(new LSL_Integer(av.ScriptCount()));
14346 break;
14347 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
14348 ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
14349 break;
14350 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
14351 ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f));
14352 break;
14353 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
14354 ret.Add(new LSL_Integer(1));
14355 break;
14356 case ScriptBaseClass.OBJECT_SERVER_COST:
14357 ret.Add(new LSL_Float(0));
14358 break;
14359 case ScriptBaseClass.OBJECT_STREAMING_COST:
14360 ret.Add(new LSL_Float(0));
14361 break;
14362 case ScriptBaseClass.OBJECT_PHYSICS_COST:
14363 ret.Add(new LSL_Float(0));
14364 break;
14365 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
14366 ret.Add(new LSL_Float(0));
14367 break;
14368 case ScriptBaseClass.OBJECT_ROOT:
14369 SceneObjectPart p = av.ParentPart;
14370 if (p != null)
14371 { 14308 {
14372 ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString())); 14309 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f);
14310 avpos -= sitOffset;
14373 } 14311 }
14374 else 14312
14313 SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart;
14314 avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation();
14315 }
14316 else
14317 avpos = av.AbsolutePosition;
14318
14319 ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z));
14320 break;
14321 case ScriptBaseClass.OBJECT_ROT:
14322 Quaternion avrot = av.GetWorldRotation();
14323 ret.Add(new LSL_Rotation(avrot));
14324 break;
14325 case ScriptBaseClass.OBJECT_VELOCITY:
14326 Vector3 avvel = av.GetWorldVelocity();
14327 ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
14328 break;
14329 case ScriptBaseClass.OBJECT_OWNER:
14330 ret.Add(new LSL_Key((string)id));
14331 break;
14332 case ScriptBaseClass.OBJECT_GROUP:
14333 ret.Add(new LSL_String(UUID.Zero.ToString()));
14334 break;
14335 case ScriptBaseClass.OBJECT_CREATOR:
14336 ret.Add(new LSL_Key(UUID.Zero.ToString()));
14337 break;
14338 // For the following 8 see the Object version below
14339 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
14340 ret.Add(new LSL_Integer(av.RunningScriptCount()));
14341 break;
14342 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
14343 ret.Add(new LSL_Integer(av.ScriptCount()));
14344 break;
14345 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
14346 ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
14347 break;
14348 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
14349 ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f));
14350 break;
14351 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
14352 ret.Add(new LSL_Integer(1));
14353 break;
14354 case ScriptBaseClass.OBJECT_SERVER_COST:
14355 ret.Add(new LSL_Float(0));
14356 break;
14357 case ScriptBaseClass.OBJECT_STREAMING_COST:
14358 ret.Add(new LSL_Float(0));
14359 break;
14360 case ScriptBaseClass.OBJECT_PHYSICS_COST:
14361 ret.Add(new LSL_Float(0));
14362 break;
14363 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
14364 ret.Add(new LSL_Float(0));
14365 break;
14366 case ScriptBaseClass.OBJECT_ROOT:
14367 SceneObjectPart p = av.ParentPart;
14368 if (p != null)
14369 {
14370 ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
14371 }
14372 else
14373 {
14374 ret.Add(new LSL_Key((string)id));
14375 }
14376 break;
14377 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
14378 ret.Add(new LSL_Integer(0));
14379 break;
14380 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
14381 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
14382 break;
14383 case ScriptBaseClass.OBJECT_PHYSICS:
14384 ret.Add(new LSL_Integer(0));
14385 break;
14386 case ScriptBaseClass.OBJECT_PHANTOM:
14387 ret.Add(new LSL_Integer(0));
14388 break;
14389 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
14390 ret.Add(new LSL_Integer(0));
14391 break;
14392 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
14393 ret.Add(new LSL_Integer(-1));
14394 break;
14395 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
14396 ret.Add(new LSL_Float(0));
14397 break;
14398 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
14399 LSL_Float shapeType;
14400 if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0)
14401 shapeType = new LSL_Float(1);
14402 else
14403 shapeType = new LSL_Float(0);
14404 ret.Add(shapeType);
14405 break;
14406 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
14407 ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
14408 break;
14409 case ScriptBaseClass.OBJECT_CLICK_ACTION:
14410 ret.Add(new LSL_Integer(0));
14411 break;
14412 case ScriptBaseClass.OBJECT_OMEGA:
14413 ret.Add(new LSL_Vector(Vector3.Zero));
14414 break;
14415 case ScriptBaseClass.OBJECT_PRIM_COUNT:
14416 List<SceneObjectGroup> Attachments = av.GetAttachments();
14417 int count = 0;
14418 try
14419 {
14420 foreach (SceneObjectGroup Attachment in Attachments)
14421 count += Attachment.PrimCount;
14422 } catch { };
14423 ret.Add(new LSL_Integer(count));
14424 break;
14425 case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
14426 List<SceneObjectGroup> invAttachments = av.GetAttachments();
14427 int invcount = 0;
14428 try
14429 {
14430 foreach (SceneObjectGroup Attachment in invAttachments)
14375 { 14431 {
14376 ret.Add(new LSL_String(id)); 14432 SceneObjectPart[] parts = Attachment.Parts;
14433 int nparts = parts.Count();
14434 for(int i = 0; i < nparts; i++)
14435 invcount += parts[i].Inventory.Count;
14377 } 14436 }
14378 break; 14437 } catch { };
14379 case ScriptBaseClass.OBJECT_ATTACHED_POINT: 14438 ret.Add(new LSL_Integer(invcount));
14380 ret.Add(new LSL_Integer(0)); 14439 break;
14381 break; 14440 case ScriptBaseClass.OBJECT_REZZER_KEY:
14382 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding 14441 ret.Add(new LSL_Key((string)id));
14383 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR)); 14442 break;
14384 break; 14443 case ScriptBaseClass.OBJECT_GROUP_TAG:
14385 case ScriptBaseClass.OBJECT_PHYSICS: 14444 ret.Add(new LSL_String(av.Grouptitle));
14386 ret.Add(new LSL_Integer(0)); 14445 break;
14387 break; 14446 case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
14388 case ScriptBaseClass.OBJECT_PHANTOM: 14447 ret.Add(new LSL_Integer(0));
14389 ret.Add(new LSL_Integer(0)); 14448 break;
14390 break; 14449 default:
14391 case ScriptBaseClass.OBJECT_TEMP_ON_REZ: 14450 // Invalid or unhandled constant.
14392 ret.Add(new LSL_Integer(0)); 14451 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
14393 break; 14452 break;
14394 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
14395 ret.Add(new LSL_Integer(-1));
14396 break;
14397 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
14398 ret.Add(new LSL_Float(0));
14399 break;
14400 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
14401 LSL_Float shapeType;
14402 if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0)
14403 shapeType = new LSL_Float(1);
14404 else
14405 shapeType = new LSL_Float(0);
14406 ret.Add(shapeType);
14407 break;
14408 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
14409 ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
14410 break;
14411 case ScriptBaseClass.OBJECT_CLICK_ACTION:
14412 ret.Add(new LSL_Integer(0));
14413 break;
14414 case ScriptBaseClass.OBJECT_OMEGA:
14415 ret.Add(new LSL_Vector(Vector3.Zero));
14416 break;
14417 case ScriptBaseClass.OBJECT_PRIM_COUNT:
14418 List<SceneObjectGroup> Attachments = av.GetAttachments();
14419 int count = 0;
14420 try
14421 {
14422 foreach (SceneObjectGroup Attachment in Attachments)
14423 count += Attachment.PrimCount;
14424 } catch { };
14425 ret.Add(new LSL_Integer(count));
14426 break;
14427 case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
14428 List<SceneObjectGroup> invAttachments = av.GetAttachments();
14429 int invcount = 0;
14430 try
14431 {
14432 foreach (SceneObjectGroup Attachment in invAttachments)
14433 {
14434 SceneObjectPart[] parts = Attachment.Parts;
14435 int nparts = parts.Count();
14436 for(int i = 0; i < nparts; i++)
14437 invcount += parts[i].Inventory.Count;
14438 }
14439 } catch { };
14440 ret.Add(new LSL_Integer(invcount));
14441 break;
14442 case ScriptBaseClass.OBJECT_REZZER_KEY:
14443 ret.Add(new LSL_Key(id));
14444 break;
14445 case ScriptBaseClass.OBJECT_GROUP_TAG:
14446 ret.Add(new LSL_String(av.Grouptitle));
14447 break;
14448 case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
14449 ret.Add(new LSL_Integer(0));
14450 break;
14451 default:
14452 // Invalid or unhandled constant.
14453 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
14454 break;
14455 }
14456 } 14453 }
14457
14458 return ret;
14459 } 14454 }
14455 return ret;
14456 }
14460 14457
14461 SceneObjectPart obj = World.GetSceneObjectPart(key); 14458 SceneObjectPart obj = World.GetSceneObjectPart(key);
14462 if (obj != null) 14459 if (obj != null)
14460 {
14461 foreach (object o in args.Data)
14463 { 14462 {
14464 foreach (object o in args.Data) 14463 switch (int.Parse(o.ToString()))
14465 { 14464 {
14466 switch (int.Parse(o.ToString())) 14465 case ScriptBaseClass.OBJECT_NAME:
14467 { 14466 ret.Add(new LSL_String(obj.Name));
14468 case ScriptBaseClass.OBJECT_NAME: 14467 break;
14469 ret.Add(new LSL_String(obj.Name)); 14468 case ScriptBaseClass.OBJECT_DESC:
14470 break; 14469 ret.Add(new LSL_String(obj.Description));
14471 case ScriptBaseClass.OBJECT_DESC: 14470 break;
14472 ret.Add(new LSL_String(obj.Description)); 14471 case ScriptBaseClass.OBJECT_POS:
14473 break; 14472 Vector3 opos = obj.AbsolutePosition;
14474 case ScriptBaseClass.OBJECT_POS: 14473 ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
14475 Vector3 opos = obj.AbsolutePosition; 14474 break;
14476 ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); 14475 case ScriptBaseClass.OBJECT_ROT:
14477 break; 14476 Quaternion rot = Quaternion.Identity;
14478 case ScriptBaseClass.OBJECT_ROT:
14479 Quaternion rot = Quaternion.Identity;
14480 14477
14481 if (obj.ParentGroup.IsAttachment) 14478 if (obj.ParentGroup.IsAttachment)
14482 { 14479 {
14483 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); 14480 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
14484 14481
14485 if (sp != null) 14482 if (sp != null)
14486 rot = sp.GetWorldRotation(); 14483 rot = sp.GetWorldRotation();
14487 } 14484 }
14485 else
14486 {
14487 if (obj.ParentGroup.RootPart == obj)
14488 rot = obj.ParentGroup.GroupRotation;
14488 else 14489 else
14489 { 14490 rot = obj.GetWorldRotation();
14490 if (obj.ParentGroup.RootPart == obj) 14491 }
14491 rot = obj.ParentGroup.GroupRotation;
14492 else
14493 rot = obj.GetWorldRotation();
14494 }
14495 14492
14496 LSL_Rotation objrot = new LSL_Rotation(rot); 14493 LSL_Rotation objrot = new LSL_Rotation(rot);
14497 ret.Add(objrot); 14494 ret.Add(objrot);
14498 14495
14499 break; 14496 break;
14500 case ScriptBaseClass.OBJECT_VELOCITY: 14497 case ScriptBaseClass.OBJECT_VELOCITY:
14501 Vector3 vel = Vector3.Zero; 14498 Vector3 vel = Vector3.Zero;
14502 14499
14503 if (obj.ParentGroup.IsAttachment) 14500 if (obj.ParentGroup.IsAttachment)
14504 { 14501 {
14505 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); 14502 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
14506 14503
14507 if (sp != null) 14504 if (sp != null)
14508 vel = sp.GetWorldVelocity(); 14505 vel = sp.GetWorldVelocity();
14509 } 14506 }
14510 else 14507 else
14511 { 14508 {
14512 vel = obj.Velocity; 14509 vel = obj.Velocity;
14513 } 14510 }
14514 14511
14515 ret.Add(vel); 14512 ret.Add(vel);
14516 break; 14513 break;
14517 case ScriptBaseClass.OBJECT_OWNER: 14514 case ScriptBaseClass.OBJECT_OWNER:
14518 ret.Add(new LSL_String(obj.OwnerID.ToString())); 14515 ret.Add(new LSL_String(obj.OwnerID.ToString()));
14519 break; 14516 break;
14520 case ScriptBaseClass.OBJECT_GROUP: 14517 case ScriptBaseClass.OBJECT_GROUP:
14521 ret.Add(new LSL_String(obj.GroupID.ToString())); 14518 ret.Add(new LSL_String(obj.GroupID.ToString()));
14522 break; 14519 break;
14523 case ScriptBaseClass.OBJECT_CREATOR: 14520 case ScriptBaseClass.OBJECT_CREATOR:
14524 ret.Add(new LSL_String(obj.CreatorID.ToString())); 14521 ret.Add(new LSL_String(obj.CreatorID.ToString()));
14525 break; 14522 break;
14526 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: 14523 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
14527 ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); 14524 ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount()));
14528 break; 14525 break;
14529 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: 14526 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
14530 ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); 14527 ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount()));
14531 break; 14528 break;
14532 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: 14529 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
14533 // The value returned in SL for mono scripts is 65536 * number of active scripts 14530 // The value returned in SL for mono scripts is 65536 * number of active scripts
14534 // and 16384 * number of active scripts for LSO. since llGetFreememory 14531 // and 16384 * number of active scripts for LSO. since llGetFreememory
14535 // is coded to give the LSO value use it here 14532 // is coded to give the LSO value use it here
14536 ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); 14533 ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
14537 break; 14534 break;
14538 case ScriptBaseClass.OBJECT_SCRIPT_TIME: 14535 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
14539 // Average cpu time in seconds per simulator frame expended on all scripts in the object 14536 // Average cpu time in seconds per simulator frame expended on all scripts in the object
14540 ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); 14537 ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f));
14541 break; 14538 break;
14542 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: 14539 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
14543 // according to the SL wiki A prim or linkset will have prim 14540 // according to the SL wiki A prim or linkset will have prim
14544 // equivalent of the number of prims in a linkset if it does not 14541 // equivalent of the number of prims in a linkset if it does not
14545 // contain a mesh anywhere in the link set or is not a normal prim 14542 // contain a mesh anywhere in the link set or is not a normal prim
14546 // The value returned in SL for normal prims is prim count 14543 // The value returned in SL for normal prims is prim count
14547 ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); 14544 ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
14548 break; 14545 break;
14549 14546
14550 // costs below may need to be diferent for root parts, need to check 14547 // costs below may need to be diferent for root parts, need to check
14551 case ScriptBaseClass.OBJECT_SERVER_COST: 14548 case ScriptBaseClass.OBJECT_SERVER_COST:
14552 // The linden calculation is here 14549 // The linden calculation is here
14553 // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight 14550 // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight
14554 // The value returned in SL for normal prims looks like the prim count 14551 // The value returned in SL for normal prims looks like the prim count
14555 ret.Add(new LSL_Float(0)); 14552 ret.Add(new LSL_Float(0));
14556 break; 14553 break;
14557 case ScriptBaseClass.OBJECT_STREAMING_COST: 14554 case ScriptBaseClass.OBJECT_STREAMING_COST:
14558 // The value returned in SL for normal prims is prim count * 0.06 14555 // The value returned in SL for normal prims is prim count * 0.06
14559 ret.Add(new LSL_Float(obj.StreamingCost)); 14556 ret.Add(new LSL_Float(obj.StreamingCost));
14560 break; 14557 break;
14561 case ScriptBaseClass.OBJECT_PHYSICS_COST: 14558 case ScriptBaseClass.OBJECT_PHYSICS_COST:
14562 // The value returned in SL for normal prims is prim count 14559 // The value returned in SL for normal prims is prim count
14563 ret.Add(new LSL_Float(obj.PhysicsCost)); 14560 ret.Add(new LSL_Float(obj.PhysicsCost));
14564 break; 14561 break;
14565 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding 14562 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
14566 ret.Add(new LSL_Float(0)); 14563 ret.Add(new LSL_Float(0));
14567 break; 14564 break;
14568 case ScriptBaseClass.OBJECT_ROOT: 14565 case ScriptBaseClass.OBJECT_ROOT:
14569 ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString())); 14566 ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
14570 break; 14567 break;
14571 case ScriptBaseClass.OBJECT_ATTACHED_POINT: 14568 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
14572 ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint)); 14569 ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
14573 break; 14570 break;
14574 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: 14571 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
14575 byte pcode = obj.Shape.PCode; 14572 byte pcode = obj.Shape.PCode;
14576 if (obj.ParentGroup.AttachmentPoint != 0 14573 if (obj.ParentGroup.AttachmentPoint != 0
14577 || pcode == (byte)PCode.Grass 14574 || pcode == (byte)PCode.Grass
14578 || pcode == (byte)PCode.Tree 14575 || pcode == (byte)PCode.Tree
14579 || pcode == (byte)PCode.NewTree) 14576 || pcode == (byte)PCode.NewTree)
14580 { 14577 {
14581 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER)); 14578 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
14582 } 14579 }
14583 else 14580 else
14584 { 14581 {
14585 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET)); 14582 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
14586 } 14583 }
14587 break; 14584 break;
14588 case ScriptBaseClass.OBJECT_PHYSICS: 14585 case ScriptBaseClass.OBJECT_PHYSICS:
14589 if (obj.ParentGroup.AttachmentPoint != 0) 14586 if (obj.ParentGroup.AttachmentPoint != 0)
14590 { 14587 {
14591 ret.Add(new LSL_Integer(0)); // Always false if attached 14588 ret.Add(new LSL_Integer(0)); // Always false if attached
14592 } 14589 }
14593 else 14590 else
14594 { 14591 {
14595 ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0)); 14592 ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
14596 } 14593 }
14597 break; 14594 break;
14598 case ScriptBaseClass.OBJECT_PHANTOM: 14595 case ScriptBaseClass.OBJECT_PHANTOM:
14599 if (obj.ParentGroup.AttachmentPoint != 0) 14596 if (obj.ParentGroup.AttachmentPoint != 0)
14600 { 14597 {
14601 ret.Add(new LSL_Integer(0)); // Always false if attached 14598 ret.Add(new LSL_Integer(0)); // Always false if attached
14602 } 14599 }
14603 else 14600 else
14604 { 14601 {
14605 ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0)); 14602 ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
14606 } 14603 }
14607 break; 14604 break;
14608 case ScriptBaseClass.OBJECT_TEMP_ON_REZ: 14605 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
14609 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0)); 14606 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
14610 break; 14607 break;
14611 case ScriptBaseClass.OBJECT_RENDER_WEIGHT: 14608 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
14609 ret.Add(new LSL_Integer(0));
14610 break;
14611 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
14612 ret.Add(new LSL_Float(0));
14613 break;
14614 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
14615 ret.Add(new LSL_Float(-1));
14616 break;
14617 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
14618 ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
14619 break;
14620 case ScriptBaseClass.OBJECT_CLICK_ACTION:
14621 ret.Add(new LSL_Integer(obj.ClickAction));
14622 break;
14623 case ScriptBaseClass.OBJECT_OMEGA:
14624 ret.Add(new LSL_Vector(obj.AngularVelocity));
14625 break;
14626 case ScriptBaseClass.OBJECT_PRIM_COUNT:
14627 ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
14628 break;
14629 case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
14630 SceneObjectPart[] parts = obj.ParentGroup.Parts;
14631 int nparts = parts.Count();
14632 int count = 0;
14633 for(int i = 0; i < nparts; i++)
14634 count += parts[i].Inventory.Count;
14635 ret.Add(new LSL_Integer(count));
14636 break;
14637 case ScriptBaseClass.OBJECT_REZZER_KEY:
14638 ret.Add(new LSL_Key(obj.ParentGroup.RezzerID.ToString()));
14639 break;
14640 case ScriptBaseClass.OBJECT_GROUP_TAG:
14641 ret.Add(new LSL_String(String.Empty));
14642 break;
14643 case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
14644 if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID == UUID.Zero)
14645 {
14646 ret.Add(new LSL_Integer(1));
14647 }
14648 else
14649 {
14612 ret.Add(new LSL_Integer(0)); 14650 ret.Add(new LSL_Integer(0));
14613 break; 14651 }
14614 case ScriptBaseClass.OBJECT_HOVER_HEIGHT: 14652 break;
14615 ret.Add(new LSL_Float(0)); 14653 default:
14616 break; 14654 // Invalid or unhandled constant.
14617 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: 14655 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
14618 ret.Add(new LSL_Float(-1)); 14656 break;
14619 break;
14620 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
14621 ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
14622 break;
14623 case ScriptBaseClass.OBJECT_CLICK_ACTION:
14624 ret.Add(new LSL_Integer(obj.ClickAction));
14625 break;
14626 case ScriptBaseClass.OBJECT_OMEGA:
14627 ret.Add(new LSL_Vector(obj.AngularVelocity));
14628 break;
14629 case ScriptBaseClass.OBJECT_PRIM_COUNT:
14630 ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
14631 break;
14632 case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
14633 SceneObjectPart[] parts = obj.ParentGroup.Parts;
14634 int nparts = parts.Count();
14635 int count = 0;
14636 for(int i = 0; i < nparts; i++)
14637 count += parts[i].Inventory.Count;
14638 ret.Add(new LSL_Integer(count));
14639 break;
14640 case ScriptBaseClass.OBJECT_REZZER_KEY:
14641 ret.Add(new LSL_Key(obj.ParentGroup.RezzerID.ToString()));
14642 break;
14643 case ScriptBaseClass.OBJECT_GROUP_TAG:
14644 ret.Add(new LSL_String(String.Empty));
14645 break;
14646 case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
14647 if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID == UUID.Zero)
14648 {
14649 ret.Add(new LSL_Integer(1));
14650 }
14651 else
14652 {
14653 ret.Add(new LSL_Integer(0));
14654 }
14655 break;
14656 default:
14657 // Invalid or unhandled constant.
14658 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
14659 break;
14660 }
14661 } 14657 }
14662
14663 return ret;
14664 } 14658 }
14665 } 14659 }
14666 14660
14667 return new LSL_List(); 14661 return ret;
14668 } 14662 }
14669 14663
14670 internal UUID GetScriptByName(string name) 14664 internal UUID GetScriptByName(string name)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 4cb63b1..101e69d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -169,11 +169,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
169 LSL_Integer llGetNumberOfPrims(); 169 LSL_Integer llGetNumberOfPrims();
170 LSL_Integer llGetNumberOfSides(); 170 LSL_Integer llGetNumberOfSides();
171 LSL_String llGetObjectDesc(); 171 LSL_String llGetObjectDesc();
172 LSL_List llGetObjectDetails(string id, LSL_List args); 172 LSL_List llGetObjectDetails(LSL_Key objectId, LSL_List args);
173 LSL_Float llGetObjectMass(string id); 173 LSL_Float llGetObjectMass(LSL_Key objectId);
174 LSL_String llGetObjectName(); 174 LSL_String llGetObjectName();
175 LSL_Integer llGetObjectPermMask(int mask); 175 LSL_Integer llGetObjectPermMask(int mask);
176 LSL_Integer llGetObjectPrimCount(string object_id); 176 LSL_Integer llGetObjectPrimCount(LSL_Key objectId);
177 LSL_Vector llGetOmega(); 177 LSL_Vector llGetOmega();
178 LSL_Key llGetOwner(); 178 LSL_Key llGetOwner();
179 LSL_Key llGetOwnerKey(string id); 179 LSL_Key llGetOwnerKey(string id);
@@ -416,7 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
416 void llStopSound(); 416 void llStopSound();
417 LSL_Integer llStringLength(string str); 417 LSL_Integer llStringLength(string str);
418 LSL_String llStringToBase64(string str); 418 LSL_String llStringToBase64(string str);
419 LSL_String llStringTrim(string src, int type); 419 LSL_String llStringTrim(LSL_String src, LSL_Integer type);
420 LSL_Integer llSubStringIndex(string source, string pattern); 420 LSL_Integer llSubStringIndex(string source, string pattern);
421 void llTakeCamera(string avatar); 421 void llTakeCamera(string avatar);
422 void llTakeControls(int controls, int accept, int pass_on); 422 void llTakeControls(int controls, int accept, int pass_on);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 09f77d1..0704378 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -641,7 +641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
641 return m_LSL_Functions.llGetObjectDesc(); 641 return m_LSL_Functions.llGetObjectDesc();
642 } 642 }
643 643
644 public LSL_List llGetObjectDetails(string id, LSL_List args) 644 public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args)
645 { 645 {
646 return m_LSL_Functions.llGetObjectDetails(id, args); 646 return m_LSL_Functions.llGetObjectDetails(id, args);
647 } 647 }
@@ -661,7 +661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
661 return m_LSL_Functions.llGetObjectPermMask(mask); 661 return m_LSL_Functions.llGetObjectPermMask(mask);
662 } 662 }
663 663
664 public LSL_Integer llGetObjectPrimCount(string object_id) 664 public LSL_Integer llGetObjectPrimCount(LSL_Key object_id)
665 { 665 {
666 return m_LSL_Functions.llGetObjectPrimCount(object_id); 666 return m_LSL_Functions.llGetObjectPrimCount(object_id);
667 } 667 }
@@ -1871,7 +1871,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1871 return m_LSL_Functions.llStringToBase64(str); 1871 return m_LSL_Functions.llStringToBase64(str);
1872 } 1872 }
1873 1873
1874 public LSL_String llStringTrim(string src, int type) 1874 public LSL_String llStringTrim(LSL_String src, LSL_Integer type)
1875 { 1875 {
1876 return m_LSL_Functions.llStringTrim(src, type); 1876 return m_LSL_Functions.llStringTrim(src, type);
1877 } 1877 }