BlueGit

timfa questward

Apply the red death dissolve to players as well as mobs.

Local and remote player corpses keep the killing-blow flash, then fade out over 0.5s instead of vanishing on entity-despawn.

timfa Tim Falken · pushed by timfa

Authored 2026-09-02 · 2 months ago

Hash
afc8cc0820927602c2f0d4e8f428b83b396a6880
Parent
c67dec95
2 files changed +26 −7
client/src/play/main.js +3 −0
@@ -2234,11 +2234,14 @@ async function main ()
2234 2234 healthUi?.apply({ current: 0, max: healthUi.getMax?.() });
2235 2235 view?.updateEntityHealth(message.entityId, 0, healthUi.getMax?.());
2236 2236 }
2237 // Red silhouette fade if despawn is delayed or already queued this tick.
2238 view?.beginDeathDissolve?.(message.entityId);
2237 2239 break;
2238 2240 case MessageType.playerRespawned:
2239 2241 death?.hide();
2240 2242 // Drop deferred killing-blow health=0 that may still be queued on a projectile.
2241 2243 view?.cancelDeferredCombatHits?.(message.entityId);
2244 view?.finishDeathDissolve?.(message.entityId);
2242 2245 view?.updateEntityHealth(message.entityId, message.health, message.maxHealth);
2243 2246 if (message.skullValue != null)
2244 2247 { view?.updateEntitySkull(message.entityId, message.skullValue); }
@@ -2234,11 +2234,14 @@ async function main ()
2234 healthUi?.apply({ current: 0, max: healthUi.getMax?.() });
2234 healthUi?.apply({ current: 0, max: healthUi.getMax?.() });
2235 view?.updateEntityHealth(message.entityId, 0, healthUi.getMax?.());
2235 view?.updateEntityHealth(message.entityId, 0, healthUi.getMax?.());
2236 }
2236 }
2237 // Red silhouette fade if despawn is delayed or already queued this tick.
2238 view?.beginDeathDissolve?.(message.entityId);
2237 break;
2239 break;
2238 case MessageType.playerRespawned:
2240 case MessageType.playerRespawned:
2239 death?.hide();
2241 death?.hide();
2240 // Drop deferred killing-blow health=0 that may still be queued on a projectile.
2242 // Drop deferred killing-blow health=0 that may still be queued on a projectile.
2241 view?.cancelDeferredCombatHits?.(message.entityId);
2243 view?.cancelDeferredCombatHits?.(message.entityId);
2244 view?.finishDeathDissolve?.(message.entityId);
2242 view?.updateEntityHealth(message.entityId, message.health, message.maxHealth);
2245 view?.updateEntityHealth(message.entityId, message.health, message.maxHealth);
2243 if (message.skullValue != null)
2246 if (message.skullValue != null)
2244 { view?.updateEntitySkull(message.entityId, message.skullValue); }
2247 { view?.updateEntitySkull(message.entityId, message.skullValue); }
client/src/render/worldView.js +23 −7
@@ -809,13 +809,9 @@ export class WorldView
809 809 { this.#finishDeathDissolve(entityId); }
810 810 return;
811 811 }
812 // Players use the death UI / immediate remove; mobs dissolve so the killing
813 // blow flash and knockback remain visible (unless the caller forces immediate).
814 if (
815 immediate
816 || existing.characterId
817 || entityId === this.localEntityId
818 )
812 // Chunk unload / session wipe: drop instantly. Combat death (mobs and players)
813 // keeps the sprite for a red silhouette fade.
814 if (immediate)
819 815 {
820 816 this.cancelDeferredCombatHits(entityId);
821 817 this.#destroyEntityVisuals(existing);
@@ -825,6 +821,26 @@ export class WorldView
825 821 this.#beginDeathDissolve(existing);
826 822 }
827 823
824 /**
825 * Start the red silhouette fade without requiring a despawn message
826 * (e.g. local playerDied arrives before entityDespawn).
827 */
828 beginDeathDissolve (entityId)
829 {
830 const existing = this.entities.get(entityId);
831 if (!existing || existing.dying)
832 { return; }
833 this.#beginDeathDissolve(existing);
834 }
835
836 /** Abort an in-progress dissolve (respawn / session wipe). */
837 finishDeathDissolve (entityId)
838 {
839 if (!this.entities.get(entityId)?.dying)
840 { return; }
841 this.#finishDeathDissolve(entityId);
842 }
843
828 844 #destroyEntityVisuals (existing)
829 845 {
830 846 existing.object?.destroy();
@@ -809,13 +809,9 @@ export class WorldView
809 { this.#finishDeathDissolve(entityId); }
809 { this.#finishDeathDissolve(entityId); }
810 return;
810 return;
811 }
811 }
812 // Players use the death UI / immediate remove; mobs dissolve so the killing
812 // Chunk unload / session wipe: drop instantly. Combat death (mobs and players)
813 // blow flash and knockback remain visible (unless the caller forces immediate).
813 // keeps the sprite for a red silhouette fade.
814 if (
814 if (immediate)
815 immediate
816 || existing.characterId
817 || entityId === this.localEntityId
818 )
819 {
815 {
820 this.cancelDeferredCombatHits(entityId);
816 this.cancelDeferredCombatHits(entityId);
821 this.#destroyEntityVisuals(existing);
817 this.#destroyEntityVisuals(existing);
@@ -825,6 +821,26 @@ export class WorldView
825 this.#beginDeathDissolve(existing);
821 this.#beginDeathDissolve(existing);
826 }
822 }
827
823
824 /**
825 * Start the red silhouette fade without requiring a despawn message
826 * (e.g. local playerDied arrives before entityDespawn).
827 */
828 beginDeathDissolve (entityId)
829 {
830 const existing = this.entities.get(entityId);
831 if (!existing || existing.dying)
832 { return; }
833 this.#beginDeathDissolve(existing);
834 }
835
836 /** Abort an in-progress dissolve (respawn / session wipe). */
837 finishDeathDissolve (entityId)
838 {
839 if (!this.entities.get(entityId)?.dying)
840 { return; }
841 this.#finishDeathDissolve(entityId);
842 }
843
828 #destroyEntityVisuals (existing)
844 #destroyEntityVisuals (existing)
829 {
845 {
830 existing.object?.destroy();
846 existing.object?.destroy();