Exemple #1
0
 def update_vehicle_if_obsolete(self, vehicle, piloted=True):
     if vehicle is None:
         return False
     updated = False
     if EDVehicleFactory.is_ship_launched_fighter(vehicle):
         updated = self.__update_slf_if_obsolete(vehicle)
         if not self.mothership.supports_slf():
             self.mothership = EDVehicleFactory.unknown_vehicle()
         if piloted:
             self.piloted_vehicle = self.slf
     elif EDVehicleFactory.is_surface_vehicle(vehicle):
         updated = self.__update_srv_if_obsolete(vehicle)
         if not self.mothership.supports_srv():
             self.mothership = EDVehicleFactory.unknown_vehicle()
         if piloted:
             self.piloted_vehicle = self.srv
     else:
         updated = self.__update_mothership_if_obsolete(vehicle)
         if piloted:
             self.piloted_vehicle = self.mothership
     if updated:
         self._touch()
     return updated
Exemple #2
0
    def targeting(self, pilot, ship_internal_name=None):
        if pilot.is_human():
            self.instance.player_in(pilot)
        else:
            self.instance.npc_in(pilot)

        if self._target:
            self._target.untargeted()
            self._target._touch()
        self._target = pilot
        
        mothership = True
        slf = False
        srv = False
        if ship_internal_name:
            vehicle = EDVehicleFactory.from_internal_name(ship_internal_name)
            slf = EDVehicleFactory.is_ship_launched_fighter(vehicle)
            srv = EDVehicleFactory.is_surface_vehicle(vehicle)
            mothership = not(slf or srv)
        
        pilot.targeted(mothership, slf, srv)
        pilot._touch()
        self._touch()