コード例 #1
0
ファイル: session.py プロジェクト: Z-Fikar/unknown-horizons
 def remove_selected(self):
     self.log.debug('Removing %s', self.selected_instances)
     for instance in [inst for inst in self.selected_instances]:
         if instance.is_building:
             if instance.tearable and instance.owner is self.world.player:
                 self.log.debug('Attempting to remove building %s', inst)
                 Tear(instance).execute(self)
                 self.selected_instances.discard(instance)
             else:
                 self.log.debug('Unable to remove building %s', inst)
         elif instance.is_unit:
             if instance.owner is self.world.player:
                 self.log.debug('Attempting to remove unit %s', inst)
                 RemoveUnit(instance).execute(self)
                 self.selected_instances.discard(instance)
             else:
                 self.log.debug('Unable to remove unit %s', inst)
         else:
             self.log.error('Unable to remove unknown object %s', instance)
コード例 #2
0
 def _remove_unnecessary_objects(self):
     # Delete all ships.
     for ship in (ship for ship in self.world.ships):
         RemoveUnit(ship).execute(self.session)