diff options
author | Charles Krinke | 2008-08-08 18:27:24 +0000 |
---|---|---|
committer | Charles Krinke | 2008-08-08 18:27:24 +0000 |
commit | 87c5b0b9266540aebe079ffcaafb35a05f421519 (patch) | |
tree | a7339c83472d23140b2bce4b94af4d8657a24265 /OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |
parent | Mantis#1521. Thank you kindly, Lmmz for a patch that: (diff) | |
download | opensim-SC_OLD-87c5b0b9266540aebe079ffcaafb35a05f421519.zip opensim-SC_OLD-87c5b0b9266540aebe079ffcaafb35a05f421519.tar.gz opensim-SC_OLD-87c5b0b9266540aebe079ffcaafb35a05f421519.tar.bz2 opensim-SC_OLD-87c5b0b9266540aebe079ffcaafb35a05f421519.tar.xz |
Mantis#1521. Thank you kindly, HomerHorwitz for a patch that:
Increases the functionality of the particle system on both
script engines.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 254 |
1 files changed, 139 insertions, 115 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index baa781e..d4332b0 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4460,151 +4460,175 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4460 | return returnval; | 4460 | return returnval; |
4461 | } | 4461 | } |
4462 | 4462 | ||
4463 | 4463 | private Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues() | |
4464 | { | ||
4465 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(); | ||
4466 | |||
4467 | // TODO find out about the other defaults and add them here | ||
4468 | ps.PartStartColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
4469 | ps.PartEndColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
4470 | ps.PartStartScaleX = 1.0f; | ||
4471 | ps.PartStartScaleY = 1.0f; | ||
4472 | ps.PartEndScaleX = 1.0f; | ||
4473 | ps.PartEndScaleY = 1.0f; | ||
4474 | ps.BurstSpeedMin = 1.0f; | ||
4475 | ps.BurstSpeedMax = 1.0f; | ||
4476 | ps.BurstRate = 0.1f; | ||
4477 | ps.PartMaxAge = 10.0f; | ||
4478 | return ps; | ||
4479 | } | ||
4480 | |||
4464 | public void llParticleSystem(LSL_Types.list rules) | 4481 | public void llParticleSystem(LSL_Types.list rules) |
4465 | { | 4482 | { |
4466 | m_host.AddScriptLPS(1); | 4483 | m_host.AddScriptLPS(1); |
4467 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | 4484 | if(rules.Length == 0) |
4468 | LSL_Types.Vector3 tempv = new LSL_Types.Vector3(); | 4485 | { |
4486 | m_host.RemoveParticleSystem(); | ||
4487 | } | ||
4488 | else | ||
4489 | { | ||
4490 | Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues(); | ||
4491 | LSL_Types.Vector3 tempv = new LSL_Types.Vector3(); | ||
4469 | 4492 | ||
4470 | float tempf = 0; | 4493 | float tempf = 0; |
4471 | 4494 | ||
4472 | for (int i = 0; i < rules.Length; i += 2) | 4495 | for (int i = 0; i < rules.Length; i += 2) |
4473 | { | ||
4474 | switch ((int)rules.Data[i]) | ||
4475 | { | 4496 | { |
4476 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_FLAGS: | 4497 | switch ((int)rules.Data[i]) |
4477 | prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)((uint)Convert.ToInt32(rules.Data[i + 1].ToString())); | 4498 | { |
4478 | break; | 4499 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_FLAGS: |
4500 | prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)((uint)Convert.ToInt32(rules.Data[i + 1].ToString())); | ||
4501 | break; | ||
4479 | 4502 | ||
4480 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_COLOR: | 4503 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_COLOR: |
4481 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; | 4504 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; |
4482 | prules.PartStartColor.R = (float)tempv.x; | 4505 | prules.PartStartColor.R = (float)tempv.x; |
4483 | prules.PartStartColor.G = (float)tempv.y; | 4506 | prules.PartStartColor.G = (float)tempv.y; |
4484 | prules.PartStartColor.B = (float)tempv.z; | 4507 | prules.PartStartColor.B = (float)tempv.z; |
4485 | break; | 4508 | break; |
4486 | 4509 | ||
4487 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_ALPHA: | 4510 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_ALPHA: |
4488 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4511 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4489 | prules.PartStartColor.A = (float)tempf; | 4512 | prules.PartStartColor.A = (float)tempf; |
4490 | break; | 4513 | break; |
4491 | 4514 | ||
4492 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR: | 4515 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR: |
4493 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; | 4516 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; |
4494 | //prules.PartEndColor = new LLColor(tempv.x,tempv.y,tempv.z,1); | 4517 | //prules.PartEndColor = new LLColor(tempv.x,tempv.y,tempv.z,1); |
4495 | 4518 | ||
4496 | prules.PartEndColor.R = (float)tempv.x; | 4519 | prules.PartEndColor.R = (float)tempv.x; |
4497 | prules.PartEndColor.G = (float)tempv.y; | 4520 | prules.PartEndColor.G = (float)tempv.y; |
4498 | prules.PartEndColor.B = (float)tempv.z; | 4521 | prules.PartEndColor.B = (float)tempv.z; |
4499 | break; | 4522 | break; |
4500 | 4523 | ||
4501 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_ALPHA: | 4524 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_ALPHA: |
4502 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4525 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4503 | prules.PartEndColor.A = (float)tempf; | 4526 | prules.PartEndColor.A = (float)tempf; |
4504 | break; | 4527 | break; |
4505 | 4528 | ||
4506 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_SCALE: | 4529 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_SCALE: |
4507 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; | 4530 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; |
4508 | prules.PartStartScaleX = (float)tempv.x; | 4531 | prules.PartStartScaleX = (float)tempv.x; |
4509 | prules.PartStartScaleY = (float)tempv.y; | 4532 | prules.PartStartScaleY = (float)tempv.y; |
4510 | break; | 4533 | break; |
4511 | 4534 | ||
4512 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_SCALE: | 4535 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_SCALE: |
4513 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; | 4536 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; |
4514 | prules.PartEndScaleX = (float)tempv.x; | 4537 | prules.PartEndScaleX = (float)tempv.x; |
4515 | prules.PartEndScaleY = (float)tempv.y; | 4538 | prules.PartEndScaleY = (float)tempv.y; |
4516 | break; | 4539 | break; |
4517 | 4540 | ||
4518 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_MAX_AGE: | 4541 | case (int)BuiltIn_Commands_BaseClass.PSYS_PART_MAX_AGE: |
4519 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4542 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4520 | prules.PartMaxAge = (float)tempf; | 4543 | prules.PartMaxAge = (float)tempf; |
4521 | break; | 4544 | break; |
4522 | 4545 | ||
4523 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ACCEL: | 4546 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ACCEL: |
4524 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; | 4547 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; |
4525 | prules.PartAcceleration.X = (float)tempv.x; | 4548 | prules.PartAcceleration.X = (float)tempv.x; |
4526 | prules.PartAcceleration.Y = (float)tempv.y; | 4549 | prules.PartAcceleration.Y = (float)tempv.y; |
4527 | prules.PartAcceleration.Z = (float)tempv.z; | 4550 | prules.PartAcceleration.Z = (float)tempv.z; |
4528 | break; | 4551 | break; |
4529 | 4552 | ||
4530 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_PATTERN: | 4553 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_PATTERN: |
4531 | int tmpi = int.Parse(rules.Data[i + 1].ToString()); | 4554 | int tmpi = int.Parse(rules.Data[i + 1].ToString()); |
4532 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; | 4555 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; |
4533 | break; | 4556 | break; |
4534 | 4557 | ||
4535 | // Xantor 20080503 | 4558 | // Xantor 20080503 |
4536 | // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture | 4559 | // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture |
4537 | // "" = default texture. | 4560 | // "" = default texture. |
4538 | // 20080530 Updated to remove code duplication | 4561 | // 20080530 Updated to remove code duplication |
4539 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE: | 4562 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE: |
4540 | prules.Texture = KeyOrName(rules.Data[i + 1].ToString()); | 4563 | prules.Texture = KeyOrName(rules.Data[i + 1].ToString()); |
4541 | break; | 4564 | break; |
4542 | 4565 | ||
4543 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE: | 4566 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE: |
4544 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4567 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4545 | prules.BurstRate = (float)tempf; | 4568 | prules.BurstRate = (float)tempf; |
4546 | break; | 4569 | break; |
4547 | 4570 | ||
4548 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_PART_COUNT: | 4571 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_PART_COUNT: |
4549 | prules.BurstPartCount = (byte)Convert.ToByte(rules.Data[i + 1].ToString()); | 4572 | prules.BurstPartCount = (byte)Convert.ToByte(rules.Data[i + 1].ToString()); |
4550 | break; | 4573 | break; |
4551 | 4574 | ||
4552 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RADIUS: | 4575 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RADIUS: |
4553 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4576 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4554 | prules.BurstRadius = (float)tempf; | 4577 | prules.BurstRadius = (float)tempf; |
4555 | break; | 4578 | break; |
4556 | 4579 | ||
4557 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_SPEED_MIN: | 4580 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_SPEED_MIN: |
4558 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4581 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4559 | prules.BurstSpeedMin = (float)tempf; | 4582 | prules.BurstSpeedMin = (float)tempf; |
4560 | break; | 4583 | break; |
4561 | 4584 | ||
4562 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_SPEED_MAX: | 4585 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_SPEED_MAX: |
4563 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4586 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4564 | prules.BurstSpeedMax = (float)tempf; | 4587 | prules.BurstSpeedMax = (float)tempf; |
4565 | break; | 4588 | break; |
4566 | 4589 | ||
4567 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_MAX_AGE: | 4590 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_MAX_AGE: |
4568 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4591 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4569 | prules.MaxAge = (float)tempf; | 4592 | prules.MaxAge = (float)tempf; |
4570 | break; | 4593 | break; |
4571 | 4594 | ||
4572 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TARGET_KEY: | 4595 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TARGET_KEY: |
4573 | LLUUID key = LLUUID.Zero; | 4596 | LLUUID key = LLUUID.Zero; |
4574 | if (LLUUID.TryParse(rules.Data[i + 1].ToString(), out key)) | 4597 | if (LLUUID.TryParse(rules.Data[i + 1].ToString(), out key)) |
4575 | { | 4598 | { |
4576 | prules.Target = key; | 4599 | prules.Target = key; |
4577 | } | 4600 | } |
4578 | else | 4601 | else |
4579 | { | 4602 | { |
4580 | prules.Target = m_host.UUID; | 4603 | prules.Target = m_host.UUID; |
4581 | } | 4604 | } |
4582 | break; | 4605 | break; |
4583 | 4606 | ||
4584 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_OMEGA: | 4607 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_OMEGA: |
4585 | // AL: This is an assumption, since it is the only thing that would match. | 4608 | // AL: This is an assumption, since it is the only thing that would match. |
4586 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; | 4609 | tempv = (LSL_Types.Vector3)rules.Data[i + 1]; |
4587 | prules.AngularVelocity.X = (float)tempv.x; | 4610 | prules.AngularVelocity.X = (float)tempv.x; |
4588 | prules.AngularVelocity.Y = (float)tempv.y; | 4611 | prules.AngularVelocity.Y = (float)tempv.y; |
4589 | prules.AngularVelocity.Z = (float)tempv.z; | 4612 | prules.AngularVelocity.Z = (float)tempv.z; |
4590 | //cast?? prules.MaxAge = (float)rules[i + 1]; | 4613 | //cast?? prules.MaxAge = (float)rules[i + 1]; |
4591 | break; | 4614 | break; |
4592 | 4615 | ||
4593 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_BEGIN: | 4616 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_BEGIN: |
4594 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | 4617 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); |
4595 | prules.InnerAngle = (float)tempf; | 4618 | prules.InnerAngle = (float)tempf; |
4596 | break; | 4619 | break; |
4620 | |||
4621 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_END: | ||
4622 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | ||
4623 | prules.OuterAngle = (float)tempf; | ||
4624 | break; | ||
4625 | } | ||
4597 | 4626 | ||
4598 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_END: | ||
4599 | tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); | ||
4600 | prules.OuterAngle = (float)tempf; | ||
4601 | break; | ||
4602 | } | 4627 | } |
4628 | prules.CRC = 1; | ||
4603 | 4629 | ||
4630 | m_host.AddNewParticleSystem(prules); | ||
4604 | } | 4631 | } |
4605 | prules.CRC = 1; | ||
4606 | |||
4607 | m_host.AddNewParticleSystem(prules); | ||
4608 | m_host.SendFullUpdateToAllClients(); | 4632 | m_host.SendFullUpdateToAllClients(); |
4609 | } | 4633 | } |
4610 | 4634 | ||