@lagless/create 0.0.56 → 0.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lagless/create",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -173,6 +173,15 @@ const hooks: RoomHooks = {
173
173
  reason,
174
174
  });
175
175
  },
176
+ // Inspect or reject client inputs before broadcast:
177
+ onInput: (ctx, player, input) => {
178
+ // input: { tick, playerSlot, seq, payload }
179
+ // Return false to reject (sends CancelInput to sender)
180
+ },
181
+ // Called when input is rejected (validation or onInput):
182
+ onInputDeclined: (ctx, player, tick, seq, reason) => {
183
+ // reason: 0=TooOld, 1=TooFarFuture, 2=InvalidSlot, 3=Rejected
184
+ },
176
185
  };
177
186
  ```
178
187
 
@@ -170,6 +170,20 @@ export const hooks: RoomHooks = {
170
170
  // Persist results to database, etc.
171
171
  },
172
172
 
173
+ // Inspect or reject client inputs before broadcast (sync, called per input)
174
+ onInput: (ctx, player, input) => {
175
+ // input: { tick, playerSlot, seq, payload (Uint8Array) }
176
+ // Decode payload: InputBinarySchema.unpackBatch(registry, input.payload.buffer)
177
+ // Return false to reject (sends CancelInput with Rejected reason)
178
+ // Return void/true to accept
179
+ },
180
+
181
+ // Called when input is rejected (by validation or onInput returning false)
182
+ onInputDeclined: (ctx, player, tick, seq, reason) => {
183
+ // reason: 0=TooOld, 1=TooFarFuture, 2=InvalidSlot, 3=Rejected
184
+ // Use for logging, rate-limit tracking, anti-cheat analytics
185
+ },
186
+
173
187
  // Room is being disposed
174
188
  onRoomDisposed: (ctx) => {
175
189
  console.log('Room disposed:', ctx.roomId);