fix bot/basic UpdateHealth event

This commit is contained in:
Tnze
2022-12-13 00:46:49 +08:00
parent 8445fb63cd
commit d39f4d398e

View File

@ -84,9 +84,12 @@ func attachUpdateHealth(c *bot.Client, healthChangeHandler func(health float32)
healthChangeErr = healthChangeHandler(float32(health)) healthChangeErr = healthChangeHandler(float32(health))
} }
if deathHandler != nil && health <= 0 { if deathHandler != nil && health <= 0 {
healthChangeErr = deathHandler() deathErr = deathHandler()
} }
if healthChangeErr != nil || deathErr != nil {
return updateHealthError{healthChangeErr, deathErr} return updateHealthError{healthChangeErr, deathErr}
}
return nil
}, },
}) })
} }