-
Notifications
You must be signed in to change notification settings - Fork 0
MishapJS
YukkuriC edited this page Sep 5, 2026
·
1 revision
highly customizable mishap types
- declaring the type using
MishapJS.type()first, quite similar toIotaJS - calling
type.create()ortype.create(data)for a mishap of this type - KJS-ish piped methods to override all behaviors of created mishaps
let {
ActionRegistry,
MishapJS,
APIFlat: { HexPattern },
} = HexJS
// declaring a mishap type with custom message & execution logic, everything else default
let MishapSus = MishapJS.type()
.setConstErrorMessage(Text.red('SUS'))
.setExecute((mishap, env, ctx, stack) => {
env.castingEntity.kill()
})
this.MishapSus = MishapSus
// a familiar action throwing this new mishap
// pattern credit: HexTweaks
let actionSus = ActionRegistry.of(
HexPattern.fromAnglesUnchecked('dewdeqwwedaqedwadweqewwd', 'west'),
'yc:sus',
true,
).setOperate(() => MishapSus.create())