mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-09-15 23:37:14 +02:00
Redone the spawn procedute and destination objects
This commit is contained in:
@@ -39,7 +39,7 @@ class Maintainer(Entity):
|
||||
self._next = []
|
||||
self._last = []
|
||||
self._last_serviced = 'None'
|
||||
self._floortile_graph = points_to_graph(state[c.FLOOR].positions)
|
||||
self._floortile_graph = points_to_graph(state[c.FLOORS].positions)
|
||||
|
||||
def tick(self, state):
|
||||
if found_objective := state[self.objective].by_pos(self.pos):
|
||||
@@ -89,7 +89,7 @@ class Maintainer(Entity):
|
||||
|
||||
def _predict_move(self, state):
|
||||
next_pos = self._path[0]
|
||||
if len(state[c.FLOOR].by_pos(next_pos).guests_that_can_collide) > 0:
|
||||
if len(state[c.FLOORS].by_pos(next_pos).guests_that_can_collide) > 0:
|
||||
action = c.NOOP
|
||||
else:
|
||||
next_pos = self._path.pop(0)
|
||||
|
@@ -5,11 +5,9 @@ from marl_factory_grid.environment.entity.wall_floor import Floor
|
||||
from marl_factory_grid.environment.groups.env_objects import EnvObjects
|
||||
from marl_factory_grid.environment.groups.mixins import PositionMixin
|
||||
from ..machines.actions import MachineAction
|
||||
from ...utils.render import RenderEntity
|
||||
from ...utils.states import Gamestate
|
||||
|
||||
from ..machines import constants as mc
|
||||
from . import constants as mi
|
||||
|
||||
|
||||
class Maintainers(PositionMixin, EnvObjects):
|
||||
|
@@ -14,7 +14,7 @@ class MaintenanceRule(Rule):
|
||||
self.n_maintainer = n_maintainer
|
||||
|
||||
def on_init(self, state: Gamestate, lvl_map):
|
||||
state[M.MAINTAINERS].spawn(state[c.FLOOR].empty_tiles[:self.n_maintainer], state)
|
||||
state[M.MAINTAINERS].spawn(state[c.FLOORS].empty_tiles[:self.n_maintainer], state)
|
||||
pass
|
||||
|
||||
def tick_pre_step(self, state) -> List[TickResult]:
|
||||
|
Reference in New Issue
Block a user