Added preliminary support for sitting on prims
parent
d56da1c831
commit
2cf117cc6c
|
@ -169,6 +169,8 @@ namespace OpenSim.Framework.Interfaces
|
||||||
public delegate void StatusChange(bool status);
|
public delegate void StatusChange(bool status);
|
||||||
public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
|
public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
|
||||||
public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
|
public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
|
||||||
|
public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID);
|
||||||
|
public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
|
||||||
public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
|
public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
|
public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
|
||||||
|
@ -217,6 +219,8 @@ namespace OpenSim.Framework.Interfaces
|
||||||
event GenericCall OnRequestWearables;
|
event GenericCall OnRequestWearables;
|
||||||
event GenericCall2 OnCompleteMovementToRegion;
|
event GenericCall2 OnCompleteMovementToRegion;
|
||||||
event UpdateAgent OnAgentUpdate;
|
event UpdateAgent OnAgentUpdate;
|
||||||
|
event AgentRequestSit OnAgentRequestSit;
|
||||||
|
event AgentSit OnAgentSit;
|
||||||
event GenericCall OnRequestAvatarsData;
|
event GenericCall OnRequestAvatarsData;
|
||||||
event AddNewPrim OnAddPrim;
|
event AddNewPrim OnAddPrim;
|
||||||
event ObjectDuplicate OnObjectDuplicate;
|
event ObjectDuplicate OnObjectDuplicate;
|
||||||
|
@ -321,7 +325,7 @@ namespace OpenSim.Framework.Interfaces
|
||||||
void SendTeleportLocationStart();
|
void SendTeleportLocationStart();
|
||||||
void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
|
void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
|
||||||
|
|
||||||
void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry);
|
void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID);
|
||||||
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation);
|
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation);
|
||||||
void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations);
|
void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event SetAppearance OnSetAppearance;
|
public event SetAppearance OnSetAppearance;
|
||||||
public event GenericCall2 OnCompleteMovementToRegion;
|
public event GenericCall2 OnCompleteMovementToRegion;
|
||||||
public event UpdateAgent OnAgentUpdate;
|
public event UpdateAgent OnAgentUpdate;
|
||||||
|
public event AgentRequestSit OnAgentRequestSit;
|
||||||
|
public event AgentSit OnAgentSit;
|
||||||
public event StartAnim OnStartAnim;
|
public event StartAnim OnStartAnim;
|
||||||
public event GenericCall OnRequestAvatarsData;
|
public event GenericCall OnRequestAvatarsData;
|
||||||
public event LinkObjects OnLinkObjects;
|
public event LinkObjects OnLinkObjects;
|
||||||
|
@ -807,6 +809,19 @@ namespace OpenSim.Region.ClientStack
|
||||||
avatarReply.PropertiesData.PartnerID = partnerID;
|
avatarReply.PropertiesData.PartnerID = partnerID;
|
||||||
OutPacket(avatarReply);
|
OutPacket(avatarReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendSitResponse(LLUUID targetID, LLVector3 offset)
|
||||||
|
{
|
||||||
|
AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
|
||||||
|
|
||||||
|
avatarSitResponse.SitObject.ID = targetID;
|
||||||
|
|
||||||
|
avatarSitResponse.SitTransform.AutoPilot = true;
|
||||||
|
avatarSitResponse.SitTransform.SitPosition = offset;
|
||||||
|
avatarSitResponse.SitTransform.SitRotation = new LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
OutPacket(avatarSitResponse);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Appearance/ Wearables Methods
|
#region Appearance/ Wearables Methods
|
||||||
|
@ -889,7 +904,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
/// <param name="avatarID"></param>
|
/// <param name="avatarID"></param>
|
||||||
/// <param name="avatarLocalID"></param>
|
/// <param name="avatarLocalID"></param>
|
||||||
/// <param name="Pos"></param>
|
/// <param name="Pos"></param>
|
||||||
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry)
|
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
|
||||||
{
|
{
|
||||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle = regionHandle;
|
objupdate.RegionData.RegionHandle = regionHandle;
|
||||||
|
@ -900,6 +915,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
//give this avatar object a local id and assign the user a name
|
//give this avatar object a local id and assign the user a name
|
||||||
objupdate.ObjectData[0].ID = avatarLocalID;
|
objupdate.ObjectData[0].ID = avatarLocalID;
|
||||||
objupdate.ObjectData[0].FullID = avatarID;
|
objupdate.ObjectData[0].FullID = avatarID;
|
||||||
|
objupdate.ObjectData[0].ParentID = parentID;
|
||||||
objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
|
objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
|
||||||
LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
|
LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
|
||||||
byte[] pb = pos2.GetBytes();
|
byte[] pb = pos2.GetBytes();
|
||||||
|
|
|
@ -34,6 +34,7 @@ using OpenSim.Framework.Inventory;
|
||||||
using OpenSim.Framework.Types;
|
using OpenSim.Framework.Types;
|
||||||
using OpenSim.Framework.Utilities;
|
using OpenSim.Framework.Utilities;
|
||||||
using OpenSim.Framework.Interfaces;
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
|
@ -198,6 +199,21 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PacketType.AgentRequestSit:
|
||||||
|
AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
|
||||||
|
SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
|
||||||
|
if (OnAgentRequestSit != null)
|
||||||
|
{
|
||||||
|
OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PacketType.AgentSit:
|
||||||
|
if (OnAgentSit != null)
|
||||||
|
{
|
||||||
|
AgentSitPacket agentSit = (AgentSitPacket) Pack;
|
||||||
|
OnAgentSit(this, agentSit.AgentData.AgentID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private byte m_movementflag = 0;
|
private byte m_movementflag = 0;
|
||||||
private readonly List<NewForce> m_forcesList = new List<NewForce>();
|
private readonly List<NewForce> m_forcesList = new List<NewForce>();
|
||||||
private short m_updateCount = 0;
|
private short m_updateCount = 0;
|
||||||
|
private uint m_requestedSitTargetID = 0;
|
||||||
|
|
||||||
private Quaternion bodyRot;
|
private Quaternion bodyRot;
|
||||||
private byte[] m_visualParams;
|
private byte[] m_visualParams;
|
||||||
|
@ -216,6 +217,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set { m_isChildAgent = value; }
|
set { m_isChildAgent = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private uint m_parentID = 0;
|
||||||
|
public uint ParentID
|
||||||
|
{
|
||||||
|
get { return m_parentID; }
|
||||||
|
set { m_parentID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor(s)
|
#region Constructor(s)
|
||||||
|
@ -245,6 +253,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
|
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
|
||||||
m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
|
m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
|
||||||
m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
|
m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
|
||||||
|
m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
|
||||||
|
m_controllingClient.OnAgentSit += HandleAgentSit;
|
||||||
// ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
|
// ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
|
||||||
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
|
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
|
||||||
//ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
|
//ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
|
||||||
|
@ -454,33 +464,44 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
update_movementflag = true;
|
update_movementflag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
|
||||||
|
{
|
||||||
|
StandUp();
|
||||||
|
update_movementflag = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (q != bodyRot)
|
if (q != bodyRot)
|
||||||
{
|
{
|
||||||
bodyRot = q;
|
bodyRot = q;
|
||||||
update_rotation = true;
|
update_rotation = true;
|
||||||
}
|
}
|
||||||
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
|
|
||||||
|
if (m_parentID == 0)
|
||||||
{
|
{
|
||||||
if ((flags & (uint)DCF) != 0)
|
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
|
||||||
{
|
{
|
||||||
DCFlagKeyPressed = true;
|
if ((flags & (uint)DCF) != 0)
|
||||||
agent_control_v3 += Dir_Vectors[i];
|
|
||||||
if ((m_movementflag & (uint)DCF) == 0)
|
|
||||||
{
|
{
|
||||||
m_movementflag += (byte)(uint)DCF;
|
DCFlagKeyPressed = true;
|
||||||
update_movementflag = true;
|
agent_control_v3 += Dir_Vectors[i];
|
||||||
|
if ((m_movementflag & (uint)DCF) == 0)
|
||||||
|
{
|
||||||
|
m_movementflag += (byte)(uint)DCF;
|
||||||
|
update_movementflag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((m_movementflag & (uint)DCF) != 0)
|
|
||||||
{
|
{
|
||||||
m_movementflag -= (byte)(uint)DCF;
|
if ((m_movementflag & (uint)DCF) != 0)
|
||||||
update_movementflag = true;
|
{
|
||||||
|
m_movementflag -= (byte)(uint)DCF;
|
||||||
|
update_movementflag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
|
if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
|
||||||
{
|
{
|
||||||
AddNewMovement(agent_control_v3, q);
|
AddNewMovement(agent_control_v3, q);
|
||||||
|
@ -488,6 +509,46 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
UpdateMovementAnimations(update_movementflag);
|
UpdateMovementAnimations(update_movementflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void StandUp()
|
||||||
|
{
|
||||||
|
if (m_parentID != 0)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
|
||||||
|
if (part != null)
|
||||||
|
AbsolutePosition = part.AbsolutePosition;
|
||||||
|
m_parentID = 0;
|
||||||
|
SendFullUpdateToAllClients();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID)
|
||||||
|
{
|
||||||
|
if (m_parentID != 0)
|
||||||
|
{
|
||||||
|
StandUp();
|
||||||
|
UpdateMovementAnimations(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
|
||||||
|
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
m_requestedSitTargetID = part.LocalID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("Sit requested on unknown object: " + targetID.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID)
|
||||||
|
{
|
||||||
|
AbsolutePosition = new LLVector3(0F, 0F, 0F);
|
||||||
|
m_parentID = m_requestedSitTargetID;
|
||||||
|
SendAnimPack(Animations.AnimsLLUUID["SIT"], 1);
|
||||||
|
SendFullUpdateToAllClients();
|
||||||
|
}
|
||||||
|
|
||||||
protected void UpdateMovementAnimations(bool update_movementflag)
|
protected void UpdateMovementAnimations(bool update_movementflag)
|
||||||
{
|
{
|
||||||
if (update_movementflag)
|
if (update_movementflag)
|
||||||
|
@ -641,7 +702,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
|
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
|
||||||
{
|
{
|
||||||
remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
|
remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
|
||||||
LocalId, AbsolutePosition, m_textureEntry.ToBytes());
|
LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendFullUpdateToAllClients()
|
public void SendFullUpdateToAllClients()
|
||||||
|
@ -667,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SendInitialData()
|
public void SendInitialData()
|
||||||
{
|
{
|
||||||
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
|
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
|
||||||
AbsolutePosition, m_textureEntry.ToBytes());
|
AbsolutePosition, m_textureEntry.ToBytes(), m_parentID);
|
||||||
if (!m_isChildAgent)
|
if (!m_isChildAgent)
|
||||||
{
|
{
|
||||||
m_scene.InformClientOfNeighbours(m_controllingClient);
|
m_scene.InformClientOfNeighbours(m_controllingClient);
|
||||||
|
|
|
@ -68,6 +68,8 @@ namespace SimpleApp
|
||||||
public event GenericCall OnRequestWearables;
|
public event GenericCall OnRequestWearables;
|
||||||
public event GenericCall2 OnCompleteMovementToRegion;
|
public event GenericCall2 OnCompleteMovementToRegion;
|
||||||
public event UpdateAgent OnAgentUpdate;
|
public event UpdateAgent OnAgentUpdate;
|
||||||
|
public event AgentRequestSit OnAgentRequestSit;
|
||||||
|
public event AgentSit OnAgentSit;
|
||||||
public event GenericCall OnRequestAvatarsData;
|
public event GenericCall OnRequestAvatarsData;
|
||||||
public event AddNewPrim OnAddPrim;
|
public event AddNewPrim OnAddPrim;
|
||||||
public event ObjectDuplicate OnObjectDuplicate;
|
public event ObjectDuplicate OnObjectDuplicate;
|
||||||
|
@ -179,7 +181,7 @@ namespace SimpleApp
|
||||||
public virtual void SendTeleportLocationStart() { }
|
public virtual void SendTeleportLocationStart() { }
|
||||||
public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
|
public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
|
||||||
|
|
||||||
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { }
|
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { }
|
||||||
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { }
|
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { }
|
||||||
public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { }
|
public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { }
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,5 @@
|
||||||
<animation name="STAND">2408fe9e-df1d-1d7d-f4ff-1384fa7b350f</animation>
|
<animation name="STAND">2408fe9e-df1d-1d7d-f4ff-1384fa7b350f</animation>
|
||||||
<animation name="WALK">6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0</animation>
|
<animation name="WALK">6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0</animation>
|
||||||
<animation name="FLY">aec4610c-757f-bc4e-c092-c6e9caf18daf</animation>
|
<animation name="FLY">aec4610c-757f-bc4e-c092-c6e9caf18daf</animation>
|
||||||
|
<animation name="SIT">1a5fe8ac-a804-8a5d-7cbd-56bd83184568</animation>
|
||||||
</animations>
|
</animations>
|
Loading…
Reference in New Issue