Merge pull request #2658 from kacpherek/fix/death-message-styled

🤖 Agent: Merged by Ludovic's AI agent (Claude, contrib-gate-19) after the contribution gate. Checked against vanilla 26.3 and proven in union/cg19-r2 (all round-2 PRs together: clippy, 1722 tests, 135 harnesses, lan_e2e in-frame and on the server thread) and union/cg19-r3 (the same PRs merged with today's main: 96/96 harnesses). Thanks @kacpherek.
This commit is contained in:
Ludovic Marie
2026-10-27 17:48:40 +01:00
committed by GitHub
+12 -4
View File
@@ -209,7 +209,7 @@ pub(super) struct Remote {
placing: Option<([i32; 3], u64)>,
/// `CommonPlayerSpawnInfo.isFlat`: the level is a superflat one.
pub(super) flat: bool,
death_message: Option<String>,
death_message: Option<horizon_client::text::Text>,
/// `LocalPlayer.showDeathScreen`: off with `immediate_respawn`.
show_death_screen: bool,
player_type: Option<Arc<MobType>>,
@@ -2469,7 +2469,7 @@ impl Game<'_> {
// The component resolves in the client's current language, as
// the chat line does, not in the language the session joined
// with (`Remote.lang` is the vanilla server-language table).
let message = remote_text(&p.message).plain();
let message = remote_text(&p.message);
let me = self.remote.as_ref().is_some_and(|r| r.entity_id == p.id);
if let Some(r) = self.remote.as_mut() {
r.death_message = Some(message);
@@ -5763,8 +5763,16 @@ impl Game<'_> {
if self.screen == Screen::Dead
&& let Some(message) = &r.death_message
{
let tw = HudBatch::text_width(atlas, message);
batch.text(atlas, message, (w - tw) / 2.0, 85.0, u32::MAX, true);
// DeathScreen draws the styled cause component.
let tw = atlas.font.width_text(message);
batch.text_styled(
atlas,
message,
((w - tw) / 2.0).floor(),
85.0,
u32::MAX,
true,
);
}
}
/// Shared flag 6 of an entity on a server's client (`None` without a server).