// Token: 0x06000F22 RID: 3874 RVA: 0x0006C154 File Offset: 0x0006A354 private void DropAllItems() { this.SpawnProcessed(); if (this.m_fuelItem != null) { float @float = this.m_nview.GetZDO().GetFloat("fuel", 0f); for (int i = 0; i < (int)@float; i++) { Vector3 position = base.transform.position + Vector3.up + UnityEngine.Random.insideUnitSphere * 0.3f; Quaternion rotation = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f); UnityEngine.Object.Instantiate <GameObject>(this.m_fuelItem.gameObject, position, rotation); } } while (this.GetQueueSize() > 0) { string queuedOre = this.GetQueuedOre(); this.RemoveOneOre(); Smelter.ItemConversion itemConversion = this.GetItemConversion(queuedOre); if (itemConversion != null) { Vector3 position2 = base.transform.position + Vector3.up + UnityEngine.Random.insideUnitSphere * 0.3f; Quaternion rotation2 = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f); UnityEngine.Object.Instantiate <GameObject>(itemConversion.m_from.gameObject, position2, rotation2); } else { ZLog.Log("Invalid ore in smelter " + queuedOre); } } }
// Token: 0x06000F3A RID: 3898 RVA: 0x0006CA58 File Offset: 0x0006AC58 private void QueueProcessed(string ore) { if (!this.m_spawnStack) { this.Spawn(ore, 1); return; } string @string = this.m_nview.GetZDO().GetString("SpawnOre", ""); int num = this.m_nview.GetZDO().GetInt("SpawnAmount", 0); if (@string.Length <= 0) { this.m_nview.GetZDO().Set("SpawnOre", ore); this.m_nview.GetZDO().Set("SpawnAmount", 1); return; } if (@string != ore) { this.SpawnProcessed(); this.m_nview.GetZDO().Set("SpawnOre", ore); this.m_nview.GetZDO().Set("SpawnAmount", 1); return; } num++; Smelter.ItemConversion itemConversion = this.GetItemConversion(ore); if (itemConversion == null || num >= itemConversion.m_to.m_itemData.m_shared.m_maxStackSize) { this.Spawn(ore, num); this.m_nview.GetZDO().Set("SpawnOre", ""); this.m_nview.GetZDO().Set("SpawnAmount", 0); return; } this.m_nview.GetZDO().Set("SpawnAmount", num); }
// Token: 0x06000F3D RID: 3901 RVA: 0x0006CC28 File Offset: 0x0006AE28 private void Spawn(string ore, int stack) { Smelter.ItemConversion itemConversion = this.GetItemConversion(ore); if (itemConversion != null) { this.m_produceEffects.Create(base.transform.position, base.transform.rotation, null, 1f); UnityEngine.Object.Instantiate <GameObject>(itemConversion.m_to.gameObject, this.m_outputPoint.position, this.m_outputPoint.rotation).GetComponent <ItemDrop>().m_itemData.m_stack = stack; } }
/// <summary> /// Turns the SmelterConversionConfig into a Valheim Smelter.ItemConversion item. /// </summary> /// <returns>The Valheim Smelter.ItemConversion</returns> public Smelter.ItemConversion GetItemConversion() { Smelter.ItemConversion conv = new Smelter.ItemConversion() { m_from = Mock <ItemDrop> .Create(FromItem), m_to = Mock <ItemDrop> .Create(ToItem), }; return(conv); }
private static bool PreventUsingSpecificWood(Smelter smelter, Smelter.ItemConversion itemConversion) { if (smelter.m_name.Equals(SmelterDefinitions.KilnName)) { if (Configuration.Current.Kiln.dontProcessFineWood && itemConversion.m_from.m_itemData.m_shared.m_name.Equals(WoodDefinitions.FineWoodName) || Configuration.Current.Kiln.dontProcessRoundLog && itemConversion.m_from.m_itemData.m_shared.m_name.Equals(WoodDefinitions.RoundLogName)) { return(true); } } return(false); }
public static void Postfix(Smelter __instance) { if (ItsJustWood.AllowAncientBarkForCoal.Value) { var ancientWood = ObjectDB.instance.GetItemPrefab("ElderBark").GetComponent <ItemDrop>(); var itemConversion = __instance.m_conversion.Find(x => x.m_from == ancientWood); if (itemConversion == null) { var coal = ObjectDB.instance.GetItemPrefab("Coal").GetComponent <ItemDrop>(); itemConversion = new Smelter.ItemConversion() { m_from = ancientWood, m_to = coal }; __instance.m_conversion.Add(itemConversion); } } }