Merge branch 'master' into varregion

varregion
Robert Adams 2013-12-01 15:51:42 -08:00
commit 31bacfbb63
10 changed files with 8616 additions and 8079 deletions

View File

@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL
DataTable schemaTable = result.GetSchemaTable(); DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows) foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["ColumnName"].ToString()); m_ColumnNames.Add(row["column_name"].ToString());
} }
foreach (string s in m_ColumnNames) foreach (string s in m_ColumnNames)
@ -376,7 +376,7 @@ namespace OpenSim.Data.PGSQL
private List<RegionData> Get(int regionFlags, UUID scopeID) private List<RegionData> Get(int regionFlags, UUID scopeID)
{ {
string sql = "SELECT * FROM " + m_Realm + " WHERE (flags & " + regionFlags.ToString() + ") <> 0"; string sql = "SELECT * FROM " + m_Realm + " WHERE (\"flags\" & " + regionFlags.ToString() + ") <> 0";
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
sql += " AND \"ScopeID\" = :scopeID"; sql += " AND \"ScopeID\" = :scopeID";

View File

@ -296,6 +296,11 @@ namespace OpenSim
"Change the scale of a named prim", "Change the scale of a named prim",
HandleEditScale); HandleEditScale);
m_console.Commands.AddCommand("Objects", false, "rotate scene",
"rotate scene <degrees>",
"Rotates all scene objects around x:128, y:128",
HandleRotateScene);
m_console.Commands.AddCommand("Users", false, "kick user", m_console.Commands.AddCommand("Users", false, "kick user",
"kick user <first> <last> [--force] [message]", "kick user <first> <last> [--force] [message]",
"Kick a user off the simulator", "Kick a user off the simulator",
@ -505,6 +510,45 @@ namespace OpenSim
} }
} }
private void HandleRotateScene(string module, string[] args)
{
string usage = "Usage: rotate scene <angle in degrees> [centerX centerY] (centerX and centerY are optional and default to Constants.RegionSize / 2";
float centerX = Constants.RegionSize * 0.5f;
float centerY = Constants.RegionSize * 0.5f;
if (args.Length < 3 || args.Length == 4)
{
MainConsole.Instance.Output(usage);
return;
}
float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI);
OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle);
if (args.Length > 4)
{
centerX = Convert.ToSingle(args[3]);
centerY = Convert.ToSingle(args[4]);
}
Vector3 center = new Vector3(centerX, centerY, 0.0f);
SceneManager.ForEachSelectedScene(delegate(Scene scene)
{
scene.ForEachSOG(delegate(SceneObjectGroup sog)
{
if (sog.AttachmentPoint == 0)
{
sog.RootPart.UpdateRotation(rot * sog.GroupRotation);
Vector3 offset = sog.AbsolutePosition - center;
offset *= rot;
sog.UpdateGroupPosition(center + offset);
}
});
});
}
/// <summary> /// <summary>
/// Creates a new region based on the parameters specified. This will ask the user questions on the console /// Creates a new region based on the parameters specified. This will ask the user questions on the console
/// </summary> /// </summary>

View File

