Merge branch 'master' into careminster-presence-refactor
commit
42c22f41dd
|
@ -451,22 +451,33 @@ namespace OpenSim.Framework
|
||||||
/// 0x80 bit set then we assume this is an append
|
/// 0x80 bit set then we assume this is an append
|
||||||
/// operation otherwise we replace whatever is
|
/// operation otherwise we replace whatever is
|
||||||
/// currently attached at the attachpoint
|
/// currently attached at the attachpoint
|
||||||
|
/// return true if something actually changed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetAttachment(int attachpoint, UUID item, UUID asset)
|
public bool SetAttachment(int attachpoint, UUID item, UUID asset)
|
||||||
{
|
{
|
||||||
if (attachpoint == 0)
|
if (attachpoint == 0)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (item == UUID.Zero)
|
if (item == UUID.Zero)
|
||||||
{
|
{
|
||||||
lock (m_attachments)
|
lock (m_attachments)
|
||||||
{
|
{
|
||||||
if (m_attachments.ContainsKey(attachpoint))
|
if (m_attachments.ContainsKey(attachpoint))
|
||||||
|
{
|
||||||
m_attachments.Remove(attachpoint);
|
m_attachments.Remove(attachpoint);
|
||||||
return;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if the item is already attached at this point
|
||||||
|
if (GetAttachpoint(item) == (attachpoint & 0x7F))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// check if this is an append or a replace, 0x80 marks it as an append
|
// check if this is an append or a replace, 0x80 marks it as an append
|
||||||
if ((attachpoint & 0x80) > 0)
|
if ((attachpoint & 0x80) > 0)
|
||||||
{
|
{
|
||||||
|
@ -478,6 +489,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
|
ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetAttachpoint(UUID itemID)
|
public int GetAttachpoint(UUID itemID)
|
||||||
|
@ -495,7 +507,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DetachAttachment(UUID itemID)
|
public bool DetachAttachment(UUID itemID)
|
||||||
{
|
{
|
||||||
lock (m_attachments)
|
lock (m_attachments)
|
||||||
{
|
{
|
||||||
|
@ -510,10 +522,11 @@ namespace OpenSim.Framework
|
||||||
// And remove the list if there are no more attachments here
|
// And remove the list if there are no more attachments here
|
||||||
if (m_attachments[kvp.Key].Count == 0)
|
if (m_attachments[kvp.Key].Count == 0)
|
||||||
m_attachments.Remove(kvp.Key);
|
m_attachments.Remove(kvp.Key);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearAttachments()
|
public void ClearAttachments()
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace OpenSim.Framework.Console
|
||||||
System.Console.WriteLine(text);
|
System.Console.WriteLine(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OutputFormat(string format, params string[] components)
|
public virtual void OutputFormat(string format, params object[] components)
|
||||||
{
|
{
|
||||||
Output(string.Format(format, components));
|
Output(string.Format(format, components));
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||||
+ ", AttachmentPoint: " + AttachmentPt);
|
+ ", AttachmentPoint: " + AttachmentPt);
|
||||||
|
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -346,8 +344,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (m_scene.InventoryService != null)
|
if (m_scene.InventoryService != null)
|
||||||
item = m_scene.InventoryService.GetItem(item);
|
item = m_scene.InventoryService.GetItem(item);
|
||||||
|
|
||||||
if (presence.Appearance != null)
|
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
if (changed && m_scene.AvatarFactory != null)
|
||||||
|
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return att.UUID;
|
return att.UUID;
|
||||||
|
@ -397,9 +396,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (m_scene.InventoryService == null)
|
if (m_scene.InventoryService == null)
|
||||||
m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
|
m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
|
||||||
item = m_scene.InventoryService.GetItem(item);
|
item = m_scene.InventoryService.GetItem(item);
|
||||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
|
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||||
|
if (changed && m_scene.AvatarFactory != null)
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,11 +417,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
ScenePresence presence;
|
ScenePresence presence;
|
||||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||||
{
|
{
|
||||||
presence.Appearance.DetachAttachment(itemID);
|
|
||||||
|
|
||||||
// Save avatar attachment information
|
// Save avatar attachment information
|
||||||
m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
|
bool changed = presence.Appearance.DetachAttachment(itemID);
|
||||||
|
if (changed && m_scene.AvatarFactory != null)
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,9 +446,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
|
part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
presence.Appearance.DetachAttachment(itemID);
|
bool changed = presence.Appearance.DetachAttachment(itemID);
|
||||||
|
if (changed && m_scene.AvatarFactory != null)
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||||
|
|
||||||
part.ParentGroup.DetachToGround();
|
part.ParentGroup.DetachToGround();
|
||||||
|
|
|
@ -217,7 +217,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
// update transaction. In theory, we should be able to do an immediate
|
// update transaction. In theory, we should be able to do an immediate
|
||||||
// appearance send and save here.
|
// appearance send and save here.
|
||||||
|
|
||||||
QueueAppearanceSave(client.AgentId);
|
// save only if there were changes, send no matter what (doesn't hurt to send twice)
|
||||||
|
if (changed)
|
||||||
|
QueueAppearanceSave(client.AgentId);
|
||||||
QueueAppearanceSend(client.AgentId);
|
QueueAppearanceSend(client.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private readonly Scene m_scene;
|
private readonly Scene m_scene;
|
||||||
private readonly LandManagementModule m_landManagementModule;
|
private readonly LandManagementModule m_landManagementModule;
|
||||||
|
|
||||||
public LandChannel(Scene scene, LandManagementModule landManagementMod)
|
public LandChannel(Scene scene, LandManagementModule landManagementMod)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData;
|
||||||
using OpenMetaverse.Messages.Linden;
|
using OpenMetaverse.Messages.Linden;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Capabilities;
|
using OpenSim.Framework.Capabilities;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
using OpenSim.Services.Interfaces;
|
||||||
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Land
|
namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
// used for caching
|
// used for caching
|
||||||
internal class ExtendedLandData {
|
internal class ExtendedLandData
|
||||||
|
{
|
||||||
public LandData LandData;
|
public LandData LandData;
|
||||||
public ulong RegionHandle;
|
public ulong RegionHandle;
|
||||||
public uint X, Y;
|
public uint X, Y;
|
||||||
|
@ -65,6 +69,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
private LandChannel landChannel;
|
private LandChannel landChannel;
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
protected Commander m_commander = new Commander("land");
|
||||||
|
|
||||||
|
protected IUserManagement m_userManager;
|
||||||
|
|
||||||
// Minimum for parcels to work is 64m even if we don't actually use them.
|
// Minimum for parcels to work is 64m even if we don't actually use them.
|
||||||
#pragma warning disable 0429
|
#pragma warning disable 0429
|
||||||
|
@ -135,19 +142,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
||||||
m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
|
m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
|
||||||
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
|
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
|
||||||
|
m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
|
||||||
|
|
||||||
lock (m_scene)
|
lock (m_scene)
|
||||||
{
|
{
|
||||||
m_scene.LandChannel = (ILandChannel)landChannel;
|
m_scene.LandChannel = (ILandChannel)landChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InstallInterfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
|
m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
// TODO: Also release other event manager listeners here
|
||||||
|
|
||||||
|
m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
|
||||||
|
m_scene.UnregisterModuleCommander(m_commander.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
|
// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
|
||||||
|
@ -156,6 +171,29 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
// reason = "You are not allowed to enter this sim.";
|
// reason = "You are not allowed to enter this sim.";
|
||||||
// return nearestParcel != null;
|
// return nearestParcel != null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Processes commandline input. Do not call directly.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">Commandline arguments</param>
|
||||||
|
protected void EventManagerOnPluginConsole(string[] args)
|
||||||
|
{
|
||||||
|
if (args[0] == "land")
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
m_commander.ProcessConsoleCommand("help", new string[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] tmpArgs = new string[args.Length - 2];
|
||||||
|
int i;
|
||||||
|
for (i = 2; i < args.Length; i++)
|
||||||
|
tmpArgs[i - 2] = args[i];
|
||||||
|
|
||||||
|
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EventManagerOnNewClient(IClientAPI client)
|
void EventManagerOnNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
@ -217,11 +255,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -231,11 +264,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
get { return "LandManagementModule"; }
|
get { return "LandManagementModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Parcel Add/Remove/Get/Create
|
#region Parcel Add/Remove/Get/Create
|
||||||
|
@ -1932,5 +1960,44 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void InstallInterfaces()
|
||||||
|
{
|
||||||
|
Command showCommand =
|
||||||
|
new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region.");
|
||||||
|
|
||||||
|
m_commander.RegisterCommand("show", showCommand);
|
||||||
|
|
||||||
|
// Add this to our scene so scripts can call these functions
|
||||||
|
m_scene.RegisterModuleCommander(m_commander);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ShowParcelsCommand(Object[] args)
|
||||||
|
{
|
||||||
|
StringBuilder report = new StringBuilder();
|
||||||
|
|
||||||
|
report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
|
||||||
|
report.AppendFormat(
|
||||||
|
"{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n",
|
||||||
|
"Parcel Name",
|
||||||
|
"Area",
|
||||||
|
"Starts",
|
||||||
|
"Ends",
|
||||||
|
"Owner");
|
||||||
|
|
||||||
|
lock (m_landList)
|
||||||
|
{
|
||||||
|
foreach (ILandObject lo in m_landList.Values)
|
||||||
|
{
|
||||||
|
LandData ld = lo.LandData;
|
||||||
|
|
||||||
|
report.AppendFormat(
|
||||||
|
"{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n",
|
||||||
|
ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(report.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,43 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
get { return m_scene.RegionInfo.RegionID; }
|
get { return m_scene.RegionInfo.RegionID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 StartPoint
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
for (int y = 0; y < landArrayMax; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < landArrayMax; x++)
|
||||||
|
{
|
||||||
|
if (LandBitmap[x, y])
|
||||||
|
return new Vector3(x * 4, y * 4, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Vector3(-1, -1, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 EndPoint
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
for (int y = landArrayMax - 1; y >= 0; y--)
|
||||||
|
{
|
||||||
|
for (int x = landArrayMax - 1; x >= 0; x--)
|
||||||
|
{
|
||||||
|
if (LandBitmap[x, y])
|
||||||
|
{
|
||||||
|
return new Vector3(x * 4, y * 4, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Vector3(-1, -1, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
|
public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
|
||||||
|
@ -96,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
#region Member Functions
|
#region Member Functions
|
||||||
|
|
||||||
#region General Functions
|
#region General Functions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks to see if this land object contains a point
|
/// Checks to see if this land object contains a point
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -43,7 +43,21 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
LandData LandData { get; set; }
|
LandData LandData { get; set; }
|
||||||
bool[,] LandBitmap { get; set; }
|
bool[,] LandBitmap { get; set; }
|
||||||
UUID RegionUUID { get; }
|
UUID RegionUUID { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The start point for the land object. This is the western-most point as one scans land working from
|
||||||
|
/// north to south.
|
||||||
|
/// </summary>
|
||||||
|
Vector3 StartPoint { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The end point for the land object. This is the eastern-most point as one scans land working from
|
||||||
|
/// south to north.
|
||||||
|
/// </summary>
|
||||||
|
Vector3 EndPoint { get; }
|
||||||
|
|
||||||
bool ContainsPoint(int x, int y);
|
bool ContainsPoint(int x, int y);
|
||||||
|
|
||||||
ILandObject Copy();
|
ILandObject Copy();
|
||||||
|
|
||||||
void SendLandUpdateToAvatarsOverMe();
|
void SendLandUpdateToAvatarsOverMe();
|
||||||
|
|
|
@ -516,12 +516,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_sceneGraph.Entities; }
|
get { return m_sceneGraph.Entities; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<UUID, ScenePresence> m_restorePresences
|
|
||||||
{
|
|
||||||
get { return m_sceneGraph.RestorePresences; }
|
|
||||||
set { m_sceneGraph.RestorePresences = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Properties
|
#endregion Properties
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
@ -2584,56 +2578,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
||||||
|
|
||||||
CheckHeartbeat();
|
CheckHeartbeat();
|
||||||
ScenePresence presence;
|
|
||||||
|
|
||||||
if (m_restorePresences.ContainsKey(client.AgentId))
|
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
|
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
||||||
|
|
||||||
m_clientManager.Add(client);
|
m_clientManager.Add(client);
|
||||||
SubscribeToClientEvents(client);
|
SubscribeToClientEvents(client);
|
||||||
|
|
||||||
presence = m_restorePresences[client.AgentId];
|
ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
|
||||||
m_restorePresences.Remove(client.AgentId);
|
m_eventManager.TriggerOnNewPresence(sp);
|
||||||
|
|
||||||
// This is one of two paths to create avatars that are
|
// HERE!!! Do the initial attachments right here
|
||||||
// used. This tends to get called more in standalone
|
// first agent upon login is a root agent by design.
|
||||||
// than grid, not really sure why, but as such needs
|
// All other AddNewClient calls find aCircuit.child to be true
|
||||||
// an explicity appearance lookup here.
|
if (aCircuit.child == false)
|
||||||
AvatarAppearance appearance = null;
|
|
||||||
GetAvatarAppearance(client, out appearance);
|
|
||||||
presence.Appearance = appearance;
|
|
||||||
|
|
||||||
presence.initializeScenePresence(client, RegionInfo, this);
|
|
||||||
|
|
||||||
m_sceneGraph.AddScenePresence(presence);
|
|
||||||
|
|
||||||
lock (m_restorePresences)
|
|
||||||
{
|
{
|
||||||
Monitor.PulseAll(m_restorePresences);
|
sp.IsChildAgent = false;
|
||||||
}
|
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
|
||||||
{
|
|
||||||
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
|
||||||
|
|
||||||
m_clientManager.Add(client);
|
|
||||||
SubscribeToClientEvents(client);
|
|
||||||
|
|
||||||
ScenePresence sp = CreateAndAddScenePresence(client);
|
|
||||||
if (aCircuit != null)
|
|
||||||
sp.Appearance = aCircuit.Appearance;
|
|
||||||
|
|
||||||
// HERE!!! Do the initial attachments right here
|
|
||||||
// first agent upon login is a root agent by design.
|
|
||||||
// All other AddNewClient calls find aCircuit.child to be true
|
|
||||||
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
|
|
||||||
{
|
|
||||||
sp.IsChildAgent = false;
|
|
||||||
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3109,25 +3071,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a child agent scene presence and add it to this scene.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
|
||||||
{
|
|
||||||
CheckHeartbeat();
|
|
||||||
AvatarAppearance appearance = null;
|
|
||||||
GetAvatarAppearance(client, out appearance);
|
|
||||||
|
|
||||||
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
|
|
||||||
//avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
|
|
||||||
|
|
||||||
m_eventManager.TriggerOnNewPresence(avatar);
|
|
||||||
|
|
||||||
return avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the avatar apperance for the given client.
|
/// Get the avatar apperance for the given client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -82,7 +82,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
|
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
|
||||||
|
|
||||||
protected internal EntityManager Entities = new EntityManager();
|
protected internal EntityManager Entities = new EntityManager();
|
||||||
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
|
|
||||||
|
|
||||||
protected RegionInfo m_regInfo;
|
protected RegionInfo m_regInfo;
|
||||||
protected Scene m_parentScene;
|
protected Scene m_parentScene;
|
||||||
|
@ -629,8 +628,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ScenePresence newAvatar = null;
|
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);
|
||||||
newAvatar.IsChildAgent = true;
|
|
||||||
|
|
||||||
AddScenePresence(newAvatar);
|
AddScenePresence(newAvatar);
|
||||||
|
|
||||||
|
@ -643,6 +642,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="presence"></param>
|
/// <param name="presence"></param>
|
||||||
protected internal void AddScenePresence(ScenePresence presence)
|
protected internal void AddScenePresence(ScenePresence presence)
|
||||||
{
|
{
|
||||||
|
// Always a child when added to the scene
|
||||||
bool child = presence.IsChildAgent;
|
bool child = presence.IsChildAgent;
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
|
|
Loading…
Reference in New Issue