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

@@ -12,8 +12,6 @@ from ...utils.utility_classes import RenderEntity
class Entity(_Object, abc.ABC):
"""Full Env Entity that lives on the environment Grid. Doors, Items, DirtPile etc..."""
_u_idx = defaultdict(lambda: 0)
@property
def state(self):
return self._status or ActionResult(entity=self, identifier=c.NOOP, validity=c.VALID, reward=0)
@@ -29,7 +27,6 @@ class Entity(_Object, abc.ABC):
except AttributeError:
return False
@property
def var_can_move(self):
try:
@@ -51,7 +48,6 @@ class Entity(_Object, abc.ABC):
except AttributeError:
return False
@property
def x(self):
return self.pos[0]
@@ -87,7 +83,7 @@ class Entity(_Object, abc.ABC):
if valid := state.check_move_validity(self, next_pos):
for observer in self.observers:
observer.notify_del_entity(self)
self._view_directory = curr_pos[0]-next_pos[0], curr_pos[1]-next_pos[1]
self._view_directory = curr_pos[0] - next_pos[0], curr_pos[1] - next_pos[1]
self._pos = next_pos
for observer in self.observers:
observer.notify_add_entity(self)