* ModuleLoader: Privatized some too-public fields
* Scene: Changed name from MakeAvatarPhysical to MakeRootAgent and added ForEachClient * SceneManager: Added ForEachScene * Worked some on appearances.afrisby
parent
27f003b683
commit
03d49b0217
|
@ -39,6 +39,12 @@ namespace OpenSim.Framework.Types
|
|||
|
||||
}
|
||||
|
||||
public AvatarWearable( LLUUID itemId, LLUUID assetId )
|
||||
{
|
||||
AssetID = assetId;
|
||||
ItemID = itemId;
|
||||
}
|
||||
|
||||
public static AvatarWearable[] DefaultWearables
|
||||
{
|
||||
get
|
||||
|
|
|
@ -750,7 +750,7 @@ namespace OpenSim
|
|||
break;
|
||||
case "modules":
|
||||
m_log.Error("The currently loaded shared modules are:");
|
||||
foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.LoadedSharedModules.Values)
|
||||
foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.GetLoadedSharedModules )
|
||||
{
|
||||
m_log.Error("Shared Module: " + module.Name);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
@ -42,10 +43,10 @@ namespace OpenSim.Region.Environment
|
|||
{
|
||||
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
|
||||
|
||||
public List<IRegionModule> LoadedModules = new List<IRegionModule>();
|
||||
public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
|
||||
private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
|
||||
private Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
|
||||
private readonly LogBase m_log;
|
||||
private IConfigSource m_config;
|
||||
private readonly IConfigSource m_config;
|
||||
|
||||
public ModuleLoader(LogBase log, IConfigSource config)
|
||||
{
|
||||
|
@ -53,6 +54,16 @@ namespace OpenSim.Region.Environment
|
|||
m_config = config;
|
||||
}
|
||||
|
||||
public IRegionModule[] GetLoadedSharedModules
|
||||
{
|
||||
get
|
||||
{
|
||||
IRegionModule[] regionModules = new IRegionModule[ m_loadedSharedModules.Count ];
|
||||
m_loadedSharedModules.Values.CopyTo( regionModules, 0 );
|
||||
return regionModules;
|
||||
}
|
||||
}
|
||||
|
||||
public void PickupModules(Scene scene, string moduleDir)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(moduleDir);
|
||||
|
@ -66,19 +77,19 @@ namespace OpenSim.Region.Environment
|
|||
public void LoadDefaultSharedModules()
|
||||
{
|
||||
DynamicTextureModule dynamicModule = new DynamicTextureModule();
|
||||
LoadedSharedModules.Add(dynamicModule.Name, dynamicModule);
|
||||
m_loadedSharedModules.Add(dynamicModule.Name, dynamicModule);
|
||||
|
||||
ChatModule chat = new ChatModule();
|
||||
LoadedSharedModules.Add(chat.Name, chat);
|
||||
m_loadedSharedModules.Add(chat.Name, chat);
|
||||
|
||||
InstantMessageModule imMod = new InstantMessageModule();
|
||||
LoadedSharedModules.Add(imMod.Name, imMod);
|
||||
m_loadedSharedModules.Add(imMod.Name, imMod);
|
||||
|
||||
LoadImageURLModule loadMod = new LoadImageURLModule();
|
||||
LoadedSharedModules.Add(loadMod.Name, loadMod);
|
||||
m_loadedSharedModules.Add(loadMod.Name, loadMod);
|
||||
|
||||
AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
|
||||
LoadedSharedModules.Add(avatarFactory.Name, avatarFactory);
|
||||
m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory);
|
||||
|
||||
//TextureDownloadModule textureModule = new TextureDownloadModule();
|
||||
//LoadedSharedModules.Add(textureModule.Name, textureModule);
|
||||
|
@ -86,7 +97,7 @@ namespace OpenSim.Region.Environment
|
|||
|
||||
public void InitialiseSharedModules(Scene scene)
|
||||
{
|
||||
foreach (IRegionModule module in LoadedSharedModules.Values)
|
||||
foreach (IRegionModule module in m_loadedSharedModules.Values)
|
||||
{
|
||||
module.Initialise(scene, m_config);
|
||||
scene.AddModule(module.Name, module); //should be doing this?
|
||||
|
@ -97,7 +108,7 @@ namespace OpenSim.Region.Environment
|
|||
{
|
||||
module.Initialise(scene, m_config);
|
||||
scene.AddModule(module.Name, module);
|
||||
LoadedModules.Add(module);
|
||||
m_loadedModules.Add(module);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -111,7 +122,7 @@ namespace OpenSim.Region.Environment
|
|||
IRegionModule module = LoadModule(dllName, moduleName);
|
||||
if (module != null)
|
||||
{
|
||||
LoadedSharedModules.Add(module.Name, module);
|
||||
m_loadedSharedModules.Add(module.Name, module);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,12 +215,12 @@ namespace OpenSim.Region.Environment
|
|||
|
||||
public void PostInitialise()
|
||||
{
|
||||
foreach (IRegionModule module in LoadedSharedModules.Values)
|
||||
foreach (IRegionModule module in m_loadedSharedModules.Values)
|
||||
{
|
||||
module.PostInitialise();
|
||||
}
|
||||
|
||||
foreach (IRegionModule module in LoadedModules)
|
||||
foreach (IRegionModule module in m_loadedModules)
|
||||
{
|
||||
module.PostInitialise();
|
||||
}
|
||||
|
|
|
@ -1134,7 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
if (m_scenePresences.ContainsKey(agentID))
|
||||
{
|
||||
m_scenePresences[agentID].MakeAvatarPhysical(position, isFlying);
|
||||
m_scenePresences[agentID].MakeRootAgent(position, isFlying);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1570,5 +1570,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
avatar = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void ForEachClient( Action<IClientAPI> action )
|
||||
{
|
||||
foreach (ScenePresence presence in m_scenePresences.Values )
|
||||
{
|
||||
action(presence.ControllingClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -310,5 +310,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
avatar = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ForEachScene(Action<Scene> action )
|
||||
{
|
||||
m_localScenes.ForEach( action );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,8 +248,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
Animations.LoadAnims();
|
||||
|
||||
//register for events
|
||||
m_controllingClient.OnRequestWearables += SendOurAppearance;
|
||||
m_controllingClient.OnSetAppearance += new SetAppearance(SetAppearance);
|
||||
m_controllingClient.OnRequestWearables += SendAppearance;
|
||||
m_controllingClient.OnSetAppearance += SetAppearance;
|
||||
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
|
||||
m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
|
||||
m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
|
||||
|
@ -343,7 +343,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
#region Status Methods
|
||||
|
||||
public void MakeAvatarPhysical(LLVector3 pos, bool isFlying)
|
||||
public void MakeRootAgent(LLVector3 pos, bool isFlying)
|
||||
{
|
||||
m_newAvatar = true;
|
||||
m_isChildAgent = false;
|
||||
|
@ -412,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_visualParams[i] = visualParam[i].ParamValue;
|
||||
}
|
||||
|
||||
SendAppearanceToAllOtherAgents();
|
||||
SendAppearanceToAllOtherClients();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -433,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_isChildAgent = false;
|
||||
|
||||
//this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
|
||||
this.MakeAvatarPhysical(this.AbsolutePosition, false);
|
||||
this.MakeRootAgent(this.AbsolutePosition, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -707,16 +707,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public void SendFullUpdateToAllClients()
|
||||
{
|
||||
List<ScenePresence> avatars = m_scene.GetScenePresences();
|
||||
foreach (ScenePresence avatar in avatars)
|
||||
List<ScenePresence> agents = m_scene.GetScenePresences();
|
||||
foreach (ScenePresence agent in agents)
|
||||
{
|
||||
SendFullUpdateToOtherClient(avatar);
|
||||
if (avatar.LocalId != LocalId)
|
||||
IClientAPI client = agent.ControllingClient;
|
||||
client.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
|
||||
LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID );
|
||||
|
||||
if (agent.LocalId != LocalId)
|
||||
{
|
||||
if (!avatar.m_isChildAgent)
|
||||
if (!agent.m_isChildAgent)
|
||||
{
|
||||
avatar.SendFullUpdateToOtherClient(this);
|
||||
avatar.SendAppearanceToOtherAgent(this);
|
||||
client.SendAppearance(m_controllingClient.AgentId, m_visualParams,
|
||||
m_textureEntry.ToBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -736,22 +739,28 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
SendFullUpdateToAllClients();
|
||||
SendAppearanceToAllOtherAgents();
|
||||
SendAppearanceToAllOtherClients();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="OurClient"></param>
|
||||
public void SendOurAppearance(IClientAPI OurClient)
|
||||
public void SetWearable( int wearableId, AvatarWearable wearable )
|
||||
{
|
||||
m_controllingClient.SendWearables(m_wearables);
|
||||
m_wearables[wearableId] = wearable;
|
||||
|
||||
m_scene.ForEachClient( delegate( IClientAPI client )
|
||||
{
|
||||
SendAppearance( client );
|
||||
});
|
||||
}
|
||||
|
||||
public void SendAppearance(IClientAPI client)
|
||||
{
|
||||
client.SendWearables(m_wearables);
|
||||
|
||||
//this.SendFullUpdateToAllClients();
|
||||
//this.SendAppearanceToAllOtherAgents();
|
||||
//this.SendAppearanceToAllOtherClients();
|
||||
|
||||
m_scene.SendAllSceneObjectsToClient(this);
|
||||
m_controllingClient.SendViewerTime(m_scene.TimePhase);
|
||||
client.SendViewerTime(m_scene.TimePhase);
|
||||
|
||||
//Please don't remove the following code (at least not yet), just leave it commented out
|
||||
//gives the user god powers, should help with debuging things in the future
|
||||
|
@ -767,25 +776,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SendAppearanceToAllOtherAgents()
|
||||
public void SendAppearanceToAllOtherClients()
|
||||
{
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||
{
|
||||
if (scenePresence != this)
|
||||
{
|
||||
SendAppearanceToOtherAgent(scenePresence);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="avatarInfo"></param>
|
||||
public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
|
||||
{
|
||||
avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams,
|
||||
m_textureEntry.ToBytes());
|
||||
m_scene.ForEachClient(delegate(IClientAPI client)
|
||||
{
|
||||
if( client != m_controllingClient )
|
||||
{
|
||||
client.SendAppearance(m_controllingClient.AgentId, m_visualParams,
|
||||
m_textureEntry.ToBytes() );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue