Revolution is on the roll again! :)

Fixes: Undo, T-pose of others on login, modifiedBulletX works again, feet now stand on the ground instead of in the ground, adds checks to CombatModule. Adds: Redo, Land Undo, checks to agentUpdate (so one can not fall off of a region), more vehicle parts. Finishes almost all of LSL (1 function left, 2 events).

Direct flames and kudos to Revolution, please

Signed-off-by: Melanie <melanie@t-data.com>
This commit is contained in:
Revolution
2010-02-14 15:41:57 -06:00
committed by Melanie
parent 45493171b0
commit 9821c4f566
39 changed files with 1430 additions and 226 deletions

View File

@@ -32,9 +32,9 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface ISoundModule
{
void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags);
void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius);
void TriggerSound(
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle);
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius);
}
}

View File

@@ -62,5 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces
void SaveToStream(string filename, Stream stream);
void InstallPlugin(string name, ITerrainEffect plug);
void UndoTerrain(ITerrainChannel channel);
}
}

View File

@@ -418,15 +418,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
if (m_scenePresence.IsChildAgent)
return;
UUID[] animIDs;
int[] sequenceNums;
UUID[] objectIDs;
m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
m_scenePresence.ControllingClient.SendAnimations(
animIDs, sequenceNums, m_scenePresence.ControllingClient.AgentId, objectIDs);
m_scenePresence.Scene.ForEachScenePresence(
delegate(ScenePresence SP)
{
SP.Animator.SendAnimPack();
});
}
/// <summary>

View File

@@ -1976,6 +1976,23 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
if (grp.RootPart.RETURN_AT_EDGE)
{
// We remove the object here
try
{
List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
objects.Add(grp);
SceneObjectGroup[] objectsArray = objects.ToArray();
returnObjects(objectsArray, UUID.Zero);
}
catch (Exception)
{
m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
}
return;
}
int thisx = (int)RegionInfo.RegionLocX;
int thisy = (int)RegionInfo.RegionLocY;
Vector3 EastCross = new Vector3(0.1f,0,0);
@@ -2044,19 +2061,25 @@ namespace OpenSim.Region.Framework.Scenes
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
try
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint)((thisy + changeY) * Constants.RegionSize));
// x - 1
// y + 1
newRegionHandle
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint)((thisy + changeY) * Constants.RegionSize));
// x - 1
// y + 1
}
catch (Exception ex)
{
}
}
else
{
@@ -2684,6 +2707,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnGrabUpdate += ProcessObjectGrabUpdate;
client.OnDeGrabObject += ProcessObjectDeGrab;
client.OnUndo += m_sceneGraph.HandleUndo;
client.OnRedo += m_sceneGraph.HandleRedo;
client.OnObjectDescription += m_sceneGraph.PrimDescription;
client.OnObjectDrop += m_sceneGraph.DropObject;
client.OnObjectSaleInfo += ObjectSaleInfo;
@@ -2838,6 +2862,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnGrabObject -= ProcessObjectGrab;
client.OnDeGrabObject -= ProcessObjectDeGrab;
client.OnUndo -= m_sceneGraph.HandleUndo;
client.OnRedo -= m_sceneGraph.HandleRedo;
client.OnObjectDescription -= m_sceneGraph.PrimDescription;
client.OnObjectDrop -= m_sceneGraph.DropObject;
client.OnObjectSaleInfo -= ObjectSaleInfo;

View File

@@ -452,6 +452,15 @@ namespace OpenSim.Region.Framework.Scenes
part.Undo();
}
}
protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
{
if (primId != UUID.Zero)
{
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
if (part != null)
part.Redo();
}
}
protected internal void HandleObjectGroupUpdate(
IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)

View File

