DeathLink: add support for the cause field
This commit is contained in:
		
							parent
							
								
									30755b2067
								
							
						
					
					
						commit
						720ef936da
					
				| 
						 | 
				
			
			@ -263,6 +263,11 @@ class CommonContext():
 | 
			
		|||
    def on_deathlink(self, data: dict):
 | 
			
		||||
        """Gets dispatched when a new DeathLink is triggered by another linked player."""
 | 
			
		||||
        self.last_death_link = max(data["time"], self.last_death_link)
 | 
			
		||||
        text = data.get("cause", "")
 | 
			
		||||
        if text:
 | 
			
		||||
            logger.info(f"DeathLink: {text}")
 | 
			
		||||
        else:
 | 
			
		||||
            logger.info(f"DeathLink: Received from {data['source']}")
 | 
			
		||||
 | 
			
		||||
    async def send_death(self):
 | 
			
		||||
        self.last_death_link = time.time()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -148,7 +148,6 @@ class Context(CommonContext):
 | 
			
		|||
        snes_buffered_write(self, WRAM_START + 0x0373, bytes([8]))
 | 
			
		||||
        asyncio.create_task(snes_flush_writes(self))
 | 
			
		||||
        self.death_state = True
 | 
			
		||||
        snes_logger.info(f"Received DeathLink from {data['source']}")
 | 
			
		||||
        super(Context, self).on_deathlink(data)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue