diff options
author | Melanie | 2010-03-15 17:23:35 +0000 |
---|---|---|
committer | Melanie | 2010-03-15 17:23:35 +0000 |
commit | d3f33acc1a6a385ee19814286fe27cb5e48c1551 (patch) | |
tree | 07795e74a637ca63d96b5ee06950b8c1a7a99489 /OpenSim/Region/CoreModules/Avatar | |
parent | Merge branch 'careminster' into careminster-presence-refactor (diff) | |
parent | flip UVs for profile faces (diff) | |
download | opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.zip opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.gz opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.bz2 opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
3 files changed, 114 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d458364..f54e41a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | 37 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
39 | { | 39 | { |
40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule | 40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -67,6 +67,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
67 | get { return false; } | 67 | get { return false; } |
68 | } | 68 | } |
69 | 69 | ||
70 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) | ||
71 | { | ||
72 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | ||
73 | |||
74 | // If we can't take it, we can't attach it! | ||
75 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); | ||
76 | if (part == null) | ||
77 | return; | ||
78 | |||
79 | if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) | ||
80 | return; | ||
81 | |||
82 | // Calls attach with a Zero position | ||
83 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) | ||
84 | { | ||
85 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | ||
86 | |||
87 | // Save avatar attachment information | ||
88 | ScenePresence presence; | ||
89 | if (m_scene.AvatarFactory != null && m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
90 | { | ||
91 | m_log.Info( | ||
92 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
93 | + ", AttachmentPoint: " + AttachmentPt); | ||
94 | |||
95 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | |||
70 | public bool AttachObject( | 100 | public bool AttachObject( |
71 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | 101 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) |
72 | { | 102 | { |
@@ -138,12 +168,87 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
138 | 168 | ||
139 | return true; | 169 | return true; |
140 | } | 170 | } |
171 | |||
172 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
173 | { | ||
174 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | ||
175 | |||
176 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); | ||
177 | } | ||
178 | |||
179 | public UUID RezSingleAttachmentFromInventory( | ||
180 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | ||
181 | { | ||
182 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | ||
183 | |||
184 | if (updateInventoryStatus) | ||
185 | { | ||
186 | if (att == null) | ||
187 | { | ||
188 | ShowDetachInUserInventory(itemID, remoteClient); | ||
189 | } | ||
190 | |||
191 | SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); | ||
192 | } | ||
193 | |||
194 | if (null == att) | ||
195 | return UUID.Zero; | ||
196 | else | ||
197 | return att.UUID; | ||
198 | } | ||
199 | |||
200 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | ||
201 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
202 | { | ||
203 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
204 | if (invAccess != null) | ||
205 | { | ||
206 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, | ||
207 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
208 | false, false, remoteClient.AgentId, true); | ||
209 | |||
210 | // m_log.DebugFormat( | ||
211 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
212 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
213 | |||
214 | if (objatt != null) | ||
215 | { | ||
216 | bool tainted = false; | ||
217 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | ||
218 | tainted = true; | ||
219 | |||
220 | AttachObject( | ||
221 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
222 | //objatt.ScheduleGroupForFullUpdate(); | ||
223 | |||
224 | if (tainted) | ||
225 | objatt.HasGroupChanged = true; | ||
226 | |||
227 | // Fire after attach, so we don't get messy perms dialogs | ||
228 | // 3 == AttachedRez | ||
229 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | ||
230 | |||
231 | // Do this last so that event listeners have access to all the effects of the attachment | ||
232 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | m_log.WarnFormat( | ||
237 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
238 | itemID, remoteClient.Name, AttachmentPt); | ||
239 | } | ||
240 | |||
241 | return objatt; | ||
242 | } | ||
243 | |||
244 | return null; | ||
245 | } | ||
141 | 246 | ||
142 | public UUID SetAttachmentInventoryStatus( | 247 | public UUID SetAttachmentInventoryStatus( |
143 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 248 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
144 | { | 249 | { |
145 | m_log.DebugFormat( | 250 | m_log.DebugFormat( |
146 | "[ATTACHMENTS MODULEY]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | 251 | "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", |
147 | remoteClient.Name, att.Name, itemID); | 252 | remoteClient.Name, att.Name, itemID); |
148 | 253 | ||
149 | if (!att.IsDeleted) | 254 | if (!att.IsDeleted) |
@@ -204,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
204 | if (m_scene.AvatarFactory != null) | 309 | if (m_scene.AvatarFactory != null) |
205 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 310 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); |
206 | } | 311 | } |
207 | } | 312 | } |
208 | 313 | ||
209 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) | 314 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) |
210 | { | 315 | { |
@@ -222,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
222 | } | 327 | } |
223 | 328 | ||
224 | DetachSingleAttachmentToInv(itemID, remoteClient); | 329 | DetachSingleAttachmentToInv(itemID, remoteClient); |
225 | } | 330 | } |
226 | 331 | ||
227 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | 332 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. |
228 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | 333 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? |
@@ -252,6 +357,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
252 | } | 357 | } |
253 | } | 358 | } |
254 | } | 359 | } |
255 | } | 360 | } |
256 | } | 361 | } |
257 | } \ No newline at end of file | 362 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index de324c0..312db38 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -394,11 +394,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
394 | public IClientAPI LocateClientObject(UUID agentID) | 394 | public IClientAPI LocateClientObject(UUID agentID) |
395 | { | 395 | { |
396 | Scene scene = GetClientScene(agentID); | 396 | Scene scene = GetClientScene(agentID); |
397 | if(scene == null) | 397 | if (scene == null) |
398 | return null; | 398 | return null; |
399 | 399 | ||
400 | ScenePresence presence = scene.GetScenePresence(agentID); | 400 | ScenePresence presence = scene.GetScenePresence(agentID); |
401 | if(presence == null) | 401 | if (presence == null) |
402 | return null; | 402 | return null; |
403 | 403 | ||
404 | return presence.ControllingClient; | 404 | return presence.ControllingClient; |
@@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
481 | m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID); | 481 | m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID); |
482 | 482 | ||
483 | // This user wants to be friends with the other user. | 483 | // This user wants to be friends with the other user. |
484 | // Let's add both relations to the DB, but one of them is inactive (-1) | 484 | // Let's add the relation backwards, in case the other is not online |
485 | FriendsService.StoreFriend(friendID, principalID.ToString(), 0); | 485 | FriendsService.StoreFriend(friendID, principalID.ToString(), 0); |
486 | 486 | ||
487 | // Now let's ask the other user to be friends with this user | 487 | // Now let's ask the other user to be friends with this user |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index c0d3f31..ad050a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
108 | if (!m_Enabled) | 108 | if (!m_Enabled) |
109 | return; | 109 | return; |
110 | 110 | ||
111 | lock(m_Scenes) | 111 | lock (m_Scenes) |
112 | { | 112 | { |
113 | m_Scenes.Remove(scene); | 113 | m_Scenes.Remove(scene); |
114 | } | 114 | } |