Пример #1
0
 def actTankman(self, invID):
     if self.filter[
             'location'] != BARRACKS_CONSTANTS.LOCATION_FILTER_NOT_RECRUITED:
         tankman = self.itemsCache.items.getTankman(int(invID))
         if tankman is None:
             _logger.error(
                 'Attempt to dismiss tankman by invalid invID: %r', invID)
             return
         if tankman.isDismissed:
             result = yield TankmanRestore(tankman).request()
         elif tankman.isInTank:
             tmanVehile = self.itemsCache.items.getVehicle(
                 tankman.vehicleInvID)
             if tmanVehile is None:
                 _logger.error(
                     "Target tankman's vehicle is not found in inventory %r %r",
                     tankman, tankman.vehicleInvID)
                 return
             result = yield TankmanUnload(tmanVehile,
                                          tankman.vehicleSlotIdx).request()
         else:
             result = yield TankmanDismiss(tankman).request()
         if result.userMsg:
             SystemMessages.pushMessage(result.userMsg,
                                        type=result.sysMsgType)
     return
Пример #2
0
 def actTankman(self, invID):
     tankman = g_itemsCache.items.getTankman(int(invID))
     if tankman is None:
         LOG_ERROR('Attempt to dismiss tankman by invalid invID:', invID)
         return
     else:
         if tankman.isDismissed:
             result = yield TankmanRestore(tankman).request()
         elif tankman.isInTank:
             tmanVehile = g_itemsCache.items.getVehicle(tankman.vehicleInvID)
             if tmanVehile is None:
                 LOG_ERROR("Target tankman's vehicle is not found in inventory", tankman, tankman.vehicleInvID)
                 return
             result = yield TankmanUnload(tmanVehile, tankman.vehicleSlotIdx).request()
         else:
             result = yield TankmanDismiss(tankman).request()
         if len(result.userMsg):
             SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
         return