Esempio n. 1
0
 internal void Initialize(FCSDeepDrillerController mono)
 {
     _mono = mono;
     FCSConnectableAwake_Patcher.AddEventHandlerIfMissing(OnFCSDeviceAwake);
     FCSConnectableDestroy_Patcher.AddEventHandlerIfMissing(OnFCSDeviceDestroy);
     FindExStorages();
     //InvokeRepeating(nameof(CheckInternalStorageForItems),1f,1f);
 }
        private void Initialize(SubRoot habitat)
        {
            ReadySaveData();
            FCSConnectableAwake_Patcher.AddEventHandlerIfMissing(AlertedNewFCSConnectablePlaced);
            FCSConnectableDestroy_Patcher.AddEventHandlerIfMissing(AlertedFCSConnectableDestroyed);

            GetFCSConnectables();


            if (NameController == null)
            {
                NameController = new NameController();
                NameController.Initialize(AuxPatchers.Submit(), Mod.AntennaFriendlyName);
                NameController.OnLabelChanged += OnLabelChangedMethod;

                if (string.IsNullOrEmpty(_savedData?.InstanceID))
                {
                    NameController.SetCurrentName(GetDefaultName());
                }
                else
                {
                    NameController.SetCurrentName(_savedData?.BaseName);
                }
            }

            if (DumpContainer == null)
            {
                DumpContainer = habitat.gameObject.AddComponent <DumpContainer>();
                DumpContainer.Initialize(habitat.transform, AuxPatchers.BaseDumpReceptacle(), AuxPatchers.NotAllowed(),
                                         AuxPatchers.CannotBeStored(), this);
            }

            if (DockingManager == null)
            {
                DockingManager = habitat.gameObject.AddComponent <DSSVehicleDockingManager>();
                DockingManager.Initialize(habitat, this);
                DockingManager.ToggleIsEnabled(_savedData?.AllowDocking ?? false);
            }

            _hasBreakerTripped = _savedData?.HasBreakerTripped ?? false;
        }