Use red death fade only for combat kills, not interest leave.
Plain entity despawns (leaving the 3x3, summons, etc.) get a normal alpha fade that still respects darkness; combat death despawns are tagged cause=death for the red silhouette.
@@ -1967,7 +1967,9 @@ async function main ()
1967
1967
case MessageType.entityDespawn:
1968
1968
if (message.entityId === autorunFocusEntityId)
1969
1969
{ clearAutorunFocus(); }
1970
view?.despawnEntity(message.entityId);
1970
view?.despawnEntity(message.entityId, {
1971
combatDeath: message.cause === "death"
1972
});
1971
1973
break;
1972
1974
case MessageType.entityAppearance:
1973
1975
view?.setAppearance(message);
@@ -1967,7 +1967,9 @@ async function main ()1967
case MessageType.entityDespawn:1967
case MessageType.entityDespawn:1968
if (message.entityId === autorunFocusEntityId)1968
if (message.entityId === autorunFocusEntityId)1969
{ clearAutorunFocus(); }1969
{ clearAutorunFocus(); }1970
view?.despawnEntity(message.entityId);1970
view?.despawnEntity(message.entityId, {1971
combatDeath: message.cause === "death"1972
});1971
break;1973
break;1972
case MessageType.entityAppearance:1974
case MessageType.entityAppearance:1973
view?.setAppearance(message);1975
view?.setAppearance(message);@@ -67,8 +67,10 @@ const GATHER_TOOL_HOLD_MS = 1100;
67
67
const DAMAGE_FLASH_MS = 180;
68
68
const FLASH_COLOR_DAMAGE = Object.freeze([1.0, 0.12, 0.12]);
69
69
const FLASH_COLOR_BLOCK = Object.freeze([1.0, 1.0, 1.0]);
70
/** Mob death: full red silhouette fades to transparent after the killing blow. */
70
/** Combat death: full red silhouette fades to transparent after the killing blow. */
71
71
const DEATH_FADE_MS = 500;
72
/** Interest leave / non-combat despawn: plain alpha fade (still lit / darkened). */
73
const DESPAWN_FADE_MS = 500;
72
74
const DAMAGE_FLOAT_MS = 900;
73
75
const SKILL_LEVEL_FLOAT_MS = 2800;
74
76
/** Projectiles spawn this many sprite-pixels below the caster sprite top. */
@@ -798,7 +800,7 @@ export class WorldView
798
800
{ this.#notePlayerTile(payload.tileX, payload.tileY); }
799
801
}
800
802
801
despawnEntity (entityId, { immediate = false } = {})
803
despawnEntity (entityId, { immediate = false, combatDeath = false } = {})
802
804
{
803
805
const existing = this.entities.get(entityId);
804
806
if (!existing)
@@ -806,11 +808,12 @@ export class WorldView
806
808
if (existing.dying)
807
809
{
808
810
if (immediate)
809
{ this.#finishDeathDissolve(entityId); }
811
{ this.#finishEntityFade(entityId); }
812
else if (combatDeath)
813
{ this.#upgradeToDeathDissolve(existing); }
810
814
return;
811
815
}
812
// Chunk unload / session wipe: drop instantly. Combat death (mobs and players)
813
// keeps the sprite for a red silhouette fade.
816
// Chunk unload / session wipe: drop instantly.
814
817
if (immediate)
815
818
{
816
819
this.cancelDeferredCombatHits(entityId);
@@ -818,7 +821,11 @@ export class WorldView
818
821
this.entities.delete(entityId);
819
822
return;
820
823
}
821
this.#beginDeathDissolve(existing);
824
// Combat death → red silhouette. Leaving 3×3 / summons / etc. → plain fade.
825
if (combatDeath)
826
{ this.#beginDeathDissolve(existing); }
827
else
828
{ this.#beginDespawnFade(existing); }
822
829
}
823
830
824
831
/**
@@ -828,17 +835,22 @@ export class WorldView
828
835
beginDeathDissolve (entityId)
829
836
{
830
837
const existing = this.entities.get(entityId);
831
if (!existing || existing.dying)
838
if (!existing)
832
839
{ return; }
840
if (existing.dying)
841
{
842
this.#upgradeToDeathDissolve(existing);
843
return;
844
}
833
845
this.#beginDeathDissolve(existing);
834
846
}
835
847
836
/** Abort an in-progress dissolve (respawn / session wipe). */
848
/** Abort an in-progress fade (respawn / session wipe). */
837
849
finishDeathDissolve (entityId)
838
850
{
839
851
if (!this.entities.get(entityId)?.dying)
840
852
{ return; }
841
this.#finishDeathDissolve(entityId);
853
this.#finishEntityFade(entityId);
842
854
}
843
855
844
856
#destroyEntityVisuals (existing)
@@ -852,23 +864,56 @@ export class WorldView
852
864
{ overlay.destroy(); }
853
865
}
854
866
867
#stripEntityChrome (entity)
868
{
869
entity.hpBar?.destroy();
870
entity.hpBar = null;
871
entity.skullMarker?.destroy();
872
entity.skullMarker = null;
873
}
874
875
#beginDespawnFade (entity)
876
{
877
const now = performance.now();
878
entity.dying = true;
879
entity.deathDissolve = false;
880
entity.untargetable = true;
881
entity.deathFadeStarted = now;
882
entity.deathFadeMs = DESPAWN_FADE_MS;
883
this.#stripEntityChrome(entity);
884
}
885
855
886
#beginDeathDissolve (entity)
856
887
{
857
888
const now = performance.now();
858
889
entity.dying = true;
890
entity.deathDissolve = true;
859
891
entity.untargetable = true;
860
892
entity.deathFadeStarted = now;
893
entity.deathFadeMs = DEATH_FADE_MS;
861
894
// Keep a full red silhouette for the whole fade (hit flash may already be running).
862
895
entity.damageFlashUntil = now + DEATH_FADE_MS;
863
896
entity.damageFlashColor = FLASH_COLOR_DAMAGE;
864
entity.hpBar?.destroy();
865
entity.hpBar = null;
866
entity.skullMarker?.destroy();
867
entity.skullMarker = null;
897
this.#stripEntityChrome(entity);
868
898
// Leave deferred projectile impacts queued so knockback / float still play on arrival.
869
899
}
870
900
871
#finishDeathDissolve (entityId)
901
/** Promote an in-progress plain despawn fade to the red combat dissolve. */
902
#upgradeToDeathDissolve (entity)
903
{
904
if (entity.deathDissolve)
905
{ return; }
906
const now = performance.now();
907
const elapsed = Math.max(0, now - (entity.deathFadeStarted ?? now));
908
const remaining = Math.max(1, (entity.deathFadeMs ?? DESPAWN_FADE_MS) - elapsed);
909
entity.deathDissolve = true;
910
entity.deathFadeStarted = now;
911
entity.deathFadeMs = Math.min(DEATH_FADE_MS, remaining);
912
entity.damageFlashUntil = now + entity.deathFadeMs;
913
entity.damageFlashColor = FLASH_COLOR_DAMAGE;
914
}
915
916
#finishEntityFade (entityId)
872
917
{
873
918
this.cancelDeferredCombatHits(entityId);
874
919
const existing = this.entities.get(entityId);
@@ -2429,7 +2474,7 @@ export class WorldView
2429
2474
let entity = this.entities.get(payload.entityId);
2430
2475
if (entity?.dying)
2431
2476
{
2432
this.#finishDeathDissolve(payload.entityId);
2477
this.#finishEntityFade(payload.entityId);
2433
2478
entity = null;
2434
2479
}
2435
2480
if (!entity)
@@ -2679,15 +2724,17 @@ export class WorldView
2679
2724
let deathAlpha = 1;
2680
2725
if (entity.dying)
2681
2726
{
2682
const fadeT = (now - (entity.deathFadeStarted ?? now)) / DEATH_FADE_MS;
2727
const fadeMs = Math.max(1, entity.deathFadeMs ?? DEATH_FADE_MS);
2728
const fadeT = (now - (entity.deathFadeStarted ?? now)) / fadeMs;
2683
2729
if (fadeT >= 1)
2684
2730
{
2685
this.#finishDeathDissolve(entity.entityId);
2731
this.#finishEntityFade(entity.entityId);
2686
2732
return;
2687
2733
}
2688
// Full red silhouette while dissolving; alpha drains over DEATH_FADE_MS.
2689
flashStrength = 1;
2690
2734
deathAlpha = Math.max(0, 1 - fadeT);
2735
// Red silhouette only for combat death; plain despawn keeps lit colours + darkness.
2736
if (entity.deathDissolve)
2737
{ flashStrength = 1; }
2691
2738
}
2692
2739
const flashColor = entity.damageFlashColor ?? FLASH_COLOR_DAMAGE;
2693
2740
const tileShade = this.#entityShadeAlpha(entity, now);
@@ -67,8 +67,10 @@ const GATHER_TOOL_HOLD_MS = 1100;67
const DAMAGE_FLASH_MS = 180;67
const DAMAGE_FLASH_MS = 180;68
const FLASH_COLOR_DAMAGE = Object.freeze([1.0, 0.12, 0.12]);68
const FLASH_COLOR_DAMAGE = Object.freeze([1.0, 0.12, 0.12]);69
const FLASH_COLOR_BLOCK = Object.freeze([1.0, 1.0, 1.0]);69
const FLASH_COLOR_BLOCK = Object.freeze([1.0, 1.0, 1.0]);70
/** Mob death: full red silhouette fades to transparent after the killing blow. */70
/** Combat death: full red silhouette fades to transparent after the killing blow. */71
const DEATH_FADE_MS = 500;71
const DEATH_FADE_MS = 500;72
/** Interest leave / non-combat despawn: plain alpha fade (still lit / darkened). */73
const DESPAWN_FADE_MS = 500;72
const DAMAGE_FLOAT_MS = 900;74
const DAMAGE_FLOAT_MS = 900;73
const SKILL_LEVEL_FLOAT_MS = 2800;75
const SKILL_LEVEL_FLOAT_MS = 2800;74
/** Projectiles spawn this many sprite-pixels below the caster sprite top. */76
/** Projectiles spawn this many sprite-pixels below the caster sprite top. */@@ -798,7 +800,7 @@ export class WorldView798
{ this.#notePlayerTile(payload.tileX, payload.tileY); }800
{ this.#notePlayerTile(payload.tileX, payload.tileY); }799
}801
}800
802
801
despawnEntity (entityId, { immediate = false } = {})803
despawnEntity (entityId, { immediate = false, combatDeath = false } = {})802
{804
{803
const existing = this.entities.get(entityId);805
const existing = this.entities.get(entityId);804
if (!existing)806
if (!existing)@@ -806,11 +808,12 @@ export class WorldView806
if (existing.dying)808
if (existing.dying)807
{809
{808
if (immediate)810
if (immediate)809
{ this.#finishDeathDissolve(entityId); }811
{ this.#finishEntityFade(entityId); }812
else if (combatDeath)813
{ this.#upgradeToDeathDissolve(existing); }810
return;814
return;811
}815
}812
// Chunk unload / session wipe: drop instantly. Combat death (mobs and players)816
// Chunk unload / session wipe: drop instantly.813
// keeps the sprite for a red silhouette fade.814
if (immediate)817
if (immediate)815
{818
{816
this.cancelDeferredCombatHits(entityId);819
this.cancelDeferredCombatHits(entityId);@@ -818,7 +821,11 @@ export class WorldView818
this.entities.delete(entityId);821
this.entities.delete(entityId);819
return;822
return;820
}823
}821
this.#beginDeathDissolve(existing);824
// Combat death → red silhouette. Leaving 3×3 / summons / etc. → plain fade.825
if (combatDeath)826
{ this.#beginDeathDissolve(existing); }827
else828
{ this.#beginDespawnFade(existing); }822
}829
}823
830
824
/**831
/**@@ -828,17 +835,22 @@ export class WorldView828
beginDeathDissolve (entityId)835
beginDeathDissolve (entityId)829
{836
{830
const existing = this.entities.get(entityId);837
const existing = this.entities.get(entityId);831
if (!existing || existing.dying)838
if (!existing)832
{ return; }839
{ return; }840
if (existing.dying)841
{842
this.#upgradeToDeathDissolve(existing);843
return;844
}833
this.#beginDeathDissolve(existing);845
this.#beginDeathDissolve(existing);834
}846
}835
847
836
/** Abort an in-progress dissolve (respawn / session wipe). */848
/** Abort an in-progress fade (respawn / session wipe). */837
finishDeathDissolve (entityId)849
finishDeathDissolve (entityId)838
{850
{839
if (!this.entities.get(entityId)?.dying)851
if (!this.entities.get(entityId)?.dying)840
{ return; }852
{ return; }841
this.#finishDeathDissolve(entityId);853
this.#finishEntityFade(entityId);842
}854
}843
855
844
#destroyEntityVisuals (existing)856
#destroyEntityVisuals (existing)@@ -852,23 +864,56 @@ export class WorldView852
{ overlay.destroy(); }864
{ overlay.destroy(); }853
}865
}854
866
867
#stripEntityChrome (entity)868
{869
entity.hpBar?.destroy();870
entity.hpBar = null;871
entity.skullMarker?.destroy();872
entity.skullMarker = null;873
}874
875
#beginDespawnFade (entity)876
{877
const now = performance.now();878
entity.dying = true;879
entity.deathDissolve = false;880
entity.untargetable = true;881
entity.deathFadeStarted = now;882
entity.deathFadeMs = DESPAWN_FADE_MS;883
this.#stripEntityChrome(entity);884
}885
855
#beginDeathDissolve (entity)886
#beginDeathDissolve (entity)856
{887
{857
const now = performance.now();888
const now = performance.now();858
entity.dying = true;889
entity.dying = true;890
entity.deathDissolve = true;859
entity.untargetable = true;891
entity.untargetable = true;860
entity.deathFadeStarted = now;892
entity.deathFadeStarted = now;893
entity.deathFadeMs = DEATH_FADE_MS;861
// Keep a full red silhouette for the whole fade (hit flash may already be running).894
// Keep a full red silhouette for the whole fade (hit flash may already be running).862
entity.damageFlashUntil = now + DEATH_FADE_MS;895
entity.damageFlashUntil = now + DEATH_FADE_MS;863
entity.damageFlashColor = FLASH_COLOR_DAMAGE;896
entity.damageFlashColor = FLASH_COLOR_DAMAGE;864
entity.hpBar?.destroy();897
this.#stripEntityChrome(entity);865
entity.hpBar = null;866
entity.skullMarker?.destroy();867
entity.skullMarker = null;868
// Leave deferred projectile impacts queued so knockback / float still play on arrival.898
// Leave deferred projectile impacts queued so knockback / float still play on arrival.869
}899
}870
900
871
#finishDeathDissolve (entityId)901
/** Promote an in-progress plain despawn fade to the red combat dissolve. */902
#upgradeToDeathDissolve (entity)903
{904
if (entity.deathDissolve)905
{ return; }906
const now = performance.now();907
const elapsed = Math.max(0, now - (entity.deathFadeStarted ?? now));908
const remaining = Math.max(1, (entity.deathFadeMs ?? DESPAWN_FADE_MS) - elapsed);909
entity.deathDissolve = true;910
entity.deathFadeStarted = now;911
entity.deathFadeMs = Math.min(DEATH_FADE_MS, remaining);912
entity.damageFlashUntil = now + entity.deathFadeMs;913
entity.damageFlashColor = FLASH_COLOR_DAMAGE;914
}915
916
#finishEntityFade (entityId)872
{917
{873
this.cancelDeferredCombatHits(entityId);918
this.cancelDeferredCombatHits(entityId);874
const existing = this.entities.get(entityId);919
const existing = this.entities.get(entityId);@@ -2429,7 +2474,7 @@ export class WorldView2429
let entity = this.entities.get(payload.entityId);2474
let entity = this.entities.get(payload.entityId);2430
if (entity?.dying)2475
if (entity?.dying)2431
{2476
{2432
this.#finishDeathDissolve(payload.entityId);2477
this.#finishEntityFade(payload.entityId);2433
entity = null;2478
entity = null;2434
}2479
}2435
if (!entity)2480
if (!entity)@@ -2679,15 +2724,17 @@ export class WorldView2679
let deathAlpha = 1;2724
let deathAlpha = 1;2680
if (entity.dying)2725
if (entity.dying)2681
{2726
{2682
const fadeT = (now - (entity.deathFadeStarted ?? now)) / DEATH_FADE_MS;2727
const fadeMs = Math.max(1, entity.deathFadeMs ?? DEATH_FADE_MS);2728
const fadeT = (now - (entity.deathFadeStarted ?? now)) / fadeMs;2683
if (fadeT >= 1)2729
if (fadeT >= 1)2684
{2730
{2685
this.#finishDeathDissolve(entity.entityId);2731
this.#finishEntityFade(entity.entityId);2686
return;2732
return;2687
}2733
}2688
// Full red silhouette while dissolving; alpha drains over DEATH_FADE_MS.2689
flashStrength = 1;2690
deathAlpha = Math.max(0, 1 - fadeT);2734
deathAlpha = Math.max(0, 1 - fadeT);2735
// Red silhouette only for combat death; plain despawn keeps lit colours + darkness.2736
if (entity.deathDissolve)2737
{ flashStrength = 1; }2691
}2738
}2692
const flashColor = entity.damageFlashColor ?? FLASH_COLOR_DAMAGE;2739
const flashColor = entity.damageFlashColor ?? FLASH_COLOR_DAMAGE;2693
const tileShade = this.#entityShadeAlpha(entity, now);2740
const tileShade = this.#entityShadeAlpha(entity, now);@@ -2314,7 +2314,8 @@ export function finalizeMobKill (world, attackerId, targetId, targetHandle, tile
2314
2314
type: "entity-despawn",
2315
2315
entityId: targetId,
2316
2316
tileX: view.tileX,
2317
tileY: view.tileY
2317
tileY: view.tileY,
2318
cause: "death"
2318
2319
});
2319
2320
}
2320
2321
return events;
@@ -2314,7 +2314,8 @@ export function finalizeMobKill (world, attackerId, targetId, targetHandle, tile2314
type: "entity-despawn",2314
type: "entity-despawn",2315
entityId: targetId,2315
entityId: targetId,2316
tileX: view.tileX,2316
tileX: view.tileX,2317
tileY: view.tileY2317
tileY: view.tileY,2318
cause: "death"2318
});2319
});2319
}2320
}2320
return events;2321
return events;@@ -2024,7 +2024,10 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
2024
2024
{
2025
2025
if (session.entityId === event.entityId || (!seesTo && !seesFrom))
2026
2026
{ continue; }
2027
send(session, { type: MessageType.entityDespawn, entityId: event.entityId });
2027
const payload = { type: MessageType.entityDespawn, entityId: event.entityId };
2028
if (event.cause)
2029
{ payload.cause = event.cause; }
2030
send(session, payload);
2028
2031
continue;
2029
2032
}
2030
2033
if (event.type === "entity-appearance")
@@ -2024,7 +2024,10 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,2024
{2024
{2025
if (session.entityId === event.entityId || (!seesTo && !seesFrom))2025
if (session.entityId === event.entityId || (!seesTo && !seesFrom))2026
{ continue; }2026
{ continue; }2027
send(session, { type: MessageType.entityDespawn, entityId: event.entityId });2027
const payload = { type: MessageType.entityDespawn, entityId: event.entityId };2028
if (event.cause)2029
{ payload.cause = event.cause; }2030
send(session, payload);2028
continue;2031
continue;2029
}2032
}2030
if (event.type === "entity-appearance")2033
if (event.type === "entity-appearance")@@ -1864,7 +1864,8 @@ export class Simulation
1864
1864
type: "entity-despawn",
1865
1865
entityId: event.entityId,
1866
1866
tileX: event.tileX,
1867
tileY: event.tileY
1867
tileY: event.tileY,
1868
cause: "death"
1868
1869
});
1869
1870
for (const dropEvent of result?.events ?? [])
1870
1871
{
@@ -1864,7 +1864,8 @@ export class Simulation1864
type: "entity-despawn",1864
type: "entity-despawn",1865
entityId: event.entityId,1865
entityId: event.entityId,1866
tileX: event.tileX,1866
tileX: event.tileX,1867
tileY: event.tileY1867
tileY: event.tileY,1868
cause: "death"1868
});1869
});1869
for (const dropEvent of result?.events ?? [])1870
for (const dropEvent of result?.events ?? [])1870
{1871
{@@ -8,6 +8,7 @@ import { mobComponents } from "../src/simulation/spawners.js";
8
8
import { createEmptyChunkData, encodeChunkBlob } from "../src/world/chunkData.js";
9
9
import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js";
10
10
import { emptyEquipment, emptySlots, addCoinsToSlots, countCoinsInSlots } from "../../shared/items/inventory.js";
11
import { applyDamageAndKill } from "../src/combat/service.js";
11
12
12
13
function componentsOf (simulation, entityId)
13
14
{
@@ -286,10 +287,42 @@ test("player death emits entity-despawn for other viewers", () =>
286
287
const playerId = harness.simulation.spawnCharacter(1, character);
287
288
const result = killPlayer(harness, character, playerId);
288
289
assert.ok(result.events.some((event) =>
289
event.type === "entity-despawn" && event.entityId === playerId
290
event.type === "entity-despawn"
291
&& event.entityId === playerId
292
&& event.cause === "death"
290
293
));
291
294
}
292
295
finally
293
296
{ harness.close(); }
294
297
});
295
298
});
299
300
test("mob kill entity-despawn is marked as combat death", () =>
301
{
302
const harness = makeSimulation({ workerCount: 1 });
303
try
304
{
305
const character = makeCharacter(harness.stateDb, { tileX: 8, tileY: 8 });
306
const playerId = harness.simulation.spawnCharacter(1, character);
307
const ratId = harness.simulation.spawnEntity(mobComponents({
308
tileX: 9,
309
tileY: 8,
310
mobTypeId: MobId.rat,
311
spawnerId: null
312
}));
313
const worker = harness.simulation.workers[
314
harness.simulation.entityRecord(ratId).workerId
315
];
316
const handle = worker.world.ecs.handleOf(ratId);
317
const health = worker.world.ecs.get(handle, Component.health);
318
health.current = 1;
319
const events = applyDamageAndKill(worker.world, playerId, ratId, 1, harness.now());
320
assert.ok(events.some((event) =>
321
event.type === "entity-despawn"
322
&& event.entityId === ratId
323
&& event.cause === "death"
324
));
325
}
326
finally
327
{ harness.close(); }
328
});
@@ -8,6 +8,7 @@ import { mobComponents } from "../src/simulation/spawners.js";8
import { createEmptyChunkData, encodeChunkBlob } from "../src/world/chunkData.js";8
import { createEmptyChunkData, encodeChunkBlob } from "../src/world/chunkData.js";9
import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js";9
import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js";10
import { emptyEquipment, emptySlots, addCoinsToSlots, countCoinsInSlots } from "../../shared/items/inventory.js";10
import { emptyEquipment, emptySlots, addCoinsToSlots, countCoinsInSlots } from "../../shared/items/inventory.js";11
import { applyDamageAndKill } from "../src/combat/service.js";11
12
12
function componentsOf (simulation, entityId)13
function componentsOf (simulation, entityId)13
{14
{@@ -286,10 +287,42 @@ test("player death emits entity-despawn for other viewers", () =>286
const playerId = harness.simulation.spawnCharacter(1, character);287
const playerId = harness.simulation.spawnCharacter(1, character);287
const result = killPlayer(harness, character, playerId);288
const result = killPlayer(harness, character, playerId);288
assert.ok(result.events.some((event) =>289
assert.ok(result.events.some((event) =>289
event.type === "entity-despawn" && event.entityId === playerId290
event.type === "entity-despawn"291
&& event.entityId === playerId292
&& event.cause === "death"290
));293
));291
}294
}292
finally295
finally293
{ harness.close(); }296
{ harness.close(); }294
});297
});295
});298
});299
300
test("mob kill entity-despawn is marked as combat death", () =>301
{302
const harness = makeSimulation({ workerCount: 1 });303
try304
{305
const character = makeCharacter(harness.stateDb, { tileX: 8, tileY: 8 });306
const playerId = harness.simulation.spawnCharacter(1, character);307
const ratId = harness.simulation.spawnEntity(mobComponents({308
tileX: 9,309
tileY: 8,310
mobTypeId: MobId.rat,311
spawnerId: null312
}));313
const worker = harness.simulation.workers[314
harness.simulation.entityRecord(ratId).workerId315
];316
const handle = worker.world.ecs.handleOf(ratId);317
const health = worker.world.ecs.get(handle, Component.health);318
health.current = 1;319
const events = applyDamageAndKill(worker.world, playerId, ratId, 1, harness.now());320
assert.ok(events.some((event) =>321
event.type === "entity-despawn"322
&& event.entityId === ratId323
&& event.cause === "death"324
));325
}326
finally327
{ harness.close(); }328
});