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 ally of the hit’s instigator takes none 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 is never spared as friendly fire. An InvulnerableTrait entity takes none either, its own hits included. A refused hit changes nothing on the entity and emits DamageRefusedEvent in place of DamagedEvent, naming the refusal, friendly fire first. Returns why it applied nothing, or null. An amount below 0, or no finite number, throws, naming dealHealing as the way to give health back. 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