Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

This commit is contained in:
Justin Clark-Casey (justincc)
2010-02-16 19:08:06 +00:00
57 changed files with 1692 additions and 404 deletions

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

@@ -209,7 +209,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Triggered when an object or attachment enters a scene
/// </summary>
public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
@@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}
public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
{
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnScriptChangedEvent(uint localID, uint change)
@@ -454,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnClientMovement(ScenePresence avatar)
@@ -475,7 +475,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerPermissionError(UUID user, string reason)
@@ -496,7 +496,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnPluginConsole(string[] args)
@@ -517,7 +517,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnFrame()
@@ -538,11 +538,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnNewClient(IClientAPI client)
{
{
OnNewClientDelegate handlerNewClient = OnNewClient;
if (handlerNewClient != null)
{
@@ -559,10 +559,10 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
if (client is IClientCore)
{
{
OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
if (handlerClientConnect != null)
{
@@ -579,7 +579,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
}
@@ -601,11 +601,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnRemovePresence(UUID agentId)
{
{
OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
if (handlerRemovePresence != null)
{
@@ -622,11 +622,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnBackup(IRegionDataStore dstore)
{
{
OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null)
{
@@ -643,7 +643,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerParcelPrimCountUpdate()
@@ -664,7 +664,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
@@ -685,7 +685,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerTerrainTick()
@@ -706,7 +706,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
@@ -727,7 +727,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
@@ -748,11 +748,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerShutdown()
{
{
OnShutdownDelegate handlerShutdown = OnShutdown;
if (handlerShutdown != null)
{
@@ -769,11 +769,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
{
ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
if (handlerObjectGrab != null)
{
@@ -790,11 +790,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
{
ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
if (handlerObjectGrabbing != null)
{
@@ -811,11 +811,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
{
ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
if (handlerObjectDeGrab != null)
{
@@ -832,11 +832,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptReset(uint localID, UUID itemID)
{
{
ScriptResetDelegate handlerScriptReset = OnScriptReset;
if (handlerScriptReset != null)
{
@@ -853,11 +853,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
{
{
NewRezScript handlerRezScript = OnRezScript;
if (handlerRezScript != null)
{
@@ -874,7 +874,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerStartScript(uint localID, UUID itemID)
@@ -895,7 +895,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerStopScript(uint localID, UUID itemID)
@@ -916,11 +916,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRemoveScript(uint localID, UUID itemID)
{
{
RemoveScript handlerRemoveScript = OnRemoveScript;
if (handlerRemoveScript != null)
{
@@ -937,7 +937,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public bool TriggerGroupMove(UUID groupID, Vector3 delta)
@@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandObjectAdded(ILandObject newParcel)
@@ -1057,7 +1057,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandObjectRemoved(UUID globalID)
@@ -1078,7 +1078,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
@@ -1104,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerIncomingInstantMessage(GridInstantMessage message)
@@ -1125,7 +1125,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerUnhandledInstantMessage(GridInstantMessage message)
@@ -1146,7 +1146,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerClientClosed(UUID ClientID, Scene scene)
@@ -1167,7 +1167,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnMakeChildAgent(ScenePresence presence)
@@ -1188,7 +1188,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnMakeRootAgent(ScenePresence presence)
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
@@ -1229,12 +1229,12 @@ namespace OpenSim.Region.Framework.Scenes
"[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
{
{
RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
if (handlerRegisterCaps != null)
{
@@ -1251,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
@@ -1272,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
@@ -1293,7 +1293,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandBuy(Object sender, LandBuyArgs args)
@@ -1314,7 +1314,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
@@ -1335,11 +1335,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
{
{
ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
if (handlerScriptAtTargetEvent != null)
{
@@ -1356,7 +1356,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerNotAtTargetEvent(uint localID)
@@ -1377,11 +1377,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
{
{
ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
if (handlerScriptAtRotTargetEvent != null)
{
@@ -1398,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerNotAtRotTargetEvent(uint localID)
@@ -1419,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRequestChangeWaterHeight(float height)
@@ -1440,7 +1440,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
@@ -1461,7 +1461,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerSignificantClientMovement(IClientAPI client)
@@ -1482,7 +1482,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
@@ -1503,7 +1503,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
@@ -1524,7 +1524,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
@@ -1545,7 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
@@ -1566,7 +1566,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerNoticeNoLandDataFromStorage()
@@ -1587,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
@@ -1608,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerSetAllowForcefulBan(bool allow)
@@ -1629,7 +1629,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRequestParcelPrimCountUpdate()
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerParcelPrimCountTainted()
@@ -1671,7 +1671,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
// this lets us keep track of nasty script events like timer, etc.
@@ -1710,7 +1710,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public float GetCurrentTimeAsSunLindenHour()
@@ -1737,7 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public void TriggerOarFileLoaded(Guid requestId, string message)
{
{
OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
if (handlerOarFileLoaded != null)
{
@@ -1754,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOarFileSaved(Guid requestId, string message)
@@ -1775,7 +1775,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
@@ -1796,7 +1796,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
@@ -1817,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
@@ -1838,7 +1838,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
@@ -1859,7 +1859,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
@@ -1880,7 +1880,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
@@ -1901,7 +1901,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
@@ -1922,11 +1922,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
{
{
OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
if (handlerSetRootAgentScene != null)
{
@@ -1943,7 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnRegionUp(GridRegion otherRegion)
@@ -1964,7 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
}
}

View File

@@ -585,6 +585,9 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
return;
}
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
return;
}
AssetBase asset = AssetService.Get(item.AssetID.ToString());

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
{
@@ -2518,7 +2541,7 @@ namespace OpenSim.Region.Framework.Scenes
AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate();
grp.SendGroupFullUpdate();
}
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)
@@ -633,7 +642,7 @@ namespace OpenSim.Region.Framework.Scenes
// it get cleaned up
//
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
group.HasGroupChanged = false;
group.HasGroupChanged = false;
}
else
{

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
{
@@ -1782,32 +1819,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;
@@ -1966,6 +1977,8 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in m_parts.Values)
{
if (!IsSelected)
part.UpdateLookAt();
part.SendScheduledUpdates();
}
}
@@ -2467,11 +2480,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
{
@@ -2827,6 +2843,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)
@@ -2854,6 +2871,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;
@@ -2913,6 +2931,8 @@ namespace OpenSim.Region.Framework.Scenes
z *= a;
}
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
}
@@ -2928,6 +2948,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);
@@ -2941,6 +2962,8 @@ namespace OpenSim.Region.Framework.Scenes
obPart.Resize(newSize);
obPart.UpdateOffSet(currentpos);
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
@@ -2950,6 +2973,8 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
}
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();
}
@@ -2965,13 +2990,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;
@@ -2990,7 +3028,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)
@@ -3012,6 +3053,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,
@@ -3055,6 +3100,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;
@@ -3075,6 +3124,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;
@@ -3098,6 +3151,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)
@@ -3128,8 +3185,11 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
part.IgnoreUndoUpdate = true;
part.UpdateRotation(rot);
part.OffsetPosition = pos;
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
}
}
}
@@ -3143,6 +3203,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)
{
@@ -3156,6 +3217,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);
@@ -3168,7 +3230,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();
@@ -4278,7 +4531,7 @@ namespace OpenSim.Region.Framework.Scenes
else
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
ScheduleFullUpdate();
}
}
@@ -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

@@ -314,7 +314,7 @@ namespace OpenSim.Region.Framework.Scenes
}
);
}
}
}
private void RestoreSavedScriptState(UUID oldID, UUID newID)
{
@@ -579,7 +579,7 @@ namespace OpenSim.Region.Framework.Scenes
m_items.TryGetValue(itemId, out item);
return item;
}
}
/// <summary>
/// Get inventory items by name.
@@ -588,7 +588,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
/// </returns>
public IList<TaskInventoryItem> GetInventoryItems(string name)
{
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();

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;
@@ -225,7 +227,7 @@ namespace OpenSim.Region.Framework.Scenes
// Agent's Draw distance.
protected float m_DrawDistance;
protected AvatarAppearance m_appearance;
protected AvatarAppearance m_appearance;
// neighbouring regions we have enabled a child agent in
// holds the seed cap for the child agent in that region
@@ -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)
@@ -640,7 +648,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Constructor(s)
public ScenePresence()
{
{
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
CreateSceneViewer();
m_animator = new ScenePresenceAnimator(this);
@@ -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}",
@@ -2704,36 +2737,75 @@ 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)
{
if (m_requestedSitTargetUUID == UUID.Zero)
{
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.X;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.X;
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();
}
@@ -3193,7 +3265,7 @@ namespace OpenSim.Region.Framework.Scenes
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
m_physicsActor.SubscribeEvents(500);
m_physicsActor.LocalID = LocalId;
m_physicsActor.LocalID = LocalId;
}
private void OutOfBoundsCall(Vector3 pos)
@@ -3285,7 +3357,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if (m_health <= 0)
m_scene.EventManager.TriggerAvatarKill(killerObj, this);
}
}
}
public void setHealthWithUpdate(float health)

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);
}
}
}