aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie2012-08-18 13:17:39 +0100
committerMelanie2012-08-18 13:17:39 +0100
commitaee7a31bc3b5348c883e0d750bab991d853db642 (patch)
tree9d38c2ec7cc62019ab3ea95a3716d28e1451c397 /OpenSim/Region/ScriptEngine/Shared
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-aee7a31bc3b5348c883e0d750bab991d853db642.zip
opensim-SC-aee7a31bc3b5348c883e0d750bab991d853db642.tar.gz
opensim-SC-aee7a31bc3b5348c883e0d750bab991d853db642.tar.bz2
opensim-SC-aee7a31bc3b5348c883e0d750bab991d853db642.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs60
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs15
3 files changed, 46 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d6aafaf..0ed1ccb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1492,31 +1492,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1492 if (part == null || part.ParentGroup.IsDeleted) 1492 if (part == null || part.ParentGroup.IsDeleted)
1493 return; 1493 return;
1494 1494
1495 if (scale.x < 0.01) 1495 // First we need to check whether or not we need to clamp the size of a physics-enabled prim
1496 scale.x = 0.01;
1497 if (scale.y < 0.01)
1498 scale.y = 0.01;
1499 if (scale.z < 0.01)
1500 scale.z = 0.01;
1501
1502 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor; 1496 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor;
1503
1504 if (pa != null && pa.IsPhysical) 1497 if (pa != null && pa.IsPhysical)
1505 { 1498 {
1506 if (scale.x > World.m_maxPhys) 1499 scale.x = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.x));
1507 scale.x = World.m_maxPhys; 1500 scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y));
1508 if (scale.y > World.m_maxPhys) 1501 scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z));
1509 scale.y = World.m_maxPhys;
1510 if (scale.z > World.m_maxPhys)
1511 scale.z = World.m_maxPhys;
1512 } 1502 }
1513 1503
1514 if (scale.x > World.m_maxNonphys) 1504 // Next we clamp the scale to the non-physical min/max
1515 scale.x = World.m_maxNonphys; 1505 scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
1516 if (scale.y > World.m_maxNonphys) 1506 scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
1517 scale.y = World.m_maxNonphys; 1507 scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
1518 if (scale.z > World.m_maxNonphys)
1519 scale.z = World.m_maxNonphys;
1520 1508
1521 Vector3 tmp = part.Scale; 1509 Vector3 tmp = part.Scale;
1522 tmp.X = (float)scale.x; 1510 tmp.X = (float)scale.x;
@@ -4398,9 +4386,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4398 public void llSetText(string text, LSL_Vector color, double alpha) 4386 public void llSetText(string text, LSL_Vector color, double alpha)
4399 { 4387 {
4400 m_host.AddScriptLPS(1); 4388 m_host.AddScriptLPS(1);
4401 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), 4389 Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y,
4402 Util.Clip((float)color.y, 0.0f, 1.0f), 4390 (float)color.z), 0.0f, 1.0f);
4403 Util.Clip((float)color.z, 0.0f, 1.0f));
4404 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4391 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4405 //m_host.ParentGroup.HasGroupChanged = true; 4392 //m_host.ParentGroup.HasGroupChanged = true;
4406 //m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4393 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
@@ -8425,9 +8412,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8425 string primText = rules.GetLSLStringItem(idx++); 8412 string primText = rules.GetLSLStringItem(idx++);
8426 LSL_Vector primTextColor = rules.GetVector3Item(idx++); 8413 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
8427 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); 8414 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
8428 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), 8415 Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x,
8429 Util.Clip((float)primTextColor.y, 0.0f, 1.0f), 8416 (float)primTextColor.y,
8430 Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); 8417 (float)primTextColor.z), 0.0f, 1.0f);
8431 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 8418 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
8432 8419
8433 break; 8420 break;
@@ -8457,7 +8444,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8457 LSL_Float gain = rules.GetLSLFloatItem(idx++); 8444 LSL_Float gain = rules.GetLSLFloatItem(idx++);
8458 TargetOmega(part, axis, (double)spinrate, (double)gain); 8445 TargetOmega(part, axis, (double)spinrate, (double)gain);
8459 break; 8446 break;
8460 8447 case (int)ScriptBaseClass.PRIM_SLICE:
8448 if (remain < 1)
8449 return null;
8450 LSL_Vector slice = rules.GetVector3Item(idx++);
8451 part.UpdateSlice((float)slice.x, (float)slice.y);
8452 break;
8461 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 8453 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
8462 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 8454 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
8463 return null; 8455 return null;
@@ -8466,6 +8458,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8466 } 8458 }
8467 } 8459 }
8468 } 8460 }
8461 catch (InvalidCastException e)
8462 {
8463 ShoutError(e.Message);
8464 }
8469 finally 8465 finally
8470 { 8466 {
8471 if (positionChanged) 8467 if (positionChanged)
@@ -9563,7 +9559,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9563 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 9559 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
9564 res.Add(new LSL_Vector(GetPartLocalPos(part))); 9560 res.Add(new LSL_Vector(GetPartLocalPos(part)));
9565 break; 9561 break;
9566
9567 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 9562 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
9568 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 9563 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
9569 return res; 9564 return res;
@@ -9572,6 +9567,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9572 LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); 9567 LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules);
9573 res += tres; 9568 res += tres;
9574 return res; 9569 return res;
9570 case (int)ScriptBaseClass.PRIM_SLICE:
9571 PrimType prim_type = part.GetPrimType();
9572 bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING);
9573 res.Add(new LSL_Vector(
9574 (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
9575 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
9576 0
9577 ));
9578 break;
9575 } 9579 }
9576 } 9580 }
9577 return res; 9581 return res;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index f989cc6..05ba222 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -329,6 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
329 public const int PRIM_OMEGA = 32; 329 public const int PRIM_OMEGA = 32;
330 public const int PRIM_POS_LOCAL = 33; 330 public const int PRIM_POS_LOCAL = 33;
331 public const int PRIM_LINK_TARGET = 34; 331 public const int PRIM_LINK_TARGET = 34;
332 public const int PRIM_SLICE = 35;
332 public const int PRIM_TEXGEN_DEFAULT = 0; 333 public const int PRIM_TEXGEN_DEFAULT = 0;
333 public const int PRIM_TEXGEN_PLANAR = 1; 334 public const int PRIM_TEXGEN_PLANAR = 1;
334 335
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 8adf4c5..46772ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -562,12 +562,23 @@ namespace OpenSim.Region.ScriptEngine.Shared
562 else if (m_data[itemIndex] is LSL_Types.LSLString) 562 else if (m_data[itemIndex] is LSL_Types.LSLString)
563 return new LSLInteger(m_data[itemIndex].ToString()); 563 return new LSLInteger(m_data[itemIndex].ToString());
564 else 564 else
565 throw new InvalidCastException(); 565 throw new InvalidCastException(string.Format(
566 "{0} expected but {1} given",
567 typeof(LSL_Types.LSLInteger).Name,
568 m_data[itemIndex] != null ?
569 m_data[itemIndex].GetType().Name : "null"));
566 } 570 }
567 571
568 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 572 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
569 { 573 {
570 return (LSL_Types.Vector3)m_data[itemIndex]; 574 if(m_data[itemIndex] is LSL_Types.Vector3)
575 return (LSL_Types.Vector3)m_data[itemIndex];
576 else
577 throw new InvalidCastException(string.Format(
578 "{0} expected but {1} given",
579 typeof(LSL_Types.Vector3).Name,
580 m_data[itemIndex] != null ?
581 m_data[itemIndex].GetType().Name : "null"));
571 } 582 }
572 583
573 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) 584 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)