* 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,7 +2000,10 @@ 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)
|
||||||
|
{
|
||||||
|
if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, editobj))
|
||||||
{
|
{
|
||||||
#region position
|
#region position
|
||||||
|
|
||||||
|
@ -2111,6 +2114,13 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
#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)
|
||||||
|
@ -826,10 +884,30 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
|
{
|
||||||
|
if (part.GetAvatarOnSitTarget() == UUID)
|
||||||
|
{
|
||||||
|
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_pos -= part.AbsolutePosition;
|
||||||
m_parentPosition = 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,12 +2162,20 @@ 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();
|
||||||
|
|
||||||
|
if (AVID != LLUUID.Zero)
|
||||||
|
return AVID.ToString();
|
||||||
|
else
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue