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;
query += "UPDATE userprofile SET ";
query += "profilePartner=?profilePartner, ";
query += "profileURL=?profileURL, ";
query += "profileImage=?image, ";
query += "profileAboutText=?abouttext,";
@ -752,7 +751,6 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?profileURL", props.WebUrl);
cmd.Parameters.AddWithValue("?profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue("?image", props.ImageId.ToString());
cmd.Parameters.AddWithValue("?abouttext", props.AboutText);
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)
{
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)
sql += " AND \"ScopeID\" = :scopeID";

View File

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

View File

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

View File

@ -296,6 +296,11 @@ namespace OpenSim
"Change the scale of a named prim",
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",
"kick user <first> <last> [--force] [message]",
"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>
/// Creates a new region based on the parameters specified. This will ask the user questions on the console
/// </summary>

View File

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

View File

@ -2648,11 +2648,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
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.AutoPilot = autopilot;
avatarSitResponse.SitTransform.SitPosition = OffsetPos;
@ -5150,15 +5147,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
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;
velocity = presence.Velocity;
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)
textureEntry = presence.Appearance.Texture.GetBytes();
else
@ -5278,6 +5274,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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];
@ -5303,7 +5301,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " +
data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle);
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.PathScaleX = 100;
update.PathScaleY = 100;
@ -13007,6 +13011,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
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
// 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

View File

