@adatechnology/game-test-room 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,6 +46,7 @@ const room = createTestRoom({
46
46
  { id: 'my_crate_breaks', name: 'My crate breaks', run: ({ room, step, expect }) => {
47
47
  const o = room.spawn('my_crate', [0, 0, -4])
48
48
  room.setTool('pistol_9mm')
49
+ room.waitUntilReady() // setTool plays the draw: the tool answers `drawing` until the rule's draw time is over
49
50
  room.look([0, 1, -2], [0, 0.5, -4])
50
51
  room.use()
51
52
  step(2)
@@ -89,6 +90,10 @@ module id, so two modules can share a control id; a module loaded again keeps it
89
90
  `location`: the example page keeps it in `?bench.<moduleId>=`. `fps` and `frame_ms` use the real frame time, even past the 50 ms the simulation is clamped to. Loading a module again detaches the previous `attach` first. Q now reports the new fire
90
91
  mode (`mode` event) and `shot` events carry `rounds` and `mode`.
91
92
 
93
+ Grenades are cooked: hold the button to pull the pin and let go to throw with the fuse that is left (`cook` host events: `start`, `throw`, `burst` when it goes off in the hand; `room.use(hold)` does the same
94
+ by script). A charge set down gets a marker (`charge_marker`, a stake with a flag) and, when it waits for a trip wire (the Claymore), the wire is drawn (`charge_wire`) and the charge goes off by itself
95
+ when a body (the player, an object of the room) crosses it; whatever was already on the wire when it was set is let through until it steps off. Y only fires the charges for the remote detonator (C4).
96
+
92
97
  ## Controls
93
98
 
94
99
  | Input | Action |
package/dist/index.d.ts CHANGED
@@ -264,6 +264,8 @@ interface TestRoom {
264
264
  spawned(): SpawnedObject[];
265
265
  /** Advance one frame (only needed when the host owns the loop). */
266
266
  update(dt: number): void;
267
+ /** Advance frames until the tool in hand has no phase left (the draw `setTool` plays, a reload, a cycle) or `maxSeconds` pass; plus one frame so the next pull is not inside the phase; returns the seconds waited. */
268
+ waitUntilReady(maxSeconds?: number): number;
267
269
  on(type: 'spawn' | 'tool' | 'grab' | 'throw' | 'event', fn: (data: unknown) => void): () => void;
268
270
  /** Tilt the held item by `rad` radians around its own x axis (hold Z in the room). Pouring and spilling follow from the tilt. */
269
271
  tilt(rad: number): void;