mirror of
https://github.com/opensim/opensim.git
synced 2026-05-19 06:25:44 +08:00
* Patch from Melanie. Mantis 0001037: Add various internal plumbing to the example economy module, implements llSetPayPrice(), money() and llGiveMoney() in scripts. Thanks Melanie!
* Moves module loading before the script engine so the script engine can pick up events from modules registering interfaces with scene.
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
using System;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Modules;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
@@ -68,6 +71,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
|
||||
myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
|
||||
// TODO: HOOK ALL EVENTS UP TO SERVER!
|
||||
IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
|
||||
if(money != null)
|
||||
{
|
||||
money.OnObjectPaid+=HandleObjectPaid;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +84,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
}
|
||||
|
||||
private void HandleObjectPaid(LLUUID objectID, LLUUID agentID, int amount)
|
||||
{
|
||||
SceneObjectPart part=myScriptEngine.World.GetSceneObjectPart(objectID);
|
||||
if(part != null)
|
||||
{
|
||||
money(part.LocalId, agentID, amount);
|
||||
}
|
||||
}
|
||||
|
||||
public void changed(uint localID, uint change)
|
||||
{
|
||||
// Add to queue for all scripts in localID, Object pass change.
|
||||
@@ -112,6 +130,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
);
|
||||
}
|
||||
|
||||
public void money(uint localID, LLUUID agentID, int amount)
|
||||
{
|
||||
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "money", EventQueueManager.llDetectNull, new object[] { agentID.ToString(), (int)amount });
|
||||
}
|
||||
|
||||
// TODO: Replace placeholders below
|
||||
// NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT!
|
||||
// These needs to be hooked up to OpenSim during init of this class
|
||||
@@ -194,11 +217,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull);
|
||||
}
|
||||
|
||||
public void money(uint localID, LLUUID itemID)
|
||||
{
|
||||
myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "money", EventQueueManager.llDetectNull);
|
||||
}
|
||||
|
||||
public void email(uint localID, LLUUID itemID)
|
||||
{
|
||||
myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email", EventQueueManager.llDetectNull);
|
||||
|
||||
Reference in New Issue
Block a user