aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs196
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs20
4 files changed, 124 insertions, 97 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3f9c026..4661488 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -53,7 +53,6 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
53using OpenSim.Region.ScriptEngine.Interfaces; 53using OpenSim.Region.ScriptEngine.Interfaces;
54using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 54using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
55using OpenSim.Services.Interfaces; 55using OpenSim.Services.Interfaces;
56using OpenSim.Services.Interfaces;
57using GridRegion = OpenSim.Services.Interfaces.GridRegion; 56using GridRegion = OpenSim.Services.Interfaces.GridRegion;
58using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 57using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
59using PrimType = OpenSim.Region.Framework.Scenes.PrimType; 58using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
@@ -3066,9 +3065,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3066 3065
3067 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 3066 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3068 3067
3069 m_ScriptEngine.World.AttachObject(presence.ControllingClient, 3068 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3070 grp.LocalId, (uint)attachment, Quaternion.Identity, 3069 if (attachmentsModule != null)
3071 Vector3.Zero, false); 3070 attachmentsModule.AttachObject(
3071 presence.ControllingClient, grp.LocalId,
3072 (uint)attachment, Quaternion.Identity, Vector3.Zero, false);
3072 } 3073 }
3073 } 3074 }
3074 3075
@@ -3105,8 +3106,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3105 3106
3106 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 3107 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3107 3108
3108 m_ScriptEngine.World.DetachSingleAttachmentToInv(itemID, 3109 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3109 presence.ControllingClient); 3110 if (attachmentsModule != null)
3111 attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient);
3110 } 3112 }
3111 } 3113 }
3112 3114
@@ -5598,12 +5600,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5598 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) 5600 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
5599 { 5601 {
5600 m_host.AddScriptLPS(1); 5602 m_host.AddScriptLPS(1);
5603
5604 SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate);
5605 }
5606
5607 public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate)
5608 {
5609 m_host.AddScriptLPS(1);
5610
5611 List<SceneObjectPart> parts = GetLinkParts(linknumber);
5612
5613 foreach (var part in parts)
5614 {
5615 SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
5616 }
5617 }
5618
5619 private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate)
5620 {
5621
5601 Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); 5622 Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation();
5602 pTexAnim.Flags = (Primitive.TextureAnimMode)mode; 5623 pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
5603 5624
5604 //ALL_SIDES 5625 //ALL_SIDES
5605 if (face == ScriptBaseClass.ALL_SIDES) 5626 if (face == ScriptBaseClass.ALL_SIDES)
5606 face = 255; 5627 face = 255;
5607 5628
5608 pTexAnim.Face = (uint)face; 5629 pTexAnim.Face = (uint)face;
5609 pTexAnim.Length = (float)length; 5630 pTexAnim.Length = (float)length;
@@ -5612,9 +5633,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5612 pTexAnim.SizeY = (uint)sizey; 5633 pTexAnim.SizeY = (uint)sizey;
5613 pTexAnim.Start = (float)start; 5634 pTexAnim.Start = (float)start;
5614 5635
5615 m_host.AddTextureAnimation(pTexAnim); 5636 part.AddTextureAnimation(pTexAnim);
5616 m_host.SendFullUpdateToAllClients(); 5637 part.SendFullUpdateToAllClients();
5617 m_host.ParentGroup.HasGroupChanged = true; 5638 part.ParentGroup.HasGroupChanged = true;
5618 } 5639 }
5619 5640
5620 public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, 5641 public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
@@ -6011,13 +6032,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6011 return ps; 6032 return ps;
6012 } 6033 }
6013 6034
6035 public void llLinkParticleSystem(int linknumber, LSL_List rules)
6036 {
6037 m_host.AddScriptLPS(1);
6038
6039 List<SceneObjectPart> parts = GetLinkParts(linknumber);
6040
6041 foreach (var part in parts)
6042 {
6043 SetParticleSystem(part, rules);
6044 }
6045 }
6046
6014 public void llParticleSystem(LSL_List rules) 6047 public void llParticleSystem(LSL_List rules)
6015 { 6048 {
6016 m_host.AddScriptLPS(1); 6049 m_host.AddScriptLPS(1);
6050 SetParticleSystem(m_host, rules);
6051 }
6052
6053 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
6054
6055
6017 if (rules.Length == 0) 6056 if (rules.Length == 0)
6018 { 6057 {
6019 m_host.RemoveParticleSystem(); 6058 part.RemoveParticleSystem();
6020 m_host.ParentGroup.HasGroupChanged = true; 6059 part.ParentGroup.HasGroupChanged = true;
6021 } 6060 }
6022 else 6061 else
6023 { 6062 {
@@ -6128,7 +6167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6128 } 6167 }
6129 else 6168 else
6130 { 6169 {
6131 prules.Target = m_host.UUID; 6170 prules.Target = part.UUID;
6132 } 6171 }
6133 break; 6172 break;
6134 6173
@@ -6154,10 +6193,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6154 } 6193 }
6155 prules.CRC = 1; 6194 prules.CRC = 1;
6156 6195
6157 m_host.AddNewParticleSystem(prules); 6196 part.AddNewParticleSystem(prules);
6158 m_host.ParentGroup.HasGroupChanged = true; 6197 part.ParentGroup.HasGroupChanged = true;
6159 } 6198 }
6160 m_host.SendFullUpdateToAllClients(); 6199 part.SendFullUpdateToAllClients();
6161 } 6200 }
6162 6201
6163 public void llGroundRepel(double height, int water, double tau) 6202 public void llGroundRepel(double height, int water, double tau)
@@ -6966,6 +7005,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6966 SetPrimParams(part, rules); 7005 SetPrimParams(part, rules);
6967 } 7006 }
6968 7007
7008 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
7009 {
7010 llSetLinkPrimitiveParams(linknumber, rules);
7011 }
7012
6969 protected void SetPrimParams(SceneObjectPart part, LSL_List rules) 7013 protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
6970 { 7014 {
6971 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7015 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -7325,6 +7369,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7325 int style = rules.GetLSLIntegerItem(idx++); 7369 int style = rules.GetLSLIntegerItem(idx++);
7326 SetTexGen(part, face, style); 7370 SetTexGen(part, face, style);
7327 break; 7371 break;
7372 case (int)ScriptBaseClass.PRIM_TEXT:
7373 if (remain < 3)
7374 return;
7375 string primText = rules.GetLSLStringItem(idx++);
7376 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
7377 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
7378 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
7379 Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
7380 Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
7381 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
7382
7383 break;
7328 } 7384 }
7329 } 7385 }
7330 } 7386 }
@@ -7568,6 +7624,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7568 return GetLinkPrimitiveParams(m_host, rules); 7624 return GetLinkPrimitiveParams(m_host, rules);
7569 } 7625 }
7570 7626
7627 public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
7628 {
7629 m_host.AddScriptLPS(1);
7630
7631 List<SceneObjectPart> parts = GetLinkParts(linknumber);
7632
7633 LSL_List res = new LSL_List();
7634
7635 foreach (var part in parts)
7636 {
7637 LSL_List partRes = GetLinkPrimitiveParams(part, rules);
7638 res += partRes;
7639 }
7640
7641 return res;
7642 }
7643
7571 public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) 7644 public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
7572 { 7645 {
7573 LSL_List res = new LSL_List(); 7646 LSL_List res = new LSL_List();
@@ -7951,6 +8024,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7951 res.Add(new LSL_Float(primglow)); 8024 res.Add(new LSL_Float(primglow));
7952 } 8025 }
7953 break; 8026 break;
8027 case (int)ScriptBaseClass.PRIM_TEXT:
8028 Color4 textColor = part.GetTextColor();
8029 res.Add(part.Text);
8030 res.Add(new LSL_Vector(textColor.R,
8031 textColor.G,
8032 textColor.B));
8033 res.Add(new LSL_Float(textColor.A));
8034 break;
7954 } 8035 }
7955 } 8036 }
7956 return res; 8037 return res;
@@ -10050,90 +10131,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10050 10131
10051 Notecard nc = new Notecard(); 10132 Notecard nc = new Notecard();
10052 nc.lastRef = DateTime.Now; 10133 nc.lastRef = DateTime.Now;
10053 nc.text = ParseText(text.Replace("\r", "").Split('\n')); 10134 nc.text = SLUtil.ParseNotecardToList(text).ToArray();
10054 m_Notecards[assetID] = nc; 10135 m_Notecards[assetID] = nc;
10055 } 10136 }
10056 } 10137 }
10057 10138
10058 protected static string[] ParseText(string[] input)
10059 {
10060 int idx = 0;
10061 int level = 0;
10062 List<string> output = new List<string>();
10063 string[] words;
10064
10065 while (idx < input.Length)
10066 {
10067 if (input[idx] == "{")
10068 {
10069 level++;
10070 idx++;
10071 continue;
10072 }
10073
10074 if (input[idx]== "}")
10075 {
10076 level--;
10077 idx++;
10078 continue;
10079 }
10080
10081 switch (level)
10082 {
10083 case 0:
10084 words = input[idx].Split(' '); // Linden text ver
10085 // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
10086 if (words.Length < 3)
10087 return new String[0];
10088
10089 int version = int.Parse(words[3]);
10090 if (version != 2)
10091 return new String[0];
10092 break;
10093 case 1:
10094 words = input[idx].Split(' ');
10095 if (words[0] == "LLEmbeddedItems")
10096 break;
10097 if (words[0] == "Text")
10098 {
10099 int len = int.Parse(words[2]);
10100 idx++;
10101
10102 int count = -1;
10103
10104 while (count < len)
10105 {
10106 // int l = input[idx].Length;
10107 string ln = input[idx];
10108
10109 int need = len-count-1;
10110 if (ln.Length > need)
10111 ln = ln.Substring(0, need);
10112
10113 output.Add(ln);
10114 count += ln.Length + 1;
10115 idx++;
10116 }
10117
10118 return output.ToArray();
10119 }
10120 break;
10121 case 2:
10122 words = input[idx].Split(' '); // count
10123 if (words[0] == "count")
10124 {
10125 int c = int.Parse(words[1]);
10126 if (c > 0)
10127 return new String[0];
10128 break;
10129 }
10130 break;
10131 }
10132 idx++;
10133 }
10134 return output.ToArray();
10135 }
10136
10137 public static bool IsCached(UUID assetID) 10139 public static bool IsCached(UUID assetID)
10138 { 10140 {
10139 lock (m_Notecards) 10141 lock (m_Notecards)
@@ -10189,4 +10191,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10189 } 10191 }
10190 } 10192 }
10191 } 10193 }
10192} 10194} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index a74e8da..7ab04a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
135 LSL_Key llGetLinkKey(int linknum); 135 LSL_Key llGetLinkKey(int linknum);
136 LSL_String llGetLinkName(int linknum); 136 LSL_String llGetLinkName(int linknum);
137 LSL_Integer llGetLinkNumber(); 137 LSL_Integer llGetLinkNumber();
138 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
138 LSL_Integer llGetListEntryType(LSL_List src, int index); 139 LSL_Integer llGetListEntryType(LSL_List src, int index);
139 LSL_Integer llGetListLength(LSL_List src); 140 LSL_Integer llGetListLength(LSL_List src);
140 LSL_Vector llGetLocalPos(); 141 LSL_Vector llGetLocalPos();
@@ -206,6 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
206 void llInstantMessage(string user, string message); 207 void llInstantMessage(string user, string message);
207 LSL_String llIntegerToBase64(int number); 208 LSL_String llIntegerToBase64(int number);
208 LSL_String llKey2Name(string id); 209 LSL_String llKey2Name(string id);
210 void llLinkParticleSystem(int linknum, LSL_List rules);
209 LSL_String llList2CSV(LSL_List src); 211 LSL_String llList2CSV(LSL_List src);
210 LSL_Float llList2Float(LSL_List src, int index); 212 LSL_Float llList2Float(LSL_List src, int index);
211 LSL_Integer llList2Integer(LSL_List src, int index); 213 LSL_Integer llList2Integer(LSL_List src, int index);
@@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
322 void llSetLinkColor(int linknumber, LSL_Vector color, int face); 324 void llSetLinkColor(int linknumber, LSL_Vector color, int face);
323 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); 325 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
324 void llSetLinkTexture(int linknumber, string texture, int face); 326 void llSetLinkTexture(int linknumber, string texture, int face);
327 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
325 void llSetLocalRot(LSL_Rotation rot); 328 void llSetLocalRot(LSL_Rotation rot);
326 void llSetObjectDesc(string desc); 329 void llSetObjectDesc(string desc);
327 void llSetObjectName(string name); 330 void llSetObjectName(string name);
@@ -330,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
330 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 333 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
331 void llSetPos(LSL_Vector pos); 334 void llSetPos(LSL_Vector pos);
332 void llSetPrimitiveParams(LSL_List rules); 335 void llSetPrimitiveParams(LSL_List rules);
336 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
333 void llSetPrimURL(string url); 337 void llSetPrimURL(string url);
334 void llSetRemoteScriptAccessPin(int pin); 338 void llSetRemoteScriptAccessPin(int pin);
335 void llSetRot(LSL_Rotation rot); 339 void llSetRot(LSL_Rotation rot);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 7cf82b2..ee35fa4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -313,6 +313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
313 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake 313 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
314 public const int PRIM_POINT_LIGHT = 23; // Huh? 314 public const int PRIM_POINT_LIGHT = 23; // Huh?
315 public const int PRIM_GLOW = 25; 315 public const int PRIM_GLOW = 25;
316 public const int PRIM_TEXT = 26;
316 public const int PRIM_TEXGEN_DEFAULT = 0; 317 public const int PRIM_TEXGEN_DEFAULT = 0;
317 public const int PRIM_TEXGEN_PLANAR = 1; 318 public const int PRIM_TEXGEN_PLANAR = 1;
318 319
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index a28e97b..3339995 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -674,6 +674,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
674 return m_LSL_Functions.llGetPrimitiveParams(rules); 674 return m_LSL_Functions.llGetPrimitiveParams(rules);
675 } 675 }
676 676
677 public LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules)
678 {
679 return m_LSL_Functions.llGetLinkPrimitiveParams(linknum, rules);
680 }
681
677 public LSL_Integer llGetRegionAgentCount() 682 public LSL_Integer llGetRegionAgentCount()
678 { 683 {
679 return m_LSL_Functions.llGetRegionAgentCount(); 684 return m_LSL_Functions.llGetRegionAgentCount();
@@ -889,6 +894,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
889 return m_LSL_Functions.llKey2Name(id); 894 return m_LSL_Functions.llKey2Name(id);
890 } 895 }
891 896
897 public void llLinkParticleSystem(int linknum, LSL_List rules)
898 {
899 m_LSL_Functions.llLinkParticleSystem(linknum, rules);
900 }
901
892 public LSL_String llList2CSV(LSL_List src) 902 public LSL_String llList2CSV(LSL_List src)
893 { 903 {
894 return m_LSL_Functions.llList2CSV(src); 904 return m_LSL_Functions.llList2CSV(src);
@@ -1468,6 +1478,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1468 m_LSL_Functions.llSetLinkTexture(linknumber, texture, face); 1478 m_LSL_Functions.llSetLinkTexture(linknumber, texture, face);
1469 } 1479 }
1470 1480
1481 public void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate)
1482 {
1483 m_LSL_Functions.llSetLinkTextureAnim(linknum, mode, face, sizex, sizey, start, length, rate);
1484 }
1485
1471 public void llSetLocalRot(LSL_Rotation rot) 1486 public void llSetLocalRot(LSL_Rotation rot)
1472 { 1487 {
1473 m_LSL_Functions.llSetLocalRot(rot); 1488 m_LSL_Functions.llSetLocalRot(rot);
@@ -1508,6 +1523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1508 m_LSL_Functions.llSetPrimitiveParams(rules); 1523 m_LSL_Functions.llSetPrimitiveParams(rules);
1509 } 1524 }
1510 1525
1526 public void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules)
1527 {
1528 m_LSL_Functions.llSetLinkPrimitiveParamsFast(linknum, rules);
1529 }
1530
1511 public void llSetPrimURL(string url) 1531 public void llSetPrimURL(string url)
1512 { 1532 {
1513 m_LSL_Functions.llSetPrimURL(url); 1533 m_LSL_Functions.llSetPrimURL(url);