aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
authorMelanie2012-07-11 03:56:50 +0100
committerMelanie2012-07-11 03:56:50 +0100
commit0bc8238a6c25bc42438caee0cf42deec00f26b8e (patch)
treea046cace418e2e7714818c60242698d0dd9cb4f4 /OpenSim/Region/OptionalModules/World
parentMerge branch 'avination' into careminster (diff)
parentIf a part has a sit target and an avatar is already sitting, allow another av... (diff)
downloadopensim-SC_OLD-0bc8238a6c25bc42438caee0cf42deec00f26b8e.zip
opensim-SC_OLD-0bc8238a6c25bc42438caee0cf42deec00f26b8e.tar.gz
opensim-SC_OLD-0bc8238a6c25bc42438caee0cf42deec00f26b8e.tar.bz2
opensim-SC_OLD-0bc8238a6c25bc42438caee0cf42deec00f26b8e.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Framework/Watchdog.cs OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs47
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs10
2 files changed, 57 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 4fcf40d..045661a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -104,6 +104,45 @@ namespace OpenSim.Region.OptionalModules.World.NPC
104 OnMoneyTransferRequest(m_uuid, target, amount, 1, "Payment"); 104 OnMoneyTransferRequest(m_uuid, target, amount, 1, "Payment");
105 } 105 }
106 106
107 public bool Touch(UUID target)
108 {
109 SceneObjectPart part = m_scene.GetSceneObjectPart(target);
110 if (part == null)
111 return false;
112 bool objectTouchable = hasTouchEvents(part); // Only touch an object that is scripted to respond
113 if (!objectTouchable && !part.IsRoot)
114 objectTouchable = hasTouchEvents(part.ParentGroup.RootPart);
115 if (!objectTouchable)
116 return false;
117 // Set up the surface args as if the touch is from a client that does not support this
118 SurfaceTouchEventArgs surfaceArgs = new SurfaceTouchEventArgs();
119 surfaceArgs.FaceIndex = -1; // TOUCH_INVALID_FACE
120 surfaceArgs.Binormal = Vector3.Zero; // TOUCH_INVALID_VECTOR
121 surfaceArgs.Normal = Vector3.Zero; // TOUCH_INVALID_VECTOR
122 surfaceArgs.STCoord = new Vector3(-1.0f, -1.0f, 0.0f); // TOUCH_INVALID_TEXCOORD
123 surfaceArgs.UVCoord = surfaceArgs.STCoord; // TOUCH_INVALID_TEXCOORD
124 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
125 touchArgs.Add(surfaceArgs);
126 Vector3 offset = part.OffsetPosition * -1.0f;
127 if (OnGrabObject == null)
128 return false;
129 OnGrabObject(part.LocalId, offset, this, touchArgs);
130 if (OnGrabUpdate != null)
131 OnGrabUpdate(part.UUID, offset, part.ParentGroup.RootPart.GroupPosition, this, touchArgs);
132 if (OnDeGrabObject != null)
133 OnDeGrabObject(part.LocalId, this, touchArgs);
134 return true;
135 }
136
137 private bool hasTouchEvents(SceneObjectPart part)
138 {
139 if ((part.ScriptEvents & scriptEvents.touch) != 0 ||
140 (part.ScriptEvents & scriptEvents.touch_start) != 0 ||
141 (part.ScriptEvents & scriptEvents.touch_end) != 0)
142 return true;
143 return false;
144 }
145
107 public void InstantMessage(UUID target, string message) 146 public void InstantMessage(UUID target, string message)
108 { 147 {
109 OnInstantMessage(this, new GridInstantMessage(m_scene, 148 OnInstantMessage(this, new GridInstantMessage(m_scene,
@@ -153,6 +192,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC
153 192
154 private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType) 193 private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType)
155 { 194 {
195 if (channel == 0)
196 {
197 message = message.Trim();
198 if (string.IsNullOrEmpty(message))
199 {
200 return;
201 }
202 }
156 OSChatMessage chatFromClient = new OSChatMessage(); 203 OSChatMessage chatFromClient = new OSChatMessage();
157 chatFromClient.Channel = channel; 204 chatFromClient.Channel = channel;
158 chatFromClient.From = Name; 205 chatFromClient.From = Name;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index a32ab2a..b37aba3 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -306,6 +306,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
306 return false; 306 return false;
307 } 307 }
308 308
309 public bool Touch(UUID agentID, UUID objectID)
310 {
311 lock (m_avatars)
312 {
313 if (m_avatars.ContainsKey(agentID))
314 return m_avatars[agentID].Touch(objectID);
315 return false;
316 }
317 }
318
309 public UUID GetOwner(UUID agentID) 319 public UUID GetOwner(UUID agentID)
310 { 320 {
311 lock (m_avatars) 321 lock (m_avatars)