aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs43
-rw-r--r--OpenSim/Region/ScriptEngine/Common/IScript.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs262
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs391
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs817
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs78
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs120
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs73
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs9
9 files changed, 145 insertions, 1651 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs
deleted file mode 100644
index 9c45ab5..0000000
--- a/OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Region.Environment.Scenes;
30
31namespace OpenSim.Region.ScriptEngine.Common
32{
33 /// <summary>
34 /// This is the end of a chain of inherited builtin command implementations. This module will be instanced by script engines.
35 /// </summary>
36 public class BuilIn_Commands : OSSL_BuilIn_Commands
37 {
38 public BuilIn_Commands(ScriptEngineBase.ScriptEngine scriptEngine, SceneObjectPart host, uint localID,
39 UUID itemID) : base(scriptEngine, host, localID, itemID)
40 {
41 }
42 }
43}
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs
index 754e86b..8d91071 100644
--- a/OpenSim/Region/ScriptEngine/Common/IScript.cs
+++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs
@@ -27,6 +27,7 @@
27 27
28using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 28using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
29using OpenSim.Region.ScriptEngine.Shared; 29using OpenSim.Region.ScriptEngine.Shared;
30using OpenSim.Region.ScriptEngine.Interfaces;
30 31
31namespace OpenSim.Region.ScriptEngine.Common 32namespace OpenSim.Region.ScriptEngine.Common
32{ 33{
@@ -36,6 +37,6 @@ namespace OpenSim.Region.ScriptEngine.Common
36 int StartParam { get; set; } 37 int StartParam { get; set; }
37 ExecutorBase Exec { get; } 38 ExecutorBase Exec { get; }
38 string Source { get; set; } 39 string Source { get; set; }
39 void Start(BuilIn_Commands BuiltIn_Commands); 40 void InitApi(string api, IScriptApi LSL_Functions);
40 } 41 }
41} 42}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
deleted file mode 100644
index 8252bfc..0000000
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime;
32using System.Text;
33using System.Threading;
34using Nini.Config;
35using OpenMetaverse;
36using OpenMetaverse.Packets;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Region.Environment;
40using OpenSim.Region.Interfaces;
41using OpenSim.Region.Environment.Interfaces;
42using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
43using OpenSim.Region.Environment.Modules.World.Land;
44using OpenSim.Region.Environment.Scenes;
45using OpenSim.Region.Physics.Manager;
46using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
47using OpenSim.Region.ScriptEngine.Shared;
48using OpenSim.Region.ScriptEngine.Shared.Api;
49
50using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
51using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
52using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
53using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
54using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
55using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
56using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
57
58namespace OpenSim.Region.ScriptEngine.Common
59{
60 /// <summary>
61 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
62 /// </summary>
63 public class LSL_BuiltIn_Commands : LSL_Api_Base, LSL_BuiltIn_Commands_Interface
64 {
65// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
66
67 internal ScriptEngineBase.ScriptEngine m_ScriptEngineDirect;
68
69 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
70 {
71 m_ScriptEngineDirect = ScriptEngine;
72 m_ScriptEngine = ScriptEngine;
73 m_host = host;
74 m_localID = localID;
75 m_itemID = itemID;
76
77 AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
78
79 //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
80
81
82 IConfigSource config = new IniConfigSource(Application.iniFilePath);
83 if (config.Configs["LL-Functions"] == null)
84 config.AddConfig("LL-Functions");
85
86 m_ScriptDelayFactor = config.Configs["LL-Functions"].GetFloat("ScriptDelayFactor", 1.0f);
87 m_ScriptDistanceFactor = config.Configs["LL-Functions"].GetFloat("ScriptDistanceLimitFactor", 1.0f);
88
89 }
90
91 private string m_state = "default";
92
93 protected void ScriptSleep(int delay)
94 {
95 delay = (int)((float)delay * m_ScriptDelayFactor);
96 if (delay == 0)
97 return;
98 System.Threading.Thread.Sleep(delay);
99 }
100
101 // Object never expires
102 public override Object InitializeLifetimeService()
103 {
104 ILease lease = (ILease)base.InitializeLifetimeService();
105
106 if (lease.CurrentState == LeaseState.Initial)
107 {
108 lease.InitialLeaseTime = TimeSpan.Zero;
109 }
110 return lease;
111 }
112
113 public string State
114 {
115 get { return m_state; }
116 set {
117 // Set it if it changed
118 if (m_state != value)
119 {
120 try
121 {
122 m_ScriptEngineDirect.m_EventManager.state_exit(m_localID);
123
124 }
125 catch (AppDomainUnloadedException)
126 {
127 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
128 }
129 m_state = value;
130 try
131 {
132 int eventFlags = m_ScriptEngineDirect.m_ScriptManager.GetStateEventFlags(m_localID, m_itemID);
133 m_host.SetScriptEvents(m_itemID, eventFlags);
134 m_ScriptEngineDirect.m_EventManager.state_entry(m_localID);
135 }
136 catch (AppDomainUnloadedException)
137 {
138 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
139 }
140 }
141 }
142 }
143
144 // Extension commands use this:
145 public ICommander GetCommander(string name)
146 {
147 return World.GetCommander(name);
148 }
149
150 public LSL_Integer llGetScriptState(string name)
151 {
152 UUID item;
153 ScriptManager sm;
154 IScript script = null;
155
156 m_host.AddScriptLPS(1);
157
158 // These functions are supposed to be robust,
159 // so get the state one step at a time.
160
161 if ((item = ScriptByName(name)) != UUID.Zero)
162 {
163 if ((sm = m_ScriptEngineDirect.m_ScriptManager) != null)
164 {
165 if ((script = sm.GetScript(m_localID, item)) != null)
166 {
167 return script.Exec.Running?1:0;
168 }
169 }
170 }
171
172 // Required by SL
173
174 if (script == null)
175 ShoutError("llGetScriptState: script "+name+" not found");
176
177 // If we didn't find it, then it's safe to
178 // assume it is not running.
179
180 return 0;
181 }
182
183 public void llResetOtherScript(string name)
184 {
185 UUID item;
186 ScriptManager sm;
187 IScript script = null;
188
189 m_host.AddScriptLPS(8000);
190
191 // These functions are supposed to be robust,
192 // so get the state one step at a time.
193
194 if ((item = ScriptByName(name)) != UUID.Zero)
195 if ((sm = m_ScriptEngineDirect.m_ScriptManager) != null)
196 sm.ResetScript(m_localID, item);
197
198 // Required by SL
199
200 if (script == null)
201 ShoutError("llResetOtherScript: script "+name+" not found");
202
203 // If we didn't find it, then it's safe to
204 // assume it is not running.
205 }
206
207 public void llResetScript()
208 {
209 m_host.AddScriptLPS(800);
210 m_ScriptEngineDirect.m_ScriptManager.ResetScript(m_localID, m_itemID);
211 }
212
213 public void llSetScriptState(string name, int run)
214 {
215 UUID item;
216 ScriptManager sm;
217 IScript script = null;
218
219 m_host.AddScriptLPS(1);
220
221 // These functions are supposed to be robust,
222 // so get the state one step at a time.
223
224 if ((item = ScriptByName(name)) != UUID.Zero)
225 {
226 if ((sm = m_ScriptEngineDirect.m_ScriptManager) != null)
227 {
228 if (sm.Scripts.ContainsKey(m_localID))
229 {
230 if ((script = sm.GetScript(m_localID, item)) != null)
231 {
232 script.Exec.Running = (run==0) ? false : true;
233 }
234 }
235 }
236 }
237
238 // Required by SL
239
240 if (script == null)
241 ShoutError("llSetScriptState: script "+name+" not found");
242
243 // If we didn't find it, then it's safe to
244 // assume it is not running.
245 }
246
247 internal UUID ScriptByName(string name)
248 {
249 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
250 {
251 if (item.Type == 10 && item.Name == name)
252 return item.ItemID;
253 }
254 return UUID.Zero;
255 }
256
257 internal void ShoutError(string msg)
258 {
259 llShout(ScriptBaseClass.DEBUG_CHANNEL, msg);
260 }
261 }
262}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
deleted file mode 100644
index e05849d..0000000
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ /dev/null
@@ -1,391 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenSim.Region.Environment.Interfaces;
29
30using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
31using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
32using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
33using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
34using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
35using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
36using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
37
38namespace OpenSim.Region.ScriptEngine.Common
39{
40 public interface LSL_BuiltIn_Commands_Interface
41 {
42 // Interface used for loading and executing scripts
43
44 string State { get; set; }
45
46 ICommander GetCommander(string name);
47
48 LSL_Integer llAbs(int i);
49 LSL_Float llAcos(double val);
50 void llAddToLandBanList(string avatar, double hours);
51 void llAddToLandPassList(string avatar, double hours);
52 void llAdjustSoundVolume(double volume);
53 void llAllowInventoryDrop(int add);
54 LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b);
55 void llApplyImpulse(LSL_Vector force, int local);
56 void llApplyRotationalImpulse(LSL_Vector force, int local);
57 LSL_Float llAsin(double val);
58 LSL_Float llAtan2(double x, double y);
59 void llAttachToAvatar(int attachment);
60 LSL_Key llAvatarOnSitTarget();
61 LSL_Rotation llAxes2Rot(LSL_Vector fwd, LSL_Vector left, LSL_Vector up);
62 LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, double angle);
63 LSL_Integer llBase64ToInteger(string str);
64 LSL_String llBase64ToString(string str);
65 void llBreakAllLinks();
66 void llBreakLink(int linknum);
67 LSL_Integer llCeil(double f);
68 void llClearCameraParams();
69 void llCloseRemoteDataChannel(string channel);
70 LSL_Float llCloud(LSL_Vector offset);
71 void llCollisionFilter(string name, string id, int accept);
72 void llCollisionSound(string impact_sound, double impact_volume);
73 void llCollisionSprite(string impact_sprite);
74 LSL_Float llCos(double f);
75 void llCreateLink(string target, int parent);
76 LSL_List llCSV2List(string src);
77 LSL_List llDeleteSubList(LSL_List src, int start, int end);
78 LSL_String llDeleteSubString(string src, int start, int end);
79 void llDetachFromAvatar();
80 LSL_Vector llDetectedGrab(int number);
81 LSL_Integer llDetectedGroup(int number);
82 LSL_Key llDetectedKey(int number);
83 LSL_Integer llDetectedLinkNumber(int number);
84 LSL_String llDetectedName(int number);
85 LSL_Key llDetectedOwner(int number);
86 LSL_Vector llDetectedPos(int number);
87 LSL_Rotation llDetectedRot(int number);
88 LSL_Integer llDetectedType(int number);
89 LSL_Vector llDetectedTouchBinormal(int index);
90 LSL_Integer llDetectedTouchFace(int index);
91 LSL_Vector llDetectedTouchNormal(int index);
92 LSL_Vector llDetectedTouchPos(int index);
93 LSL_Vector llDetectedTouchST(int index);
94 LSL_Vector llDetectedTouchUV(int index);
95 LSL_Vector llDetectedVel(int number);
96 void llDialog(string avatar, string message, LSL_List buttons, int chat_channel);
97 void llDie();
98 LSL_String llDumpList2String(LSL_List src, string seperator);
99 LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir);
100 void llEjectFromLand(string pest);
101 void llEmail(string address, string subject, string message);
102 LSL_String llEscapeURL(string url);
103 LSL_Rotation llEuler2Rot(LSL_Vector v);
104 LSL_Float llFabs(double f);
105 LSL_Integer llFloor(double f);
106 void llForceMouselook(int mouselook);
107 LSL_Float llFrand(double mag);
108 LSL_Vector llGetAccel();
109 LSL_Integer llGetAgentInfo(string id);
110 LSL_Vector llGetAgentSize(string id);
111 LSL_Float llGetAlpha(int face);
112 LSL_Float llGetAndResetTime();
113 LSL_String llGetAnimation(string id);
114 LSL_List llGetAnimationList(string id);
115 LSL_Integer llGetAttached();
116 LSL_List llGetBoundingBox(string obj);
117 LSL_Vector llGetCameraPos();
118 LSL_Rotation llGetCameraRot();
119 LSL_Vector llGetCenterOfMass();
120 LSL_Vector llGetColor(int face);
121 LSL_String llGetCreator();
122 LSL_String llGetDate();
123 LSL_Float llGetEnergy();
124 LSL_Vector llGetForce();
125 LSL_Integer llGetFreeMemory();
126 LSL_Vector llGetGeometricCenter();
127 LSL_Float llGetGMTclock();
128 LSL_Key llGetInventoryCreator(string item);
129 LSL_Key llGetInventoryKey(string name);
130 LSL_String llGetInventoryName(int type, int number);
131 LSL_Integer llGetInventoryNumber(int type);
132 LSL_Integer llGetInventoryPermMask(string item, int mask);
133 LSL_Integer llGetInventoryType(string name);
134 LSL_Key llGetKey();
135 LSL_Key llGetLandOwnerAt(LSL_Vector pos);
136 LSL_Key llGetLinkKey(int linknum);
137 LSL_String llGetLinkName(int linknum);
138 LSL_Integer llGetLinkNumber();
139 LSL_Integer llGetListEntryType(LSL_List src, int index);
140 LSL_Integer llGetListLength(LSL_List src);
141 LSL_Vector llGetLocalPos();
142 LSL_Rotation llGetLocalRot();
143 LSL_Float llGetMass();
144 void llGetNextEmail(string address, string subject);
145 LSL_String llGetNotecardLine(string name, int line);
146 LSL_Key llGetNumberOfNotecardLines(string name);
147 LSL_Integer llGetNumberOfPrims();
148 LSL_Integer llGetNumberOfSides();
149 LSL_String llGetObjectDesc();
150 LSL_List llGetObjectDetails(string id, LSL_List args);
151 LSL_Float llGetObjectMass(string id);
152 LSL_String llGetObjectName();
153 LSL_Integer llGetObjectPermMask(int mask);
154 LSL_Integer llGetObjectPrimCount(string object_id);
155 LSL_Vector llGetOmega();
156 LSL_Key llGetOwner();
157 LSL_Key llGetOwnerKey(string id);
158 LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param);
159 LSL_Integer llGetParcelFlags(LSL_Vector pos);
160 LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide);
161 LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide);
162 LSL_List llGetParcelPrimOwners(LSL_Vector pos);
163 LSL_Integer llGetPermissions();
164 LSL_Key llGetPermissionsKey();
165 LSL_Vector llGetPos();
166 LSL_List llGetPrimitiveParams(LSL_List rules);
167 LSL_Integer llGetRegionAgentCount();
168 LSL_Vector llGetRegionCorner();
169 LSL_Integer llGetRegionFlags();
170 LSL_Float llGetRegionFPS();
171 LSL_String llGetRegionName();
172 LSL_Float llGetRegionTimeDilation();
173 LSL_Vector llGetRootPosition();
174 LSL_Rotation llGetRootRotation();
175 LSL_Rotation llGetRot();
176 LSL_Vector llGetScale();
177 LSL_String llGetScriptName();
178 LSL_Integer llGetScriptState(string name);
179 LSL_String llGetSimulatorHostname();
180 LSL_Integer llGetStartParameter();
181 LSL_Integer llGetStatus(int status);
182 LSL_String llGetSubString(string src, int start, int end);
183 LSL_Vector llGetSunDirection();
184 LSL_String llGetTexture(int face);
185 LSL_Vector llGetTextureOffset(int face);
186 LSL_Float llGetTextureRot(int side);
187 LSL_Vector llGetTextureScale(int side);
188 LSL_Float llGetTime();
189 LSL_Float llGetTimeOfDay();
190 LSL_String llGetTimestamp();
191 LSL_Vector llGetTorque();
192 LSL_Integer llGetUnixTime();
193 LSL_Vector llGetVel();
194 LSL_Float llGetWallclock();
195 void llGiveInventory(string destination, string inventory);
196 void llGiveInventoryList(string destination, string category, LSL_List inventory);
197 LSL_Integer llGiveMoney(string destination, int amount);
198 void llGodLikeRezObject(string inventory, LSL_Vector pos);
199 LSL_Float llGround(LSL_Vector offset);
200 LSL_Vector llGroundContour(LSL_Vector offset);
201 LSL_Vector llGroundNormal(LSL_Vector offset);
202 void llGroundRepel(double height, int water, double tau);
203 LSL_Vector llGroundSlope(LSL_Vector offset);
204 LSL_String llHTTPRequest(string url, LSL_List parameters, string body);
205 LSL_String llInsertString(string dst, int position, string src);
206 void llInstantMessage(string user, string message);
207 LSL_String llIntegerToBase64(int number);
208 LSL_String llKey2Name(string id);
209 LSL_String llList2CSV(LSL_List src);
210 LSL_Float llList2Float(LSL_List src, int index);
211 LSL_Integer llList2Integer(LSL_List src, int index);
212 LSL_Key llList2Key(LSL_List src, int index);
213 LSL_List llList2List(LSL_List src, int start, int end);
214 LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride);
215 LSL_Rotation llList2Rot(LSL_List src, int index);
216 LSL_String llList2String(LSL_List src, int index);
217 LSL_Vector llList2Vector(LSL_List src, int index);
218 LSL_Integer llListen(int channelID, string name, string ID, string msg);
219 void llListenControl(int number, int active);
220 void llListenRemove(int number);
221 LSL_Integer llListFindList(LSL_List src, LSL_List test);
222 LSL_List llListInsertList(LSL_List dest, LSL_List src, int start);
223 LSL_List llListRandomize(LSL_List src, int stride);
224 LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end);
225 LSL_List llListSort(LSL_List src, int stride, int ascending);
226 LSL_Float llListStatistics(int operation, LSL_List src);
227 void llLoadURL(string avatar_id, string message, string url);
228 LSL_Float llLog(double val);
229 LSL_Float llLog10(double val);
230 void llLookAt(LSL_Vector target, double strength, double damping);
231 void llLoopSound(string sound, double volume);
232 void llLoopSoundMaster(string sound, double volume);
233 void llLoopSoundSlave(string sound, double volume);
234 void llMakeExplosion();
235 void llMakeFire();
236 void llMakeFountain();
237 void llMakeSmoke();
238 void llMapDestination(string simname, LSL_Vector pos, LSL_Vector look_at);
239 LSL_String llMD5String(string src, int nonce);
240 void llMessageLinked(int linknum, int num, string str, string id);
241 void llMinEventDelay(double delay);
242 void llModifyLand(int action, int brush);
243 LSL_Integer llModPow(int a, int b, int c);
244 void llMoveToTarget(LSL_Vector target, double tau);
245 void llOffsetTexture(double u, double v, int face);
246 void llOpenRemoteDataChannel();
247 LSL_Integer llOverMyLand(string id);
248 void llOwnerSay(string msg);
249 void llParcelMediaCommandList(LSL_List commandList);
250 LSL_List llParcelMediaQuery(LSL_List aList);
251 LSL_List llParseString2List(string str, LSL_List separators, LSL_List spacers);
252 LSL_List llParseStringKeepNulls(string src, LSL_List seperators, LSL_List spacers);
253 void llParticleSystem(LSL_List rules);
254 void llPassCollisions(int pass);
255 void llPassTouches(int pass);
256 void llPlaySound(string sound, double volume);
257 void llPlaySoundSlave(string sound, double volume);
258 void llPointAt();
259 LSL_Float llPow(double fbase, double fexponent);
260 void llPreloadSound(string sound);
261 void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local);
262 void llRefreshPrimURL();
263 void llRegionSay(int channelID, string text);
264 void llReleaseCamera(string avatar);
265 void llReleaseControls();
266 void llRemoteDataReply(string channel, string message_id, string sdata, int idata);
267 void llRemoteDataSetRegion();
268 void llRemoteLoadScript();
269 void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param);
270 void llRemoveFromLandBanList(string avatar);
271 void llRemoveFromLandPassList(string avatar);
272 void llRemoveInventory(string item);
273 void llRemoveVehicleFlags(int flags);
274 LSL_Key llRequestAgentData(string id, int data);
275 LSL_Key llRequestInventoryData(string name);
276 void llRequestPermissions(string agent, int perm);
277 LSL_Key llRequestSimulatorData(string simulator, int data);
278 void llResetLandBanList();
279 void llResetLandPassList();
280 void llResetOtherScript(string name);
281 void llResetScript();
282 void llResetTime();
283 void llRezAtRoot(string inventory, LSL_Vector position, LSL_Vector velocity, LSL_Rotation rot, int param);
284 void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param);
285 LSL_Float llRot2Angle(LSL_Rotation rot);
286 LSL_Vector llRot2Axis(LSL_Rotation rot);
287 LSL_Vector llRot2Euler(LSL_Rotation r);
288 LSL_Vector llRot2Fwd(LSL_Rotation r);
289 LSL_Vector llRot2Left(LSL_Rotation r);
290 LSL_Vector llRot2Up(LSL_Rotation r);
291 void llRotateTexture(double rotation, int face);
292 LSL_Rotation llRotBetween(LSL_Vector start, LSL_Vector end);
293 void llRotLookAt(LSL_Rotation target, double strength, double damping);
294 LSL_Integer llRotTarget(LSL_Rotation rot, double error);
295 void llRotTargetRemove(int number);
296 LSL_Integer llRound(double f);
297 LSL_Integer llSameGroup(string agent);
298 void llSay(int channelID, string text);
299 void llScaleTexture(double u, double v, int face);
300 LSL_Integer llScriptDanger(LSL_Vector pos);
301 LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata);
302 void llSensor(string name, string id, int type, double range, double arc);
303 void llSensorRemove();
304 void llSensorRepeat(string name, string id, int type, double range, double arc, double rate);
305 void llSetAlpha(double alpha, int face);
306 void llSetBuoyancy(double buoyancy);
307 void llSetCameraAtOffset(LSL_Vector offset);
308 void llSetCameraEyeOffset(LSL_Vector offset);
309 void llSetCameraParams(LSL_List rules);
310 void llSetClickAction(int action);
311 void llSetColor(LSL_Vector color, int face);
312 void llSetDamage(double damage);
313 void llSetForce(LSL_Vector force, int local);
314 void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local);
315 void llSetHoverHeight(double height, int water, double tau);
316 void llSetInventoryPermMask(string item, int mask, int value);
317 void llSetLinkAlpha(int linknumber, double alpha, int face);
318 void llSetLinkColor(int linknumber, LSL_Vector color, int face);
319 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
320 void llSetLinkTexture(int linknumber, string texture, int face);
321 void llSetLocalRot(LSL_Rotation rot);
322 void llSetObjectDesc(string desc);
323 void llSetObjectName(string name);
324 void llSetObjectPermMask(int mask, int value);
325 void llSetParcelMusicURL(string url);
326 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
327 void llSetPos(LSL_Vector pos);
328 void llSetPrimitiveParams(LSL_List rules);
329 void llSetPrimURL();
330 void llSetRemoteScriptAccessPin(int pin);
331 void llSetRot(LSL_Rotation rot);
332 void llSetScale(LSL_Vector scale);
333 void llSetScriptState(string name, int run);
334 void llSetSitText(string text);
335 void llSetSoundQueueing(int queue);
336 void llSetSoundRadius(double radius);
337 void llSetStatus(int status, int value);
338 void llSetText(string text, LSL_Vector color, double alpha);
339 void llSetTexture(string texture, int face);
340 void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate);
341 void llSetTimerEvent(double sec);
342 void llSetTorque(LSL_Vector torque, int local);
343 void llSetTouchText(string text);
344 void llSetVehicleFlags(int flags);
345 void llSetVehicleFloatParam(int param, float value);
346 void llSetVehicleRotationParam(int param, LSL_Rotation rot);
347 void llSetVehicleType(int type);
348 void llSetVehicleVectorParam(int param, LSL_Vector vec);
349 void llShout(int channelID, string text);
350 LSL_Float llSin(double f);
351 void llSitTarget(LSL_Vector offset, LSL_Rotation rot);
352 void llSleep(double sec);
353 void llSound();
354 void llSoundPreload();
355 LSL_Float llSqrt(double f);
356 void llStartAnimation(string anim);
357 void llStopAnimation(string anim);
358 void llStopHover();
359 void llStopLookAt();
360 void llStopMoveToTarget();
361 void llStopPointAt();
362 void llStopSound();
363 LSL_Integer llStringLength(string str);
364 LSL_String llStringToBase64(string str);
365 LSL_String llStringTrim(string src, int type);
366 LSL_Integer llSubStringIndex(string source, string pattern);
367 void llTakeCamera(string avatar);
368 void llTakeControls(int controls, int accept, int pass_on);
369 LSL_Float llTan(double f);
370 LSL_Integer llTarget(LSL_Vector position, double range);
371 void llTargetOmega(LSL_Vector axis, double spinrate, double gain);
372 void llTargetRemove(int number);
373 void llTeleportAgentHome(string agent);
374 void llTextBox(string avatar, string message, int chat_channel);
375 LSL_String llToLower(string source);
376 LSL_String llToUpper(string source);
377 void llTriggerSound(string sound, double volume);
378 void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, LSL_Vector bottom_south_west);
379 LSL_String llUnescapeURL(string url);
380 void llUnSit(string id);
381 LSL_Float llVecDist(LSL_Vector a, LSL_Vector b);
382 LSL_Float llVecMag(LSL_Vector v);
383 LSL_Vector llVecNorm(LSL_Vector v);
384 void llVolumeDetect(int detect);
385 LSL_Float llWater(LSL_Vector offset);
386 void llWhisper(int channelID, string text);
387 LSL_Vector llWind(LSL_Vector offset);
388 void llXorBase64Strings();
389 LSL_String llXorBase64StringsCorrect(string str1, string str2);
390 }
391}
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
deleted file mode 100644
index 7b2d229..0000000
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
+++ /dev/null
@@ -1,817 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections;
29using OpenMetaverse;
30using Nini.Config;
31using OpenSim.Framework.Console;
32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
35using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
36//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
37using OpenSim.Region.ScriptEngine.Shared;
38
39namespace OpenSim.Region.ScriptEngine.Common
40{
41 public class OSSL_BuilIn_Commands : LSL_BuiltIn_Commands, OSSL_BuilIn_Commands_Interface
42 {
43 internal ScriptEngineBase.ScriptEngine m_ScriptEngineDirect;
44
45 public OSSL_BuilIn_Commands(ScriptEngineBase.ScriptEngine scriptEngine, SceneObjectPart host, uint localID,
46 UUID itemID)
47 : base(scriptEngine, host, localID, itemID)
48 {
49 m_ScriptEngineDirect = scriptEngine;
50 Prim = new OSSLPrim(this);
51 }
52
53 public OSSLPrim Prim;
54
55 [Serializable]
56 public class OSSLPrim
57 {
58 internal OSSL_BuilIn_Commands OSSL;
59 public OSSLPrim(OSSL_BuilIn_Commands bc)
60 {
61 OSSL = bc;
62 Position = new OSSLPrim_Position(this);
63 Rotation = new OSSLPrim_Rotation(this);
64 }
65
66 public OSSLPrim_Position Position;
67 public OSSLPrim_Rotation Rotation;
68 //public LSL_Types.Vector3 Position
69 //{
70 // get { return OSSL.llGetPos(); }
71 // set { OSSL.llSetPos(value); }
72 //}
73 //public LSL_Types.Quaternion Rotation
74 //{
75 // get { return OSSL.llGetRot(); }
76 // set { OSSL.llSetRot(value); }
77 //}
78 private TextStruct _text;
79 public TextStruct Text
80 {
81 get { return _text; }
82 set
83 {
84 _text = value;
85 OSSL.llSetText(_text.Text, _text.color, _text.alpha);
86 }
87 }
88
89 [Serializable]
90 public struct TextStruct
91 {
92 public string Text;
93 public LSL_Types.Vector3 color;
94 public double alpha;
95 }
96 }
97
98 [Serializable]
99 public class OSSLPrim_Position
100 {
101 private OSSLPrim prim;
102 private LSL_Types.Vector3 Position;
103 public OSSLPrim_Position(OSSLPrim _prim)
104 {
105 prim = _prim;
106 }
107 private void Load()
108 {
109 Position = prim.OSSL.llGetPos();
110 }
111 private void Save()
112 {
113 if (Position.x > 255)
114 Position.x = 255;
115 if (Position.x < 0)
116 Position.x = 0;
117 if (Position.y > 255)
118 Position.y = 255;
119 if (Position.y < 0)
120 Position.y = 0;
121 if (Position.z > 768)
122 Position.z = 768;
123 if (Position.z < 0)
124 Position.z = 0;
125 prim.OSSL.llSetPos(Position);
126 }
127
128 public double x
129 {
130 get
131 {
132 Load();
133 return Position.x;
134 }
135 set
136 {
137 Load();
138 Position.x = value;
139 Save();
140 }
141 }
142 public double y
143 {
144 get
145 {
146 Load();
147 return Position.y;
148 }
149 set
150 {
151 Load();
152 Position.y = value;
153 Save();
154 }
155 }
156 public double z
157 {
158 get
159 {
160 Load();
161 return Position.z;
162 }
163 set
164 {
165 Load();
166 Position.z = value;
167 Save();
168 }
169 }
170 }
171
172 [Serializable]
173 public class OSSLPrim_Rotation
174 {
175 private OSSLPrim prim;
176 private LSL_Types.Quaternion Rotation;
177 public OSSLPrim_Rotation(OSSLPrim _prim)
178 {
179 prim = _prim;
180 }
181 private void Load()
182 {
183 Rotation = prim.OSSL.llGetRot();
184 }
185 private void Save()
186 {
187 prim.OSSL.llSetRot(Rotation);
188 }
189
190 public double x
191 {
192 get
193 {
194 Load();
195 return Rotation.x;
196 }
197 set
198 {
199 Load();
200 Rotation.x = value;
201 Save();
202 }
203 }
204 public double y
205 {
206 get
207 {
208 Load();
209 return Rotation.y;
210 }
211 set
212 {
213 Load();
214 Rotation.y = value;
215 Save();
216 }
217 }
218 public double z
219 {
220 get
221 {
222 Load();
223 return Rotation.z;
224 }
225 set
226 {
227 Load();
228 Rotation.z = value;
229 Save();
230 }
231 }
232 public double s
233 {
234 get
235 {
236 Load();
237 return Rotation.s;
238 }
239 set
240 {
241 Load();
242 Rotation.s = value;
243 Save();
244 }
245 }
246 }
247 //public struct OSSLPrim_Rotation
248 //{
249 // public double X;
250 // public double Y;
251 // public double Z;
252 // public double R;
253 //}
254
255
256 //
257 // OpenSim functions
258 //
259
260 public int osTerrainSetHeight(int x, int y, double val)
261 {
262 m_host.AddScriptLPS(1);
263 if (x > 255 || x < 0 || y > 255 || y < 0)
264 LSLError("osTerrainSetHeight: Coordinate out of bounds");
265
266 if (World.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0)))
267 {
268 World.Heightmap[x, y] = val;
269 return 1;
270 }
271 else
272 {
273 return 0;
274 }
275 }
276
277 public double osTerrainGetHeight(int x, int y)
278 {
279 m_host.AddScriptLPS(1);
280 if (x > 255 || x < 0 || y > 255 || y < 0)
281 LSLError("osTerrainGetHeight: Coordinate out of bounds");
282
283 return World.Heightmap[x, y];
284 }
285
286 public int osRegionRestart(double seconds)
287 {
288 m_host.AddScriptLPS(1);
289 if (World.ExternalChecks.ExternalChecksCanIssueEstateCommand(m_host.OwnerID, false))
290 {
291 World.Restart((float)seconds);
292 return 1;
293 }
294 else
295 {
296 return 0;
297 }
298 }
299
300 public void osRegionNotice(string msg)
301 {
302 m_host.AddScriptLPS(1);
303 World.SendGeneralAlert(msg);
304 }
305
306 public void osSetRot(UUID target, Quaternion rotation)
307 {
308 m_host.AddScriptLPS(1);
309 if (World.Entities.ContainsKey(target))
310 {
311 World.Entities[target].Rotation = rotation;
312 }
313 else
314 {
315 LSLError("osSetRot: Invalid target");
316 }
317 }
318
319 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
320 int timer)
321 {
322 m_host.AddScriptLPS(1);
323 if (dynamicID == String.Empty)
324 {
325 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
326 UUID createdTexture =
327 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
328 extraParams, timer);
329 return createdTexture.ToString();
330 }
331 else
332 {
333 //TODO update existing dynamic textures
334 }
335
336 return UUID.Zero.ToString();
337 }
338
339 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
340 int timer, int alpha)
341 {
342 m_host.AddScriptLPS(1);
343 if (dynamicID == String.Empty)
344 {
345 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
346 UUID createdTexture =
347 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
348 extraParams, timer, true, (byte) alpha);
349 return createdTexture.ToString();
350 }
351 else
352 {
353 //TODO update existing dynamic textures
354 }
355
356 return UUID.Zero.ToString();
357 }
358
359 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
360 int timer)
361 {
362 m_host.AddScriptLPS(1);
363 if (dynamicID == String.Empty)
364 {
365 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
366 if (textureManager != null)
367 {
368 if (extraParams == String.Empty)
369 {
370 extraParams = "256";
371 }
372 UUID createdTexture =
373 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
374 extraParams, timer);
375 return createdTexture.ToString();
376 }
377 }
378 else
379 {
380 //TODO update existing dynamic textures
381 }
382
383 return UUID.Zero.ToString();
384 }
385
386 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
387 int timer, int alpha)
388 {
389 m_host.AddScriptLPS(1);
390 if (dynamicID == String.Empty)
391 {
392 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
393 if (textureManager != null)
394 {
395 if (extraParams == String.Empty)
396 {
397 extraParams = "256";
398 }
399 UUID createdTexture =
400 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
401 extraParams, timer, true, (byte) alpha);
402 return createdTexture.ToString();
403 }
404 }
405 else
406 {
407 //TODO update existing dynamic textures
408 }
409
410 return UUID.Zero.ToString();
411 }
412
413 public bool osConsoleCommand(string command)
414 {
415 m_host.AddScriptLPS(1);
416 IConfigSource config = new IniConfigSource(Application.iniFilePath);
417 if (config.Configs["LL-Functions"] == null)
418 config.AddConfig("LL-Functions");
419
420 if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false))
421 {
422 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID))
423 {
424 MainConsole.Instance.RunCommand(command);
425 return true;
426 }
427 return false;
428 }
429 return false;
430 }
431 public void osSetPrimFloatOnWater(int floatYN)
432 {
433 m_host.AddScriptLPS(1);
434 if (m_host.ParentGroup != null)
435 {
436 if (m_host.ParentGroup.RootPart != null)
437 {
438 m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
439 }
440 }
441 }
442
443 // Teleport functions
444 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
445 {
446 m_host.AddScriptLPS(1);
447 UUID agentId = new UUID();
448 if (UUID.TryParse(agent, out agentId))
449 {
450 ScenePresence presence = World.GetScenePresence(agentId);
451 if (presence != null)
452 {
453 // agent must be over owners land to avoid abuse
454 if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
455 {
456 World.RequestTeleportLocation(presence.ControllingClient, regionName,
457 new Vector3((float)position.x, (float)position.y, (float)position.z),
458 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
459 // ScriptSleep(5000);
460
461 }
462 }
463 }
464 }
465
466 public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
467 {
468 osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
469 }
470
471 // Adam's super super custom animation functions
472 public void osAvatarPlayAnimation(string avatar, string animation)
473 {
474 m_host.AddScriptLPS(1);
475 if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
476 {
477 ScenePresence target = (ScenePresence)World.Entities[avatar];
478 target.AddAnimation(avatar);
479 }
480 }
481
482 public void osAvatarStopAnimation(string avatar, string animation)
483 {
484 m_host.AddScriptLPS(1);
485 if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
486 {
487 ScenePresence target = (ScenePresence)World.Entities[avatar];
488 target.RemoveAnimation(animation);
489 }
490 }
491
492 //Texture draw functions
493 public string osMovePen(string drawList, int x, int y)
494 {
495 m_host.AddScriptLPS(1);
496 drawList += "MoveTo " + x + "," + y + ";";
497 return drawList;
498 }
499
500 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
501 {
502 m_host.AddScriptLPS(1);
503 drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; ";
504 return drawList;
505 }
506
507 public string osDrawLine(string drawList, int endX, int endY)
508 {
509 m_host.AddScriptLPS(1);
510 drawList += "LineTo " + endX + "," + endY + "; ";
511 return drawList;
512 }
513
514 public string osDrawText(string drawList, string text)
515 {
516 m_host.AddScriptLPS(1);
517 drawList += "Text " + text + "; ";
518 return drawList;
519 }
520
521 public string osDrawEllipse(string drawList, int width, int height)
522 {
523 m_host.AddScriptLPS(1);
524 drawList += "Ellipse " + width + "," + height + "; ";
525 return drawList;
526 }
527
528 public string osDrawRectangle(string drawList, int width, int height)
529 {
530 m_host.AddScriptLPS(1);
531 drawList += "Rectangle " + width + "," + height + "; ";
532 return drawList;
533 }
534
535 public string osDrawFilledRectangle(string drawList, int width, int height)
536 {
537 m_host.AddScriptLPS(1);
538 drawList += "FillRectangle " + width + "," + height + "; ";
539 return drawList;
540 }
541
542 public string osSetFontSize(string drawList, int fontSize)
543 {
544 m_host.AddScriptLPS(1);
545 drawList += "FontSize "+ fontSize +"; ";
546 return drawList;
547 }
548
549 public string osSetPenSize(string drawList, int penSize)
550 {
551 m_host.AddScriptLPS(1);
552 drawList += "PenSize " + penSize + "; ";
553 return drawList;
554 }
555
556 public string osSetPenColour(string drawList, string colour)
557 {
558 m_host.AddScriptLPS(1);
559 drawList += "PenColour " + colour + "; ";
560 return drawList;
561 }
562
563 public string osDrawImage(string drawList, int width, int height, string imageUrl)
564 {
565 m_host.AddScriptLPS(1);
566 drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ;
567 return drawList;
568 }
569
570 public void osSetStateEvents(int events)
571 {
572 m_host.SetScriptEvents(m_itemID, events);
573 }
574
575 public void osOpenRemoteDataChannel(string channel)
576 {
577 m_host.AddScriptLPS(1);
578 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
579 if (xmlrpcMod.IsEnabled())
580 {
581 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, new UUID(channel));
582 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(UUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) };
583 m_ScriptEngineDirect.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", new DetectParams[0], resobj);
584 }
585 }
586
587 public void osSetParcelMediaURL(string url)
588 {
589 m_host.AddScriptLPS(1);
590 UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
591
592 if (landowner == UUID.Zero)
593 {
594 return;
595 }
596
597 if (landowner != m_host.ObjectOwner)
598 {
599 return;
600 }
601
602 World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url);
603 }
604
605 public string osGetScriptEngineName()
606 {
607 m_host.AddScriptLPS(1);
608
609 int scriptEngineNameIndex = 0;
610
611 if (!String.IsNullOrEmpty(m_ScriptEngineDirect.ScriptEngineName))
612 {
613 // parse off the "ScriptEngine."
614 scriptEngineNameIndex = m_ScriptEngineDirect.ScriptEngineName.IndexOf(".", scriptEngineNameIndex);
615 scriptEngineNameIndex++; // get past delimiter
616
617 int scriptEngineNameLength = m_ScriptEngineDirect.ScriptEngineName.Length - scriptEngineNameIndex;
618
619 // create char array then a string that is only the script engine name
620 Char[] scriptEngineNameCharArray = m_ScriptEngineDirect.ScriptEngineName.ToCharArray(scriptEngineNameIndex, scriptEngineNameLength);
621 String scriptEngineName = new String(scriptEngineNameCharArray);
622
623 return scriptEngineName;
624 }
625 else
626 {
627 return String.Empty;
628 }
629 }
630
631 //for testing purposes only
632 public void osSetParcelMediaTime(double time)
633 {
634 World.ParcelMediaSetTime((float)time);
635 }
636
637 public Hashtable osParseJSON(string JSON)
638 {
639 m_host.AddScriptLPS(1);
640
641 // see http://www.json.org/ for more details on JSON
642
643 string currentKey=null;
644 Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this
645 Hashtable jsondata = new Hashtable(); // the hashtable to be returned
646
647 try
648 {
649
650 // iterate through the serialised stream of tokens and store at the right depth in the hashtable
651 // the top level hashtable may contain more nested hashtables within it each containing an objects representation
652 for (int i=0;i<JSON.Length; i++)
653 {
654
655 // Console.WriteLine(""+JSON[i]);
656 switch (JSON[i])
657 {
658 case '{':
659 // create hashtable and add it to the stack or array if we are populating one, we can have a lot of nested objects in JSON
660
661 Hashtable currentObject = new Hashtable();
662 if (objectStack.Count==0) // the stack should only be empty for the first outer object
663 {
664
665 objectStack.Push(jsondata);
666 }
667 else if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
668 {
669 // add it to the parent array
670 ((ArrayList)objectStack.Peek()).Add(currentObject);
671 objectStack.Push(currentObject);
672 }
673 else
674 {
675 // add it to the parent hashtable
676 ((Hashtable)objectStack.Peek()).Add(currentKey,currentObject);
677 objectStack.Push(currentObject);
678 }
679
680 // clear the key
681 currentKey=null;
682 break;
683 case '}':
684 // pop the hashtable off the stack
685 objectStack.Pop();
686 break;
687 case '"':// string boundary
688
689 string tokenValue="";
690 i++; // move to next char
691
692 // just loop through until the next quote mark storing the string
693 while (JSON[i]!='"')
694 {
695 tokenValue+=JSON[i++];
696 }
697
698 // ok we've got a string, if we've got an array on the top of the stack then we store it
699 if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
700 {
701 ((ArrayList)objectStack.Peek()).Add(tokenValue);
702 }
703 else if (currentKey==null) // no key stored and its not an array this must be a key so store it
704 {
705 currentKey = tokenValue;
706 }
707 else
708 {
709 // we have a key so lets store this value
710 ((Hashtable)objectStack.Peek()).Add(currentKey,tokenValue);
711 // now lets clear the key, we're done with it and moving on
712 currentKey=null;
713 }
714
715 break;
716 case ':':// key : value separator
717 // just ignore
718 break;
719 case ' ':// spaces
720 // just ignore
721 break;
722 case '[': // array start
723 ArrayList currentArray = new ArrayList();
724
725 if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
726 {
727 ((ArrayList)objectStack.Peek()).Add(currentArray);
728 }
729 else
730 {
731 ((Hashtable)objectStack.Peek()).Add(currentKey,currentArray);
732 // clear the key
733 currentKey=null;
734 }
735 objectStack.Push(currentArray);
736
737 break;
738 case ',':// seperator
739 // just ignore
740 break;
741 case ']'://Array end
742 // pop the array off the stack
743 objectStack.Pop();
744 break;
745 case 't': // we've found a character start not in quotes, it must be a boolean true
746
747 if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
748 {
749 ((ArrayList)objectStack.Peek()).Add(true);
750 }
751 else
752 {
753 ((Hashtable)objectStack.Peek()).Add(currentKey,true);
754 }
755
756 //advance the counter to the letter 'e'
757 i = i+3;
758 break;
759 case 'f': // we've found a character start not in quotes, it must be a boolean false
760
761 if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
762 {
763 ((ArrayList)objectStack.Peek()).Add(false);
764 }
765 else
766 {
767 ((Hashtable)objectStack.Peek()).Add(currentKey,false);
768 }
769 //advance the counter to the letter 'e'
770 i = i+4;
771 break;
772
773 default:
774 // ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately
775 // but for now we'll just do them as strings
776
777 string numberValue="";
778
779 // just loop through until the next known marker quote mark storing the string
780 while (JSON[i] != '"' && JSON[i] != ',' && JSON[i] != ']' && JSON[i] != '}' && JSON[i] != ' ')
781 {
782 numberValue+=""+JSON[i++];
783 }
784
785 i--; // we want to process this caracter that marked the end of this string in the main loop
786
787 // ok we've got a string, if we've got an array on the top of the stack then we store it
788 if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
789 {
790 ((ArrayList)objectStack.Peek()).Add(numberValue);
791 }
792 else
793 {
794 // we have a key so lets store this value
795 ((Hashtable)objectStack.Peek()).Add(currentKey,numberValue);
796 // now lets clear the key, we're done with it and moving on
797 currentKey=null;
798 }
799
800 break;
801 }
802 }
803 }
804 catch(Exception)
805 {
806 LSLError("osParseJSON: The JSON string is not valid " + JSON);
807 }
808
809 return jsondata;
810 }
811
812 internal void LSLError(string msg)
813 {
814 throw new Exception("LSL Runtime Error: " + msg);
815 }
816 }
817}
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs
deleted file mode 100644
index 49f92b5..0000000
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using OpenSim.Region.ScriptEngine.Shared;
28
29namespace OpenSim.Region.ScriptEngine.Common
30{
31 public interface OSSL_BuilIn_Commands_Interface
32 {
33 //OpenSim functions
34 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
35 string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
36 int timer, int alpha);
37 string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer);
38 string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
39 int timer, int alpha);
40 double osTerrainGetHeight(int x, int y);
41 int osTerrainSetHeight(int x, int y, double val);
42 int osRegionRestart(double seconds);
43 void osRegionNotice(string msg);
44 bool osConsoleCommand(string Command);
45 void osSetParcelMediaURL(string url);
46 void osSetPrimFloatOnWater(int floatYN);
47
48 // Teleport commands
49 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
50 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
51
52 // Animation commands
53 void osAvatarPlayAnimation(string avatar, string animation);
54 void osAvatarStopAnimation(string avatar, string animation);
55
56 //texture draw functions
57 string osMovePen(string drawList, int x, int y);
58 string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
59 string osDrawLine(string drawList, int endX, int endY);
60 string osDrawText(string drawList, string text);
61 string osDrawEllipse(string drawList, int width, int height);
62 string osDrawRectangle(string drawList, int width, int height);
63 string osDrawFilledRectangle(string drawList, int width, int height);
64 string osSetFontSize(string drawList, int fontSize);
65 string osSetPenSize(string drawList, int penSize);
66 string osSetPenColour(string drawList, string colour);
67 string osDrawImage(string drawList, int width, int height, string imageUrl);
68 void osSetStateEvents(int events);
69
70 void osOpenRemoteDataChannel(string channel);
71
72 System.Collections.Hashtable osParseJSON(string JSON);
73
74 string osGetScriptEngineName();
75 void osSetParcelMediaTime(double time);
76
77 }
78}
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;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 32using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
33using OpenSim.Region.ScriptEngine.Shared; 33using OpenSim.Region.ScriptEngine.Shared;
34using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
35using OpenSim.Region.ScriptEngine.Interfaces;
34 36
35using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 37using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
36using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 38using 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
43namespace OpenSim.Region.ScriptEngine.Common 45namespace 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
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index 18925e0..88f7b41 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -66,6 +66,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
66 private bool m_enabled = false; 66 private bool m_enabled = false;
67 private bool m_hookUpToServer = false; 67 private bool m_hookUpToServer = false;
68 68
69 public IConfig Config
70 {
71 get { return ScriptConfigSource; }
72 }
73
69 /// <summary> 74 /// <summary>
70 /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes. 75 /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes.
71 /// </summary> 76 /// </summary>
@@ -120,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
120 m_EventManager = new EventManager(this, HookUpToServer); 125 m_EventManager = new EventManager(this, HookUpToServer);
121 // We need to start it 126 // We need to start it
122 m_ScriptManager = newScriptManager; 127 m_ScriptManager = newScriptManager;
128 m_ScriptManager.Setup();
123 m_AppDomainManager = new AppDomainManager(this); 129 m_AppDomainManager = new AppDomainManager(this);
124 if (m_MaintenanceThread == null) 130 if (m_MaintenanceThread == null)
125 m_MaintenanceThread = new MaintenanceThread(); 131 m_MaintenanceThread = new MaintenanceThread();
@@ -229,23 +235,88 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
229 235
230 public void SetState(UUID itemID, string state) 236 public void SetState(UUID itemID, string state)
231 { 237 {
238 uint localID = m_ScriptManager.GetLocalID(itemID);
239 if (localID == 0)
240 return;
241
242 IScript Script = m_ScriptManager.GetScript(localID, itemID);
243
244 if (Script == null)
245 return;
246
247 string currentState = Script.State;
248
249 if (currentState != state)
250 {
251 try
252 {
253 m_EventManager.state_exit(localID);
254
255 }
256 catch (AppDomainUnloadedException)
257 {
258 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
259 }
260
261 Script.State = state;
262
263 try
264 {
265 int eventFlags = m_ScriptManager.GetStateEventFlags(localID, itemID);
266 SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID);
267 if (part != null)
268 part.SetScriptEvents(itemID, eventFlags);
269 m_EventManager.state_entry(localID);
270 }
271 catch (AppDomainUnloadedException)
272 {
273 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
274 }
275 }
232 } 276 }
233 277
234 public bool GetScriptState(UUID itemID) 278 public bool GetScriptState(UUID itemID)
235 { 279 {
236 return true; 280 uint localID = m_ScriptManager.GetLocalID(itemID);
281 if (localID == 0)
282 return false;
283
284 IScript script = m_ScriptManager.GetScript(localID, itemID);
285 if (script == null)
286 return false;
287
288 return script.Exec.Running?true:false;
237 } 289 }
238 290
239 public void SetScriptState(UUID itemID, bool state) 291 public void SetScriptState(UUID itemID, bool state)
240 { 292 {
293 uint localID = m_ScriptManager.GetLocalID(itemID);
294 if (localID == 0)
295 return;
296
297 IScript script = m_ScriptManager.GetScript(localID, itemID);
298 if (script == null)
299 return;
300
301 script.Exec.Running = state;
241 } 302 }
242 303
243 public void ApiResetScript(UUID itemID) 304 public void ApiResetScript(UUID itemID)
244 { 305 {
306 uint localID = m_ScriptManager.GetLocalID(itemID);
307 if (localID == 0)
308 return;
309
310 m_ScriptManager.ResetScript(localID, itemID);
245 } 311 }
246 312
247 public void ResetScript(UUID itemID) 313 public void ResetScript(UUID itemID)
248 { 314 {
315 uint localID = m_ScriptManager.GetLocalID(itemID);
316 if (localID == 0)
317 return;
318
319 m_ScriptManager.ResetScript(localID, itemID);
249 } 320 }
250 } 321 }
251} 322}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
index 095e11f..987a0a0 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
@@ -120,12 +120,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
120 m_scriptEngine = scriptEngine; 120 m_scriptEngine = scriptEngine;
121 } 121 }
122 public abstract void Initialize(); 122 public abstract void Initialize();
123 public void Setup()
124 {
125 ReadConfig();
126 Initialize();
127 }
123 public void Start() 128 public void Start()
124 { 129 {
125 m_started = true; 130 m_started = true;
126 131
127 ReadConfig();
128 Initialize();
129 132
130 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); 133 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
131 134
@@ -225,6 +228,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
225 { 228 {
226 if (LUQueue.Count > 0) 229 if (LUQueue.Count > 0)
227 { 230 {
231m_scriptEngine.Log.InfoFormat("[{0}]: Loading script", m_scriptEngine.ScriptEngineName);
228 LUStruct item = LUQueue.Dequeue(); 232 LUStruct item = LUQueue.Dequeue();
229 233
230 if (item.Action == LUType.Unload) 234 if (item.Action == LUType.Unload)
@@ -281,6 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
281 ls.startParam = startParam; 285 ls.startParam = startParam;
282 ls.postOnRez = postOnRez; 286 ls.postOnRez = postOnRez;
283 LUQueue.Enqueue(ls); 287 LUQueue.Enqueue(ls);
288m_scriptEngine.Log.InfoFormat("[{0}]: Queued script for load", m_scriptEngine.ScriptEngineName);
284 } 289 }
285 } 290 }
286 291