예제 #1
0
        /// <summary>
        /// Mounts a new module to the station
        /// </summary>
        /// <param name="module">Station module to mount</param>
        /// <returns>Negative if error. If successful, returns the module index.</returns>
        public virtual int MountModule(StationModuleBase module)
        {
            if (modules != null)
            {
                for (int i = 0; i < modules.Count; i++)
                {
                    if (modules[i] != null && modules[i].GetType() == module.GetType())
                    {
                        return(-2);
                    }
                }

                modules.Add(module);
                module.parent = this;
                module.OnMount();

                return(0);
            }
            else
            {
                return(-3);
            }
        }