aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-11-23 04:26:07 +0000
committerJustin Clark-Casey (justincc)2010-11-23 04:26:07 +0000
commit63170fdea7eb7f6271fdcf048a39824084a83fd1 (patch)
treeacb13f16b023f193d3049ae62d6bc0932e605812 /OpenSim/Region/CoreModules
parentadapt tests to use DeRezObjects() since DeRezObject() has recently disappeared (diff)
downloadopensim-SC_OLD-63170fdea7eb7f6271fdcf048a39824084a83fd1.zip
opensim-SC_OLD-63170fdea7eb7f6271fdcf048a39824084a83fd1.tar.gz
opensim-SC_OLD-63170fdea7eb7f6271fdcf048a39824084a83fd1.tar.bz2
opensim-SC_OLD-63170fdea7eb7f6271fdcf048a39824084a83fd1.tar.xz
Only perform the take object permissions check if an object is being attached directly from the scene, not from existing inventory
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs105
1 files changed, 50 insertions, 55 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 1744fb3..1f49a01 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -111,7 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
111 return; 111 return;
112 112
113 if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) 113 if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
114 {
115 remoteClient.SendAgentAlertMessage(
116 "You don't have sufficient permissions to attach this object", false);
117
114 return; 118 return;
119 }
115 120
116 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 121 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
117 // be removed when that functionality is implemented in opensim 122 // be removed when that functionality is implemented in opensim
@@ -141,76 +146,66 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
141 { 146 {
142 Vector3 attachPos = group.AbsolutePosition; 147 Vector3 attachPos = group.AbsolutePosition;
143 148
144 if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) 149 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
150 // be removed when that functionality is implemented in opensim
151 AttachmentPt &= 0x7f;
152
153 // If the attachment point isn't the same as the one previously used
154 // set it's offset position = 0 so that it appears on the attachment point
155 // and not in a weird location somewhere unknown.
156 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
145 { 157 {
146 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 158 attachPos = Vector3.Zero;
147 // be removed when that functionality is implemented in opensim 159 }
148 AttachmentPt &= 0x7f;
149
150 // If the attachment point isn't the same as the one previously used
151 // set it's offset position = 0 so that it appears on the attachment point
152 // and not in a weird location somewhere unknown.
153 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
154 {
155 attachPos = Vector3.Zero;
156 }
157 160
158 // AttachmentPt 0 means the client chose to 'wear' the attachment. 161 // AttachmentPt 0 means the client chose to 'wear' the attachment.
159 if (AttachmentPt == 0) 162 if (AttachmentPt == 0)
160 { 163 {
161 // Check object for stored attachment point 164 // Check object for stored attachment point
162 AttachmentPt = (uint)group.GetAttachmentPoint(); 165 AttachmentPt = (uint)group.GetAttachmentPoint();
163 } 166 }
164 167
165 // if we still didn't find a suitable attachment point....... 168 // if we still didn't find a suitable attachment point.......
166 if (AttachmentPt == 0) 169 if (AttachmentPt == 0)
167 { 170 {
168 // Stick it on left hand with Zero Offset from the attachment point. 171 // Stick it on left hand with Zero Offset from the attachment point.
169 AttachmentPt = (uint)AttachmentPoint.LeftHand; 172 AttachmentPt = (uint)AttachmentPoint.LeftHand;
170 attachPos = Vector3.Zero; 173 attachPos = Vector3.Zero;
171 } 174 }
172 175
173 group.SetAttachmentPoint((byte)AttachmentPt); 176 group.SetAttachmentPoint((byte)AttachmentPt);
174 group.AbsolutePosition = attachPos; 177 group.AbsolutePosition = attachPos;
175 178
176 // Remove any previous attachments 179 // Remove any previous attachments
177 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 180 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
178 UUID itemID = UUID.Zero; 181 UUID itemID = UUID.Zero;
179 if (sp != null) 182 if (sp != null)
183 {
184 foreach (SceneObjectGroup grp in sp.Attachments)
180 { 185 {
181 foreach (SceneObjectGroup grp in sp.Attachments) 186 if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
182 { 187 {
183 if (grp.GetAttachmentPoint() == (byte)AttachmentPt) 188 itemID = grp.GetFromItemID();
184 { 189 break;
185 itemID = grp.GetFromItemID();
186 break;
187 }
188 } 190 }
189 if (itemID != UUID.Zero)
190 DetachSingleAttachmentToInv(itemID, remoteClient);
191 } 191 }
192 if (itemID != UUID.Zero)
193 DetachSingleAttachmentToInv(itemID, remoteClient);
194 }
192 195
193 if (group.GetFromItemID() == UUID.Zero) 196 if (group.GetFromItemID() == UUID.Zero)
194 { 197 {
195 m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); 198 m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
196 }
197 else
198 {
199 itemID = group.GetFromItemID();
200 }
201
202 ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
203
204 AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
205 } 199 }
206 else 200 else
207 { 201 {
208 remoteClient.SendAgentAlertMessage( 202 itemID = group.GetFromItemID();
209 "You don't have sufficient permissions to attach this object", false);
210
211 return false;
212 } 203 }
213 204
205 ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
206
207 AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
208
214 return true; 209 return true;
215 } 210 }
216 211