コード例 #1
0
 public static bool Prefix(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle data, ushort targetBuilding)
 {
     if ((data.m_transferType == 127) || (data.m_transferType == 126))
     {
         data.m_targetBuilding = targetBuilding;
         if (!CustomCargoTruckAI.CustomStartPathFind(vehicleID, ref data))
         {
             data.m_transferType   = MainDataStore.preTranferReason[vehicleID];
             data.m_targetBuilding = 0;
             __instance.SetTarget(vehicleID, ref data, 0);
             if (MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]] > 0)
             {
                 MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]]--;
             }
             MainDataStore.TargetGasBuilding[vehicleID] = 0;
             data.Unspawn(vehicleID);
         }
         return(false);
     }
     return(true);
 }
コード例 #2
0
 public static bool Prefix(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle data, ushort targetBuilding)
 {
     if ((data.m_transferType == 127) || (data.m_transferType == 126))
     {
         if (targetBuilding == data.m_targetBuilding)
         {
             return(true);
         }
         else
         {
             data.m_flags      &= ~Vehicle.Flags.WaitingTarget;
             data.m_waitCounter = 0;
             ushort tempTargetBuilding = data.m_targetBuilding;
             data.m_targetBuilding = MainDataStore.TargetGasBuilding[vehicleID];
             bool success = CustomCargoTruckAI.CustomStartPathFind(vehicleID, ref data);
             data.m_targetBuilding = tempTargetBuilding;
             if (!success)
             {
                 data.m_transferType = MainDataStore.preTranferReason[vehicleID];
                 PathManager instance = Singleton <PathManager> .instance;
                 if (data.m_path != 0u)
                 {
                     instance.ReleasePath(data.m_path);
                     data.m_path = 0;
                 }
                 __instance.SetTarget(vehicleID, ref data, data.m_targetBuilding);
                 if (MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]] > 0)
                 {
                     MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]]--;
                 }
                 MainDataStore.TargetGasBuilding[vehicleID] = 0;
             }
             return(false);
         }
     }
     return(true);
 }