mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-06-24 04:11:36 +02:00
fix mismatching signatures of spawn
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
from typing import Union, List, Tuple
|
||||
|
||||
from marl_factory_grid.environment.groups.collection import Collection
|
||||
from .entities import Maintainer
|
||||
from ..machines import constants as mc
|
||||
@ -27,5 +29,6 @@ class Maintainers(Collection):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def spawn(self, position, state: Gamestate):
|
||||
self.add_items([self._entity(state, mc.MACHINES, MachineAction(), pos) for pos in position])
|
||||
def spawn(self, coords_or_quantity: Union[int, List[Tuple[(int, int)]]], *entity_args):
|
||||
state = entity_args[0]
|
||||
self.add_items([self._entity(state, mc.MACHINES, MachineAction(), pos) for pos in coords_or_quantity])
|
||||
|
@ -14,7 +14,6 @@ class MaintenanceRule(Rule):
|
||||
self.n_maintainer = n_maintainer
|
||||
|
||||
def on_init(self, state: Gamestate, lvl_map):
|
||||
# Move to spawn? : #TODO
|
||||
state[M.MAINTAINERS].spawn(state.entities.empty_positions[:self.n_maintainer], state)
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user