Correct state handling and state event masks. Prims will now show

touch, pay, etc script states correctly.
0.6.0-stable
Melanie Thielker 2008-09-08 22:19:06 +00:00
parent 737fcf322b
commit 1034c1cdc1
3 changed files with 42 additions and 31 deletions

View File

@ -1897,10 +1897,10 @@ namespace OpenSim.Region.Environment.Scenes
// remove values from aggregated script events // remove values from aggregated script events
AggregateScriptEvents &= ~oldparts; AggregateScriptEvents &= ~oldparts;
m_scriptEvents.Remove(scriptid); m_scriptEvents.Remove(scriptid);
}
}
aggregateScriptEvents(); aggregateScriptEvents();
} }
}
}
/// <summary> /// <summary>
/// Reset UUIDs for this part. This involves generate this part's own UUID and /// Reset UUIDs for this part. This involves generate this part's own UUID and
@ -2354,6 +2354,8 @@ namespace OpenSim.Region.Environment.Scenes
// oldparts = m_scriptEvents[scriptid]; // oldparts = m_scriptEvents[scriptid];
// remove values from aggregated script events // remove values from aggregated script events
if (m_scriptEvents[scriptid] == (scriptEvents) events)
return;
m_scriptEvents[scriptid] = (scriptEvents) events; m_scriptEvents[scriptid] = (scriptEvents) events;
} }
else else
@ -3205,6 +3207,8 @@ namespace OpenSim.Region.Environment.Scenes
public void aggregateScriptEvents() public void aggregateScriptEvents()
{ {
AggregateScriptEvents = 0;
// Aggregate script events // Aggregate script events
lock (m_scriptEvents) lock (m_scriptEvents)
{ {

View File

@ -4730,98 +4730,92 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch ((int)rules.Data[i]) switch ((int)rules.Data[i])
{ {
case (int)ScriptBaseClass.PSYS_PART_FLAGS: case (int)ScriptBaseClass.PSYS_PART_FLAGS:
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)((uint)Convert.ToInt32(rules.Data[i + 1].ToString())); prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
break; break;
case (int)ScriptBaseClass.PSYS_PART_START_COLOR: case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
tempv = (LSL_Types.Vector3)rules.Data[i + 1]; tempv = rules.GetVector3Item(i + 1);
prules.PartStartColor.R = (float)tempv.x; prules.PartStartColor.R = (float)tempv.x;
prules.PartStartColor.G = (float)tempv.y; prules.PartStartColor.G = (float)tempv.y;
prules.PartStartColor.B = (float)tempv.z; prules.PartStartColor.B = (float)tempv.z;
break; break;
case (int)ScriptBaseClass.PSYS_PART_START_ALPHA: case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartStartColor.A = (float)tempf; prules.PartStartColor.A = tempf;
break; break;
case (int)ScriptBaseClass.PSYS_PART_END_COLOR: case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
tempv = (LSL_Types.Vector3)rules.Data[i + 1]; tempv = rules.GetVector3Item(i + 1);
//prules.PartEndColor = new Color4(tempv.x,tempv.y,tempv.z,1);
prules.PartEndColor.R = (float)tempv.x; prules.PartEndColor.R = (float)tempv.x;
prules.PartEndColor.G = (float)tempv.y; prules.PartEndColor.G = (float)tempv.y;
prules.PartEndColor.B = (float)tempv.z; prules.PartEndColor.B = (float)tempv.z;
break; break;
case (int)ScriptBaseClass.PSYS_PART_END_ALPHA: case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartEndColor.A = (float)tempf; prules.PartEndColor.A = tempf;
break; break;
case (int)ScriptBaseClass.PSYS_PART_START_SCALE: case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
tempv = (LSL_Types.Vector3)rules.Data[i + 1]; tempv = rules.GetVector3Item(i + 1);
prules.PartStartScaleX = (float)tempv.x; prules.PartStartScaleX = (float)tempv.x;
prules.PartStartScaleY = (float)tempv.y; prules.PartStartScaleY = (float)tempv.y;
break; break;
case (int)ScriptBaseClass.PSYS_PART_END_SCALE: case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
tempv = (LSL_Types.Vector3)rules.Data[i + 1]; tempv = rules.GetVector3Item(i + 1);
prules.PartEndScaleX = (float)tempv.x; prules.PartEndScaleX = (float)tempv.x;
prules.PartEndScaleY = (float)tempv.y; prules.PartEndScaleY = (float)tempv.y;
break; break;
case (int)ScriptBaseClass.PSYS_PART_MAX_AGE: case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartMaxAge = (float)tempf; prules.PartMaxAge = tempf;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_ACCEL: case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
tempv = (LSL_Types.Vector3)rules.Data[i + 1]; tempv = rules.GetVector3Item(i + 1);
prules.PartAcceleration.X = (float)tempv.x; prules.PartAcceleration.X = (float)tempv.x;
prules.PartAcceleration.Y = (float)tempv.y; prules.PartAcceleration.Y = (float)tempv.y;
prules.PartAcceleration.Z = (float)tempv.z; prules.PartAcceleration.Z = (float)tempv.z;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_PATTERN: case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
int tmpi = int.Parse(rules.Data[i + 1].ToString()); int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
break; break;
// Xantor 20080503
// Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture
// "" = default texture.
// 20080530 Updated to remove code duplication
case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
prules.Texture = KeyOrName(rules.Data[i + 1].ToString()); prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
break; break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstRate = (float)tempf; prules.BurstRate = (float)tempf;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT: case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
prules.BurstPartCount = (byte)Convert.ToByte(rules.Data[i + 1].ToString()); prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1);
break; break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS: case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstRadius = (float)tempf; prules.BurstRadius = (float)tempf;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN: case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstSpeedMin = (float)tempf; prules.BurstSpeedMin = (float)tempf;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX: case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstSpeedMax = (float)tempf; prules.BurstSpeedMax = (float)tempf;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE: case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.MaxAge = (float)tempf; prules.MaxAge = (float)tempf;
break; break;
@ -4839,20 +4833,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PSYS_SRC_OMEGA: case (int)ScriptBaseClass.PSYS_SRC_OMEGA:
// AL: This is an assumption, since it is the only thing that would match. // AL: This is an assumption, since it is the only thing that would match.
tempv = (LSL_Types.Vector3)rules.Data[i + 1]; tempv = rules.GetVector3Item(i + 1);
prules.AngularVelocity.X = (float)tempv.x; prules.AngularVelocity.X = (float)tempv.x;
prules.AngularVelocity.Y = (float)tempv.y; prules.AngularVelocity.Y = (float)tempv.y;
prules.AngularVelocity.Z = (float)tempv.z; prules.AngularVelocity.Z = (float)tempv.z;
//cast?? prules.MaxAge = (float)rules[i + 1];
break; break;
case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.InnerAngle = (float)tempf; prules.InnerAngle = (float)tempf;
break; break;
case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.OuterAngle = (float)tempf; prules.OuterAngle = (float)tempf;
break; break;
} }

View File

@ -255,6 +255,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_Engine.Log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName); m_Engine.Log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
part.SetScriptEvents(m_ItemID,
(int)m_Script.GetStateEventFlags(State));
if (m_RunEvents && (!m_ShuttingDown)) if (m_RunEvents && (!m_ShuttingDown))
{ {
m_RunEvents = false; m_RunEvents = false;
@ -612,6 +615,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_EventQueue.Clear(); m_EventQueue.Clear();
m_Script.ResetVars(); m_Script.ResetVars();
m_State = "default"; m_State = "default";
part.SetScriptEvents(m_ItemID,
(int)m_Script.GetStateEventFlags(State));
if (running) if (running)
Start(); Start();
m_SaveState = true; m_SaveState = true;
@ -631,6 +637,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
part.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero; part.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
AsyncCommandManager async = (AsyncCommandManager)m_Engine.AsyncCommands; AsyncCommandManager async = (AsyncCommandManager)m_Engine.AsyncCommands;
async.RemoveScript(m_LocalID, m_ItemID); async.RemoveScript(m_LocalID, m_ItemID);
m_EventQueue.Clear();
m_Script.ResetVars();
m_State = "default";
part.SetScriptEvents(m_ItemID,
(int)m_Script.GetStateEventFlags(State));
if (m_CurrentEvent != "state_entry") if (m_CurrentEvent != "state_entry")
{ {
m_SaveState = true; m_SaveState = true;