protected override void ModifyGameObject() { SeamothStorageContainer container = GameObjectClone.GetComponent <SeamothStorageContainer>(); container.width = 7; container.height = 8; }
public static Optional <ItemsContainer> GetBasedOnOwnersType(GameObject owner) { SeamothStorageContainer seamothStorageContainer = owner.GetComponent <SeamothStorageContainer>(); if (seamothStorageContainer != null) { return(Optional.Of(seamothStorageContainer.container)); } StorageContainer storageContainer = owner.GetComponentInChildren <StorageContainer>(); if (storageContainer != null) { return(Optional.Of(storageContainer.container)); } BaseBioReactor baseBioReactor = owner.GetComponentInChildren <BaseBioReactor>(); if (baseBioReactor != null) { ItemsContainer container = (ItemsContainer)baseBioReactor.ReflectionGetProperty("container"); return(Optional.Of(container)); } if (owner.name == "Player") { return(Optional.Of(Inventory.Get().container)); } Log.Debug("Couldn't resolve container from gameObject: " + owner.name); return(Optional.Empty); }
protected override void PostModify() { SeamothStorageContainer container = PrefabClone.GetComponent <SeamothStorageContainer>(); container.width = 4; container.height = 4; }
public static Optional <ItemsContainer> GetBasedOnOwnersType(GameObject owner) { SeamothStorageContainer seamothStorageContainer = owner.GetComponent <SeamothStorageContainer>(); if (seamothStorageContainer != null) { return(Optional <ItemsContainer> .Of(seamothStorageContainer.container)); } StorageContainer storageContainer = owner.GetComponent <StorageContainer>(); if (storageContainer != null) { return(Optional <ItemsContainer> .Of(storageContainer.container)); } return(Optional <ItemsContainer> .Empty()); }
public static Optional <ItemsContainer> TryGetContainerByOwner(GameObject owner) { SeamothStorageContainer seamothStorageContainer = owner.GetComponent <SeamothStorageContainer>(); if (seamothStorageContainer) { return(Optional.Of(seamothStorageContainer.container)); } StorageContainer storageContainer = owner.GetComponentInChildren <StorageContainer>(); if (storageContainer) { return(Optional.Of(storageContainer.container)); } BaseBioReactor baseBioReactor = owner.GetComponentInChildren <BaseBioReactor>(); if (baseBioReactor) { ItemsContainer container = (ItemsContainer)baseBioReactor.ReflectionGetProperty("container"); return(Optional.Of(container)); } if (owner.name == "Player") { return(Optional.Of(Inventory.Get().container)); } if (owner.GetComponentInChildren <PingInstance>().GetLabel().StartsWith("Player ")) { if (playerManager == null) { playerManager = NitroxServiceLocator.LocateService <PlayerManager>(); } Optional <RemotePlayer> opPlayer = playerManager.FindByName(owner.name); if (opPlayer.HasValue) { return(Optional.Of(opPlayer.Value.Inventory)); } } Log.Debug("Couldn't resolve container from gameObject: " + owner.name); return(Optional.Empty); }
private static ItemsContainer GetItemsContainerFromIventoryItem(InventoryItem inventoryItem, TechType techType) { if (inventoryItem == null) { return(null); } var module = Modules.ContainsKey(techType) ? Modules[techType] : null; Pickupable pickupable = inventoryItem.item; SeamothStorageContainer storageContainer = pickupable.GetComponent <SeamothStorageContainer>(); if (storageContainer == null) { return(null); } ItemsContainer itemsContainer = storageContainer.container; itemsContainer.Resize(module?.StorageWidth ?? 4, module?.StorageHeight ?? 4); return(itemsContainer); }
private static bool Prefix(SeaMoth __instance, ref bool __result, Pickupable pickupable, bool verbose) { TechType techType = pickupable.GetTechType(); if (techType == TechType.SeamothTorpedoModule) { SeamothStorageContainer torpedoStorage = pickupable.GetComponent <SeamothStorageContainer>(); if (torpedoStorage != null) { bool empty = torpedoStorage.container.count == 0; if (verbose && !empty) { ErrorMessage.AddDebug("Torpedo silo is not empty"); } __result = empty; return(false); } } return(true); }
public static Optional <ItemsContainer> GetBasedOnOwnersType(GameObject owner) { SeamothStorageContainer seamothStorageContainer = owner.GetComponent <SeamothStorageContainer>(); if (seamothStorageContainer != null) { return(Optional.Of(seamothStorageContainer.container)); } StorageContainer storageContainer = owner.GetComponentInChildren <StorageContainer>(); if (storageContainer != null) { return(Optional.Of(storageContainer.container)); } if (owner.name == "Player") { return(Optional.Of(Inventory.Get().container)); } return(Optional.Empty); }
internal static bool IsAllowedToRemove(SeaMoth seaMoth, Pickupable pickupable, bool verbose) { if (!IsStorageModule(pickupable.GetTechType())) { return(true); } SeamothStorageContainer component = pickupable.GetComponent <SeamothStorageContainer>(); if (component == null) { return(true); } var flag = component.container.count == 0; if (verbose && !flag) { ErrorMessage.AddDebug(Language.main.Get("SeamothStorageNotEmpty")); } return(flag); }
private static void Postfix(SeamothStorageContainer __instance) { string name = __instance.gameObject.name; var techType = CraftData.GetTechType(__instance.gameObject); string ContainerID = (techType.ToString() + "." + name).Replace("(Clone)", ""); string lowerID = ContainerID.ToLower(); if (techType == TechType.None) { #if !RELEASE Logger.Log(Logger.Level.Info, $"Container {name} has TechType of None and is not the Lifepod locker, skipping"); #endif return; } Vector2int NewSize; if (Main.config.TryGetModSize(ContainerID, out NewSize)) { #if !RELEASE Logger.Log(Logger.Level.Debug, $"Configuration for items container {ContainerID} was found with value of ({NewSize.x}, {NewSize.y})"); #endif __instance.container.Resize(NewSize.x, NewSize.y); return; } if (NewSize.x * NewSize.y != 0) { // TryGetNewSize returned false, but with a non-zero vector; this should mean that the value was found, but with default value. #if !RELEASE Logger.Log(Logger.Level.Debug, $"Items container {ContainerID} was found, but with default values; nothing to do."); #endif return; } #if !RELEASE Logger.Log(Logger.Level.Info, $"Items container identifier {ContainerID} was not found in configuration settings; using default values"); #endif Main.config.AddContainer(lowerID, __instance.width, __instance.height); }
private bool IsAllowedToRemove(Pickupable pickupable, bool verbose) { TechType techType = pickupable.GetTechType(); if (techType == SeaTruckStorage_Prefab.TechTypeID) { SeamothStorageContainer component = pickupable.GetComponent <SeamothStorageContainer>(); if (component != null) { bool flag = component.container.count == 0; if (verbose && !flag) { ErrorMessage.AddDebug(Language.main.Get("DeconstructNonEmptyStorageContainerError")); } return(flag); } Debug.LogError("No SeamothStorageContainer found on SeaTruckStorageModule item"); } return(true); }
private static bool Prefix(SeamothStorageContainer __instance) { __instance.width = Mod.config.SeamothStorage.width; __instance.height = Mod.config.SeamothStorage.height; return(true); }
public static void Prefix(SeamothStorageContainer __instance) { __instance.width = DW_Tweaks_Settings.Instance.SeamothInventoryWidth; __instance.height = DW_Tweaks_Settings.Instance.SeamothInventoryHeight; return; }
public static void Postfix(SeamothStorageContainer __instance) { __instance.container.Resize(QMultiModSettings.Instance.SeamothStorageContainerWidth, QMultiModSettings.Instance.SeamothStorageContainerHeight); }