From f6d566427a42c3d7d2a202615fc86504c8d29756 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Sat, 31 Jan 2026 08:55:49 +0100 Subject: [PATCH] Add immediate handling for deceased characters in health update: Implement logic to check if a character's health is less than or equal to zero and handle their death accordingly, improving character state management. --- YpDaemon/src/worker/user_character.rs | 6 ++++++ src/worker/user_character.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/YpDaemon/src/worker/user_character.rs b/YpDaemon/src/worker/user_character.rs index c5c76f4..cf423f4 100644 --- a/YpDaemon/src/worker/user_character.rs +++ b/YpDaemon/src/worker/user_character.rs @@ -175,6 +175,12 @@ impl UserCharacterWorker { } fn update_character_health(&mut self, character: &mut Character) -> Result<(), DbError> { + // Bereits verstorbene Charaktere (health <= 0) sofort behandeln + if character.health <= 0 { + self.handle_character_death(character.id)?; + return Ok(()); + } + let health_change = self.calculate_health_change(character.age); if health_change == 0 { return Ok(()); diff --git a/src/worker/user_character.rs b/src/worker/user_character.rs index c5c76f4..cf423f4 100644 --- a/src/worker/user_character.rs +++ b/src/worker/user_character.rs @@ -175,6 +175,12 @@ impl UserCharacterWorker { } fn update_character_health(&mut self, character: &mut Character) -> Result<(), DbError> { + // Bereits verstorbene Charaktere (health <= 0) sofort behandeln + if character.health <= 0 { + self.handle_character_death(character.id)?; + return Ok(()); + } + let health_change = self.calculate_health_change(character.age); if health_change == 0 { return Ok(());