aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 48cae2f..4734fa9 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -59,6 +59,57 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
59 return null; 59 return null;
60 } 60 }
61 61
62 #region OnTouch
63
64 private event OnTouchDelegate _OnTouch;
65 private bool _OnTouchActive = false;
66
67 public event OnTouchDelegate OnTouch
68 {
69 add
70 {
71 if(!_OnTouchActive)
72 {
73 _OnTouchActive = true;
74 m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab;
75 }
76
77 _OnTouch += value;
78 }
79 remove
80 {
81 _OnTouch -= value;
82
83 if (_OnTouch == null)
84 {
85 _OnTouchActive = false;
86 m_rootScene.EventManager.OnObjectGrab -= EventManager_OnObjectGrab;
87 }
88 }
89 }
90
91 void EventManager_OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
92 {
93 if (_OnTouchActive && m_localID == localID)
94 {
95 TouchEventArgs e = new TouchEventArgs();
96 e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId);
97 e.TouchBiNormal = surfaceArgs.Binormal;
98 e.TouchMaterialIndex = surfaceArgs.FaceIndex;
99 e.TouchNormal = surfaceArgs.Normal;
100 e.TouchPosition = surfaceArgs.Position;
101 e.TouchST = new Vector2(surfaceArgs.STCoord.X, surfaceArgs.STCoord.Y);
102 e.TouchUV = new Vector2(surfaceArgs.UVCoord.X, surfaceArgs.UVCoord.Y);
103
104 IObject sender = this;
105
106 if (_OnTouch != null)
107 _OnTouch(sender, e);
108 }
109 }
110
111 #endregion
112
62 public bool Exists 113 public bool Exists
63 { 114 {
64 get { return GetSOP() != null; } 115 get { return GetSOP() != null; }