definePlugin
definePlugin<
Schema,Scope,Input,Motion,Rules,Physics,Inputs,Actions,Layers,Commands,Contexts>(config):Plugin<SystemHandles<Input,Motion,Rules,Physics>,Inputs,Actions,Layers,Commands,Contexts>
Makes a plugin, checking what one plugin can know at the call: its name,
its phases, that each system has a name and no two share one, that each
anchor names a system of its phase, that each replacement matches what
it replaces, and that it does not require itself. What needs the whole
list, a missing requirement, an anchor’s plugin, a clash between
plugins, the composer checks as the world is made. Generic over the
commands, the inputs and the systems’ keys, so siege.commands.pick is
typed by its payload, siege.systems.spawn by its phase, predicted
and runsOn, and siege.commands.unknown fails to typecheck.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Schema extends SaveSchema |
SaveSchema |
Scope extends "entity" | "world" | "player" |
"player" |
Input extends object |
Record<never, never> |
Motion extends object |
Record<never, never> |
Rules extends object |
Record<never, never> |
Physics extends object |
Record<never, never> |
Inputs extends Readonly<Record<string, VectorInputDeclaration | AngleInputDeclaration | ButtonInputDeclaration | AxisInputDeclaration>> |
Readonly<Record<never, never>> |
Actions extends Readonly<Record<string, PageActionDeclaration>> |
Readonly<Record<never, never>> |
Layers extends string |
never |
Commands extends Readonly<Record<string, CommandDeclaration<Readonly<Record<string, CommandField>>, string, Readonly<Record<string, ReturnField>> | undefined, boolean, boolean, boolean>>> |
Readonly<Record<never, never>> |
Contexts extends Readonly<Record<string, InputContextDeclaration>> |
Readonly<Record<never, never>> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config |
PluginConfig<Schema, Scope, PluginSystems<Input, Motion, Rules, Physics, Extract<keyof Commands, string>>, Inputs, Actions, Layers, Commands, Contexts> |
Returns
Section titled “Returns”Plugin<SystemHandles<Input, Motion, Rules, Physics>, Inputs, Actions, Layers, Commands, Contexts>