Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Data shapeServer APIGenerated

PlayerHit

Defined in: server/api.d.ts:1351

A player or NPC blow, as playerHit shows it before the referee rules. damage is what the blow will take and modifiers scale how the server works it out; a handler may change either, from any resource, and the next handler sees the change. Every other field describes what happened and is read-only in effect. It is live only while the handlers run: one kept for later reads damage and modifiers as undefined and changes nothing.

armor: DamagePasses

Defined in: server/api.d.ts:1380

The victim’s armour in each pass where the blow landed, before modifiers.


attack: DamagePasses

Defined in: server/api.d.ts:1375

The attacker’s attack in each pass, after the swing’s own strength and before modifiers.


blockBroken: boolean

Defined in: server/api.d.ts:1430

The victim’s block gave way under it.


blockDefense: number

Defined in: server/api.d.ts:1385

What the victim’s block put up, or 0 when nothing blocked it.


blocked: boolean

Defined in: server/api.d.ts:1420

The victim’s block caught it.


bodyPart: "head" | "torso" | "leftArm" | "rightArm" | "leftLeg" | "rightLeg" | null

Defined in: server/api.d.ts:1405

The limb it landed on, or null for none in particular.


bodyPartCoefficient: number

Defined in: server/api.d.ts:1390

How much the place it landed multiplies the damage by: 1.5 for the head, 1 for the torso, 0.7 for a limb.


damage: number

Defined in: server/api.d.ts:1355

Health the blow takes. For melee between players the server works it out itself, the way the game does, from the attacker’s weapon and its wear, both players’ strength and skills, the armour the victim wears where it landed, the block and the perks and buffs it can vouch for; for NPC melee or an arrow it is what the victim’s own game worked out. Set it and it stands as set: modifiers are then ignored. Never negative.


engineDamage: number

Defined in: server/api.d.ts:1360

Health the game itself took for the blow on the machine that saw it land. Matches damage unless a perk that depends on the moment – a heavy weapon’s, a first strike’s – was in play, which the server leaves out.


modifiers: PlayerHitModifiers

Defined in: server/api.d.ts:1395

Scales on the server’s price; see PlayerHitModifiers. Ignored for an arrow.


perfectBlock: boolean

Defined in: server/api.d.ts:1425

The victim’s perfect block caught it. The game takes nothing for one.


priced: boolean

Defined in: server/api.d.ts:1365

Whether the server worked damage out itself: true for a swing, false for an arrow.


reason: "unknown" | "combat" | "gunshot" | "starvation" | "collision" | "scripted" | "disintegrate" | "fall" | "poison" | "bleeding" | "selfHarm"

Defined in: server/api.d.ts:1410

The game’s own reason for the damage: combat for a blade or a bow.


source: "melee" | "missile"

Defined in: server/api.d.ts:1415

Whether it was a swing or an arrow.


stamina: number

Defined in: server/api.d.ts:1400

Stamina the blow cost the victim. Already spent: stamina decides their next block, which cannot wait for a ruling.


weapon: string | null

Defined in: server/api.d.ts:1370

The attacker’s weapon as 32 hex digits, or null for a bare hand.