diff options
author | Tedd Hansen | 2007-10-05 19:56:44 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-10-05 19:56:44 +0000 |
commit | 6dd923b01d6864ffcb17030c9de17224f45b4c2a (patch) | |
tree | 83d00d90a13f6803b38988049096296caf9f4c17 /OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API | |
parent | Code from Illumious Beltran (IBM) implementing more LSL (diff) | |
download | opensim-SC_OLD-6dd923b01d6864ffcb17030c9de17224f45b4c2a.zip opensim-SC_OLD-6dd923b01d6864ffcb17030c9de17224f45b4c2a.tar.gz opensim-SC_OLD-6dd923b01d6864ffcb17030c9de17224f45b4c2a.tar.bz2 opensim-SC_OLD-6dd923b01d6864ffcb17030c9de17224f45b4c2a.tar.xz |
Some more work on new ScriptEngine.
Diffstat (limited to 'OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API')
-rw-r--r-- | OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | 1161 |
1 files changed, 1161 insertions, 0 deletions
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs new file mode 100644 index 0000000..a1f6c73 --- /dev/null +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -0,0 +1,1161 @@ | |||
1 | using Axiom.Math; | ||
2 | using System; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Region.Environment.Scenes; | ||
7 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
8 | using OpenSim.Region.Environment.Interfaces; | ||
9 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; | ||
10 | using OpenSim.Region.ScriptEngine.Common; | ||
11 | using OpenSim.Framework.Console; | ||
12 | using OpenSim.Framework.Utilities; | ||
13 | using System.Runtime.Remoting.Lifetime; | ||
14 | |||
15 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | ||
16 | { | ||
17 | // | ||
18 | // !!!IMPORTANT!!! | ||
19 | // | ||
20 | // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status | ||
21 | // | ||
22 | |||
23 | /// <summary> | ||
24 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. | ||
25 | /// </summary> | ||
26 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface | ||
27 | { | ||
28 | |||
29 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
30 | private ScriptEngine m_ScriptEngine; | ||
31 | private SceneObjectPart m_host; | ||
32 | private uint m_localID; | ||
33 | private LLUUID m_itemID; | ||
34 | private bool throwErrorOnNotImplemented = true; | ||
35 | |||
36 | |||
37 | public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) | ||
38 | { | ||
39 | m_ScriptEngine = ScriptEngine; | ||
40 | m_host = host; | ||
41 | m_localID = localID; | ||
42 | m_itemID = itemID; | ||
43 | |||
44 | |||
45 | //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); | ||
46 | } | ||
47 | |||
48 | |||
49 | private string m_state = "default"; | ||
50 | |||
51 | public string State() | ||
52 | { | ||
53 | return m_state; | ||
54 | } | ||
55 | |||
56 | // Object never expires | ||
57 | public override Object InitializeLifetimeService() | ||
58 | { | ||
59 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); | ||
60 | // return null; | ||
61 | ILease lease = (ILease)base.InitializeLifetimeService(); | ||
62 | |||
63 | if (lease.CurrentState == LeaseState.Initial) | ||
64 | { | ||
65 | lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); | ||
66 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); | ||
67 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(2); | ||
68 | } | ||
69 | return lease; | ||
70 | } | ||
71 | |||
72 | |||
73 | public Scene World | ||
74 | { | ||
75 | get { return m_ScriptEngine.World; } | ||
76 | } | ||
77 | |||
78 | //These are the implementations of the various ll-functions used by the LSL scripts. | ||
79 | //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 | ||
80 | public double llSin(double f) { return (double)Math.Sin(f); } | ||
81 | public double llCos(double f) { return (double)Math.Cos(f); } | ||
82 | public double llTan(double f) { return (double)Math.Tan(f); } | ||
83 | public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } | ||
84 | public double llSqrt(double f) { return (double)Math.Sqrt(f); } | ||
85 | public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } | ||
86 | public int llAbs(int i) { return (int)Math.Abs(i); } | ||
87 | public double llFabs(double f) { return (double)Math.Abs(f); } | ||
88 | |||
89 | public double llFrand(double mag) | ||
90 | { | ||
91 | lock (Util.RandomClass) | ||
92 | { | ||
93 | return Util.RandomClass.Next((int)mag); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | public int llFloor(double f) { return (int)Math.Floor(f); } | ||
98 | public int llCeil(double f) { return (int)Math.Ceiling(f); } | ||
99 | public int llRound(double f) { return (int)Math.Round(f, 3); } | ||
100 | |||
101 | //This next group are vector operations involving squaring and square root. ckrinke | ||
102 | public double llVecMag(LSL_Types.Vector3 v) | ||
103 | { | ||
104 | return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); | ||
105 | } | ||
106 | |||
107 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) | ||
108 | { | ||
109 | double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; | ||
110 | LSL_Types.Vector3 nor = new LSL_Types.Vector3(); | ||
111 | nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; | ||
112 | return nor; | ||
113 | } | ||
114 | |||
115 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) | ||
116 | { | ||
117 | double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; | ||
118 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); | ||
119 | } | ||
120 | |||
121 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke | ||
122 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) | ||
123 | { | ||
124 | //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke | ||
125 | LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); | ||
126 | double m = (t.X + t.Y + t.Z + t.R); | ||
127 | if (m == 0) return new LSL_Types.Vector3(); | ||
128 | double n = 2 * (r.Y * r.R + r.X * r.Z); | ||
129 | double p = m * m - n * n; | ||
130 | if (p > 0) | ||
131 | return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)), | ||
132 | Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R))); | ||
133 | else if (n > 0) | ||
134 | return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); | ||
135 | else | ||
136 | return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); | ||
137 | } | ||
138 | |||
139 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) | ||
140 | { | ||
141 | //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 | ||
142 | float err = 0.00001f; | ||
143 | double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); | ||
144 | double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); | ||
145 | double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); | ||
146 | LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); | ||
147 | LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); | ||
148 | LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); | ||
149 | LSL_Types.Quaternion a = new LSL_Types.Quaternion(); | ||
150 | //This multiplication doesnt compile, yet. a = a1 * a2 * a3; | ||
151 | LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, | ||
152 | aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); | ||
153 | LSL_Types.Quaternion c = new LSL_Types.Quaternion(); | ||
154 | //This addition doesnt compile yet c = a + b; | ||
155 | LSL_Types.Quaternion d = new LSL_Types.Quaternion(); | ||
156 | //This addition doesnt compile yet d = a - b; | ||
157 | if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) || | ||
158 | (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) || | ||
159 | (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) || | ||
160 | (Math.Abs(c.R) > err && Math.Abs(d.R) > err)) | ||
161 | { | ||
162 | //return a new Quaternion that is null until I figure this out | ||
163 | // return b; | ||
164 | // return a; | ||
165 | } | ||
166 | return new LSL_Types.Quaternion(); | ||
167 | } | ||
168 | |||
169 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } | ||
170 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | ||
171 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | ||
172 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | ||
173 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } | ||
174 | |||
175 | public void llWhisper(int channelID, string text) | ||
176 | { | ||
177 | //type for whisper is 0 | ||
178 | World.SimChat(Helpers.StringToField(text), | ||
179 | 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | ||
180 | } | ||
181 | |||
182 | public void llSay(int channelID, string text) | ||
183 | { | ||
184 | //type for say is 1 | ||
185 | |||
186 | World.SimChat(Helpers.StringToField(text), | ||
187 | 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | ||
188 | } | ||
189 | |||
190 | public void llShout(int channelID, string text) | ||
191 | { | ||
192 | //type for shout is 2 | ||
193 | World.SimChat(Helpers.StringToField(text), | ||
194 | 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | ||
195 | } | ||
196 | |||
197 | public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; } | ||
198 | public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; } | ||
199 | public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; } | ||
200 | public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } | ||
201 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } | ||
202 | public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } | ||
203 | public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } | ||
204 | public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } | ||
205 | public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } | ||
206 | public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } | ||
207 | public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } | ||
208 | public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } | ||
209 | public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } | ||
210 | public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } | ||
211 | public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } | ||
212 | public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } | ||
213 | public void llDie() { NotImplemented("llDie"); return; } | ||
214 | public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } | ||
215 | public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } | ||
216 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } | ||
217 | public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } | ||
218 | public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } | ||
219 | |||
220 | public void llSetScale(LSL_Types.Vector3 scale) | ||
221 | { | ||
222 | // TODO: this needs to trigger a persistance save as well | ||
223 | LLVector3 tmp = m_host.Scale; | ||
224 | tmp.X = (float)scale.X; | ||
225 | tmp.Y = (float)scale.Y; | ||
226 | tmp.Z = (float)scale.Z; | ||
227 | m_host.Scale = tmp; | ||
228 | return; | ||
229 | } | ||
230 | public LSL_Types.Vector3 llGetScale() | ||
231 | { | ||
232 | return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); | ||
233 | } | ||
234 | |||
235 | public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } | ||
236 | public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } | ||
237 | public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } | ||
238 | public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } | ||
239 | public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } | ||
240 | public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } | ||
241 | public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } | ||
242 | public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } | ||
243 | |||
244 | public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } | ||
245 | |||
246 | public void llSetPos(LSL_Types.Vector3 pos) | ||
247 | { | ||
248 | if (m_host.ParentID != 0) | ||
249 | { | ||
250 | m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | ||
251 | } | ||
252 | else | ||
253 | { | ||
254 | m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | public LSL_Types.Vector3 llGetPos() | ||
259 | { | ||
260 | return new LSL_Types.Vector3(m_host.AbsolutePosition.X, | ||
261 | m_host.AbsolutePosition.Y, | ||
262 | m_host.AbsolutePosition.Z); | ||
263 | } | ||
264 | |||
265 | public LSL_Types.Vector3 llGetLocalPos() | ||
266 | { | ||
267 | if (m_host.ParentID != 0) | ||
268 | { | ||
269 | return new LSL_Types.Vector3(m_host.OffsetPosition.X, | ||
270 | m_host.OffsetPosition.Y, | ||
271 | m_host.OffsetPosition.Z); | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | return new LSL_Types.Vector3(m_host.AbsolutePosition.X, | ||
276 | m_host.AbsolutePosition.Y, | ||
277 | m_host.AbsolutePosition.Z); | ||
278 | } | ||
279 | } | ||
280 | public void llSetRot(LSL_Types.Quaternion rot) | ||
281 | { | ||
282 | m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); | ||
283 | } | ||
284 | public LSL_Types.Quaternion llGetRot() | ||
285 | { | ||
286 | LLQuaternion q = m_host.RotationOffset; | ||
287 | return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | ||
288 | } | ||
289 | public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } | ||
290 | public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } | ||
291 | public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } | ||
292 | public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } | ||
293 | public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } | ||
294 | public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } | ||
295 | public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } | ||
296 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } | ||
297 | public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } | ||
298 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } | ||
299 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } | ||
300 | public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } | ||
301 | public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } | ||
302 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } | ||
303 | public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } | ||
304 | public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } | ||
305 | public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } | ||
306 | public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } | ||
307 | |||
308 | public double llGetWallclock() | ||
309 | { | ||
310 | return DateTime.Now.TimeOfDay.TotalSeconds; | ||
311 | } | ||
312 | |||
313 | public double llGetTime() { NotImplemented("llGetTime"); return 0; } | ||
314 | public void llResetTime() { NotImplemented("llResetTime"); } | ||
315 | public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } | ||
316 | public void llSound() { NotImplemented("llSound"); } | ||
317 | public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } | ||
318 | public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } | ||
319 | public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } | ||
320 | public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } | ||
321 | public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } | ||
322 | public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } | ||
323 | public void llStopSound() { NotImplemented("llStopSound"); } | ||
324 | public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } | ||
325 | |||
326 | public string llGetSubString(string src, int start, int end) | ||
327 | { | ||
328 | return src.Substring(start, end); | ||
329 | } | ||
330 | |||
331 | public string llDeleteSubString(string src, int start, int end) | ||
332 | { | ||
333 | return src.Remove(start, end - start); | ||
334 | } | ||
335 | public string llInsertString(string dst, int position, string src) | ||
336 | { | ||
337 | return dst.Insert(position, src); | ||
338 | } | ||
339 | public string llToUpper(string src) | ||
340 | { | ||
341 | return src.ToUpper(); | ||
342 | } | ||
343 | |||
344 | public string llToLower(string src) | ||
345 | { | ||
346 | return src.ToLower(); | ||
347 | } | ||
348 | |||
349 | public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } | ||
350 | public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } | ||
351 | public void llMakeFountain() { NotImplemented("llMakeFountain"); } | ||
352 | public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } | ||
353 | public void llMakeFire() { NotImplemented("llMakeFire"); } | ||
354 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } | ||
355 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } | ||
356 | public void llStopLookAt() { NotImplemented("llStopLookAt"); } | ||
357 | |||
358 | public void llSetTimerEvent(double sec) | ||
359 | { | ||
360 | // Setting timer repeat | ||
361 | m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); | ||
362 | } | ||
363 | |||
364 | public void llSleep(double sec) | ||
365 | { | ||
366 | System.Threading.Thread.Sleep((int)(sec * 1000)); | ||
367 | } | ||
368 | |||
369 | public double llGetMass() { NotImplemented("llGetMass"); return 0; } | ||
370 | public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } | ||
371 | public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } | ||
372 | public void llReleaseControls() { NotImplemented("llReleaseControls"); } | ||
373 | public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } | ||
374 | public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } | ||
375 | public void llTakeCamera() { NotImplemented("llTakeCamera"); } | ||
376 | public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } | ||
377 | |||
378 | public string llGetOwner() | ||
379 | { | ||
380 | return m_host.ObjectOwner.ToStringHyphenated(); | ||
381 | } | ||
382 | |||
383 | public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } | ||
384 | public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } | ||
385 | public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } | ||
386 | |||
387 | public string llGetKey() | ||
388 | { | ||
389 | return m_host.UUID.ToStringHyphenated(); | ||
390 | } | ||
391 | |||
392 | public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } | ||
393 | public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } | ||
394 | public void llStopHover() { NotImplemented("llStopHover"); } | ||
395 | public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } | ||
396 | public void llSoundPreload() { NotImplemented("llSoundPreload"); } | ||
397 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } | ||
398 | |||
399 | public int llStringLength(string str) | ||
400 | { | ||
401 | if (str.Length > 0) | ||
402 | { | ||
403 | return str.Length; | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | return 0; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } | ||
412 | public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } | ||
413 | public void llPointAt() { NotImplemented("llPointAt"); } | ||
414 | public void llStopPointAt() { NotImplemented("llStopPointAt"); } | ||
415 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } | ||
416 | public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } | ||
417 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } | ||
418 | public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } | ||
419 | public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } | ||
420 | public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } | ||
421 | public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } | ||
422 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } | ||
423 | public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } | ||
424 | public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } | ||
425 | public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } | ||
426 | public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } | ||
427 | public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } | ||
428 | public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } | ||
429 | public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } | ||
430 | public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } | ||
431 | public double llGetEnergy() { return 1.0f; } | ||
432 | public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } | ||
433 | public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } | ||
434 | |||
435 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) | ||
436 | { | ||
437 | Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); | ||
438 | m_host.SetText(text, av3, alpha); | ||
439 | } | ||
440 | |||
441 | |||
442 | public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } | ||
443 | public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } | ||
444 | public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } | ||
445 | public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } | ||
446 | public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } | ||
447 | public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } | ||
448 | public void llModifyLand(int action, int brush) { } | ||
449 | public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } | ||
450 | public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } | ||
451 | public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } | ||
452 | public void llResetScript() | ||
453 | { | ||
454 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); | ||
455 | } | ||
456 | public void llMessageLinked(int linknum, int num, string str, string id) { } | ||
457 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } | ||
458 | public void llPassCollisions(int pass) { } | ||
459 | public string llGetScriptName() { return ""; } | ||
460 | |||
461 | public int llGetNumberOfSides() { return 0; } | ||
462 | |||
463 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } | ||
464 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } | ||
465 | public void llRot2Angle() { } | ||
466 | |||
467 | public double llAcos(double val) | ||
468 | { | ||
469 | return (double)Math.Acos(val); | ||
470 | } | ||
471 | |||
472 | public double llAsin(double val) | ||
473 | { | ||
474 | return (double)Math.Asin(val); | ||
475 | } | ||
476 | |||
477 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } | ||
478 | public string llGetInventoryKey(string name) { return ""; } | ||
479 | public void llAllowInventoryDrop(int add) { } | ||
480 | public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } | ||
481 | public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } | ||
482 | public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } | ||
483 | public double llGetTextureRot(int side) { return 0; } | ||
484 | |||
485 | public int llSubStringIndex(string source, string pattern) | ||
486 | { | ||
487 | return source.IndexOf(pattern); | ||
488 | } | ||
489 | |||
490 | public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } | ||
491 | |||
492 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } | ||
493 | |||
494 | public List<string> llListSort(List<string> src, int stride, int ascending) | ||
495 | { | ||
496 | SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); | ||
497 | // Add chunks to an array | ||
498 | int s = stride; | ||
499 | if (s < 1) | ||
500 | s = 1; | ||
501 | int c = 0; | ||
502 | List<string> chunk = new List<string>(); | ||
503 | string chunkString = ""; | ||
504 | foreach (string element in src) | ||
505 | { | ||
506 | c++; | ||
507 | if (c > s) | ||
508 | { | ||
509 | sorted.Add(chunkString, chunk); | ||
510 | chunkString = ""; | ||
511 | chunk = new List<string>(); | ||
512 | c = 0; | ||
513 | } | ||
514 | chunk.Add(element); | ||
515 | chunkString += element.ToString(); | ||
516 | } | ||
517 | if (chunk.Count > 0) | ||
518 | sorted.Add(chunkString, chunk); | ||
519 | |||
520 | List<string> ret = new List<string>(); | ||
521 | foreach (List<string> ls in sorted.Values) | ||
522 | { | ||
523 | ret.AddRange(ls); | ||
524 | } | ||
525 | |||
526 | if (ascending == LSL.LSL_BaseClass.TRUE) | ||
527 | return ret; | ||
528 | ret.Reverse(); | ||
529 | return ret; | ||
530 | } | ||
531 | |||
532 | public int llGetListLength(List<string> src) | ||
533 | { | ||
534 | return src.Count; | ||
535 | } | ||
536 | |||
537 | public int llList2Integer(List<string> src, int index) | ||
538 | { | ||
539 | return Convert.ToInt32(src[index]); | ||
540 | } | ||
541 | |||
542 | public double llList2double(List<string> src, int index) | ||
543 | { | ||
544 | return Convert.ToDouble(src[index]); | ||
545 | } | ||
546 | |||
547 | public float llList2Float(List<string> src, int index) | ||
548 | { | ||
549 | return Convert.ToSingle(src[index]); | ||
550 | } | ||
551 | |||
552 | public string llList2String(List<string> src, int index) | ||
553 | { | ||
554 | return src[index]; | ||
555 | } | ||
556 | |||
557 | public string llList2Key(List<string> src, int index) | ||
558 | { | ||
559 | //return OpenSim.Framework.Types.ToStringHyphenated(src[index]); | ||
560 | return src[index].ToString(); | ||
561 | } | ||
562 | |||
563 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) | ||
564 | { | ||
565 | return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); | ||
566 | } | ||
567 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) | ||
568 | { | ||
569 | return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); | ||
570 | } | ||
571 | public List<string> llList2List(List<string> src, int start, int end) | ||
572 | { | ||
573 | if (end > start) | ||
574 | { | ||
575 | // Simple straight forward chunk | ||
576 | return src.GetRange(start, end - start); | ||
577 | } | ||
578 | else | ||
579 | { | ||
580 | // Some of the end + some of the beginning | ||
581 | // First chunk | ||
582 | List<string> ret = new List<string>(); | ||
583 | ret.AddRange(src.GetRange(start, src.Count - start)); | ||
584 | ret.AddRange(src.GetRange(0, end)); | ||
585 | return ret; | ||
586 | } | ||
587 | |||
588 | |||
589 | |||
590 | |||
591 | } | ||
592 | public List<string> llDeleteSubList(List<string> src, int start, int end) | ||
593 | { | ||
594 | List<string> ret = new List<string>(src); | ||
595 | ret.RemoveRange(start, end - start); | ||
596 | return ret; | ||
597 | } | ||
598 | public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } | ||
599 | public string llList2CSV(List<string> src) | ||
600 | { | ||
601 | string ret = ""; | ||
602 | foreach (string s in src) | ||
603 | { | ||
604 | if (s.Length > 0) | ||
605 | ret += ","; | ||
606 | ret += s; | ||
607 | } | ||
608 | return ret; | ||
609 | } | ||
610 | public List<string> llCSV2List(string src) | ||
611 | { | ||
612 | List<string> ret = new List<string>(); | ||
613 | foreach (string s in src.Split(",".ToCharArray())) | ||
614 | { | ||
615 | ret.Add(s); | ||
616 | } | ||
617 | return ret; | ||
618 | } | ||
619 | public List<string> llListRandomize(List<string> src, int stride) | ||
620 | { | ||
621 | int s = stride; | ||
622 | if (s < 1) | ||
623 | s = 1; | ||
624 | |||
625 | // This is a cowardly way of doing it ;) | ||
626 | // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange | ||
627 | List<List<string>> tmp = new List<List<string>>(); | ||
628 | |||
629 | // Add chunks to an array | ||
630 | int c = 0; | ||
631 | List<string> chunk = new List<string>(); | ||
632 | foreach (string element in src) | ||
633 | { | ||
634 | c++; | ||
635 | if (c > s) | ||
636 | { | ||
637 | tmp.Add(chunk); | ||
638 | chunk = new List<string>(); | ||
639 | c = 0; | ||
640 | } | ||
641 | chunk.Add(element); | ||
642 | } | ||
643 | if (chunk.Count > 0) | ||
644 | tmp.Add(chunk); | ||
645 | |||
646 | // Decreate (<- what kind of word is that? :D ) array back into a list | ||
647 | int rnd; | ||
648 | List<string> ret = new List<string>(); | ||
649 | while (tmp.Count > 0) | ||
650 | { | ||
651 | rnd = Util.RandomClass.Next(tmp.Count); | ||
652 | foreach (string str in tmp[rnd]) | ||
653 | { | ||
654 | ret.Add(str); | ||
655 | } | ||
656 | tmp.RemoveAt(rnd); | ||
657 | } | ||
658 | |||
659 | return ret; | ||
660 | |||
661 | |||
662 | } | ||
663 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | ||
664 | { | ||
665 | List<string> ret = new List<string>(); | ||
666 | int s = stride; | ||
667 | if (s < 1) | ||
668 | s = 1; | ||
669 | |||
670 | int sc = s; | ||
671 | for (int i = start; i < src.Count; i++) | ||
672 | { | ||
673 | sc--; | ||
674 | if (sc == 0) | ||
675 | { | ||
676 | sc = s; | ||
677 | // Addthis | ||
678 | ret.Add(src[i]); | ||
679 | } | ||
680 | if (i == end) | ||
681 | break; | ||
682 | } | ||
683 | return ret; | ||
684 | } | ||
685 | |||
686 | public LSL_Types.Vector3 llGetRegionCorner() | ||
687 | { | ||
688 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); | ||
689 | } | ||
690 | |||
691 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) | ||
692 | { | ||
693 | |||
694 | List<string> ret = new List<string>(dest); | ||
695 | //foreach (string s in src.Reverse()) | ||
696 | for (int ci = src.Count - 1; ci > -1; ci--) | ||
697 | { | ||
698 | ret.Insert(start, src[ci]); | ||
699 | } | ||
700 | return ret; | ||
701 | } | ||
702 | public int llListFindList(List<string> src, List<string> test) | ||
703 | { | ||
704 | foreach (string s in test) | ||
705 | { | ||
706 | for (int ci = 0; ci < src.Count; ci++) | ||
707 | { | ||
708 | |||
709 | if (s == src[ci]) | ||
710 | return ci; | ||
711 | } | ||
712 | } | ||
713 | return -1; | ||
714 | } | ||
715 | |||
716 | public string llGetObjectName() | ||
717 | { | ||
718 | return m_host.Name; | ||
719 | } | ||
720 | |||
721 | public void llSetObjectName(string name) | ||
722 | { | ||
723 | m_host.Name = name; | ||
724 | } | ||
725 | |||
726 | public string llGetDate() | ||
727 | { | ||
728 | DateTime date = DateTime.Now.ToUniversalTime(); | ||
729 | string result = date.ToString("yyyy-MM-dd"); | ||
730 | return result; | ||
731 | } | ||
732 | |||
733 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } | ||
734 | public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } | ||
735 | public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } | ||
736 | public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } | ||
737 | public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } | ||
738 | public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } | ||
739 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } | ||
740 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } | ||
741 | public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } | ||
742 | |||
743 | public void llParseString2List() { NotImplemented("llParseString2List"); } | ||
744 | |||
745 | public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } | ||
746 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } | ||
747 | public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } | ||
748 | public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } | ||
749 | public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } | ||
750 | public void llUnSit(string id) { NotImplemented("llUnSit"); } | ||
751 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } | ||
752 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } | ||
753 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } | ||
754 | public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } | ||
755 | public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } | ||
756 | |||
757 | public string llGetRegionName() | ||
758 | { | ||
759 | return World.RegionInfo.RegionName; | ||
760 | } | ||
761 | |||
762 | public double llGetRegionTimeDilation() { return 1.0f; } | ||
763 | public double llGetRegionFPS() { return 10.0f; } | ||
764 | |||
765 | /* particle system rules should be coming into this routine as doubles, that is | ||
766 | rule[0] should be an integer from this list and rule[1] should be the arg | ||
767 | for the same integer. wiki.secondlife.com has most of this mapping, but some | ||
768 | came from http://www.caligari-designs.com/p4u2 | ||
769 | |||
770 | We iterate through the list for 'Count' elements, incrementing by two for each | ||
771 | iteration and set the members of Primitive.ParticleSystem, one at a time. | ||
772 | */ | ||
773 | public enum PrimitiveRule : int | ||
774 | { | ||
775 | PSYS_PART_FLAGS = 0, | ||
776 | PSYS_PART_START_COLOR = 1, | ||
777 | PSYS_PART_START_ALPHA = 2, | ||
778 | PSYS_PART_END_COLOR = 3, | ||
779 | PSYS_PART_END_ALPHA = 4, | ||
780 | PSYS_PART_START_SCALE = 5, | ||
781 | PSYS_PART_END_SCALE = 6, | ||
782 | PSYS_PART_MAX_AGE = 7, | ||
783 | PSYS_SRC_ACCEL = 8, | ||
784 | PSYS_SRC_PATTERN = 9, | ||
785 | PSYS_SRC_TEXTURE = 12, | ||
786 | PSYS_SRC_BURST_RATE = 13, | ||
787 | PSYS_SRC_BURST_PART_COUNT = 15, | ||
788 | PSYS_SRC_BURST_RADIUS = 16, | ||
789 | PSYS_SRC_BURST_SPEED_MIN = 17, | ||
790 | PSYS_SRC_BURST_SPEED_MAX = 18, | ||
791 | PSYS_SRC_MAX_AGE = 19, | ||
792 | PSYS_SRC_TARGET_KEY = 20, | ||
793 | PSYS_SRC_OMEGA = 21, | ||
794 | PSYS_SRC_ANGLE_BEGIN = 22, | ||
795 | PSYS_SRC_ANGLE_END = 23 | ||
796 | } | ||
797 | |||
798 | public void llParticleSystem(List<Object> rules) | ||
799 | { | ||
800 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | ||
801 | for (int i = 0; i < rules.Count; i += 2) | ||
802 | { | ||
803 | switch ((int)rules[i]) | ||
804 | { | ||
805 | case (int)PrimitiveRule.PSYS_PART_FLAGS: | ||
806 | prules.PartFlags = (uint)rules[i + 1]; | ||
807 | break; | ||
808 | |||
809 | case (int)PrimitiveRule.PSYS_PART_START_COLOR: | ||
810 | prules.PartStartColor = (LLColor)rules[i + 1]; | ||
811 | break; | ||
812 | |||
813 | case (int)PrimitiveRule.PSYS_PART_START_ALPHA: | ||
814 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
815 | break; | ||
816 | |||
817 | case (int)PrimitiveRule.PSYS_PART_END_COLOR: | ||
818 | prules.PartEndColor = (LLColor)rules[i + 1]; | ||
819 | break; | ||
820 | |||
821 | case (int)PrimitiveRule.PSYS_PART_END_ALPHA: | ||
822 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
823 | break; | ||
824 | |||
825 | case (int)PrimitiveRule.PSYS_PART_START_SCALE: | ||
826 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
827 | break; | ||
828 | |||
829 | case (int)PrimitiveRule.PSYS_PART_END_SCALE: | ||
830 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
831 | break; | ||
832 | |||
833 | case (int)PrimitiveRule.PSYS_PART_MAX_AGE: | ||
834 | prules.MaxAge = (float)rules[i + 1]; | ||
835 | break; | ||
836 | |||
837 | case (int)PrimitiveRule.PSYS_SRC_ACCEL: | ||
838 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
839 | break; | ||
840 | |||
841 | case (int)PrimitiveRule.PSYS_SRC_PATTERN: | ||
842 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
843 | break; | ||
844 | |||
845 | case (int)PrimitiveRule.PSYS_SRC_TEXTURE: | ||
846 | prules.Texture = (LLUUID)rules[i + 1]; | ||
847 | break; | ||
848 | |||
849 | case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: | ||
850 | prules.BurstRate = (float)rules[i + 1]; | ||
851 | break; | ||
852 | |||
853 | case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: | ||
854 | prules.BurstPartCount = (byte)rules[i + 1]; | ||
855 | break; | ||
856 | |||
857 | case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: | ||
858 | prules.BurstRadius = (float)rules[i + 1]; | ||
859 | break; | ||
860 | |||
861 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: | ||
862 | prules.BurstSpeedMin = (float)rules[i + 1]; | ||
863 | break; | ||
864 | |||
865 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: | ||
866 | prules.BurstSpeedMax = (float)rules[i + 1]; | ||
867 | break; | ||
868 | |||
869 | case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: | ||
870 | prules.MaxAge = (float)rules[i + 1]; | ||
871 | break; | ||
872 | |||
873 | case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: | ||
874 | prules.Target = (LLUUID)rules[i + 1]; | ||
875 | break; | ||
876 | |||
877 | case (int)PrimitiveRule.PSYS_SRC_OMEGA: | ||
878 | //cast?? prules.MaxAge = (float)rules[i + 1]; | ||
879 | break; | ||
880 | |||
881 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: | ||
882 | prules.InnerAngle = (float)rules[i + 1]; | ||
883 | break; | ||
884 | |||
885 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: | ||
886 | prules.OuterAngle = (float)rules[i + 1]; | ||
887 | break; | ||
888 | |||
889 | } | ||
890 | } | ||
891 | |||
892 | m_host.AddNewParticleSystem(prules); | ||
893 | } | ||
894 | |||
895 | public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } | ||
896 | public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } | ||
897 | public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } | ||
898 | public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } | ||
899 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } | ||
900 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } | ||
901 | public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } | ||
902 | public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } | ||
903 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } | ||
904 | public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } | ||
905 | public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } | ||
906 | |||
907 | public void llSetTouchText(string text) | ||
908 | { | ||
909 | m_host.TouchName = text; | ||
910 | } | ||
911 | |||
912 | public void llSetSitText(string text) | ||
913 | { | ||
914 | m_host.SitName = text; | ||
915 | } | ||
916 | |||
917 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } | ||
918 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } | ||
919 | public void llDumpList2String() { NotImplemented("llDumpList2String"); } | ||
920 | public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } | ||
921 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); } | ||
922 | public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); } | ||
923 | public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); } | ||
924 | |||
925 | public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } | ||
926 | |||
927 | public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } | ||
928 | public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } | ||
929 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } | ||
930 | public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); } | ||
931 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } | ||
932 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); } | ||
933 | public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); } | ||
934 | |||
935 | public string llMD5String(string src, int nonce) | ||
936 | { | ||
937 | return Util.Md5Hash(src + ":" + nonce.ToString()); | ||
938 | } | ||
939 | |||
940 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } | ||
941 | public string llStringToBase64(string str) | ||
942 | { | ||
943 | |||
944 | try | ||
945 | { | ||
946 | byte[] encData_byte = new byte[str.Length]; | ||
947 | encData_byte = System.Text.Encoding.UTF8.GetBytes(str); | ||
948 | string encodedData = Convert.ToBase64String(encData_byte); | ||
949 | return encodedData; | ||
950 | } | ||
951 | catch (Exception e) | ||
952 | { | ||
953 | throw new Exception("Error in base64Encode" + e.Message); | ||
954 | } | ||
955 | } | ||
956 | |||
957 | public string llBase64ToString(string str) | ||
958 | { | ||
959 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); | ||
960 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); | ||
961 | try | ||
962 | { | ||
963 | |||
964 | byte[] todecode_byte = Convert.FromBase64String(str); | ||
965 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | ||
966 | char[] decoded_char = new char[charCount]; | ||
967 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); | ||
968 | string result = new String(decoded_char); | ||
969 | return result; | ||
970 | } | ||
971 | catch (Exception e) | ||
972 | { | ||
973 | throw new Exception("Error in base64Decode" + e.Message); | ||
974 | } | ||
975 | } | ||
976 | public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } | ||
977 | public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } | ||
978 | public double llLog10(double val) { return (double)Math.Log10(val); } | ||
979 | public double llLog(double val) { return (double)Math.Log(val); } | ||
980 | public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); } | ||
981 | public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); } | ||
982 | |||
983 | public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } | ||
984 | |||
985 | public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } | ||
986 | |||
987 | public string llGetObjectDesc() | ||
988 | { | ||
989 | return m_host.Description; | ||
990 | } | ||
991 | |||
992 | public void llSetObjectDesc(string desc) | ||
993 | { | ||
994 | m_host.Description = desc; | ||
995 | } | ||
996 | |||
997 | public string llGetCreator() | ||
998 | { | ||
999 | return m_host.ObjectCreator.ToStringHyphenated(); | ||
1000 | } | ||
1001 | |||
1002 | public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } | ||
1003 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } | ||
1004 | public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } | ||
1005 | public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } | ||
1006 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } | ||
1007 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } | ||
1008 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } | ||
1009 | public string llIntegerToBase64(int number) | ||
1010 | { | ||
1011 | NotImplemented("llIntegerToBase64"); return ""; | ||
1012 | } | ||
1013 | public int llBase64ToInteger(string str) | ||
1014 | { | ||
1015 | NotImplemented("llBase64ToInteger"); return 0; | ||
1016 | } | ||
1017 | |||
1018 | public double llGetGMTclock() | ||
1019 | { | ||
1020 | return DateTime.UtcNow.TimeOfDay.TotalSeconds; | ||
1021 | } | ||
1022 | |||
1023 | public string llGetSimulatorHostname() | ||
1024 | { | ||
1025 | return System.Environment.MachineName; | ||
1026 | } | ||
1027 | |||
1028 | public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } | ||
1029 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } | ||
1030 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } | ||
1031 | |||
1032 | public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } | ||
1033 | |||
1034 | public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } | ||
1035 | |||
1036 | public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } | ||
1037 | public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } | ||
1038 | public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } | ||
1039 | public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } | ||
1040 | public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } | ||
1041 | public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } | ||
1042 | public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } | ||
1043 | public void llListReplaceList() { NotImplemented("llListReplaceList"); } | ||
1044 | |||
1045 | public void llLoadURL(string avatar_id, string message, string url) | ||
1046 | { | ||
1047 | LLUUID avatarId = new LLUUID(avatar_id); | ||
1048 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); | ||
1049 | } | ||
1050 | |||
1051 | public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } | ||
1052 | public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } | ||
1053 | |||
1054 | public int llModPow(int a, int b, int c) | ||
1055 | { | ||
1056 | Int64 tmp = 0; | ||
1057 | Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); | ||
1058 | return Convert.ToInt32(tmp); | ||
1059 | } | ||
1060 | |||
1061 | public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } | ||
1062 | |||
1063 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } | ||
1064 | public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } | ||
1065 | public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } | ||
1066 | public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } | ||
1067 | public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } | ||
1068 | |||
1069 | public string llEscapeURL(string url) | ||
1070 | { | ||
1071 | try | ||
1072 | { | ||
1073 | return Uri.EscapeUriString(url); | ||
1074 | } | ||
1075 | catch (Exception ex) | ||
1076 | { | ||
1077 | return "llEscapeURL: " + ex.ToString(); | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | public string llUnescapeURL(string url) | ||
1082 | { | ||
1083 | try | ||
1084 | { | ||
1085 | return Uri.UnescapeDataString(url); | ||
1086 | } | ||
1087 | catch (Exception ex) | ||
1088 | { | ||
1089 | return "llUnescapeURL: " + ex.ToString(); | ||
1090 | } | ||
1091 | } | ||
1092 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } | ||
1093 | public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } | ||
1094 | public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } | ||
1095 | public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } | ||
1096 | public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } | ||
1097 | public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } | ||
1098 | public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } | ||
1099 | |||
1100 | public int llGetUnixTime() | ||
1101 | { | ||
1102 | return Util.UnixTimeSinceEpoch(); | ||
1103 | } | ||
1104 | |||
1105 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } | ||
1106 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } | ||
1107 | public string llXorBase64StringsCorrect(string str1, string str2) | ||
1108 | { | ||
1109 | string ret = ""; | ||
1110 | string src1 = llBase64ToString(str1); | ||
1111 | string src2 = llBase64ToString(str2); | ||
1112 | int c = 0; | ||
1113 | for (int i = 0; i < src1.Length; i++) | ||
1114 | { | ||
1115 | ret += src1[i] ^ src2[c]; | ||
1116 | |||
1117 | c++; | ||
1118 | if (c > src2.Length) | ||
1119 | c = 0; | ||
1120 | } | ||
1121 | return llStringToBase64(ret); | ||
1122 | } | ||
1123 | public void llHTTPRequest(string url, List<string> parameters, string body) | ||
1124 | { | ||
1125 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); | ||
1126 | } | ||
1127 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } | ||
1128 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } | ||
1129 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } | ||
1130 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } | ||
1131 | public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } | ||
1132 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } | ||
1133 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } | ||
1134 | |||
1135 | // | ||
1136 | // OpenSim functions | ||
1137 | // | ||
1138 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) | ||
1139 | { | ||
1140 | if (dynamicID == "") | ||
1141 | { | ||
1142 | IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); | ||
1143 | LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer); | ||
1144 | return createdTexture.ToStringHyphenated(); | ||
1145 | } | ||
1146 | else | ||
1147 | { | ||
1148 | //TODO update existing dynamic textures | ||
1149 | } | ||
1150 | |||
1151 | return LLUUID.Zero.ToStringHyphenated(); | ||
1152 | } | ||
1153 | |||
1154 | private void NotImplemented(string Command) | ||
1155 | { | ||
1156 | if (throwErrorOnNotImplemented) | ||
1157 | throw new NotImplementedException("Command not implemented: " + Command); | ||
1158 | } | ||
1159 | |||
1160 | } | ||
1161 | } | ||