def remove(self): self.session.world.ships.remove(self) self.session.view.discard_change_listener(self.draw_health) if self.in_ship_map: if self.position.to_tuple() in self.session.world.ship_map: del self.session.world.ship_map[self.position.to_tuple()] else: self.log.error("Ship %s had in_ship_map flag set as True " "but tuple %s was not found in world.ship_map", self, self.position.to_tuple()) if self._next_target.to_tuple() in self.session.world.ship_map: del self.session.world.ship_map[self._next_target.to_tuple()] self.in_ship_map = False ShipDestroyed.broadcast(self) super(Ship, self).remove()