Work in progress on SECS stuff. Have been holding it off until after 0.6 release. Still messy as hell and doesn't really work yet. Will undergo dramatic changes. AND MOST IMPORTANTLY: Will be conformed to work in coop with todays DNE and XEngine, hopefully one day providing a common interface for all components.

This commit is contained in:
Tedd Hansen
2008-11-08 17:35:48 +00:00
parent cf0a14bec9
commit 9511a8c763
53 changed files with 2997 additions and 573 deletions

View File

@@ -27,19 +27,92 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.ApplicationPlugins.ScriptEngine.Components;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.ScriptEngine.Shared;
using EventParams=OpenSim.ScriptEngine.Shared.EventParams;
namespace OpenSim.ScriptEngine.Components.DotNetEngine.Events
{
public class LSLEventProvider: EventBase
public class LSLEventProvider : IScriptEventProvider
{
public delegate void RezScriptDelegate(uint localID, UUID itemID, string script, int startParam, bool postOnRez,
string engine);
public event RezScriptDelegate RezScript;
public delegate void RemoveScriptDelegate(uint localID, UUID itemID);
public event RemoveScriptDelegate RemoveScript;
public delegate void ScriptChangedDelegate(uint localID, uint change);
public event ScriptChangedDelegate ScriptChanged;
public override void Start()
private RegionInfoStructure CurrentRegion;
public void Initialize(RegionInfoStructure currentRegion)
{
CurrentRegion = currentRegion;
HookupEvents();
}
public override void Close()
private void HookupEvents()
{
CurrentRegion.Scene.EventManager.OnObjectGrab += OnObjectGrab;
CurrentRegion.Scene.EventManager.OnRezScript += OnRezScript;
CurrentRegion.Scene.EventManager.OnRemoveScript += OnRemoveScript;
CurrentRegion.Scene.EventManager.OnScriptChangedEvent += OnScriptChangedEvent;
}
private void OnScriptChangedEvent(uint localID, uint change)
{
// Script is being changed, fire event
if (ScriptChanged != null)
ScriptChanged(localID, change);
}
private void OnRemoveScript(uint localID, UUID itemID)
{
// Script is being removed, fire event
if (RemoveScript != null)
RemoveScript(localID, itemID);
}
private void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
{
// New script being created, fire event
if (RezScript != null)
RezScript(localID, itemID, script, startParam, postOnRez, engine);
}
private void OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
DetectParams[] det = new DetectParams[1];
det[0] = new DetectParams();
det[0].Key = remoteClient.AgentId;
//det[0].Populate(World);
if (originalID == 0)
{
SceneObjectPart part =
CurrentRegion.Scene.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart =
CurrentRegion.Scene.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
Shared.EventParams ep =
new Shared.EventParams(localID, "touch_start", new Object[] {new LSL_Types.LSLInteger(1)}, det);
CurrentRegion.Executors_Execute(ep);
}
}
}