aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-08 02:40:20 +0000
committerMelanie Thielker2008-09-08 02:40:20 +0000
commit490ac0be005a989c86ebde62aad137fd2da7cbd8 (patch)
tree0bd15a47dea6d2dea470d50779603970a0493fd9 /OpenSim/Region/ScriptEngine
parentImplement llEjectFromLand. (diff)
downloadopensim-SC_OLD-490ac0be005a989c86ebde62aad137fd2da7cbd8.zip
opensim-SC_OLD-490ac0be005a989c86ebde62aad137fd2da7cbd8.tar.gz
opensim-SC_OLD-490ac0be005a989c86ebde62aad137fd2da7cbd8.tar.bz2
opensim-SC_OLD-490ac0be005a989c86ebde62aad137fd2da7cbd8.tar.xz
Implement proper persistence of the following prim properties:
Floating text, Rotation, Texture animation, Particle System This will make "Eye Candy" scripts work without modification in XEngine. The use of the CHANGED_REGION_RESTART hack is no longer needed. Implemented in MySQL only, hovertext also in SQLite.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs17
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs8
5 files changed, 32 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index f79c1a3..c07f093 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
53 public interface IScriptInstance 53 public interface IScriptInstance
54 { 54 {
55 bool Running { get; set; } 55 bool Running { get; set; }
56 bool ShuttingDown { get; set; }
56 string State { get; set; } 57 string State { get; set; }
57 IScriptEngine Engine { get; } 58 IScriptEngine Engine { get; }
58 UUID AppDomain { get; set; } 59 UUID AppDomain { get; set; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 20dc46e..38d9728 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2173,7 +2173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2173 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 2173 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2174 "object_rez", new Object[] { 2174 "object_rez", new Object[] {
2175 new LSL_Types.LSLString( 2175 new LSL_Types.LSLString(
2176 new_group.RootPart.ToString()) }, 2176 new_group.RootPart.UUID.ToString()) },
2177 new DetectParams[0])); 2177 new DetectParams[0]));
2178 2178
2179 float groupmass = new_group.GetMass(); 2179 float groupmass = new_group.GetMass();
@@ -2542,6 +2542,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2542 m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); 2542 m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate));
2543 m_host.ScheduleTerseUpdate(); 2543 m_host.ScheduleTerseUpdate();
2544 m_host.SendTerseUpdateToAllClients(); 2544 m_host.SendTerseUpdateToAllClients();
2545 m_host.ParentGroup.HasGroupChanged = true;
2545 } 2546 }
2546 2547
2547 public LSL_Types.LSLInteger llGetStartParameter() 2548 public LSL_Types.LSLInteger llGetStartParameter()
@@ -3009,6 +3010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3009 m_host.AddScriptLPS(1); 3010 m_host.AddScriptLPS(1);
3010 Vector3 av3 = new Vector3((float)color.x, (float)color.y, (float)color.z); 3011 Vector3 av3 = new Vector3((float)color.x, (float)color.y, (float)color.z);
3011 m_host.SetText(text, av3, alpha); 3012 m_host.SetText(text, av3, alpha);
3013 m_host.ParentGroup.HasGroupChanged = true;
3012 } 3014 }
3013 3015
3014 public double llWater(LSL_Types.Vector3 offset) 3016 public double llWater(LSL_Types.Vector3 offset)
@@ -4396,6 +4398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4396 4398
4397 m_host.AddTextureAnimation(pTexAnim); 4399 m_host.AddTextureAnimation(pTexAnim);
4398 m_host.SendFullUpdateToAllClients(); 4400 m_host.SendFullUpdateToAllClients();
4401 m_host.ParentGroup.HasGroupChanged = true;
4399 } 4402 }
4400 4403
4401 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, 4404 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
@@ -4713,6 +4716,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4713 if (rules.Length == 0) 4716 if (rules.Length == 0)
4714 { 4717 {
4715 m_host.RemoveParticleSystem(); 4718 m_host.RemoveParticleSystem();
4719 m_host.ParentGroup.HasGroupChanged = true;
4716 } 4720 }
4717 else 4721 else
4718 { 4722 {
@@ -4857,6 +4861,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4857 prules.CRC = 1; 4861 prules.CRC = 1;
4858 4862
4859 m_host.AddNewParticleSystem(prules); 4863 m_host.AddNewParticleSystem(prules);
4864 m_host.ParentGroup.HasGroupChanged = true;
4860 } 4865 }
4861 m_host.SendFullUpdateToAllClients(); 4866 m_host.SendFullUpdateToAllClients();
4862 } 4867 }
@@ -7260,10 +7265,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7260 return; 7265 return;
7261 } 7266 }
7262 m_host.ParentGroup.RootPart.PayPrice[0]=price; 7267 m_host.ParentGroup.RootPart.PayPrice[0]=price;
7263 m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; 7268
7264 m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; 7269 m_host.ParentGroup.RootPart.PayPrice[1]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[0];
7265 m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; 7270 m_host.ParentGroup.RootPart.PayPrice[2]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[1];
7266 m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; 7271 m_host.ParentGroup.RootPart.PayPrice[3]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[2];
7272 m_host.ParentGroup.RootPart.PayPrice[4]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[3];
7273 m_host.ParentGroup.HasGroupChanged = true;
7267 } 7274 }
7268 7275
7269 public LSL_Types.Vector3 llGetCameraPos() 7276 public LSL_Types.Vector3 llGetCameraPos()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index e3b81b7..6de7ca4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -260,7 +260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
260 public const int CHANGED_REGION_RESTART = 256; 260 public const int CHANGED_REGION_RESTART = 256;
261 public const int TYPE_INVALID = 0; 261 public const int TYPE_INVALID = 0;
262 public const int TYPE_INTEGER = 1; 262 public const int TYPE_INTEGER = 1;
263 public const int TYPE_double = 2; 263 public const int TYPE_FLOAT = 2;
264 public const int TYPE_STRING = 3; 264 public const int TYPE_STRING = 3;
265 public const int TYPE_KEY = 4; 265 public const int TYPE_KEY = 4;
266 public const int TYPE_VECTOR = 5; 266 public const int TYPE_VECTOR = 5;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 08f9545..30002e8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -74,6 +74,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
74 private bool m_InSelfDelete = false; 74 private bool m_InSelfDelete = false;
75 private int m_MaxScriptQueue; 75 private int m_MaxScriptQueue;
76 private bool m_SaveState = true; 76 private bool m_SaveState = true;
77 private bool m_ShuttingDown = false;
77 78
78 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); 79 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
79 80
@@ -88,6 +89,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
88 set { m_RunEvents = value; } 89 set { m_RunEvents = value; }
89 } 90 }
90 91
92 public bool ShuttingDown
93 {
94 get { return m_ShuttingDown; }
95 set { m_ShuttingDown = value; }
96 }
97
91 public string State 98 public string State
92 { 99 {
93 get { return m_State; } 100 get { return m_State; }
@@ -248,7 +255,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
248 255
249 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);
250 257
251 if (m_RunEvents) 258 if (m_RunEvents && (!m_ShuttingDown))
252 { 259 {
253 m_RunEvents = false; 260 m_RunEvents = false;
254 Start(); 261 Start();
@@ -517,7 +524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
517 { 524 {
518 lock (m_EventQueue) 525 lock (m_EventQueue)
519 { 526 {
520 if ((m_EventQueue.Count > 0) && m_RunEvents) 527 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
521 { 528 {
522 m_CurrentResult=m_Engine.QueueEventHandler(this); 529 m_CurrentResult=m_Engine.QueueEventHandler(this);
523 } 530 }
@@ -564,7 +571,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
564 571
565 lock (m_EventQueue) 572 lock (m_EventQueue)
566 { 573 {
567 if ((m_EventQueue.Count > 0) && m_RunEvents) 574 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
568 { 575 {
569 m_CurrentResult = m_Engine.QueueEventHandler(this); 576 m_CurrentResult = m_Engine.QueueEventHandler(this);
570 } 577 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 303e5e4..bb08a60 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -856,7 +856,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
856 856
857 foreach (IScriptInstance i in instances) 857 foreach (IScriptInstance i in instances)
858 { 858 {
859 // Stop the script, even forcibly if needed. Then flag
860 // it as shutting down and restore the previous run state
861 // for serialization, so the scripts don't come back
862 // dead after region restart
863 //
864 bool prevRunning = i.Running;
859 i.Stop(50); 865 i.Stop(50);
866 i.ShuttingDown = true;
867 i.Running = prevRunning;
860 } 868 }
861 869
862 DoBackup(new Object[] {0}); 870 DoBackup(new Object[] {0});