Beispiel #1
0
        /// <summary>
        /// Initialize config common for this module and any descendents.
        /// </summary>
        /// <param name="source"></param>
        protected virtual void InitialiseCommon(IConfigSource source)
        {
            string transferVersionName = "SIMULATION";
            float maxTransferVersion = 0.3f;

            IConfig hypergridConfig = source.Configs["Hypergrid"];
            if (hypergridConfig != null)
            {
                m_ThisHomeURI = hypergridConfig.GetString("HomeURI", string.Empty);
                if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/"))
                    m_ThisHomeURI += '/';

                m_GatekeeperURI = hypergridConfig.GetString("GatekeeperURI", string.Empty);
                if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/"))
                    m_GatekeeperURI += '/';
            }

            IConfig transferConfig = source.Configs["EntityTransfer"];
            if (transferConfig != null)
            {
                string rawVersion 
                    = transferConfig.GetString(
                        "MaxOutgoingTransferVersion", 
                        string.Format("{0}/{1}", transferVersionName, maxTransferVersion));

                string[] rawVersionComponents = rawVersion.Split(new char[] { '/' });

                bool versionValid = false;

                if (rawVersionComponents.Length >= 2)
                    versionValid = float.TryParse(rawVersionComponents[1], out maxTransferVersion);

                if (!versionValid)
                {
                    m_log.ErrorFormat(
                        "[ENTITY TRANSFER MODULE]: MaxOutgoingTransferVersion {0} is invalid, using {1}", 
                        rawVersion, string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
                }
                else
                {
                    transferVersionName = rawVersionComponents[0];

                    m_log.InfoFormat(
                        "[ENTITY TRANSFER MODULE]: MaxOutgoingTransferVersion set to {0}", 
                        string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
                }

                DisableInterRegionTeleportCancellation 
                    = transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);

                WaitForAgentArrivedAtDestination
                    = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault);
                
                MaxTransferDistance = transferConfig.GetInt("max_distance", DefaultMaxTransferDistance);
            }
            else
            {
                MaxTransferDistance = DefaultMaxTransferDistance;
            }

            OutgoingTransferVersionName = transferVersionName;
            MaxOutgoingTransferVersion = maxTransferVersion;

            m_entityTransferStateMachine = new EntityTransferStateMachine(this);

            m_Enabled = true;
        }
        /// <summary>
        /// Initialize config common for this module and any descendents.
        /// </summary>
        /// <param name="source"></param>
        protected virtual void InitialiseCommon(IConfigSource source)
        {
            IConfig transferConfig = source.Configs["EntityTransfer"];
            if (transferConfig != null)
            {
                WaitForAgentArrivedAtDestination
                    = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault);
                
                MaxTransferDistance = transferConfig.GetInt("max_distance", DefaultMaxTransferDistance);
            }
            else
            {
                MaxTransferDistance = DefaultMaxTransferDistance;
            }

            m_entityTransferStateMachine = new EntityTransferStateMachine(this);

            m_Enabled = true;
        }