* Added slightly better object sit handling
* Added sit handling for sit targets * Implemented llSitTarget() * Implemented llAvatarOnSitTarget() * Sit targets do not persist sim restart.afrisby
parent
54d9fbc0fe
commit
87d55443d3
|
@ -2000,117 +2000,127 @@ namespace OpenSim.Region.ClientStack
|
||||||
// Can't act on Null Data
|
// Can't act on Null Data
|
||||||
if (multipleupdate.ObjectData[i].Data != null)
|
if (multipleupdate.ObjectData[i].Data != null)
|
||||||
{
|
{
|
||||||
if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID))
|
LLUUID editobj = tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID;
|
||||||
|
if (editobj != null)
|
||||||
{
|
{
|
||||||
#region position
|
if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, editobj))
|
||||||
|
{
|
||||||
|
#region position
|
||||||
|
|
||||||
if (multipleupdate.ObjectData[i].Type == 9) //change position
|
if (multipleupdate.ObjectData[i].Type == 9) //change position
|
||||||
{
|
|
||||||
if (OnUpdatePrimGroupPosition != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
if (OnUpdatePrimGroupPosition != null)
|
||||||
OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
{
|
||||||
|
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||||
|
OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position
|
||||||
else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimSinglePosition != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
if (OnUpdatePrimSinglePosition != null)
|
||||||
// System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
|
{
|
||||||
OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||||
|
// System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
|
||||||
|
OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion position
|
||||||
#endregion position
|
#region rotation
|
||||||
#region rotation
|
|
||||||
|
|
||||||
else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab
|
else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab
|
||||||
{
|
|
||||||
if (OnUpdatePrimSingleRotation != null)
|
|
||||||
{
|
{
|
||||||
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
if (OnUpdatePrimSingleRotation != null)
|
||||||
//System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
{
|
||||||
OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
|
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
||||||
|
//System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
||||||
|
OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse
|
||||||
else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimSingleRotation != null)
|
|
||||||
{
|
{
|
||||||
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
|
if (OnUpdatePrimSingleRotation != null)
|
||||||
//System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
{
|
||||||
OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
|
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
|
||||||
|
//System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
||||||
|
OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab
|
||||||
else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimGroupRotation != null)
|
|
||||||
{
|
{
|
||||||
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
if (OnUpdatePrimGroupRotation != null)
|
||||||
// Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
{
|
||||||
OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
|
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
||||||
|
// Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
||||||
|
OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse
|
||||||
else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimGroupMouseRotation != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
if (OnUpdatePrimGroupMouseRotation != null)
|
||||||
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
|
{
|
||||||
//Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
|
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||||
// Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
|
||||||
OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
|
//Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
|
||||||
|
// Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
|
||||||
|
OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
#endregion
|
#region scale
|
||||||
#region scale
|
|
||||||
|
|
||||||
else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab
|
else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab
|
||||||
{
|
|
||||||
if (OnUpdatePrimScale != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
if (OnUpdatePrimScale != null)
|
||||||
//Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
{
|
||||||
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
||||||
|
//Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||||
|
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
||||||
|
|
||||||
// Change the position based on scale (for bug number 246)
|
// Change the position based on scale (for bug number 246)
|
||||||
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||||
// System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
|
// System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
|
||||||
OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse
|
||||||
else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimScale != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
if (OnUpdatePrimScale != null)
|
||||||
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
|
{
|
||||||
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
||||||
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
|
||||||
OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
||||||
|
LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||||
|
OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab
|
||||||
else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimScale != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
if (OnUpdatePrimScale != null)
|
||||||
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
{
|
||||||
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
||||||
|
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||||
|
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse
|
||||||
else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse
|
|
||||||
{
|
|
||||||
if (OnUpdatePrimScale != null)
|
|
||||||
{
|
{
|
||||||
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
if (OnUpdatePrimScale != null)
|
||||||
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
{
|
||||||
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
||||||
|
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||||
|
OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
}
|
||||||
|
} // editobj != null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// It's a ghost! tell the client to delete it from view.
|
||||||
|
simClient.SendKillObject(this.Scene.RegionInfo.RegionHandle, multipleupdate.ObjectData[i].ObjectLocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -123,9 +123,9 @@ namespace OpenSim.Region.ClientStack
|
||||||
/// <param name="circuitcode"></param>
|
/// <param name="circuitcode"></param>
|
||||||
public virtual void CloseCircuit(uint circuitcode)
|
public virtual void CloseCircuit(uint circuitcode)
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainLog.Instance.Debug("PACKETSERVER", "Removing Circuit Code");
|
|
||||||
m_networkHandler.RemoveClientCircuit(circuitcode);
|
m_networkHandler.RemoveClientCircuit(circuitcode);
|
||||||
OpenSim.Framework.Console.MainLog.Instance.Debug("PACKETSERVER", "Removed Circuit Code");
|
|
||||||
//m_scene.ClientManager.CloseAllAgents(circuitcode);
|
//m_scene.ClientManager.CloseAllAgents(circuitcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,9 +326,9 @@ namespace OpenSim.Region.ClientStack
|
||||||
uint circuit;
|
uint circuit;
|
||||||
if (clientCircuits.TryGetValue(sender, out circuit))
|
if (clientCircuits.TryGetValue(sender, out circuit))
|
||||||
{
|
{
|
||||||
MainLog.Instance.Debug("UDPSERVER", "CloseEndPoint:ClosingCircuit");
|
|
||||||
m_packetServer.CloseCircuit(circuit);
|
m_packetServer.CloseCircuit(circuit);
|
||||||
MainLog.Instance.Debug("UDPSERVER", "CloseEndPoint:ClosedCircuit");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,13 +381,13 @@ namespace OpenSim.Region.ClientStack
|
||||||
EndPoint sendto = null;
|
EndPoint sendto = null;
|
||||||
if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
|
if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
|
||||||
{
|
{
|
||||||
MainLog.Instance.Debug("UDPSERVER", "RemovingClientCircuit");
|
|
||||||
clientCircuits.Remove(sendto);
|
|
||||||
MainLog.Instance.Debug("UDPSERVER", "Removed Client Circuit");
|
|
||||||
|
|
||||||
MainLog.Instance.Debug("UDPSERVER", "Removing Reverse ClientCircuit");
|
clientCircuits.Remove(sendto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clientCircuits_reverse.Remove(circuitcode);
|
clientCircuits_reverse.Remove(circuitcode);
|
||||||
MainLog.Instance.Debug("UDPSERVER", "Removed Reverse ClientCircuit");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public Int32 CreationDate;
|
public Int32 CreationDate;
|
||||||
public uint ParentID = 0;
|
public uint ParentID = 0;
|
||||||
|
|
||||||
|
private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0);
|
||||||
|
private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1);
|
||||||
|
private LLUUID m_SitTargetAvatar = LLUUID.Zero;
|
||||||
|
|
||||||
|
|
||||||
// Main grid has default permissions as follows
|
// Main grid has default permissions as follows
|
||||||
//
|
//
|
||||||
public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER;
|
public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER;
|
||||||
|
@ -161,6 +166,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
//unkown if this will be kept, added as a way of removing the group position from the group class
|
//unkown if this will be kept, added as a way of removing the group position from the group class
|
||||||
protected LLVector3 m_groupPosition;
|
protected LLVector3 m_groupPosition;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LLVector3 GroupPosition
|
public LLVector3 GroupPosition
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -774,6 +781,33 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_parentGroup = parent;
|
m_parentGroup = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSitTarget(Vector3 offset, Quaternion orientation)
|
||||||
|
{
|
||||||
|
m_sitTargetPosition = offset;
|
||||||
|
m_sitTargetOrientation = orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 GetSitTargetPosition()
|
||||||
|
{
|
||||||
|
return m_sitTargetPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Quaternion GetSitTargetOrientation()
|
||||||
|
{
|
||||||
|
return m_sitTargetOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAvatarOnSitTarget(LLUUID avatarID)
|
||||||
|
{
|
||||||
|
m_SitTargetAvatar = avatarID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLUUID GetAvatarOnSitTarget()
|
||||||
|
{
|
||||||
|
return m_SitTargetAvatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public LLUUID GetRootPartUUID()
|
public LLUUID GetRootPartUUID()
|
||||||
{
|
{
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
|
|
|
@ -537,7 +537,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// and send a full object update.
|
// and send a full object update.
|
||||||
// There's no message to send the client to tell it to stop flying
|
// There's no message to send the client to tell it to stop flying
|
||||||
|
|
||||||
// Add 1/2 the avatar's height to it's position so it doesn't shoot into the air
|
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
|
||||||
// when the avatar stands up
|
// when the avatar stands up
|
||||||
|
|
||||||
AbsolutePosition = AbsolutePosition + new LLVector3(0, 0, (m_avHeight/6));
|
AbsolutePosition = AbsolutePosition + new LLVector3(0, 0, (m_avHeight/6));
|
||||||
|
@ -748,6 +748,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (m_parentID != 0)
|
if (m_parentID != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
// Reset sit target.
|
||||||
|
if (part.GetAvatarOnSitTarget() == UUID)
|
||||||
|
part.SetAvatarOnSitTarget(LLUUID.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
|
m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
|
||||||
m_parentPosition = new LLVector3();
|
m_parentPosition = new LLVector3();
|
||||||
|
|
||||||
|
@ -769,6 +778,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
bool autopilot = true;
|
bool autopilot = true;
|
||||||
LLVector3 pos = new LLVector3();
|
LLVector3 pos = new LLVector3();
|
||||||
|
LLQuaternion sitOrientation = new LLQuaternion(0,0,0,1);
|
||||||
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
|
@ -776,27 +786,74 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
|
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
|
||||||
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
|
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
|
||||||
|
|
||||||
|
|
||||||
|
// Is a sit target available?
|
||||||
|
Vector3 avSitOffSet = part.GetSitTargetPosition();
|
||||||
|
Quaternion avSitOrientation = part.GetSitTargetOrientation();
|
||||||
|
LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget();
|
||||||
|
|
||||||
|
bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero));
|
||||||
|
bool SitTargetisSet = (!(avSitOffSet.x == 0 && avSitOffSet.y == 0 && avSitOffSet.z == 0 && avSitOrientation.w == 0 && avSitOrientation.x == 0 && avSitOrientation.y == 0 && avSitOrientation.z == 1));
|
||||||
|
|
||||||
|
if (SitTargetisSet && SitTargetUnOccupied)
|
||||||
|
{
|
||||||
|
part.SetAvatarOnSitTarget(UUID);
|
||||||
|
offset = new LLVector3(avSitOffSet.x,avSitOffSet.y,avSitOffSet.z);
|
||||||
|
sitOrientation = new LLQuaternion(avSitOrientation.w,avSitOrientation.x,avSitOrientation.y,avSitOrientation.z);
|
||||||
|
autopilot = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pos = part.AbsolutePosition + offset;
|
pos = part.AbsolutePosition + offset;
|
||||||
|
|
||||||
if (m_physicsActor != null)
|
if (m_physicsActor != null)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// If we're not using the client autopilot, we're immediately warping the avatar to the location
|
||||||
|
// We can remove the physicsActor until they stand up.
|
||||||
|
//
|
||||||
m_sitAvatarHeight = m_physicsActor.Size.Z;
|
m_sitAvatarHeight = m_physicsActor.Size.Z;
|
||||||
}
|
|
||||||
|
|
||||||
// this doesn't seem to quite work yet....
|
if (autopilot)
|
||||||
// // if we're close, set the avatar position to the target position and forgo autopilot
|
{
|
||||||
// if (AbsolutePosition.GetDistanceTo(pos) < 2.5)
|
|
||||||
// {
|
if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
|
||||||
// autopilot = false;
|
{
|
||||||
// AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight);
|
autopilot = false;
|
||||||
// }
|
|
||||||
}
|
RemoveFromPhysicalScene();
|
||||||
|
AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoveFromPhysicalScene();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} // Physactor != null
|
||||||
|
} // part != null
|
||||||
|
|
||||||
|
|
||||||
avatarSitResponse.SitTransform.AutoPilot = autopilot;
|
avatarSitResponse.SitTransform.AutoPilot = autopilot;
|
||||||
avatarSitResponse.SitTransform.SitPosition = offset;
|
avatarSitResponse.SitTransform.SitPosition = offset;
|
||||||
avatarSitResponse.SitTransform.SitRotation = new LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f);
|
avatarSitResponse.SitTransform.SitRotation = sitOrientation;
|
||||||
|
|
||||||
remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task);
|
remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task);
|
||||||
|
|
||||||
|
// This calls HandleAgentSit twice, once from here, and the client calls
|
||||||
|
// HandleAgentSit itself after it gets to the location
|
||||||
|
// It doesn't get to the location until we've moved them there though
|
||||||
|
// which happens in HandleAgentSit :P
|
||||||
|
if (!autopilot)
|
||||||
|
HandleAgentSit(remoteClient, UUID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset)
|
public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset)
|
||||||
|
@ -806,7 +863,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
StandUp();
|
StandUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
SendSitResponse(remoteClient, targetID, offset);
|
|
||||||
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
|
||||||
|
|
||||||
|
@ -819,6 +876,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("Sit requested on unknown object: " + targetID.ToString());
|
MainLog.Instance.Warn("Sit requested on unknown object: " + targetID.ToString());
|
||||||
}
|
}
|
||||||
|
SendSitResponse(remoteClient, targetID, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID)
|
public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID)
|
||||||
|
@ -827,8 +885,28 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
m_pos -= part.AbsolutePosition;
|
if (part.GetAvatarOnSitTarget() == UUID)
|
||||||
m_parentPosition = part.AbsolutePosition;
|
{
|
||||||
|
Vector3 sitTargetPos = part.GetSitTargetPosition();
|
||||||
|
Quaternion sitTargetOrient = part.GetSitTargetOrientation();
|
||||||
|
|
||||||
|
//Quaternion vq = new Quaternion(sitTargetPos.x, sitTargetPos.y+0.2f, sitTargetPos.z+0.2f, 0);
|
||||||
|
//Quaternion nq = new Quaternion(sitTargetOrient.w, -sitTargetOrient.x, -sitTargetOrient.y, -sitTargetOrient.z);
|
||||||
|
|
||||||
|
//Quaternion result = (sitTargetOrient * vq) * nq;
|
||||||
|
|
||||||
|
m_pos = new LLVector3(sitTargetPos.x, sitTargetPos.y, sitTargetPos.z);
|
||||||
|
m_bodyRot = sitTargetOrient;
|
||||||
|
//Rotation = sitTargetOrient;
|
||||||
|
m_parentPosition = part.AbsolutePosition;
|
||||||
|
|
||||||
|
//SendTerseUpdateToAllClients();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pos -= part.AbsolutePosition;
|
||||||
|
m_parentPosition = part.AbsolutePosition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parentID = m_requestedSitTargetID;
|
m_parentID = m_requestedSitTargetID;
|
||||||
|
@ -838,6 +916,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
SetMovementAnimation(Animations.AnimsLLUUID["SIT"], 1);
|
SetMovementAnimation(Animations.AnimsLLUUID["SIT"], 1);
|
||||||
SendFullUpdateToAllClients();
|
SendFullUpdateToAllClients();
|
||||||
|
// This may seem stupid, but Our Full updates don't send avatar rotation :P
|
||||||
|
// So we're also sending a terse update (which has avatar rotation)
|
||||||
|
SendTerseUpdateToAllClients();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2162,13 +2162,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
|
|
||||||
public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot)
|
public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot)
|
||||||
{
|
{
|
||||||
NotImplemented("llSitTarget");
|
// LSL quaternions can normalize to 0, normal Quaternions can't.
|
||||||
|
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
|
||||||
|
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
|
||||||
|
|
||||||
|
m_host.SetSitTarget(new Vector3((float)offset.x, (float)offset.y, (float)offset.z), new Quaternion((float)rot.s, (float)rot.x, (float)rot.y, (float)rot.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string llAvatarOnSitTarget()
|
public string llAvatarOnSitTarget()
|
||||||
{
|
{
|
||||||
NotImplemented("llAvatarOnSitTarget");
|
LLUUID AVID = m_host.GetAvatarOnSitTarget();
|
||||||
return "";
|
|
||||||
|
if (AVID != LLUUID.Zero)
|
||||||
|
return AVID.ToString();
|
||||||
|
else
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llAddToLandPassList(string avatar, double hours)
|
public void llAddToLandPassList(string avatar, double hours)
|
||||||
|
|
Loading…
Reference in New Issue