private static bool DropItemToNearbyChest(Fermenter __instance, ref Fermenter.ItemConversion itemConversion) { List <Container> nearbyChests = InventoryAssistant.GetNearbyChests(__instance.gameObject, Configuration.Current.Fermenter.autoRange, !Configuration.Current.Fermenter.ignorePrivateAreaCheck); int spawnedInChests = 0; for (int i = 0; i < itemConversion.m_producedItems; i++) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemConversion.m_to.gameObject.name); ZNetView.m_forceDisableInit = true; GameObject itemObject = Object.Instantiate <GameObject>(itemPrefab); ZNetView.m_forceDisableInit = false; ItemDrop comp = itemObject.GetComponent <ItemDrop>(); bool result = spawnNearbyChest(comp, true); Object.Destroy(itemObject); if (!result) { itemConversion.m_producedItems -= spawnedInChests; return(false); } spawnedInChests++; } return(true); bool spawnNearbyChest(ItemDrop item, bool mustHaveItem) { foreach (Container chest in nearbyChests) { Inventory cInventory = chest.GetInventory(); if (mustHaveItem && !cInventory.HaveItem(item.m_itemData.m_shared.m_name)) { continue; } if (!cInventory.AddItem(item.m_itemData)) { //Chest full, move to the next continue; } InventoryAssistant.ConveyContainerToNetwork(chest); return(true); } if (mustHaveItem) { return(spawnNearbyChest(item, false)); } return(false); } }
private static void Postfix(ref Fermenter.ItemConversion __result) { if (Settings.isEnabled("Fermenter")) { int fermenterItemCount = Settings.getInt("Fermenter", "fermenterItemsProduced"); if (fermenterItemCount > 0) { __result.m_producedItems = fermenterItemCount; } } }
private static void Postfix(ref Fermenter.ItemConversion __result) { if (Configuration.Current.Fermenter.IsEnabled) { int fermenterItemCount = Configuration.Current.Fermenter.fermenterItemsProduced; if (fermenterItemCount > 0) { __result.m_producedItems = fermenterItemCount; } } }
/// <summary> /// Turns the FermenterConversionConfig into a Valheim Fermenter.ItemConversion item. /// </summary> /// <returns>The Valheim Fermenter.ItemConversion</returns> public Fermenter.ItemConversion GetItemConversion() { Fermenter.ItemConversion conv = new Fermenter.ItemConversion() { m_producedItems = ProducedItems, m_from = Mock <ItemDrop> .Create(FromItem), m_to = Mock <ItemDrop> .Create(ToItem), }; return(conv); }
private static void Postfix(ref Fermenter.ItemConversion __result) { if (Conf.Fermenter != null) { int fermenterItemCount = Conf.Fermenter.FermenterItemsProduced; if (fermenterItemCount > 0) { __result.m_producedItems = fermenterItemCount; } } }
private static void Postfix(ref Fermenter.ItemConversion __result) { if (Config["Fermenter"]["enabled"] == "true") { int fermenterItemCount = int.Parse(Config["Fermenter"]["fermenterItemsProduced"]); if (fermenterItemCount > 0) { __result.m_producedItems = fermenterItemCount; } } }
// Token: 0x06000D12 RID: 3346 RVA: 0x0005D424 File Offset: 0x0005B624 private void DelayedTap() { this.m_spawnEffects.Create(this.m_outputPoint.transform.position, Quaternion.identity, null, 1f); Fermenter.ItemConversion itemConversion = this.GetItemConversion(this.m_delayedTapItem); if (itemConversion != null) { float d = 0.3f; for (int i = 0; i < itemConversion.m_producedItems; i++) { Vector3 position = this.m_outputPoint.position + Vector3.up * d; UnityEngine.Object.Instantiate <ItemDrop>(itemConversion.m_to, position, Quaternion.identity); } } }
// Token: 0x06000D15 RID: 3349 RVA: 0x0005D548 File Offset: 0x0005B748 private string GetContentName() { string content = this.GetContent(); if (string.IsNullOrEmpty(content)) { return(""); } Fermenter.ItemConversion itemConversion = this.GetItemConversion(content); if (itemConversion == null) { return("Invalid"); } return(itemConversion.m_from.m_itemData.m_shared.m_name); }