diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs | 120 |
1 files changed, 64 insertions, 56 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs index d665bcc..927ab2c 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs | |||
@@ -31,6 +31,8 @@ using System.Threading; | |||
31 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 32 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
33 | using OpenSim.Region.ScriptEngine.Shared; | 33 | using OpenSim.Region.ScriptEngine.Shared; |
34 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | ||
35 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
34 | 36 | ||
35 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 37 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
36 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | 38 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; |
@@ -42,7 +44,7 @@ using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | |||
42 | 44 | ||
43 | namespace OpenSim.Region.ScriptEngine.Common | 45 | namespace OpenSim.Region.ScriptEngine.Common |
44 | { | 46 | { |
45 | public class ScriptBaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, OSSL_BuilIn_Commands_Interface, IScript | 47 | public class ScriptBaseClass : MarshalByRefObject, IScript |
46 | { | 48 | { |
47 | // | 49 | // |
48 | // Included as base for any LSL-script that is compiled. | 50 | // Included as base for any LSL-script that is compiled. |
@@ -71,6 +73,19 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
71 | 73 | ||
72 | private Executor m_Exec; | 74 | private Executor m_Exec; |
73 | 75 | ||
76 | private string m_state = "default"; | ||
77 | |||
78 | public String State | ||
79 | { | ||
80 | get { return m_state; } | ||
81 | set { m_state = value; } | ||
82 | } | ||
83 | |||
84 | public void state(string newState) | ||
85 | { | ||
86 | m_LSL_Functions.state(newState); | ||
87 | } | ||
88 | |||
74 | ExecutorBase IScript.Exec | 89 | ExecutorBase IScript.Exec |
75 | { | 90 | { |
76 | get | 91 | get |
@@ -82,7 +97,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
82 | } | 97 | } |
83 | 98 | ||
84 | 99 | ||
85 | public BuilIn_Commands m_LSL_Functions; | 100 | public ILSL_Api m_LSL_Functions; |
101 | public IOSSL_Api m_OSSL_Functions; | ||
86 | private string _Source = String.Empty; | 102 | private string _Source = String.Empty; |
87 | public string Source | 103 | public string Source |
88 | { | 104 | { |
@@ -104,20 +120,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
104 | { | 120 | { |
105 | } | 121 | } |
106 | 122 | ||
107 | public string State | 123 | public void InitApi(string api, IScriptApi LSL_Functions) |
108 | { | ||
109 | get { return m_LSL_Functions.State; } | ||
110 | set { m_LSL_Functions.State = value; } | ||
111 | } | ||
112 | public void state(string state) | ||
113 | { | ||
114 | State = state; | ||
115 | |||
116 | } | ||
117 | |||
118 | public void Start(BuilIn_Commands LSL_Functions) | ||
119 | { | 124 | { |
120 | m_LSL_Functions = LSL_Functions; | 125 | if (api == "LSL") |
126 | m_LSL_Functions = (ILSL_Api)LSL_Functions; | ||
127 | if (api == "OSSL") | ||
128 | m_OSSL_Functions = (IOSSL_Api)LSL_Functions; | ||
121 | 129 | ||
122 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called."); | 130 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called."); |
123 | 131 | ||
@@ -142,9 +150,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
142 | 150 | ||
143 | 151 | ||
144 | 152 | ||
145 | public OSSL_BuilIn_Commands.OSSLPrim Prim { | 153 | // public OSSL_BuilIn_Commands.OSSLPrim Prim { |
146 | get { return m_LSL_Functions.Prim; } | 154 | // get { return m_LSL_Functions.Prim; } |
147 | } | 155 | // } |
148 | 156 | ||
149 | 157 | ||
150 | // | 158 | // |
@@ -153,10 +161,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
153 | // They are only forwarders to LSL_BuiltIn_Commands.cs | 161 | // They are only forwarders to LSL_BuiltIn_Commands.cs |
154 | // | 162 | // |
155 | 163 | ||
156 | public ICommander GetCommander(string name) | 164 | // public ICommander GetCommander(string name) |
157 | { | 165 | // { |
158 | return m_LSL_Functions.GetCommander(name); | 166 | // return m_LSL_Functions.GetCommander(name); |
159 | } | 167 | // } |
160 | 168 | ||
161 | public LSL_Integer llAbs(int i) | 169 | public LSL_Integer llAbs(int i) |
162 | { | 170 | { |
@@ -1874,84 +1882,84 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1874 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, | 1882 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, |
1875 | int timer) | 1883 | int timer) |
1876 | { | 1884 | { |
1877 | return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); | 1885 | return m_OSSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); |
1878 | } | 1886 | } |
1879 | 1887 | ||
1880 | public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, | 1888 | public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, |
1881 | int timer) | 1889 | int timer) |
1882 | { | 1890 | { |
1883 | return m_LSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); | 1891 | return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); |
1884 | } | 1892 | } |
1885 | 1893 | ||
1886 | public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, | 1894 | public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, |
1887 | int timer, int alpha) | 1895 | int timer, int alpha) |
1888 | { | 1896 | { |
1889 | return m_LSL_Functions.osSetDynamicTextureURLBlend(dynamicID, contentType, url, extraParams, timer, alpha); | 1897 | return m_OSSL_Functions.osSetDynamicTextureURLBlend(dynamicID, contentType, url, extraParams, timer, alpha); |
1890 | } | 1898 | } |
1891 | 1899 | ||
1892 | public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, | 1900 | public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, |
1893 | int timer, int alpha) | 1901 | int timer, int alpha) |
1894 | { | 1902 | { |
1895 | return m_LSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha); | 1903 | return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha); |
1896 | } | 1904 | } |
1897 | 1905 | ||
1898 | public double osTerrainGetHeight(int x, int y) | 1906 | public double osTerrainGetHeight(int x, int y) |
1899 | { | 1907 | { |
1900 | return m_LSL_Functions.osTerrainGetHeight(x, y); | 1908 | return m_OSSL_Functions.osTerrainGetHeight(x, y); |
1901 | } | 1909 | } |
1902 | 1910 | ||
1903 | public int osTerrainSetHeight(int x, int y, double val) | 1911 | public int osTerrainSetHeight(int x, int y, double val) |
1904 | { | 1912 | { |
1905 | return m_LSL_Functions.osTerrainSetHeight(x, y, val); | 1913 | return m_OSSL_Functions.osTerrainSetHeight(x, y, val); |
1906 | } | 1914 | } |
1907 | 1915 | ||
1908 | public int osRegionRestart(double seconds) | 1916 | public int osRegionRestart(double seconds) |
1909 | { | 1917 | { |
1910 | return m_LSL_Functions.osRegionRestart(seconds); | 1918 | return m_OSSL_Functions.osRegionRestart(seconds); |
1911 | } | 1919 | } |
1912 | 1920 | ||
1913 | public void osRegionNotice(string msg) | 1921 | public void osRegionNotice(string msg) |
1914 | { | 1922 | { |
1915 | m_LSL_Functions.osRegionNotice(msg); | 1923 | m_OSSL_Functions.osRegionNotice(msg); |
1916 | } | 1924 | } |
1917 | 1925 | ||
1918 | public bool osConsoleCommand(string Command) | 1926 | public bool osConsoleCommand(string Command) |
1919 | { | 1927 | { |
1920 | return m_LSL_Functions.osConsoleCommand(Command); | 1928 | return m_OSSL_Functions.osConsoleCommand(Command); |
1921 | } | 1929 | } |
1922 | 1930 | ||
1923 | public void osSetParcelMediaURL(string url) | 1931 | public void osSetParcelMediaURL(string url) |
1924 | { | 1932 | { |
1925 | m_LSL_Functions.osSetParcelMediaURL(url); | 1933 | m_OSSL_Functions.osSetParcelMediaURL(url); |
1926 | } | 1934 | } |
1927 | 1935 | ||
1928 | public void osSetPrimFloatOnWater(int floatYN) | 1936 | public void osSetPrimFloatOnWater(int floatYN) |
1929 | { | 1937 | { |
1930 | m_LSL_Functions.osSetPrimFloatOnWater(floatYN); | 1938 | m_OSSL_Functions.osSetPrimFloatOnWater(floatYN); |
1931 | } | 1939 | } |
1932 | 1940 | ||
1933 | // Teleport Functions | 1941 | // Teleport Functions |
1934 | 1942 | ||
1935 | public void osTeleportAgent(string agent, string regionName, LSL_Vector position, LSL_Vector lookat) | 1943 | public void osTeleportAgent(string agent, string regionName, LSL_Vector position, LSL_Vector lookat) |
1936 | { | 1944 | { |
1937 | m_LSL_Functions.osTeleportAgent(agent, regionName, position, lookat); | 1945 | m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); |
1938 | } | 1946 | } |
1939 | 1947 | ||
1940 | public void osTeleportAgent(string agent, LSL_Vector position, LSL_Vector lookat) | 1948 | public void osTeleportAgent(string agent, LSL_Vector position, LSL_Vector lookat) |
1941 | { | 1949 | { |
1942 | m_LSL_Functions.osTeleportAgent(agent, position, lookat); | 1950 | m_OSSL_Functions.osTeleportAgent(agent, position, lookat); |
1943 | } | 1951 | } |
1944 | 1952 | ||
1945 | // Animation Functions | 1953 | // Animation Functions |
1946 | 1954 | ||
1947 | public void osAvatarPlayAnimation(string avatar, string animation) | 1955 | public void osAvatarPlayAnimation(string avatar, string animation) |
1948 | { | 1956 | { |
1949 | m_LSL_Functions.osAvatarPlayAnimation(avatar, animation); | 1957 | m_OSSL_Functions.osAvatarPlayAnimation(avatar, animation); |
1950 | } | 1958 | } |
1951 | 1959 | ||
1952 | public void osAvatarStopAnimation(string avatar, string animation) | 1960 | public void osAvatarStopAnimation(string avatar, string animation) |
1953 | { | 1961 | { |
1954 | m_LSL_Functions.osAvatarStopAnimation(avatar, animation); | 1962 | m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); |
1955 | } | 1963 | } |
1956 | 1964 | ||
1957 | 1965 | ||
@@ -1959,83 +1967,83 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1959 | 1967 | ||
1960 | public string osMovePen(string drawList, int x, int y) | 1968 | public string osMovePen(string drawList, int x, int y) |
1961 | { | 1969 | { |
1962 | return m_LSL_Functions.osMovePen(drawList, x, y); | 1970 | return m_OSSL_Functions.osMovePen(drawList, x, y); |
1963 | } | 1971 | } |
1964 | 1972 | ||
1965 | public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) | 1973 | public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) |
1966 | { | 1974 | { |
1967 | return m_LSL_Functions.osDrawLine(drawList, startX, startY, endX, endY); | 1975 | return m_OSSL_Functions.osDrawLine(drawList, startX, startY, endX, endY); |
1968 | } | 1976 | } |
1969 | 1977 | ||
1970 | public string osDrawLine(string drawList, int endX, int endY) | 1978 | public string osDrawLine(string drawList, int endX, int endY) |
1971 | { | 1979 | { |
1972 | return m_LSL_Functions.osDrawLine(drawList, endX, endY); | 1980 | return m_OSSL_Functions.osDrawLine(drawList, endX, endY); |
1973 | } | 1981 | } |
1974 | 1982 | ||
1975 | public string osDrawText(string drawList, string text) | 1983 | public string osDrawText(string drawList, string text) |
1976 | { | 1984 | { |
1977 | return m_LSL_Functions.osDrawText(drawList, text); | 1985 | return m_OSSL_Functions.osDrawText(drawList, text); |
1978 | } | 1986 | } |
1979 | 1987 | ||
1980 | public string osDrawEllipse(string drawList, int width, int height) | 1988 | public string osDrawEllipse(string drawList, int width, int height) |
1981 | { | 1989 | { |
1982 | return m_LSL_Functions.osDrawEllipse(drawList, width, height); | 1990 | return m_OSSL_Functions.osDrawEllipse(drawList, width, height); |
1983 | } | 1991 | } |
1984 | 1992 | ||
1985 | public string osDrawRectangle(string drawList, int width, int height) | 1993 | public string osDrawRectangle(string drawList, int width, int height) |
1986 | { | 1994 | { |
1987 | return m_LSL_Functions.osDrawRectangle(drawList, width, height); | 1995 | return m_OSSL_Functions.osDrawRectangle(drawList, width, height); |
1988 | } | 1996 | } |
1989 | 1997 | ||
1990 | public string osDrawFilledRectangle(string drawList, int width, int height) | 1998 | public string osDrawFilledRectangle(string drawList, int width, int height) |
1991 | { | 1999 | { |
1992 | return m_LSL_Functions.osDrawFilledRectangle(drawList, width, height); | 2000 | return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height); |
1993 | } | 2001 | } |
1994 | 2002 | ||
1995 | public string osSetFontSize(string drawList, int fontSize) | 2003 | public string osSetFontSize(string drawList, int fontSize) |
1996 | { | 2004 | { |
1997 | return m_LSL_Functions.osSetFontSize(drawList, fontSize); | 2005 | return m_OSSL_Functions.osSetFontSize(drawList, fontSize); |
1998 | } | 2006 | } |
1999 | 2007 | ||
2000 | public string osSetPenSize(string drawList, int penSize) | 2008 | public string osSetPenSize(string drawList, int penSize) |
2001 | { | 2009 | { |
2002 | return m_LSL_Functions.osSetPenSize(drawList, penSize); | 2010 | return m_OSSL_Functions.osSetPenSize(drawList, penSize); |
2003 | } | 2011 | } |
2004 | 2012 | ||
2005 | public string osSetPenColour(string drawList, string colour) | 2013 | public string osSetPenColour(string drawList, string colour) |
2006 | { | 2014 | { |
2007 | return m_LSL_Functions.osSetPenColour(drawList, colour); | 2015 | return m_OSSL_Functions.osSetPenColour(drawList, colour); |
2008 | } | 2016 | } |
2009 | 2017 | ||
2010 | public string osDrawImage(string drawList, int width, int height, string imageUrl) | 2018 | public string osDrawImage(string drawList, int width, int height, string imageUrl) |
2011 | { | 2019 | { |
2012 | return m_LSL_Functions.osDrawImage(drawList, width, height, imageUrl); | 2020 | return m_OSSL_Functions.osDrawImage(drawList, width, height, imageUrl); |
2013 | } | 2021 | } |
2014 | 2022 | ||
2015 | public void osSetStateEvents(int events) | 2023 | public void osSetStateEvents(int events) |
2016 | { | 2024 | { |
2017 | m_LSL_Functions.osSetStateEvents(events); | 2025 | m_OSSL_Functions.osSetStateEvents(events); |
2018 | } | 2026 | } |
2019 | 2027 | ||
2020 | public void osOpenRemoteDataChannel(string channel) | 2028 | // public void osOpenRemoteDataChannel(string channel) |
2021 | { | 2029 | // { |
2022 | m_LSL_Functions.osOpenRemoteDataChannel(channel); | 2030 | // m_OSSL_Functions.osOpenRemoteDataChannel(channel); |
2023 | } | 2031 | // } |
2024 | 2032 | ||
2025 | public string osGetScriptEngineName() | 2033 | public string osGetScriptEngineName() |
2026 | { | 2034 | { |
2027 | return m_LSL_Functions.osGetScriptEngineName(); | 2035 | return m_OSSL_Functions.osGetScriptEngineName(); |
2028 | } | 2036 | } |
2029 | 2037 | ||
2030 | public System.Collections.Hashtable osParseJSON(string JSON) | 2038 | public System.Collections.Hashtable osParseJSON(string JSON) |
2031 | { | 2039 | { |
2032 | return m_LSL_Functions.osParseJSON(JSON); | 2040 | return m_OSSL_Functions.osParseJSON(JSON); |
2033 | } | 2041 | } |
2034 | 2042 | ||
2035 | //for testing purposes only | 2043 | //for testing purposes only |
2036 | public void osSetParcelMediaTime(double time) | 2044 | public void osSetParcelMediaTime(double time) |
2037 | { | 2045 | { |
2038 | m_LSL_Functions.osSetParcelMediaTime(time); | 2046 | m_OSSL_Functions.osSetParcelMediaTime(time); |
2039 | } | 2047 | } |
2040 | 2048 | ||
2041 | // LSL CONSTANTS | 2049 | // LSL CONSTANTS |