No active sessions yet.

No games yet.

No conversations yet.

No characters yet.

Cooperation

How plugins work together without depending on each other.

Plugins never call each other. They meet through shared engine state. That's what makes them removable: if hunger called into rest, deleting rest would break hunger.

They meet in three places.

1. Shared fields

Any plugin can read any field. So ask before you rely on one:

$.hasPlugin('hunger') && $.field('satiety') < 20

Without the check, a game without the hunger plugin reads null, and your rule behaves as if everyone is always starving or never hungry. See Missing values.

2. Engine triggers

One plugin's $.damage() fires onDamage, and another plugin's hook catches it. Neither knows the other exists.

3. Plugin events

A plugin can declare an event: a moment it lets other plugins refuse. The rest plugin declares rest:sleep. Hunger answers it:

// hook on rest:sleep
if ($.party.some(p => p.fields.satiety <= 0)) {
  $.refuse('they are too hollow with hunger to settle')
}

A hook on an undeclared event never fires. So hunger works fine in a game without rest.

A refuse in a hook on an event stops only that event. The rest of the turn still runs.

The test

Delete either side of any pair, and the other still works.

Hunger without rest still drains and still starves; it just never refuses a sleep. Rest without hunger still restores; it just never gets refused. If deleting one breaks the other, you haven't built two plugins. You've built one in two pieces.