RedColonyConfiguration.py 901B

1234567891011121314151617181920212223242526272829
  1. from intelligine.synergy.ColonyConfiguration import ColonyConfiguration
  2. from intelligine.sandbox.colored.RedAnt import RedAnt
  3. from intelligine.synergy.object.ant.Egg import Egg
  4. from intelligine.cst import COLONY, MOVE_MODE_NURSE
  5. class RedColonyConfiguration(ColonyConfiguration):
  6. _start_position = (0, 20, 70)
  7. _ant_class = RedAnt
  8. _ant_count = 50
  9. def get_start_objects(self, collection, context):
  10. objects = super().get_start_objects(collection, context)
  11. for ant in objects:
  12. ant._brain.switch_to_mode(MOVE_MODE_NURSE)
  13. for x in range(50):
  14. for y in range(1, 50):
  15. if x % 3 == 0 and y % 3 == 0:
  16. egg = Egg(collection, context)
  17. egg.set_position((0, 1+x, 50+y))
  18. context.metas.value.set(COLONY, egg.get_id(), collection.get_id())
  19. objects.append(egg)
  20. return objects