{ "source": "JavaScript expression returning {start(api), update(api,dt)}. No imports or TypeScript. Worker watchdog 1500ms. Imported project scripts are TRUSTED code; Worker is responsiveness isolation, not a security sandbox.", "api": { "state": "Persistent per-instance mutable data during one play run", "params": "Field defaults + component.script.params", "input": "{x,z,attack,pointer,aim,jump,dash,sprint,jumpPressed,dashPressed,resetPressed,yaw,pitch}; yaw=0 faces -Z in first person", "get": "api.get(id?) -> clone of entity or null", "entities": "api.entities() -> clones of entity states", "position": "api.position(id?) -> local coordinates", "move": "api.move([dx,dy,dz]); real collisions for kinematic body", "physics": "api.physics(id?) -> {grounded,velocity:{x,y,z},contacts:[{entityId,normal:[x,y,z]}]}", "velocity": "api.velocity({x?,y?,z?,gravityScale?}); persistent m/s, requires character component; gravity runs at 60 Hz", "teleport": "api.teleport([x,y,z],yaw?); clears velocity and contacts for character respawn", "emit": "api.emit(name,data?); delivers a presentation event to runtime callbacks", "rotate": "api.rotate(yRadians)", "patch": "api.patch(id,patch); updates state/transform/enabled. Structural mesh/collider edits take effect next Play.", "animate": "api.animate(clipOrState,loop=true); use false for a one-shot animation", "effect": "api.effect(\"swing\"|\"hit\",id?)", "spawn": "api.spawn(prefabAssetId,position); behaviors start on spawned instances", "destroy": "api.destroy(id?); disables entity+collider", "scene": "api.scene(sceneId); starts another scene", "log": "api.log(text)" }, "example": "({ update(api, dt) { const n = api.get(); api.rotate(n.transform.rotation[1] + api.params.speed * dt); } })" }