@@ -298,7 +298,16 @@ namespace OpenSim.Region.Framework.Scenes
{
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
}
if (RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
{
RootPart.ScriptSetPhysicsStatus(false);
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
return;
}
}
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
@@ -398,6 +407,34 @@ namespace OpenSim.Region.Framework.Scenes
}
}
private SceneObjectPart m_PlaySoundMasterPrim = null;
public SceneObjectPart PlaySoundMasterPrim
{
get { return m_PlaySoundMasterPrim; }
set { m_PlaySoundMasterPrim = value; }
}
private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
public List<SceneObjectPart> PlaySoundSlavePrims
{
get { return m_LoopSoundSlavePrims; }
set { m_LoopSoundSlavePrims = value; }
}
private SceneObjectPart m_LoopSoundMasterPrim = null;
public SceneObjectPart LoopSoundMasterPrim
{
get { return m_LoopSoundMasterPrim; }
set { m_LoopSoundMasterPrim = value; }
}
private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
public List<SceneObjectPart> LoopSoundSlavePrims
{
get { return m_LoopSoundSlavePrims; }
set { m_LoopSoundSlavePrims = value; }
}
// The UUID for the Region this Object is in.
public UUID RegionUUID
{
@@ -1779,32 +1816,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void rotLookAt(Quaternion target, float strength, float damping)
{
SceneObjectPart rootpart = m_rootPart;
if (rootpart != null)
{
if (IsAttachment)
{
/*
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
Rotate the Av?
} */
}
else
{
if (rootpart.PhysActor != null)
{
rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
rootpart.PhysActor.APIDStrength = strength;
rootpart.PhysActor.APIDDamping = damping;
rootpart.PhysActor.APIDActive = true;
}
}
}
}
public void stopLookAt()
{
SceneObjectPart rootpart = m_rootPart;
@@ -1963,6 +1974,8 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in m_parts.Values)
{
if (!IsSelected)
part.UpdateLookAt();
part.SendScheduledUpdates();
}
}
@@ -2452,11 +2465,14 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_rootPart.PhysActor.IsPhysical)
{
Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce;
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
m_rootPart.PhysActor.AddForce(grabforce,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
if (!m_rootPart.BlockGrab)
{
Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce;
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
m_rootPart.PhysActor.AddForce(grabforce, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
}
else
{
@@ -2812,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.IgnoreUndoUpdate = true;
if (scale.X > m_scene.m_maxNonphys)
scale.X = m_scene.m_maxNonphys;
if (scale.Y > m_scene.m_maxNonphys)
@@ -2839,6 +2856,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (obPart.UUID != m_rootPart.UUID)
{
obPart.IgnoreUndoUpdate = true;
Vector3 oldSize = new Vector3(obPart.Scale);
float f = 1.0f;
@@ -2898,6 +2916,8 @@ namespace OpenSim.Region.Framework.Scenes
z *= a;
}
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
}
@@ -2913,6 +2933,7 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart obPart in m_parts.Values)
{
obPart.IgnoreUndoUpdate = true;
if (obPart.UUID != m_rootPart.UUID)
{
Vector3 currentpos = new Vector3(obPart.OffsetPosition);
@@ -2926,6 +2947,8 @@ namespace OpenSim.Region.Framework.Scenes
obPart.Resize(newSize);
obPart.UpdateOffSet(currentpos);
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
@@ -2935,6 +2958,8 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
}
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();
}
@@ -2950,13 +2975,26 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param>
public void UpdateGroupPosition(Vector3 pos)
{
foreach (SceneObjectPart part in Children.Values)
{
part.StoreUndoState();
}
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{
if (IsAttachment)
{
m_rootPart.AttachedPos = pos;
}
if (RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
{
RootPart.ScriptSetPhysicsStatus(false);
pos = AbsolutePosition;
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
}
}
AbsolutePosition = pos;
HasGroupChanged = true;
@@ -2975,7 +3013,10 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdateSinglePosition(Vector3 pos, uint localID)
{
SceneObjectPart part = GetChildPart(localID);
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
}
if (part != null)
{
if (part.UUID == m_rootPart.UUID)
@@ -2997,6 +3038,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param>
private void UpdateRootPosition(Vector3 pos)
{
foreach (SceneObjectPart part in Children.Values)
{
part.StoreUndoState();
}
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
Vector3 oldPos =
new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3040,6 +3085,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="rot"></param>
public void UpdateGroupRotationR(Quaternion rot)
{
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
}
m_rootPart.UpdateRotation(rot);
PhysicsActor actor = m_rootPart.PhysActor;
@@ -3060,6 +3109,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="rot"></param>
public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
{
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
}
m_rootPart.UpdateRotation(rot);
PhysicsActor actor = m_rootPart.PhysActor;
@@ -3083,6 +3136,10 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdateSingleRotation(Quaternion rot, uint localID)
{
SceneObjectPart part = GetChildPart(localID);
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
}
if (part != null)
{
if (part.UUID == m_rootPart.UUID)
@@ -3113,8 +3170,11 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
part.IgnoreUndoUpdate = true;
part.UpdateRotation(rot);
part.OffsetPosition = pos;
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
}
}
}
@@ -3128,6 +3188,7 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion axRot = rot;
Quaternion oldParentRot = m_rootPart.RotationOffset;
m_rootPart.StoreUndoState();
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
@@ -3141,6 +3202,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (prim.UUID != m_rootPart.UUID)
{
prim.IgnoreUndoUpdate = true;
Vector3 axPos = prim.OffsetPosition;
axPos *= oldParentRot;
axPos *= Quaternion.Inverse(axRot);
@@ -3153,7 +3215,14 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
foreach (SceneObjectPart childpart in Children.Values)
{
if (childpart != m_rootPart)
{
childpart.IgnoreUndoUpdate = false;
childpart.StoreUndoState();
}
}
m_rootPart.ScheduleTerseUpdate();
}

View File

@@ -133,6 +133,18 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore]
public bool DIE_AT_EDGE;
[XmlIgnore]
public bool RETURN_AT_EDGE;
[XmlIgnore]
public bool BlockGrab;
[XmlIgnore]
public bool StatusSandbox;
[XmlIgnore]
public Vector3 StatusSandboxPos;
// TODO: This needs to be persisted in next XML version update!
[XmlIgnore]
public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
@@ -219,6 +231,15 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore]
public Quaternion SpinOldOrientation = Quaternion.Identity;
[XmlIgnore]
public Quaternion m_APIDTarget = Quaternion.Identity;
[XmlIgnore]
public float m_APIDDamp = 0;
[XmlIgnore]
public float m_APIDStrength = 0;
/// <summary>
/// This part's inventory
/// </summary>
@@ -232,6 +253,9 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore]
public bool Undoing;
[XmlIgnore]
public bool IgnoreUndoUpdate = false;
[XmlIgnore]
private PrimFlags LocalFlags;
[XmlIgnore]
@@ -253,6 +277,7 @@ namespace OpenSim.Region.Framework.Scenes
private string m_text = String.Empty;
private string m_touchName = String.Empty;
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5);
private UUID _creatorID;
private bool m_passTouches;
@@ -501,6 +526,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
[XmlIgnore]
public Quaternion APIDTarget
{
get { return m_APIDTarget; }
set { m_APIDTarget = value; }
}
[XmlIgnore]
public float APIDDamp
{
get { return m_APIDDamp; }
set { m_APIDDamp = value; }
}
[XmlIgnore]
public float APIDStrength
{
get { return m_APIDStrength; }
set { m_APIDStrength = value; }
}
public ulong RegionHandle
{
get { return m_regionHandle; }
@@ -512,6 +558,33 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_scriptAccessPin; }
set { m_scriptAccessPin = (int)value; }
}
private SceneObjectPart m_PlaySoundMasterPrim = null;
public SceneObjectPart PlaySoundMasterPrim
{
get { return m_PlaySoundMasterPrim; }
set { m_PlaySoundMasterPrim = value; }
}
private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
public List<SceneObjectPart> PlaySoundSlavePrims
{
get { return m_LoopSoundSlavePrims; }
set { m_LoopSoundSlavePrims = value; }
}
private SceneObjectPart m_LoopSoundMasterPrim = null;
public SceneObjectPart LoopSoundMasterPrim
{
get { return m_LoopSoundMasterPrim; }
set { m_LoopSoundMasterPrim = value; }
}
private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
public List<SceneObjectPart> LoopSoundSlavePrims
{
get { return m_LoopSoundSlavePrims; }
set { m_LoopSoundSlavePrims = value; }
}
[XmlIgnore]
public Byte[] TextureAnimation
@@ -573,8 +646,6 @@ namespace OpenSim.Region.Framework.Scenes
}
set
{
StoreUndoState();
m_groupPosition = value;
PhysicsActor actor = PhysActor;
@@ -1401,6 +1472,10 @@ namespace OpenSim.Region.Framework.Scenes
{
m_undo.Clear();
}
lock (m_redo)
{
m_redo.Clear();
}
StoreUndoState();
}
@@ -1711,6 +1786,66 @@ namespace OpenSim.Region.Framework.Scenes
return m_parentGroup.RootPart.DIE_AT_EDGE;
}
public bool GetReturnAtEdge()
{
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted)
return false;
return m_parentGroup.RootPart.RETURN_AT_EDGE;
}
public void SetReturnAtEdge(bool p)
{
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted)
return;
m_parentGroup.RootPart.RETURN_AT_EDGE = p;
}
public bool GetBlockGrab()
{
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted)
return false;
return m_parentGroup.RootPart.BlockGrab;
}
public void SetBlockGrab(bool p)
{
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted)
return;
m_parentGroup.RootPart.BlockGrab = p;
}
public void SetStatusSandbox(bool p)
{
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted)
return;
StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
m_parentGroup.RootPart.StatusSandbox = p;
}
public bool GetStatusSandbox()
{
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted)
return false;
return m_parentGroup.RootPart.StatusSandbox;
}
public int GetAxisRotation(int axis)
{
//Cannot use ScriptBaseClass constants as no referance to it currently.
@@ -1917,7 +2052,7 @@ namespace OpenSim.Region.Framework.Scenes
// play the sound.
if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
{
SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0);
SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
}
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
@@ -2491,9 +2626,8 @@ namespace OpenSim.Region.Framework.Scenes
List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
foreach (ScenePresence p in avatarts)
{
// TODO: some filtering by distance of avatar
p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100))
p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
}
}
@@ -2554,7 +2688,38 @@ namespace OpenSim.Region.Framework.Scenes
public void RotLookAt(Quaternion target, float strength, float damping)
{
m_parentGroup.rotLookAt(target, strength, damping);
rotLookAt(target, strength, damping);
}
public void rotLookAt(Quaternion target, float strength, float damping)
{
if (IsAttachment)
{
/*
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
Rotate the Av?
} */
}
else
{
APIDDamp = damping;
APIDStrength = strength;
APIDTarget = target;
}
}
public void startLookAt(Quaternion rot, float damp, float strength)
{
APIDDamp = damp;
APIDStrength = strength;
APIDTarget = rot;
}
public void stopLookAt()
{
APIDTarget = Quaternion.Identity;
}
/// <summary>
@@ -2814,7 +2979,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="volume"></param>
/// <param name="triggered"></param>
/// <param name="flags"></param>
public void SendSound(string sound, double volume, bool triggered, byte flags)
public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
{
if (volume > 1)
volume = 1;
@@ -2850,10 +3015,51 @@ namespace OpenSim.Region.Framework.Scenes
ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>();
if (soundModule != null)
{
if (triggered)
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle);
if (useMaster)
{
if (isMaster)
{
if (triggered)
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
else
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
ParentGroup.PlaySoundMasterPrim = this;
ownerID = this._ownerID;
objectID = this.UUID;
parentID = this.GetRootPartUUID();
position = this.AbsolutePosition; // region local
regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle;
if (triggered)
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
else
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
{
ownerID = prim._ownerID;
objectID = prim.UUID;
parentID = prim.GetRootPartUUID();
position = prim.AbsolutePosition; // region local
regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
if (triggered)
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
else
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
}
ParentGroup.PlaySoundSlavePrims.Clear();
ParentGroup.PlaySoundMasterPrim = null;
}
else
{
ParentGroup.PlaySoundSlavePrims.Add(this);
}
}
else
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags);
{
if (triggered)
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
else
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
}
}
}
@@ -3156,6 +3362,14 @@ namespace OpenSim.Region.Framework.Scenes
hasProfileCut = hasDimple; // is it the same thing?
}
public void SetVehicleFlags(int param, bool remove)
{
if (PhysActor != null)
{
PhysActor.VehicleFlags(param, remove);
}
}
public void SetGroup(UUID groupID, IClientAPI client)
{
_groupID = groupID;
@@ -3260,27 +3474,30 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!Undoing)
{
if (m_parentGroup != null)
if (!IgnoreUndoUpdate)
{
lock (m_undo)
if (m_parentGroup != null)
{
if (m_undo.Count > 0)
lock (m_undo)
{
UndoState last = m_undo.Peek();
if (last != null)
if (m_undo.Count > 0)
{
if (last.Compare(this))
return;
UndoState last = m_undo.Peek();
if (last != null)
{
if (last.Compare(this))
return;
}
}
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this);
m_undo.Push(nUndo);
}
}
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this);
m_undo.Push(nUndo);
}
}
}
}
@@ -3751,14 +3968,39 @@ namespace OpenSim.Region.Framework.Scenes
lock (m_undo)
{
if (m_undo.Count > 0)
{
UndoState nUndo = null;
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState goback = m_undo.Pop();
if (goback != null)
goback.PlaybackState(this);
nUndo = new UndoState(this);
}
UndoState goback = m_undo.Pop();
if (goback != null)
{
goback.PlaybackState(this);
if (nUndo != null)
m_redo.Push(nUndo);
}
}
}
}
public void Redo()
{
lock (m_redo)
{
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this);
m_undo.Push(nUndo);
}
UndoState gofwd = m_redo.Pop();
if (gofwd != null)
gofwd.PlayfwdState(this);
}
}
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
{
m_shape.ReadInUpdateExtraParam(type, inUse, data);
@@ -3802,6 +4044,18 @@ namespace OpenSim.Region.Framework.Scenes
(pos.Z != OffsetPosition.Z))
{
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
if (ParentGroup.RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
{
ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
newPos = OffsetPosition;
ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false);
}
}
OffsetPosition = newPos;
ScheduleTerseUpdate();
}
@@ -4094,7 +4348,6 @@ namespace OpenSim.Region.Framework.Scenes
(rot.Z != RotationOffset.Z) ||
(rot.W != RotationOffset.W))
{
//StoreUndoState();
RotationOffset = rot;
ParentGroup.HasGroupChanged = true;
ScheduleTerseUpdate();
@@ -4396,5 +4649,36 @@ namespace OpenSim.Region.Framework.Scenes
Inventory.ApplyNextOwnerPermissions();
}
public void UpdateLookAt()
{
try
{
if (APIDTarget != Quaternion.Identity)
{
if (Single.IsNaN(APIDTarget.W) == true)
{
APIDTarget = Quaternion.Identity;
return;
}
Quaternion rot = RotationOffset;
Quaternion dir = (rot - APIDTarget);
float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f));
if (dir.Z > speed)
{
rot.Z -= speed;
}
if (dir.Z < -speed)
{
rot.Z += speed;
}
rot.Normalize();
UpdateRotation(rot);
}
}
catch (Exception ex)
{
m_log.Error("[Physics] " + ex);
}
}
}
}

