From aa8aee90a35458f1f601ca23e2298b212782d0a3 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 24 Apr 2008 11:32:41 +0000 Subject: * Adds much better support for attachments that you right click on in world. * Your friends can see your attachments now. People who appear in the sim after you've attached something can also see your attachments. * You can position & rotate your attachments now. Positions do *not* save. * You can detach attachments now the regular way. * Attachments do not cross into other regions with you..(this isn't too far off) * Updated ODE to not request terse updates on child prim. --- OpenSim/Region/ClientStack/ClientView.cs | 34 ++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/ClientView.cs') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 216633f..0a6431d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -235,6 +235,7 @@ namespace OpenSim.Region.ClientStack private ScriptAnswer handlerScriptAnswer = null; private RequestPayPrice handlerRequestPayPrice = null; + private ObjectDeselect handlerObjectDetach = null; /* Properties */ @@ -689,6 +690,7 @@ namespace OpenSim.Region.ClientStack public event AvatarNowWearing OnAvatarNowWearing; public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; public event ObjectAttach OnObjectAttach; + public event ObjectDeselect OnObjectDetach; public event GenericCall2 OnCompleteMovementToRegion; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -1989,6 +1991,7 @@ namespace OpenSim.Region.ClientStack /// public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { + ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); Console.WriteLine("Attach object!"); // TODO: don't create new blocks if recycling an old packet @@ -2013,13 +2016,13 @@ namespace OpenSim.Region.ClientStack SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, flags, objectID, ownerID, text, color, parentID, particleSystem, - rotation, clickAction, textureanim); + rotation, clickAction, textureanim, false,(uint)0); } public void SendPrimitiveToClient( ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, - LLQuaternion rotation, byte clickAction, byte[] textureanim) + LLQuaternion rotation, byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint) { ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); // TODO: don't create new blocks if recycling an old packet @@ -2050,6 +2053,18 @@ namespace OpenSim.Region.ClientStack outPacket.ObjectData[0].ClickAction = clickAction; //outPacket.ObjectData[0].Flags = 0; + if (attachment) + { + // Necessary??? + outPacket.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 2); + outPacket.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); + + // Item from inventory??? + outPacket.ObjectData[0].NameValue = + Helpers.StringToField("AttachItemID STRING RW SV " + objectID.UUID); + outPacket.ObjectData[0].State = (byte)(((byte)AttachPoint) << 4); + } + // Sound Radius outPacket.ObjectData[0].Radius = 20; @@ -3438,6 +3453,21 @@ namespace OpenSim.Region.ClientStack } break; + case PacketType.ObjectDetach: + + ObjectDetachPacket dett = (ObjectDetachPacket)Pack; + for (int j = 0; j < dett.ObjectData.Length; j++) + { + uint obj = dett.ObjectData[j].ObjectLocalID; + handlerObjectDetach = OnObjectDetach; + if (handlerObjectDetach != null) + { + handlerObjectDetach(obj,this); + } + + } + + break; case PacketType.SetAlwaysRun: SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; -- cgit v1.1