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.
This commit is contained in:
Melanie Thielker
2008-09-08 02:40:20 +00:00
parent 4822e79759
commit 490ac0be00
14 changed files with 102 additions and 15 deletions

View File

@@ -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; }

View File

@@ -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()

View File

@@ -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;

View File

@@ -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<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@@ -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);
}

View File

@@ -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});