diff options
author | Kitto Flora | 2010-03-12 13:48:31 -0500 |
---|---|---|
committer | Kitto Flora | 2010-03-12 13:48:31 -0500 |
commit | 7bd48d383d3383c1e633f76f76a5291f4224d48a (patch) | |
tree | 18997a5b1a123091af18a1a7984d7dd7873930ac /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Dynamics Integration Part 1 (diff) | |
parent | Small consistency change (diff) | |
download | opensim-SC-7bd48d383d3383c1e633f76f76a5291f4224d48a.zip opensim-SC-7bd48d383d3383c1e633f76f76a5291f4224d48a.tar.gz opensim-SC-7bd48d383d3383c1e633f76f76a5291f4224d48a.tar.bz2 opensim-SC-7bd48d383d3383c1e633f76f76a5291f4224d48a.tar.xz |
Resolved merge
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 342 |
1 files changed, 278 insertions, 64 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7a6739b..180fba9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1252,7 +1252,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1252 | 1252 | ||
1253 | if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) | 1253 | if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) |
1254 | { | 1254 | { |
1255 | NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); | 1255 | if (value != 0) |
1256 | m_host.SetBlockGrab(true); | ||
1257 | else | ||
1258 | m_host.SetBlockGrab(false); | ||
1256 | } | 1259 | } |
1257 | 1260 | ||
1258 | if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) | 1261 | if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) |
@@ -1265,12 +1268,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1265 | 1268 | ||
1266 | if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) | 1269 | if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) |
1267 | { | 1270 | { |
1268 | NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); | 1271 | if (value != 0) |
1272 | m_host.SetReturnAtEdge(true); | ||
1273 | else | ||
1274 | m_host.SetReturnAtEdge(false); | ||
1269 | } | 1275 | } |
1270 | 1276 | ||
1271 | if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) | 1277 | if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) |
1272 | { | 1278 | { |
1273 | NotImplemented("llSetStatus - STATUS_SANDBOX"); | 1279 | if (value != 0) |
1280 | m_host.SetStatusSandbox(true); | ||
1281 | else | ||
1282 | m_host.SetStatusSandbox(false); | ||
1274 | } | 1283 | } |
1275 | 1284 | ||
1276 | if (statusrotationaxis != 0) | 1285 | if (statusrotationaxis != 0) |
@@ -1307,8 +1316,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1307 | return 0; | 1316 | return 0; |
1308 | 1317 | ||
1309 | case ScriptBaseClass.STATUS_BLOCK_GRAB: | 1318 | case ScriptBaseClass.STATUS_BLOCK_GRAB: |
1310 | NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); | 1319 | if (m_host.GetBlockGrab()) |
1311 | return 0; | 1320 | return 1; |
1321 | else | ||
1322 | return 0; | ||
1312 | 1323 | ||
1313 | case ScriptBaseClass.STATUS_DIE_AT_EDGE: | 1324 | case ScriptBaseClass.STATUS_DIE_AT_EDGE: |
1314 | if (m_host.GetDieAtEdge()) | 1325 | if (m_host.GetDieAtEdge()) |
@@ -1317,24 +1328,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1317 | return 0; | 1328 | return 0; |
1318 | 1329 | ||
1319 | case ScriptBaseClass.STATUS_RETURN_AT_EDGE: | 1330 | case ScriptBaseClass.STATUS_RETURN_AT_EDGE: |
1320 | NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); | 1331 | if (m_host.GetReturnAtEdge()) |
1321 | return 0; | 1332 | return 1; |
1333 | else | ||
1334 | return 0; | ||
1322 | 1335 | ||
1323 | case ScriptBaseClass.STATUS_ROTATE_X: | 1336 | case ScriptBaseClass.STATUS_ROTATE_X: |
1324 | NotImplemented("llGetStatus - STATUS_ROTATE_X"); | 1337 | if (m_host.GetAxisRotation(2) == 2) |
1325 | return 0; | 1338 | return 1; |
1339 | else | ||
1340 | return 0; | ||
1326 | 1341 | ||
1327 | case ScriptBaseClass.STATUS_ROTATE_Y: | 1342 | case ScriptBaseClass.STATUS_ROTATE_Y: |
1328 | NotImplemented("llGetStatus - STATUS_ROTATE_Y"); | 1343 | if (m_host.GetAxisRotation(4) == 4) |
1329 | return 0; | 1344 | return 1; |
1345 | else | ||
1346 | return 0; | ||
1330 | 1347 | ||
1331 | case ScriptBaseClass.STATUS_ROTATE_Z: | 1348 | case ScriptBaseClass.STATUS_ROTATE_Z: |
1332 | NotImplemented("llGetStatus - STATUS_ROTATE_Z"); | 1349 | if (m_host.GetAxisRotation(8) == 8) |
1333 | return 0; | 1350 | return 1; |
1351 | else | ||
1352 | return 0; | ||
1334 | 1353 | ||
1335 | case ScriptBaseClass.STATUS_SANDBOX: | 1354 | case ScriptBaseClass.STATUS_SANDBOX: |
1336 | NotImplemented("llGetStatus - STATUS_SANDBOX"); | 1355 | if (m_host.GetStatusSandbox()) |
1337 | return 0; | 1356 | return 1; |
1357 | else | ||
1358 | return 0; | ||
1338 | } | 1359 | } |
1339 | return 0; | 1360 | return 0; |
1340 | } | 1361 | } |
@@ -2346,7 +2367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2346 | m_host.AddScriptLPS(1); | 2367 | m_host.AddScriptLPS(1); |
2347 | 2368 | ||
2348 | // send the sound, once, to all clients in range | 2369 | // send the sound, once, to all clients in range |
2349 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0); | 2370 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); |
2350 | } | 2371 | } |
2351 | 2372 | ||
2352 | // Xantor 20080528 we should do this differently. | 2373 | // Xantor 20080528 we should do this differently. |
@@ -2376,42 +2397,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2376 | public void llLoopSoundMaster(string sound, double volume) | 2397 | public void llLoopSoundMaster(string sound, double volume) |
2377 | { | 2398 | { |
2378 | m_host.AddScriptLPS(1); | 2399 | m_host.AddScriptLPS(1); |
2379 | NotImplemented("llLoopSoundMaster"); | 2400 | m_host.ParentGroup.LoopSoundMasterPrim = m_host; |
2401 | lock (m_host.ParentGroup.LoopSoundSlavePrims) | ||
2402 | { | ||
2403 | foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) | ||
2404 | { | ||
2405 | if (prim.Sound != UUID.Zero) | ||
2406 | llStopSound(); | ||
2407 | |||
2408 | prim.Sound = KeyOrName(sound); | ||
2409 | prim.SoundGain = volume; | ||
2410 | prim.SoundFlags = 1; // looping | ||
2411 | prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
2412 | |||
2413 | prim.ScheduleFullUpdate(); | ||
2414 | prim.SendFullUpdateToAllClients(); | ||
2415 | } | ||
2416 | } | ||
2417 | if (m_host.Sound != UUID.Zero) | ||
2418 | llStopSound(); | ||
2419 | |||
2420 | m_host.Sound = KeyOrName(sound); | ||
2421 | m_host.SoundGain = volume; | ||
2422 | m_host.SoundFlags = 1; // looping | ||
2423 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
2424 | |||
2425 | m_host.ScheduleFullUpdate(); | ||
2426 | m_host.SendFullUpdateToAllClients(); | ||
2380 | } | 2427 | } |
2381 | 2428 | ||
2382 | public void llLoopSoundSlave(string sound, double volume) | 2429 | public void llLoopSoundSlave(string sound, double volume) |
2383 | { | 2430 | { |
2384 | m_host.AddScriptLPS(1); | 2431 | m_host.AddScriptLPS(1); |
2385 | NotImplemented("llLoopSoundSlave"); | 2432 | lock (m_host.ParentGroup.LoopSoundSlavePrims) |
2433 | { | ||
2434 | m_host.ParentGroup.LoopSoundSlavePrims.Add(m_host); | ||
2435 | } | ||
2386 | } | 2436 | } |
2387 | 2437 | ||
2388 | public void llPlaySoundSlave(string sound, double volume) | 2438 | public void llPlaySoundSlave(string sound, double volume) |
2389 | { | 2439 | { |
2390 | m_host.AddScriptLPS(1); | 2440 | m_host.AddScriptLPS(1); |
2391 | NotImplemented("llPlaySoundSlave"); | 2441 | |
2442 | // send the sound, once, to all clients in range | ||
2443 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); | ||
2392 | } | 2444 | } |
2393 | 2445 | ||
2394 | public void llTriggerSound(string sound, double volume) | 2446 | public void llTriggerSound(string sound, double volume) |
2395 | { | 2447 | { |
2396 | m_host.AddScriptLPS(1); | 2448 | m_host.AddScriptLPS(1); |
2397 | // send the sound, once, to all clients in range | 2449 | // send the sound, once, to all clients in range |
2398 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0); | 2450 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); |
2399 | } | 2451 | } |
2400 | 2452 | ||
2401 | // Xantor 20080528: Clear prim data of sound instead | 2453 | // Xantor 20080528: Clear prim data of sound instead |
2402 | public void llStopSound() | 2454 | public void llStopSound() |
2403 | { | 2455 | { |
2404 | m_host.AddScriptLPS(1); | 2456 | m_host.AddScriptLPS(1); |
2405 | 2457 | if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) | |
2406 | m_host.Sound = UUID.Zero; | 2458 | { |
2407 | m_host.SoundGain = 0; | 2459 | if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) |
2408 | m_host.SoundFlags = 0; | 2460 | { |
2409 | m_host.SoundRadius = 0; | 2461 | foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) |
2410 | 2462 | { | |
2411 | m_host.ScheduleFullUpdate(); | 2463 | part.Sound = UUID.Zero; |
2412 | m_host.SendFullUpdateToAllClients(); | 2464 | part.SoundGain = 0; |
2413 | 2465 | part.SoundFlags = 0; | |
2414 | // m_host.SendSound(UUID.Zero.ToString(), 1.0, false, 2); | 2466 | part.SoundRadius = 0; |
2467 | part.ScheduleFullUpdate(); | ||
2468 | part.SendFullUpdateToAllClients(); | ||
2469 | } | ||
2470 | m_host.ParentGroup.LoopSoundMasterPrim = null; | ||
2471 | m_host.ParentGroup.LoopSoundSlavePrims.Clear(); | ||
2472 | } | ||
2473 | else | ||
2474 | { | ||
2475 | m_host.Sound = UUID.Zero; | ||
2476 | m_host.SoundGain = 0; | ||
2477 | m_host.SoundFlags = 0; | ||
2478 | m_host.SoundRadius = 0; | ||
2479 | m_host.ScheduleFullUpdate(); | ||
2480 | m_host.SendFullUpdateToAllClients(); | ||
2481 | } | ||
2482 | } | ||
2483 | else | ||
2484 | { | ||
2485 | m_host.Sound = UUID.Zero; | ||
2486 | m_host.SoundGain = 0; | ||
2487 | m_host.SoundFlags = 0; | ||
2488 | m_host.SoundRadius = 0; | ||
2489 | m_host.ScheduleFullUpdate(); | ||
2490 | m_host.SendFullUpdateToAllClients(); | ||
2491 | } | ||
2415 | } | 2492 | } |
2416 | 2493 | ||
2417 | public void llPreloadSound(string sound) | 2494 | public void llPreloadSound(string sound) |
@@ -2803,8 +2880,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2803 | 2880 | ||
2804 | public void llLookAt(LSL_Vector target, double strength, double damping) | 2881 | public void llLookAt(LSL_Vector target, double strength, double damping) |
2805 | { | 2882 | { |
2806 | // partial implementation, rotates objects correctly but does not apply strength or damping attributes | ||
2807 | |||
2808 | m_host.AddScriptLPS(1); | 2883 | m_host.AddScriptLPS(1); |
2809 | // Determine where we are looking from | 2884 | // Determine where we are looking from |
2810 | LSL_Vector from = llGetPos(); | 2885 | LSL_Vector from = llGetPos(); |
@@ -2824,9 +2899,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2824 | // the angles of rotation in radians into rotation value | 2899 | // the angles of rotation in radians into rotation value |
2825 | 2900 | ||
2826 | LSL_Types.Quaternion rot = llEuler2Rot(angle); | 2901 | LSL_Types.Quaternion rot = llEuler2Rot(angle); |
2827 | 2902 | Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); | |
2903 | m_host.startLookAt(rotation, (float)damping, (float)strength); | ||
2828 | // Orient the object to the angle calculated | 2904 | // Orient the object to the angle calculated |
2829 | llSetRot(rot); | 2905 | //llSetRot(rot); |
2830 | } | 2906 | } |
2831 | 2907 | ||
2832 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | 2908 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) |
@@ -3329,13 +3405,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3329 | public void llPointAt(LSL_Vector pos) | 3405 | public void llPointAt(LSL_Vector pos) |
3330 | { | 3406 | { |
3331 | m_host.AddScriptLPS(1); | 3407 | m_host.AddScriptLPS(1); |
3332 | NotImplemented("llPointAt"); | 3408 | ScenePresence Owner = World.GetScenePresence(m_host.UUID); |
3409 | LSL_Rotation rot = llEuler2Rot(pos); | ||
3410 | Owner.PreviousRotation = Owner.Rotation; | ||
3411 | Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s)); | ||
3333 | } | 3412 | } |
3334 | 3413 | ||
3335 | public void llStopPointAt() | 3414 | public void llStopPointAt() |
3336 | { | 3415 | { |
3337 | m_host.AddScriptLPS(1); | 3416 | m_host.AddScriptLPS(1); |
3338 | NotImplemented("llStopPointAt"); | 3417 | ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); |
3418 | Owner.Rotation = Owner.PreviousRotation; | ||
3339 | } | 3419 | } |
3340 | 3420 | ||
3341 | public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) | 3421 | public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) |
@@ -4138,8 +4218,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4138 | public void llCollisionSound(string impact_sound, double impact_volume) | 4218 | public void llCollisionSound(string impact_sound, double impact_volume) |
4139 | { | 4219 | { |
4140 | m_host.AddScriptLPS(1); | 4220 | m_host.AddScriptLPS(1); |
4141 | //NotImplemented("llCollisionSound"); | ||
4142 | |||
4143 | // TODO: Parameter check logic required. | 4221 | // TODO: Parameter check logic required. |
4144 | UUID soundId = UUID.Zero; | 4222 | UUID soundId = UUID.Zero; |
4145 | if (!UUID.TryParse(impact_sound, out soundId)) | 4223 | if (!UUID.TryParse(impact_sound, out soundId)) |
@@ -4727,8 +4805,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4727 | public LSL_Vector llGetCenterOfMass() | 4805 | public LSL_Vector llGetCenterOfMass() |
4728 | { | 4806 | { |
4729 | m_host.AddScriptLPS(1); | 4807 | m_host.AddScriptLPS(1); |
4730 | NotImplemented("llGetCenterOfMass"); | 4808 | Vector3 center = m_host.GetGeometricCenter(); |
4731 | return new LSL_Vector(); | 4809 | return new LSL_Vector(center.X,center.Y,center.Z); |
4732 | } | 4810 | } |
4733 | 4811 | ||
4734 | public LSL_List llListSort(LSL_List src, int stride, int ascending) | 4812 | public LSL_List llListSort(LSL_List src, int stride, int ascending) |
@@ -5461,8 +5539,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5461 | flags |= ScriptBaseClass.AGENT_SITTING; | 5539 | flags |= ScriptBaseClass.AGENT_SITTING; |
5462 | } | 5540 | } |
5463 | 5541 | ||
5464 | //NotImplemented("llGetAgentInfo"); | ||
5465 | |||
5466 | return flags; | 5542 | return flags; |
5467 | } | 5543 | } |
5468 | 5544 | ||
@@ -5522,12 +5598,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5522 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) | 5598 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) |
5523 | { | 5599 | { |
5524 | m_host.AddScriptLPS(1); | 5600 | m_host.AddScriptLPS(1); |
5601 | |||
5602 | SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate); | ||
5603 | } | ||
5604 | |||
5605 | public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
5606 | { | ||
5607 | m_host.AddScriptLPS(1); | ||
5608 | |||
5609 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
5610 | |||
5611 | foreach (var part in parts) | ||
5612 | { | ||
5613 | SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); | ||
5614 | } | ||
5615 | } | ||
5616 | |||
5617 | private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
5618 | { | ||
5619 | |||
5525 | Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); | 5620 | Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); |
5526 | pTexAnim.Flags = (Primitive.TextureAnimMode)mode; | 5621 | pTexAnim.Flags = (Primitive.TextureAnimMode)mode; |
5527 | 5622 | ||
5528 | //ALL_SIDES | 5623 | //ALL_SIDES |
5529 | if (face == ScriptBaseClass.ALL_SIDES) | 5624 | if (face == ScriptBaseClass.ALL_SIDES) |
5530 | face = 255; | 5625 | face = 255; |
5531 | 5626 | ||
5532 | pTexAnim.Face = (uint)face; | 5627 | pTexAnim.Face = (uint)face; |
5533 | pTexAnim.Length = (float)length; | 5628 | pTexAnim.Length = (float)length; |
@@ -5536,16 +5631,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5536 | pTexAnim.SizeY = (uint)sizey; | 5631 | pTexAnim.SizeY = (uint)sizey; |
5537 | pTexAnim.Start = (float)start; | 5632 | pTexAnim.Start = (float)start; |
5538 | 5633 | ||
5539 | m_host.AddTextureAnimation(pTexAnim); | 5634 | part.AddTextureAnimation(pTexAnim); |
5540 | m_host.SendFullUpdateToAllClients(); | 5635 | part.SendFullUpdateToAllClients(); |
5541 | m_host.ParentGroup.HasGroupChanged = true; | 5636 | part.ParentGroup.HasGroupChanged = true; |
5542 | } | 5637 | } |
5543 | 5638 | ||
5544 | public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, | 5639 | public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, |
5545 | LSL_Vector bottom_south_west) | 5640 | LSL_Vector bottom_south_west) |
5546 | { | 5641 | { |
5547 | m_host.AddScriptLPS(1); | 5642 | m_host.AddScriptLPS(1); |
5548 | NotImplemented("llTriggerSoundLimited"); | 5643 | float radius1 = (float)llVecDist(llGetPos(), top_north_east); |
5644 | float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); | ||
5645 | float radius = Math.Abs(radius1 - radius2); | ||
5646 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); | ||
5549 | } | 5647 | } |
5550 | 5648 | ||
5551 | public void llEjectFromLand(string pest) | 5649 | public void llEjectFromLand(string pest) |
@@ -5932,13 +6030,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5932 | return ps; | 6030 | return ps; |
5933 | } | 6031 | } |
5934 | 6032 | ||
6033 | public void llLinkParticleSystem(int linknumber, LSL_List rules) | ||
6034 | { | ||
6035 | m_host.AddScriptLPS(1); | ||
6036 | |||
6037 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
6038 | |||
6039 | foreach (var part in parts) | ||
6040 | { | ||
6041 | SetParticleSystem(part, rules); | ||
6042 | } | ||
6043 | } | ||
6044 | |||
5935 | public void llParticleSystem(LSL_List rules) | 6045 | public void llParticleSystem(LSL_List rules) |
5936 | { | 6046 | { |
5937 | m_host.AddScriptLPS(1); | 6047 | m_host.AddScriptLPS(1); |
6048 | SetParticleSystem(m_host, rules); | ||
6049 | } | ||
6050 | |||
6051 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { | ||
6052 | |||
6053 | |||
5938 | if (rules.Length == 0) | 6054 | if (rules.Length == 0) |
5939 | { | 6055 | { |
5940 | m_host.RemoveParticleSystem(); | 6056 | part.RemoveParticleSystem(); |
5941 | m_host.ParentGroup.HasGroupChanged = true; | 6057 | part.ParentGroup.HasGroupChanged = true; |
5942 | } | 6058 | } |
5943 | else | 6059 | else |
5944 | { | 6060 | { |
@@ -5949,7 +6065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5949 | 6065 | ||
5950 | for (int i = 0; i < rules.Length; i += 2) | 6066 | for (int i = 0; i < rules.Length; i += 2) |
5951 | { | 6067 | { |
5952 | switch (Convert.ToInt32(rules.Data[i])) | 6068 | switch (rules.GetLSLIntegerItem(i)) |
5953 | { | 6069 | { |
5954 | case (int)ScriptBaseClass.PSYS_PART_FLAGS: | 6070 | case (int)ScriptBaseClass.PSYS_PART_FLAGS: |
5955 | prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1); | 6071 | prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1); |
@@ -6049,7 +6165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6049 | } | 6165 | } |
6050 | else | 6166 | else |
6051 | { | 6167 | { |
6052 | prules.Target = m_host.UUID; | 6168 | prules.Target = part.UUID; |
6053 | } | 6169 | } |
6054 | break; | 6170 | break; |
6055 | 6171 | ||
@@ -6075,16 +6191,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6075 | } | 6191 | } |
6076 | prules.CRC = 1; | 6192 | prules.CRC = 1; |
6077 | 6193 | ||
6078 | m_host.AddNewParticleSystem(prules); | 6194 | part.AddNewParticleSystem(prules); |
6079 | m_host.ParentGroup.HasGroupChanged = true; | 6195 | part.ParentGroup.HasGroupChanged = true; |
6080 | } | 6196 | } |
6081 | m_host.SendFullUpdateToAllClients(); | 6197 | part.SendFullUpdateToAllClients(); |
6082 | } | 6198 | } |
6083 | 6199 | ||
6084 | public void llGroundRepel(double height, int water, double tau) | 6200 | public void llGroundRepel(double height, int water, double tau) |
6085 | { | 6201 | { |
6086 | m_host.AddScriptLPS(1); | 6202 | m_host.AddScriptLPS(1); |
6087 | NotImplemented("llGroundRepel"); | 6203 | if (m_host.PhysActor != null) |
6204 | { | ||
6205 | float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0)); | ||
6206 | float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0)); | ||
6207 | PIDHoverType hoverType = PIDHoverType.Ground; | ||
6208 | if (water != 0) | ||
6209 | { | ||
6210 | hoverType = PIDHoverType.GroundAndWater; | ||
6211 | if (ground < waterLevel) | ||
6212 | height += waterLevel; | ||
6213 | else | ||
6214 | height += ground; | ||
6215 | } | ||
6216 | else | ||
6217 | { | ||
6218 | height += ground; | ||
6219 | } | ||
6220 | |||
6221 | m_host.SetHoverHeight((float)height, hoverType, (float)tau); | ||
6222 | } | ||
6088 | } | 6223 | } |
6089 | 6224 | ||
6090 | protected UUID GetTaskInventoryItem(string name) | 6225 | protected UUID GetTaskInventoryItem(string name) |
@@ -6219,7 +6354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6219 | { | 6354 | { |
6220 | if (!m_host.ParentGroup.IsDeleted) | 6355 | if (!m_host.ParentGroup.IsDeleted) |
6221 | { | 6356 | { |
6222 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags); | 6357 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false); |
6223 | } | 6358 | } |
6224 | } | 6359 | } |
6225 | } | 6360 | } |
@@ -6231,7 +6366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6231 | { | 6366 | { |
6232 | if (!m_host.ParentGroup.IsDeleted) | 6367 | if (!m_host.ParentGroup.IsDeleted) |
6233 | { | 6368 | { |
6234 | m_host.ParentGroup.RootPart.RemoveVehicleFlags(flags); | 6369 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true); |
6235 | } | 6370 | } |
6236 | } | 6371 | } |
6237 | } | 6372 | } |
@@ -6868,6 +7003,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6868 | SetPrimParams(part, rules); | 7003 | SetPrimParams(part, rules); |
6869 | } | 7004 | } |
6870 | 7005 | ||
7006 | public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) | ||
7007 | { | ||
7008 | llSetLinkPrimitiveParams(linknumber, rules); | ||
7009 | } | ||
7010 | |||
6871 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) | 7011 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) |
6872 | { | 7012 | { |
6873 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 7013 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
@@ -7227,6 +7367,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7227 | int style = rules.GetLSLIntegerItem(idx++); | 7367 | int style = rules.GetLSLIntegerItem(idx++); |
7228 | SetTexGen(part, face, style); | 7368 | SetTexGen(part, face, style); |
7229 | break; | 7369 | break; |
7370 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
7371 | if (remain < 3) | ||
7372 | return; | ||
7373 | string primText = rules.GetLSLStringItem(idx++); | ||
7374 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | ||
7375 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | ||
7376 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), | ||
7377 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), | ||
7378 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); | ||
7379 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | ||
7380 | |||
7381 | break; | ||
7230 | } | 7382 | } |
7231 | } | 7383 | } |
7232 | } | 7384 | } |
@@ -7271,7 +7423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7271 | public void llRemoteDataSetRegion() | 7423 | public void llRemoteDataSetRegion() |
7272 | { | 7424 | { |
7273 | m_host.AddScriptLPS(1); | 7425 | m_host.AddScriptLPS(1); |
7274 | NotImplemented("llRemoteDataSetRegion"); | 7426 | Deprecated("llRemoteDataSetRegion"); |
7275 | } | 7427 | } |
7276 | 7428 | ||
7277 | public LSL_Float llLog10(double val) | 7429 | public LSL_Float llLog10(double val) |
@@ -7470,6 +7622,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7470 | return GetLinkPrimitiveParams(m_host, rules); | 7622 | return GetLinkPrimitiveParams(m_host, rules); |
7471 | } | 7623 | } |
7472 | 7624 | ||
7625 | public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) | ||
7626 | { | ||
7627 | m_host.AddScriptLPS(1); | ||
7628 | |||
7629 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
7630 | |||
7631 | LSL_List res = new LSL_List(); | ||
7632 | |||
7633 | foreach (var part in parts) | ||
7634 | { | ||
7635 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | ||
7636 | res += partRes; | ||
7637 | } | ||
7638 | |||
7639 | return res; | ||
7640 | } | ||
7641 | |||
7473 | public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) | 7642 | public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) |
7474 | { | 7643 | { |
7475 | LSL_List res = new LSL_List(); | 7644 | LSL_List res = new LSL_List(); |
@@ -7853,6 +8022,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7853 | res.Add(new LSL_Float(primglow)); | 8022 | res.Add(new LSL_Float(primglow)); |
7854 | } | 8023 | } |
7855 | break; | 8024 | break; |
8025 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
8026 | Color4 textColor = part.GetTextColor(); | ||
8027 | res.Add(part.Text); | ||
8028 | res.Add(new LSL_Vector(textColor.R, | ||
8029 | textColor.G, | ||
8030 | textColor.B)); | ||
8031 | res.Add(new LSL_Float(textColor.A)); | ||
8032 | break; | ||
7856 | } | 8033 | } |
7857 | } | 8034 | } |
7858 | return res; | 8035 | return res; |
@@ -8409,7 +8586,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8409 | public void llSetInventoryPermMask(string item, int mask, int value) | 8586 | public void llSetInventoryPermMask(string item, int mask, int value) |
8410 | { | 8587 | { |
8411 | m_host.AddScriptLPS(1); | 8588 | m_host.AddScriptLPS(1); |
8412 | NotImplemented("llSetInventoryPermMask"); | 8589 | if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false)) |
8590 | { | ||
8591 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | ||
8592 | { | ||
8593 | lock (m_host.TaskInventory) | ||
8594 | { | ||
8595 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
8596 | { | ||
8597 | if (inv.Value.Name == item) | ||
8598 | { | ||
8599 | switch (mask) | ||
8600 | { | ||
8601 | case 0: | ||
8602 | inv.Value.BasePermissions = (uint)value; | ||
8603 | break; | ||
8604 | case 1: | ||
8605 | inv.Value.CurrentPermissions = (uint)value; | ||
8606 | break; | ||
8607 | case 2: | ||
8608 | inv.Value.GroupPermissions = (uint)value; | ||
8609 | break; | ||
8610 | case 3: | ||
8611 | inv.Value.EveryonePermissions = (uint)value; | ||
8612 | break; | ||
8613 | case 4: | ||
8614 | inv.Value.NextPermissions = (uint)value; | ||
8615 | break; | ||
8616 | } | ||
8617 | } | ||
8618 | } | ||
8619 | } | ||
8620 | } | ||
8621 | } | ||
8413 | } | 8622 | } |
8414 | 8623 | ||
8415 | public LSL_String llGetInventoryCreator(string item) | 8624 | public LSL_String llGetInventoryCreator(string item) |
@@ -8843,6 +9052,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8843 | // we send to all | 9052 | // we send to all |
8844 | landData.MediaID = new UUID(texture); | 9053 | landData.MediaID = new UUID(texture); |
8845 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; | 9054 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; |
9055 | landData.MediaSize[0] = width; | ||
9056 | landData.MediaSize[1] = height; | ||
9057 | landData.MediaType = mediaType; | ||
8846 | 9058 | ||
8847 | // do that one last, it will cause a ParcelPropertiesUpdate | 9059 | // do that one last, it will cause a ParcelPropertiesUpdate |
8848 | landObject.SetMediaUrl(url); | 9060 | landObject.SetMediaUrl(url); |
@@ -8902,11 +9114,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8902 | m_host.AddScriptLPS(1); | 9114 | m_host.AddScriptLPS(1); |
8903 | LSL_List list = new LSL_List(); | 9115 | LSL_List list = new LSL_List(); |
8904 | //TO DO: make the implementation for the missing commands | 9116 | //TO DO: make the implementation for the missing commands |
8905 | //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture. | ||
8906 | //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url. | ||
8907 | //PARCEL_MEDIA_COMMAND_TYPE string mime_type Use this to get or set the parcel media MIME type (e.g. "text/html"). (1.19.1 RC0 or later) | ||
8908 | //PARCEL_MEDIA_COMMAND_SIZE integer x, integer y Use this to get or set the parcel media pixel resolution. (1.19.1 RC0 or later) | ||
8909 | //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later) | ||
8910 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) | 9117 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) |
8911 | for (int i = 0; i < aList.Data.Length; i++) | 9118 | for (int i = 0; i < aList.Data.Length; i++) |
8912 | { | 9119 | { |
@@ -8924,6 +9131,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8924 | case ParcelMediaCommandEnum.Texture: | 9131 | case ParcelMediaCommandEnum.Texture: |
8925 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); | 9132 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); |
8926 | break; | 9133 | break; |
9134 | case ParcelMediaCommandEnum.Type: | ||
9135 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); | ||
9136 | break; | ||
9137 | case ParcelMediaCommandEnum.Size: | ||
9138 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); | ||
9139 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); | ||
9140 | break; | ||
8927 | default: | 9141 | default: |
8928 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; | 9142 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; |
8929 | NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); | 9143 | NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); |