aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/InnerScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs147
1 files changed, 147 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 7421957..cb04939 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -232,6 +232,153 @@ namespace OpenSim.Region.Environment.Scenes
232 } 232 }
233 } 233 }
234 234
235 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot)
236 {
237 System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt);
238 SceneObjectPart p = GetSceneObjectPart(objectLocalID);
239 ScenePresence av = null;
240 if (TryGetAvatar(remoteClient.AgentId, out av)) {
241 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
242 objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle;
243 objupdate.RegionData.TimeDilation = 64096;
244 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2];
245 // avatar stuff - horrible group copypaste
246
247 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
248 objupdate.ObjectData[0].PSBlock = new byte[0];
249 objupdate.ObjectData[0].ExtraParams = new byte[1];
250 objupdate.ObjectData[0].MediaURL = new byte[0];
251 objupdate.ObjectData[0].NameValue = new byte[0];
252 objupdate.ObjectData[0].Text = new byte[0];
253 objupdate.ObjectData[0].TextColor = new byte[4];
254 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
255 objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
256 objupdate.ObjectData[0].Material = 4;
257 objupdate.ObjectData[0].TextureAnim = new byte[0];
258 objupdate.ObjectData[0].Sound = LLUUID.Zero;
259
260 objupdate.ObjectData[0].State = 0;
261 objupdate.ObjectData[0].Data = new byte[0];
262
263 objupdate.ObjectData[0].ObjectData = new byte[76];
264 objupdate.ObjectData[0].ObjectData[15] = 128;
265 objupdate.ObjectData[0].ObjectData[16] = 63;
266 objupdate.ObjectData[0].ObjectData[56] = 128;
267 objupdate.ObjectData[0].ObjectData[61] = 102;
268 objupdate.ObjectData[0].ObjectData[62] = 40;
269 objupdate.ObjectData[0].ObjectData[63] = 61;
270 objupdate.ObjectData[0].ObjectData[64] = 189;
271
272
273 objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
274 objupdate.ObjectData[0].PathCurve = 16;
275 objupdate.ObjectData[0].ProfileCurve = 1;
276 objupdate.ObjectData[0].PathScaleX = 100;
277 objupdate.ObjectData[0].PathScaleY = 100;
278 objupdate.ObjectData[0].ParentID = 0;
279 objupdate.ObjectData[0].OwnerID = LLUUID.Zero;
280 objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1);
281 objupdate.ObjectData[0].PCode = 47;
282 objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture;
283
284 objupdate.ObjectData[0].ID = av.LocalId;
285 objupdate.ObjectData[0].FullID = remoteClient.AgentId;
286 objupdate.ObjectData[0].ParentID = 0;
287 objupdate.ObjectData[0].NameValue =
288 Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname);
289 LLVector3 pos2 = av.AbsolutePosition;
290 // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z);
291 byte[] pb = pos2.GetBytes();
292 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
293
294
295 // primitive part
296 objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock();
297 // SetDefaultPrimPacketValues
298 objupdate.ObjectData[1].PSBlock = new byte[0];
299 objupdate.ObjectData[1].ExtraParams = new byte[1];
300 objupdate.ObjectData[1].MediaURL = new byte[0];
301 objupdate.ObjectData[1].NameValue = new byte[0];
302 objupdate.ObjectData[1].Text = new byte[0];
303 objupdate.ObjectData[1].TextColor = new byte[4];
304 objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0);
305 objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0);
306 objupdate.ObjectData[1].Material = 3;
307 objupdate.ObjectData[1].TextureAnim = new byte[0];
308 objupdate.ObjectData[1].Sound = LLUUID.Zero;
309 objupdate.ObjectData[1].State = 0;
310 objupdate.ObjectData[1].Data = new byte[0];
311
312 objupdate.ObjectData[1].ObjectData = new byte[60];
313 objupdate.ObjectData[1].ObjectData[46] = 128;
314 objupdate.ObjectData[1].ObjectData[47] = 63;
315
316 // SetPrimPacketShapeData
317 PrimitiveBaseShape primData = p.Shape;
318
319 objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
320 objupdate.ObjectData[1].PCode = primData.PCode;
321 objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4) ;
322 objupdate.ObjectData[1].PathBegin = primData.PathBegin;
323 objupdate.ObjectData[1].PathEnd = primData.PathEnd;
324 objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
325 objupdate.ObjectData[1].PathScaleY = primData.PathScaleY;
326 objupdate.ObjectData[1].PathShearX = primData.PathShearX;
327 objupdate.ObjectData[1].PathShearY = primData.PathShearY;
328 objupdate.ObjectData[1].PathSkew = primData.PathSkew;
329 objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin;
330 objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd;
331 objupdate.ObjectData[1].Scale = primData.Scale;
332 objupdate.ObjectData[1].PathCurve = primData.PathCurve;
333 objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve;
334 objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow;
335 objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset;
336 objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions;
337 objupdate.ObjectData[1].PathTaperX = primData.PathTaperX;
338 objupdate.ObjectData[1].PathTaperY = primData.PathTaperY;
339 objupdate.ObjectData[1].PathTwist = primData.PathTwist;
340 objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin;
341 objupdate.ObjectData[1].ExtraParams = primData.ExtraParams;
342
343
344 objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ??
345 objupdate.ObjectData[1].ID = p.LocalID;
346 objupdate.ObjectData[1].FullID = p.UUID;
347 objupdate.ObjectData[1].OwnerID = p.OwnerID;
348 objupdate.ObjectData[1].Text = Helpers.StringToField(p.Text);
349 objupdate.ObjectData[1].TextColor[0] = 255;
350 objupdate.ObjectData[1].TextColor[1] = 255;
351 objupdate.ObjectData[1].TextColor[2] = 255;
352 objupdate.ObjectData[1].TextColor[3] = 128;
353 objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID;
354 //objupdate.ObjectData[1].PSBlock = particleSystem;
355 //objupdate.ObjectData[1].ClickAction = clickAction;
356 objupdate.ObjectData[1].Radius = 20;
357 objupdate.ObjectData[1].NameValue =
358 Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID);
359 LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0);
360
361 pb = pos.GetBytes();
362 Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
363
364 byte[] brot = rot.GetBytes();
365 Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length);
366
367
368
369 remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task);
370
371
372
373
374 }
375 else
376 {
377 m_log.Info("[SCENE]: Avatar " + remoteClient.AgentId + " not found");
378 }
379 }
380
381
235 public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) 382 public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance)
236 { 383 {
237 ScenePresence newAvatar = null; 384 ScenePresence newAvatar = null;