View File

@@ -164,6 +164,8 @@ namespace OpenSim.Region.Framework.Scenes
private Quaternion m_bodyRot= Quaternion.Identity;
private Quaternion m_bodyRotPrevious = Quaternion.Identity;
private const int LAND_VELOCITYMAG_MAX = 12;
public bool IsRestrictedToRegion;
@@ -508,6 +510,12 @@ namespace OpenSim.Region.Framework.Scenes
set { m_bodyRot = value; }
}
public Quaternion PreviousRotation
{
get { return m_bodyRotPrevious; }
set { m_bodyRotPrevious = value; }
}
/// <summary>
/// If this is true, agent doesn't have a representation in this scene.
/// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -824,6 +832,31 @@ namespace OpenSim.Region.Framework.Scenes
if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
{
Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
if (pos.X < 0)
{
emergencyPos.X = (int)Constants.RegionSize + pos.X;
if (!(pos.Y < 0))
emergencyPos.Y = pos.Y;
if (!(pos.Z < 0))
emergencyPos.X = pos.X;
}
if (pos.Y < 0)
{
emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
if (!(pos.X < 0))
emergencyPos.X = pos.X;
if (!(pos.Z < 0))
emergencyPos.Z = pos.Z;
}
if (pos.Z < 0)
{
if (!(pos.X < 0))
emergencyPos.X = pos.X;
if (!(pos.Y < 0))
emergencyPos.Y = pos.Y;
//Leave as 128
}
m_log.WarnFormat(
"[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -1193,6 +1226,14 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
if (m_pos.X < 0)
m_pos.X = 128;
if (m_pos.Y < 0)
m_pos.Y = 128;
if (m_pos.X > Scene.WestBorders[0].BorderLine.X)
m_pos.X = 128;
if (m_pos.Y > Scene.NorthBorders[0].BorderLine.Y)
m_pos.Y = 128;
m_LastFinitePos = m_pos;
}
@@ -2704,36 +2745,72 @@ namespace OpenSim.Region.Framework.Scenes
{
// Checks if where it's headed exists a region
bool needsTransit = false;
if (m_scene.TestBorderCross(pos2, Cardinals.W))
{
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.SW, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.NW, ref fix);
}
else
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.W, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.E))
{
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.SE, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.NE, ref fix);
}
else
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.E, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.S, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.N, ref fix);
}
// Makes sure avatar does not end up outside region
if (neighbor < 0)
AbsolutePosition = new Vector3(
AbsolutePosition.X + 3*fix[0],
AbsolutePosition.Y + 3*fix[1],
AbsolutePosition.Z);
if (neighbor <= 0)
{
if (!needsTransit)
{
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.Y;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.Y;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y;
AbsolutePosition = pos;
}
}
else if (neighbor > 0)
CrossToNewRegion();
}

