File size: 464 Bytes
6e13fd7
 
b3dcd81
e2e8242
 
 
 
 
 
 
 
 
 
 
b3dcd81
e2e8242
6e13fd7
 
e2e8242
 
 
 
 
 
357c6cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
export function parseCommand(text) {
  const t = text.toLowerCase();

  if (t.includes("fractal")) {
    return packet("world", { power: 8.0 });
  }

  if (t.includes("stronger")) {
    return packet("world", { power: 12.0 });
  }

  if (t.includes("reset")) {
    return packet("system", { reset: true });
  }

  return packet("control", { raw: text });
}

function packet(lane, payload) {
  return {
    lane,
    payload,
    timestamp: performance.now()
  };
}