Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
	OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
avinationmerge
Melanie 2013-12-07 01:08:49 +00:00
commit 6d6b9ab791
13 changed files with 8601 additions and 8084 deletions

View File

@ -736,7 +736,6 @@ namespace OpenSim.Data.MySQL
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profilePartner=?profilePartner, ";
query += "profileURL=?profileURL, "; query += "profileURL=?profileURL, ";
query += "profileImage=?image, "; query += "profileImage=?image, ";
query += "profileAboutText=?abouttext,"; query += "profileAboutText=?abouttext,";
@ -752,7 +751,6 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?profileURL", props.WebUrl); cmd.Parameters.AddWithValue("?profileURL", props.WebUrl);
cmd.Parameters.AddWithValue("?profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue("?image", props.ImageId.ToString()); cmd.Parameters.AddWithValue("?image", props.ImageId.ToString());
cmd.Parameters.AddWithValue("?abouttext", props.AboutText); cmd.Parameters.AddWithValue("?abouttext", props.AboutText);
cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString());

View File

@ -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

@ -715,7 +715,6 @@ namespace OpenSim.Data.PGSQL
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profilePartner=:profilePartner, ";
query += "profileURL=:profileURL, "; query += "profileURL=:profileURL, ";
query += "profileImage=:image, "; query += "profileImage=:image, ";
query += "profileAboutText=:abouttext,"; query += "profileAboutText=:abouttext,";
@ -731,7 +730,6 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("profileURL", props.WebUrl); cmd.Parameters.AddWithValue("profileURL", props.WebUrl);
cmd.Parameters.AddWithValue("profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue("image", props.ImageId.ToString()); cmd.Parameters.AddWithValue("image", props.ImageId.ToString());
cmd.Parameters.AddWithValue("abouttext", props.AboutText); cmd.Parameters.AddWithValue("abouttext", props.AboutText);
cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString());

View File

@ -679,7 +679,6 @@ namespace OpenSim.Data.SQLite
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profilePartner=:profilePartner, ";
query += "profileURL=:profileURL, "; query += "profileURL=:profileURL, ";
query += "profileImage=:image, "; query += "profileImage=:image, ";
query += "profileAboutText=:abouttext,"; query += "profileAboutText=:abouttext,";
@ -693,7 +692,6 @@ namespace OpenSim.Data.SQLite
{ {
cmd.CommandText = query; cmd.CommandText = query;
cmd.Parameters.AddWithValue(":profileURL", props.WebUrl); cmd.Parameters.AddWithValue(":profileURL", props.WebUrl);
cmd.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue(":image", props.ImageId.ToString()); cmd.Parameters.AddWithValue(":image", props.ImageId.ToString());
cmd.Parameters.AddWithValue(":abouttext", props.AboutText); cmd.Parameters.AddWithValue(":abouttext", props.AboutText);
cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString());

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

@ -743,6 +743,10 @@ namespace OpenSim.Region.ClientStack.Linden
inType = (sbyte)InventoryType.Sound; inType = (sbyte)InventoryType.Sound;
assType = (sbyte)AssetType.Sound; assType = (sbyte)AssetType.Sound;
} }
else if (inventoryType == "snapshot")
{
inType = (sbyte)InventoryType.Snapshot;
}
else if (inventoryType == "animation") else if (inventoryType == "animation")
{ {
inType = (sbyte)InventoryType.Animation; inType = (sbyte)InventoryType.Animation;

View File

@ -2648,11 +2648,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.CameraAtOffset = CameraAtOffset;
avatarSitResponse.SitTransform.CameraEyeOffset = CameraEyeOffset; 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;
@ -5150,15 +5147,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
attachPoint = 0; attachPoint = 0;
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
// attachPoint = presence.State; // Core: commented
collisionPlane = presence.CollisionPlane; collisionPlane = presence.CollisionPlane;
velocity = presence.Velocity; velocity = presence.Velocity;
acceleration = Vector3.Zero; acceleration = Vector3.Zero;
// Interestingly, sending this to non-zero will cause the client's avatar to start moving & accelerating
// in that direction, even though we don't model this on the server. Implementing this in the future
// may improve movement smoothness.
// acceleration = new Vector3(1, 0, 0);
if (sendTexture) if (sendTexture)
textureEntry = presence.Appearance.Texture.GetBytes(); textureEntry = presence.Appearance.Texture.GetBytes();
else else
@ -5278,6 +5274,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
parentID = part.ParentGroup.RootPart.LocalId; parentID = part.ParentGroup.RootPart.LocalId;
} }
} }
// 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];
@ -5303,7 +5301,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 = 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;
@ -13007,6 +13011,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

