aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorUbitUmarov2016-11-07 11:36:43 +0000
committerUbitUmarov2016-11-07 11:36:43 +0000
commit93ea7bd7f470a7fd80b6400d39091ffb1780fbd9 (patch)
treef00524dd18c7d865b2a8a755b4ce1284ff005de3 /OpenSim/Region/ScriptEngine/Shared
parentMerge branch 'master' into httptests (diff)
parentadd a few more lsl constants for attachments (diff)
downloadopensim-SC-93ea7bd7f470a7fd80b6400d39091ffb1780fbd9.zip
opensim-SC-93ea7bd7f470a7fd80b6400d39091ffb1780fbd9.tar.gz
opensim-SC-93ea7bd7f470a7fd80b6400d39091ffb1780fbd9.tar.bz2
opensim-SC-93ea7bd7f470a7fd80b6400d39091ffb1780fbd9.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs158
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs41
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs2
5 files changed, 163 insertions, 52 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ced81ad..1a73c3e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
113 protected float m_MinTimerInterval = 0.5f; 113 protected float m_MinTimerInterval = 0.5f;
114 protected float m_recoilScaleFactor = 0.0f; 114 protected float m_recoilScaleFactor = 0.0f;
115 115
116 protected DateTime m_timer = DateTime.Now; 116 protected double m_timer = Util.GetTimeStampMS();
117 protected bool m_waitingForScriptAnswer = false; 117 protected bool m_waitingForScriptAnswer = false;
118 protected bool m_automaticLinkPermission = false; 118 protected bool m_automaticLinkPermission = false;
119 protected IMessageTransferModule m_TransferModule = null; 119 protected IMessageTransferModule m_TransferModule = null;
@@ -662,15 +662,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
662 List<SceneObjectPart> ret = new List<SceneObjectPart>(); 662 List<SceneObjectPart> ret = new List<SceneObjectPart>();
663 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 663 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
664 return ret; 664 return ret;
665 ret.Add(part);
666 665
667 switch (linkType) 666 switch (linkType)
668 { 667 {
669 case ScriptBaseClass.LINK_SET: 668 case ScriptBaseClass.LINK_SET:
670 return new List<SceneObjectPart>(part.ParentGroup.Parts); 669 return new List<SceneObjectPart>(part.ParentGroup.Parts);
671 670
672 case ScriptBaseClass.LINK_ROOT: 671 case ScriptBaseClass.LINK_ROOT:
673 ret = new List<SceneObjectPart>();
674 ret.Add(part.ParentGroup.RootPart); 672 ret.Add(part.ParentGroup.RootPart);
675 return ret; 673 return ret;
676 674
@@ -690,16 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
690 return ret; 688 return ret;
691 689
692 case ScriptBaseClass.LINK_THIS: 690 case ScriptBaseClass.LINK_THIS:
691 ret.Add(part);
693 return ret; 692 return ret;
694 693
695 default: 694 default:
696 if (linkType < 0) 695 if (linkType < 0)
697 return new List<SceneObjectPart>(); 696 return ret;
698 697
699 SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType); 698 SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
700 if (target == null) 699 if (target == null)
701 return new List<SceneObjectPart>(); 700 return ret;
702 ret = new List<SceneObjectPart>();
703 ret.Add(target); 701 ret.Add(target);
704 return ret; 702 return ret;
705 } 703 }
@@ -3050,22 +3048,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3050 public LSL_Float llGetTime() 3048 public LSL_Float llGetTime()
3051 { 3049 {
3052 m_host.AddScriptLPS(1); 3050 m_host.AddScriptLPS(1);
3053 TimeSpan ScriptTime = DateTime.Now - m_timer; 3051 double ScriptTime = Util.GetTimeStampMS() - m_timer;
3054 return (double)(ScriptTime.TotalMilliseconds / 1000); 3052 return (ScriptTime / 1000.0);
3055 } 3053 }
3056 3054
3057 public void llResetTime() 3055 public void llResetTime()
3058 { 3056 {
3059 m_host.AddScriptLPS(1); 3057 m_host.AddScriptLPS(1);
3060 m_timer = DateTime.Now; 3058 m_timer = Util.GetTimeStampMS();
3061 } 3059 }
3062 3060
3063 public LSL_Float llGetAndResetTime() 3061 public LSL_Float llGetAndResetTime()
3064 { 3062 {
3065 m_host.AddScriptLPS(1); 3063 m_host.AddScriptLPS(1);
3066 TimeSpan ScriptTime = DateTime.Now - m_timer; 3064 double now = Util.GetTimeStampMS();
3067 m_timer = DateTime.Now; 3065 double ScriptTime = now - m_timer;
3068 return (double)(ScriptTime.TotalMilliseconds / 1000); 3066 m_timer = now;
3067 return (ScriptTime / 1000.0);
3069 } 3068 }
3070 3069
3071 public void llSound(string sound, double volume, int queue, int loop) 3070 public void llSound(string sound, double volume, int queue, int loop)
@@ -10086,6 +10085,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10086 part.UpdateSlice((float)slice.x, (float)slice.y); 10085 part.UpdateSlice((float)slice.x, (float)slice.y);
10087 break; 10086 break;
10088 10087
10088 case ScriptBaseClass.PRIM_SIT_TARGET:
10089 if (remain < 3)
10090 return new LSL_List();
10091
10092 int active;
10093 try
10094 {
10095 active = rules.GetLSLIntegerItem(idx++);
10096 }
10097 catch(InvalidCastException)
10098 {
10099 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
10100 return new LSL_List();
10101 }
10102 LSL_Vector offset;
10103 try
10104 {
10105 offset = rules.GetVector3Item(idx++);
10106 }
10107 catch(InvalidCastException)
10108 {
10109 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10110 return new LSL_List();
10111 }
10112 LSL_Rotation sitrot;
10113 try
10114 {
10115 sitrot = rules.GetQuaternionItem(idx++);
10116 }
10117 catch(InvalidCastException)
10118 {
10119 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 3 must be rotation", rulesParsed, idx - idxStart - 1));
10120 return new LSL_List();
10121 }
10122
10123 // not SL compatible since we don't have a independent flag to control active target but use the values of offset and rotation
10124 if(active == 1)
10125 {
10126 if(offset.x == 0 && offset.y == 0 && offset.z == 0 && sitrot.s == 1.0)
10127 offset.z = 1e-5f; // hack
10128 SitTarget(part,offset,sitrot);
10129 }
10130 else if(active == 0)
10131 SitTarget(part, Vector3.Zero , Quaternion.Identity);
10132
10133 break;
10134
10089 case ScriptBaseClass.PRIM_LINK_TARGET: 10135 case ScriptBaseClass.PRIM_LINK_TARGET:
10090 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 10136 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
10091 return new LSL_List(); 10137 return new LSL_List();
@@ -11182,7 +11228,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11182 res.Add(new LSL_Float(spin)); 11228 res.Add(new LSL_Float(spin));
11183 res.Add(new LSL_Float(gain)); 11229 res.Add(new LSL_Float(gain));
11184 break; 11230 break;
11185 11231
11232 case (int)ScriptBaseClass.PRIM_SIT_TARGET:
11233 if(part.IsSitTargetSet)
11234 {
11235 res.Add(new LSL_Integer(1));
11236 res.Add(new LSL_Vector(part.SitTargetPosition));
11237 res.Add(new LSL_Rotation(part.SitTargetOrientation));
11238 }
11239 else
11240 {
11241 res.Add(new LSL_Integer(0));
11242 res.Add(new LSL_Vector(Vector3.Zero));
11243 res.Add(new LSL_Rotation(Quaternion.Identity));
11244 }
11245 break;
11246
11186 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 11247 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
11187 11248
11188 // TODO: Should be issuing a runtime script warning in this case. 11249 // TODO: Should be issuing a runtime script warning in this case.
@@ -14155,18 +14216,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14155 return false; 14216 return false;
14156 } 14217 }
14157 14218
14158 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd) 14219 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd, bool skipPhys)
14159 { 14220 {
14160 List<ContactResult> contacts = new List<ContactResult>(); 14221 List<ContactResult> contacts = new List<ContactResult>();
14161 14222
14162 Vector3 ab = rayEnd - rayStart; 14223 Vector3 ab = rayEnd - rayStart;
14224 float ablen = ab.Length();
14163 14225
14164 World.ForEachScenePresence(delegate(ScenePresence sp) 14226 World.ForEachScenePresence(delegate(ScenePresence sp)
14165 { 14227 {
14228 if(skipPhys && sp.PhysicsActor != null)
14229 return;
14230
14166 Vector3 ac = sp.AbsolutePosition - rayStart; 14231 Vector3 ac = sp.AbsolutePosition - rayStart;
14167// Vector3 bc = sp.AbsolutePosition - rayEnd;
14168 14232
14169 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 14233 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / ablen);
14170 14234
14171 if (d > 1.5) 14235 if (d > 1.5)
14172 return; 14236 return;
@@ -14455,7 +14519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14455 Vector3 rayEnd = end; 14519 Vector3 rayEnd = end;
14456 Vector3 dir = rayEnd - rayStart; 14520 Vector3 dir = rayEnd - rayStart;
14457 14521
14458 float dist = Vector3.Mag(dir); 14522 float dist = dir.Length();
14459 14523
14460 int count = 1; 14524 int count = 1;
14461 bool detectPhantom = false; 14525 bool detectPhantom = false;
@@ -14484,7 +14548,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14484 bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL); 14548 bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
14485 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); 14549 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
14486 14550
14487
14488 if (World.SupportsRayCastFiltered()) 14551 if (World.SupportsRayCastFiltered())
14489 { 14552 {
14490 if (dist == 0) 14553 if (dist == 0)
@@ -14493,8 +14556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14493 RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; 14556 RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull;
14494 if (checkTerrain) 14557 if (checkTerrain)
14495 rayfilter |= RayFilterFlags.land; 14558 rayfilter |= RayFilterFlags.land;
14496// if (checkAgents) 14559 if (checkAgents)
14497// rayfilter |= RayFilterFlags.agent; 14560 rayfilter |= RayFilterFlags.agent;
14498 if (checkPhysical) 14561 if (checkPhysical)
14499 rayfilter |= RayFilterFlags.physical; 14562 rayfilter |= RayFilterFlags.physical;
14500 if (checkNonPhysical) 14563 if (checkNonPhysical)
@@ -14520,16 +14583,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14520 14583
14521 if (physresults == null) 14584 if (physresults == null)
14522 { 14585 {
14523 list.Add(new LSL_Integer(-3)); // timeout error 14586// list.Add(new LSL_Integer(-3)); // timeout error
14524 return list; 14587// return list;
14588 results = new List<ContactResult>();
14525 } 14589 }
14526 14590 else
14527 results = (List<ContactResult>)physresults; 14591 results = (List<ContactResult>)physresults;
14528 14592
14529 // for now physics doesn't detect sitted avatars so do it outside physics 14593 // for now physics doesn't detect sitted avatars so do it outside physics
14530 if (checkAgents) 14594 if (checkAgents)
14531 { 14595 {
14532 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 14596 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, true);
14533 foreach (ContactResult r in agentHits) 14597 foreach (ContactResult r in agentHits)
14534 results.Add(r); 14598 results.Add(r);
14535 } 14599 }
@@ -14545,12 +14609,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14545 foreach (ContactResult r in objectHits) 14609 foreach (ContactResult r in objectHits)
14546 results.Add(r); 14610 results.Add(r);
14547 } 14611 }
14612 // Double check this because of current ODE distance problems
14613 if (checkTerrain && dist > 60)
14614 {
14615 bool skipGroundCheck = false;
14616
14617 foreach (ContactResult c in results)
14618 {
14619 if (c.ConsumerID == 0) // Physics gave us a ground collision
14620 skipGroundCheck = true;
14621 }
14622
14623 if (!skipGroundCheck)
14624 {
14625 float tmp = dir.X * dir.X + dir.Y * dir.Y;
14626 if(tmp > 2500)
14627 {
14628 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
14629 if (groundContact != null)
14630 results.Add((ContactResult)groundContact);
14631 }
14632 }
14633 }
14548 } 14634 }
14549 else 14635 else
14550 { 14636 {
14551 if (checkAgents) 14637 if (checkAgents)
14552 { 14638 {
14553 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 14639 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, false);
14554 foreach (ContactResult r in agentHits) 14640 foreach (ContactResult r in agentHits)
14555 results.Add(r); 14641 results.Add(r);
14556 } 14642 }
@@ -14565,20 +14651,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14565 results.Add(objectHits[iter]); 14651 results.Add(objectHits[iter]);
14566 } 14652 }
14567 } 14653 }
14568 }
14569 14654
14570 // Double check this 14655 if (checkTerrain)
14571 if (checkTerrain)
14572 {
14573 bool skipGroundCheck = false;
14574
14575 foreach (ContactResult c in results)
14576 {
14577 if (c.ConsumerID == 0) // Physics gave us a ground collision
14578 skipGroundCheck = true;
14579 }
14580
14581 if (!skipGroundCheck)
14582 { 14656 {
14583 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); 14657 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
14584 if (groundContact != null) 14658 if (groundContact != null)
@@ -14590,7 +14664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14590 { 14664 {
14591 return a.Depth.CompareTo(b.Depth); 14665 return a.Depth.CompareTo(b.Depth);
14592 }); 14666 });
14593 14667
14594 int values = 0; 14668 int values = 0;
14595 SceneObjectGroup thisgrp = m_host.ParentGroup; 14669 SceneObjectGroup thisgrp = m_host.ParentGroup;
14596 14670
@@ -14644,7 +14718,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14644 } 14718 }
14645 14719
14646 list.Add(new LSL_Integer(values)); 14720 list.Add(new LSL_Integer(values));
14647
14648 return list; 14721 return list;
14649 } 14722 }
14650 14723
@@ -15919,6 +15992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15919 case (int)ScriptBaseClass.PRIM_TEXT: 15992 case (int)ScriptBaseClass.PRIM_TEXT:
15920 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 15993 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
15921 case (int)ScriptBaseClass.PRIM_OMEGA: 15994 case (int)ScriptBaseClass.PRIM_OMEGA:
15995 case (int)ScriptBaseClass.PRIM_SIT_TARGET:
15922 if (remain < 3) 15996 if (remain < 3)
15923 return new LSL_List(); 15997 return new LSL_List();
15924 idx += 3; 15998 idx += 3;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 7bd4fa7..1e26036 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -365,8 +365,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
365 /// </summary> 365 /// </summary>
366 protected object ConvertFromLSL(object lslparm, Type type, string fname) 366 protected object ConvertFromLSL(object lslparm, Type type, string fname)
367 { 367 {
368
369 if(lslparm.GetType() == type)
370 return lslparm;
371
368 // ---------- String ---------- 372 // ---------- String ----------
369 if (lslparm is LSL_String) 373 else if (lslparm is LSL_String)
370 { 374 {
371 if (type == typeof(string)) 375 if (type == typeof(string))
372 return (string)(LSL_String)lslparm; 376 return (string)(LSL_String)lslparm;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 4a8e885..cee66b2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -254,6 +254,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
254 public const int ATTACH_HUD_BOTTOM_RIGHT = 38; 254 public const int ATTACH_HUD_BOTTOM_RIGHT = 38;
255 public const int ATTACH_NECK = 39; 255 public const int ATTACH_NECK = 39;
256 public const int ATTACH_AVATAR_CENTER = 40; 256 public const int ATTACH_AVATAR_CENTER = 40;
257 public const int ATTACH_LHAND_RING1 = 41;
258 public const int ATTACH_RHAND_RING1 = 42;
259 public const int ATTACH_TAIL_BASE = 43;
260 public const int ATTACH_TAIL_TIP = 44;
261 public const int ATTACH_LWING = 45;
262 public const int ATTACH_RWING = 46;
263 public const int ATTACH_FACE_JAW = 47;
264 public const int ATTACH_FACE_LEAR = 48;
265 public const int ATTACH_FACE_REAR = 49;
266 public const int ATTACH_FACE_LEYE = 50;
267 public const int ATTACH_FACE_REYE = 51;
268 public const int ATTACH_FACE_TONGUE = 52;
269 public const int ATTACH_GROIN = 53;
270 public const int ATTACH_HIND_LFOOT = 54;
271 public const int ATTACH_HIND_RFOOT = 55;
257 272
258 #region osMessageAttachments constants 273 #region osMessageAttachments constants
259 274
@@ -336,11 +351,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
336 public const int ROTATE = 32; 351 public const int ROTATE = 32;
337 public const int SCALE = 64; 352 public const int SCALE = 64;
338 public const int ALL_SIDES = -1; 353 public const int ALL_SIDES = -1;
354
355 // LINK flags
339 public const int LINK_SET = -1; 356 public const int LINK_SET = -1;
340 public const int LINK_ROOT = 1; 357 public const int LINK_ROOT = 1;
341 public const int LINK_ALL_OTHERS = -2; 358 public const int LINK_ALL_OTHERS = -2;
342 public const int LINK_ALL_CHILDREN = -3; 359 public const int LINK_ALL_CHILDREN = -3;
343 public const int LINK_THIS = -4; 360 public const int LINK_THIS = -4;
361
344 public const int CHANGED_INVENTORY = 1; 362 public const int CHANGED_INVENTORY = 1;
345 public const int CHANGED_COLOR = 2; 363 public const int CHANGED_COLOR = 2;
346 public const int CHANGED_SHAPE = 4; 364 public const int CHANGED_SHAPE = 4;
@@ -356,6 +374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
356 public const int CHANGED_MEDIA = 2048; 374 public const int CHANGED_MEDIA = 2048;
357 public const int CHANGED_ANIMATION = 16384; 375 public const int CHANGED_ANIMATION = 16384;
358 public const int CHANGED_POSITION = 32768; 376 public const int CHANGED_POSITION = 32768;
377
359 public const int TYPE_INVALID = 0; 378 public const int TYPE_INVALID = 0;
360 public const int TYPE_INTEGER = 1; 379 public const int TYPE_INTEGER = 1;
361 public const int TYPE_FLOAT = 2; 380 public const int TYPE_FLOAT = 2;
@@ -389,6 +408,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
389 public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded 408 public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded
390 public const int CONTENT_TYPE_RSS = 8; //application/rss+xml 409 public const int CONTENT_TYPE_RSS = 8; //application/rss+xml
391 410
411 //parameters comand flags
392 public const int PRIM_MATERIAL = 2; 412 public const int PRIM_MATERIAL = 2;
393 public const int PRIM_PHYSICS = 3; 413 public const int PRIM_PHYSICS = 3;
394 public const int PRIM_TEMP_ON_REZ = 4; 414 public const int PRIM_TEMP_ON_REZ = 4;
@@ -397,19 +417,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
397 public const int PRIM_SIZE = 7; 417 public const int PRIM_SIZE = 7;
398 public const int PRIM_ROTATION = 8; 418 public const int PRIM_ROTATION = 8;
399 public const int PRIM_TYPE = 9; 419 public const int PRIM_TYPE = 9;
420 // gap 10-16
400 public const int PRIM_TEXTURE = 17; 421 public const int PRIM_TEXTURE = 17;
401 public const int PRIM_COLOR = 18; 422 public const int PRIM_COLOR = 18;
402 public const int PRIM_BUMP_SHINY = 19; 423 public const int PRIM_BUMP_SHINY = 19;
403 public const int PRIM_FULLBRIGHT = 20; 424 public const int PRIM_FULLBRIGHT = 20;
404 public const int PRIM_FLEXIBLE = 21; 425 public const int PRIM_FLEXIBLE = 21;
405 public const int PRIM_TEXGEN = 22; 426 public const int PRIM_TEXGEN = 22;
406 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
407 public const int PRIM_POINT_LIGHT = 23; // Huh? 427 public const int PRIM_POINT_LIGHT = 23; // Huh?
428 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
408 public const int PRIM_GLOW = 25; 429 public const int PRIM_GLOW = 25;
409 public const int PRIM_TEXT = 26; 430 public const int PRIM_TEXT = 26;
410 public const int PRIM_NAME = 27; 431 public const int PRIM_NAME = 27;
411 public const int PRIM_DESC = 28; 432 public const int PRIM_DESC = 28;
412 public const int PRIM_ROT_LOCAL = 29; 433 public const int PRIM_ROT_LOCAL = 29;
434 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
435 public const int PRIM_PHYSICS_MATERIAL = 31; // apparently not on SL wiki
413 public const int PRIM_OMEGA = 32; 436 public const int PRIM_OMEGA = 32;
414 public const int PRIM_POS_LOCAL = 33; 437 public const int PRIM_POS_LOCAL = 33;
415 public const int PRIM_LINK_TARGET = 34; 438 public const int PRIM_LINK_TARGET = 34;
@@ -417,6 +440,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
417 public const int PRIM_SPECULAR = 36; 440 public const int PRIM_SPECULAR = 36;
418 public const int PRIM_NORMAL = 37; 441 public const int PRIM_NORMAL = 37;
419 public const int PRIM_ALPHA_MODE = 38; 442 public const int PRIM_ALPHA_MODE = 38;
443 public const int PRIM_ALLOW_UNSIT = 39; // experiences related. unsupported
444 public const int PRIM_SCRIPTED_SIT_ONLY = 40; // experiences related. unsupported
445 public const int PRIM_SIT_TARGET = 41;
446
447
448 // parameters
420 public const int PRIM_TEXGEN_DEFAULT = 0; 449 public const int PRIM_TEXGEN_DEFAULT = 0;
421 public const int PRIM_TEXGEN_PLANAR = 1; 450 public const int PRIM_TEXGEN_PLANAR = 1;
422 451
@@ -473,6 +502,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
473 public const int PRIM_SCULPT_FLAG_INVERT = 64; 502 public const int PRIM_SCULPT_FLAG_INVERT = 64;
474 public const int PRIM_SCULPT_FLAG_MIRROR = 128; 503 public const int PRIM_SCULPT_FLAG_MIRROR = 128;
475 504
505 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
506 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
507 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
508
476 public const int PROFILE_NONE = 0; 509 public const int PROFILE_NONE = 0;
477 public const int PROFILE_SCRIPT_MEMORY = 1; 510 public const int PROFILE_SCRIPT_MEMORY = 1;
478 511
@@ -701,12 +734,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
701 public const int PRIM_MEDIA_PERM_GROUP = 2; 734 public const int PRIM_MEDIA_PERM_GROUP = 2;
702 public const int PRIM_MEDIA_PERM_ANYONE = 4; 735 public const int PRIM_MEDIA_PERM_ANYONE = 4;
703 736
704 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
705 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
706 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
707 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
708
709 public const int PRIM_PHYSICS_MATERIAL = 31;
710 public const int DENSITY = 1; 737 public const int DENSITY = 1;
711 public const int FRICTION = 2; 738 public const int FRICTION = 2;
712 public const int RESTITUTION = 4; 739 public const int RESTITUTION = 4;
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 9fb1e2c..c36e7c6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -704,12 +704,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
704 { 704 {
705 if (Data[itemIndex] is LSL_Types.Quaternion) 705 if (Data[itemIndex] is LSL_Types.Quaternion)
706 { 706 {
707 return (LSL_Types.Quaternion)Data[itemIndex]; 707 LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex];
708 q.Normalize();
709 return q;
708 } 710 }
709 else if(Data[itemIndex] is OpenMetaverse.Quaternion) 711 else if(Data[itemIndex] is OpenMetaverse.Quaternion)
710 { 712 {
711 return new LSL_Types.Quaternion( 713 LSL_Types.Quaternion q = new LSL_Types.Quaternion(
712 (OpenMetaverse.Quaternion)Data[itemIndex]); 714 (OpenMetaverse.Quaternion)Data[itemIndex]);
715 q.Normalize();
716 return q;
713 } 717 }
714 else 718 else
715 { 719 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
index 71b88bc..fe2113b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
@@ -270,6 +270,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
270 TestHelpers.InMethod(); 270 TestHelpers.InMethod();
271 271
272 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); 272 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
273 // make that nonsense a quaternion
274 testValue.Normalize();
273 LSL_Types.list testList = new LSL_Types.list(testValue); 275 LSL_Types.list testList = new LSL_Types.list(testValue);
274 276
275 Assert.AreEqual(testValue, testList.GetQuaternionItem(0)); 277 Assert.AreEqual(testValue, testList.GetQuaternionItem(0));