DeathLink: add support for the cause field #2

This commit is contained in:
Fabian Dill 2021-11-06 16:17:10 +01:00
parent 720ef936da
commit 5cf7e6e24b
2 changed files with 4 additions and 3 deletions

View File

@ -269,13 +269,14 @@ class CommonContext():
else: else:
logger.info(f"DeathLink: Received from {data['source']}") logger.info(f"DeathLink: Received from {data['source']}")
async def send_death(self): async def send_death(self, death_text: str = ""):
self.last_death_link = time.time() self.last_death_link = time.time()
await self.send_msgs([{ await self.send_msgs([{
"cmd": "Bounce", "tags": ["DeathLink"], "cmd": "Bounce", "tags": ["DeathLink"],
"data": { "data": {
"time": self.last_death_link, "time": self.last_death_link,
"source": self.player_names[self.slot] "source": self.player_names[self.slot],
"cause": death_text
} }
}]) }])

View File

@ -123,7 +123,7 @@ class World(metaclass=AutoWorldRegister):
self.player = player self.player = player
# overridable methods that get called by Main.py, sorted by execution order # overridable methods that get called by Main.py, sorted by execution order
# can also be implemented as a classmethod and called "stage_<original_name", # can also be implemented as a classmethod and called "stage_<original_name>",
# in that case the MultiWorld object is passed as an argument and it gets called once for the entire multiworld. # in that case the MultiWorld object is passed as an argument and it gets called once for the entire multiworld.
# An example of this can be found in alttp as stage_pre_fill # An example of this can be found in alttp as stage_pre_fill
def generate_early(self): def generate_early(self):