* Added and implemented the LSL changed event.
* An example changed event syntax is at: http://opensimulator.org/wiki/Changed_Event_Example * You can use this to trigger actions in your script if someone sits on your object_rez * You can use this to figure out all of the CHANGED_ constants except for CHANGED_REGION, CHANGED_TELEPORT, and CHANGED_ALLOW_DROPThreadPoolClientBranch
parent
feba36aaf3
commit
c2863df49d
|
@ -1249,6 +1249,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
|
protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
|
||||||
{
|
{
|
||||||
if (m_AvatarFactory == null ||
|
if (m_AvatarFactory == null ||
|
||||||
|
@ -2190,6 +2191,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
scriptEngine.InitializeEngine(this, logger);
|
scriptEngine.InitializeEngine(this, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TriggerObjectChanged(uint localID, uint change)
|
||||||
|
{
|
||||||
|
|
||||||
|
m_eventManager.TriggerOnScriptChangedEvent(localID, change);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region InnerScene wrapper methods
|
#region InnerScene wrapper methods
|
||||||
|
|
|
@ -125,7 +125,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
|
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
|
||||||
|
|
||||||
|
public delegate void ScriptChangedEvent(uint localID, uint change);
|
||||||
|
|
||||||
|
public event ScriptChangedEvent OnScriptChangedEvent;
|
||||||
|
|
||||||
|
public void TriggerOnScriptChangedEvent(uint localID, uint change)
|
||||||
|
{
|
||||||
|
if (OnScriptChangedEvent != null)
|
||||||
|
OnScriptChangedEvent(localID,change);
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerOnClientMovement(ScenePresence avatar)
|
public void TriggerOnClientMovement(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
lock (m_taskInventory)
|
lock (m_taskInventory)
|
||||||
{
|
{
|
||||||
m_taskInventory.Add(item.ItemID, item);
|
m_taskInventory.Add(item.ItemID, item);
|
||||||
|
TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
|
@ -220,6 +221,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
foreach (TaskInventoryItem item in items)
|
foreach (TaskInventoryItem item in items)
|
||||||
{
|
{
|
||||||
m_taskInventory.Add(item.ItemID, item);
|
m_taskInventory.Add(item.ItemID, item);
|
||||||
|
TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +267,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
m_taskInventory[item.ItemID] = item;
|
m_taskInventory[item.ItemID] = item;
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
|
TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -295,6 +298,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
int type = m_taskInventory[itemID].InvType;
|
int type = m_taskInventory[itemID].InvType;
|
||||||
m_taskInventory.Remove(itemID);
|
m_taskInventory.Remove(itemID);
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
|
TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,23 @@ using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
|
// I don't really know where to put this except here.
|
||||||
|
// Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum Changed : uint
|
||||||
|
{
|
||||||
|
INVENTORY = 1,
|
||||||
|
COLOR = 2,
|
||||||
|
SHAPE = 4,
|
||||||
|
SCALE = 8,
|
||||||
|
TEXTURE = 16,
|
||||||
|
LINK = 32,
|
||||||
|
ALLOWED_DROP = 64,
|
||||||
|
OWNER = 128
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public partial class SceneObjectPart : IScriptHost
|
public partial class SceneObjectPart : IScriptHost
|
||||||
{
|
{
|
||||||
private const PermissionMask OBJFULL_MASK_GENERAL =
|
private const PermissionMask OBJFULL_MASK_GENERAL =
|
||||||
|
@ -186,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public LLQuaternion GetWorldRotation()
|
public LLQuaternion GetWorldRotation()
|
||||||
{
|
{
|
||||||
|
|
||||||
Quaternion newRot;
|
Quaternion newRot;
|
||||||
|
|
||||||
if (this.LinkNum == 0)
|
if (this.LinkNum == 0)
|
||||||
|
@ -277,6 +295,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
// Hack to get the child prim to update world positions in the physics engine
|
// Hack to get the child prim to update world positions in the physics engine
|
||||||
ParentGroup.ResetChildPrimPhysicsPositions();
|
ParentGroup.ResetChildPrimPhysicsPositions();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (System.NullReferenceException)
|
catch (System.NullReferenceException)
|
||||||
{
|
{
|
||||||
|
@ -427,6 +446,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_color = value;
|
m_color = value;
|
||||||
|
TriggerScriptChangedEvent(Changed.COLOR);
|
||||||
|
|
||||||
/* ScheduleFullUpdate() need not be called b/c after
|
/* ScheduleFullUpdate() need not be called b/c after
|
||||||
* setting the color, the text will be set, so then
|
* setting the color, the text will be set, so then
|
||||||
* ScheduleFullUpdate() will be called. */
|
* ScheduleFullUpdate() will be called. */
|
||||||
|
@ -477,7 +498,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public int LinkNum
|
public int LinkNum
|
||||||
{
|
{
|
||||||
get { return m_linkNum; }
|
get { return m_linkNum; }
|
||||||
set { m_linkNum = value; }
|
set
|
||||||
|
{
|
||||||
|
m_linkNum = value;
|
||||||
|
TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte m_clickAction = 0;
|
private byte m_clickAction = 0;
|
||||||
|
@ -494,16 +520,35 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
protected PrimitiveBaseShape m_shape;
|
protected PrimitiveBaseShape m_shape;
|
||||||
|
|
||||||
|
public void TriggerScriptChangedEvent(Changed val)
|
||||||
|
{
|
||||||
|
if (m_parentGroup != null)
|
||||||
|
{
|
||||||
|
if (m_parentGroup.Scene != null)
|
||||||
|
m_parentGroup.Scene.TriggerObjectChanged(LocalID, (uint)val);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public PrimitiveBaseShape Shape
|
public PrimitiveBaseShape Shape
|
||||||
{
|
{
|
||||||
get { return m_shape; }
|
get { return m_shape; }
|
||||||
set { m_shape = value; }
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
m_shape = value;
|
||||||
|
TriggerScriptChangedEvent(Changed.SHAPE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLVector3 Scale
|
public LLVector3 Scale
|
||||||
{
|
{
|
||||||
set { m_shape.Scale = value; }
|
|
||||||
get { return m_shape.Scale; }
|
get { return m_shape.Scale; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_shape.Scale = value;
|
||||||
|
TriggerScriptChangedEvent(Changed.SCALE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Stopped
|
public bool Stopped
|
||||||
|
@ -692,6 +737,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
BaseMask = NextOwnerMask;
|
BaseMask = NextOwnerMask;
|
||||||
OwnerMask = NextOwnerMask;
|
OwnerMask = NextOwnerMask;
|
||||||
|
TriggerScriptChangedEvent(Changed.OWNER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplySanePermissions()
|
public void ApplySanePermissions()
|
||||||
|
@ -918,6 +965,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SetAvatarOnSitTarget(LLUUID avatarID)
|
public void SetAvatarOnSitTarget(LLUUID avatarID)
|
||||||
{
|
{
|
||||||
m_SitTargetAvatar = avatarID;
|
m_SitTargetAvatar = avatarID;
|
||||||
|
TriggerScriptChangedEvent(Changed.LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLUUID GetAvatarOnSitTarget()
|
public LLUUID GetAvatarOnSitTarget()
|
||||||
|
@ -1328,6 +1376,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void UpdateTextureEntry(byte[] textureEntry)
|
public void UpdateTextureEntry(byte[] textureEntry)
|
||||||
{
|
{
|
||||||
m_shape.TextureEntry = textureEntry;
|
m_shape.TextureEntry = textureEntry;
|
||||||
|
TriggerScriptChangedEvent(Changed.TEXTURE);
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,17 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
||||||
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
|
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
|
||||||
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
|
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
|
||||||
|
myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
|
||||||
// TODO: HOOK ALL EVENTS UP TO SERVER!
|
// TODO: HOOK ALL EVENTS UP TO SERVER!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changed(uint localID, uint change)
|
||||||
|
{
|
||||||
|
// Add to queue for all scripts in localID, Object pass change.
|
||||||
|
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID,"changed", new object[] {(int) change});
|
||||||
|
}
|
||||||
|
|
||||||
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
|
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
// Add to queue for all scripts in ObjectID object
|
// Add to queue for all scripts in ObjectID object
|
||||||
|
|
Loading…
Reference in New Issue