aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
parentImplement llEjectFromLand. (diff)
downloadopensim-SC-490ac0be005a989c86ebde62aad137fd2da7cbd8.zip
opensim-SC-490ac0be005a989c86ebde62aad137fd2da7cbd8.tar.gz
opensim-SC-490ac0be005a989c86ebde62aad137fd2da7cbd8.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs20
-rw-r--r--OpenSim/Data/MySQL/Resources/017_RegionStore.sql9
-rw-r--r--OpenSim/Data/SQLite/Resources/009_RegionStore.sql8
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs9
-rw-r--r--OpenSim/Framework/PacketPool.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs13
-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
13 files changed, 100 insertions, 15 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 9552ba1..b7fc70b 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -31,6 +31,7 @@ using System.Data;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Drawing;
34using OpenMetaverse; 35using OpenMetaverse;
35using log4net; 36using log4net;
36using MySql.Data.MySqlClient; 37using MySql.Data.MySqlClient;
@@ -858,6 +859,10 @@ namespace OpenSim.Data.MySQL
858 createCol(prims, "SceneGroupID", typeof (String)); 859 createCol(prims, "SceneGroupID", typeof (String));
859 // various text fields 860 // various text fields
860 createCol(prims, "Text", typeof (String)); 861 createCol(prims, "Text", typeof (String));
862 createCol(prims, "ColorR", typeof (Int32));
863 createCol(prims, "ColorG", typeof (Int32));
864 createCol(prims, "ColorB", typeof (Int32));
865 createCol(prims, "ColorA", typeof (Int32));
861 createCol(prims, "Description", typeof (String)); 866 createCol(prims, "Description", typeof (String));
862 createCol(prims, "SitName", typeof (String)); 867 createCol(prims, "SitName", typeof (String));
863 createCol(prims, "TouchName", typeof (String)); 868 createCol(prims, "TouchName", typeof (String));
@@ -912,6 +917,7 @@ namespace OpenSim.Data.MySQL
912 createCol(prims, "LoopedSound", typeof(String)); 917 createCol(prims, "LoopedSound", typeof(String));
913 createCol(prims, "LoopedSoundGain", typeof(Double)); 918 createCol(prims, "LoopedSoundGain", typeof(Double));
914 createCol(prims, "TextureAnimation", typeof(Byte[])); 919 createCol(prims, "TextureAnimation", typeof(Byte[]));
920 createCol(prims, "ParticleSystem", typeof(Byte[]));
915 921
916 createCol(prims, "OmegaX", typeof (Double)); 922 createCol(prims, "OmegaX", typeof (Double));
917 createCol(prims, "OmegaY", typeof (Double)); 923 createCol(prims, "OmegaY", typeof (Double));
@@ -1109,6 +1115,10 @@ namespace OpenSim.Data.MySQL
1109 prim.Name = (String) row["Name"]; 1115 prim.Name = (String) row["Name"];
1110 // various text fields 1116 // various text fields
1111 prim.Text = (String) row["Text"]; 1117 prim.Text = (String) row["Text"];
1118 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
1119 Convert.ToInt32(row["ColorR"]),
1120 Convert.ToInt32(row["ColorG"]),
1121 Convert.ToInt32(row["ColorB"]));
1112 prim.Description = (String) row["Description"]; 1122 prim.Description = (String) row["Description"];
1113 prim.SitName = (String) row["SitName"]; 1123 prim.SitName = (String) row["SitName"];
1114 prim.TouchName = (String) row["TouchName"]; 1124 prim.TouchName = (String) row["TouchName"];
@@ -1180,6 +1190,8 @@ namespace OpenSim.Data.MySQL
1180 1190
1181 if (!row.IsNull("TextureAnimation")) 1191 if (!row.IsNull("TextureAnimation"))
1182 prim.TextureAnimation = (Byte[])row["TextureAnimation"]; 1192 prim.TextureAnimation = (Byte[])row["TextureAnimation"];
1193 if (!row.IsNull("ParticleSystem"))
1194 prim.ParticleSystem = (Byte[])row["ParticleSystem"];
1183 1195
1184 prim.RotationalVelocity = new Vector3( 1196 prim.RotationalVelocity = new Vector3(
1185 Convert.ToSingle(row["OmegaX"]), 1197 Convert.ToSingle(row["OmegaX"]),
@@ -1187,9 +1199,6 @@ namespace OpenSim.Data.MySQL
1187 Convert.ToSingle(row["OmegaZ"]) 1199 Convert.ToSingle(row["OmegaZ"])
1188 ); 1200 );
1189 1201
1190 // TODO: Rotation
1191 // OmegaX, OmegaY, OmegaZ
1192
1193 prim.SetCameraEyeOffset(new Vector3( 1202 prim.SetCameraEyeOffset(new Vector3(
1194 Convert.ToSingle(row["CameraEyeOffsetX"]), 1203 Convert.ToSingle(row["CameraEyeOffsetX"]),
1195 Convert.ToSingle(row["CameraEyeOffsetY"]), 1204 Convert.ToSingle(row["CameraEyeOffsetY"]),
@@ -1419,6 +1428,10 @@ namespace OpenSim.Data.MySQL
1419 // the UUID of the root part for this SceneObjectGroup 1428 // the UUID of the root part for this SceneObjectGroup
1420 // various text fields 1429 // various text fields
1421 row["Text"] = prim.Text; 1430 row["Text"] = prim.Text;
1431 row["ColorR"] = prim.Color.R;
1432 row["ColorG"] = prim.Color.G;
1433 row["ColorB"] = prim.Color.B;
1434 row["ColorA"] = prim.Color.A;
1422 row["Description"] = prim.Description; 1435 row["Description"] = prim.Description;
1423 row["SitName"] = prim.SitName; 1436 row["SitName"] = prim.SitName;
1424 row["TouchName"] = prim.TouchName; 1437 row["TouchName"] = prim.TouchName;
@@ -1485,6 +1498,7 @@ namespace OpenSim.Data.MySQL
1485 } 1498 }
1486 1499
1487 row["TextureAnimation"] = prim.TextureAnimation; 1500 row["TextureAnimation"] = prim.TextureAnimation;
1501 row["ParticleSystem"] = prim.ParticleSystem;
1488 1502
1489 row["OmegaX"] = prim.RotationalVelocity.X; 1503 row["OmegaX"] = prim.RotationalVelocity.X;
1490 row["OmegaY"] = prim.RotationalVelocity.Y; 1504 row["OmegaY"] = prim.RotationalVelocity.Y;
diff --git a/OpenSim/Data/MySQL/Resources/017_RegionStore.sql b/OpenSim/Data/MySQL/Resources/017_RegionStore.sql
new file mode 100644
index 0000000..0304f30
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/017_RegionStore.sql
@@ -0,0 +1,9 @@
1BEGIN;
2
3ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
4ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
5ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
6ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
7ALTER TABLE prims ADD COLUMN ParticleSystem blob;
8
9COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/009_RegionStore.sql b/OpenSim/Data/SQLite/Resources/009_RegionStore.sql
new file mode 100644
index 0000000..1f40548
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/009_RegionStore.sql
@@ -0,0 +1,8 @@
1BEGIN;
2
3ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
4ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
5ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
6ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
7
8COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index bb441f6..cfb2023 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -31,6 +31,7 @@ using System.Data;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Drawing;
34using OpenMetaverse; 35using OpenMetaverse;
35using log4net; 36using log4net;
36using Mono.Data.SqliteClient; 37using Mono.Data.SqliteClient;
@@ -666,6 +667,10 @@ namespace OpenSim.Data.SQLite
666 createCol(prims, "SceneGroupID", typeof (String)); 667 createCol(prims, "SceneGroupID", typeof (String));
667 // various text fields 668 // various text fields
668 createCol(prims, "Text", typeof (String)); 669 createCol(prims, "Text", typeof (String));
670 createCol(prims, "ColorR", typeof (Int32));
671 createCol(prims, "ColorG", typeof (Int32));
672 createCol(prims, "ColorB", typeof (Int32));
673 createCol(prims, "ColorA", typeof (Int32));
669 createCol(prims, "Description", typeof (String)); 674 createCol(prims, "Description", typeof (String));
670 createCol(prims, "SitName", typeof (String)); 675 createCol(prims, "SitName", typeof (String));
671 createCol(prims, "TouchName", typeof (String)); 676 createCol(prims, "TouchName", typeof (String));
@@ -890,6 +895,10 @@ namespace OpenSim.Data.SQLite
890 prim.Name = (String) row["Name"]; 895 prim.Name = (String) row["Name"];
891 // various text fields 896 // various text fields
892 prim.Text = (String) row["Text"]; 897 prim.Text = (String) row["Text"];
898 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
899 Convert.ToInt32(row["ColorR"]),
900 Convert.ToInt32(row["ColorG"]),
901 Convert.ToInt32(row["ColorB"]));
893 prim.Description = (String) row["Description"]; 902 prim.Description = (String) row["Description"];
894 prim.SitName = (String) row["SitName"]; 903 prim.SitName = (String) row["SitName"];
895 prim.TouchName = (String) row["TouchName"]; 904 prim.TouchName = (String) row["TouchName"];
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs
index 07a2f3a..e6c519e 100644
--- a/OpenSim/Framework/PacketPool.cs
+++ b/OpenSim/Framework/PacketPool.cs
@@ -111,6 +111,10 @@ namespace OpenSim.Framework
111 { 111 {
112 PacketType type = GetType(bytes); 112 PacketType type = GetType(bytes);
113 113
114 int z;
115 for (z = 0 ; z < zeroBuffer.Length ; z++)
116 zeroBuffer[z] = (byte)0;
117
114 int i = 0; 118 int i = 0;
115 Packet packet = GetPacket(type); 119 Packet packet = GetPacket(type);
116 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); 120 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 5625854..206216e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -213,6 +213,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
213 213
214 if (ok) 214 if (ok)
215 { 215 {
216 // Make sure we are getting zeroes when running off the
217 // end of grab / degrab packets from old clients
218 //
219 int z;
220 for (z = numBytes ; z < RecvBuffer.Length ; z++)
221 RecvBuffer[z] = (byte)0;
222
216 epProxy = epSender; 223 epProxy = epSender;
217 if (proxyPortOffset != 0) 224 if (proxyPortOffset != 0)
218 { 225 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 80db10d..3c34f73 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1131,6 +1131,10 @@ namespace OpenSim.Region.Environment.Scenes
1131 Name, UUID, m_scene.RegionInfo.RegionName); 1131 Name, UUID, m_scene.RegionInfo.RegionName);
1132 1132
1133 SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false); 1133 SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false);
1134 backup_group.RootPart.Velocity = RootPart.Velocity;
1135 backup_group.RootPart.Acceleration = RootPart.Acceleration;
1136 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
1137 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1134 1138
1135 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1139 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
1136 HasGroupChanged = false; 1140 HasGroupChanged = false;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index f8e8c9f..292a5c6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -433,6 +433,13 @@ namespace OpenSim.Region.Environment.Scenes
433 set { m_TextureAnimation = value; } 433 set { m_TextureAnimation = value; }
434 } 434 }
435 435
436 [XmlIgnore]
437 public Byte[] ParticleSystem
438 {
439 get { return m_particleSystem; }
440 set { m_particleSystem = value; }
441 }
442
436 public Vector3 GroupPosition 443 public Vector3 GroupPosition
437 { 444 {
438 get 445 get
@@ -1212,9 +1219,9 @@ namespace OpenSim.Region.Environment.Scenes
1212 dupe.GroupPosition = GroupPosition; 1219 dupe.GroupPosition = GroupPosition;
1213 dupe.OffsetPosition = OffsetPosition; 1220 dupe.OffsetPosition = OffsetPosition;
1214 dupe.RotationOffset = RotationOffset; 1221 dupe.RotationOffset = RotationOffset;
1215 dupe.Velocity = Vector3.Zero; 1222 dupe.Velocity = new Vector3(0, 0, 0);
1216 dupe.Acceleration = Vector3.Zero; 1223 dupe.Acceleration = new Vector3(0, 0, 0);
1217 dupe.AngularVelocity = Vector3.Zero; 1224 dupe.AngularVelocity = new Vector3(0, 0, 0);
1218 dupe.ObjectFlags = ObjectFlags; 1225 dupe.ObjectFlags = ObjectFlags;
1219 1226
1220 dupe._ownershipCost = _ownershipCost; 1227 dupe._ownershipCost = _ownershipCost;
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});