aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie2010-03-06 11:58:19 +0000
committerMelanie2010-03-06 11:58:19 +0000
commit9fa9cfd2154fb1225b5b96ad26d7284d446f9961 (patch)
tree2a0f1ba9ea7bfb211819fbb9946315cb89a9d828 /OpenSim/Region/ScriptEngine/Shared
parent- implementing server 1.38 functions (diff)
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.zip
opensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.tar.gz
opensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.tar.bz2
opensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs97
1 files changed, 10 insertions, 87 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f1241a1..0a871d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -52,7 +52,6 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
52using OpenSim.Region.ScriptEngine.Interfaces; 52using OpenSim.Region.ScriptEngine.Interfaces;
53using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 53using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
54using OpenSim.Services.Interfaces; 54using OpenSim.Services.Interfaces;
55using OpenSim.Services.Interfaces;
56using GridRegion = OpenSim.Services.Interfaces.GridRegion; 55using GridRegion = OpenSim.Services.Interfaces.GridRegion;
57using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 56using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
58using PrimType = OpenSim.Region.Framework.Scenes.PrimType; 57using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
@@ -2897,9 +2896,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2897 2896
2898 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 2897 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
2899 2898
2900 m_ScriptEngine.World.AttachObject(presence.ControllingClient, 2899 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
2901 grp.LocalId, (uint)attachment, Quaternion.Identity, 2900 if (attachmentsModule != null)
2902 Vector3.Zero, false); 2901 attachmentsModule.AttachObject(
2902 presence.ControllingClient, grp.LocalId,
2903 (uint)attachment, Quaternion.Identity, Vector3.Zero, false);
2903 } 2904 }
2904 } 2905 }
2905 2906
@@ -2930,8 +2931,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2930 2931
2931 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 2932 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
2932 2933
2933 m_ScriptEngine.World.DetachSingleAttachmentToInv(itemID, 2934 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
2934 presence.ControllingClient); 2935 if (attachmentsModule != null)
2936 attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient);
2935 } 2937 }
2936 } 2938 }
2937 2939
@@ -9784,90 +9786,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9784 9786
9785 Notecard nc = new Notecard(); 9787 Notecard nc = new Notecard();
9786 nc.lastRef = DateTime.Now; 9788 nc.lastRef = DateTime.Now;
9787 nc.text = ParseText(text.Replace("\r", "").Split('\n')); 9789 nc.text = SLUtil.ParseNotecardToList(text).ToArray();
9788 m_Notecards[assetID] = nc; 9790 m_Notecards[assetID] = nc;
9789 } 9791 }
9790 } 9792 }
9791 9793
9792 protected static string[] ParseText(string[] input)
9793 {
9794 int idx = 0;
9795 int level = 0;
9796 List<string> output = new List<string>();
9797 string[] words;
9798
9799 while (idx < input.Length)
9800 {
9801 if (input[idx] == "{")
9802 {
9803 level++;
9804 idx++;
9805 continue;
9806 }
9807
9808 if (input[idx]== "}")
9809 {
9810 level--;
9811 idx++;
9812 continue;
9813 }
9814
9815 switch (level)
9816 {
9817 case 0:
9818 words = input[idx].Split(' '); // Linden text ver
9819 // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
9820 if (words.Length < 3)
9821 return new String[0];
9822
9823 int version = int.Parse(words[3]);
9824 if (version != 2)
9825 return new String[0];
9826 break;
9827 case 1:
9828 words = input[idx].Split(' ');
9829 if (words[0] == "LLEmbeddedItems")
9830 break;
9831 if (words[0] == "Text")
9832 {
9833 int len = int.Parse(words[2]);
9834 idx++;
9835
9836 int count = -1;
9837
9838 while (count < len)
9839 {
9840 // int l = input[idx].Length;
9841 string ln = input[idx];
9842
9843 int need = len-count-1;
9844 if (ln.Length > need)
9845 ln = ln.Substring(0, need);
9846
9847 output.Add(ln);
9848 count += ln.Length + 1;
9849 idx++;
9850 }
9851
9852 return output.ToArray();
9853 }
9854 break;
9855 case 2:
9856 words = input[idx].Split(' '); // count
9857 if (words[0] == "count")
9858 {
9859 int c = int.Parse(words[1]);
9860 if (c > 0)
9861 return new String[0];
9862 break;
9863 }
9864 break;
9865 }
9866 idx++;
9867 }
9868 return output.ToArray();
9869 }
9870
9871 public static bool IsCached(UUID assetID) 9794 public static bool IsCached(UUID assetID)
9872 { 9795 {
9873 lock (m_Notecards) 9796 lock (m_Notecards)
@@ -9923,4 +9846,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9923 } 9846 }
9924 } 9847 }
9925 } 9848 }
9926} 9849} \ No newline at end of file