def instanced(self, cmdr_name, ship_internal_name=None, piloted=True): self._touch() cmdr = self.instance.player(cmdr_name) if not cmdr: cmdr = EDPlayer(cmdr_name) cmdr.location = self.location if ship_internal_name: vehicle = EDVehicleFactory.from_internal_name(ship_internal_name) cmdr.update_vehicle_if_obsolete(vehicle, piloted) self.instance.player_in(cmdr) return cmdr
def instanced_npc(self, name, rank=None, ship_internal_name=None, piloted=True): self._touch() npc = self.instance.npc(name, rank, ship_internal_name) if not npc: npc = EDPilot(name, rank) npc.location = self.location if ship_internal_name: vehicle = EDVehicleFactory.from_internal_name(ship_internal_name) npc.update_vehicle_if_obsolete(vehicle, piloted) self.instance.npc_in(npc) return npc
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()