Part 1 of a commit. This revision will not compile, part 2 will be added in a couple of minutes that should fix that.
Some work towards persisting Avatar Appearance (what is being worn). Added OnAvatarNowWearing event to IClientAPI that is triggered by AgentIsNowWearing packets. stub code to subscribe to this event in AvatarFactoryModule. Todo: code needs to be added to AvatarFactoryModule to save the uuids to a database and then read them back when that modules TryGetIntialAvatarAppearance() method is called. Done some changes to Scene to make it easier to subclass it: including changed some private fields to protected and made some methods virtual.afrisby
parent
6aef4a09f9
commit
27f182ac54
|
@ -57,7 +57,7 @@ namespace OpenSim.Framework
|
|||
public enum ThrottleOutPacketType : int
|
||||
{
|
||||
Resend = 0,
|
||||
Land = 1,
|
||||
Land = 1,
|
||||
Wind = 2,
|
||||
Cloud = 3,
|
||||
Task = 4,
|
||||
|
@ -172,8 +172,33 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public class AvatarWearingArgs : EventArgs
|
||||
{
|
||||
private List<Wearable> m_nowWearing = new List<Wearable>();
|
||||
|
||||
public List<Wearable> NowWearing
|
||||
{
|
||||
get { return m_nowWearing; }
|
||||
set { m_nowWearing = value; }
|
||||
}
|
||||
|
||||
public class Wearable
|
||||
{
|
||||
public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||
public byte Type = 0;
|
||||
|
||||
public Wearable(LLUUID itemId, byte type)
|
||||
{
|
||||
ItemID = itemId;
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void TextureRequest(Object sender, TextureRequestArgs e);
|
||||
|
||||
public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e);
|
||||
|
||||
public delegate void ImprovedInstantMessage(
|
||||
LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp,
|
||||
string fromAgentName, string message, byte dialog); // Cut down from full list
|
||||
|
@ -187,7 +212,7 @@ namespace OpenSim.Framework
|
|||
public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq);
|
||||
|
||||
public delegate void LinkObjects(uint parent, List<uint> children);
|
||||
|
||||
|
||||
public delegate void DelinkObjects(List<uint> primIds);
|
||||
|
||||
public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY);
|
||||
|
@ -200,7 +225,7 @@ namespace OpenSim.Framework
|
|||
public delegate void DisconnectUser();
|
||||
|
||||
public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
|
||||
public delegate void SetAlwaysRun (IClientAPI remoteClient, bool SetAlwaysRun);
|
||||
public delegate void SetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun);
|
||||
|
||||
public delegate void GenericCall2();
|
||||
|
||||
|
@ -217,7 +242,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
|
||||
|
||||
public delegate void RequestObjectPropertiesFamily(IClientAPI remoteClient,LLUUID AgentID, uint RequestFlags, LLUUID TaskID);
|
||||
public delegate void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID TaskID);
|
||||
|
||||
public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
|
||||
|
||||
|
@ -268,7 +293,7 @@ namespace OpenSim.Framework
|
|||
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape);
|
||||
|
||||
public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client);
|
||||
|
||||
|
||||
public delegate void GodKickUser(LLUUID GodAgentID, LLUUID GodSessionID, LLUUID AgentID, uint kickflags, byte[] reason);
|
||||
|
||||
public delegate void CreateInventoryFolder(
|
||||
|
@ -314,6 +339,7 @@ namespace OpenSim.Framework
|
|||
event RezObject OnRezObject;
|
||||
event ModifyTerrain OnModifyTerrain;
|
||||
event SetAppearance OnSetAppearance;
|
||||
event AvatarNowWearing OnAvatarNowWearing;
|
||||
event StartAnim OnStartAnim;
|
||||
event LinkObjects OnLinkObjects;
|
||||
event DelinkObjects OnDelinkObjects;
|
||||
|
@ -447,7 +473,7 @@ namespace OpenSim.Framework
|
|||
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||
LLQuaternion rotation);
|
||||
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||
LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity);
|
||||
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity);
|
||||
|
||||
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount);
|
||||
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
|
||||
|
|
|
@ -568,6 +568,7 @@ namespace OpenSim.Region.ClientStack
|
|||
public event Action<IClientAPI> OnRegionHandShakeReply;
|
||||
public event GenericCall2 OnRequestWearables;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event GenericCall2 OnCompleteMovementToRegion;
|
||||
public event UpdateAgent OnAgentUpdate;
|
||||
public event AgentRequestSit OnAgentRequestSit;
|
||||
|
@ -2662,6 +2663,19 @@ namespace OpenSim.Region.ClientStack
|
|||
OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
|
||||
}
|
||||
break;
|
||||
case PacketType.AgentIsNowWearing:
|
||||
if (OnAvatarNowWearing != null)
|
||||
{
|
||||
AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack;
|
||||
AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
|
||||
for (int i = 0; i < nowWearing.WearableData.Length; i++)
|
||||
{
|
||||
AvatarWearingArgs.Wearable wearable = new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, nowWearing.WearableData[i].WearableType);
|
||||
wearingArgs.NowWearing.Add(wearable);
|
||||
}
|
||||
OnAvatarNowWearing(this, wearingArgs);
|
||||
}
|
||||
break;
|
||||
case PacketType.SetAlwaysRun:
|
||||
SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
|
||||
|
||||
|
@ -3604,10 +3618,6 @@ namespace OpenSim.Region.ClientStack
|
|||
// Parhaps this should be processed on the Sim to determine whether or not to drop a dead client
|
||||
// Dumping it to the verbose console until it's handled properly.
|
||||
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "unhandled packet " + Pack.ToString());
|
||||
break;
|
||||
case PacketType.AgentIsNowWearing:
|
||||
// AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "unhandled packet " + Pack.ToString());
|
||||
break;
|
||||
case PacketType.ObjectScale:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using libsecondlife;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
|
@ -8,6 +9,8 @@ namespace OpenSim.Region.Environment.Modules
|
|||
{
|
||||
public class AvatarFactoryModule : IAvatarFactory
|
||||
{
|
||||
private Scene m_scene = null;
|
||||
|
||||
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
|
||||
out byte[] visualParams)
|
||||
{
|
||||
|
@ -18,6 +21,12 @@ namespace OpenSim.Region.Environment.Modules
|
|||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
scene.RegisterModuleInterface<IAvatarFactory>(this);
|
||||
// scene.EventManager.OnNewClient += NewClient;
|
||||
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
|
@ -38,6 +47,27 @@ namespace OpenSim.Region.Environment.Modules
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
// client.OnAvatarNowWearing += AvatarIsWearing;
|
||||
}
|
||||
|
||||
public void RemoveClient(IClientAPI client)
|
||||
{
|
||||
// client.OnAvatarNowWearing -= AvatarIsWearing;
|
||||
}
|
||||
|
||||
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
||||
{
|
||||
IClientAPI clientView = (IClientAPI) sender;
|
||||
//Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
|
||||
// then store assetid and itemId and wearable type in a database
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
LLUUID assetID = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId).RootFolder.HasItem(wear.ItemID).assetID;
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
||||
{
|
||||
visualParams = new byte[218];
|
||||
|
|
|
@ -362,7 +362,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
/// <param name="packet"></param>
|
||||
/// <param name="simClient"></param>
|
||||
public void DeRezObject(Packet packet, IClientAPI remoteClient)
|
||||
public virtual void DeRezObject(Packet packet, IClientAPI remoteClient)
|
||||
{
|
||||
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
|
||||
|
||||
|
@ -443,7 +443,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
group.DeleteParts();
|
||||
}
|
||||
|
||||
public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
|
||||
public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
|
|
|
@ -96,11 +96,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public IXfer XferManager;
|
||||
|
||||
private IHttpRequests m_httpRequestModule;
|
||||
private ISimChat m_simChatModule;
|
||||
private IXMLRPC m_xmlrpcModule;
|
||||
private IWorldComm m_worldCommModule;
|
||||
private IAvatarFactory m_AvatarFactory;
|
||||
protected IHttpRequests m_httpRequestModule;
|
||||
protected ISimChat m_simChatModule;
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
protected IAvatarFactory m_AvatarFactory;
|
||||
|
||||
// Central Update Loop
|
||||
|
||||
|
@ -128,14 +128,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
get { return m_authenticateHandler; }
|
||||
}
|
||||
|
||||
private readonly LandManager m_LandManager;
|
||||
protected readonly LandManager m_LandManager;
|
||||
|
||||
public LandManager LandManager
|
||||
{
|
||||
get { return m_LandManager; }
|
||||
}
|
||||
|
||||
private readonly EstateManager m_estateManager;
|
||||
protected readonly EstateManager m_estateManager;
|
||||
|
||||
public PhysicsScene PhysicsScene
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
get { return m_timedilation; }
|
||||
}
|
||||
|
||||
private readonly PermissionManager m_permissionManager;
|
||||
protected readonly PermissionManager m_permissionManager;
|
||||
|
||||
public PermissionManager PermissionsMngr
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public override bool OtherRegionUp(RegionInfo otherRegion)
|
||||
{
|
||||
// Another region is up. We have to tell all our ScenePresences about it
|
||||
/* // Another region is up. We have to tell all our ScenePresences about it
|
||||
// This fails to get the desired effect and needs further work.
|
||||
|
||||
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
|
||||
|
@ -289,7 +289,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client");
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
// Reset list to nothing.
|
||||
m_regionRestartNotifyList = new List<RegionInfo>();
|
||||
m_regionRestartNotifyList.Clear();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
|
@ -397,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_innerScene.Close();
|
||||
UnRegisterReginWithComms();
|
||||
|
||||
foreach (IRegionModule module in this.Modules.Values)
|
||||
foreach (IRegionModule module in Modules.Values)
|
||||
{
|
||||
if (!module.IsSharedModule)
|
||||
{
|
||||
|
@ -427,6 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
|
||||
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
||||
XferManager = RequestModuleInterface<IXfer>();
|
||||
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -792,7 +793,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
/// <param name="addPacket"></param>
|
||||
/// <param name="ownerID"></param>
|
||||
public void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape)
|
||||
public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape)
|
||||
{
|
||||
|
||||
// What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision
|
||||
|
@ -1015,18 +1016,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
EventManager.TriggerOnNewClient(client);
|
||||
}
|
||||
|
||||
protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
|
||||
byte[] visualParams;
|
||||
AvatarWearable[] wearables;
|
||||
|
||||
if (m_AvatarFactory == null ||
|
||||
!m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams))
|
||||
{
|
||||
AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||
}
|
||||
LoadAvatarAppearance(client, out visualParams, out wearables);
|
||||
|
||||
avatar = m_innerScene.CreateAndAddScenePresence(client, child, wearables, visualParams);
|
||||
|
||||
|
@ -1038,6 +1034,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return avatar;
|
||||
}
|
||||
|
||||
protected void LoadAvatarAppearance(IClientAPI client, out byte[] visualParams, out AvatarWearable[] wearables)
|
||||
{
|
||||
if (m_AvatarFactory == null ||
|
||||
!m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams))
|
||||
{
|
||||
AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -1145,6 +1150,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_sceneGridService.KillObject = SendKillObject;
|
||||
}
|
||||
|
||||
|
||||
public void UnRegisterReginWithComms()
|
||||
{
|
||||
m_sceneGridService.OnRegionUp -= OtherRegionUp;
|
||||
|
|
Loading…
Reference in New Issue