aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-08 22:19:06 +0000
committerMelanie Thielker2008-09-08 22:19:06 +0000
commit1034c1cdc1a75b6e37a266e15048b9f9ab965b04 (patch)
treefae96225599ab434aef75322704eca257b8a58f4 /OpenSim/Region/ScriptEngine
parentfix an issue where we got coliding namespaces that prevented a sim start (diff)
downloadopensim-SC_OLD-1034c1cdc1a75b6e37a266e15048b9f9ab965b04.zip
opensim-SC_OLD-1034c1cdc1a75b6e37a266e15048b9f9ab965b04.tar.gz
opensim-SC_OLD-1034c1cdc1a75b6e37a266e15048b9f9ab965b04.tar.bz2
opensim-SC_OLD-1034c1cdc1a75b6e37a266e15048b9f9ab965b04.tar.xz
Correct state handling and state event masks. Prims will now show
touch, pay, etc script states correctly.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs53
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs14
2 files changed, 37 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4b92739..1f52dc3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4730,98 +4730,92 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4730 switch ((int)rules.Data[i]) 4730 switch ((int)rules.Data[i])
4731 { 4731 {
4732 case (int)ScriptBaseClass.PSYS_PART_FLAGS: 4732 case (int)ScriptBaseClass.PSYS_PART_FLAGS:
4733 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)((uint)Convert.ToInt32(rules.Data[i + 1].ToString())); 4733 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
4734 break; 4734 break;
4735 4735
4736 case (int)ScriptBaseClass.PSYS_PART_START_COLOR: 4736 case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
4737 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4737 tempv = rules.GetVector3Item(i + 1);
4738 prules.PartStartColor.R = (float)tempv.x; 4738 prules.PartStartColor.R = (float)tempv.x;
4739 prules.PartStartColor.G = (float)tempv.y; 4739 prules.PartStartColor.G = (float)tempv.y;
4740 prules.PartStartColor.B = (float)tempv.z; 4740 prules.PartStartColor.B = (float)tempv.z;
4741 break; 4741 break;
4742 4742
4743 case (int)ScriptBaseClass.PSYS_PART_START_ALPHA: 4743 case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
4744 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4744 tempf = (float)rules.GetLSLFloatItem(i + 1);
4745 prules.PartStartColor.A = (float)tempf; 4745 prules.PartStartColor.A = tempf;
4746 break; 4746 break;
4747 4747
4748 case (int)ScriptBaseClass.PSYS_PART_END_COLOR: 4748 case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
4749 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4749 tempv = rules.GetVector3Item(i + 1);
4750 //prules.PartEndColor = new Color4(tempv.x,tempv.y,tempv.z,1);
4751
4752 prules.PartEndColor.R = (float)tempv.x; 4750 prules.PartEndColor.R = (float)tempv.x;
4753 prules.PartEndColor.G = (float)tempv.y; 4751 prules.PartEndColor.G = (float)tempv.y;
4754 prules.PartEndColor.B = (float)tempv.z; 4752 prules.PartEndColor.B = (float)tempv.z;
4755 break; 4753 break;
4756 4754
4757 case (int)ScriptBaseClass.PSYS_PART_END_ALPHA: 4755 case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
4758 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4756 tempf = (float)rules.GetLSLFloatItem(i + 1);
4759 prules.PartEndColor.A = (float)tempf; 4757 prules.PartEndColor.A = tempf;
4760 break; 4758 break;
4761 4759
4762 case (int)ScriptBaseClass.PSYS_PART_START_SCALE: 4760 case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
4763 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4761 tempv = rules.GetVector3Item(i + 1);
4764 prules.PartStartScaleX = (float)tempv.x; 4762 prules.PartStartScaleX = (float)tempv.x;
4765 prules.PartStartScaleY = (float)tempv.y; 4763 prules.PartStartScaleY = (float)tempv.y;
4766 break; 4764 break;
4767 4765
4768 case (int)ScriptBaseClass.PSYS_PART_END_SCALE: 4766 case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
4769 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4767 tempv = rules.GetVector3Item(i + 1);
4770 prules.PartEndScaleX = (float)tempv.x; 4768 prules.PartEndScaleX = (float)tempv.x;
4771 prules.PartEndScaleY = (float)tempv.y; 4769 prules.PartEndScaleY = (float)tempv.y;
4772 break; 4770 break;
4773 4771
4774 case (int)ScriptBaseClass.PSYS_PART_MAX_AGE: 4772 case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
4775 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4773 tempf = (float)rules.GetLSLFloatItem(i + 1);
4776 prules.PartMaxAge = (float)tempf; 4774 prules.PartMaxAge = tempf;
4777 break; 4775 break;
4778 4776
4779 case (int)ScriptBaseClass.PSYS_SRC_ACCEL: 4777 case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
4780 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4778 tempv = rules.GetVector3Item(i + 1);
4781 prules.PartAcceleration.X = (float)tempv.x; 4779 prules.PartAcceleration.X = (float)tempv.x;
4782 prules.PartAcceleration.Y = (float)tempv.y; 4780 prules.PartAcceleration.Y = (float)tempv.y;
4783 prules.PartAcceleration.Z = (float)tempv.z; 4781 prules.PartAcceleration.Z = (float)tempv.z;
4784 break; 4782 break;
4785 4783
4786 case (int)ScriptBaseClass.PSYS_SRC_PATTERN: 4784 case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
4787 int tmpi = int.Parse(rules.Data[i + 1].ToString()); 4785 int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
4788 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; 4786 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
4789 break; 4787 break;
4790 4788
4791 // Xantor 20080503
4792 // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture
4793 // "" = default texture.
4794 // 20080530 Updated to remove code duplication
4795 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 4789 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
4796 prules.Texture = KeyOrName(rules.Data[i + 1].ToString()); 4790 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
4797 break; 4791 break;
4798 4792
4799 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: 4793 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
4800 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4794 tempf = (float)rules.GetLSLFloatItem(i + 1);
4801 prules.BurstRate = (float)tempf; 4795 prules.BurstRate = (float)tempf;
4802 break; 4796 break;
4803 4797
4804 case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT: 4798 case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
4805 prules.BurstPartCount = (byte)Convert.ToByte(rules.Data[i + 1].ToString()); 4799 prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1);
4806 break; 4800 break;
4807 4801
4808 case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS: 4802 case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
4809 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4803 tempf = (float)rules.GetLSLFloatItem(i + 1);
4810 prules.BurstRadius = (float)tempf; 4804 prules.BurstRadius = (float)tempf;
4811 break; 4805 break;
4812 4806
4813 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN: 4807 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
4814 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4808 tempf = (float)rules.GetLSLFloatItem(i + 1);
4815 prules.BurstSpeedMin = (float)tempf; 4809 prules.BurstSpeedMin = (float)tempf;
4816 break; 4810 break;
4817 4811
4818 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX: 4812 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
4819 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4813 tempf = (float)rules.GetLSLFloatItem(i + 1);
4820 prules.BurstSpeedMax = (float)tempf; 4814 prules.BurstSpeedMax = (float)tempf;
4821 break; 4815 break;
4822 4816
4823 case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE: 4817 case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE:
4824 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4818 tempf = (float)rules.GetLSLFloatItem(i + 1);
4825 prules.MaxAge = (float)tempf; 4819 prules.MaxAge = (float)tempf;
4826 break; 4820 break;
4827 4821
@@ -4839,20 +4833,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4839 4833
4840 case (int)ScriptBaseClass.PSYS_SRC_OMEGA: 4834 case (int)ScriptBaseClass.PSYS_SRC_OMEGA:
4841 // AL: This is an assumption, since it is the only thing that would match. 4835 // AL: This is an assumption, since it is the only thing that would match.
4842 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4836 tempv = rules.GetVector3Item(i + 1);
4843 prules.AngularVelocity.X = (float)tempv.x; 4837 prules.AngularVelocity.X = (float)tempv.x;
4844 prules.AngularVelocity.Y = (float)tempv.y; 4838 prules.AngularVelocity.Y = (float)tempv.y;
4845 prules.AngularVelocity.Z = (float)tempv.z; 4839 prules.AngularVelocity.Z = (float)tempv.z;
4846 //cast?? prules.MaxAge = (float)rules[i + 1];
4847 break; 4840 break;
4848 4841
4849 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: 4842 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
4850 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4843 tempf = (float)rules.GetLSLFloatItem(i + 1);
4851 prules.InnerAngle = (float)tempf; 4844 prules.InnerAngle = (float)tempf;
4852 break; 4845 break;
4853 4846
4854 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: 4847 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
4855 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4848 tempf = (float)rules.GetLSLFloatItem(i + 1);
4856 prules.OuterAngle = (float)tempf; 4849 prules.OuterAngle = (float)tempf;
4857 break; 4850 break;
4858 } 4851 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 30002e8..24813b0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -255,6 +255,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
255 255
256 m_Engine.Log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName); 256 m_Engine.Log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
257 257
258 part.SetScriptEvents(m_ItemID,
259 (int)m_Script.GetStateEventFlags(State));
260
258 if (m_RunEvents && (!m_ShuttingDown)) 261 if (m_RunEvents && (!m_ShuttingDown))
259 { 262 {
260 m_RunEvents = false; 263 m_RunEvents = false;
@@ -612,6 +615,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
612 m_EventQueue.Clear(); 615 m_EventQueue.Clear();
613 m_Script.ResetVars(); 616 m_Script.ResetVars();
614 m_State = "default"; 617 m_State = "default";
618
619 part.SetScriptEvents(m_ItemID,
620 (int)m_Script.GetStateEventFlags(State));
615 if (running) 621 if (running)
616 Start(); 622 Start();
617 m_SaveState = true; 623 m_SaveState = true;
@@ -631,6 +637,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
631 part.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero; 637 part.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
632 AsyncCommandManager async = (AsyncCommandManager)m_Engine.AsyncCommands; 638 AsyncCommandManager async = (AsyncCommandManager)m_Engine.AsyncCommands;
633 async.RemoveScript(m_LocalID, m_ItemID); 639 async.RemoveScript(m_LocalID, m_ItemID);
640
641 m_EventQueue.Clear();
642 m_Script.ResetVars();
643 m_State = "default";
644
645 part.SetScriptEvents(m_ItemID,
646 (int)m_Script.GetStateEventFlags(State));
647
634 if (m_CurrentEvent != "state_entry") 648 if (m_CurrentEvent != "state_entry")
635 { 649 {
636 m_SaveState = true; 650 m_SaveState = true;