private void EnsureInit() { registerTile = GetComponent <RegisterTile>(); spriteHandler = GetComponentInChildren <SpriteHandler>(); storage = GetComponent <ItemStorage>(); SetState(new MicrowaveIdle(this)); // Get the machine stock parts used in this instance and get the tier of each part. IDictionary <GameObject, int> builtParts = GetComponent <Machine>().PartsInFrame; ICollection <GameObject> parts = builtParts.Keys; ItemAttributesV2 partAttributes; // Collection is unorganized so run through the whole list. foreach (GameObject part in parts) { partAttributes = part.GetComponent <ItemAttributesV2>(); if (partAttributes.HasTrait(MachinePartsItemTraits.Instance.MicroLaser)) { laserTier = part.GetComponent <StockTier>().Tier; } if (partAttributes.HasTrait(MachinePartsItemTraits.Instance.MatterBin)) { int binTier = part.GetComponent <StockTier>().Tier; // Decide ItemStorageStructure based on tier. Currently: slot size == matter bin tier. storage.AcceptNewStructure(TierStorage[binTier - 1]); } } }