示例#1
0
    public void VehicleComplete(VehiclePart_CHASSIS _chassis)
    {
        vehicleOrder[_chassis.design]--;
        if (vehicleOrder[_chassis.design] == 0)
        {
            bool ordersStillPending = false;
            foreach (int _REMAINING in vehicleOrder.Values)
            {
                if (_REMAINING > 0)
                {
                    ordersStillPending = true;
                    break;
                }
            }

            if (!ordersStillPending)
            {
                orderComplete = true;
                Debug.Log("ORDER COMPLETE in " + tick + " ticks");
            }
            else
            {
                if (factoryMode == FactoryMode.OOP)
                {
                    workshopTasks.Remove(workshopTasks[0]);
                    Debug.Log("Next workshop task: " + workshopTasks[0].design.designName);
                    foreach (var _WORKSHOP in workshops)
                    {
                        _WORKSHOP.Set_current_task(workshopTasks[0]);
                        _WORKSHOP.purgingPartsToSharedStorage = false;
                    }
                }
            }
        }
    }
示例#2
0
 public void Request_viable_parts(VehiclePart_CHASSIS _chassis)
 {
     foreach (KeyValuePair <VehiclePart_Config, int> _PAIR in currentTask.requiredParts)
     {
         VehiclePart_Config _PART = _PAIR.Key;
         int _QUANTITY            = _PAIR.Value;
         if (_PART.partType != Vehicle_PartType.CHASSIS)
         {
             if (currentTask.requiredParts.ContainsKey(_PAIR.Key))
             {
                 if (factoryMode == FactoryMode.OOP)
                 {
                     if (_chassis.partsFitted.ContainsKey(_PART))
                     {
                         if (_chassis.partsFitted[_PART] >= _QUANTITY)
                         {
                             continue;
                         }
                     }
                 }
                 L1.Request_part(new VehiclePartRequest(_PAIR.Key, REG));
                 REG.waitingForPartType = _chassis.partsNeeded[0].partConfig;
                 if (!purgingPartsToSharedStorage)
                 {
                     REG.Change_state(StorageState.WAITING);
                 }
                 return;
             }
         }
     }
 }
示例#3
0
    public bool Is_chassis_viable(int _lineIndex, int _slotIndex, VehicleChassiRequest _request)
    {
        VehiclePart         _SLOT    = Get_data_slot(_lineIndex, _slotIndex);
        VehiclePart_CHASSIS _CHASSIS = null;

        if (_SLOT != null)
        {
            if (_SLOT.partConfig.partType == Vehicle_PartType.CHASSIS)
            {     // part IS a chassis
                if (_SLOT.partConfig.partVersion == _request.chassisVersion || _request.factoryMode == FactoryMode.DOD)
                { // is Correct chassis type
                    _CHASSIS = _SLOT as VehiclePart_CHASSIS;
                }
            }
        }

        if (_CHASSIS != null)
        {
            if (_CHASSIS.partsNeeded.Count > 0)
            {
                var _PARTS_FITTED = _CHASSIS.partsFitted;

                // If chassis has less a defecit of our required parts, grab it
                foreach (KeyValuePair <VehiclePart_Config, int> _PAIR in _request.requiredParts)
                {
                    VehiclePart_Config _REQ_PART = _PAIR.Key;
                    if (_CHASSIS.design.quantities.ContainsKey(_REQ_PART))
                    {
                        int _QUANTITY = _CHASSIS.design.quantities[_REQ_PART];
                        if (_REQ_PART.partType != Vehicle_PartType.CHASSIS)
                        {
                            if (_CHASSIS.partsFitted.ContainsKey(_REQ_PART))
                            {
                                if (_CHASSIS.partsFitted[_REQ_PART] < _QUANTITY)
                                {
                                    return(true);
                                }
                            }
                            else
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
        }
        return(false);
    }