@ -2607,11 +2607,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket(); AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
avatarSitResponse.SitObject.ID = TargetID; avatarSitResponse.SitObject.ID = TargetID;
if (CameraAtOffset != Vector3.Zero) avatarSitResponse.SitTransform.CameraAtOffset = CameraAtOffset;
{ avatarSitResponse.SitTransform.CameraEyeOffset = CameraEyeOffset;
avatarSitResponse.SitTransform.CameraAtOffset = CameraAtOffset;
avatarSitResponse.SitTransform.CameraEyeOffset = CameraEyeOffset;
}
avatarSitResponse.SitTransform.ForceMouselook = ForceMouseLook; avatarSitResponse.SitTransform.ForceMouselook = ForceMouseLook;
avatarSitResponse.SitTransform.AutoPilot = autopilot; avatarSitResponse.SitTransform.AutoPilot = autopilot;
avatarSitResponse.SitTransform.SitPosition = OffsetPos; avatarSitResponse.SitTransform.SitPosition = OffsetPos;
@ -5051,6 +5048,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
ScenePresence presence = (ScenePresence)entity; ScenePresence presence = (ScenePresence)entity;
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
attachPoint = presence.State; attachPoint = presence.State;
collisionPlane = presence.CollisionPlane; collisionPlane = presence.CollisionPlane;
position = presence.OffsetPosition; position = presence.OffsetPosition;
@ -5170,6 +5170,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
{ {
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name);
byte[] objectData = new byte[76]; byte[] objectData = new byte[76];
data.CollisionPlane.ToBytes(objectData, 0); data.CollisionPlane.ToBytes(objectData, 0);
@ -5190,7 +5193,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " +
data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle);
update.ObjectData = objectData; update.ObjectData = objectData;
update.ParentID = data.ParentID;
SceneObjectPart parentPart = data.ParentPart;
if (parentPart != null)
update.ParentID = parentPart.ParentGroup.LocalId;
else
update.ParentID = 0;
update.PathCurve = 16; update.PathCurve = 16;
update.PathScaleX = 100; update.PathScaleX = 100;
update.PathScaleY = 100; update.PathScaleY = 100;
@ -12615,6 +12624,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
if (p is ScenePresence) if (p is ScenePresence)
{ {
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}",
// p.Name, Name, Scene.Name);
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
// There's no explicit message to send the client to tell it to stop flying.. it relies on the // There's no explicit message to send the client to tell it to stop flying.. it relies on the
// velocity, collision plane and avatar height // velocity, collision plane and avatar height

View File

@ -403,11 +403,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
Falling = false; Falling = false;
// Walking / crouchwalking / running // Walking / crouchwalking / running
if (move.Z < 0f) if (move.Z < 0f)
{
return "CROUCHWALK"; return "CROUCHWALK";
else if (m_scenePresence.SetAlwaysRun) }
return "RUN"; // We need to prevent these animations if the user tries to make their avatar walk or run whilst
else // specifying AGENT_CONTROL_STOP (pressing down space on viewers).
return "WALK"; else if (!m_scenePresence.AgentControlStopActive)
{
if (m_scenePresence.SetAlwaysRun)
return "RUN";
else
return "WALK";
}
} }
else if (!m_jumping) else if (!m_jumping)
{ {
@ -435,6 +442,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// <returns>'true' if the animation was changed</returns> /// <returns>'true' if the animation was changed</returns>
public bool UpdateMovementAnimations() public bool UpdateMovementAnimations()
{ {
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name);
bool ret = false; bool ret = false;
lock (m_animations) lock (m_animations)
{ {

View File

@ -789,16 +789,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e); m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
} }
} }
// TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
if (SitTargetAvatar != UUID.Zero)
{
ScenePresence avatar;
if (ParentGroup.Scene.TryGetScenePresence(SitTargetAvatar, out avatar))
{
avatar.ParentPosition = GetWorldPosition();
}
}
} }
} }

View File

