WIP: removing tiles

This commit is contained in:
Chanumask
2023-10-16 11:06:51 +02:00
parent 3bf3246aeb
commit 3677b7b7dc
37 changed files with 255 additions and 247 deletions

View File

@ -1,10 +1,11 @@
from marl_factory_grid.environment.groups.env_objects import EnvObjects
from marl_factory_grid.environment.groups.mixins import PositionMixin, HasBoundMixin
from marl_factory_grid.modules.destinations.entitites import Destination, BoundDestination
from marl_factory_grid.environment import constants as c
from marl_factory_grid.modules.destinations import constants as d
class Destinations(PositionMixin, EnvObjects):
_entity = Destination
is_blocking_light: bool = False
can_collide: bool = False
@ -15,9 +16,19 @@ class Destinations(PositionMixin, EnvObjects):
def __repr__(self):
return super(Destinations, self).__repr__()
@staticmethod
def trigger_destination_spawn(n_dests, state):
coordinates = state.entities.floorlist[:n_dests]
if destinations := [Destination(pos) for pos in coordinates]:
state[d.DESTINATION].add_items(destinations)
state.print(f'{n_dests} new destinations have been spawned')
return c.VALID
else:
state.print('No Destiantions are spawning, limit is reached.')
return c.NOT_VALID
class BoundDestinations(HasBoundMixin, Destinations):
_entity = BoundDestination
def __init__(self, *args, **kwargs):