aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs')
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs121
1 files changed, 0 insertions, 121 deletions
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
deleted file mode 100644
index 81dc62d..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.ScriptEngine.Shared;
34using OpenSim.ScriptEngine.Shared;
35using EventParams = OpenSim.ScriptEngine.Shared.EventParams;
36
37namespace OpenSim.ScriptEngine.Components.DotNetEngine.Events
38{
39 public class LSLEventProvider : IScriptEventProvider
40 {
41 public delegate void RezScriptDelegate(uint localID, UUID itemID, string script, int startParam, bool postOnRez,
42 string engine);
43 public event RezScriptDelegate RezScript;
44 public delegate void RemoveScriptDelegate(uint localID, UUID itemID);
45 public event RemoveScriptDelegate RemoveScript;
46 public delegate void ScriptChangedDelegate(uint localID, uint change);
47 public event ScriptChangedDelegate ScriptChanged;
48
49 private RegionInfoStructure CurrentRegion;
50 public void Initialize(RegionInfoStructure currentRegion)
51 {
52 CurrentRegion = currentRegion;
53 HookupEvents();
54 }
55
56 private void HookupEvents()
57 {
58 CurrentRegion.Scene.EventManager.OnObjectGrab += OnObjectGrab;
59 CurrentRegion.Scene.EventManager.OnRezScript += OnRezScript;
60 CurrentRegion.Scene.EventManager.OnRemoveScript += OnRemoveScript;
61 CurrentRegion.Scene.EventManager.OnScriptChangedEvent += OnScriptChangedEvent;
62
63
64 }
65
66 private void OnScriptChangedEvent(uint localID, uint change)
67 {
68 // Script is being changed, fire event
69 if (ScriptChanged != null)
70 ScriptChanged(localID, change);
71 }
72
73 private void OnRemoveScript(uint localID, UUID itemID)
74 {
75 // Script is being removed, fire event
76 if (RemoveScript != null)
77 RemoveScript(localID, itemID);
78 }
79
80 private void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
81 {
82 // New script being created, fire event
83 if (RezScript != null)
84 RezScript(localID, itemID, script, startParam, postOnRez, engine);
85 }
86
87 private void OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
88 {
89 // Add to queue for all scripts in ObjectID object
90 DetectParams[] det = new DetectParams[1];
91 det[0] = new DetectParams();
92 det[0].Key = remoteClient.AgentId;
93 //det[0].Populate(World);
94
95 if (originalID == 0)
96 {
97 SceneObjectPart part =
98 CurrentRegion.Scene.GetSceneObjectPart(localID);
99
100 if (part == null)
101 return;
102
103 det[0].LinkNum = part.LinkNum;
104 }
105 else
106 {
107 SceneObjectPart originalPart =
108 CurrentRegion.Scene.GetSceneObjectPart(originalID);
109 det[0].LinkNum = originalPart.LinkNum;
110 }
111 if (surfaceArgs != null)
112 {
113 det[0].SurfaceTouchArgs = surfaceArgs;
114 }
115 Shared.EventParams ep =
116 new Shared.EventParams(localID, "touch_start", new Object[] {new LSL_Types.LSLInteger(1)}, det);
117 CurrentRegion.Executors_Execute(ep);
118
119 }
120 }
121}