This commit is contained in:
Chanumask
2023-10-27 13:08:01 +02:00
parent ef2fdd5d28
commit b13dff925b
13 changed files with 141 additions and 99 deletions

View File

@@ -20,7 +20,7 @@ class Batteries(Collection):
@property
def var_has_position(self):
return True
return False
@property
def obs_tag(self):

View File

@@ -36,7 +36,6 @@ class DestinationReachAll(Rule):
results.append(TickResult(self.name, validity=c.VALID, reward=r.DEST_REACHED, entity=agent))
return results
def on_check_done(self, state) -> List[DoneResult]:
if all(x.was_reached() for x in state[d.DESTINATION]):
return [DoneResult(self.name, validity=c.VALID, reward=r.DEST_REACHED)]
@@ -56,7 +55,7 @@ class DestinationReachAny(DestinationReachAll):
class DestinationSpawn(Rule):
def __init__(self, n_dests: int = 1,
def __init__(self, n_dests: int = 1, spawn_frequency: int = 5,
spawn_mode: str = d.MODE_GROUPED):
super(DestinationSpawn, self).__init__()
self.n_dests = n_dests

View File

@@ -5,7 +5,7 @@ from marl_factory_grid.environment import constants as c
from marl_factory_grid.environment.groups.collection import Collection
from marl_factory_grid.environment.groups.objects import _Objects
from marl_factory_grid.environment.groups.mixins import IsBoundMixin, HasBoundMixin
from marl_factory_grid.environment.groups.mixins import IsBoundMixin
from marl_factory_grid.environment.entity.agent import Agent
from marl_factory_grid.modules.items.entitites import Item, DropOffLocation
@@ -45,6 +45,10 @@ class Items(Collection):
class Inventory(IsBoundMixin, Collection):
_accepted_objects = Item
@property
def var_can_be_bound(self):
return True
@property
def obs_tag(self):
return self.name
@@ -69,7 +73,7 @@ class Inventory(IsBoundMixin, Collection):
self._collection = collection
class Inventories(HasBoundMixin, _Objects):
class Inventories(_Objects):
_entity = Inventory
@property

View File

@@ -3,10 +3,12 @@ from marl_factory_grid.modules.zones import Zone
class Zones(_Objects):
symbol = None
_entity = Zone
var_can_move = False
@property
def var_can_move(self):
return False
def __init__(self, *args, **kwargs):
super(Zones, self).__init__(*args, can_collide=True, **kwargs)