diff options
author | Teravus Ovares | 2008-04-23 22:44:59 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-23 22:44:59 +0000 |
commit | 1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90 (patch) | |
tree | e2f37410f60a2b038c7ced800008491c7d0f1d88 /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase | |
parent | * Add NUnit to CONTRIBUTORS file (diff) | |
download | opensim-SC_OLD-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.zip opensim-SC_OLD-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.tar.gz opensim-SC_OLD-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.tar.bz2 opensim-SC_OLD-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.tar.xz |
* 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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index b4789a9..c2e3209 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -28,6 +28,9 @@ | |||
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment; | ||
32 | using OpenSim.Region.Environment.Modules; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
31 | 34 | ||
32 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 35 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
33 | { | 36 | { |
@@ -68,6 +71,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
68 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 71 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
69 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; | 72 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; |
70 | // TODO: HOOK ALL EVENTS UP TO SERVER! | 73 | // TODO: HOOK ALL EVENTS UP TO SERVER! |
74 | IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); | ||
75 | if(money != null) | ||
76 | { | ||
77 | money.OnObjectPaid+=HandleObjectPaid; | ||
78 | } | ||
79 | |||
71 | } | 80 | } |
72 | } | 81 | } |
73 | 82 | ||
@@ -75,6 +84,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
75 | { | 84 | { |
76 | } | 85 | } |
77 | 86 | ||
87 | private void HandleObjectPaid(LLUUID objectID, LLUUID agentID, int amount) | ||
88 | { | ||
89 | SceneObjectPart part=myScriptEngine.World.GetSceneObjectPart(objectID); | ||
90 | if(part != null) | ||
91 | { | ||
92 | money(part.LocalId, agentID, amount); | ||
93 | } | ||
94 | } | ||
95 | |||
78 | public void changed(uint localID, uint change) | 96 | public void changed(uint localID, uint change) |
79 | { | 97 | { |
80 | // Add to queue for all scripts in localID, Object pass change. | 98 | // Add to queue for all scripts in localID, Object pass change. |
@@ -112,6 +130,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
112 | ); | 130 | ); |
113 | } | 131 | } |
114 | 132 | ||
133 | public void money(uint localID, LLUUID agentID, int amount) | ||
134 | { | ||
135 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "money", EventQueueManager.llDetectNull, new object[] { agentID.ToString(), (int)amount }); | ||
136 | } | ||
137 | |||
115 | // TODO: Replace placeholders below | 138 | // TODO: Replace placeholders below |
116 | // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT! | 139 | // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT! |
117 | // These needs to be hooked up to OpenSim during init of this class | 140 | // These needs to be hooked up to OpenSim during init of this class |
@@ -194,11 +217,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
194 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull); | 217 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull); |
195 | } | 218 | } |
196 | 219 | ||
197 | public void money(uint localID, LLUUID itemID) | ||
198 | { | ||
199 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "money", EventQueueManager.llDetectNull); | ||
200 | } | ||
201 | |||
202 | public void email(uint localID, LLUUID itemID) | 220 | public void email(uint localID, LLUUID itemID) |
203 | { | 221 | { |
204 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email", EventQueueManager.llDetectNull); | 222 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email", EventQueueManager.llDetectNull); |