Description and better naming scheme for the Door-Module

This commit is contained in:
Steffen Illium
2023-10-26 16:12:19 +02:00
parent 6011ba383e
commit 20068e8e1b
3 changed files with 18 additions and 5 deletions

View File

@ -60,7 +60,7 @@ Just define what your environment needs in a *yaml*-configfile like:
done_at_collisions: !!bool True
ItemRespawn:
spawn_freq: 5
DoorAutoClose: {}
DoDoorAutoClose: {}
Assets:
- Defaults

View File

@ -1,4 +1,4 @@
from .actions import DoorUse
from .entitites import Door, DoorIndicator
from .groups import Doors
from .rules import DoorAutoClose, DoorIndicateArea
from .rules import DoDoorAutoClose, IndicateDoorAreaInObservation

View File

@ -1,13 +1,19 @@
from marl_factory_grid.environment.rules import Rule
from marl_factory_grid.environment import constants as c
from marl_factory_grid.environment.rules import Rule
from marl_factory_grid.utils.results import TickResult
from . import constants as d
from .entitites import DoorIndicator
class DoorAutoClose(Rule):
class DoDoorAutoClose(Rule):
def __init__(self, close_frequency: int = 10):
"""
This rule closes doors, that have been opened automatically, when no entity is blocking the position.
:type close_frequency: int
:param close_frequency: How many ticks after opening, should the door close?
"""
super().__init__()
self.close_frequency = close_frequency
@ -22,9 +28,16 @@ class DoorAutoClose(Rule):
return []
class DoorIndicateArea(Rule):
class IndicateDoorAreaInObservation(Rule):
def __init__(self):
"""
Whether to add an indicator aka place a value around doors (within the door tile), for agents to see.
This could improve learning.
"""
# Todo: Discuss if this rather be a single entity with a standalone observation.
# Could then be combined with the "Combine"-approach.
super().__init__()
def on_init(self, state, lvl_map):