예제 #1
0
        public void Init(ShipyardType yardType)
        {
            if (YardType == yardType)
            {
                return;
            }

            Logging.Instance.WriteDebug("YardItem.Init: " + yardType);

            YardType = yardType;

            foreach (IMyCubeGrid grid in ContainsGrids)
            {
                ((MyCubeGrid)grid).OnGridSplit += OnGridSplit;
            }

            YardGrids = ContainsGrids.Where(x => !x.Closed && !x.MarkedForClose).ToList();
            ContainsGrids.Clear();
            IntersectsGrids.Clear();
            Utilities.Invoke(() =>
            {
                foreach (IMyCubeBlock tool in Tools)
                {
                    var myFunctionalBlock = tool as IMyFunctionalBlock;
                    if (myFunctionalBlock != null)
                    {
                        myFunctionalBlock.Enabled = true;                  //.RequestEnable(true);
                    }
                }
            });

            Communication.SendYardState(this);
        }