First set of merge fixes
parent
9cc2d0b60a
commit
03f6734f43
|
@ -3747,7 +3747,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
|
||||
continue;
|
||||
|
||||
List<SceneObjectGroup> atts = sp.Attachments;
|
||||
List<SceneObjectGroup> atts = sp.GetAttachments();
|
||||
bool found = false;
|
||||
foreach (SceneObjectGroup att in atts)
|
||||
{
|
||||
|
|
|
@ -204,29 +204,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UndeliveredMessage(GridInstantMessage im)
|
||||
{
|
||||
if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
|
||||
im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
|
||||
im.dialog != (byte)InstantMessageDialog.GroupNotice &&
|
||||
im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
|
||||
im.dialog != (byte)InstantMessageDialog.InventoryOffered)
|
||||
if ((im.offline != 0)
|
||||
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL + "/SaveMessage/", im);
|
||||
return;
|
||||
}
|
||||
|
||||
// It's not delivered. Make sure the scope id is saved
|
||||
// We don't need the imSessionID here anymore, overwrite it
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL+"/SaveMessage/?scope=" +
|
||||
scene.RegionInfo.ScopeID.ToString(), im);
|
||||
|
||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
{
|
||||
|
@ -245,4 +231,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -788,7 +788,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment))
|
||||
return null;
|
||||
|
||||
SceneObjectPart rootPart = group.RootPart;
|
||||
for (int i = 0; i < objlist.Count; i++)
|
||||
{
|
||||
group = objlist[i];
|
||||
|
@ -835,8 +835,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
group.AbsolutePosition = pos + veclist[i];
|
||||
}
|
||||
|
||||
SceneObjectPart rootPart = group.RootPart;
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
|
||||
if (!attachment)
|
||||
|
@ -869,6 +867,50 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
rootPart.ObjectSaleType = 0;
|
||||
rootPart.SalePrice = 10;
|
||||
|
||||
if (m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
}
|
||||
}
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
|
||||
if ((rootPart.OwnerID != item.Owner) ||
|
||||
(item.CurrentPermissions & 16) != 0 || // Magic number
|
||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||
{
|
||||
//Need to kill the for sale here
|
||||
rootPart.ObjectSaleType = 0;
|
||||
rootPart.SalePrice = 10;
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
|
@ -1014,48 +1056,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
m_Scene.InventoryService.DeleteItems(item.Owner, uuids);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((rootPart.OwnerID != item.Owner) ||
|
||||
(item.CurrentPermissions & 16) != 0 || // Magic number
|
||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||
{
|
||||
//Need to kill the for sale here
|
||||
rootPart.ObjectSaleType = 0;
|
||||
rootPart.SalePrice = 10;
|
||||
|
||||
if (m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
}
|
||||
}
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -987,6 +987,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
group.RemoveInventoryItem(localID, itemID);
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
}
|
||||
|
||||
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
|
||||
{
|
||||
|
|
|
@ -5347,41 +5347,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// }
|
||||
// }
|
||||
|
||||
lock (m_cleaningAttachments)
|
||||
{
|
||||
ForEachSOG(delegate (SceneObjectGroup grp)
|
||||
{
|
||||
if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
|
||||
{
|
||||
UUID agentID = grp.OwnerID;
|
||||
if (agentID == UUID.Zero)
|
||||
{
|
||||
objectsToDelete.Add(grp);
|
||||
return;
|
||||
}
|
||||
|
||||
ScenePresence sp = GetScenePresence(agentID);
|
||||
if (sp == null)
|
||||
{
|
||||
objectsToDelete.Add(grp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (objectsToDelete.Count > 0)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count);
|
||||
foreach (SceneObjectGroup grp in objectsToDelete)
|
||||
{
|
||||
m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
|
||||
DeleteSceneObject(grp, true);
|
||||
}
|
||||
m_log.Debug("[SCENE]: Finished dropped attachment deletion");
|
||||
}
|
||||
}
|
||||
|
||||
public void ThreadAlive(int threadCode)
|
||||
{
|
||||
switch(threadCode)
|
||||
|
|
|
@ -1437,9 +1437,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Set the new attachment point data in the object
|
||||
byte attachmentPoint = group.GetAttachmentPoint();
|
||||
group.UpdateGroupPosition(pos);
|
||||
group.RootPart.IsAttachment = false;
|
||||
group.IsAttachment = false;
|
||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||
group.SetAttachmentPoint(attachmentPoint);
|
||||
group.AttachmentPoint = attachmentPoint;
|
||||
group.HasGroupChanged = true;
|
||||
}
|
||||
else
|
||||
|
@ -1730,7 +1730,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
childGroups.Add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup child in childGroups)
|
||||
{
|
||||
|
|
|
@ -350,10 +350,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
get { return m_rotation; }
|
||||
set {
|
||||
foreach(SceneObjectPart p in m_parts.GetArray())
|
||||
{
|
||||
p.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
|
||||
}
|
||||
m_rotation = value;
|
||||
}
|
||||
}
|
||||
|
@ -487,8 +483,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
foreach (SceneObjectPart part in parts)
|
||||
{
|
||||
part.IgnoreUndoUpdate = false;
|
||||
part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
|
||||
part.GroupPosition = val;
|
||||
if (!m_dupeInProgress)
|
||||
{
|
||||
|
@ -1193,45 +1187,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="agentID"></param>
|
||||
/// <param name="attachmentpoint"></param>
|
||||
/// <param name="AttachOffset"></param>
|
||||
public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset, bool silent)
|
||||
private void AttachToAgent(
|
||||
ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
ScenePresence avatar = m_scene.GetScenePresence(agentID);
|
||||
if (avatar != null)
|
||||
{
|
||||
// don't attach attachments to child agents
|
||||
if (avatar.IsChildAgent) return;
|
||||
|
||||
// m_log.DebugFormat("[SOG]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
|
||||
|
||||
DetachFromBackup();
|
||||
|
||||
// Remove from database and parcel prim count
|
||||
m_scene.DeleteFromStorage(UUID);
|
||||
m_scene.DeleteFromStorage(so.UUID);
|
||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||
|
||||
m_rootPart.AttachedAvatar = agentID;
|
||||
so.AttachedAvatar = avatar.UUID;
|
||||
|
||||
//Anakin Lohner bug #3839
|
||||
lock (m_parts)
|
||||
if (so.RootPart.PhysActor != null)
|
||||
{
|
||||
foreach (SceneObjectPart p in m_parts.GetArray())
|
||||
{
|
||||
p.AttachedAvatar = agentID;
|
||||
}
|
||||
m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
|
||||
so.RootPart.PhysActor = null;
|
||||
}
|
||||
|
||||
if (m_rootPart.PhysActor != null)
|
||||
{
|
||||
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
|
||||
m_rootPart.PhysActor = null;
|
||||
}
|
||||
|
||||
AbsolutePosition = AttachOffset;
|
||||
m_rootPart.AttachedPos = AttachOffset;
|
||||
m_rootPart.IsAttachment = true;
|
||||
|
||||
m_rootPart.SetParentLocalId(avatar.LocalId);
|
||||
SetAttachmentPoint(Convert.ToByte(attachmentpoint));
|
||||
so.AbsolutePosition = attachOffset;
|
||||
so.RootPart.AttachedPos = attachOffset;
|
||||
so.IsAttachment = true;
|
||||
so.RootPart.SetParentLocalId(avatar.LocalId);
|
||||
so.AttachmentPoint = attachmentpoint;
|
||||
|
||||
avatar.AddAttachment(this);
|
||||
|
||||
|
@ -1254,7 +1234,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_log.WarnFormat(
|
||||
"[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
|
||||
UUID, agentID, Scene.RegionInfo.RegionName);
|
||||
UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1263,11 +1243,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return m_rootPart.Shape.State;
|
||||
}
|
||||
|
||||
public void ClearPartAttachmentData()
|
||||
{
|
||||
SetAttachmentPoint((Byte)0);
|
||||
}
|
||||
|
||||
public void DetachToGround()
|
||||
{
|
||||
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
|
||||
|
@ -1855,7 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
dupe.UpdateParentIDs();
|
||||
dupe.HasGroupChanged = true;
|
||||
dupe.AttachToBackup();
|
||||
|
||||
}
|
||||
ScheduleGroupForFullUpdate();
|
||||
// Need to duplicate the physics actor as well
|
||||
if (part.PhysActor != null && userExposed)
|
||||
|
@ -3175,7 +3150,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (IsAttachment)
|
||||
{
|
||||
m_rootPart.StoreUndoState(UndoType.STATE_GROUP_POSITION);
|
||||
m_rootPart.AttachedPos = pos;
|
||||
}
|
||||
if (RootPart.GetStatusSandbox())
|
||||
|
@ -3207,9 +3181,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
SceneObjectPart part = GetChildPart(localID);
|
||||
|
||||
// SceneObjectPart[] parts = m_parts.GetArray();
|
||||
// for (int i = 0; i < parts.Length; i++)
|
||||
// parts[i].StoreUndoState();
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].StoreUndoState();
|
||||
|
||||
if (part != null)
|
||||
{
|
||||
|
@ -3368,8 +3342,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
SceneObjectPart part = GetChildPart(localID);
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||
|
||||
if (part != null)
|
||||
{
|
||||
|
@ -3440,14 +3412,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
Quaternion axRot = rot;
|
||||
Quaternion oldParentRot = m_rootPart.RotationOffset;
|
||||
|
||||
m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||
bool cancelUndo = false;
|
||||
if (!m_rootPart.Undoing)
|
||||
{
|
||||
m_rootPart.Undoing = true;
|
||||
cancelUndo = true;
|
||||
}
|
||||
m_rootPart.StoreUndoState();
|
||||
|
||||
//Don't use UpdateRotation because it schedules an update prematurely
|
||||
m_rootPart.RotationOffset = rot;
|
||||
|
|
|
@ -852,7 +852,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
set
|
||||
{
|
||||
StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||
StoreUndoState();
|
||||
m_rotationOffset = value;
|
||||
|
||||
PhysicsActor actor = PhysActor;
|
||||
|
@ -3590,7 +3590,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_parentGroup.ScheduleGroupForTerseUpdate();
|
||||
//m_parentGroup.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
public void StoreUndoState(UndoType type)
|
||||
|
||||
public void StoreUndoState()
|
||||
{
|
||||
StoreUndoState(false);
|
||||
}
|
||||
|
@ -3630,18 +3631,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
UndoState nUndo = new UndoState(this, forGroup);
|
||||
|
||||
UndoState nUndo = new UndoState(this, type);
|
||||
|
||||
if (lastUndo != null)
|
||||
{
|
||||
TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
|
||||
if (ts.TotalMilliseconds < 500)
|
||||
{
|
||||
//Delete the last entry since it was less than 500 milliseconds ago
|
||||
nUndo.Merge(lastUndo);
|
||||
m_undo.Pop();
|
||||
}
|
||||
}
|
||||
m_undo.Push(nUndo);
|
||||
|
||||
if (m_redo.Count > 0)
|
||||
|
|
|
@ -1361,6 +1361,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the event handler for client movement. If a client is moving, this event is triggering.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// This is the event handler for client movement. If a client is moving, this event is triggering.
|
||||
/// </summary>
|
||||
|
@ -1389,7 +1392,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error #9999902");
|
||||
|
||||
m_pos = m_LastFinitePos;
|
||||
|
||||
if (!m_pos.IsFinite())
|
||||
{
|
||||
m_pos.X = 127f;
|
||||
|
@ -1459,6 +1461,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback);
|
||||
}
|
||||
}
|
||||
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
if (scriptedcontrols.Count > 0)
|
||||
|
@ -1473,9 +1476,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
|
||||
{
|
||||
m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
|
||||
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
|
||||
|
||||
// TODO: This doesn't prevent the user from walking yet.
|
||||
// Setting parent ID would fix this, if we knew what value
|
||||
// to use. Or we could add a m_isSitting variable.
|
||||
|
@ -1530,20 +1530,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (actor.Flying != oldflying)
|
||||
update_movementflag = true;
|
||||
|
||||
if (m_animator.m_jumping) // add for jumping
|
||||
update_movementflag = true;
|
||||
|
||||
if (q != m_bodyRot)
|
||||
{
|
||||
m_bodyRot = q;
|
||||
update_rotation = true;
|
||||
}
|
||||
|
||||
//guilty until proven innocent..
|
||||
bool Nudging = true;
|
||||
//Basically, if there is at least one non-nudge control then we don't need
|
||||
//to worry about stopping the avatar
|
||||
|
||||
if (m_parentID == 0)
|
||||
{
|
||||
bool bAllowUpdateMoveToPosition = false;
|
||||
|
@ -1557,12 +1543,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
else
|
||||
dirVectors = Dir_Vectors;
|
||||
|
||||
bool[] isNudge = GetDirectionIsNudge();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// The fact that m_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)
|
||||
|
@ -1572,18 +1556,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
try
|
||||
{
|
||||
agent_control_v3 += dirVectors[i];
|
||||
if (isNudge[i] == false)
|
||||
{
|
||||
Nudging = false;
|
||||
}
|
||||
//m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]);
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
// Why did I get this?
|
||||
}
|
||||
|
||||
if ((m_movementflag & (uint)DCF) == 0)
|
||||
if ((m_movementflag & (byte)(uint)DCF) == 0)
|
||||
{
|
||||
if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACK_NUDGE)
|
||||
{
|
||||
m_movementflag |= (byte)nudgehack;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF);
|
||||
m_movementflag += (byte)(uint)DCF;
|
||||
|
@ -1592,10 +1577,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((m_movementflag & (uint)DCF) != 0)
|
||||
if ((m_movementflag & (byte)(uint)DCF) != 0 ||
|
||||
((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACK_NUDGE)
|
||||
&& ((m_movementflag & (byte)nudgehack) == nudgehack))
|
||||
) // This or is for Nudge forward
|
||||
{
|
||||
m_movementflag -= (byte)(uint)DCF;
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF);
|
||||
m_movementflag -= ((byte)(uint)DCF);
|
||||
update_movementflag = true;
|
||||
|
||||
/*
|
||||
if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
|
||||
&& ((m_movementflag & (byte)nudgehack) == nudgehack))
|
||||
{
|
||||
m_log.Debug("Removed Hack flag");
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1605,129 +1602,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (MovingToTarget)
|
||||
{
|
||||
m_moveToPositionTarget = Vector3.Zero;
|
||||
m_moveToPositionInProgress = false;
|
||||
update_movementflag = true;
|
||||
bAllowUpdateMoveToPosition = false;
|
||||
}
|
||||
|
||||
if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving))
|
||||
{
|
||||
/*
|
||||
bool twoD = false;
|
||||
bool there = false;
|
||||
if (Animator != null)
|
||||
{
|
||||
switch (Animator.CurrentMovementAnimation)
|
||||
{
|
||||
case "STAND":
|
||||
case "WALK":
|
||||
case "RUN":
|
||||
case "CROUCH":
|
||||
case "CROUCHWALK":
|
||||
{
|
||||
twoD = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (twoD)
|
||||
{
|
||||
*/
|
||||
Vector3 abspos = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, 0.0f);
|
||||
Vector3 tgt = new Vector3(m_moveToPositionTarget.X, m_moveToPositionTarget.Y, 0.0f);
|
||||
/* if (Util.GetDistanceTo(abspos, tgt) <= 0.5f) there = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) there = true;
|
||||
}
|
||||
*/
|
||||
//Check the error term of the current position in relation to the target position
|
||||
// if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f)
|
||||
// if (there)
|
||||
if (Util.GetDistanceTo(abspos, tgt) <= 0.5f)
|
||||
// If the user has pressed a key then we want to cancel any move to target.
|
||||
if (DCFlagKeyPressed)
|
||||
{
|
||||
ResetMoveToTarget();
|
||||
update_movementflag = true;
|
||||
}
|
||||
else if (bAllowUpdateMoveToPosition)
|
||||
{
|
||||
try
|
||||
{
|
||||
// move avatar in 2D at one meter/second towards target, in avatar coordinate frame.
|
||||
// This movement vector gets added to the velocity through AddNewMovement().
|
||||
// Theoretically we might need a more complex PID approach here if other
|
||||
// unknown forces are acting on the avatar and we need to adaptively respond
|
||||
// to such forces, but the following simple approach seems to works fine.
|
||||
Vector3 LocalVectorToTarget3D =
|
||||
// (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
|
||||
(tgt - abspos)
|
||||
* Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
|
||||
// Ignore z component of vector
|
||||
Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
|
||||
LocalVectorToTarget2D.Normalize();
|
||||
|
||||
//We're not nudging
|
||||
Nudging = false;
|
||||
agent_control_v3 += LocalVectorToTarget2D;
|
||||
|
||||
// update avatar movement flags. the avatar coordinate system is as follows:
|
||||
//
|
||||
// +X (forward)
|
||||
//
|
||||
// ^
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// (left) +Y <--------o--------> -Y
|
||||
// avatar
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// v
|
||||
// -X
|
||||
//
|
||||
|
||||
// based on the above avatar coordinate system, classify the movement into
|
||||
// one of left/right/back/forward.
|
||||
if (LocalVectorToTarget2D.Y > 0)//MoveLeft
|
||||
{
|
||||
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
|
||||
//AgentControlFlags
|
||||
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
|
||||
if (HandleMoveToTargetUpdate(ref agent_control_v3))
|
||||
update_movementflag = true;
|
||||
}
|
||||
else if (LocalVectorToTarget2D.Y < 0) //MoveRight
|
||||
{
|
||||
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
|
||||
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
|
||||
update_movementflag = true;
|
||||
}
|
||||
if (LocalVectorToTarget2D.X < 0) //MoveBack
|
||||
{
|
||||
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
|
||||
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
|
||||
update_movementflag = true;
|
||||
}
|
||||
else if (LocalVectorToTarget2D.X > 0) //Move Forward
|
||||
{
|
||||
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
|
||||
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
|
||||
update_movementflag = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Avoid system crash, can be slower but...
|
||||
m_log.DebugFormat("Crash! {0}", e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1763,9 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// "[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);
|
||||
|
||||
AddNewMovement(agent_control_v3, q, Nudging);
|
||||
|
||||
|
||||
AddNewMovement(agent_control_v3);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
@ -1781,9 +1667,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Animator.UpdateMovementAnimations();
|
||||
}
|
||||
|
||||
if (update_movementflag && !SitGround)
|
||||
Animator.UpdateMovementAnimations();
|
||||
|
||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
|
@ -1800,18 +1683,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
|
||||
|
||||
bool updated = false;
|
||||
|
||||
public void StopMoveToPosition()
|
||||
{
|
||||
m_moveToPositionTarget = Vector3.Zero;
|
||||
m_moveToPositionInProgress = false;
|
||||
}
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
|
||||
// allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
|
||||
|
||||
public void DoMoveToPosition(Object sender, string method, List<String> args)
|
||||
{
|
||||
//Console.WriteLine("SP:DoMoveToPosition");
|
||||
try
|
||||
if (!m_autopilotMoving)
|
||||
{
|
||||
double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget);
|
||||
// m_log.DebugFormat(
|
||||
|
@ -2746,41 +2625,21 @@ 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>
|
||||
/// <param name="rotation">The direction in which this avatar should now face.
|
||||
public void AddNewMovement(Vector3 vec, Quaternion rotation, bool Nudging)
|
||||
public void AddNewMovement(Vector3 vec)
|
||||
{
|
||||
if (m_isChildAgent)
|
||||
{
|
||||
// WHAT???
|
||||
m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
Vector3 direc = vec * Rotation;
|
||||
direc.Normalize();
|
||||
PhysicsActor actor = m_physicsActor;
|
||||
|
||||
if (actor.Flying != m_flyingOld) // add for fly velocity control
|
||||
{
|
||||
m_flyingOld = actor.Flying; // add for fly velocity control
|
||||
if (!actor.Flying) m_wasFlying = true; // add for fly velocity control
|
||||
}
|
||||
|
||||
if (m_physicsActor.IsColliding == true) m_wasFlying = false; // add for fly velocity control
|
||||
|
||||
if ((vec.Z == 0f) && !actor.Flying) direc.Z = 0f; // Prevent camera WASD up.
|
||||
|
||||
direc *= 0.03f * 128f * m_speedModifier;
|
||||
|
||||
PhysicsActor actor = m_physicsActor;
|
||||
if (actor != null)
|
||||
{
|
||||
if (actor.Flying)
|
||||
{
|
||||
// rm speed mod direc *= 4.0f;
|
||||
direc *= 5.2f; // for speed mod
|
||||
direc *= 4.0f;
|
||||
//bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
|
||||
//bool colliding = (m_physicsActor.IsColliding==true);
|
||||
//if (controlland)
|
||||
|
@ -2793,34 +2652,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// m_log.Info("[AGENT]: Stop FLying");
|
||||
//}
|
||||
}
|
||||
if (Animator.m_falling && m_wasFlying) // if falling from flying, disable motion add
|
||||
{
|
||||
direc *= 0.0f;
|
||||
}
|
||||
/* This jumping section removed to SPA
|
||||
else if (!actor.Flying && actor.IsColliding)
|
||||
{
|
||||
if (direc.Z > 2.0f)
|
||||
{
|
||||
if(m_animator.m_animTickJump == -1)
|
||||
{
|
||||
direc.Z *= 3.0f; // jump
|
||||
}
|
||||
else
|
||||
{
|
||||
direc.Z *= 0.1f; // prejump
|
||||
}
|
||||
/ * Animations are controlled via GetMovementAnimation() in ScenePresenceAnimator.cs
|
||||
direc.Z *= 3.0f;
|
||||
|
||||
// TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
|
||||
Animator.TrySetMovementAnimation("PREJUMP");
|
||||
Animator.TrySetMovementAnimation("JUMP");
|
||||
* /
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add the force instead of only setting it to support multiple forces per frame?
|
||||
m_forceToApply = direc;
|
||||
m_isNudging = Nudging;
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
|
@ -3961,7 +3808,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
|
|||
{
|
||||
StartCollidingMessage.Colliders = colliding;
|
||||
|
||||
foreach (SceneObjectGroup att in Attachments)
|
||||
foreach (SceneObjectGroup att in GetAttachments())
|
||||
Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage);
|
||||
}
|
||||
}
|
||||
|
@ -3996,7 +3843,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
|
|||
{
|
||||
EndCollidingMessage.Colliders = colliding;
|
||||
|
||||
foreach (SceneObjectGroup att in Attachments)
|
||||
foreach (SceneObjectGroup att in GetAttachments())
|
||||
Scene.EventManager.TriggerScriptCollidingEnd(att.LocalId, EndCollidingMessage);
|
||||
}
|
||||
}
|
||||
|
@ -4517,7 +4364,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
|
|||
List<AvatarAttachment> attachments = m_appearance.GetAttachments();
|
||||
foreach (AvatarAttachment attach in attachments)
|
||||
{
|
||||
if (m_isDeleted)
|
||||
if (IsDeleted)
|
||||
return;
|
||||
|
||||
int p = attach.AttachPoint;
|
||||
|
@ -4603,7 +4450,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
|
|||
public void SaveChangedAttachments()
|
||||
{
|
||||
// Need to copy this list because DetachToInventoryPrep mods it
|
||||
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(Attachments.ToArray());
|
||||
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(GetAttachments().ToArray());
|
||||
|
||||
IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule;
|
||||
if (attachmentsModule != null)
|
||||
|
@ -4612,12 +4459,12 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
|
|||
{
|
||||
if (grp.HasGroupChanged) // Resizer scripts?
|
||||
{
|
||||
grp.RootPart.IsAttachment = false;
|
||||
grp.IsAttachment = false;
|
||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||
// grp.DetachToInventoryPrep();
|
||||
attachmentsModule.UpdateKnownItem(ControllingClient,
|
||||
grp, grp.GetFromItemID(), grp.OwnerID);
|
||||
grp.RootPart.IsAttachment = true;
|
||||
grp.IsAttachment = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2166,8 +2166,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
UUID x = module.CreateNPC(firstname,
|
||||
lastname,
|
||||
new Vector3((float) position.x, (float) position.y, (float) position.z),
|
||||
World,
|
||||
appearance);
|
||||
World,appearance);
|
||||
|
||||
return new LSL_Key(x.ToString());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue