Skip to content

hotRules ​

Function of @v12-engine/engine

ts
export declare function hotRules(hot: HotContext | undefined, current: Rules, next: unknown): void;

A game's entry module's new version, taken while it runs (hot reload). At the module's end, the call to Vite written out as it is (Vite finds a module that takes its own new versions by it):

if (import.meta.hot) import.meta.hot.accept((module) = hotRules(import.meta.hot, melee, module?.melee))

As it or a file it reads (its units, its data.json) is saved in the dev server, the module given is made the new one in place, so that what holds it has the new one, and the games and editors of the page playing it take its definitions and rules (reloadGame, through onNewGameVersion). What does not go loads the page again, saying why (hot.invalidate(reason)): no new module, another game, a component defined another way, or a change to what a running world keeps as it was made (its systems, hooks, components, resources, and withoutSystems and withoutHooks, compared by their code and values). No client is pulled into the rules, which a server reads too