diff options
author | Melanie | 2012-08-25 21:03:47 +0100 |
---|---|---|
committer | Melanie | 2012-08-25 21:03:47 +0100 |
commit | 86d4e45f4d5ce7de4a2043dfe753f620925e28c4 (patch) | |
tree | 7d4bb503a2afb9bf3b1c1b6d6eb7e2aed5225943 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Also move the other avatar based overload out of harms way (diff) | |
download | opensim-SC-86d4e45f4d5ce7de4a2043dfe753f620925e28c4.zip opensim-SC-86d4e45f4d5ce7de4a2043dfe753f620925e28c4.tar.gz opensim-SC-86d4e45f4d5ce7de4a2043dfe753f620925e28c4.tar.bz2 opensim-SC-86d4e45f4d5ce7de4a2043dfe753f620925e28c4.tar.xz |
since we will be making the Get return type the remaining ruleset as with the Set return type, we need to move the original return type to a ref param
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 274 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 |
2 files changed, 139 insertions, 137 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 64f145b..fbb91ce 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8636,7 +8636,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8636 | public LSL_List llGetPrimitiveParams(LSL_List rules) | 8636 | public LSL_List llGetPrimitiveParams(LSL_List rules) |
8637 | { | 8637 | { |
8638 | m_host.AddScriptLPS(1); | 8638 | m_host.AddScriptLPS(1); |
8639 | return GetPrimParams(m_host, rules); | 8639 | |
8640 | LSL_List result = new LSL_List(); | ||
8641 | |||
8642 | GetPrimParams(m_host, rules, ref result); | ||
8643 | |||
8644 | return result; | ||
8640 | } | 8645 | } |
8641 | 8646 | ||
8642 | public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) | 8647 | public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) |
@@ -8655,24 +8660,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8655 | { | 8660 | { |
8656 | foreach (var part in parts) | 8661 | foreach (var part in parts) |
8657 | { | 8662 | { |
8658 | LSL_List partRes = GetPrimParams(part, rules); | 8663 | GetPrimParams(part, rules, ref res); |
8659 | res += partRes; | ||
8660 | } | 8664 | } |
8661 | } | 8665 | } |
8662 | if (avatars.Count > 0) | 8666 | if (avatars.Count > 0) |
8663 | { | 8667 | { |
8664 | foreach (ScenePresence avatar in avatars) | 8668 | foreach (ScenePresence avatar in avatars) |
8665 | { | 8669 | { |
8666 | LSL_List avaRes = GetPrimParams(avatar, rules); | 8670 | GetPrimParams(avatar, rules, ref res); |
8667 | res += avaRes; | ||
8668 | } | 8671 | } |
8672 | // TODO: FINISH MERGE | ||
8669 | } | 8673 | } |
8670 | return res; | 8674 | return res; |
8671 | } | 8675 | } |
8672 | 8676 | ||
8673 | public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) | 8677 | public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) |
8674 | { | 8678 | { |
8675 | LSL_List res = new LSL_List(); | ||
8676 | int idx=0; | 8679 | int idx=0; |
8677 | while (idx < rules.Length) | 8680 | while (idx < rules.Length) |
8678 | { | 8681 | { |
@@ -8810,7 +8813,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8810 | 8813 | ||
8811 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 8814 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
8812 | if (remain < 1) | 8815 | if (remain < 1) |
8813 | return res; | 8816 | return; |
8814 | 8817 | ||
8815 | int face = (int)rules.GetLSLIntegerItem(idx++); | 8818 | int face = (int)rules.GetLSLIntegerItem(idx++); |
8816 | Primitive.TextureEntry tex = part.Shape.Textures; | 8819 | Primitive.TextureEntry tex = part.Shape.Textures; |
@@ -8850,7 +8853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8850 | 8853 | ||
8851 | case (int)ScriptBaseClass.PRIM_COLOR: | 8854 | case (int)ScriptBaseClass.PRIM_COLOR: |
8852 | if (remain < 1) | 8855 | if (remain < 1) |
8853 | return res; | 8856 | return; |
8854 | 8857 | ||
8855 | face=(int)rules.GetLSLIntegerItem(idx++); | 8858 | face=(int)rules.GetLSLIntegerItem(idx++); |
8856 | 8859 | ||
@@ -8879,7 +8882,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8879 | 8882 | ||
8880 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 8883 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
8881 | if (remain < 1) | 8884 | if (remain < 1) |
8882 | return res; | 8885 | return; |
8883 | face = (int)rules.GetLSLIntegerItem(idx++); | 8886 | face = (int)rules.GetLSLIntegerItem(idx++); |
8884 | 8887 | ||
8885 | tex = part.Shape.Textures; | 8888 | tex = part.Shape.Textures; |
@@ -8935,7 +8938,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8935 | 8938 | ||
8936 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 8939 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
8937 | if (remain < 1) | 8940 | if (remain < 1) |
8938 | return res; | 8941 | return; |
8939 | face = (int)rules.GetLSLIntegerItem(idx++); | 8942 | face = (int)rules.GetLSLIntegerItem(idx++); |
8940 | 8943 | ||
8941 | tex = part.Shape.Textures; | 8944 | tex = part.Shape.Textures; |
@@ -8989,7 +8992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8989 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 8992 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
8990 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | 8993 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) |
8991 | if (remain < 1) | 8994 | if (remain < 1) |
8992 | return res; | 8995 | return; |
8993 | face = (int)rules.GetLSLIntegerItem(idx++); | 8996 | face = (int)rules.GetLSLIntegerItem(idx++); |
8994 | 8997 | ||
8995 | tex = part.Shape.Textures; | 8998 | tex = part.Shape.Textures; |
@@ -9037,7 +9040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9037 | 9040 | ||
9038 | case (int)ScriptBaseClass.PRIM_GLOW: | 9041 | case (int)ScriptBaseClass.PRIM_GLOW: |
9039 | if (remain < 1) | 9042 | if (remain < 1) |
9040 | return res; | 9043 | return; |
9041 | face = (int)rules.GetLSLIntegerItem(idx++); | 9044 | face = (int)rules.GetLSLIntegerItem(idx++); |
9042 | 9045 | ||
9043 | tex = part.Shape.Textures; | 9046 | tex = part.Shape.Textures; |
@@ -9083,12 +9086,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9083 | break; | 9086 | break; |
9084 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 9087 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
9085 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 9088 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
9086 | return res; | 9089 | return; |
9087 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 9090 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
9088 | LSL_List new_rules = rules.GetSublist(idx, -1); | 9091 | LSL_List new_rules = rules.GetSublist(idx, -1); |
9089 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | 9092 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); |
9090 | res += tres; | 9093 | res += tres; |
9091 | return res; | 9094 | return; |
9092 | case (int)ScriptBaseClass.PRIM_SLICE: | 9095 | case (int)ScriptBaseClass.PRIM_SLICE: |
9093 | PrimType prim_type = part.GetPrimType(); | 9096 | PrimType prim_type = part.GetPrimType(); |
9094 | bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); | 9097 | bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); |
@@ -9100,7 +9103,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9100 | break; | 9103 | break; |
9101 | } | 9104 | } |
9102 | } | 9105 | } |
9103 | return res; | ||
9104 | } | 9106 | } |
9105 | 9107 | ||
9106 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) | 9108 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) |
@@ -11661,13 +11663,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11661 | public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) | 11663 | public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) |
11662 | { | 11664 | { |
11663 | SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); | 11665 | SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); |
11664 | if (obj == null) | ||
11665 | return new LSL_List(); | ||
11666 | 11666 | ||
11667 | if (obj.OwnerID != m_host.OwnerID) | 11667 | LSL_List result = new LSL_List(); |
11668 | return new LSL_List(); | ||
11669 | 11668 | ||
11670 | return GetPrimParams(obj, rules); | 11669 | if (obj != null && obj.OwnerID != m_host.OwnerID) |
11670 | { | ||
11671 | GetPrimParams(obj, rules, ref result); | ||
11672 | } | ||
11673 | |||
11674 | return result; | ||
11671 | } | 11675 | } |
11672 | 11676 | ||
11673 | public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) | 11677 | public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) |
@@ -12604,110 +12608,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12604 | } | 12608 | } |
12605 | } | 12609 | } |
12606 | } | 12610 | } |
12607 | } | ||
12608 | |||
12609 | public class NotecardCache | ||
12610 | { | ||
12611 | protected class Notecard | ||
12612 | { | ||
12613 | public string[] text; | ||
12614 | public DateTime lastRef; | ||
12615 | } | ||
12616 | |||
12617 | protected static Dictionary<UUID, Notecard> m_Notecards = | ||
12618 | new Dictionary<UUID, Notecard>(); | ||
12619 | |||
12620 | public static void Cache(UUID assetID, string text) | ||
12621 | { | ||
12622 | CacheCheck(); | ||
12623 | |||
12624 | lock (m_Notecards) | ||
12625 | { | ||
12626 | if (m_Notecards.ContainsKey(assetID)) | ||
12627 | return; | ||
12628 | |||
12629 | Notecard nc = new Notecard(); | ||
12630 | nc.lastRef = DateTime.Now; | ||
12631 | nc.text = SLUtil.ParseNotecardToList(text).ToArray(); | ||
12632 | m_Notecards[assetID] = nc; | ||
12633 | } | ||
12634 | } | ||
12635 | |||
12636 | public static bool IsCached(UUID assetID) | ||
12637 | { | ||
12638 | lock (m_Notecards) | ||
12639 | { | ||
12640 | return m_Notecards.ContainsKey(assetID); | ||
12641 | } | ||
12642 | } | ||
12643 | |||
12644 | public static int GetLines(UUID assetID) | ||
12645 | { | ||
12646 | if (!IsCached(assetID)) | ||
12647 | return -1; | ||
12648 | |||
12649 | lock (m_Notecards) | ||
12650 | { | ||
12651 | m_Notecards[assetID].lastRef = DateTime.Now; | ||
12652 | return m_Notecards[assetID].text.Length; | ||
12653 | } | ||
12654 | } | ||
12655 | |||
12656 | /// <summary> | ||
12657 | /// Get a notecard line. | ||
12658 | /// </summary> | ||
12659 | /// <param name="assetID"></param> | ||
12660 | /// <param name="line">Lines start at index 0</param> | ||
12661 | /// <returns></returns> | ||
12662 | public static string GetLine(UUID assetID, int lineNumber) | ||
12663 | { | ||
12664 | if (lineNumber < 0) | ||
12665 | return ""; | ||
12666 | |||
12667 | string data; | ||
12668 | |||
12669 | if (!IsCached(assetID)) | ||
12670 | return ""; | ||
12671 | |||
12672 | lock (m_Notecards) | ||
12673 | { | ||
12674 | m_Notecards[assetID].lastRef = DateTime.Now; | ||
12675 | |||
12676 | if (lineNumber >= m_Notecards[assetID].text.Length) | ||
12677 | return "\n\n\n"; | ||
12678 | |||
12679 | data = m_Notecards[assetID].text[lineNumber]; | ||
12680 | |||
12681 | return data; | ||
12682 | } | ||
12683 | } | ||
12684 | |||
12685 | /// <summary> | ||
12686 | /// Get a notecard line. | ||
12687 | /// </summary> | ||
12688 | /// <param name="assetID"></param> | ||
12689 | /// <param name="line">Lines start at index 0</param> | ||
12690 | /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> | ||
12691 | /// <returns></returns> | ||
12692 | public static string GetLine(UUID assetID, int lineNumber, int maxLength) | ||
12693 | { | ||
12694 | string line = GetLine(assetID, lineNumber); | ||
12695 | |||
12696 | if (line.Length > maxLength) | ||
12697 | line = line.Substring(0, maxLength); | ||
12698 | |||
12699 | return line; | ||
12700 | } | ||
12701 | |||
12702 | public static void CacheCheck() | ||
12703 | { | ||
12704 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) | ||
12705 | { | ||
12706 | Notecard nc = m_Notecards[key]; | ||
12707 | if (nc.lastRef.AddSeconds(30) < DateTime.Now) | ||
12708 | m_Notecards.Remove(key); | ||
12709 | } | ||
12710 | } | ||
12711 | 12611 | ||
12712 | protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) | 12612 | protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) |
12713 | { | 12613 | { |
@@ -12892,12 +12792,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12892 | return null; | 12792 | return null; |
12893 | } | 12793 | } |
12894 | 12794 | ||
12895 | public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules) | 12795 | public void GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) |
12896 | { | 12796 | { |
12897 | // avatars case | 12797 | // avatars case |
12898 | // replies as SL wiki | 12798 | // replies as SL wiki |
12899 | 12799 | ||
12900 | LSL_List res = new LSL_List(); | ||
12901 | // SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed | 12800 | // SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed |
12902 | SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? | 12801 | SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? |
12903 | 12802 | ||
@@ -12965,7 +12864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12965 | 12864 | ||
12966 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 12865 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
12967 | if (remain < 1) | 12866 | if (remain < 1) |
12968 | return res; | 12867 | return; |
12969 | 12868 | ||
12970 | int face = (int)rules.GetLSLIntegerItem(idx++); | 12869 | int face = (int)rules.GetLSLIntegerItem(idx++); |
12971 | if (face == ScriptBaseClass.ALL_SIDES) | 12870 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -12992,7 +12891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12992 | 12891 | ||
12993 | case (int)ScriptBaseClass.PRIM_COLOR: | 12892 | case (int)ScriptBaseClass.PRIM_COLOR: |
12994 | if (remain < 1) | 12893 | if (remain < 1) |
12995 | return res; | 12894 | return; |
12996 | 12895 | ||
12997 | face = (int)rules.GetLSLIntegerItem(idx++); | 12896 | face = (int)rules.GetLSLIntegerItem(idx++); |
12998 | 12897 | ||
@@ -13013,7 +12912,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13013 | 12912 | ||
13014 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 12913 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
13015 | if (remain < 1) | 12914 | if (remain < 1) |
13016 | return res; | 12915 | return; |
13017 | face = (int)rules.GetLSLIntegerItem(idx++); | 12916 | face = (int)rules.GetLSLIntegerItem(idx++); |
13018 | 12917 | ||
13019 | if (face == ScriptBaseClass.ALL_SIDES) | 12918 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -13033,7 +12932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13033 | 12932 | ||
13034 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 12933 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
13035 | if (remain < 1) | 12934 | if (remain < 1) |
13036 | return res; | 12935 | return; |
13037 | face = (int)rules.GetLSLIntegerItem(idx++); | 12936 | face = (int)rules.GetLSLIntegerItem(idx++); |
13038 | 12937 | ||
13039 | if (face == ScriptBaseClass.ALL_SIDES) | 12938 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -13062,7 +12961,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13062 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 12961 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
13063 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | 12962 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) |
13064 | if (remain < 1) | 12963 | if (remain < 1) |
13065 | return res; | 12964 | return; |
13066 | face = (int)rules.GetLSLIntegerItem(idx++); | 12965 | face = (int)rules.GetLSLIntegerItem(idx++); |
13067 | 12966 | ||
13068 | if (face == ScriptBaseClass.ALL_SIDES) | 12967 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -13088,7 +12987,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13088 | 12987 | ||
13089 | case (int)ScriptBaseClass.PRIM_GLOW: | 12988 | case (int)ScriptBaseClass.PRIM_GLOW: |
13090 | if (remain < 1) | 12989 | if (remain < 1) |
13091 | return res; | 12990 | return; |
13092 | face = (int)rules.GetLSLIntegerItem(idx++); | 12991 | face = (int)rules.GetLSLIntegerItem(idx++); |
13093 | 12992 | ||
13094 | if (face == ScriptBaseClass.ALL_SIDES) | 12993 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -13142,15 +13041,118 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13142 | 13041 | ||
13143 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 13042 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
13144 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 13043 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
13145 | return res; | 13044 | return; |
13146 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 13045 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
13147 | LSL_List new_rules = rules.GetSublist(idx, -1); | 13046 | LSL_List new_rules = rules.GetSublist(idx, -1); |
13148 | 13047 | ||
13149 | res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | 13048 | res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); |
13150 | return res; | 13049 | return; |
13151 | } | 13050 | } |
13152 | } | 13051 | } |
13153 | return res; | 13052 | } |
13053 | } | ||
13054 | |||
13055 | public class NotecardCache | ||
13056 | { | ||
13057 | protected class Notecard | ||
13058 | { | ||
13059 | public string[] text; | ||
13060 | public DateTime lastRef; | ||
13061 | } | ||
13062 | |||
13063 | protected static Dictionary<UUID, Notecard> m_Notecards = | ||
13064 | new Dictionary<UUID, Notecard>(); | ||
13065 | |||
13066 | public static void Cache(UUID assetID, string text) | ||
13067 | { | ||
13068 | CacheCheck(); | ||
13069 | |||
13070 | lock (m_Notecards) | ||
13071 | { | ||
13072 | if (m_Notecards.ContainsKey(assetID)) | ||
13073 | return; | ||
13074 | |||
13075 | Notecard nc = new Notecard(); | ||
13076 | nc.lastRef = DateTime.Now; | ||
13077 | nc.text = SLUtil.ParseNotecardToList(text).ToArray(); | ||
13078 | m_Notecards[assetID] = nc; | ||
13079 | } | ||
13080 | } | ||
13081 | |||
13082 | public static bool IsCached(UUID assetID) | ||
13083 | { | ||
13084 | lock (m_Notecards) | ||
13085 | { | ||
13086 | return m_Notecards.ContainsKey(assetID); | ||
13087 | } | ||
13088 | } | ||
13089 | |||
13090 | public static int GetLines(UUID assetID) | ||
13091 | { | ||
13092 | if (!IsCached(assetID)) | ||
13093 | return -1; | ||
13094 | |||
13095 | lock (m_Notecards) | ||
13096 | { | ||
13097 | m_Notecards[assetID].lastRef = DateTime.Now; | ||
13098 | return m_Notecards[assetID].text.Length; | ||
13099 | } | ||
13100 | } | ||
13101 | |||
13102 | /// <summary> | ||
13103 | /// Get a notecard line. | ||
13104 | /// </summary> | ||
13105 | /// <param name="assetID"></param> | ||
13106 | /// <param name="line">Lines start at index 0</param> | ||
13107 | /// <returns></returns> | ||
13108 | public static string GetLine(UUID assetID, int lineNumber) | ||
13109 | { | ||
13110 | if (lineNumber < 0) | ||
13111 | return ""; | ||
13112 | |||
13113 | string data; | ||
13114 | |||
13115 | if (!IsCached(assetID)) | ||
13116 | return ""; | ||
13117 | |||
13118 | lock (m_Notecards) | ||
13119 | { | ||
13120 | m_Notecards[assetID].lastRef = DateTime.Now; | ||
13121 | |||
13122 | if (lineNumber >= m_Notecards[assetID].text.Length) | ||
13123 | return "\n\n\n"; | ||
13124 | |||
13125 | data = m_Notecards[assetID].text[lineNumber]; | ||
13126 | |||
13127 | return data; | ||
13128 | } | ||
13129 | } | ||
13130 | |||
13131 | /// <summary> | ||
13132 | /// Get a notecard line. | ||
13133 | /// </summary> | ||
13134 | /// <param name="assetID"></param> | ||
13135 | /// <param name="line">Lines start at index 0</param> | ||
13136 | /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> | ||
13137 | /// <returns></returns> | ||
13138 | public static string GetLine(UUID assetID, int lineNumber, int maxLength) | ||
13139 | { | ||
13140 | string line = GetLine(assetID, lineNumber); | ||
13141 | |||
13142 | if (line.Length > maxLength) | ||
13143 | line = line.Substring(0, maxLength); | ||
13144 | |||
13145 | return line; | ||
13146 | } | ||
13147 | |||
13148 | public static void CacheCheck() | ||
13149 | { | ||
13150 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) | ||
13151 | { | ||
13152 | Notecard nc = m_Notecards[key]; | ||
13153 | if (nc.lastRef.AddSeconds(30) < DateTime.Now) | ||
13154 | m_Notecards.Remove(key); | ||
13155 | } | ||
13154 | } | 13156 | } |
13155 | } | 13157 | } |
13156 | } | 13158 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7b71a24..efd1f39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2261,7 +2261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2261 | List<SceneObjectPart> parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); | 2261 | List<SceneObjectPart> parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); |
2262 | foreach (SceneObjectPart part in parts) | 2262 | foreach (SceneObjectPart part in parts) |
2263 | { | 2263 | { |
2264 | retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); | 2264 | ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); |
2265 | } | 2265 | } |
2266 | return retVal; | 2266 | return retVal; |
2267 | } | 2267 | } |