Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

dealDamage

dealDamage(authority, entity, damage): DamageRefusal | null

Takes amount off the entity’s health, never below zero, records its source and emits the hit as a DamagedEvent; the reap downs the entity at zero with DiedEvent, naming the hit that first took it there, and removes it a step later. An InvulnerableTrait entity takes none, and neither does an ally of the hit’s instigator while friendly fire is off, by the team question: with no teams(), one player’s hit spares another and every hit reaches an NPC. Self-damage always applies. Returns why it applied nothing, or null. Damage is an outcome, so it takes the room’s authority first: dealDamage(step, target, { amount: 30, source: character }).

Parameter Type
authority Authority
entity Entity
damage Damage

DamageRefusal | null