aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs119
1 files changed, 70 insertions, 49 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 633cca8..ba42678 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -81,10 +81,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
81 protected float m_MinTimerInterval = 0.5f; 81 protected float m_MinTimerInterval = 0.5f;
82 82
83 protected DateTime m_timer = DateTime.Now; 83 protected DateTime m_timer = DateTime.Now;
84 protected bool m_waitingForScriptAnswer=false; 84 protected bool m_waitingForScriptAnswer = false;
85 protected bool m_automaticLinkPermission=false; 85 protected bool m_automaticLinkPermission = false;
86 protected IMessageTransferModule m_TransferModule = null; 86 protected IMessageTransferModule m_TransferModule = null;
87 protected int m_notecardLineReadCharsMax = 255; 87 protected int m_notecardLineReadCharsMax = 255;
88 protected int m_scriptConsoleChannel = 0;
89 protected bool m_scriptConsoleChannelEnabled = false;
88 protected IUrlModule m_UrlModule = null; 90 protected IUrlModule m_UrlModule = null;
89 91
90 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 92 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
@@ -94,21 +96,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
94 m_localID = localID; 96 m_localID = localID;
95 m_itemID = itemID; 97 m_itemID = itemID;
96 98
97 m_ScriptDelayFactor = 99 m_ScriptDelayFactor = m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
98 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 100 m_ScriptDistanceFactor = m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
99 m_ScriptDistanceFactor = 101 m_MinTimerInterval = m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
100 m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f); 102 m_automaticLinkPermission = m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
101 m_MinTimerInterval = 103 m_scriptConsoleChannel = m_ScriptEngine.Config.GetInt("ScriptConsoleChannel", 0);
102 m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); 104 m_scriptConsoleChannelEnabled = (m_scriptConsoleChannel != 0);
103 m_automaticLinkPermission = 105 m_notecardLineReadCharsMax = m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
104 m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
105 m_notecardLineReadCharsMax =
106 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
107 if (m_notecardLineReadCharsMax > 65535) 106 if (m_notecardLineReadCharsMax > 65535)
108 m_notecardLineReadCharsMax = 65535; 107 m_notecardLineReadCharsMax = 65535;
109 108
110 m_TransferModule = 109 m_TransferModule = m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
111 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
112 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 110 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
113 if (m_UrlModule != null) 111 if (m_UrlModule != null)
114 { 112 {
@@ -565,10 +563,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
565 double s2 = Math.Sin(v.y * 0.5); 563 double s2 = Math.Sin(v.y * 0.5);
566 double s3 = Math.Sin(v.z * 0.5); 564 double s3 = Math.Sin(v.z * 0.5);
567 565
568 x = s1*c2*c3+c1*s2*s3; 566 x = s1 * c2 * c3 + c1 * s2 * s3;
569 y = c1*s2*c3-s1*c2*s3; 567 y = c1 * s2 * c3 - s1 * c2 * s3;
570 z = s1*s2*c3+c1*c2*s3; 568 z = s1 * s2 * c3 + c1 * c2 * s3;
571 s = c1*c2*c3-s1*s2*s3; 569 s = c1 * c2 * c3 - s1 * s2 * s3;
572 570
573 return new LSL_Rotation(x, y, z, s); 571 return new LSL_Rotation(x, y, z, s);
574 } 572 }
@@ -742,14 +740,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
742 { 740 {
743 m_host.AddScriptLPS(1); 741 m_host.AddScriptLPS(1);
744 742
745 if (text.Length > 1023) 743 if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
746 text = text.Substring(0, 1023); 744 {
745 Console.WriteLine(text);
746 }
747 else
748 {
749 if (text.Length > 1023)
750 text = text.Substring(0, 1023);
747 751
748 World.SimChat(Utils.StringToBytes(text), 752 World.SimChat(Utils.StringToBytes(text),
749 ChatTypeEnum.Say, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); 753 ChatTypeEnum.Say, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
750 754
751 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 755 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
752 wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text); 756 wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
757 }
753 } 758 }
754 759
755 public void llShout(int channelID, string text) 760 public void llShout(int channelID, string text)
@@ -6316,11 +6321,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6316 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); 6321 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
6317 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); 6322 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
6318 if (xmlRpcRouter != null) 6323 if (xmlRpcRouter != null)
6319 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, m_itemID, "http://"+System.Environment.MachineName+":"+xmlrpcMod.Port.ToString()+"/"); 6324 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
6320 object[] resobj = new object[] { new LSL_Integer(1), new LSL_String(channelID.ToString()), new LSL_String(UUID.Zero.ToString()), new LSL_String(String.Empty), new LSL_Integer(0), new LSL_String(String.Empty) }; 6325 m_itemID, String.Format("http://{0}:{1}/", System.Environment.MachineName,
6321 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 6326 xmlrpcMod.Port.ToString()));
6322 "remote_data", resobj, 6327 object[] resobj = new object[]
6323 new DetectParams[0])); 6328 {
6329 new LSL_Integer(1),
6330 new LSL_String(channelID.ToString()),
6331 new LSL_String(UUID.Zero.ToString()),
6332 new LSL_String(String.Empty),
6333 new LSL_Integer(0),
6334 new LSL_String(String.Empty)
6335 };
6336 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj,
6337 new DetectParams[0]));
6324 } 6338 }
6325 ConditionalScriptSleep(1000); 6339 ConditionalScriptSleep(1000);
6326 } 6340 }
@@ -6352,7 +6366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6352 public LSL_String llMD5String(string src, int nonce) 6366 public LSL_String llMD5String(string src, int nonce)
6353 { 6367 {
6354 m_host.AddScriptLPS(1); 6368 m_host.AddScriptLPS(1);
6355 return Util.Md5Hash(src + ":" + nonce.ToString()); 6369 return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString()));
6356 } 6370 }
6357 6371
6358 public LSL_String llSHA1String(string src) 6372 public LSL_String llSHA1String(string src)
@@ -6729,12 +6743,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6729 // try to let this work as in SL... 6743 // try to let this work as in SL...
6730 if (part.ParentID == 0) 6744 if (part.ParentID == 0)
6731 { 6745 {
6732 // special case: If we are root, rotate complete SOG to new rotation 6746 // special case: If we are root, rotate
6747 // complete SOG to new rotation
6733 SetRot(part, Rot2Quaternion(q)); 6748 SetRot(part, Rot2Quaternion(q));
6734 } 6749 }
6735 else 6750 else
6736 { 6751 {
6737 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 6752 // we are a child. The rotation values
6753 // will be set to the one of root modified
6754 // by rot, as in SL. Don't ask.
6738 SceneObjectGroup group = part.ParentGroup; 6755 SceneObjectGroup group = part.ParentGroup;
6739 if (group != null) // a bit paranoid, maybe 6756 if (group != null) // a bit paranoid, maybe
6740 { 6757 {
@@ -6840,7 +6857,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6840 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 6857 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
6841 skew = (float)rules.GetLSLFloatItem(idx++); 6858 skew = (float)rules.GetLSLFloatItem(idx++);
6842 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6859 part.Shape.PathCurve = (byte)Extrusion.Curve1;
6843 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); 6860 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
6861 revolutions, radiusoffset, skew, 0);
6844 break; 6862 break;
6845 6863
6846 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 6864 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@@ -6859,7 +6877,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6859 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 6877 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
6860 skew = (float)rules.GetLSLFloatItem(idx++); 6878 skew = (float)rules.GetLSLFloatItem(idx++);
6861 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6879 part.Shape.PathCurve = (byte)Extrusion.Curve1;
6862 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); 6880 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
6881 revolutions, radiusoffset, skew, 1);
6863 break; 6882 break;
6864 6883
6865 case (int)ScriptBaseClass.PRIM_TYPE_RING: 6884 case (int)ScriptBaseClass.PRIM_TYPE_RING:
@@ -6878,7 +6897,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6878 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 6897 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
6879 skew = (float)rules.GetLSLFloatItem(idx++); 6898 skew = (float)rules.GetLSLFloatItem(idx++);
6880 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6899 part.Shape.PathCurve = (byte)Extrusion.Curve1;
6881 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); 6900 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
6901 revolutions, radiusoffset, skew, 3);
6882 break; 6902 break;
6883 6903
6884 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 6904 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@@ -7125,7 +7145,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7125 public LSL_Vector llGetRootPosition() 7145 public LSL_Vector llGetRootPosition()
7126 { 7146 {
7127 m_host.AddScriptLPS(1); 7147 m_host.AddScriptLPS(1);
7128 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, m_host.ParentGroup.AbsolutePosition.Z); 7148 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y,
7149 m_host.ParentGroup.AbsolutePosition.Z);
7129 } 7150 }
7130 7151
7131 /// <summary> 7152 /// <summary>
@@ -7763,39 +7784,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7763 // -1 == invalid 7784 // -1 == invalid
7764 // 0 == padding 7785 // 0 == padding
7765 7786
7766 if ((digit=c2itable[str[0]])<=0) 7787 if ((digit = c2itable[str[0]]) <= 0)
7767 { 7788 {
7768 return digit<0?(int)0:number; 7789 return digit < 0 ? (int)0 : number;
7769 } 7790 }
7770 number += --digit<<26; 7791 number += --digit<<26;
7771 7792
7772 if ((digit=c2itable[str[1]])<=0) 7793 if ((digit = c2itable[str[1]]) <= 0)
7773 { 7794 {
7774 return digit<0?(int)0:number; 7795 return digit < 0 ? (int)0 : number;
7775 } 7796 }
7776 number += --digit<<20; 7797 number += --digit<<20;
7777 7798
7778 if ((digit=c2itable[str[2]])<=0) 7799 if ((digit = c2itable[str[2]]) <= 0)
7779 { 7800 {
7780 return digit<0?(int)0:number; 7801 return digit < 0 ? (int)0 : number;
7781 } 7802 }
7782 number += --digit<<14; 7803 number += --digit<<14;
7783 7804
7784 if ((digit=c2itable[str[3]])<=0) 7805 if ((digit = c2itable[str[3]]) <= 0)
7785 { 7806 {
7786 return digit<0?(int)0:number; 7807 return digit < 0 ? (int)0 : number;
7787 } 7808 }
7788 number += --digit<<8; 7809 number += --digit<<8;
7789 7810
7790 if ((digit=c2itable[str[4]])<=0) 7811 if ((digit = c2itable[str[4]]) <= 0)
7791 { 7812 {
7792 return digit<0?(int)0:number; 7813 return digit < 0 ? (int)0 : number;
7793 } 7814 }
7794 number += --digit<<2; 7815 number += --digit<<2;
7795 7816
7796 if ((digit=c2itable[str[5]])<=0) 7817 if ((digit = c2itable[str[5]]) <= 0)
7797 { 7818 {
7798 return digit<0?(int)0:number; 7819 return digit < 0 ? (int)0 : number;
7799 } 7820 }
7800 number += --digit>>4; 7821 number += --digit>>4;
7801 7822
@@ -7913,7 +7934,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7913 if (active[j]) 7934 if (active[j])
7914 { 7935 {
7915 // scan all of the markers 7936 // scan all of the markers
7916 if ((offset[j] = src.IndexOf(separray[j].ToString(),beginning)) == -1) 7937 if ((offset[j] = src.IndexOf(separray[j].ToString(), beginning)) == -1)
7917 { 7938 {
7918 // not present at all 7939 // not present at all
7919 active[j] = false; 7940 active[j] = false;