Commands
CommandChannel (world.commands) is a list of named commands with a description. A command takes one object of arguments and returns data (or a promise). The inspector, the model viewer, the level editor and AI agents all use the same channel: list() says what is there, execute(name, args) runs it.
world.commands.list(); // [{ name, description }, ...]
await world.commands.execute('world.timeScale', { scale: 0.25 });
await world.commands.execute('physics.enable', { name: 'heat' });
A package registers its commands when its service or capability starts, so the list is the list of what the running game has loaded.
What exists#
| Area | Commands |
|---|---|
| World | world.info, world.pause, world.step, world.timeScale |
| Scene | scene.entities, scene.node, scene.nodes, scene.bounds, scene.stats, scene.validate, camera.get, camera.set, camera.view, view.set |
| Assets and packages | asset.list, asset.load, asset.remove, and the pkg.* commands (add, remove, validate a level package) |
| Animation | anim.list, anim.graph, anim.play, anim.stop, anim.montage, anim.set, anim.scrub |
| Physics host | physics.info, physics.enable, physics.disable, physics.configure, physics.materials, physics.bodies, body.state, body.impulse |
| Gravity and media | gravity.at, gravity.set, gravity.scale, gravity.attractor.add, gravity.attractor.remove, media.add, media.at, media.remove, wind.set, atmosphere.at |
| Strength and stretch | strength.health, strength.damage, stretch.info, cloth.pin |
| Ground and explosions | terrain.at, terrain.dig, terrain.fill, terrain.level, terrain.wet, terrain.compact, terrain.dump, explosion.detonate, explosion.info, explosion.preview |
| Heat, chemistry, nuclear | heat.add, heat.info, heat.join, heat.part.add, heat.set, heat.state, heat.step, chem.check, chem.info, chem.react, isotope.add, radiation.dose, radiation.map, reactor.rods, reactor.scram, reactor.state, nuclear.info |
| Combustion | chamber.ignite, chamber.state, chamber.vent, combustion.info, engine.start, engine.stop, engine.throttle, gun.fire, wick.add, gate.force |
| Electric and machines | circuit.add, circuit.connect, circuit.info, circuit.set, circuit.state, circuit.step, machine.info, machine.set, machine.state, machine.step, meter.read |
| Vehicles and liquids | vessel.add, vessel.info, vessel.state, vessel.fill, vessel.thrust, vessel.heat, vessel.burner, vessel.breach, vessel.blow, vessel.surface, liquid.add, liquid.info, fluid.info, reservoir.add, reservoir.state, surface.disturb, surface.height, surface.info, capillary.add, assembly.state |
| Links | link.add, link.state, link.valve, links.energy |
Each command's description and arguments come from the command itself: world.commands.list() is the authority, this table only shows where to look.
Why it exists#
Anything a person can do in the editor or the inspector, an agent can do through the same names, and the same names are what the tests call. That is how a level is edited by commands and patches (@ferret/editor), inspected without a debugger (@ferret/inspector), and checked in an automated run.