@ -351,15 +351,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Record user movement inputs. /// Record user movement inputs.
/// </summary> /// </summary>
public byte MovementFlag { get; private set; } public uint MovementFlag { get; private set; }
private bool m_updateflag; /// <summary>
/// Is the agent stop control flag currently active?
public bool Updated /// </summary>
{ public bool AgentControlStopActive { get; private set; }
set { m_updateflag = value; }
get { return m_updateflag; }
}
private bool m_invulnerable = true; private bool m_invulnerable = true;
@ -480,8 +477,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return (IClientCore)ControllingClient; } get { return (IClientCore)ControllingClient; }
} }
public Vector3 ParentPosition { get; set; }
/// <summary> /// <summary>
/// Position of this avatar relative to the region the avatar is in /// Position of this avatar relative to the region the avatar is in
/// </summary> /// </summary>
@ -499,6 +494,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Fetching abs pos where PhysicsActor == null and parent part {0} for {1}", Name, Scene.Name);
// Obtain the correct position of a seated avatar. // Obtain the correct position of a seated avatar.
// In addition to providing the correct position while // In addition to providing the correct position while
// the avatar is seated, this value will also // the avatar is seated, this value will also
@ -522,7 +518,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
set set
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} in {1} to {2}", Name, Scene.Name, value); // m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} to {1} in {2}", Name, value, Scene.Name);
// Util.PrintCallStack(); // Util.PrintCallStack();
if (PhysicsActor != null) if (PhysicsActor != null)
@ -539,10 +535,7 @@ namespace OpenSim.Region.Framework.Scenes
// Don't update while sitting. The PhysicsActor above is null whilst sitting. // Don't update while sitting. The PhysicsActor above is null whilst sitting.
if (ParentID == 0) if (ParentID == 0)
{
m_pos = value; m_pos = value;
ParentPosition = Vector3.Zero;
}
//m_log.DebugFormat( //m_log.DebugFormat(
// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@ -769,6 +762,14 @@ namespace OpenSim.Region.Framework.Scenes
set { m_speedModifier = value; } set { m_speedModifier = value; }
} }
/// <summary>
/// Modifier for agent movement if we get an AGENT_CONTROL_STOP whilst walking or running
/// </summary>
/// <remarks>
/// AGENT_CONTRL_STOP comes about if user holds down space key on viewers.
/// </remarks>
private float AgentControlStopSlowWhilstMoving = 0.5f;
private bool m_forceFly; private bool m_forceFly;
public bool ForceFly public bool ForceFly
@ -1635,7 +1636,6 @@ namespace OpenSim.Region.Framework.Scenes
if ((oldState & (uint)AgentState.Editing) != 0 && State == (uint)AgentState.None) if ((oldState & (uint)AgentState.Editing) != 0 && State == (uint)AgentState.None)
ControllingClient.SendAgentTerseUpdate(this); ControllingClient.SendAgentTerseUpdate(this);
PhysicsActor actor = PhysicsActor; PhysicsActor actor = PhysicsActor;
if (actor == null) if (actor == null)
{ {
@ -1696,10 +1696,7 @@ namespace OpenSim.Region.Framework.Scenes
else else
dirVectors = Dir_Vectors; dirVectors = Dir_Vectors;
// The fact that MovementFlag is a byte needs to be fixed
// it really should be a uint
// A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
uint nudgehack = 250;
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{ {
if (((uint)flags & (uint)DCF) != 0) if (((uint)flags & (uint)DCF) != 0)
@ -1716,29 +1713,19 @@ namespace OpenSim.Region.Framework.Scenes
// Why did I get this? // Why did I get this?
} }
if ((MovementFlag & (byte)(uint)DCF) == 0) if (((MovementFlag & (uint)DCF) == 0) & !AgentControlStopActive)
{ {
if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE ||
DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT_NUDGE)
{
MovementFlag |= (byte)nudgehack;
}
//m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF);
MovementFlag += (byte)(uint)DCF; MovementFlag += (uint)DCF;
update_movementflag = true; update_movementflag = true;
} }
} }
else else
{ {
if ((MovementFlag & (byte)(uint)DCF) != 0 || if ((MovementFlag & (uint)DCF) != 0)
((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE ||
DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT_NUDGE)
&& ((MovementFlag & (byte)nudgehack) == nudgehack))
) // This or is for Nudge forward
{ {
//m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF);
MovementFlag -= ((byte)(uint)DCF); MovementFlag -= (uint)DCF;
update_movementflag = true; update_movementflag = true;
/* /*
@ -1758,6 +1745,13 @@ namespace OpenSim.Region.Framework.Scenes
i++; i++;
} }
// Detect AGENT_CONTROL_STOP state changes
if (AgentControlStopActive != ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STOP) != 0))
{
AgentControlStopActive = !AgentControlStopActive;
update_movementflag = true;
}
if (MovingToTarget) if (MovingToTarget)
{ {
// If the user has pressed a key then we want to cancel any move to target. // If the user has pressed a key then we want to cancel any move to target.
@ -1783,53 +1777,79 @@ namespace OpenSim.Region.Framework.Scenes
// Only do this if we're flying // Only do this if we're flying
if (Flying && !ForceFly) if (Flying && !ForceFly)
{ {
// Landing detection code // Need to stop in mid air if user holds down AGENT_CONTROL_STOP
if (AgentControlStopActive)
// Are the landing controls requirements filled?
bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
//m_log.Debug("[CONTROL]: " +flags);
// Applies a satisfying roll effect to the avatar when flying.
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0 && (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
{ {
ApplyFlyingRoll( agent_control_v3 = Vector3.Zero;
FLY_ROLL_RADIANS_PER_UPDATE,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
}
else if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0 &&
(flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
{
ApplyFlyingRoll(
-FLY_ROLL_RADIANS_PER_UPDATE,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
} }
else else
{ {
if (m_AngularVelocity.Z != 0) // Landing detection code
m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
}
if (Flying && IsColliding && controlland) // Are the landing controls requirements filled?
{ bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
// nesting this check because LengthSquared() is expensive and we don't ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
// want to do it every step when flying.
if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX)) //m_log.Debug("[CONTROL]: " +flags);
StopFlying(); // Applies a satisfying roll effect to the avatar when flying.
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0 && (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
{
ApplyFlyingRoll(
FLY_ROLL_RADIANS_PER_UPDATE,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
}
else if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0 &&
(flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
{
ApplyFlyingRoll(
-FLY_ROLL_RADIANS_PER_UPDATE,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
(flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
}
else
{
if (m_AngularVelocity.Z != 0)
m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
}
if (Flying && IsColliding && controlland)
{
// nesting this check because LengthSquared() is expensive and we don't
// want to do it every step when flying.
if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX))
StopFlying();
}
} }
} }
// m_log.DebugFormat("[SCENE PRESENCE]: MovementFlag {0} for {1}", MovementFlag, Name);
// If the agent update does move the avatar, then calculate the force ready for the velocity update, // If the agent update does move the avatar, then calculate the force ready for the velocity update,
// which occurs later in the main scene loop // which occurs later in the main scene loop
if (update_movementflag || (update_rotation && DCFlagKeyPressed)) // We also need to update if the user rotates their avatar whilst it is slow walking/running (if they
// held down AGENT_CONTROL_STOP whilst normal walking/running). However, we do not want to update
// if the user rotated whilst holding down AGENT_CONTROL_STOP when already still (which locks the
// avatar location in place).
if (update_movementflag
|| (update_rotation && DCFlagKeyPressed && (!AgentControlStopActive || MovementFlag != 0)))
{ {
// m_log.DebugFormat( // if (update_movementflag || !AgentControlStopActive || MovementFlag != 0)
// "[SCENE PRESENCE]: In {0} adding velocity of {1} to {2}, umf = {3}, ur = {4}", // {
// m_scene.RegionInfo.RegionName, agent_control_v3, Name, update_movementflag, update_rotation); // m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} adding velocity of {1} to {2}, umf = {3}, mf = {4}, ur = {5}",
// m_scene.RegionInfo.RegionName, agent_control_v3, Name,
// update_movementflag, MovementFlag, update_rotation);
AddNewMovement(agent_control_v3); float speedModifier;
if (AgentControlStopActive)
speedModifier = AgentControlStopSlowWhilstMoving;
else
speedModifier = 1;
AddNewMovement(agent_control_v3, speedModifier);
// }
} }
// else // else
// { // {
@ -1842,7 +1862,10 @@ namespace OpenSim.Region.Framework.Scenes
// } // }
if (update_movementflag && ParentID == 0) if (update_movementflag && ParentID == 0)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Updating movement animations for {0}", Name);
Animator.UpdateMovementAnimations(); Animator.UpdateMovementAnimations();
}
SendControlsToScripts(flagsForScripts); SendControlsToScripts(flagsForScripts);
} }
@ -2170,13 +2193,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); // m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
bool satOnObject = IsSatOnObject;
SceneObjectPart part = ParentPart;
SitGround = false; SitGround = false;
if (PhysicsActor == null)
AddToPhysicalScene(false);
if (ParentID != 0) if (satOnObject)
{ {
SceneObjectPart part = ParentPart;
TaskInventoryDictionary taskIDict = part.TaskInventory; TaskInventoryDictionary taskIDict = part.TaskInventory;
if (taskIDict != null) if (taskIDict != null)
{ {
@ -2192,21 +2214,64 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
ParentPosition = part.GetWorldPosition(); Vector3 sitPartWorldPosition = part.GetWorldPosition();
ControllingClient.SendClearFollowCamProperties(part.ParentUUID); ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
ParentPosition = Vector3.Zero;
ParentID = 0; ParentID = 0;
ParentPart = null; ParentPart = null;
Quaternion standRotation;
if (part.SitTargetAvatar == UUID)
{
standRotation = part.GetWorldRotation();
if (!part.IsRoot)
standRotation = standRotation * part.SitTargetOrientation;
// standRotation = part.RotationOffset * part.SitTargetOrientation;
// else
// standRotation = part.SitTargetOrientation;
}
else
{
standRotation = Rotation;
}
//Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
//Vector3 standPos = ParentPosition;
// Vector3 standPositionAdjustment
// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f);
Vector3 adjustmentForSitPosition = part.SitTargetPosition * part.GetWorldRotation();
// XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than
// hardcoding here.
Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation;
Vector3 standPos = sitPartWorldPosition + adjustmentForSitPosition + adjustmentForSitPose;
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}",
// standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name);
Rotation = standRotation;
AbsolutePosition = standPos;
}
// We need to wait until we have calculated proper stand positions before sitting up the physical
// avatar to avoid race conditions.
if (PhysicsActor == null)
AddToPhysicalScene(false);
if (satOnObject)
{
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();
m_requestedSitTargetID = 0; m_requestedSitTargetID = 0;
part.RemoveSittingAvatar(UUID); part.RemoveSittingAvatar(UUID);
if (part != null) part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
} }
Animator.TrySetMovementAnimation("STAND"); Animator.TrySetMovementAnimation("STAND");
@ -2264,7 +2329,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sitAvatarHeight = PhysicsActor.Size.Z; m_sitAvatarHeight = PhysicsActor.Size.Z;
bool canSit = false; bool canSit = false;
Vector3 pos = part.AbsolutePosition + offset;
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
{ {
@ -2274,10 +2338,23 @@ namespace OpenSim.Region.Framework.Scenes
offset = part.SitTargetPosition; offset = part.SitTargetPosition;
sitOrientation = part.SitTargetOrientation; sitOrientation = part.SitTargetOrientation;
if (!part.IsRoot)
{
// m_log.DebugFormat("Old sit orient {0}", sitOrientation);
sitOrientation = part.RotationOffset * sitOrientation;
// m_log.DebugFormat("New sit orient {0}", sitOrientation);
// m_log.DebugFormat("Old sit offset {0}", offset);
offset = offset * part.RotationOffset;
// m_log.DebugFormat("New sit offset {0}", offset);
}
canSit = true; canSit = true;
} }
else else
{ {
Vector3 pos = part.AbsolutePosition + offset;
if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -2309,8 +2386,12 @@ namespace OpenSim.Region.Framework.Scenes
cameraEyeOffset = part.GetCameraEyeOffset(); cameraEyeOffset = part.GetCameraEyeOffset();
forceMouselook = part.GetForceMouselook(); forceMouselook = part.GetForceMouselook();
// An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
// being sat upon.
offset += part.OffsetPosition;
ControllingClient.SendSitResponse( ControllingClient.SendSitResponse(
part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); part.ParentGroup.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
m_requestedSitTargetUUID = part.UUID; m_requestedSitTargetUUID = part.UUID;
@ -2583,14 +2664,29 @@ namespace OpenSim.Region.Framework.Scenes
//Quaternion result = (sitTargetOrient * vq) * nq; //Quaternion result = (sitTargetOrient * vq) * nq;
m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT;
Rotation = sitTargetOrient; Quaternion newRot;
ParentPosition = part.AbsolutePosition;
if (part.IsRoot)
{
newRot = sitTargetOrient;
}
else
{
newPos = newPos * part.RotationOffset;
newRot = part.RotationOffset * sitTargetOrient;
}
newPos += part.OffsetPosition;
m_pos = newPos;
Rotation = newRot;
} }
else else
{ {
m_pos -= part.AbsolutePosition; // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
ParentPosition = part.AbsolutePosition; // being sat upon.
m_pos -= part.GroupPosition;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
@ -2652,10 +2748,13 @@ namespace OpenSim.Region.Framework.Scenes
/// Rotate the avatar to the given rotation and apply a movement in the given relative vector /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
/// </summary> /// </summary>
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
public void AddNewMovement(Vector3 vec) /// <param name="thisAddSpeedModifier">
/// Optional additional speed modifier for this particular add. Default is 1</param>
public void AddNewMovement(Vector3 vec, float thisAddSpeedModifier = 1)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1} for {2}", vec, Rotation, Name); // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
// vec, Rotation, thisAddSpeedModifier, Name);
Vector3 direc = vec * Rotation; Vector3 direc = vec * Rotation;
direc.Normalize(); direc.Normalize();
@ -2673,7 +2772,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((vec.Z == 0f) && !Flying) if ((vec.Z == 0f) && !Flying)
direc.Z = 0f; // Prevent camera WASD up. direc.Z = 0f; // Prevent camera WASD up.
direc *= 0.03f * 128f * SpeedModifier; direc *= 0.03f * 128f * SpeedModifier * thisAddSpeedModifier;
// m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name);
@ -2822,6 +2921,7 @@ namespace OpenSim.Region.Framework.Scenes
lastTerseUpdateToAllClientsTick = currentTick; lastTerseUpdateToAllClientsTick = currentTick;
lastPositionSentToAllClients = OffsetPosition; lastPositionSentToAllClients = OffsetPosition;
// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
m_scene.ForEachClient(SendTerseUpdateToClient); m_scene.ForEachClient(SendTerseUpdateToClient);
} }
TriggerScenePresenceUpdated(); TriggerScenePresenceUpdated();
@ -3616,8 +3716,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Vector3 force = m_forceToApply.Value; Vector3 force = m_forceToApply.Value;
Updated = true;
Velocity = force; Velocity = force;
m_forceToApply = null; m_forceToApply = null;

View File

@ -105,7 +105,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.LoginLock = true; m_scene.LoginLock = true;
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); // Warn level because the region cannot be used while logins are disabled
m_log.WarnFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
if (m_uri != string.Empty) if (m_uri != string.Empty)
{ {
@ -218,7 +219,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
m_log.InfoFormat( // Warn level because the region cannot be used while logins are disabled
m_log.WarnFormat(
"[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
} }

View File

@ -213,7 +213,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
TestIntArgEvent("touch_end"); TestIntArgEvent("touch_end");
} }
[Test]
public void TestLandCollisionEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVectorArgEvent("land_collision");
}
[Test]
public void TestLandCollisionStartEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVectorArgEvent("land_collision_start");
}
[Test]
public void TestLandCollisionEndEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVectorArgEvent("land_collision_end");
}
private void TestIntArgEvent(string eventName) private void TestIntArgEvent(string eventName)
{ {
@ -223,6 +251,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TestCompile("default { " + eventName + "(integer n, integer o) {{}} }", true); TestCompile("default { " + eventName + "(integer n, integer o) {{}} }", true);
} }
private void TestVectorArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(vector v) {} }", false);
TestCompile("default { " + eventName + "{{}} }", true);
TestCompile("default { " + eventName + "(string s) {{}} }", true);
TestCompile("default { " + eventName + "(vector v, vector w) {{}} }", true);
}
private void TestCompile(string script, bool expectException) private void TestCompile(string script, bool expectException)
{ {
bool gotException = false; bool gotException = false;

File diff suppressed because it is too large Load Diff

View File

@ -1043,7 +1043,7 @@
[UserProfiles] [UserProfiles]
;# {ProfileURL} {} {Set url to UserProfilesService} {} ;# {ProfileServiceURL} {} {Set url to UserProfilesService} {}
;; Set the value of the url to your UserProfilesService ;; Set the value of the url to your UserProfilesService
;; If un-set / "" the module is disabled ;; If un-set / "" the module is disabled
;; ProfileServiceURL = http://127.0.0.1:8002 ;; ProfileServiceURL = http://127.0.0.1:8002