defineCommand
Function of @v12-engine/engine
ts
export declare function defineCommand<const T extends string, F extends Fields>(type: T, fields: F, execute: (world: World, player: PlayerId, command: Checked<F>) => void, options?: {
outsideTick?: boolean;
}): DefinedCommand<T, F>;Defines a command type, for a game module's commands: its type, its fields (see fields.ts), and what it does. command is typed by the fields.
ts
const sellTower = defineCommand('sellTower', { tower: id }, (world, player, command) => { ... })
session.send(sellTower.make({ tower: 12 }))