public bool AddToStorage(InventoryItem item, out string reason) { if (Storage.CanHoldItem(1)) { reason = String.Empty; Storage.ForceAddItem(item); return(true); } reason = ExStorageDepotBuildable.ContainerFullMessage(); return(false); }
public override void Initialize() { if (NameController == null) { NameController = new ExStorageDepotNameManager(); NameController.Initialize(this); } if (AnimationManager == null) { AnimationManager = gameObject.AddComponent <ExStorageDepotAnimationManager>(); } if (Storage == null) { Storage = gameObject.AddComponent <ExStorageDepotStorageManager>(); Storage.Initialize(this); } if (DumpContainer == null) { DumpContainer = gameObject.AddComponent <DumpContainer>(); DumpContainer.Initialize(transform, ExStorageDepotBuildable.DumpContainerLabel(), ExStorageDepotBuildable.FoodNotAllowed(), ExStorageDepotBuildable.ContainerFullMessage(), Storage); DumpContainer.OnDumpContainerClosed += Storage.OnDumpContainerClosed; } if (Display == null) { Display = gameObject.AddComponent <ExStorageDepotDisplayManager>(); Display.Initialize(this); } var locker = GameObjectHelpers.FindGameObject(gameObject, "Locker", SearchOption.StartsWith); var sRoot = GameObjectHelpers.FindGameObject(gameObject, "StorageRoot"); if (locker != null) { Destroy(locker); } if (sRoot != null) { Destroy(sRoot); } if (FCSConnectableDevice == null) { FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>(); FCSConnectableDevice.Initialize(this, Storage, new ExStoragePowerManager(), true); FCSTechFabricator.FcTechFabricatorService.PublicAPI.RegisterDevice(FCSConnectableDevice, GetPrefabID(), Mod.ExStorageTabID); } _initialized = true; }
public override void Initialize() { if (NameController == null) { NameController = new ExStorageDepotNameManager(); NameController.Initialize(this); } if (AnimationManager == null) { AnimationManager = gameObject.AddComponent <ExStorageDepotAnimationManager>(); } if (Storage == null) { Storage = gameObject.AddComponent <ExStorageDepotStorageManager>(); Storage.Initialize(this); } if (DumpContainer == null) { DumpContainer = gameObject.AddComponent <DumpContainer>(); DumpContainer.Initialize(transform, ExStorageDepotBuildable.DumpContainerLabel(), ExStorageDepotBuildable.FoodNotAllowed(), ExStorageDepotBuildable.ContainerFullMessage(), Storage); DumpContainer.OnDumpContainerClosed += Storage.OnDumpContainerClosed; } if (Display == null) { Display = gameObject.AddComponent <ExStorageDepotDisplayManager>(); Display.Initialize(this); } if (FCSConnectableDevice == null) { FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>(); FCSConnectableDevice.Initialize(this, Storage); } _initialized = true; }