* 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.
This commit is contained in:
Teravus Ovares
2008-04-24 11:32:41 +00:00
parent c49b25f19e
commit aa8aee90a3
8 changed files with 177 additions and 27 deletions

View File

@@ -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
/// <param name="attachPoint"></param>
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;
@@ -3437,6 +3452,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;