mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-11-02 21:47:25 +01:00
Verified Collision Checks and Rendering
This commit is contained in:
@@ -2,6 +2,7 @@ from marl_factory_grid.environment import constants as c
|
||||
from marl_factory_grid.environment.groups.collection import Collection
|
||||
from marl_factory_grid.modules.clean_up.entitites import DirtPile
|
||||
from marl_factory_grid.utils.results import Result
|
||||
from marl_factory_grid.utils import helpers as h
|
||||
|
||||
|
||||
class DirtPiles(Collection):
|
||||
@@ -82,7 +83,7 @@ class DirtPiles(Collection):
|
||||
for idx, (pos, a) in enumerate(zip(n_new, amounts)):
|
||||
if not self.global_amount > self.max_global_amount:
|
||||
if dirt := self.by_pos(pos):
|
||||
dirt = next(dirt.iter())
|
||||
dirt = h.get_first(dirt)
|
||||
new_value = dirt.amount + a
|
||||
dirt.set_new_amount(new_value)
|
||||
else:
|
||||
|
||||
@@ -36,7 +36,7 @@ class ItemAction(Action):
|
||||
:rtype: ActionResult
|
||||
"""
|
||||
reward = self.valid_drop_off_reward if validity else self.failed_drop_off_reward
|
||||
return ActionResult(self.__name__, validity, reward=reward, entity=entity)
|
||||
return ActionResult(self.__class__.__name__, validity, reward=reward, entity=entity)
|
||||
|
||||
def do(self, entity, state) -> Union[None, ActionResult]:
|
||||
inventory = state[i.INVENTORY].by_entity(entity)
|
||||
|
||||
Reference in New Issue
Block a user