MCPcopy Create free account
hub / github.com/codecombat/codecombat / parseSetup

Function parseSetup

ozaria/engine/cinematic/commands/CinematicParser.js:51–61  ·  view source on GitHub ↗
(shot, systems)

Source from the content-addressed store, hash-verified

49 * @returns {AbstractCommand[]} The commands to run at the start and end of the shot.
50 */
51const parseSetup = (shot, systems) =>
52 Object.values(systems)
53 .filter(sys => sys !== undefined && typeof sys.parseSetupShot === 'function')
54 .reduce((commands, sys) => {
55 const systemCommands = sys.parseSetupShot(shot)
56 if (!Array.isArray(systemCommands)) {
57 throw new Error('Your system should always return an array of commands for a systemSetup')
58 }
59 return [...commands, ...systemCommands]
60 }
61 , [])
62
63/**
64 * Returns an array of commands.

Callers 1

parseShotFunction · 0.85

Calls 2

filterMethod · 0.80
parseSetupShotMethod · 0.45

Tested by

no test coverage detected