From 27f182ac54ffee16da730b2053480944f9ca5412 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 1 Dec 2007 14:20:37 +0000 Subject: 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. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 4 +- OpenSim/Region/Environment/Scenes/Scene.cs | 46 ++++++++++++---------- 2 files changed, 28 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 877bfe5..5b6b9cb 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -362,7 +362,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - 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) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f2eb486..39f1620 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -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(); + 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(); m_worldCommModule = RequestModuleInterface(); XferManager = RequestModuleInterface(); + m_AvatarFactory = RequestModuleInterface(); } #endregion @@ -792,7 +793,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - 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); + } + } + /// /// @@ -1145,6 +1150,7 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.KillObject = SendKillObject; } + public void UnRegisterReginWithComms() { m_sceneGridService.OnRegionUp -= OtherRegionUp; -- cgit v1.1