diff options
author | Melanie Thielker | 2008-09-26 03:04:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-26 03:04:36 +0000 |
commit | b65d2139c855d16c11b74a0090de6656b99cd664 (patch) | |
tree | 770f27291904d6f0c0f17d58fef569825f71e811 /OpenSim/Region/ScriptEngine/Shared/Api/Runtime | |
parent | Full API convergence. Api is back in LSL_Api.cs and OSSL_Api.cs. (diff) | |
download | opensim-SC-b65d2139c855d16c11b74a0090de6656b99cd664.zip opensim-SC-b65d2139c855d16c11b74a0090de6656b99cd664.tar.gz opensim-SC-b65d2139c855d16c11b74a0090de6656b99cd664.tar.bz2 opensim-SC-b65d2139c855d16c11b74a0090de6656b99cd664.tar.xz |
Bringing the OSSLPrim back. Prim.Rotation, etc, will now work again.
As a bonus, the OSSLPrim has now come to XEngine, too!
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Runtime')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index de11d06..63d74b1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -51,6 +51,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
51 | return; | 51 | return; |
52 | 52 | ||
53 | m_OSSL_Functions = (IOSSL_Api)api; | 53 | m_OSSL_Functions = (IOSSL_Api)api; |
54 | |||
55 | Prim = new OSSLPrim(this); | ||
54 | } | 56 | } |
55 | 57 | ||
56 | public void osSetRegionWaterHeight(double height) | 58 | public void osSetRegionWaterHeight(double height) |
@@ -224,5 +226,190 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
224 | { | 226 | { |
225 | return m_OSSL_Functions.osParseJSON(JSON); | 227 | return m_OSSL_Functions.osParseJSON(JSON); |
226 | } | 228 | } |
229 | |||
230 | public OSSLPrim Prim; | ||
231 | |||
232 | [Serializable] | ||
233 | public class OSSLPrim | ||
234 | { | ||
235 | internal ScriptBaseClass OSSL; | ||
236 | public OSSLPrim(ScriptBaseClass bc) | ||
237 | { | ||
238 | OSSL = bc; | ||
239 | Position = new OSSLPrim_Position(this); | ||
240 | Rotation = new OSSLPrim_Rotation(this); | ||
241 | } | ||
242 | |||
243 | public OSSLPrim_Position Position; | ||
244 | public OSSLPrim_Rotation Rotation; | ||
245 | private TextStruct _text; | ||
246 | public TextStruct Text | ||
247 | { | ||
248 | get { return _text; } | ||
249 | set | ||
250 | { | ||
251 | _text = value; | ||
252 | OSSL.llSetText(_text.Text, _text.color, _text.alpha); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | [Serializable] | ||
257 | public struct TextStruct | ||
258 | { | ||
259 | public string Text; | ||
260 | public LSL_Types.Vector3 color; | ||
261 | public double alpha; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | [Serializable] | ||
266 | public class OSSLPrim_Position | ||
267 | { | ||
268 | private OSSLPrim prim; | ||
269 | private LSL_Types.Vector3 Position; | ||
270 | public OSSLPrim_Position(OSSLPrim _prim) | ||
271 | { | ||
272 | prim = _prim; | ||
273 | } | ||
274 | private void Load() | ||
275 | { | ||
276 | Position = prim.OSSL.llGetPos(); | ||
277 | } | ||
278 | private void Save() | ||
279 | { | ||
280 | if (Position.x > 255) | ||
281 | Position.x = 255; | ||
282 | if (Position.x < 0) | ||
283 | Position.x = 0; | ||
284 | if (Position.y > 255) | ||
285 | Position.y = 255; | ||
286 | if (Position.y < 0) | ||
287 | Position.y = 0; | ||
288 | if (Position.z > 768) | ||
289 | Position.z = 768; | ||
290 | if (Position.z < 0) | ||
291 | Position.z = 0; | ||
292 | prim.OSSL.llSetPos(Position); | ||
293 | } | ||
294 | |||
295 | public double x | ||
296 | { | ||
297 | get | ||
298 | { | ||
299 | Load(); | ||
300 | return Position.x; | ||
301 | } | ||
302 | set | ||
303 | { | ||
304 | Load(); | ||
305 | Position.x = value; | ||
306 | Save(); | ||
307 | } | ||
308 | } | ||
309 | public double y | ||
310 | { | ||
311 | get | ||
312 | { | ||
313 | Load(); | ||
314 | return Position.y; | ||
315 | } | ||
316 | set | ||
317 | { | ||
318 | Load(); | ||
319 | Position.y = value; | ||
320 | Save(); | ||
321 | } | ||
322 | } | ||
323 | public double z | ||
324 | { | ||
325 | get | ||
326 | { | ||
327 | Load(); | ||
328 | return Position.z; | ||
329 | } | ||
330 | set | ||
331 | { | ||
332 | Load(); | ||
333 | Position.z = value; | ||
334 | Save(); | ||
335 | } | ||
336 | } | ||
337 | } | ||
338 | |||
339 | [Serializable] | ||
340 | public class OSSLPrim_Rotation | ||
341 | { | ||
342 | private OSSLPrim prim; | ||
343 | private LSL_Types.Quaternion Rotation; | ||
344 | public OSSLPrim_Rotation(OSSLPrim _prim) | ||
345 | { | ||
346 | prim = _prim; | ||
347 | } | ||
348 | private void Load() | ||
349 | { | ||
350 | Rotation = prim.OSSL.llGetRot(); | ||
351 | } | ||
352 | private void Save() | ||
353 | { | ||
354 | prim.OSSL.llSetRot(Rotation); | ||
355 | } | ||
356 | |||
357 | public double x | ||
358 | { | ||
359 | get | ||
360 | { | ||
361 | Load(); | ||
362 | return Rotation.x; | ||
363 | } | ||
364 | set | ||
365 | { | ||
366 | Load(); | ||
367 | Rotation.x = value; | ||
368 | Save(); | ||
369 | } | ||
370 | } | ||
371 | public double y | ||
372 | { | ||
373 | get | ||
374 | { | ||
375 | Load(); | ||
376 | return Rotation.y; | ||
377 | } | ||
378 | set | ||
379 | { | ||
380 | Load(); | ||
381 | Rotation.y = value; | ||
382 | Save(); | ||
383 | } | ||
384 | } | ||
385 | public double z | ||
386 | { | ||
387 | get | ||
388 | { | ||
389 | Load(); | ||
390 | return Rotation.z; | ||
391 | } | ||
392 | set | ||
393 | { | ||
394 | Load(); | ||
395 | Rotation.z = value; | ||
396 | Save(); | ||
397 | } | ||
398 | } | ||
399 | public double s | ||
400 | { | ||
401 | get | ||
402 | { | ||
403 | Load(); | ||
404 | return Rotation.s; | ||
405 | } | ||
406 | set | ||
407 | { | ||
408 | Load(); | ||
409 | Rotation.s = value; | ||
410 | Save(); | ||
411 | } | ||
412 | } | ||
413 | } | ||
227 | } | 414 | } |
228 | } | 415 | } |