mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Merge branch 'master' into bulletsim
Conflicts: OpenSim/Region/Framework/Scenes/SceneManager.cs
This commit is contained in:
@@ -96,9 +96,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <summary>
|
||||
/// Detach an object from the avatar.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// This method is called in response to a client's detach request, so we only update the information in
|
||||
/// inventory
|
||||
/// </remarks>
|
||||
/// <param name="objectLocalID"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
void DetachObject(uint objectLocalID, IClientAPI remoteClient);
|
||||
|
||||
@@ -32,6 +32,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IAvatarFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Send the appearance of an avatar to others in the scene.
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
/// <returns></returns>
|
||||
bool SendAppearance(UUID agentId);
|
||||
|
||||
bool SaveBakedTextures(UUID agentId);
|
||||
bool ValidateBakedTextureCache(IClientAPI client);
|
||||
void QueueAppearanceSend(UUID agentid);
|
||||
void QueueAppearanceSave(UUID agentid);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
@@ -39,9 +40,26 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="lastname"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="cloneAppearanceFrom">The UUID of the avatar from which to clone the NPC's appearance from.</param>
|
||||
/// <param name="appearance">The avatar appearance to use for the new NPC.</param>
|
||||
/// <returns>The UUID of the ScenePresence created.</returns>
|
||||
UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
|
||||
UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance);
|
||||
|
||||
/// <summary>
|
||||
/// Check if the agent is an NPC.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
|
||||
bool IsNPC(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Set the appearance for an NPC.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="appearance"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Move an NPC to a target over time.
|
||||
@@ -49,7 +67,23 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="pos"></param>
|
||||
void MoveToTarget(UUID agentID, Scene scene, Vector3 pos);
|
||||
/// <param name="noFly">
|
||||
/// If true, then the avatar will attempt to walk to the location even if it's up in the air.
|
||||
/// This is to allow walking on prims.
|
||||
/// </param>
|
||||
/// <param name="landAtTarget">
|
||||
/// If true and the avatar is flying when it reaches the target, land.
|
||||
/// </param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget);
|
||||
|
||||
/// <summary>
|
||||
/// Stop the NPC's current movement.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool StopMoveToTarget(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Get the NPC to say something.
|
||||
@@ -57,14 +91,15 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="text"></param>
|
||||
void Say(UUID agentID, Scene scene, string text);
|
||||
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool Say(UUID agentID, Scene scene, string text);
|
||||
|
||||
/// <summary>
|
||||
/// Delete an NPC.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
void DeleteNPC(UUID agentID, Scene scene);
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool DeleteNPC(UUID agentID, Scene scene);
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,48 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// This maintains the relationship between a UUID and a user name.
|
||||
/// </summary>
|
||||
public interface IUserManagement
|
||||
{
|
||||
string GetUserName(UUID uuid);
|
||||
string GetUserHomeURL(UUID uuid);
|
||||
string GetUserUUI(UUID uuid);
|
||||
string GetUserServerURL(UUID uuid, string serverType);
|
||||
void AddUser(UUID uuid, string userData);
|
||||
|
||||
/// <summary>
|
||||
/// Add a user.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If an account is found for the UUID, then the names in this will be used rather than any information
|
||||
/// extracted from creatorData.
|
||||
/// </remarks>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="creatorData">The creator data for this user.</param>
|
||||
void AddUser(UUID uuid, string creatorData);
|
||||
|
||||
/// <summary>
|
||||
/// Add a user.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The UUID is related to the name without any other checks being performed, such as user account presence.
|
||||
/// </remarks>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
void AddUser(UUID uuid, string firstName, string lastName);
|
||||
|
||||
/// <summary>
|
||||
/// Add a user.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the
|
||||
/// AddUser(UUID uuid, string creatorData) method.
|
||||
/// </remarks>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="profileURL"></param>
|
||||
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (m_scenePresence.IsChildAgent)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
|
||||
|
||||
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
|
||||
SendAnimPack();
|
||||
}
|
||||
@@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (animID == UUID.Zero)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
|
||||
|
||||
AddAnimation(animID, objectID);
|
||||
}
|
||||
|
||||
@@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
/// </summary>
|
||||
public void TrySetMovementAnimation(string anim)
|
||||
{
|
||||
//m_log.DebugFormat("Updating movement animation to {0}", anim);
|
||||
|
||||
if (!m_scenePresence.IsChildAgent)
|
||||
{
|
||||
if (m_animations.TrySetDefaultAnimation(
|
||||
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
|
||||
// anim, m_scenePresence.Name);
|
||||
|
||||
// 16384 is CHANGED_ANIMATION
|
||||
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
|
||||
SendAnimPack();
|
||||
|
||||
@@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
"delete object name <name>",
|
||||
"Delete object by name", HandleDeleteObject);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
|
||||
"delete object outside",
|
||||
"Delete all objects outside boundaries", HandleDeleteObject);
|
||||
|
||||
//Bind Storage Manager functions to some land manager functions for this scene
|
||||
EventManager.OnLandObjectAdded +=
|
||||
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
|
||||
@@ -2539,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#region Add/Remove Avatar Methods
|
||||
|
||||
/// <summary>
|
||||
/// Adding a New Client and Create a Presence for it.
|
||||
/// Add a new client and create a child agent for it.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
public override void AddNewClient(IClientAPI client)
|
||||
/// <param name="type">The type of agent to add.</param>
|
||||
public override void AddNewClient(IClientAPI client, PresenceType type)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
|
||||
bool vialogin = false;
|
||||
@@ -2562,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_clientManager.Add(client);
|
||||
SubscribeToClientEvents(client);
|
||||
|
||||
ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
|
||||
ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
|
||||
m_eventManager.TriggerOnNewPresence(sp);
|
||||
|
||||
sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
|
||||
@@ -2577,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
if (GetScenePresence(client.AgentId) != null)
|
||||
ScenePresence createdSp = GetScenePresence(client.AgentId);
|
||||
if (createdSp != null)
|
||||
{
|
||||
m_LastLogin = Util.EnvironmentTickCount();
|
||||
|
||||
// Cache the user's name
|
||||
CacheUserName(aCircuit);
|
||||
CacheUserName(createdSp, aCircuit);
|
||||
|
||||
EventManager.TriggerOnNewClient(client);
|
||||
if (vialogin)
|
||||
@@ -2590,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
private void CacheUserName(AgentCircuitData aCircuit)
|
||||
/// <summary>
|
||||
/// Cache the user name for later use.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="aCircuit"></param>
|
||||
private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
|
||||
{
|
||||
IUserManagement uMan = RequestModuleInterface<IUserManagement>();
|
||||
if (uMan != null)
|
||||
{
|
||||
string homeURL = string.Empty;
|
||||
string first = aCircuit.firstname, last = aCircuit.lastname;
|
||||
|
||||
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||
homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
|
||||
if (aCircuit.lastname.StartsWith("@"))
|
||||
if (sp.PresenceType == PresenceType.Npc)
|
||||
{
|
||||
string[] parts = aCircuit.firstname.Split('.');
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
first = parts[0];
|
||||
last = parts[1];
|
||||
}
|
||||
uMan.AddUser(aCircuit.AgentID, first, last);
|
||||
}
|
||||
else
|
||||
{
|
||||
string homeURL = string.Empty;
|
||||
|
||||
uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
|
||||
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||
homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
|
||||
if (aCircuit.lastname.StartsWith("@"))
|
||||
{
|
||||
string[] parts = aCircuit.firstname.Split('.');
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
first = parts[0];
|
||||
last = parts[1];
|
||||
}
|
||||
}
|
||||
|
||||
uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3091,11 +3110,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the given client from the scene.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
public override void RemoveClient(UUID agentID)
|
||||
public override void RemoveClient(UUID agentID, bool closeChildAgents)
|
||||
{
|
||||
CheckHeartbeat();
|
||||
bool childagentYN = false;
|
||||
@@ -3116,15 +3131,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
(childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
|
||||
|
||||
m_sceneGraph.removeUserCount(!childagentYN);
|
||||
|
||||
if (CapsModule != null)
|
||||
|
||||
// TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
|
||||
// unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
|
||||
if (closeChildAgents && CapsModule != null)
|
||||
CapsModule.RemoveCaps(agentID);
|
||||
|
||||
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
|
||||
// this method is doing is HORRIBLE!!!
|
||||
avatar.Scene.NeedSceneCacheClear(avatar.UUID);
|
||||
|
||||
if (!avatar.IsChildAgent)
|
||||
if (closeChildAgents && !avatar.IsChildAgent)
|
||||
{
|
||||
//List<ulong> childknownRegions = new List<ulong>();
|
||||
//List<ulong> ckn = avatar.KnownChildRegionHandles;
|
||||
@@ -3136,6 +3153,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
regions.Remove(RegionInfo.RegionHandle);
|
||||
m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
|
||||
}
|
||||
|
||||
m_eventManager.TriggerClientClosed(agentID, this);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
@@ -3146,7 +3164,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
m_eventManager.TriggerOnRemovePresence(agentID);
|
||||
|
||||
if (avatar != null && (!avatar.IsChildAgent))
|
||||
if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
|
||||
avatar.SaveChangedAttachments();
|
||||
|
||||
ForEachClient(
|
||||
@@ -4942,11 +4960,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private void HandleDeleteObject(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length < 4)
|
||||
if (cmd.Length < 3)
|
||||
return;
|
||||
|
||||
string mode = cmd[2];
|
||||
string o = cmd[3];
|
||||
string o = "";
|
||||
|
||||
if (mode != "outside")
|
||||
{
|
||||
if (cmd.Length < 4)
|
||||
return;
|
||||
|
||||
o = cmd[3];
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
|
||||
|
||||
@@ -4988,10 +5014,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
case "outside":
|
||||
ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
SceneObjectPart rootPart = g.RootPart;
|
||||
bool delete = false;
|
||||
|
||||
if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
|
||||
{
|
||||
delete = true;
|
||||
} else {
|
||||
ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
|
||||
|
||||
if (parcel == null || parcel.LandData.Name == "NO LAND")
|
||||
delete = true;
|
||||
}
|
||||
|
||||
if (delete && !rootPart.IsAttachment && !deletes.Contains(g))
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup g in deletes)
|
||||
{
|
||||
m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
|
||||
DeleteSceneObject(g, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleReloadEstate(string module, string[] cmd)
|
||||
|
||||
@@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
#region Add/Remove Agent/Avatar
|
||||
|
||||
/// <summary>
|
||||
/// Register the new client with the scene. The client starts off as a child agent - the later agent crossing
|
||||
/// will promote it to a root agent during login.
|
||||
/// </summary>
|
||||
/// <param name="client"></param
|
||||
public abstract void AddNewClient(IClientAPI client);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a client from the scene
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
public abstract void RemoveClient(UUID agentID);
|
||||
public abstract void AddNewClient(IClientAPI client, PresenceType type);
|
||||
public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
|
||||
|
||||
public bool TryGetScenePresence(UUID agentID, out object scenePresence)
|
||||
{
|
||||
|
||||
@@ -590,12 +590,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
|
||||
protected internal ScenePresence CreateAndAddChildScenePresence(
|
||||
IClientAPI client, AvatarAppearance appearance, PresenceType type)
|
||||
{
|
||||
ScenePresence newAvatar = null;
|
||||
|
||||
// ScenePresence always defaults to child agent
|
||||
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
|
||||
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type);
|
||||
|
||||
AddScenePresence(newAvatar);
|
||||
|
||||
|
||||
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return m_instance; }
|
||||
}
|
||||
|
||||
private readonly List<Scene> m_localScenes;
|
||||
private readonly List<Scene> m_localScenes = new List<Scene>();
|
||||
private Scene m_currentScene = null;
|
||||
|
||||
public List<Scene> Scenes
|
||||
{
|
||||
get { return m_localScenes; }
|
||||
get { return new List<Scene>(m_localScenes); }
|
||||
}
|
||||
|
||||
public Scene CurrentScene
|
||||
@@ -72,13 +72,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (m_currentScene == null)
|
||||
{
|
||||
if (m_localScenes.Count > 0)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
return m_localScenes[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
if (m_localScenes.Count > 0)
|
||||
return m_localScenes[0];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -98,17 +97,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// collect known shared modules in sharedModules
|
||||
Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
|
||||
lock (m_localScenes)
|
||||
{
|
||||
// extract known shared modules from scene
|
||||
foreach (string k in m_localScenes[i].Modules.Keys)
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
{
|
||||
if (m_localScenes[i].Modules[k].IsSharedModule &&
|
||||
!sharedModules.ContainsKey(k))
|
||||
sharedModules[k] = m_localScenes[i].Modules[k];
|
||||
// extract known shared modules from scene
|
||||
foreach (string k in m_localScenes[i].Modules.Keys)
|
||||
{
|
||||
if (m_localScenes[i].Modules[k].IsSharedModule &&
|
||||
!sharedModules.ContainsKey(k))
|
||||
sharedModules[k] = m_localScenes[i].Modules[k];
|
||||
}
|
||||
// close scene/region
|
||||
m_localScenes[i].Close();
|
||||
}
|
||||
// close scene/region
|
||||
m_localScenes[i].Close();
|
||||
}
|
||||
|
||||
// all regions/scenes are now closed, we can now safely
|
||||
@@ -121,13 +124,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void Close(Scene cscene)
|
||||
{
|
||||
if (m_localScenes.Contains(cscene))
|
||||
lock (m_localScenes)
|
||||
{
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
if (m_localScenes.Contains(cscene))
|
||||
{
|
||||
if (m_localScenes[i].Equals(cscene))
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
{
|
||||
m_localScenes[i].Close();
|
||||
if (m_localScenes[i].Equals(cscene))
|
||||
{
|
||||
m_localScenes[i].Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,27 +142,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void Add(Scene scene)
|
||||
{
|
||||
scene.OnRestart += HandleRestart;
|
||||
m_localScenes.Add(scene);
|
||||
|
||||
lock (m_localScenes)
|
||||
m_localScenes.Add(scene);
|
||||
}
|
||||
|
||||
public void HandleRestart(RegionInfo rdata)
|
||||
{
|
||||
m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main");
|
||||
int RegionSceneElement = -1;
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
{
|
||||
RegionSceneElement = i;
|
||||
if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
|
||||
{
|
||||
RegionSceneElement = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now we make sure the region is no longer known about by the SceneManager
|
||||
// Prevents duplicates.
|
||||
// Now we make sure the region is no longer known about by the SceneManager
|
||||
// Prevents duplicates.
|
||||
|
||||
if (RegionSceneElement >= 0)
|
||||
{
|
||||
m_localScenes.RemoveAt(RegionSceneElement);
|
||||
if (RegionSceneElement >= 0)
|
||||
{
|
||||
m_localScenes.RemoveAt(RegionSceneElement);
|
||||
}
|
||||
}
|
||||
|
||||
// Send signal to main that we're restarting this sim.
|
||||
@@ -167,28 +179,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
RegionInfo Result = null;
|
||||
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
{
|
||||
if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
// Inform other regions to tell their avatar about me
|
||||
Result = m_localScenes[i].RegionInfo;
|
||||
}
|
||||
}
|
||||
if (Result != null)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
{
|
||||
if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
|
||||
if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
// Inform other regions to tell their avatar about me
|
||||
//m_localScenes[i].OtherRegionUp(Result);
|
||||
Result = m_localScenes[i].RegionInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up");
|
||||
|
||||
if (Result != null)
|
||||
{
|
||||
for (int i = 0; i < m_localScenes.Count; i++)
|
||||
{
|
||||
if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
|
||||
{
|
||||
// Inform other regions to tell their avatar about me
|
||||
//m_localScenes[i].OtherRegionUp(Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +308,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (m_currentScene == null)
|
||||
{
|
||||
m_localScenes.ForEach(func);
|
||||
lock (m_localScenes)
|
||||
m_localScenes.ForEach(func);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -321,12 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Scene scene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
|
||||
foreach (Scene scene in m_localScenes)
|
||||
{
|
||||
m_currentScene = scene;
|
||||
return true;
|
||||
if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
|
||||
{
|
||||
m_currentScene = scene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,12 +358,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_log.Debug("Searching for Region: '" + regionID + "'");
|
||||
|
||||
foreach (Scene scene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (scene.RegionInfo.RegionID == regionID)
|
||||
foreach (Scene scene in m_localScenes)
|
||||
{
|
||||
m_currentScene = scene;
|
||||
return true;
|
||||
if (scene.RegionInfo.RegionID == regionID)
|
||||
{
|
||||
m_currentScene = scene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,26 +375,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool TryGetScene(string regionName, out Scene scene)
|
||||
{
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0)
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetScene(UUID regionID, out Scene scene)
|
||||
{
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (mscene.RegionInfo.RegionID == regionID)
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
if (mscene.RegionInfo.RegionID == regionID)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,13 +411,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool TryGetScene(uint locX, uint locY, out Scene scene)
|
||||
{
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (mscene.RegionInfo.RegionLocX == locX &&
|
||||
mscene.RegionInfo.RegionLocY == locY)
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
if (mscene.RegionInfo.RegionLocX == locX &&
|
||||
mscene.RegionInfo.RegionLocY == locY)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,13 +430,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene)
|
||||
{
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
|
||||
(mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
|
||||
foreach (Scene mscene in m_localScenes)
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
|
||||
(mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
|
||||
{
|
||||
scene = mscene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,11 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public RegionInfo GetRegionInfo(UUID regionID)
|
||||
{
|
||||
foreach (Scene scene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (scene.RegionInfo.RegionID == regionID)
|
||||
foreach (Scene scene in m_localScenes)
|
||||
{
|
||||
return scene.RegionInfo;
|
||||
if (scene.RegionInfo.RegionID == regionID)
|
||||
{
|
||||
return scene.RegionInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,11 +534,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)
|
||||
{
|
||||
foreach (Scene scene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (scene.TryGetScenePresence(avatarId, out avatar))
|
||||
foreach (Scene scene in m_localScenes)
|
||||
{
|
||||
return true;
|
||||
if (scene.TryGetScenePresence(avatarId, out avatar))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,12 +552,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public bool TryGetAvatarsScene(UUID avatarId, out Scene scene)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
foreach (Scene mScene in m_localScenes)
|
||||
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (mScene.TryGetScenePresence(avatarId, out avatar))
|
||||
foreach (Scene mScene in m_localScenes)
|
||||
{
|
||||
scene = mScene;
|
||||
return true;
|
||||
if (mScene.TryGetScenePresence(avatarId, out avatar))
|
||||
{
|
||||
scene = mScene;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,17 +571,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void CloseScene(Scene scene)
|
||||
{
|
||||
m_localScenes.Remove(scene);
|
||||
lock (m_localScenes)
|
||||
m_localScenes.Remove(scene);
|
||||
|
||||
scene.Close();
|
||||
}
|
||||
|
||||
public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
|
||||
{
|
||||
foreach (Scene scene in m_localScenes)
|
||||
lock (m_localScenes)
|
||||
{
|
||||
if (scene.TryGetAvatarByName(avatarName, out avatar))
|
||||
foreach (Scene scene in m_localScenes)
|
||||
{
|
||||
return true;
|
||||
if (scene.TryGetAvatarByName(avatarName, out avatar))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +596,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void ForEachScene(Action<Scene> action)
|
||||
{
|
||||
m_localScenes.ForEach(action);
|
||||
lock (m_localScenes)
|
||||
m_localScenes.ForEach(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
|
||||
if (avatar != null)
|
||||
{
|
||||
avatar.MoveToTarget(target);
|
||||
avatar.MoveToTarget(target, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="objectGroup"></param>
|
||||
public virtual void DetachFromBackup()
|
||||
{
|
||||
if (m_isBackedUp)
|
||||
if (m_isBackedUp && Scene != null)
|
||||
m_scene.EventManager.OnBackup -= ProcessBackup;
|
||||
|
||||
m_isBackedUp = false;
|
||||
@@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
SceneObjectPart selectionPart = GetChildPart(localID);
|
||||
|
||||
if (SetTemporary)
|
||||
if (SetTemporary && Scene != null)
|
||||
{
|
||||
DetachFromBackup();
|
||||
// Remove from database and parcel prim count
|
||||
@@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (selectionPart != null)
|
||||
{
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
|
||||
if (Scene != null)
|
||||
{
|
||||
SceneObjectPart part = parts[i];
|
||||
if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
|
||||
part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
|
||||
part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
UsePhysics = false; // Reset physics
|
||||
break;
|
||||
SceneObjectPart part = parts[i];
|
||||
if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
|
||||
part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
|
||||
part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
|
||||
{
|
||||
UsePhysics = false; // Reset physics
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,12 +261,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
protected SceneObjectPartInventory m_inventory;
|
||||
|
||||
|
||||
public bool Undoing;
|
||||
|
||||
|
||||
public bool IgnoreUndoUpdate = false;
|
||||
|
||||
|
||||
private PrimFlags LocalFlags;
|
||||
|
||||
@@ -1606,7 +1603,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
RotationOffset,
|
||||
RigidBody,
|
||||
m_localId);
|
||||
PhysActor.SetMaterial(Material);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -1618,6 +1614,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
|
||||
PhysActor.SOPDescription = this.Description;
|
||||
PhysActor.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||
}
|
||||
@@ -2970,22 +2967,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void ScriptSetPhantomStatus(bool Phantom)
|
||||
{
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.ScriptSetPhantomStatus(Phantom);
|
||||
}
|
||||
}
|
||||
|
||||
public void ScriptSetTemporaryStatus(bool Temporary)
|
||||
{
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.ScriptSetTemporaryStatus(Temporary);
|
||||
}
|
||||
}
|
||||
|
||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||
{
|
||||
if (m_parentGroup == null)
|
||||
@@ -2994,15 +2975,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
|
||||
}
|
||||
|
||||
public void ScriptSetVolumeDetect(bool SetVD)
|
||||
{
|
||||
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.ScriptSetVolumeDetect(SetVD);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set sculpt and mesh data, and tell the physics engine to process the change.
|
||||
/// </summary>
|
||||
@@ -4542,6 +4514,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
RemFlag(PrimFlags.Phantom);
|
||||
|
||||
if (ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
PhysicsActor pa = PhysActor;
|
||||
|
||||
if (pa == null)
|
||||
@@ -4555,11 +4530,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
RotationOffset,
|
||||
UsePhysics,
|
||||
m_localId);
|
||||
PhysActor.SetMaterial(Material);
|
||||
|
||||
pa = PhysActor;
|
||||
if (pa != null)
|
||||
{
|
||||
PhysActor.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||
|
||||
if (m_parentGroup != null)
|
||||
@@ -4645,6 +4620,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
|
||||
}
|
||||
|
||||
public void UpdateRotation(Quaternion rot)
|
||||
@@ -4864,7 +4841,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
|
||||
//}
|
||||
|
||||
LocalFlags=(PrimFlags)objectflagupdate;
|
||||
LocalFlags = (PrimFlags)objectflagupdate;
|
||||
|
||||
if (m_parentGroup != null && m_parentGroup.RootPart == this)
|
||||
{
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// What type of presence is this? User, NPC, etc.
|
||||
/// </summary>
|
||||
public PresenceType PresenceType { get; private set; }
|
||||
|
||||
// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
|
||||
private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
|
||||
private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
|
||||
@@ -173,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private float m_speedModifier = 1.0f;
|
||||
|
||||
private Quaternion m_bodyRot= Quaternion.Identity;
|
||||
private Quaternion m_bodyRot = Quaternion.Identity;
|
||||
|
||||
private Quaternion m_bodyRotPrevious = Quaternion.Identity;
|
||||
|
||||
@@ -708,15 +713,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
#region Constructor(s)
|
||||
|
||||
public ScenePresence()
|
||||
public ScenePresence(
|
||||
IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type)
|
||||
{
|
||||
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
|
||||
CreateSceneViewer();
|
||||
m_sceneViewer = new SceneViewer(this);
|
||||
m_animator = new ScenePresenceAnimator(this);
|
||||
}
|
||||
|
||||
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
|
||||
{
|
||||
PresenceType = type;
|
||||
m_DrawDistance = world.DefaultDrawDistance;
|
||||
m_rootRegionHandle = reginfo.RegionHandle;
|
||||
m_controllingClient = client;
|
||||
@@ -762,19 +765,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
RegisterToEvents();
|
||||
SetDirectionVectors();
|
||||
}
|
||||
|
||||
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
|
||||
: this(client, world, reginfo)
|
||||
{
|
||||
m_appearance = appearance;
|
||||
}
|
||||
|
||||
private void CreateSceneViewer()
|
||||
{
|
||||
m_sceneViewer = new SceneViewer(this);
|
||||
}
|
||||
|
||||
public void RegisterToEvents()
|
||||
{
|
||||
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
|
||||
@@ -1144,10 +1138,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
/// <summary>
|
||||
/// Complete Avatar's movement into the region.
|
||||
/// This is called upon a very important packet sent from the client,
|
||||
/// so it's client-controlled. Never call this method directly.
|
||||
/// </summary>
|
||||
public void CompleteMovement(IClientAPI client)
|
||||
/// <param name="client"></param>
|
||||
/// <param name="openChildAgents">
|
||||
/// If true, send notification to neighbour regions to expect
|
||||
/// a child agent from the client. These neighbours can be some distance away, depending right now on the
|
||||
/// configuration of DefaultDrawDistance in the [Startup] section of config
|
||||
/// </param>
|
||||
public void CompleteMovement(IClientAPI client, bool openChildAgents)
|
||||
{
|
||||
// DateTime startTime = DateTime.Now;
|
||||
|
||||
@@ -1188,15 +1186,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SendInitialData();
|
||||
|
||||
// Create child agents in neighbouring regions
|
||||
if (!m_isChildAgent)
|
||||
if (openChildAgents && !m_isChildAgent)
|
||||
{
|
||||
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
if (m_agentTransfer != null)
|
||||
m_agentTransfer.EnableChildAgents(this);
|
||||
else
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}",
|
||||
m_scene.RegionInfo.RegionName);
|
||||
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
if (friendsModule != null)
|
||||
@@ -1294,7 +1288,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#region Inputs
|
||||
|
||||
AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
|
||||
Quaternion bodyRotation = agentData.BodyRotation;
|
||||
|
||||
// Camera location in world. We'll need to raytrace
|
||||
// from this location from time to time.
|
||||
@@ -1380,6 +1373,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (m_allowMovement && !SitGround)
|
||||
{
|
||||
Quaternion bodyRotation = agentData.BodyRotation;
|
||||
bool update_rotation = false;
|
||||
|
||||
if (bodyRotation != m_bodyRot)
|
||||
{
|
||||
Rotation = bodyRotation;
|
||||
update_rotation = true;
|
||||
}
|
||||
|
||||
bool update_movementflag = false;
|
||||
|
||||
if (agentData.UseClientAgentPosition)
|
||||
@@ -1389,11 +1391,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
bool update_rotation = false;
|
||||
bool DCFlagKeyPressed = false;
|
||||
Vector3 agent_control_v3 = Vector3.Zero;
|
||||
Quaternion q = bodyRotation;
|
||||
|
||||
bool oldflying = PhysicsActor.Flying;
|
||||
|
||||
@@ -1407,12 +1406,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (actor.Flying != oldflying)
|
||||
update_movementflag = true;
|
||||
|
||||
if (q != m_bodyRot)
|
||||
{
|
||||
m_bodyRot = q;
|
||||
update_rotation = true;
|
||||
}
|
||||
|
||||
if (m_parentID == 0)
|
||||
{
|
||||
bool bAllowUpdateMoveToPosition = false;
|
||||
@@ -1464,8 +1457,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
) // This or is for Nudge forward
|
||||
{
|
||||
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))
|
||||
@@ -1493,7 +1486,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else if (bAllowUpdateMoveToPosition)
|
||||
{
|
||||
if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation))
|
||||
if (HandleMoveToTargetUpdate(ref agent_control_v3))
|
||||
update_movementflag = true;
|
||||
}
|
||||
}
|
||||
@@ -1531,13 +1524,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat(
|
||||
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
|
||||
|
||||
AddNewMovement(agent_control_v3, q);
|
||||
AddNewMovement(agent_control_v3);
|
||||
}
|
||||
|
||||
if (update_movementflag
|
||||
&& ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
|
||||
&& (m_parentID == 0)
|
||||
&& !SitGround)
|
||||
if (update_movementflag && m_parentID == 0)
|
||||
Animator.UpdateMovementAnimations();
|
||||
}
|
||||
|
||||
@@ -1553,9 +1543,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
|
||||
/// </remarks>
|
||||
/// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
|
||||
/// <param value="bodyRotation">New body rotation of the avatar.</param>
|
||||
/// <returns>True if movement has been updated in some way. False otherwise.</returns>
|
||||
public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation)
|
||||
public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
|
||||
|
||||
@@ -1591,7 +1580,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// to such forces, but the following simple approach seems to works fine.
|
||||
Vector3 LocalVectorToTarget3D =
|
||||
(MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
|
||||
* Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
|
||||
* Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords
|
||||
// Ignore z component of vector
|
||||
// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
|
||||
LocalVectorToTarget3D.Normalize();
|
||||
@@ -1680,7 +1669,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Move to the given target over time.
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
public void MoveToTarget(Vector3 pos)
|
||||
/// <param name="noFly">
|
||||
/// If true, then don't allow the avatar to fly to the target, even if it's up in the air.
|
||||
/// This is to allow movement to targets that are known to be on an elevated platform with a continuous path
|
||||
/// from start to finish.
|
||||
/// </param>
|
||||
public void MoveToTarget(Vector3 pos, bool noFly)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
|
||||
@@ -1714,15 +1708,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
"[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
|
||||
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
||||
|
||||
if (pos.Z > terrainHeight)
|
||||
if (noFly)
|
||||
PhysicsActor.Flying = false;
|
||||
else if (pos.Z > terrainHeight)
|
||||
PhysicsActor.Flying = true;
|
||||
|
||||
MovingToTarget = true;
|
||||
MoveToPositionTarget = pos;
|
||||
|
||||
Vector3 agent_control_v3 = new Vector3();
|
||||
HandleMoveToTargetUpdate(ref agent_control_v3, Rotation);
|
||||
AddNewMovement(agent_control_v3, Rotation);
|
||||
HandleMoveToTargetUpdate(ref agent_control_v3);
|
||||
AddNewMovement(agent_control_v3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1734,6 +1730,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
MovingToTarget = false;
|
||||
MoveToPositionTarget = Vector3.Zero;
|
||||
|
||||
// We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
|
||||
// resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
|
||||
// However, the line is here rather than in the NPC module since it also appears necessary to stop a
|
||||
// viewer that uses "go here" from juddering on all subsequent avatar movements.
|
||||
AgentControlFlags = (uint)AgentManager.ControlFlags.NONE;
|
||||
}
|
||||
|
||||
private void CheckAtSitTarget()
|
||||
@@ -2295,20 +2297,11 @@ 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)
|
||||
public void AddNewMovement(Vector3 vec)
|
||||
{
|
||||
if (m_isChildAgent)
|
||||
{
|
||||
// WHAT???
|
||||
m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
Rotation = rotation;
|
||||
Vector3 direc = vec * rotation;
|
||||
Vector3 direc = vec * Rotation;
|
||||
direc.Normalize();
|
||||
|
||||
direc *= 0.03f * 128f * m_speedModifier;
|
||||
@@ -2513,13 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// We have an appearance but we may not have the baked textures. Check the asset cache
|
||||
// to see if all the baked textures are already here.
|
||||
if (m_scene.AvatarFactory != null)
|
||||
{
|
||||
cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
|
||||
}
|
||||
|
||||
// If we aren't using a cached appearance, then clear out the baked textures
|
||||
if (!cachedappearance)
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using Timer=System.Timers.Timer;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Attachment tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class AttachmentTests
|
||||
{
|
||||
public Scene scene, scene2;
|
||||
public UUID agent1;
|
||||
public static Random random;
|
||||
public ulong region1, region2;
|
||||
public AgentCircuitData acd1;
|
||||
public SceneObjectGroup sog1, sog2, sog3;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
|
||||
scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
|
||||
|
||||
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
|
||||
interregionComms.Initialise(new IniConfigSource());
|
||||
interregionComms.PostInitialise();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
|
||||
SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
|
||||
|
||||
agent1 = UUID.Random();
|
||||
random = new Random();
|
||||
sog1 = NewSOG(UUID.Random(), scene, agent1);
|
||||
sog2 = NewSOG(UUID.Random(), scene, agent1);
|
||||
sog3 = NewSOG(UUID.Random(), scene, agent1);
|
||||
|
||||
//ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
region1 = scene.RegionInfo.RegionHandle;
|
||||
region2 = scene2.RegionInfo.RegionHandle;
|
||||
|
||||
SceneSetupHelpers.AddClient(scene, agent1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void T030_TestAddAttachments()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
|
||||
presence.AddAttachment(sog1);
|
||||
presence.AddAttachment(sog2);
|
||||
presence.AddAttachment(sog3);
|
||||
|
||||
Assert.That(presence.HasAttachments(), Is.True);
|
||||
Assert.That(presence.ValidateAttachments(), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void T031_RemoveAttachments()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
presence.RemoveAttachment(sog1);
|
||||
presence.RemoveAttachment(sog2);
|
||||
presence.RemoveAttachment(sog3);
|
||||
Assert.That(presence.HasAttachments(), Is.False);
|
||||
}
|
||||
|
||||
// I'm commenting this test because scene setup NEEDS InventoryService to
|
||||
// be non-null
|
||||
//[Test]
|
||||
public void T032_CrossAttachments()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
ScenePresence presence2 = scene2.GetScenePresence(agent1);
|
||||
presence2.AddAttachment(sog1);
|
||||
presence2.AddAttachment(sog2);
|
||||
|
||||
ISharedRegionModule serialiser = new SerialiserModule();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
|
||||
SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
|
||||
|
||||
Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
|
||||
|
||||
//Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
|
||||
Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
|
||||
Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
|
||||
}
|
||||
|
||||
private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
|
||||
{
|
||||
SceneObjectPart sop = new SceneObjectPart();
|
||||
sop.Name = RandomName();
|
||||
sop.Description = RandomName();
|
||||
sop.Text = RandomName();
|
||||
sop.SitName = RandomName();
|
||||
sop.TouchName = RandomName();
|
||||
sop.UUID = uuid;
|
||||
sop.Shape = PrimitiveBaseShape.Default;
|
||||
sop.Shape.State = 1;
|
||||
sop.OwnerID = agent;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
sog.SetScene(scene);
|
||||
|
||||
return sog;
|
||||
}
|
||||
|
||||
private static string RandomName()
|
||||
{
|
||||
StringBuilder name = new StringBuilder();
|
||||
int size = random.Next(5,12);
|
||||
char ch;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
|
||||
name.Append(ch);
|
||||
}
|
||||
|
||||
return name.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestCross()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestCrossSquare512()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestCrossRectangle512x256()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestCrossOdd512x512w256hole()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
// 512____
|
||||
|
||||
@@ -45,12 +45,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
static public Random random;
|
||||
SceneObjectGroup found;
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
[Test]
|
||||
public void T010_AddObjects()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
random = new Random();
|
||||
SceneObjectGroup found;
|
||||
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void T011_ThreadAddRemoveTest()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// This test adds and removes with mutiple threads, attempting to break the
|
||||
// uuid and localid dictionary coherence.
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestDuplicateObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
TestHelpers.InMethod();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
|
||||
string part1Name = "part1";
|
||||
|
||||
@@ -49,9 +49,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestAddSceneObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
string objName = "obj1";
|
||||
UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||
@@ -76,9 +76,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
/// </summary>
|
||||
public void TestAddExistingSceneObjectUuid()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
string obj1Name = "Alfred";
|
||||
string obj2Name = "Betty";
|
||||
@@ -110,10 +110,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestDeleteSceneObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
scene.DeleteSceneObject(part.ParentGroup, false);
|
||||
|
||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||
@@ -126,20 +126,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestDeleteSceneObjectAsync()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
|
||||
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
|
||||
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
||||
sogd.Enabled = false;
|
||||
|
||||
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
|
||||
IClientAPI client = SceneSetupHelpers.AddClient(scene, agentId);
|
||||
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
|
||||
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
|
||||
|
||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||
|
||||
@@ -56,17 +56,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestDeRezSceneObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Startup");
|
||||
config.Set("serverside_object_permissions", true);
|
||||
SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
|
||||
TestClient client = SceneSetupHelpers.AddClient(scene, userId);
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
|
||||
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
|
||||
|
||||
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
|
||||
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
||||
@@ -94,18 +94,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestDeRezSceneObjectNotOwner()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Startup");
|
||||
config.Set("serverside_object_permissions", true);
|
||||
SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
|
||||
TestClient client = SceneSetupHelpers.AddClient(scene, userId);
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
|
||||
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
|
||||
|
||||
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
|
||||
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
||||
|
||||
@@ -50,14 +50,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestLinkDelink2SceneObjects()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool debugtest = false;
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp1 = part1.ParentGroup;
|
||||
SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene);
|
||||
SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp2 = part2.ParentGroup;
|
||||
|
||||
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
||||
@@ -132,18 +132,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestLinkDelink2groups4SceneObjects()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool debugtest = false;
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp1 = part1.ParentGroup;
|
||||
SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene);
|
||||
SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp2 = part2.ParentGroup;
|
||||
SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene);
|
||||
SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp3 = part3.ParentGroup;
|
||||
SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene);
|
||||
SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp4 = part4.ParentGroup;
|
||||
|
||||
grp1.AbsolutePosition = new Vector3(10, 10, 10);
|
||||
@@ -266,10 +266,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestNewSceneObjectLinkPersistence()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
|
||||
string rootPartName = "rootpart";
|
||||
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||
@@ -305,10 +305,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestDelinkPersistence()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
|
||||
string rootPartName = "rootpart";
|
||||
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
@@ -49,11 +49,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestResizeSceneObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup;
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup;
|
||||
|
||||
g1.GroupResize(new Vector3(2, 3, 4));
|
||||
|
||||
@@ -72,12 +72,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestResizeSceneObjectPart()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero);
|
||||
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
|
||||
g1.RootPart.Scale = new Vector3(2, 3, 4);
|
||||
g1.Parts[1].Scale = new Vector3(5, 6, 7);
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic scene object status tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class SceneObjectStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void TestSetPhantom()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
|
||||
SceneObjectPart rootPart = so.RootPart;
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
|
||||
so.ScriptSetPhantomStatus(true);
|
||||
|
||||
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
|
||||
|
||||
so.ScriptSetPhantomStatus(false);
|
||||
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestShareWithGroup()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
|
||||
IConfig startupConfig = configSource.AddConfig("Startup");
|
||||
@@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
groupsConfig.Set("Module", "GroupsModule");
|
||||
groupsConfig.Set("DebugEnabled", true);
|
||||
|
||||
SceneSetupHelpers.SetupSceneModules(
|
||||
SceneHelpers.SetupSceneModules(
|
||||
scene, configSource, new object[]
|
||||
{ new PermissionsModule(),
|
||||
new GroupsModule(),
|
||||
new MockGroupsServicesConnector() });
|
||||
|
||||
TestClient client = SceneSetupHelpers.AddClient(scene, userId);
|
||||
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
|
||||
|
||||
IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
/// Scene presence tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ScenePresenceTests
|
||||
public class ScenePresenceAgentTests
|
||||
{
|
||||
public Scene scene, scene2, scene3;
|
||||
public UUID agent1, agent2, agent3;
|
||||
@@ -64,90 +64,140 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
|
||||
scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
|
||||
scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
|
||||
scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
|
||||
scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
|
||||
scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
|
||||
|
||||
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
|
||||
interregionComms.Initialise(new IniConfigSource());
|
||||
interregionComms.PostInitialise();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
|
||||
SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
|
||||
SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
|
||||
SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
|
||||
SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
|
||||
SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
|
||||
|
||||
agent1 = UUID.Random();
|
||||
agent2 = UUID.Random();
|
||||
agent3 = UUID.Random();
|
||||
random = new Random();
|
||||
sog1 = NewSOG(UUID.Random(), scene, agent1);
|
||||
sog2 = NewSOG(UUID.Random(), scene, agent1);
|
||||
sog3 = NewSOG(UUID.Random(), scene, agent1);
|
||||
sog1 = SceneHelpers.CreateSceneObject(1, agent1);
|
||||
scene.AddSceneObject(sog1);
|
||||
sog2 = SceneHelpers.CreateSceneObject(1, agent1);
|
||||
scene.AddSceneObject(sog2);
|
||||
sog3 = SceneHelpers.CreateSceneObject(1, agent1);
|
||||
scene.AddSceneObject(sog3);
|
||||
|
||||
//ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
region1 = scene.RegionInfo.RegionHandle;
|
||||
region2 = scene2.RegionInfo.RegionHandle;
|
||||
region3 = scene3.RegionInfo.RegionHandle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void T010_TestAddRootAgent()
|
||||
public void TestCloseAgent()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string firstName = "testfirstname";
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
AgentCircuitData agent = new AgentCircuitData();
|
||||
agent.AgentID = agent1;
|
||||
agent.firstname = firstName;
|
||||
agent.lastname = "testlastname";
|
||||
agent.SessionID = UUID.Random();
|
||||
agent.SecureSessionID = UUID.Random();
|
||||
agent.circuitcode = 123;
|
||||
agent.BaseFolder = UUID.Zero;
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
agent.startpos = Vector3.Zero;
|
||||
agent.CapsPath = GetRandomCapsObjectPath();
|
||||
agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
|
||||
agent.child = true;
|
||||
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
|
||||
|
||||
scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
|
||||
scene.IncomingCloseAgent(sp.UUID);
|
||||
|
||||
string reason;
|
||||
scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
|
||||
testclient = new TestClient(agent, scene);
|
||||
scene.AddNewClient(testclient);
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
|
||||
Assert.That(presence, Is.Not.Null, "presence is null");
|
||||
Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
|
||||
acd1 = agent;
|
||||
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
|
||||
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test removing an uncrossed root agent from a scene.
|
||||
/// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that unlike the other tests here, this doesn't rely on structures
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void T011_TestRemoveRootAgent()
|
||||
public void TestChildAgentEstablished()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
|
||||
// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
|
||||
EntityTransferModule etm = new EntityTransferModule();
|
||||
|
||||
SceneHelpers.SetupSceneModules(myScene1, configSource, etm);
|
||||
|
||||
SceneHelpers.AddScenePresence(myScene1, agent1Id);
|
||||
// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
|
||||
|
||||
scene.RemoveClient(agent1);
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
|
||||
Assert.That(presence, Is.Null, "presence is not null");
|
||||
// TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
|
||||
// Assert.That(childPresence, Is.Not.Null);
|
||||
// Assert.That(childPresence.IsChildAgent, Is.True);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void T010_TestAddRootAgent()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
//
|
||||
// string firstName = "testfirstname";
|
||||
//
|
||||
// AgentCircuitData agent = new AgentCircuitData();
|
||||
// agent.AgentID = agent1;
|
||||
// agent.firstname = firstName;
|
||||
// agent.lastname = "testlastname";
|
||||
// agent.SessionID = UUID.Random();
|
||||
// agent.SecureSessionID = UUID.Random();
|
||||
// agent.circuitcode = 123;
|
||||
// agent.BaseFolder = UUID.Zero;
|
||||
// agent.InventoryFolder = UUID.Zero;
|
||||
// agent.startpos = Vector3.Zero;
|
||||
// agent.CapsPath = GetRandomCapsObjectPath();
|
||||
// agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
|
||||
// agent.child = true;
|
||||
//
|
||||
// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
|
||||
//
|
||||
// string reason;
|
||||
// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
|
||||
// testclient = new TestClient(agent, scene);
|
||||
// scene.AddNewClient(testclient);
|
||||
//
|
||||
// ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
//
|
||||
// Assert.That(presence, Is.Not.Null, "presence is null");
|
||||
// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
|
||||
// acd1 = agent;
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Test removing an uncrossed root agent from a scene.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void T011_TestRemoveRootAgent()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
//
|
||||
// scene.RemoveClient(agent1);
|
||||
//
|
||||
// ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
//
|
||||
// Assert.That(presence, Is.Null, "presence is not null");
|
||||
// }
|
||||
|
||||
[Test]
|
||||
public void T012_TestAddNeighbourRegion()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string reason;
|
||||
|
||||
@@ -157,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
scene.NewUserConnection(acd1, 0, out reason);
|
||||
if (testclient == null)
|
||||
testclient = new TestClient(acd1, scene);
|
||||
scene.AddNewClient(testclient);
|
||||
scene.AddNewClient(testclient, PresenceType.User);
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
presence.MakeRootAgent(new Vector3(90,90,90),false);
|
||||
@@ -175,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void T013_TestRemoveNeighbourRegion()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
presence.RemoveNeighbourRegion(region3);
|
||||
@@ -188,37 +238,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
CompleteAvatarMovement
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that unlike the other tests here, this doesn't rely on structures
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestChildAgentEstablished()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
|
||||
TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
|
||||
EntityTransferModule etm = new EntityTransferModule();
|
||||
|
||||
SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
|
||||
|
||||
SceneSetupHelpers.AddClient(myScene1, agent1Id);
|
||||
ScenePresence childPresence = myScene2.GetScenePresence(agent1);
|
||||
|
||||
// TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
|
||||
// Assert.That(childPresence, Is.Not.Null);
|
||||
// Assert.That(childPresence.IsChildAgent, Is.True);
|
||||
}
|
||||
|
||||
// I'm commenting this test because it does not represent
|
||||
// crossings. The Thread.Sleep's in here are not meaningful mocks,
|
||||
@@ -230,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
//[Test]
|
||||
public void T021_TestCrossToNewRegion()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
scene.RegisterRegionWithGrid();
|
||||
scene2.RegisterRegionWithGrid();
|
||||
@@ -238,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
// Adding child agent to region 1001
|
||||
string reason;
|
||||
scene2.NewUserConnection(acd1,0, out reason);
|
||||
scene2.AddNewClient(testclient);
|
||||
scene2.AddNewClient(testclient, PresenceType.User);
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
|
||||
@@ -349,37 +368,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
capsPath = capsPath.Remove(capsPath.Length - 4, 4);
|
||||
return capsPath;
|
||||
}
|
||||
|
||||
private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
|
||||
{
|
||||
SceneObjectPart sop = new SceneObjectPart();
|
||||
sop.Name = RandomName();
|
||||
sop.Description = RandomName();
|
||||
sop.Text = RandomName();
|
||||
sop.SitName = RandomName();
|
||||
sop.TouchName = RandomName();
|
||||
sop.UUID = uuid;
|
||||
sop.Shape = PrimitiveBaseShape.Default;
|
||||
sop.Shape.State = 1;
|
||||
sop.OwnerID = agent;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
sog.SetScene(scene);
|
||||
|
||||
return sog;
|
||||
}
|
||||
|
||||
private static string RandomName()
|
||||
{
|
||||
StringBuilder name = new StringBuilder();
|
||||
int size = random.Next(5,12);
|
||||
char ch ;
|
||||
for (int i=0; i<size; i++)
|
||||
{
|
||||
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
|
||||
name.Append(ch);
|
||||
}
|
||||
return name.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
/// Teleport tests in a standalone OpenSim
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class StandaloneTeleportTests
|
||||
public class ScenePresenceTeleportTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
|
||||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
//[Test, LongRunning]
|
||||
public void TestSimpleNotNeighboursTeleport()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
ThreadRunResults results = new ThreadRunResults();
|
||||
results.Result = false;
|
||||
results.Message = "Test did not run";
|
||||
@@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
|
||||
|
||||
|
||||
Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
|
||||
SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
|
||||
Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
|
||||
SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
|
||||
sceneB.RegisterRegionWithGrid();
|
||||
|
||||
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
|
||||
SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
|
||||
Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
|
||||
SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
|
||||
sceneA.RegisterRegionWithGrid();
|
||||
|
||||
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
|
||||
TestClient client = SceneSetupHelpers.AddClient(sceneA, agentId);
|
||||
TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient;
|
||||
|
||||
ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestUpdateScene()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
scene.Update();
|
||||
|
||||
Assert.That(scene.Frame, Is.EqualTo(1));
|
||||
|
||||
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
|
||||
[Test]
|
||||
public void TestRezObjectFromInventoryItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
|
||||
// Create an object embedded inside the first
|
||||
@@ -98,12 +98,12 @@ namespace OpenSim.Region.Framework.Tests
|
||||
[Test]
|
||||
public void TestMoveTaskInventoryItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
|
||||
|
||||
@@ -125,12 +125,12 @@ namespace OpenSim.Region.Framework.Tests
|
||||
[Test]
|
||||
public void TestMoveTaskInventoryItemNoParent()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
|
||||
|
||||
|
||||
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
|
||||
[Test]
|
||||
public void TestGiveInventoryItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001);
|
||||
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
|
||||
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
|
||||
InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
|
||||
|
||||
scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID);
|
||||
@@ -82,12 +82,12 @@ namespace OpenSim.Region.Framework.Tests
|
||||
[Test]
|
||||
public void TestGiveInventoryFolder()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001);
|
||||
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
|
||||
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
|
||||
InventoryFolderBase folder1
|
||||
= UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1");
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void Init()
|
||||
{
|
||||
// FIXME: We don't need a full scene here - it would be enough to set up the asset service.
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
m_assetService = scene.AssetService;
|
||||
m_uuidGatherer = new UuidGatherer(m_assetService);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestCorruptAsset()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
||||
AssetBase corruptAsset
|
||||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[Test]
|
||||
public void TestMissingAsset()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
||||
IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
|
||||
|
||||
Reference in New Issue
Block a user