@ -420,12 +420,19 @@ 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) }
// We need to prevent these animations if the user tries to make their avatar walk or run whilst
// specifying AGENT_CONTROL_STOP (pressing down space on viewers).
else if (!m_scenePresence.AgentControlStopActive)
{
if (m_scenePresence.SetAlwaysRun)
return "RUN"; return "RUN";
else else
return "WALK"; return "WALK";
} }
}
else if (!m_jumping) else if (!m_jumping)
{ {
Falling = false; Falling = false;
@ -452,6 +459,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

@ -360,15 +360,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;
@ -513,6 +510,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
@ -536,7 +534,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)
@ -553,10 +551,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}",
@ -819,6 +814,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
@ -1899,7 +1902,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)
{ {
@ -1909,12 +1911,13 @@ namespace OpenSim.Region.Framework.Scenes
if (AllowMovement && !SitGround) if (AllowMovement && !SitGround)
{ {
Quaternion bodyRotation = agentData.BodyRotation; // m_log.DebugFormat("[SCENE PRESENCE]: Initial body rotation {0} for {1}", agentData.BodyRotation, Name);
bool update_rotation = false; bool update_rotation = false;
if (bodyRotation != Rotation) if (agentData.BodyRotation != Rotation)
{ {
Rotation = bodyRotation; Rotation = agentData.BodyRotation;
update_rotation = true; update_rotation = true;
} }
@ -1960,10 +1963,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)
@ -1980,29 +1980,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;
/* /*
@ -2022,6 +2012,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.
@ -2046,6 +2043,13 @@ 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)
{
// Need to stop in mid air if user holds down AGENT_CONTROL_STOP
if (AgentControlStopActive)
{
agent_control_v3 = Vector3.Zero;
}
else
{ {
// Landing detection code // Landing detection code
@ -2084,16 +2088,35 @@ namespace OpenSim.Region.Framework.Scenes
StopFlying(); 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)))
{ {
// if (update_movementflag || !AgentControlStopActive || MovementFlag != 0)
// {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} adding velocity of {1} to {2}, umf = {3}, ur = {4}", // "[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, update_rotation); // 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
// { // {
@ -2106,7 +2129,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);
} }
@ -2435,17 +2461,13 @@ 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;
/* move this down so avatar gets physical in the new position and not where it is siting if (satOnObject)
if (PhysicsActor == null)
AddToPhysicalScene(false);
*/
if (ParentID != 0)
{ {
PrevSitOffset = m_pos; // Save sit offset PrevSitOffset = m_pos; // Save sit offset
SceneObjectPart part = ParentPart;
UnRegisterSeatControls(part.ParentGroup.UUID); UnRegisterSeatControls(part.ParentGroup.UUID);
TaskInventoryDictionary taskIDict = part.TaskInventory; TaskInventoryDictionary taskIDict = part.TaskInventory;
@ -2464,27 +2486,63 @@ namespace OpenSim.Region.Framework.Scenes
} }
part.ParentGroup.DeleteAvatar(UUID); part.ParentGroup.DeleteAvatar(UUID);
// 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;
m_pos = part.AbsolutePosition + (m_pos * part.GetWorldRotation()) + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
if (part.SitTargetAvatar == UUID)
m_bodyRot = part.GetWorldRotation() * part.SitTargetOrientation;
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) if (PhysicsActor == null)
AddToPhysicalScene(false); 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);
} }
@ -2543,7 +2601,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
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)
{ {
@ -2553,6 +2610,17 @@ 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
@ -2560,9 +2628,10 @@ namespace OpenSim.Region.Framework.Scenes
if (PhysicsSit(part,offset)) // physics engine if (PhysicsSit(part,offset)) // physics engine
return; return;
Vector3 pos = part.AbsolutePosition + offset;
if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
{ {
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
canSit = true; canSit = true;
} }
@ -2588,8 +2657,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;
@ -2870,10 +2943,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();
@ -2891,7 +2967,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);
@ -3037,6 +3113,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();
@ -3806,8 +3883,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)
{ {
@ -215,7 +216,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

@ -215,6 +215,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
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)
{ {
TestCompile("default { " + eventName + "(integer n) {} }", false); TestCompile("default { " + eventName + "(integer n) {} }", false);
@ -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

@ -1039,7 +1039,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