ecs

Version:
sha256:d37a0e9
wit
world host
imports
world guest
imports
exports
setup:
setup()

app interface

app:resource {

A mod, similar to bevy::App

constructor()app

Construct an new App: an interface through which mods may interact with the bevy world.

Each mod may only do this once inside its setup function call. Attempting to do this twice or outside setup will trap.

add-systems(schedule:schedule, systems:list<system>)

Adds systems to the mod

}
system:resource {

An interface with which to define a new system for the host

Usage:

  1. Construct a new system, giving it a unique name
  2. Add system-params by calling 0 or more add-* methods
  3. Order the system relative to others
  4. Add the system to a schedule
constructor(name:string)system

Constructs a new system. Use the same name as exported in the guest world, otherwise the host won't be able to find it.

add-commands()

Adds a commands system-param

add-query(query:list<query-for>)

Adds a query system-param

after(other:borrow<system>)

Schedules this system be run after another system

before(other:borrow<system>)

Schedules this system be run before another system

}
commands:resource {

A commands system param

spawn(components:list<tuple<type-path, serialized-component>>)
}
query:resource {

A query system param

iter()option<list<component>>

Evaluates and returns the next query results

}
component:resource {
get()serialized-component

Gets the value of a component

set(value:serialized-component)

Sets the value of a component

Traps if this component was not declared as mutable

}

A fully-qualified type name

type-path:string

JSON serialized version of the actual component that is being passed between WASM and Bevy. So for every instance of component make sure you deserialize it yourself to the struct that it actually is.

Note: for components returned by query::optional this is an option<t>

serialized-component:string
schedule:variant {
mod-startup

A custom schedule that runs the first time a mod is loaded.

Note this is not the same as Bevy's Startup schedule

pre-update

Runs during the Bevy PreUpdate schedule

update

Runs during the Bevy Update schedule

post-update

Runs during the Bevy PostUpdate schedule

fixed-pre-update

Runs during the Bevy FixedPreUpdate schedule

fixed-update

Runs during the Bevy FixedUpdate schedule

fixed-post-update

Runs during the Bevy FixedPostUpdate schedule

custom(string)

Runs during the Bevy Update schedule

}
query-for:variant {
with(type-path)
without(type-path)
}