diff options
author | Dalien Talbot | 2008-02-10 22:23:11 +0000 |
---|---|---|
committer | Dalien Talbot | 2008-02-10 22:23:11 +0000 |
commit | c935b308e67d4468437fa201a3bf444d9715f377 (patch) | |
tree | db8c309027f243c35c236093c0c0780bb5327284 /OpenSim/Region/Environment | |
parent | Bugfix to state command: (diff) | |
download | opensim-SC-c935b308e67d4468437fa201a3bf444d9715f377.zip opensim-SC-c935b308e67d4468437fa201a3bf444d9715f377.tar.gz opensim-SC-c935b308e67d4468437fa201a3bf444d9715f377.tar.bz2 opensim-SC-c935b308e67d4468437fa201a3bf444d9715f377.tar.xz |
The very beginnings of attachments (no detachments! :)
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 147 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 |
3 files changed, 159 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; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index cc9d294..fee1e66 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -33,6 +33,10 @@ using libsecondlife.Packets; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using System.IO; | ||
37 | using System.Text; | ||
38 | using System.Xml; | ||
39 | |||
36 | 40 | ||
37 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
38 | { | 42 | { |
@@ -766,6 +770,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
766 | } | 770 | } |
767 | } | 771 | } |
768 | } | 772 | } |
773 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, | ||
774 | uint ItemFlags, uint NextOwnerMask) | ||
775 | { | ||
776 | System.Console.WriteLine("RezSingleAttachment: unimplemented yet"); | ||
777 | } | ||
778 | |||
769 | 779 | ||
770 | private void AddRezObject(string xmlData, LLVector3 pos) | 780 | private void AddRezObject(string xmlData, LLVector3 pos) |
771 | { | 781 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index dfbeed1..015ba12 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1299,6 +1299,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1299 | client.OnGrabUpdate += m_innerScene.MoveObject; | 1299 | client.OnGrabUpdate += m_innerScene.MoveObject; |
1300 | client.OnDeRezObject += DeRezObject; | 1300 | client.OnDeRezObject += DeRezObject; |
1301 | client.OnRezObject += RezObject; | 1301 | client.OnRezObject += RezObject; |
1302 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | ||
1303 | client.OnObjectAttach += m_innerScene.AttachObject; | ||
1302 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 1304 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; |
1303 | client.OnObjectDescription += m_innerScene.PrimDescription; | 1305 | client.OnObjectDescription += m_innerScene.PrimDescription; |
1304 | client.OnObjectName += m_innerScene.PrimName; | 1306 | client.OnObjectName += m_innerScene.PrimName; |