public void Dump_from_line_exceptType(int _lineIndex, Vehicle_PartType _keepThisPart, int _maxKept) { if (currentState == StorageState.IDLE) { int partsKept = 0; Change_state(StorageState.DUMP); List <VehiclePart> dumpList = new List <VehiclePart>(); StorageLine _LINE = storageLines[_lineIndex]; for (int _slotIndex = 0; _slotIndex < lineLength; _slotIndex++) { VehiclePart _PART = _LINE.slots[_slotIndex]; if (_PART != null) { if (_PART.partConfig.partType == _keepThisPart) { if (partsKept < _maxKept) { partsKept++; } else { dumpList.Add(_PART); } } else { dumpList.Add(_PART); } } } sendingLineTo = getsPartsFrom; Set_outgoing_parts(_lineIndex, dumpList.ToArray(), sendingLineTo); } }
public bool Slot_contains_part_type(int _lineIndex, int _slotIndex, Vehicle_PartType _type) { VehiclePart _SLOT = Get_data_slot(_lineIndex, _slotIndex); if (_SLOT != null) { if (_SLOT.partConfig.partType == _type) { return(true); } else { return(false); } } else { return(false); } }