diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 9552ba16a1..b7fc70b3ab 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -31,6 +31,7 @@ using System.Data; using System.IO; using System.Reflection; using System.Threading; +using System.Drawing; using OpenMetaverse; using log4net; using MySql.Data.MySqlClient; @@ -858,6 +859,10 @@ namespace OpenSim.Data.MySQL createCol(prims, "SceneGroupID", typeof (String)); // various text fields createCol(prims, "Text", typeof (String)); + createCol(prims, "ColorR", typeof (Int32)); + createCol(prims, "ColorG", typeof (Int32)); + createCol(prims, "ColorB", typeof (Int32)); + createCol(prims, "ColorA", typeof (Int32)); createCol(prims, "Description", typeof (String)); createCol(prims, "SitName", typeof (String)); createCol(prims, "TouchName", typeof (String)); @@ -912,6 +917,7 @@ namespace OpenSim.Data.MySQL createCol(prims, "LoopedSound", typeof(String)); createCol(prims, "LoopedSoundGain", typeof(Double)); createCol(prims, "TextureAnimation", typeof(Byte[])); + createCol(prims, "ParticleSystem", typeof(Byte[])); createCol(prims, "OmegaX", typeof (Double)); createCol(prims, "OmegaY", typeof (Double)); @@ -1109,6 +1115,10 @@ namespace OpenSim.Data.MySQL prim.Name = (String) row["Name"]; // various text fields prim.Text = (String) row["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), + Convert.ToInt32(row["ColorR"]), + Convert.ToInt32(row["ColorG"]), + Convert.ToInt32(row["ColorB"])); prim.Description = (String) row["Description"]; prim.SitName = (String) row["SitName"]; prim.TouchName = (String) row["TouchName"]; @@ -1180,6 +1190,8 @@ namespace OpenSim.Data.MySQL if (!row.IsNull("TextureAnimation")) prim.TextureAnimation = (Byte[])row["TextureAnimation"]; + if (!row.IsNull("ParticleSystem")) + prim.ParticleSystem = (Byte[])row["ParticleSystem"]; prim.RotationalVelocity = new Vector3( Convert.ToSingle(row["OmegaX"]), @@ -1187,9 +1199,6 @@ namespace OpenSim.Data.MySQL Convert.ToSingle(row["OmegaZ"]) ); - // TODO: Rotation - // OmegaX, OmegaY, OmegaZ - prim.SetCameraEyeOffset(new Vector3( Convert.ToSingle(row["CameraEyeOffsetX"]), Convert.ToSingle(row["CameraEyeOffsetY"]), @@ -1419,6 +1428,10 @@ namespace OpenSim.Data.MySQL // the UUID of the root part for this SceneObjectGroup // various text fields row["Text"] = prim.Text; + row["ColorR"] = prim.Color.R; + row["ColorG"] = prim.Color.G; + row["ColorB"] = prim.Color.B; + row["ColorA"] = prim.Color.A; row["Description"] = prim.Description; row["SitName"] = prim.SitName; row["TouchName"] = prim.TouchName; @@ -1485,6 +1498,7 @@ namespace OpenSim.Data.MySQL } row["TextureAnimation"] = prim.TextureAnimation; + row["ParticleSystem"] = prim.ParticleSystem; row["OmegaX"] = prim.RotationalVelocity.X; 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 0000000000..0304f30b72 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/017_RegionStore.sql @@ -0,0 +1,9 @@ +BEGIN; + +ALTER TABLE prims ADD COLUMN ColorR integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorG integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorB integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorA integer not null default 0; +ALTER TABLE prims ADD COLUMN ParticleSystem blob; + +COMMIT; diff --git a/OpenSim/Data/SQLite/Resources/009_RegionStore.sql b/OpenSim/Data/SQLite/Resources/009_RegionStore.sql new file mode 100644 index 0000000000..1f40548f36 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/009_RegionStore.sql @@ -0,0 +1,8 @@ +BEGIN; + +ALTER TABLE prims ADD COLUMN ColorR integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorG integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorB integer not null default 0; +ALTER TABLE prims ADD COLUMN ColorA integer not null default 0; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index bb441f656f..cfb20234f0 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -31,6 +31,7 @@ using System.Data; using System.IO; using System.Reflection; using System.Threading; +using System.Drawing; using OpenMetaverse; using log4net; using Mono.Data.SqliteClient; @@ -666,6 +667,10 @@ namespace OpenSim.Data.SQLite createCol(prims, "SceneGroupID", typeof (String)); // various text fields createCol(prims, "Text", typeof (String)); + createCol(prims, "ColorR", typeof (Int32)); + createCol(prims, "ColorG", typeof (Int32)); + createCol(prims, "ColorB", typeof (Int32)); + createCol(prims, "ColorA", typeof (Int32)); createCol(prims, "Description", typeof (String)); createCol(prims, "SitName", typeof (String)); createCol(prims, "TouchName", typeof (String)); @@ -890,6 +895,10 @@ namespace OpenSim.Data.SQLite prim.Name = (String) row["Name"]; // various text fields prim.Text = (String) row["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), + Convert.ToInt32(row["ColorR"]), + Convert.ToInt32(row["ColorG"]), + Convert.ToInt32(row["ColorB"])); prim.Description = (String) row["Description"]; prim.SitName = (String) row["SitName"]; prim.TouchName = (String) row["TouchName"]; diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs index 07a2f3afab..e6c519e880 100644 --- a/OpenSim/Framework/PacketPool.cs +++ b/OpenSim/Framework/PacketPool.cs @@ -111,6 +111,10 @@ namespace OpenSim.Framework { PacketType type = GetType(bytes); + int z; + for (z = 0 ; z < zeroBuffer.Length ; z++) + zeroBuffer[z] = (byte)0; + int i = 0; Packet packet = GetPacket(type); 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 56258549d3..206216e572 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -213,6 +213,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (ok) { + // Make sure we are getting zeroes when running off the + // end of grab / degrab packets from old clients + // + int z; + for (z = numBytes ; z < RecvBuffer.Length ; z++) + RecvBuffer[z] = (byte)0; + epProxy = epSender; if (proxyPortOffset != 0) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 80db10d8e8..3c34f73e5b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1131,6 +1131,10 @@ namespace OpenSim.Region.Environment.Scenes Name, UUID, m_scene.RegionInfo.RegionName); SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false); + backup_group.RootPart.Velocity = RootPart.Velocity; + backup_group.RootPart.Acceleration = RootPart.Acceleration; + backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; + backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); HasGroupChanged = false; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index f8e8c9f082..292a5c6c7d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -433,6 +433,13 @@ namespace OpenSim.Region.Environment.Scenes set { m_TextureAnimation = value; } } + [XmlIgnore] + public Byte[] ParticleSystem + { + get { return m_particleSystem; } + set { m_particleSystem = value; } + } + public Vector3 GroupPosition { get @@ -1212,9 +1219,9 @@ namespace OpenSim.Region.Environment.Scenes dupe.GroupPosition = GroupPosition; dupe.OffsetPosition = OffsetPosition; dupe.RotationOffset = RotationOffset; - dupe.Velocity = Vector3.Zero; - dupe.Acceleration = Vector3.Zero; - dupe.AngularVelocity = Vector3.Zero; + dupe.Velocity = new Vector3(0, 0, 0); + dupe.Acceleration = new Vector3(0, 0, 0); + dupe.AngularVelocity = new Vector3(0, 0, 0); dupe.ObjectFlags = ObjectFlags; dupe._ownershipCost = _ownershipCost; diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index f79c1a3693..c07f09380f 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -53,6 +53,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces public interface IScriptInstance { bool Running { get; set; } + bool ShuttingDown { get; set; } string State { get; set; } IScriptEngine Engine { get; } 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 20dc46ec53..38d9728c8b 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 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( "object_rez", new Object[] { new LSL_Types.LSLString( - new_group.RootPart.ToString()) }, + new_group.RootPart.UUID.ToString()) }, new DetectParams[0])); float groupmass = new_group.GetMass(); @@ -2542,6 +2542,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); m_host.ScheduleTerseUpdate(); m_host.SendTerseUpdateToAllClients(); + m_host.ParentGroup.HasGroupChanged = true; } public LSL_Types.LSLInteger llGetStartParameter() @@ -3009,6 +3010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); Vector3 av3 = new Vector3((float)color.x, (float)color.y, (float)color.z); m_host.SetText(text, av3, alpha); + m_host.ParentGroup.HasGroupChanged = true; } public double llWater(LSL_Types.Vector3 offset) @@ -4396,6 +4398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddTextureAnimation(pTexAnim); m_host.SendFullUpdateToAllClients(); + m_host.ParentGroup.HasGroupChanged = true; } public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, @@ -4713,6 +4716,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (rules.Length == 0) { m_host.RemoveParticleSystem(); + m_host.ParentGroup.HasGroupChanged = true; } else { @@ -4857,6 +4861,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api prules.CRC = 1; m_host.AddNewParticleSystem(prules); + m_host.ParentGroup.HasGroupChanged = true; } m_host.SendFullUpdateToAllClients(); } @@ -7260,10 +7265,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } m_host.ParentGroup.RootPart.PayPrice[0]=price; - m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; - m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; - m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; - m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; + + m_host.ParentGroup.RootPart.PayPrice[1]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[0]; + m_host.ParentGroup.RootPart.PayPrice[2]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[1]; + m_host.ParentGroup.RootPart.PayPrice[3]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[2]; + m_host.ParentGroup.RootPart.PayPrice[4]=(LSL_Types.LSLInteger)quick_pay_buttons.Data[3]; + m_host.ParentGroup.HasGroupChanged = true; } 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 e3b81b7633..6de7ca478d 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 public const int CHANGED_REGION_RESTART = 256; public const int TYPE_INVALID = 0; public const int TYPE_INTEGER = 1; - public const int TYPE_double = 2; + public const int TYPE_FLOAT = 2; public const int TYPE_STRING = 3; public const int TYPE_KEY = 4; 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 08f9545c3c..30002e80d5 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 private bool m_InSelfDelete = false; private int m_MaxScriptQueue; private bool m_SaveState = true; + private bool m_ShuttingDown = false; private Dictionary m_Apis = new Dictionary(); @@ -88,6 +89,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance set { m_RunEvents = value; } } + public bool ShuttingDown + { + get { return m_ShuttingDown; } + set { m_ShuttingDown = value; } + } + public string State { get { return m_State; } @@ -248,7 +255,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_Engine.Log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName); - if (m_RunEvents) + if (m_RunEvents && (!m_ShuttingDown)) { m_RunEvents = false; Start(); @@ -517,7 +524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { lock (m_EventQueue) { - if ((m_EventQueue.Count > 0) && m_RunEvents) + if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) { m_CurrentResult=m_Engine.QueueEventHandler(this); } @@ -564,7 +571,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance lock (m_EventQueue) { - if ((m_EventQueue.Count > 0) && m_RunEvents) + if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) { m_CurrentResult = m_Engine.QueueEventHandler(this); } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 303e5e4ffc..bb08a60988 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -856,7 +856,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine foreach (IScriptInstance i in instances) { + // Stop the script, even forcibly if needed. Then flag + // it as shutting down and restore the previous run state + // for serialization, so the scripts don't come back + // dead after region restart + // + bool prevRunning = i.Running; i.Stop(50); + i.ShuttingDown = true; + i.Running = prevRunning; } DoBackup(new Object[] {0}); diff --git a/prebuild.xml b/prebuild.xml index 5dfc2a2ab0..bd75843c7d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1315,6 +1315,7 @@ + @@ -1385,6 +1386,7 @@ +