From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- OpenSim/Region/Framework/Scenes/SceneBase.cs | 78 +++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneBase.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index d3e968e..7ff3d40 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -44,6 +44,10 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +#pragma warning disable 414 + private static readonly string LogHeader = "[SCENE]"; +#pragma warning restore 414 + #region Events public event restart OnRestart; @@ -78,6 +82,13 @@ namespace OpenSim.Region.Framework.Scenes /// protected Dictionary> ModuleInterfaces = new Dictionary>(); + /// + /// These two objects hold the information about any formats used + /// by modules that hold agent specific data. + /// + protected List FormatsOffered = new List(); + protected Dictionary> FormatsWanted = new Dictionary>(); + protected Dictionary ModuleAPIMethods = new Dictionary(); /// @@ -141,10 +152,6 @@ namespace OpenSim.Region.Framework.Scenes get { return 1.0f; } } - protected ulong m_regionHandle; - protected string m_regionName; - protected RegionInfo m_regInfo; - public ITerrainChannel Heightmap; /// @@ -192,7 +199,8 @@ namespace OpenSim.Region.Framework.Scenes /// Number of frames to update. Exits on shutdown even if there are frames remaining. /// If -1 then updates until shutdown. /// - public abstract void Update(int frames); + /// true if update completed within minimum frame time, false otherwise. + public abstract bool Update(int frames); #endregion @@ -209,15 +217,21 @@ namespace OpenSim.Region.Framework.Scenes /// Client to send to public virtual void SendLayerData(IClientAPI RemoteClient) { - RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); + // RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); + ITerrainModule terrModule = RequestModuleInterface(); + if (terrModule != null) + { + terrModule.PushTerrain(RemoteClient); + } } #endregion #region Add/Remove Agent/Avatar - public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type); - public abstract void RemoveClient(UUID agentID, bool closeChildAgents); + public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); + + public abstract bool CloseAgent(UUID agentID, bool force); public bool TryGetScenePresence(UUID agentID, out object scenePresence) { @@ -360,6 +374,38 @@ namespace OpenSim.Region.Framework.Scenes return m_moduleCommanders; } + public List GetFormatsOffered() + { + List ret = new List(FormatsOffered); + + return ret; + } + + protected void CheckAndAddAgentDataFormats(object mod) + { + if (!(mod is IAgentStatefulModule)) + return; + + IAgentStatefulModule m = (IAgentStatefulModule)mod; + + List renderFormats = m.GetRenderStateFormats(); + List acceptFormats = m.GetAcceptStateFormats(); + + foreach (UUID render in renderFormats) + { + if (!(FormatsOffered.Contains(render))) + FormatsOffered.Add(render); + } + + if (acceptFormats.Count == 0) + return; + + if (FormatsWanted.ContainsKey(mod)) + return; + + FormatsWanted[mod] = acceptFormats; + } + /// /// Register an interface to a region module. This allows module methods to be called directly as /// well as via events. If there is already a module registered for this interface, it is not replaced @@ -382,6 +428,8 @@ namespace OpenSim.Region.Framework.Scenes l.Add(mod); + CheckAndAddAgentDataFormats(mod); + if (mod is IEntityCreator) { IEntityCreator entityCreator = (IEntityCreator)mod; @@ -394,6 +442,14 @@ namespace OpenSim.Region.Framework.Scenes public void UnregisterModuleInterface(M mod) { + // We can't unregister agent stateful modules because + // that would require much more data to be held about formats + // and would make that code slower and less efficient. + // No known modules are unregistered anyway, ever, unless + // the simulator shuts down anyway. + if (mod is IAgentStatefulModule) + return; + List l; if (ModuleInterfaces.TryGetValue(typeof(M), out l)) { @@ -424,6 +480,8 @@ namespace OpenSim.Region.Framework.Scenes l.Add(mod); + CheckAndAddAgentDataFormats(mod); + if (mod is IEntityCreator) { IEntityCreator entityCreator = (IEntityCreator)mod; @@ -561,6 +619,10 @@ namespace OpenSim.Region.Framework.Scenes get { return false; } } + public virtual void Start() + { + } + public void Restart() { // This has to be here to fire the event -- cgit v1.1