mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-05 17:11:35 +02:00
fixed globalpos and 2rooms1door destination spawning
This commit is contained in:
@ -39,7 +39,15 @@ Agents:
|
||||
- Doors
|
||||
|
||||
Entities:
|
||||
Destinations: { }
|
||||
Destinations:
|
||||
spawnrule:
|
||||
SpawnDestinationsPerAgent:
|
||||
coords_or_quantity:
|
||||
Wolfgang:
|
||||
- (6,12)
|
||||
Sigmund:
|
||||
- (6, 2)
|
||||
|
||||
Doors: { }
|
||||
GlobalPositions: { }
|
||||
|
||||
@ -57,5 +65,5 @@ Rules:
|
||||
AssignGlobalPositions: { }
|
||||
|
||||
# Done Conditions
|
||||
MaxStepsReached:
|
||||
DoneAtMaxStepsReached:
|
||||
max_steps: 10
|
||||
|
@ -234,8 +234,12 @@ class AssignGlobalPositions(Rule):
|
||||
:return: None
|
||||
"""
|
||||
super().__init__()
|
||||
self.level_shape = None
|
||||
|
||||
def on_reset(self, state, lvl_map):
|
||||
def on_init(self, state, lvl_map):
|
||||
self.level_shape = lvl_map.level_shape
|
||||
|
||||
def on_reset(self, state):
|
||||
"""
|
||||
Assign global positions to agents when the environment is reset.
|
||||
|
||||
@ -248,7 +252,7 @@ class AssignGlobalPositions(Rule):
|
||||
"""
|
||||
from marl_factory_grid.environment.entity.util import GlobalPosition
|
||||
for agent in state[c.AGENT]:
|
||||
gp = GlobalPosition(agent, lvl_map.level_shape)
|
||||
gp = GlobalPosition(agent, self.level_shape)
|
||||
state[c.GLOBALPOSITIONS].add_item(gp)
|
||||
return []
|
||||
|
||||
|
Reference in New Issue
Block a user