DriftScript bindings · interface

HostServices

Explained in Setting up scripts.

interface HostServices extends CoreServices
import type { HostServices } from '@driftengine/script';

Properties

NameTypeDescription
aireadonlyoptionalAiServicesThe agents a script may name, and what the two bridges answer for them.
More

agents alone is a supported configuration: a host with no navigation graph and no session still gets wake, consider, intentId and degraded. The bridge sub-services are what reachable, navigate, path and deciding need, and a capability whose service is absent fails at the call saying which one to provide rather than answering falsely.

xrreadonlyoptionalXrRuntimeThe live session, if a host has one.
More

Absent means drift/xr calls fail at the call naming the namespace, which is the bargain every optional service here makes. A stub would be worse than usual: a script asking where a head is and getting the origin cannot tell a headset at the world origin from no headset at all, and one of those is a scene that draws and the other is a scene nobody is in.

audioreadonlyoptional{ readonly graph: AudioGraph; readonly registry: SoundRegistry; readonly kick?: KickDetector; }The mix a script plays into, the sounds it can name, and, when the game runs one, the kick detector pulse reads. The host calls the detector's update each frame; a script only reads.
entitiesreadonlyoptionalEntityServicesThe component types, and any prefabs, a script may name.
More

Absent means a script's drift/ecs calls fail at the call with the namespace's own name in the error — the same bargain every other optional service makes, and the reason none of them is stubbed.

chemistryreadonlyoptionalChemistryServicesThe chemistry world a script reads and writes.
More

Absent means drift/chemistry calls fail at the call naming the namespace — the same bargain every other optional service makes, and the reason none of them is stubbed. A stub would make a script whose fire never lights indistinguishable from one whose chemistry is not connected.

behaviorreadonlyoptionalBehaviorServicesWhat a behaviour tick is handed.
More

Absent means drift/behavior calls fail at the call naming the namespace. A stub is particularly bad here for the reason doing exists: an agent whose routine never runs looks exactly like one that is standing about because it has nothing to do.