@ -420,11 +420,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
Falling = false;
// Walking / crouchwalking / running
if (move.Z < 0f)
{
return "CROUCHWALK";
else if (m_scenePresence.SetAlwaysRun)
return "RUN";
else
return "WALK";
}
// 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";
else
return "WALK";
}
}
else if (!m_jumping)
{
@ -452,6 +459,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// <returns>'true' if the animation was changed</returns>
public bool UpdateMovementAnimations()
{
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name);
bool ret = false;
lock (m_animations)
{

View File

@ -360,15 +360,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Record user movement inputs.
/// </summary>
public byte MovementFlag { get; private set; }
public uint MovementFlag { get; private set; }
private bool m_updateflag;
public bool Updated
{
set { m_updateflag = value; }
get { return m_updateflag; }
}
/// <summary>
/// Is the agent stop control flag currently active?
/// </summary>
public bool AgentControlStopActive { get; private set; }
private bool m_invulnerable = true;
@ -513,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
}
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.
// In addition to providing the correct position while
// the avatar is seated, this value will also
@ -536,7 +534,7 @@ namespace OpenSim.Region.Framework.Scenes
}
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();
if (PhysicsActor != null)
@ -553,10 +551,7 @@ namespace OpenSim.Region.Framework.Scenes
// Don't update while sitting. The PhysicsActor above is null whilst sitting.
if (ParentID == 0)
{
m_pos = value;
// ParentPosition = Vector3.Zero;
}
//m_log.DebugFormat(
// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@ -819,6 +814,14 @@ namespace OpenSim.Region.Framework.Scenes
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;
public bool ForceFly
@ -1899,7 +1902,6 @@ namespace OpenSim.Region.Framework.Scenes
if ((oldState & (uint)AgentState.Editing) != 0 && State == (uint)AgentState.None)
ControllingClient.SendAgentTerseUpdate(this);
PhysicsActor actor = PhysicsActor;
if (actor == null)
{
@ -1909,12 +1911,13 @@ namespace OpenSim.Region.Framework.Scenes
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;
if (bodyRotation != Rotation)
if (agentData.BodyRotation != Rotation)
{
Rotation = bodyRotation;
Rotation = agentData.BodyRotation;
update_rotation = true;
}
@ -1960,10 +1963,7 @@ namespace OpenSim.Region.Framework.Scenes
else
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.
uint nudgehack = 250;
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{
if (((uint)flags & (uint)DCF) != 0)
@ -1980,29 +1980,19 @@ namespace OpenSim.Region.Framework.Scenes
// 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);
MovementFlag += (byte)(uint)DCF;
MovementFlag += (uint)DCF;
update_movementflag = true;
}
}
else
{
if ((MovementFlag & (byte)(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
if ((MovementFlag & (uint)DCF) != 0)
{
//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;
/*
@ -2022,6 +2012,13 @@ namespace OpenSim.Region.Framework.Scenes
i++;
}
// Detect AGENT_CONTROL_STOP state changes
if (AgentControlStopActive != ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STOP) != 0))
{
AgentControlStopActive = !AgentControlStopActive;
update_movementflag = true;
}
if (MovingToTarget)
{
// If the user has pressed a key then we want to cancel any move to target.
@ -2047,53 +2044,79 @@ namespace OpenSim.Region.Framework.Scenes
// Only do this if we're flying
if (Flying && !ForceFly)
{
// Landing detection code
// 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)
// Need to stop in mid air if user holds down AGENT_CONTROL_STOP
if (AgentControlStopActive)
{
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);
agent_control_v3 = Vector3.Zero;
}
else
{
if (m_AngularVelocity.Z != 0)
m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
}
// Landing detection code
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();
// 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(
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,
// 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(
// "[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);
// if (update_movementflag || !AgentControlStopActive || MovementFlag != 0)
// {
// 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
// {
@ -2106,7 +2129,10 @@ namespace OpenSim.Region.Framework.Scenes
// }
if (update_movementflag && ParentID == 0)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Updating movement animations for {0}", Name);
Animator.UpdateMovementAnimations();
}
SendControlsToScripts(flagsForScripts);
}
@ -2435,17 +2461,13 @@ namespace OpenSim.Region.Framework.Scenes
{
// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
bool satOnObject = IsSatOnObject;
SceneObjectPart part = ParentPart;
SitGround = false;
/* move this down so avatar gets physical in the new position and not where it is siting
if (PhysicsActor == null)
AddToPhysicalScene(false);
*/
if (ParentID != 0)
if (satOnObject)
{
PrevSitOffset = m_pos; // Save sit offset
SceneObjectPart part = ParentPart;
UnRegisterSeatControls(part.ParentGroup.UUID);
TaskInventoryDictionary taskIDict = part.TaskInventory;
@ -2464,28 +2486,64 @@ namespace OpenSim.Region.Framework.Scenes
}
part.ParentGroup.DeleteAvatar(UUID);
// ParentPosition = part.GetWorldPosition();
Vector3 sitPartWorldPosition = part.GetWorldPosition();
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;
ParentPart = null;
if (PhysicsActor == null)
AddToPhysicalScene(false);
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();
m_requestedSitTargetID = 0;
part.RemoveSittingAvatar(UUID);
if (part != null)
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
}
else if (PhysicsActor == null)
@ -2543,7 +2601,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
bool canSit = false;
Vector3 pos = part.AbsolutePosition + offset;
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
{
@ -2553,6 +2610,17 @@ namespace OpenSim.Region.Framework.Scenes
offset = part.SitTargetPosition;
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;
}
else
@ -2560,9 +2628,10 @@ namespace OpenSim.Region.Framework.Scenes
if (PhysicsSit(part,offset)) // physics engine
return;
Vector3 pos = part.AbsolutePosition + offset;
if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
{
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
canSit = true;
}
@ -2588,8 +2657,12 @@ namespace OpenSim.Region.Framework.Scenes
cameraEyeOffset = part.GetCameraEyeOffset();
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(
part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
part.ParentGroup.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
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
/// </summary>
/// <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(
// "[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;
direc.Normalize();
@ -2891,7 +2967,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((vec.Z == 0f) && !Flying)
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);
@ -3037,6 +3113,7 @@ namespace OpenSim.Region.Framework.Scenes
lastTerseUpdateToAllClientsTick = currentTick;
lastPositionSentToAllClients = OffsetPosition;
// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
m_scene.ForEachClient(SendTerseUpdateToClient);
}
TriggerScenePresenceUpdated();
@ -3806,8 +3883,6 @@ namespace OpenSim.Region.Framework.Scenes
{
Vector3 force = m_forceToApply.Value;
Updated = true;
Velocity = force;
m_forceToApply = null;

View File

@ -105,7 +105,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.LoginLock = true;
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)
{
@ -215,7 +216,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// 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);
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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