aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-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
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs16
4 files changed, 55 insertions, 37 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)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index f6cb7df..da22f85 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1053,10 +1053,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1053 return false; 1053 return false;
1054 } 1054 }
1055 1055
1056 UUID assetID = item.AssetID; 1056 m_log.DebugFormat(
1057 "[XEngine] Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
1058 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
1059 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1057 1060
1058 //m_log.DebugFormat("[XEngine] Compiling script {0} ({1} on object {2})", 1061 UUID assetID = item.AssetID;
1059 // item.Name, itemID.ToString(), part.ParentGroup.RootPart.Name);
1060 1062
1061 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID); 1063 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
1062 1064
@@ -1235,10 +1237,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1235 item.Name, startParam, postOnRez, 1237 item.Name, startParam, postOnRez,
1236 stateSource, m_MaxScriptQueue); 1238 stateSource, m_MaxScriptQueue);
1237 1239
1238 m_log.DebugFormat( 1240// m_log.DebugFormat(
1239 "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}", 1241// "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
1240 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, 1242// part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
1241 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); 1243// part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1242 1244
1243 if (presence != null) 1245 if (presence != null)
1244 { 1246 {