mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-09-17 16:12:00 +02:00
no more tiles no more floor
This commit is contained in:
@@ -4,7 +4,7 @@ from marl_factory_grid.environment.entity.agent import Agent
|
||||
from marl_factory_grid.environment.entity.entity import Entity
|
||||
from marl_factory_grid.environment import constants as c
|
||||
from marl_factory_grid.environment.entity.mixin import BoundEntityMixin
|
||||
from marl_factory_grid.utils.render import RenderEntity
|
||||
from marl_factory_grid.utils.utility_classes import RenderEntity
|
||||
from marl_factory_grid.modules.destinations import constants as d
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ class Destination(BoundEntityMixin, Entity):
|
||||
var_is_blocking_light = False
|
||||
var_can_be_bound = True # Introduce this globally!
|
||||
|
||||
@property
|
||||
def was_reached(self):
|
||||
return self._was_reached
|
||||
|
||||
@@ -35,11 +34,10 @@ class Destination(BoundEntityMixin, Entity):
|
||||
self._per_agent_actions[agent.name] += 1
|
||||
return c.VALID
|
||||
|
||||
@property
|
||||
def has_just_been_reached(self):
|
||||
if self.was_reached:
|
||||
def has_just_been_reached(self, state):
|
||||
if self.was_reached():
|
||||
return False
|
||||
agent_at_position = any(c.AGENT.lower() in x.name.lower() for x in state.entities.pos_dict[self.pos] if x.var_can_collide)
|
||||
agent_at_position = any(state[c.AGENT].by_pos(self.pos))
|
||||
|
||||
if self.bound_entity:
|
||||
return ((agent_at_position and not self.action_counts)
|
||||
@@ -57,7 +55,7 @@ class Destination(BoundEntityMixin, Entity):
|
||||
return state_summary
|
||||
|
||||
def render(self):
|
||||
if self.was_reached:
|
||||
if self.was_reached():
|
||||
return None
|
||||
else:
|
||||
return RenderEntity(d.DESTINATION, self.pos)
|
||||
|
Reference in New Issue
Block a user