aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-07-13 17:43:25 +0000
committerAdam Frisby2007-07-13 17:43:25 +0000
commit6d37fe4947eb31999295ab7f6961b7b0ab1a25c0 (patch)
treebc77978b5db979ea4b30ce123a62a58389364740 /OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
parent* Added wrappers for: (diff)
downloadopensim-SC-6d37fe4947eb31999295ab7f6961b7b0ab1a25c0.zip
opensim-SC-6d37fe4947eb31999295ab7f6961b7b0ab1a25c0.tar.gz
opensim-SC-6d37fe4947eb31999295ab7f6961b7b0ab1a25c0.tar.bz2
opensim-SC-6d37fe4947eb31999295ab7f6961b7b0ab1a25c0.tar.xz
* Moved LSL-style functions to ScriptInterpretedAPI.cs and put a XML remark comment that they are defunct and best avoided at all costs.
* More wrappers: llCollisionFilter, llCollisionSprite, llCos, llCreateLink, llDeleteSubList, llDeleteSubString, llDetachFromAvatar * More functions: osCos, osDeleteSubList, osDeleteSubString
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs206
1 files changed, 206 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
new file mode 100644
index 0000000..0ae6e62
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
@@ -0,0 +1,206 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Key = libsecondlife.LLUUID;
5using Rotation = libsecondlife.LLQuaternion;
6using Vector = libsecondlife.LLVector3;
7using LSLList = System.Collections.Generic.List<string>;
8
9using OpenSim.Region.Environment.Scenes;
10
11namespace OpenSim.Region.Environment.Scripting
12{
13 /// <summary>
14 /// A class inteded to act as an API for LSL-styled interpreted languages
15 /// </summary>
16 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
17 class ScriptInterpretedAPI
18 {
19 public int osAbs(int val)
20 {
21 return Math.Abs(val);
22 }
23
24 public float osAcos(float val)
25 {
26 return (float)Math.Acos(val);
27 }
28
29 [Obsolete("Unimplemented")]
30 public void osAddToLandPassList(Key avatar, float hours)
31 {
32 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
33 return;
34 }
35
36 [Obsolete("Unimplemented")]
37 public void osAdjustSoundVolume(float volume)
38 {
39 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAdjustSoundVolume(float volume)");
40 return;
41 }
42
43 [Obsolete("Unimplemented")]
44 public void osAllowInventoryDrop(int add)
45 {
46 return;
47 }
48
49 [Obsolete("Unimplemented")]
50 public float osAngleBetween(Rotation a, Rotation b)
51 {
52 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z);
53 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z);
54
55 return 0;
56 }
57
58 [Obsolete("Unimplemented")]
59 public void osApplyImpulse(Vector force, int local)
60 {
61 return;
62 }
63
64 [Obsolete("Unimplemented")]
65 public void osApplyRotationalImpulse(Vector force, int local)
66 {
67 return;
68 }
69
70 public float osAsin(float val)
71 {
72 return (float)Math.Asin(val);
73 }
74
75 public float osAtan2(float x, float y)
76 {
77 return (float)Math.Atan2(x, y);
78 }
79
80 [Obsolete("Unimplemented")]
81 public void osAttachToAvatar(Key avatar, int attachmentPoint)
82 {
83 return;
84 }
85
86 [Obsolete("Unimplemented")]
87 public Key osAvatarOnSitTarget()
88 {
89 return Key.Zero;
90 }
91
92 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
93 {
94 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion();
95 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z);
96 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z);
97 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z);
98
99 axQ.FromAxes(axFwd, axLeft, axUp);
100
101 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
102 }
103
104 public Rotation osAxisAngle2Rot(Vector axis, float angle)
105 {
106 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z));
107
108 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
109 }
110
111 public string osBase64ToString(string str)
112 {
113 Encoding enc = System.Text.Encoding.UTF8;
114 return enc.GetString(Convert.FromBase64String(str));
115 }
116
117 [Obsolete("Unimplemented")]
118 public void osBreakAllLinks()
119 {
120 return;
121 }
122
123 [Obsolete("Unimplemented")]
124 public void osBreakLink()
125 {
126 return;
127 }
128
129 public LSLList osCSV2List(string src)
130 {
131 LSLList retVal = new LSLList();
132 retVal.AddRange(src.Split(','));
133
134 return retVal;
135 }
136
137 public int osCeil(float val)
138 {
139 return (int)Math.Ceiling(val);
140 }
141
142 [Obsolete("Unimplemented")]
143 public void osCloseRemoteDataChannel(Key channel)
144 {
145 return;
146 }
147
148 [Obsolete("Unimplemented")]
149 public float osCloud(Vector offset)
150 {
151 return 0.0;
152 }
153
154 [Obsolete("Unimplemented")]
155 public void osCollisionFilter(string name, Key id, int accept)
156 {
157 return;
158 }
159
160 [Obsolete("Unimplemented")]
161 public void osCollisionSprite(string impact_sprite)
162 {
163 return;
164 }
165
166 public float osCos(float theta)
167 {
168 return (float)Math.Cos(theta);
169 }
170
171 [Obsolete("Unimplemented")]
172 public void osCreateLink(Key target, int parent)
173 {
174 return false;
175 }
176
177 [Obsolete("Partially Unimplemented")]
178 public LSLList osDeleteSubList(LSLList src, int start, int end)
179 {
180 if (start < 0 || end < 0)
181 {
182 throw new Exception("Unsupported at this time.");
183 }
184
185 src.RemoveRange(start, start - end + 1);
186 return src;
187 }
188
189 [Obsolete("Partially Unimplemented")]
190 public string osDeleteSubString(string src, int start, int end)
191 {
192 if (start < 0 || end < 0)
193 {
194 throw new Exception("Unsupported at this time.");
195 }
196
197 return src.Remove(start, start - end + 1);
198 }
199
200 [Obsolete("Unimplemented")]
201 public void osDetachFromAvatar(Key avatar)
202 {
203 return;
204 }
205 }
206}