diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 60 |
1 files changed, 32 insertions, 28 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; |