diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 69 |
1 files changed, 39 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 26969a5..c84afee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -369,7 +369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
369 | } | 369 | } |
370 | 370 | ||
371 | // convert a LSL_Rotation to a Quaternion | 371 | // convert a LSL_Rotation to a Quaternion |
372 | protected Quaternion Rot2Quaternion(LSL_Rotation r) | 372 | public static Quaternion Rot2Quaternion(LSL_Rotation r) |
373 | { | 373 | { |
374 | Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | 374 | Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); |
375 | q.Normalize(); | 375 | q.Normalize(); |
@@ -1204,10 +1204,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1204 | 1204 | ||
1205 | if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) | 1205 | if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) |
1206 | { | 1206 | { |
1207 | if (value != 0) | 1207 | if (m_host.ParentGroup != null) |
1208 | m_host.ScriptSetPhantomStatus(true); | 1208 | m_host.ParentGroup.ScriptSetPhantomStatus(value != 0); |
1209 | else | ||
1210 | m_host.ScriptSetPhantomStatus(false); | ||
1211 | } | 1209 | } |
1212 | 1210 | ||
1213 | if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) | 1211 | if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) |
@@ -2063,6 +2061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2063 | { | 2061 | { |
2064 | return llGetRootRotation(); | 2062 | return llGetRootRotation(); |
2065 | } | 2063 | } |
2064 | |||
2066 | m_host.AddScriptLPS(1); | 2065 | m_host.AddScriptLPS(1); |
2067 | Quaternion q = m_host.GetWorldRotation(); | 2066 | Quaternion q = m_host.GetWorldRotation(); |
2068 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2067 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
@@ -6446,9 +6445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6446 | if (m_host.ParentGroup != null) | 6445 | if (m_host.ParentGroup != null) |
6447 | { | 6446 | { |
6448 | if (!m_host.ParentGroup.IsDeleted) | 6447 | if (!m_host.ParentGroup.IsDeleted) |
6449 | { | 6448 | m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); |
6450 | m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0); | ||
6451 | } | ||
6452 | } | 6449 | } |
6453 | } | 6450 | } |
6454 | 6451 | ||
@@ -6456,7 +6453,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6456 | /// This is a depecated function so this just replicates the result of | 6453 | /// This is a depecated function so this just replicates the result of |
6457 | /// invoking it in SL | 6454 | /// invoking it in SL |
6458 | /// </summary> | 6455 | /// </summary> |
6459 | |||
6460 | public void llRemoteLoadScript(string target, string name, int running, int start_param) | 6456 | public void llRemoteLoadScript(string target, string name, int running, int start_param) |
6461 | { | 6457 | { |
6462 | m_host.AddScriptLPS(1); | 6458 | m_host.AddScriptLPS(1); |
@@ -7254,14 +7250,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7254 | return; | 7250 | return; |
7255 | 7251 | ||
7256 | string ph = rules.Data[idx++].ToString(); | 7252 | string ph = rules.Data[idx++].ToString(); |
7257 | bool phantom; | ||
7258 | 7253 | ||
7259 | if (ph.Equals("1")) | 7254 | if (m_host.ParentGroup != null) |
7260 | phantom = true; | 7255 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); |
7261 | else | ||
7262 | phantom = false; | ||
7263 | 7256 | ||
7264 | part.ScriptSetPhantomStatus(phantom); | ||
7265 | break; | 7257 | break; |
7266 | 7258 | ||
7267 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 7259 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
@@ -7282,14 +7274,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7282 | if (remain < 1) | 7274 | if (remain < 1) |
7283 | return; | 7275 | return; |
7284 | string temp = rules.Data[idx++].ToString(); | 7276 | string temp = rules.Data[idx++].ToString(); |
7285 | bool tempOnRez; | ||
7286 | 7277 | ||
7287 | if (temp.Equals("1")) | 7278 | if (m_host.ParentGroup != null) |
7288 | tempOnRez = true; | 7279 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); |
7289 | else | ||
7290 | tempOnRez = false; | ||
7291 | 7280 | ||
7292 | part.ScriptSetTemporaryStatus(tempOnRez); | ||
7293 | break; | 7281 | break; |
7294 | 7282 | ||
7295 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 7283 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
@@ -7662,7 +7650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7662 | case ScriptBaseClass.PRIM_TYPE_BOX: | 7650 | case ScriptBaseClass.PRIM_TYPE_BOX: |
7663 | case ScriptBaseClass.PRIM_TYPE_CYLINDER: | 7651 | case ScriptBaseClass.PRIM_TYPE_CYLINDER: |
7664 | case ScriptBaseClass.PRIM_TYPE_PRISM: | 7652 | case ScriptBaseClass.PRIM_TYPE_PRISM: |
7665 | res.Add(new LSL_Integer(Shape.ProfileCurve)); | 7653 | res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. |
7666 | res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); | 7654 | res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); |
7667 | res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); | 7655 | res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); |
7668 | res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); | 7656 | res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); |
@@ -7671,7 +7659,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7671 | break; | 7659 | break; |
7672 | 7660 | ||
7673 | case ScriptBaseClass.PRIM_TYPE_SPHERE: | 7661 | case ScriptBaseClass.PRIM_TYPE_SPHERE: |
7674 | res.Add(new LSL_Integer(Shape.ProfileCurve)); | 7662 | res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. |
7675 | res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); | 7663 | res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); |
7676 | res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); | 7664 | res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); |
7677 | res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); | 7665 | res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); |
@@ -7687,7 +7675,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7687 | case ScriptBaseClass.PRIM_TYPE_TUBE: | 7675 | case ScriptBaseClass.PRIM_TYPE_TUBE: |
7688 | case ScriptBaseClass.PRIM_TYPE_TORUS: | 7676 | case ScriptBaseClass.PRIM_TYPE_TORUS: |
7689 | // holeshape | 7677 | // holeshape |
7690 | res.Add(new LSL_Integer(Shape.ProfileCurve)); | 7678 | res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. |
7691 | 7679 | ||
7692 | // cut | 7680 | // cut |
7693 | res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); | 7681 | res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); |
@@ -10578,9 +10566,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10578 | } | 10566 | } |
10579 | } | 10567 | } |
10580 | 10568 | ||
10581 | public static string GetLine(UUID assetID, int line, int maxLength) | 10569 | /// <summary> |
10570 | /// Get a notecard line. | ||
10571 | /// </summary> | ||
10572 | /// <param name="assetID"></param> | ||
10573 | /// <param name="line">Lines start at index 0</param> | ||
10574 | /// <returns></returns> | ||
10575 | public static string GetLine(UUID assetID, int lineNumber) | ||
10582 | { | 10576 | { |
10583 | if (line < 0) | 10577 | if (lineNumber < 0) |
10584 | return ""; | 10578 | return ""; |
10585 | 10579 | ||
10586 | string data; | 10580 | string data; |
@@ -10592,17 +10586,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10592 | { | 10586 | { |
10593 | m_Notecards[assetID].lastRef = DateTime.Now; | 10587 | m_Notecards[assetID].lastRef = DateTime.Now; |
10594 | 10588 | ||
10595 | if (line >= m_Notecards[assetID].text.Length) | 10589 | if (lineNumber >= m_Notecards[assetID].text.Length) |
10596 | return "\n\n\n"; | 10590 | return "\n\n\n"; |
10597 | 10591 | ||
10598 | data = m_Notecards[assetID].text[line]; | 10592 | data = m_Notecards[assetID].text[lineNumber]; |
10599 | if (data.Length > maxLength) | ||
10600 | data = data.Substring(0, maxLength); | ||
10601 | 10593 | ||
10602 | return data; | 10594 | return data; |
10603 | } | 10595 | } |
10604 | } | 10596 | } |
10605 | 10597 | ||
10598 | /// <summary> | ||
10599 | /// Get a notecard line. | ||
10600 | /// </summary> | ||
10601 | /// <param name="assetID"></param> | ||
10602 | /// <param name="line">Lines start at index 0</param> | ||
10603 | /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> | ||
10604 | /// <returns></returns> | ||
10605 | public static string GetLine(UUID assetID, int lineNumber, int maxLength) | ||
10606 | { | ||
10607 | string line = GetLine(assetID, lineNumber); | ||
10608 | |||
10609 | if (line.Length > maxLength) | ||
10610 | line = line.Substring(0, maxLength); | ||
10611 | |||
10612 | return line; | ||
10613 | } | ||
10614 | |||
10606 | public static void CacheCheck() | 10615 | public static void CacheCheck() |
10607 | { | 10616 | { |
10608 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) | 10617 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) |