Bastien Sevajol 6 лет назад
Родитель
Сommit
b28e436878
2 измененных файлов: 11 добавлений и 1 удалений
  1. 1 0
      opencombat/simulation/behaviour.py
  2. 10 1
      run.py

+ 1 - 0
opencombat/simulation/behaviour.py Просмотреть файл

@@ -106,6 +106,7 @@ class LookAroundBehaviour(AliveSubjectBehaviour):
106 106
         }
107 107
 
108 108
 
109
+@disable_when(config_value('_runtime.placement_mode'))
109 110
 class EngageOpponent(AliveSubjectBehaviour):
110 111
     visible_mechanism = OpponentVisibleMechanism
111 112
     use = [visible_mechanism]

+ 10 - 1
run.py Просмотреть файл

@@ -21,6 +21,7 @@ def main(
21 21
     seed_value: int=None,
22 22
     state_file_path: str=None,
23 23
     state_save_dir: str='.',
24
+    placement_mode: bool = False,
24 25
 ):
25 26
     if seed_value is not None:
26 27
         seed(seed_value)
@@ -29,7 +30,9 @@ def main(
29 30
     config.load_yaml('config.yaml')
30 31
 
31 32
     # Runtime config
32
-    config.setdefault('_runtime', {})['state_save_dir'] = state_save_dir
33
+    config['_runtime'] = {}
34
+    config['_runtime']['state_save_dir'] = state_save_dir
35
+    config['_runtime']['placement_mode'] = placement_mode
33 36
 
34 37
     level = logging.getLevelName(config.resolve('global.logging_level', 'ERROR'))
35 38
     logger = get_default_logger(level=level)
@@ -76,6 +79,11 @@ if __name__ == '__main__':
76 79
         dest='state_save_dir',
77 80
         default='.',
78 81
     )
82
+    parser.add_argument(
83
+        '--placement-mode',
84
+        dest='placement_mode',
85
+        action='store_true',
86
+    )
79 87
 
80 88
     args = parser.parse_args()
81 89
 
@@ -84,4 +92,5 @@ if __name__ == '__main__':
84 92
         seed_value=args.seed,
85 93
         state_file_path=args.state,
86 94
         state_save_dir=args.state_save_dir,
95
+        placement_mode=args.placement_mode,
87 96
     )