View File

@@ -26,6 +26,7 @@
*/
using OpenMetaverse;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes
{
@@ -35,29 +36,21 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 Scale = Vector3.Zero;
public Quaternion Rotation = Quaternion.Identity;
public UndoState(Vector3 pos, Quaternion rot, Vector3 scale)
{
Position = pos;
Rotation = rot;
Scale = scale;
}
public UndoState(SceneObjectPart part)
{
if (part != null)
{
if (part.ParentID == 0)
{
Position = part.AbsolutePosition;
Position = part.ParentGroup.AbsolutePosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
}
else
{
Position = part.OffsetPosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
}
}
}
@@ -68,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part.ParentID == 0)
{
if (Position == part.AbsolutePosition && Rotation == part.RotationOffset)
if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation)
return true;
else
return false;
@@ -93,24 +86,78 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParentID == 0)
{
part.ParentGroup.AbsolutePosition = Position;
part.UpdateRotation(Rotation);
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
part.RotationOffset = Rotation;
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();
}
else
{
part.OffsetPosition = Position;
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
part.UpdateRotation(Rotation);
part.Resize(Scale);
if (Scale != Vector3.Zero)
part.Resize(Scale); part.ScheduleTerseUpdate();
}
part.Undoing = false;
}
}
public void PlayfwdState(SceneObjectPart part)
{
if (part != null)
{
part.Undoing = true;
if (part.ParentID == 0)
{
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();
}
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleTerseUpdate();
}
part.Undoing = false;
}
}
}
public class LandUndoState
{
public ITerrainModule m_terrainModule;
public ITerrainChannel m_terrainChannel;
public UndoState()
public LandUndoState(ITerrainModule terrainModule, ITerrainChannel terrainChannel)
{
m_terrainModule = terrainModule;
m_terrainChannel = terrainChannel;
}
public bool Compare(ITerrainChannel terrainChannel)
{
if (m_terrainChannel != terrainChannel)
return false;
else
return false;
}
public void PlaybackState()
{
m_terrainModule.UndoTerrain(m_terrainChannel);
}
}
}