diff --git a/docs/ast/source/entity.js.json b/docs/ast/source/entity.js.json index 43a84db..91d89e8 100644 --- a/docs/ast/source/entity.js.json +++ b/docs/ast/source/entity.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 8966, + "end": 9011, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 334, + "line": 336, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 8966, + "end": 9011, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 334, + "line": 336, "column": 0 } }, @@ -232,14 +232,14 @@ { "type": "ClassDeclaration", "start": 146, - "end": 8940, + "end": 8985, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 331, + "line": 333, "column": 1 } }, @@ -265,14 +265,14 @@ "body": { "type": "ClassBody", "start": 159, - "end": 8940, + "end": 8985, "loc": { "start": { "line": 9, "column": 13 }, "end": { - "line": 331, + "line": 333, "column": 1 } }, @@ -1243,16 +1243,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t ", + "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t *\n\t * @throws {Error} Cannot set entity id\n\t ", "start": 794, - "end": 882, + "end": 927, "loc": { "start": { "line": 44, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 4 } } @@ -1261,15 +1261,15 @@ }, { "type": "ClassMethod", - "start": 884, - "end": 941, + "start": 929, + "end": 986, "loc": { "start": { - "line": 49, + "line": 51, "column": 1 }, "end": { - "line": 51, + "line": 53, "column": 2 } }, @@ -1277,15 +1277,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 888, - "end": 890, + "start": 933, + "end": 935, "loc": { "start": { - "line": 49, + "line": 51, "column": 5 }, "end": { - "line": 49, + "line": 51, "column": 7 }, "identifierName": "id" @@ -1300,15 +1300,15 @@ "params": [ { "type": "Identifier", - "start": 891, - "end": 893, + "start": 936, + "end": 938, "loc": { "start": { - "line": 49, + "line": 51, "column": 8 }, "end": { - "line": 49, + "line": 51, "column": 10 }, "identifierName": "id" @@ -1318,58 +1318,58 @@ ], "body": { "type": "BlockStatement", - "start": 895, - "end": 941, + "start": 940, + "end": 986, "loc": { "start": { - "line": 49, + "line": 51, "column": 12 }, "end": { - "line": 51, + "line": 53, "column": 2 } }, "body": [ { "type": "ThrowStatement", - "start": 899, - "end": 938, + "start": 944, + "end": 983, "loc": { "start": { - "line": 50, + "line": 52, "column": 2 }, "end": { - "line": 50, + "line": 52, "column": 41 } }, "argument": { "type": "NewExpression", - "start": 905, - "end": 938, + "start": 950, + "end": 983, "loc": { "start": { - "line": 50, + "line": 52, "column": 8 }, "end": { - "line": 50, + "line": 52, "column": 41 } }, "callee": { "type": "Identifier", - "start": 909, - "end": 914, + "start": 954, + "end": 959, "loc": { "start": { - "line": 50, + "line": 52, "column": 12 }, "end": { - "line": 50, + "line": 52, "column": 17 }, "identifierName": "Error" @@ -1379,15 +1379,15 @@ "arguments": [ { "type": "StringLiteral", - "start": 915, - "end": 937, + "start": 960, + "end": 982, "loc": { "start": { - "line": 50, + "line": 52, "column": 18 }, "end": { - "line": 50, + "line": 52, "column": 40 } }, @@ -1407,16 +1407,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t ", + "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t *\n\t * @throws {Error} Cannot set entity id\n\t ", "start": 794, - "end": 882, + "end": 927, "loc": { "start": { "line": 44, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 4 } } @@ -1426,15 +1426,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if the entity has ALL of the specified component names.\n\t * Additional components that the entity has, which are not specified in has(), will be ignored.\n\t * If no component names are specified, this method returns true.\n\t *\n\t * @example\n\t * if (entity.has('position', 'velocity')) {...}\n\t *\n\t * @param {...string} [components] - The component names to check for\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 944, - "end": 1372, + "start": 989, + "end": 1417, "loc": { "start": { - "line": 53, + "line": 55, "column": 1 }, "end": { - "line": 64, + "line": 66, "column": 4 } } @@ -1443,15 +1443,15 @@ }, { "type": "ClassMethod", - "start": 1374, - "end": 1450, + "start": 1419, + "end": 1495, "loc": { "start": { - "line": 65, + "line": 67, "column": 1 }, "end": { - "line": 67, + "line": 69, "column": 2 } }, @@ -1459,15 +1459,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1374, - "end": 1377, + "start": 1419, + "end": 1422, "loc": { "start": { - "line": 65, + "line": 67, "column": 1 }, "end": { - "line": 65, + "line": 67, "column": 4 }, "identifierName": "has" @@ -1483,29 +1483,29 @@ "params": [ { "type": "RestElement", - "start": 1378, - "end": 1391, + "start": 1423, + "end": 1436, "loc": { "start": { - "line": 65, + "line": 67, "column": 5 }, "end": { - "line": 65, + "line": 67, "column": 18 } }, "argument": { "type": "Identifier", - "start": 1381, - "end": 1391, + "start": 1426, + "end": 1436, "loc": { "start": { - "line": 65, + "line": 67, "column": 8 }, "end": { - "line": 65, + "line": 67, "column": 18 }, "identifierName": "components" @@ -1516,72 +1516,72 @@ ], "body": { "type": "BlockStatement", - "start": 1393, - "end": 1450, + "start": 1438, + "end": 1495, "loc": { "start": { - "line": 65, + "line": 67, "column": 20 }, "end": { - "line": 67, + "line": 69, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 1397, - "end": 1447, + "start": 1442, + "end": 1492, "loc": { "start": { - "line": 66, + "line": 68, "column": 2 }, "end": { - "line": 66, + "line": 68, "column": 52 } }, "argument": { "type": "CallExpression", - "start": 1404, - "end": 1447, + "start": 1449, + "end": 1492, "loc": { "start": { - "line": 66, + "line": 68, "column": 9 }, "end": { - "line": 66, + "line": 68, "column": 52 } }, "callee": { "type": "MemberExpression", - "start": 1404, - "end": 1420, + "start": 1449, + "end": 1465, "loc": { "start": { - "line": 66, + "line": 68, "column": 9 }, "end": { - "line": 66, + "line": 68, "column": 25 } }, "object": { "type": "Identifier", - "start": 1404, - "end": 1414, + "start": 1449, + "end": 1459, "loc": { "start": { - "line": 66, + "line": 68, "column": 9 }, "end": { - "line": 66, + "line": 68, "column": 19 }, "identifierName": "components" @@ -1590,15 +1590,15 @@ }, "property": { "type": "Identifier", - "start": 1415, - "end": 1420, + "start": 1460, + "end": 1465, "loc": { "start": { - "line": 66, + "line": 68, "column": 20 }, "end": { - "line": 66, + "line": 68, "column": 25 }, "identifierName": "every" @@ -1610,15 +1610,15 @@ "arguments": [ { "type": "ArrowFunctionExpression", - "start": 1421, - "end": 1446, + "start": 1466, + "end": 1491, "loc": { "start": { - "line": 66, + "line": 68, "column": 26 }, "end": { - "line": 66, + "line": 68, "column": 51 } }, @@ -1629,15 +1629,15 @@ "params": [ { "type": "Identifier", - "start": 1421, - "end": 1425, + "start": 1466, + "end": 1470, "loc": { "start": { - "line": 66, + "line": 68, "column": 26 }, "end": { - "line": 66, + "line": 68, "column": 30 }, "identifierName": "name" @@ -1647,29 +1647,29 @@ ], "body": { "type": "BinaryExpression", - "start": 1429, - "end": 1446, + "start": 1474, + "end": 1491, "loc": { "start": { - "line": 66, + "line": 68, "column": 34 }, "end": { - "line": 66, + "line": 68, "column": 51 } }, "left": { "type": "Identifier", - "start": 1429, - "end": 1433, + "start": 1474, + "end": 1478, "loc": { "start": { - "line": 66, + "line": 68, "column": 34 }, "end": { - "line": 66, + "line": 68, "column": 38 }, "identifierName": "name" @@ -1679,44 +1679,44 @@ "operator": "in", "right": { "type": "MemberExpression", - "start": 1437, - "end": 1446, + "start": 1482, + "end": 1491, "loc": { "start": { - "line": 66, + "line": 68, "column": 42 }, "end": { - "line": 66, + "line": 68, "column": 51 } }, "object": { "type": "ThisExpression", - "start": 1437, - "end": 1441, + "start": 1482, + "end": 1486, "loc": { "start": { - "line": 66, + "line": 68, "column": 42 }, "end": { - "line": 66, + "line": 68, "column": 46 } } }, "property": { "type": "Identifier", - "start": 1442, - "end": 1446, + "start": 1487, + "end": 1491, "loc": { "start": { - "line": 66, + "line": 68, "column": 47 }, "end": { - "line": 66, + "line": 68, "column": 51 }, "identifierName": "data" @@ -1738,15 +1738,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if the entity has ALL of the specified component names.\n\t * Additional components that the entity has, which are not specified in has(), will be ignored.\n\t * If no component names are specified, this method returns true.\n\t *\n\t * @example\n\t * if (entity.has('position', 'velocity')) {...}\n\t *\n\t * @param {...string} [components] - The component names to check for\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 944, - "end": 1372, + "start": 989, + "end": 1417, "loc": { "start": { - "line": 53, + "line": 55, "column": 1 }, "end": { - "line": 64, + "line": 66, "column": 4 } } @@ -1756,15 +1756,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name, or undefined if it doesn't exist\n\t *\n\t * @example\n\t * let position = entity.get('position')\n\t *\n\t * @param {string} component - The component name to get\n\t *\n\t * @return {Object} The component if defined, otherwise undefined\n\t ", - "start": 1453, - "end": 1719, + "start": 1498, + "end": 1764, "loc": { "start": { - "line": 69, + "line": 71, "column": 1 }, "end": { - "line": 78, + "line": 80, "column": 4 } } @@ -1773,15 +1773,15 @@ }, { "type": "ClassMethod", - "start": 1721, - "end": 1770, + "start": 1766, + "end": 1815, "loc": { "start": { - "line": 79, + "line": 81, "column": 1 }, "end": { - "line": 81, + "line": 83, "column": 2 } }, @@ -1789,15 +1789,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1721, - "end": 1724, + "start": 1766, + "end": 1769, "loc": { "start": { - "line": 79, + "line": 81, "column": 1 }, "end": { - "line": 79, + "line": 81, "column": 4 }, "identifierName": "get" @@ -1813,15 +1813,15 @@ "params": [ { "type": "Identifier", - "start": 1725, - "end": 1734, + "start": 1770, + "end": 1779, "loc": { "start": { - "line": 79, + "line": 81, "column": 5 }, "end": { - "line": 79, + "line": 81, "column": 14 }, "identifierName": "component" @@ -1831,87 +1831,87 @@ ], "body": { "type": "BlockStatement", - "start": 1736, - "end": 1770, + "start": 1781, + "end": 1815, "loc": { "start": { - "line": 79, + "line": 81, "column": 16 }, "end": { - "line": 81, + "line": 83, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 1740, - "end": 1767, + "start": 1785, + "end": 1812, "loc": { "start": { - "line": 80, + "line": 82, "column": 2 }, "end": { - "line": 80, + "line": 82, "column": 29 } }, "argument": { "type": "MemberExpression", - "start": 1747, - "end": 1767, + "start": 1792, + "end": 1812, "loc": { "start": { - "line": 80, + "line": 82, "column": 9 }, "end": { - "line": 80, + "line": 82, "column": 29 } }, "object": { "type": "MemberExpression", - "start": 1747, - "end": 1756, + "start": 1792, + "end": 1801, "loc": { "start": { - "line": 80, + "line": 82, "column": 9 }, "end": { - "line": 80, + "line": 82, "column": 18 } }, "object": { "type": "ThisExpression", - "start": 1747, - "end": 1751, + "start": 1792, + "end": 1796, "loc": { "start": { - "line": 80, + "line": 82, "column": 9 }, "end": { - "line": 80, + "line": 82, "column": 13 } } }, "property": { "type": "Identifier", - "start": 1752, - "end": 1756, + "start": 1797, + "end": 1801, "loc": { "start": { - "line": 80, + "line": 82, "column": 14 }, "end": { - "line": 80, + "line": 82, "column": 18 }, "identifierName": "data" @@ -1922,15 +1922,15 @@ }, "property": { "type": "Identifier", - "start": 1757, - "end": 1766, + "start": 1802, + "end": 1811, "loc": { "start": { - "line": 80, + "line": 82, "column": 19 }, "end": { - "line": 80, + "line": 82, "column": 28 }, "identifierName": "component" @@ -1948,15 +1948,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name, or undefined if it doesn't exist\n\t *\n\t * @example\n\t * let position = entity.get('position')\n\t *\n\t * @param {string} component - The component name to get\n\t *\n\t * @return {Object} The component if defined, otherwise undefined\n\t ", - "start": 1453, - "end": 1719, + "start": 1498, + "end": 1764, "loc": { "start": { - "line": 69, + "line": 71, "column": 1 }, "end": { - "line": 78, + "line": 80, "column": 4 } } @@ -1966,15 +1966,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name (automatically created if it doesn't exist)\n\t *\n\t * @example\n\t * let position = entity.access('position', 3, 4)\n\t *\n\t * @param {string} component - The component name to create/get\n\t * @param {...Object} [args] - The arguments to forward to create the new component, only if it doesn't exist.\n\t *\n\t * @return {Object} Always returns either the existing component, or the newly created one.\n\t ", - "start": 1773, - "end": 2209, + "start": 1818, + "end": 2254, "loc": { "start": { - "line": 83, + "line": 85, "column": 1 }, "end": { - "line": 93, + "line": 95, "column": 4 } } @@ -1983,15 +1983,15 @@ }, { "type": "ClassMethod", - "start": 2211, - "end": 2338, + "start": 2256, + "end": 2383, "loc": { "start": { - "line": 94, + "line": 96, "column": 1 }, "end": { - "line": 99, + "line": 101, "column": 2 } }, @@ -1999,15 +1999,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 2211, - "end": 2217, + "start": 2256, + "end": 2262, "loc": { "start": { - "line": 94, + "line": 96, "column": 1 }, "end": { - "line": 94, + "line": 96, "column": 7 }, "identifierName": "access" @@ -2023,15 +2023,15 @@ "params": [ { "type": "Identifier", - "start": 2218, - "end": 2227, + "start": 2263, + "end": 2272, "loc": { "start": { - "line": 94, + "line": 96, "column": 8 }, "end": { - "line": 94, + "line": 96, "column": 17 }, "identifierName": "component" @@ -2040,29 +2040,29 @@ }, { "type": "RestElement", - "start": 2229, - "end": 2236, + "start": 2274, + "end": 2281, "loc": { "start": { - "line": 94, + "line": 96, "column": 19 }, "end": { - "line": 94, + "line": 96, "column": 26 } }, "argument": { "type": "Identifier", - "start": 2232, - "end": 2236, + "start": 2277, + "end": 2281, "loc": { "start": { - "line": 94, + "line": 96, "column": 22 }, "end": { - "line": 94, + "line": 96, "column": 26 }, "identifierName": "args" @@ -2073,44 +2073,44 @@ ], "body": { "type": "BlockStatement", - "start": 2238, - "end": 2338, + "start": 2283, + "end": 2383, "loc": { "start": { - "line": 94, + "line": 96, "column": 28 }, "end": { - "line": 99, + "line": 101, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 2242, - "end": 2305, + "start": 2287, + "end": 2350, "loc": { "start": { - "line": 95, + "line": 97, "column": 2 }, "end": { - "line": 97, + "line": 99, "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 2246, - "end": 2266, + "start": 2291, + "end": 2311, "loc": { "start": { - "line": 95, + "line": 97, "column": 6 }, "end": { - "line": 95, + "line": 97, "column": 26 } }, @@ -2118,58 +2118,58 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 2247, - "end": 2266, + "start": 2292, + "end": 2311, "loc": { "start": { - "line": 95, + "line": 97, "column": 7 }, "end": { - "line": 95, + "line": 97, "column": 26 } }, "callee": { "type": "MemberExpression", - "start": 2247, - "end": 2255, + "start": 2292, + "end": 2300, "loc": { "start": { - "line": 95, + "line": 97, "column": 7 }, "end": { - "line": 95, + "line": 97, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 2247, - "end": 2251, + "start": 2292, + "end": 2296, "loc": { "start": { - "line": 95, + "line": 97, "column": 7 }, "end": { - "line": 95, + "line": 97, "column": 11 } } }, "property": { "type": "Identifier", - "start": 2252, - "end": 2255, + "start": 2297, + "end": 2300, "loc": { "start": { - "line": 95, + "line": 97, "column": 12 }, "end": { - "line": 95, + "line": 97, "column": 15 }, "identifierName": "has" @@ -2181,15 +2181,15 @@ "arguments": [ { "type": "Identifier", - "start": 2256, - "end": 2265, + "start": 2301, + "end": 2310, "loc": { "start": { - "line": 95, + "line": 97, "column": 16 }, "end": { - "line": 95, + "line": 97, "column": 25 }, "identifierName": "component" @@ -2204,87 +2204,87 @@ }, "consequent": { "type": "BlockStatement", - "start": 2268, - "end": 2305, + "start": 2313, + "end": 2350, "loc": { "start": { - "line": 95, + "line": 97, "column": 28 }, "end": { - "line": 97, + "line": 99, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 2273, - "end": 2301, + "start": 2318, + "end": 2346, "loc": { "start": { - "line": 96, + "line": 98, "column": 3 }, "end": { - "line": 96, + "line": 98, "column": 31 } }, "expression": { "type": "CallExpression", - "start": 2273, - "end": 2301, + "start": 2318, + "end": 2346, "loc": { "start": { - "line": 96, + "line": 98, "column": 3 }, "end": { - "line": 96, + "line": 98, "column": 31 } }, "callee": { "type": "MemberExpression", - "start": 2273, - "end": 2281, + "start": 2318, + "end": 2326, "loc": { "start": { - "line": 96, + "line": 98, "column": 3 }, "end": { - "line": 96, + "line": 98, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 2273, - "end": 2277, + "start": 2318, + "end": 2322, "loc": { "start": { - "line": 96, + "line": 98, "column": 3 }, "end": { - "line": 96, + "line": 98, "column": 7 } } }, "property": { "type": "Identifier", - "start": 2278, - "end": 2281, + "start": 2323, + "end": 2326, "loc": { "start": { - "line": 96, + "line": 98, "column": 8 }, "end": { - "line": 96, + "line": 98, "column": 11 }, "identifierName": "set" @@ -2296,15 +2296,15 @@ "arguments": [ { "type": "Identifier", - "start": 2282, - "end": 2291, + "start": 2327, + "end": 2336, "loc": { "start": { - "line": 96, + "line": 98, "column": 12 }, "end": { - "line": 96, + "line": 98, "column": 21 }, "identifierName": "component" @@ -2313,29 +2313,29 @@ }, { "type": "SpreadElement", - "start": 2293, - "end": 2300, + "start": 2338, + "end": 2345, "loc": { "start": { - "line": 96, + "line": 98, "column": 23 }, "end": { - "line": 96, + "line": 98, "column": 30 } }, "argument": { "type": "Identifier", - "start": 2296, - "end": 2300, + "start": 2341, + "end": 2345, "loc": { "start": { - "line": 96, + "line": 98, "column": 26 }, "end": { - "line": 96, + "line": 98, "column": 30 }, "identifierName": "args" @@ -2353,72 +2353,72 @@ }, { "type": "ReturnStatement", - "start": 2308, - "end": 2335, + "start": 2353, + "end": 2380, "loc": { "start": { - "line": 98, + "line": 100, "column": 2 }, "end": { - "line": 98, + "line": 100, "column": 29 } }, "argument": { "type": "MemberExpression", - "start": 2315, - "end": 2335, + "start": 2360, + "end": 2380, "loc": { "start": { - "line": 98, + "line": 100, "column": 9 }, "end": { - "line": 98, + "line": 100, "column": 29 } }, "object": { "type": "MemberExpression", - "start": 2315, - "end": 2324, + "start": 2360, + "end": 2369, "loc": { "start": { - "line": 98, + "line": 100, "column": 9 }, "end": { - "line": 98, + "line": 100, "column": 18 } }, "object": { "type": "ThisExpression", - "start": 2315, - "end": 2319, + "start": 2360, + "end": 2364, "loc": { "start": { - "line": 98, + "line": 100, "column": 9 }, "end": { - "line": 98, + "line": 100, "column": 13 } } }, "property": { "type": "Identifier", - "start": 2320, - "end": 2324, + "start": 2365, + "end": 2369, "loc": { "start": { - "line": 98, + "line": 100, "column": 14 }, "end": { - "line": 98, + "line": 100, "column": 18 }, "identifierName": "data" @@ -2429,15 +2429,15 @@ }, "property": { "type": "Identifier", - "start": 2325, - "end": 2334, + "start": 2370, + "end": 2379, "loc": { "start": { - "line": 98, + "line": 100, "column": 19 }, "end": { - "line": 98, + "line": 100, "column": 28 }, "identifierName": "component" @@ -2455,15 +2455,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name (automatically created if it doesn't exist)\n\t *\n\t * @example\n\t * let position = entity.access('position', 3, 4)\n\t *\n\t * @param {string} component - The component name to create/get\n\t * @param {...Object} [args] - The arguments to forward to create the new component, only if it doesn't exist.\n\t *\n\t * @return {Object} Always returns either the existing component, or the newly created one.\n\t ", - "start": 1773, - "end": 2209, + "start": 1818, + "end": 2254, "loc": { "start": { - "line": 83, + "line": 85, "column": 1 }, "end": { - "line": 93, + "line": 95, "column": 4 } } @@ -2473,15 +2473,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a new component, or re-creates and overwrites an existing component\n\t *\n\t * @example\n\t * entity.set('position', 1, 2)\n\t *\n\t * @example\n\t * entity.set('anonymousComponent', { keys: 'values' })\n\t *\n\t * @example\n\t * entity.set('anotherAnonymousComponent', 'Any type of any value')\n\t *\n\t * @param {string} component - The component name to create. If there is a registered component for this name, then\n\t * its constructor will be called and an object of that type will be created.\n\t * @param {...Object} [args] - The arguments to forward to the registered component type. If the component type is\n\t * registered, then only the first additional argument will be used as the value of the entire component.\n\t *\n\t * @return {Object} The original entity that set() was called on, so that operations can be chained.\n\t ", - "start": 2341, - "end": 3171, + "start": 2386, + "end": 3216, "loc": { "start": { - "line": 101, + "line": 103, "column": 1 }, "end": { - "line": 119, + "line": 121, "column": 4 } } @@ -2490,15 +2490,15 @@ }, { "type": "ClassMethod", - "start": 3173, - "end": 3721, + "start": 3218, + "end": 3766, "loc": { "start": { - "line": 120, + "line": 122, "column": 1 }, "end": { - "line": 138, + "line": 140, "column": 2 } }, @@ -2506,15 +2506,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 3173, - "end": 3176, + "start": 3218, + "end": 3221, "loc": { "start": { - "line": 120, + "line": 122, "column": 1 }, "end": { - "line": 120, + "line": 122, "column": 4 }, "identifierName": "set" @@ -2530,15 +2530,15 @@ "params": [ { "type": "Identifier", - "start": 3177, - "end": 3186, + "start": 3222, + "end": 3231, "loc": { "start": { - "line": 120, + "line": 122, "column": 5 }, "end": { - "line": 120, + "line": 122, "column": 14 }, "identifierName": "component" @@ -2547,29 +2547,29 @@ }, { "type": "RestElement", - "start": 3188, - "end": 3195, + "start": 3233, + "end": 3240, "loc": { "start": { - "line": 120, + "line": 122, "column": 16 }, "end": { - "line": 120, + "line": 122, "column": 23 } }, "argument": { "type": "Identifier", - "start": 3191, - "end": 3195, + "start": 3236, + "end": 3240, "loc": { "start": { - "line": 120, + "line": 122, "column": 19 }, "end": { - "line": 120, + "line": 122, "column": 23 }, "identifierName": "args" @@ -2580,101 +2580,101 @@ ], "body": { "type": "BlockStatement", - "start": 3197, - "end": 3721, + "start": 3242, + "end": 3766, "loc": { "start": { - "line": 120, + "line": 122, "column": 25 }, "end": { - "line": 138, + "line": 140, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 3201, - "end": 3589, + "start": 3246, + "end": 3634, "loc": { "start": { - "line": 121, + "line": 123, "column": 2 }, "end": { - "line": 130, + "line": 132, "column": 3 } }, "test": { "type": "LogicalExpression", - "start": 3205, - "end": 3255, + "start": 3250, + "end": 3300, "loc": { "start": { - "line": 121, + "line": 123, "column": 6 }, "end": { - "line": 121, + "line": 123, "column": 56 } }, "left": { "type": "CallExpression", - "start": 3205, - "end": 3217, + "start": 3250, + "end": 3262, "loc": { "start": { - "line": 121, + "line": 123, "column": 6 }, "end": { - "line": 121, + "line": 123, "column": 18 } }, "callee": { "type": "MemberExpression", - "start": 3205, - "end": 3215, + "start": 3250, + "end": 3260, "loc": { "start": { - "line": 121, + "line": 123, "column": 6 }, "end": { - "line": 121, + "line": 123, "column": 16 } }, "object": { "type": "ThisExpression", - "start": 3205, - "end": 3209, + "start": 3250, + "end": 3254, "loc": { "start": { - "line": 121, + "line": 123, "column": 6 }, "end": { - "line": 121, + "line": 123, "column": 10 } } }, "property": { "type": "Identifier", - "start": 3210, - "end": 3215, + "start": 3255, + "end": 3260, "loc": { "start": { - "line": 121, + "line": 123, "column": 11 }, "end": { - "line": 121, + "line": 123, "column": 16 }, "identifierName": "valid" @@ -2688,29 +2688,29 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 3221, - "end": 3255, + "start": 3266, + "end": 3300, "loc": { "start": { - "line": 121, + "line": 123, "column": 22 }, "end": { - "line": 121, + "line": 123, "column": 56 } }, "left": { "type": "Identifier", - "start": 3221, - "end": 3230, + "start": 3266, + "end": 3275, "loc": { "start": { - "line": 121, + "line": 123, "column": 22 }, "end": { - "line": 121, + "line": 123, "column": 31 }, "identifierName": "component" @@ -2720,58 +2720,58 @@ "operator": "in", "right": { "type": "MemberExpression", - "start": 3234, - "end": 3255, + "start": 3279, + "end": 3300, "loc": { "start": { - "line": 121, + "line": 123, "column": 35 }, "end": { - "line": 121, + "line": 123, "column": 56 } }, "object": { "type": "MemberExpression", - "start": 3234, - "end": 3244, + "start": 3279, + "end": 3289, "loc": { "start": { - "line": 121, + "line": 123, "column": 35 }, "end": { - "line": 121, + "line": 123, "column": 45 } }, "object": { "type": "ThisExpression", - "start": 3234, - "end": 3238, + "start": 3279, + "end": 3283, "loc": { "start": { - "line": 121, + "line": 123, "column": 35 }, "end": { - "line": 121, + "line": 123, "column": 39 } } }, "property": { "type": "Identifier", - "start": 3239, - "end": 3244, + "start": 3284, + "end": 3289, "loc": { "start": { - "line": 121, + "line": 123, "column": 40 }, "end": { - "line": 121, + "line": 123, "column": 45 }, "identifierName": "world" @@ -2782,15 +2782,15 @@ }, "property": { "type": "Identifier", - "start": 3245, - "end": 3255, + "start": 3290, + "end": 3300, "loc": { "start": { - "line": 121, + "line": 123, "column": 46 }, "end": { - "line": 121, + "line": 123, "column": 56 }, "identifierName": "components" @@ -2803,87 +2803,87 @@ }, "consequent": { "type": "BlockStatement", - "start": 3257, - "end": 3412, + "start": 3302, + "end": 3457, "loc": { "start": { - "line": 121, + "line": 123, "column": 58 }, "end": { - "line": 124, + "line": 126, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 3334, - "end": 3408, + "start": 3379, + "end": 3453, "loc": { "start": { - "line": 123, + "line": 125, "column": 3 }, "end": { - "line": 123, + "line": 125, "column": 77 } }, "expression": { "type": "AssignmentExpression", - "start": 3334, - "end": 3408, + "start": 3379, + "end": 3453, "loc": { "start": { - "line": 123, + "line": 125, "column": 3 }, "end": { - "line": 123, + "line": 125, "column": 77 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 3334, - "end": 3354, + "start": 3379, + "end": 3399, "loc": { "start": { - "line": 123, + "line": 125, "column": 3 }, "end": { - "line": 123, + "line": 125, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 3334, - "end": 3343, + "start": 3379, + "end": 3388, "loc": { "start": { - "line": 123, + "line": 125, "column": 3 }, "end": { - "line": 123, + "line": 125, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 3334, - "end": 3338, + "start": 3379, + "end": 3383, "loc": { "start": { - "line": 123, + "line": 125, "column": 3 }, "end": { - "line": 123, + "line": 125, "column": 7 } }, @@ -2891,15 +2891,15 @@ }, "property": { "type": "Identifier", - "start": 3339, - "end": 3343, + "start": 3384, + "end": 3388, "loc": { "start": { - "line": 123, + "line": 125, "column": 8 }, "end": { - "line": 123, + "line": 125, "column": 12 }, "identifierName": "data" @@ -2911,15 +2911,15 @@ }, "property": { "type": "Identifier", - "start": 3344, - "end": 3353, + "start": 3389, + "end": 3398, "loc": { "start": { - "line": 123, + "line": 125, "column": 13 }, "end": { - "line": 123, + "line": 125, "column": 22 }, "identifierName": "component" @@ -2931,86 +2931,86 @@ }, "right": { "type": "NewExpression", - "start": 3357, - "end": 3408, + "start": 3402, + "end": 3453, "loc": { "start": { - "line": 123, + "line": 125, "column": 26 }, "end": { - "line": 123, + "line": 125, "column": 77 } }, "callee": { "type": "MemberExpression", - "start": 3361, - "end": 3393, + "start": 3406, + "end": 3438, "loc": { "start": { - "line": 123, + "line": 125, "column": 30 }, "end": { - "line": 123, + "line": 125, "column": 62 } }, "object": { "type": "MemberExpression", - "start": 3361, - "end": 3382, + "start": 3406, + "end": 3427, "loc": { "start": { - "line": 123, + "line": 125, "column": 30 }, "end": { - "line": 123, + "line": 125, "column": 51 } }, "object": { "type": "MemberExpression", - "start": 3361, - "end": 3371, + "start": 3406, + "end": 3416, "loc": { "start": { - "line": 123, + "line": 125, "column": 30 }, "end": { - "line": 123, + "line": 125, "column": 40 } }, "object": { "type": "ThisExpression", - "start": 3361, - "end": 3365, + "start": 3406, + "end": 3410, "loc": { "start": { - "line": 123, + "line": 125, "column": 30 }, "end": { - "line": 123, + "line": 125, "column": 34 } } }, "property": { "type": "Identifier", - "start": 3366, - "end": 3371, + "start": 3411, + "end": 3416, "loc": { "start": { - "line": 123, + "line": 125, "column": 35 }, "end": { - "line": 123, + "line": 125, "column": 40 }, "identifierName": "world" @@ -3021,15 +3021,15 @@ }, "property": { "type": "Identifier", - "start": 3372, - "end": 3382, + "start": 3417, + "end": 3427, "loc": { "start": { - "line": 123, + "line": 125, "column": 41 }, "end": { - "line": 123, + "line": 125, "column": 51 }, "identifierName": "components" @@ -3040,15 +3040,15 @@ }, "property": { "type": "Identifier", - "start": 3383, - "end": 3392, + "start": 3428, + "end": 3437, "loc": { "start": { - "line": 123, + "line": 125, "column": 52 }, "end": { - "line": 123, + "line": 125, "column": 61 }, "identifierName": "component" @@ -3060,44 +3060,44 @@ "arguments": [ { "type": "ThisExpression", - "start": 3394, - "end": 3398, + "start": 3439, + "end": 3443, "loc": { "start": { - "line": 123, + "line": 125, "column": 63 }, "end": { - "line": 123, + "line": 125, "column": 67 } } }, { "type": "SpreadElement", - "start": 3400, - "end": 3407, + "start": 3445, + "end": 3452, "loc": { "start": { - "line": 123, + "line": 125, "column": 69 }, "end": { - "line": 123, + "line": 125, "column": 76 } }, "argument": { "type": "Identifier", - "start": 3403, - "end": 3407, + "start": 3448, + "end": 3452, "loc": { "start": { - "line": 123, + "line": 125, "column": 72 }, "end": { - "line": 123, + "line": 125, "column": 76 }, "identifierName": "args" @@ -3113,15 +3113,15 @@ { "type": "CommentLine", "value": " Use defined component template, passing entity as first parameter", - "start": 3262, - "end": 3330, + "start": 3307, + "end": 3375, "loc": { "start": { - "line": 122, + "line": 124, "column": 3 }, "end": { - "line": 122, + "line": 124, "column": 71 } } @@ -3133,57 +3133,57 @@ }, "alternate": { "type": "IfStatement", - "start": 3418, - "end": 3589, + "start": 3463, + "end": 3634, "loc": { "start": { - "line": 124, + "line": 126, "column": 9 }, "end": { - "line": 130, + "line": 132, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 3422, - "end": 3437, + "start": 3467, + "end": 3482, "loc": { "start": { - "line": 124, + "line": 126, "column": 13 }, "end": { - "line": 124, + "line": 126, "column": 28 } }, "left": { "type": "MemberExpression", - "start": 3422, - "end": 3433, + "start": 3467, + "end": 3478, "loc": { "start": { - "line": 124, + "line": 126, "column": 13 }, "end": { - "line": 124, + "line": 126, "column": 24 } }, "object": { "type": "Identifier", - "start": 3422, - "end": 3426, + "start": 3467, + "end": 3471, "loc": { "start": { - "line": 124, + "line": 126, "column": 13 }, "end": { - "line": 124, + "line": 126, "column": 17 }, "identifierName": "args" @@ -3192,15 +3192,15 @@ }, "property": { "type": "Identifier", - "start": 3427, - "end": 3433, + "start": 3472, + "end": 3478, "loc": { "start": { - "line": 124, + "line": 126, "column": 18 }, "end": { - "line": 124, + "line": 126, "column": 24 }, "identifierName": "length" @@ -3212,15 +3212,15 @@ "operator": ">", "right": { "type": "NumericLiteral", - "start": 3436, - "end": 3437, + "start": 3481, + "end": 3482, "loc": { "start": { - "line": 124, + "line": 126, "column": 27 }, "end": { - "line": 124, + "line": 126, "column": 28 } }, @@ -3233,87 +3233,87 @@ }, "consequent": { "type": "BlockStatement", - "start": 3439, - "end": 3522, + "start": 3484, + "end": 3567, "loc": { "start": { - "line": 124, + "line": 126, "column": 30 }, "end": { - "line": 127, + "line": 129, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 3488, - "end": 3518, + "start": 3533, + "end": 3563, "loc": { "start": { - "line": 126, + "line": 128, "column": 3 }, "end": { - "line": 126, + "line": 128, "column": 33 } }, "expression": { "type": "AssignmentExpression", - "start": 3488, - "end": 3518, + "start": 3533, + "end": 3563, "loc": { "start": { - "line": 126, + "line": 128, "column": 3 }, "end": { - "line": 126, + "line": 128, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 3488, - "end": 3508, + "start": 3533, + "end": 3553, "loc": { "start": { - "line": 126, + "line": 128, "column": 3 }, "end": { - "line": 126, + "line": 128, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 3488, - "end": 3497, + "start": 3533, + "end": 3542, "loc": { "start": { - "line": 126, + "line": 128, "column": 3 }, "end": { - "line": 126, + "line": 128, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 3488, - "end": 3492, + "start": 3533, + "end": 3537, "loc": { "start": { - "line": 126, + "line": 128, "column": 3 }, "end": { - "line": 126, + "line": 128, "column": 7 } }, @@ -3321,15 +3321,15 @@ }, "property": { "type": "Identifier", - "start": 3493, - "end": 3497, + "start": 3538, + "end": 3542, "loc": { "start": { - "line": 126, + "line": 128, "column": 8 }, "end": { - "line": 126, + "line": 128, "column": 12 }, "identifierName": "data" @@ -3341,15 +3341,15 @@ }, "property": { "type": "Identifier", - "start": 3498, - "end": 3507, + "start": 3543, + "end": 3552, "loc": { "start": { - "line": 126, + "line": 128, "column": 13 }, "end": { - "line": 126, + "line": 128, "column": 22 }, "identifierName": "component" @@ -3361,29 +3361,29 @@ }, "right": { "type": "MemberExpression", - "start": 3511, - "end": 3518, + "start": 3556, + "end": 3563, "loc": { "start": { - "line": 126, + "line": 128, "column": 26 }, "end": { - "line": 126, + "line": 128, "column": 33 } }, "object": { "type": "Identifier", - "start": 3511, - "end": 3515, + "start": 3556, + "end": 3560, "loc": { "start": { - "line": 126, + "line": 128, "column": 26 }, "end": { - "line": 126, + "line": 128, "column": 30 }, "identifierName": "args" @@ -3392,15 +3392,15 @@ }, "property": { "type": "NumericLiteral", - "start": 3516, - "end": 3517, + "start": 3561, + "end": 3562, "loc": { "start": { - "line": 126, + "line": 128, "column": 31 }, "end": { - "line": 126, + "line": 128, "column": 32 } }, @@ -3418,15 +3418,15 @@ { "type": "CommentLine", "value": " Use first argument as component value", - "start": 3444, - "end": 3484, + "start": 3489, + "end": 3529, "loc": { "start": { - "line": 125, + "line": 127, "column": 3 }, "end": { - "line": 125, + "line": 127, "column": 43 } } @@ -3438,87 +3438,87 @@ }, "alternate": { "type": "BlockStatement", - "start": 3528, - "end": 3589, + "start": 3573, + "end": 3634, "loc": { "start": { - "line": 127, + "line": 129, "column": 9 }, "end": { - "line": 130, + "line": 132, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 3560, - "end": 3585, + "start": 3605, + "end": 3630, "loc": { "start": { - "line": 129, + "line": 131, "column": 3 }, "end": { - "line": 129, + "line": 131, "column": 28 } }, "expression": { "type": "AssignmentExpression", - "start": 3560, - "end": 3585, + "start": 3605, + "end": 3630, "loc": { "start": { - "line": 129, + "line": 131, "column": 3 }, "end": { - "line": 129, + "line": 131, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 3560, - "end": 3580, + "start": 3605, + "end": 3625, "loc": { "start": { - "line": 129, + "line": 131, "column": 3 }, "end": { - "line": 129, + "line": 131, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 3560, - "end": 3569, + "start": 3605, + "end": 3614, "loc": { "start": { - "line": 129, + "line": 131, "column": 3 }, "end": { - "line": 129, + "line": 131, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 3560, - "end": 3564, + "start": 3605, + "end": 3609, "loc": { "start": { - "line": 129, + "line": 131, "column": 3 }, "end": { - "line": 129, + "line": 131, "column": 7 } }, @@ -3526,15 +3526,15 @@ }, "property": { "type": "Identifier", - "start": 3565, - "end": 3569, + "start": 3610, + "end": 3614, "loc": { "start": { - "line": 129, + "line": 131, "column": 8 }, "end": { - "line": 129, + "line": 131, "column": 12 }, "identifierName": "data" @@ -3546,15 +3546,15 @@ }, "property": { "type": "Identifier", - "start": 3570, - "end": 3579, + "start": 3615, + "end": 3624, "loc": { "start": { - "line": 129, + "line": 131, "column": 13 }, "end": { - "line": 129, + "line": 131, "column": 22 }, "identifierName": "component" @@ -3566,15 +3566,15 @@ }, "right": { "type": "ObjectExpression", - "start": 3583, - "end": 3585, + "start": 3628, + "end": 3630, "loc": { "start": { - "line": 129, + "line": 131, "column": 26 }, "end": { - "line": 129, + "line": 131, "column": 28 } }, @@ -3586,15 +3586,15 @@ { "type": "CommentLine", "value": " Make an empty object", - "start": 3533, - "end": 3556, + "start": 3578, + "end": 3601, "loc": { "start": { - "line": 128, + "line": 130, "column": 3 }, "end": { - "line": 128, + "line": 130, "column": 26 } } @@ -3611,15 +3611,15 @@ { "type": "CommentLine", "value": " Update the index with this new component", - "start": 3593, - "end": 3636, + "start": 3638, + "end": 3681, "loc": { "start": { - "line": 132, + "line": 134, "column": 2 }, "end": { - "line": 132, + "line": 134, "column": 45 } } @@ -3628,57 +3628,57 @@ }, { "type": "IfStatement", - "start": 3639, - "end": 3703, + "start": 3684, + "end": 3748, "loc": { "start": { - "line": 133, + "line": 135, "column": 2 }, "end": { - "line": 135, + "line": 137, "column": 3 } }, "test": { "type": "CallExpression", - "start": 3643, - "end": 3655, + "start": 3688, + "end": 3700, "loc": { "start": { - "line": 133, + "line": 135, "column": 6 }, "end": { - "line": 133, + "line": 135, "column": 18 } }, "callee": { "type": "MemberExpression", - "start": 3643, - "end": 3653, + "start": 3688, + "end": 3698, "loc": { "start": { - "line": 133, + "line": 135, "column": 6 }, "end": { - "line": 133, + "line": 135, "column": 16 } }, "object": { "type": "ThisExpression", - "start": 3643, - "end": 3647, + "start": 3688, + "end": 3692, "loc": { "start": { - "line": 133, + "line": 135, "column": 6 }, "end": { - "line": 133, + "line": 135, "column": 10 } }, @@ -3686,15 +3686,15 @@ }, "property": { "type": "Identifier", - "start": 3648, - "end": 3653, + "start": 3693, + "end": 3698, "loc": { "start": { - "line": 133, + "line": 135, "column": 11 }, "end": { - "line": 133, + "line": 135, "column": 16 }, "identifierName": "valid" @@ -3709,115 +3709,115 @@ }, "consequent": { "type": "BlockStatement", - "start": 3657, - "end": 3703, + "start": 3702, + "end": 3748, "loc": { "start": { - "line": 133, + "line": 135, "column": 20 }, "end": { - "line": 135, + "line": 137, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 3662, - "end": 3699, + "start": 3707, + "end": 3744, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 40 } }, "expression": { "type": "CallExpression", - "start": 3662, - "end": 3699, + "start": 3707, + "end": 3744, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 40 } }, "callee": { "type": "MemberExpression", - "start": 3662, - "end": 3682, + "start": 3707, + "end": 3727, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 3662, - "end": 3678, + "start": 3707, + "end": 3723, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 19 } }, "object": { "type": "MemberExpression", - "start": 3662, - "end": 3672, + "start": 3707, + "end": 3717, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 3662, - "end": 3666, + "start": 3707, + "end": 3711, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 7 } } }, "property": { "type": "Identifier", - "start": 3667, - "end": 3672, + "start": 3712, + "end": 3717, "loc": { "start": { - "line": 134, + "line": 136, "column": 8 }, "end": { - "line": 134, + "line": 136, "column": 13 }, "identifierName": "world" @@ -3828,15 +3828,15 @@ }, "property": { "type": "Identifier", - "start": 3673, - "end": 3678, + "start": 3718, + "end": 3723, "loc": { "start": { - "line": 134, + "line": 136, "column": 14 }, "end": { - "line": 134, + "line": 136, "column": 19 }, "identifierName": "index" @@ -3847,15 +3847,15 @@ }, "property": { "type": "Identifier", - "start": 3679, - "end": 3682, + "start": 3724, + "end": 3727, "loc": { "start": { - "line": 134, + "line": 136, "column": 20 }, "end": { - "line": 134, + "line": 136, "column": 23 }, "identifierName": "add" @@ -3867,30 +3867,30 @@ "arguments": [ { "type": "ThisExpression", - "start": 3683, - "end": 3687, + "start": 3728, + "end": 3732, "loc": { "start": { - "line": 134, + "line": 136, "column": 24 }, "end": { - "line": 134, + "line": 136, "column": 28 } } }, { "type": "Identifier", - "start": 3689, - "end": 3698, + "start": 3734, + "end": 3743, "loc": { "start": { - "line": 134, + "line": 136, "column": 30 }, "end": { - "line": 134, + "line": 136, "column": 39 }, "identifierName": "component" @@ -3908,15 +3908,15 @@ { "type": "CommentLine", "value": " Update the index with this new component", - "start": 3593, - "end": 3636, + "start": 3638, + "end": 3681, "loc": { "start": { - "line": 132, + "line": 134, "column": 2 }, "end": { - "line": 132, + "line": 134, "column": 45 } } @@ -3925,29 +3925,29 @@ }, { "type": "ReturnStatement", - "start": 3707, - "end": 3718, + "start": 3752, + "end": 3763, "loc": { "start": { - "line": 137, + "line": 139, "column": 2 }, "end": { - "line": 137, + "line": 139, "column": 13 } }, "argument": { "type": "ThisExpression", - "start": 3714, - "end": 3718, + "start": 3759, + "end": 3763, "loc": { "start": { - "line": 137, + "line": 139, "column": 9 }, "end": { - "line": 137, + "line": 139, "column": 13 } } @@ -3961,15 +3961,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a new component, or re-creates and overwrites an existing component\n\t *\n\t * @example\n\t * entity.set('position', 1, 2)\n\t *\n\t * @example\n\t * entity.set('anonymousComponent', { keys: 'values' })\n\t *\n\t * @example\n\t * entity.set('anotherAnonymousComponent', 'Any type of any value')\n\t *\n\t * @param {string} component - The component name to create. If there is a registered component for this name, then\n\t * its constructor will be called and an object of that type will be created.\n\t * @param {...Object} [args] - The arguments to forward to the registered component type. If the component type is\n\t * registered, then only the first additional argument will be used as the value of the entire component.\n\t *\n\t * @return {Object} The original entity that set() was called on, so that operations can be chained.\n\t ", - "start": 2341, - "end": 3171, + "start": 2386, + "end": 3216, "loc": { "start": { - "line": 101, + "line": 103, "column": 1 }, "end": { - "line": 119, + "line": 121, "column": 4 } } @@ -3979,15 +3979,15 @@ { "type": "CommentBlock", "value": "*\n\t * Updates component data from an object or other component. Similar to access() with a shallow merge applied after.\n\t *\n\t * @example\n\t * entity.update('position', { x: 1, y: 2 })\n\t *\n\t * @param {string} component - The component name to update\n\t * @param {Object} data - The object or other component to merge into the specified component.\n\t *\n\t * @return {Object} The original entity that update() was called on, so that operations can be chained.\n\t ", - "start": 3724, - "end": 4188, + "start": 3769, + "end": 4233, "loc": { "start": { - "line": 140, + "line": 142, "column": 1 }, "end": { - "line": 150, + "line": 152, "column": 4 } } @@ -3996,15 +3996,15 @@ }, { "type": "ClassMethod", - "start": 4190, - "end": 4364, + "start": 4235, + "end": 4409, "loc": { "start": { - "line": 151, + "line": 153, "column": 1 }, "end": { - "line": 160, + "line": 162, "column": 2 } }, @@ -4012,15 +4012,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 4190, - "end": 4196, + "start": 4235, + "end": 4241, "loc": { "start": { - "line": 151, + "line": 153, "column": 1 }, "end": { - "line": 151, + "line": 153, "column": 7 }, "identifierName": "update" @@ -4036,15 +4036,15 @@ "params": [ { "type": "Identifier", - "start": 4197, - "end": 4206, + "start": 4242, + "end": 4251, "loc": { "start": { - "line": 151, + "line": 153, "column": 8 }, "end": { - "line": 151, + "line": 153, "column": 17 }, "identifierName": "component" @@ -4053,15 +4053,15 @@ }, { "type": "Identifier", - "start": 4208, - "end": 4212, + "start": 4253, + "end": 4257, "loc": { "start": { - "line": 151, + "line": 153, "column": 19 }, "end": { - "line": 151, + "line": 153, "column": 23 }, "identifierName": "data" @@ -4071,59 +4071,59 @@ ], "body": { "type": "BlockStatement", - "start": 4214, - "end": 4364, + "start": 4259, + "end": 4409, "loc": { "start": { - "line": 151, + "line": 153, "column": 25 }, "end": { - "line": 160, + "line": 162, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 4218, - "end": 4251, + "start": 4263, + "end": 4296, "loc": { "start": { - "line": 152, + "line": 154, "column": 2 }, "end": { - "line": 152, + "line": 154, "column": 35 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4222, - "end": 4251, + "start": 4267, + "end": 4296, "loc": { "start": { - "line": 152, + "line": 154, "column": 6 }, "end": { - "line": 152, + "line": 154, "column": 35 } }, "id": { "type": "Identifier", - "start": 4222, - "end": 4226, + "start": 4267, + "end": 4271, "loc": { "start": { - "line": 152, + "line": 154, "column": 6 }, "end": { - "line": 152, + "line": 154, "column": 10 }, "identifierName": "comp" @@ -4132,58 +4132,58 @@ }, "init": { "type": "CallExpression", - "start": 4229, - "end": 4251, + "start": 4274, + "end": 4296, "loc": { "start": { - "line": 152, + "line": 154, "column": 13 }, "end": { - "line": 152, + "line": 154, "column": 35 } }, "callee": { "type": "MemberExpression", - "start": 4229, - "end": 4240, + "start": 4274, + "end": 4285, "loc": { "start": { - "line": 152, + "line": 154, "column": 13 }, "end": { - "line": 152, + "line": 154, "column": 24 } }, "object": { "type": "ThisExpression", - "start": 4229, - "end": 4233, + "start": 4274, + "end": 4278, "loc": { "start": { - "line": 152, + "line": 154, "column": 13 }, "end": { - "line": 152, + "line": 154, "column": 17 } } }, "property": { "type": "Identifier", - "start": 4234, - "end": 4240, + "start": 4279, + "end": 4285, "loc": { "start": { - "line": 152, + "line": 154, "column": 18 }, "end": { - "line": 152, + "line": 154, "column": 24 }, "identifierName": "access" @@ -4195,15 +4195,15 @@ "arguments": [ { "type": "Identifier", - "start": 4241, - "end": 4250, + "start": 4286, + "end": 4295, "loc": { "start": { - "line": 152, + "line": 154, "column": 25 }, "end": { - "line": 152, + "line": 154, "column": 34 }, "identifierName": "component" @@ -4221,15 +4221,15 @@ { "type": "CommentLine", "value": " Shallow set keys of the component", - "start": 4255, - "end": 4291, + "start": 4300, + "end": 4336, "loc": { "start": { - "line": 154, + "line": 156, "column": 2 }, "end": { - "line": 154, + "line": 156, "column": 38 } } @@ -4238,58 +4238,58 @@ }, { "type": "ForInStatement", - "start": 4294, - "end": 4346, + "start": 4339, + "end": 4391, "loc": { "start": { - "line": 155, + "line": 157, "column": 2 }, "end": { - "line": 157, + "line": 159, "column": 3 } }, "left": { "type": "VariableDeclaration", - "start": 4299, - "end": 4306, + "start": 4344, + "end": 4351, "loc": { "start": { - "line": 155, + "line": 157, "column": 7 }, "end": { - "line": 155, + "line": 157, "column": 14 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4303, - "end": 4306, + "start": 4348, + "end": 4351, "loc": { "start": { - "line": 155, + "line": 157, "column": 11 }, "end": { - "line": 155, + "line": 157, "column": 14 } }, "id": { "type": "Identifier", - "start": 4303, - "end": 4306, + "start": 4348, + "end": 4351, "loc": { "start": { - "line": 155, + "line": 157, "column": 11 }, "end": { - "line": 155, + "line": 157, "column": 14 }, "identifierName": "key" @@ -4306,15 +4306,15 @@ }, "right": { "type": "Identifier", - "start": 4310, - "end": 4314, + "start": 4355, + "end": 4359, "loc": { "start": { - "line": 155, + "line": 157, "column": 18 }, "end": { - "line": 155, + "line": 157, "column": 22 }, "identifierName": "data" @@ -4323,73 +4323,73 @@ }, "body": { "type": "BlockStatement", - "start": 4316, - "end": 4346, + "start": 4361, + "end": 4391, "loc": { "start": { - "line": 155, + "line": 157, "column": 24 }, "end": { - "line": 157, + "line": 159, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 4321, - "end": 4342, + "start": 4366, + "end": 4387, "loc": { "start": { - "line": 156, + "line": 158, "column": 3 }, "end": { - "line": 156, + "line": 158, "column": 24 } }, "expression": { "type": "AssignmentExpression", - "start": 4321, - "end": 4342, + "start": 4366, + "end": 4387, "loc": { "start": { - "line": 156, + "line": 158, "column": 3 }, "end": { - "line": 156, + "line": 158, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 4321, - "end": 4330, + "start": 4366, + "end": 4375, "loc": { "start": { - "line": 156, + "line": 158, "column": 3 }, "end": { - "line": 156, + "line": 158, "column": 12 } }, "object": { "type": "Identifier", - "start": 4321, - "end": 4325, + "start": 4366, + "end": 4370, "loc": { "start": { - "line": 156, + "line": 158, "column": 3 }, "end": { - "line": 156, + "line": 158, "column": 7 }, "identifierName": "comp" @@ -4398,15 +4398,15 @@ }, "property": { "type": "Identifier", - "start": 4326, - "end": 4329, + "start": 4371, + "end": 4374, "loc": { "start": { - "line": 156, + "line": 158, "column": 8 }, "end": { - "line": 156, + "line": 158, "column": 11 }, "identifierName": "key" @@ -4417,29 +4417,29 @@ }, "right": { "type": "MemberExpression", - "start": 4333, - "end": 4342, + "start": 4378, + "end": 4387, "loc": { "start": { - "line": 156, + "line": 158, "column": 15 }, "end": { - "line": 156, + "line": 158, "column": 24 } }, "object": { "type": "Identifier", - "start": 4333, - "end": 4337, + "start": 4378, + "end": 4382, "loc": { "start": { - "line": 156, + "line": 158, "column": 15 }, "end": { - "line": 156, + "line": 158, "column": 19 }, "identifierName": "data" @@ -4448,15 +4448,15 @@ }, "property": { "type": "Identifier", - "start": 4338, - "end": 4341, + "start": 4383, + "end": 4386, "loc": { "start": { - "line": 156, + "line": 158, "column": 20 }, "end": { - "line": 156, + "line": 158, "column": 23 }, "identifierName": "key" @@ -4474,15 +4474,15 @@ { "type": "CommentLine", "value": " Shallow set keys of the component", - "start": 4255, - "end": 4291, + "start": 4300, + "end": 4336, "loc": { "start": { - "line": 154, + "line": 156, "column": 2 }, "end": { - "line": 154, + "line": 156, "column": 38 } } @@ -4491,29 +4491,29 @@ }, { "type": "ReturnStatement", - "start": 4350, - "end": 4361, + "start": 4395, + "end": 4406, "loc": { "start": { - "line": 159, + "line": 161, "column": 2 }, "end": { - "line": 159, + "line": 161, "column": 13 } }, "argument": { "type": "ThisExpression", - "start": 4357, - "end": 4361, + "start": 4402, + "end": 4406, "loc": { "start": { - "line": 159, + "line": 161, "column": 9 }, "end": { - "line": 159, + "line": 161, "column": 13 } } @@ -4527,15 +4527,15 @@ { "type": "CommentBlock", "value": "*\n\t * Updates component data from an object or other component. Similar to access() with a shallow merge applied after.\n\t *\n\t * @example\n\t * entity.update('position', { x: 1, y: 2 })\n\t *\n\t * @param {string} component - The component name to update\n\t * @param {Object} data - The object or other component to merge into the specified component.\n\t *\n\t * @return {Object} The original entity that update() was called on, so that operations can be chained.\n\t ", - "start": 3724, - "end": 4188, + "start": 3769, + "end": 4233, "loc": { "start": { - "line": 140, + "line": 142, "column": 1 }, "end": { - "line": 150, + "line": 152, "column": 4 } } @@ -4545,15 +4545,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes a component from the entity - has no effect when it doesn't exist.\n\t * Can specify an onRemove() method in your component which gets called before it is removed.\n\t * If nothing is specified, then nothing will be removed. Use removeAll() to remove all components.\n\t *\n\t * @example\n\t * entity.remove('position')\n\t *\n\t * @param {...string} [components] - The component names to remove from the entity.\n\t *\n\t * @return {Object} The original entity that remove() was called on, so that operations can be chained.\n\t ", - "start": 4367, - "end": 4895, + "start": 4412, + "end": 4940, "loc": { "start": { - "line": 162, + "line": 164, "column": 1 }, "end": { - "line": 173, + "line": 175, "column": 4 } } @@ -4562,15 +4562,15 @@ }, { "type": "ClassMethod", - "start": 4897, - "end": 5226, + "start": 4942, + "end": 5271, "loc": { "start": { - "line": 174, + "line": 176, "column": 1 }, "end": { - "line": 190, + "line": 192, "column": 2 } }, @@ -4578,15 +4578,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 4897, - "end": 4903, + "start": 4942, + "end": 4948, "loc": { "start": { - "line": 174, + "line": 176, "column": 1 }, "end": { - "line": 174, + "line": 176, "column": 7 }, "identifierName": "remove" @@ -4602,29 +4602,29 @@ "params": [ { "type": "RestElement", - "start": 4904, - "end": 4917, + "start": 4949, + "end": 4962, "loc": { "start": { - "line": 174, + "line": 176, "column": 8 }, "end": { - "line": 174, + "line": 176, "column": 21 } }, "argument": { "type": "Identifier", - "start": 4907, - "end": 4917, + "start": 4952, + "end": 4962, "loc": { "start": { - "line": 174, + "line": 176, "column": 11 }, "end": { - "line": 174, + "line": 176, "column": 21 }, "identifierName": "components" @@ -4635,73 +4635,73 @@ ], "body": { "type": "BlockStatement", - "start": 4919, - "end": 5226, + "start": 4964, + "end": 5271, "loc": { "start": { - "line": 174, + "line": 176, "column": 23 }, "end": { - "line": 190, + "line": 192, "column": 2 } }, "body": [ { "type": "ForOfStatement", - "start": 4923, - "end": 5209, + "start": 4968, + "end": 5254, "loc": { "start": { - "line": 175, + "line": 177, "column": 2 }, "end": { - "line": 188, + "line": 190, "column": 3 } }, "left": { "type": "VariableDeclaration", - "start": 4928, - "end": 4941, + "start": 4973, + "end": 4986, "loc": { "start": { - "line": 175, + "line": 177, "column": 7 }, "end": { - "line": 175, + "line": 177, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4932, - "end": 4941, + "start": 4977, + "end": 4986, "loc": { "start": { - "line": 175, + "line": 177, "column": 11 }, "end": { - "line": 175, + "line": 177, "column": 20 } }, "id": { "type": "Identifier", - "start": 4932, - "end": 4941, + "start": 4977, + "end": 4986, "loc": { "start": { - "line": 175, + "line": 177, "column": 11 }, "end": { - "line": 175, + "line": 177, "column": 20 }, "identifierName": "component" @@ -4715,15 +4715,15 @@ }, "right": { "type": "Identifier", - "start": 4945, - "end": 4955, + "start": 4990, + "end": 5000, "loc": { "start": { - "line": 175, + "line": 177, "column": 24 }, "end": { - "line": 175, + "line": 177, "column": 34 }, "identifierName": "components" @@ -4732,58 +4732,58 @@ }, "body": { "type": "BlockStatement", - "start": 4957, - "end": 5209, + "start": 5002, + "end": 5254, "loc": { "start": { - "line": 175, + "line": 177, "column": 36 }, "end": { - "line": 188, + "line": 190, "column": 3 } }, "body": [ { "type": "IfStatement", - "start": 4962, - "end": 5205, + "start": 5007, + "end": 5250, "loc": { "start": { - "line": 176, + "line": 178, "column": 3 }, "end": { - "line": 187, + "line": 189, "column": 4 } }, "test": { "type": "BinaryExpression", - "start": 4966, - "end": 4988, + "start": 5011, + "end": 5033, "loc": { "start": { - "line": 176, + "line": 178, "column": 7 }, "end": { - "line": 176, + "line": 178, "column": 29 } }, "left": { "type": "Identifier", - "start": 4966, - "end": 4975, + "start": 5011, + "end": 5020, "loc": { "start": { - "line": 176, + "line": 178, "column": 7 }, "end": { - "line": 176, + "line": 178, "column": 16 }, "identifierName": "component" @@ -4793,44 +4793,44 @@ "operator": "in", "right": { "type": "MemberExpression", - "start": 4979, - "end": 4988, + "start": 5024, + "end": 5033, "loc": { "start": { - "line": 176, + "line": 178, "column": 20 }, "end": { - "line": 176, + "line": 178, "column": 29 } }, "object": { "type": "ThisExpression", - "start": 4979, - "end": 4983, + "start": 5024, + "end": 5028, "loc": { "start": { - "line": 176, + "line": 178, "column": 20 }, "end": { - "line": 176, + "line": 178, "column": 24 } } }, "property": { "type": "Identifier", - "start": 4984, - "end": 4988, + "start": 5029, + "end": 5033, "loc": { "start": { - "line": 176, + "line": 178, "column": 25 }, "end": { - "line": 176, + "line": 178, "column": 29 }, "identifierName": "data" @@ -4842,72 +4842,72 @@ }, "consequent": { "type": "BlockStatement", - "start": 4990, - "end": 5205, + "start": 5035, + "end": 5250, "loc": { "start": { - "line": 176, + "line": 178, "column": 31 }, "end": { - "line": 187, + "line": 189, "column": 4 } }, "body": [ { "type": "IfStatement", - "start": 5022, - "end": 5093, + "start": 5067, + "end": 5138, "loc": { "start": { - "line": 179, + "line": 181, "column": 4 }, "end": { - "line": 181, + "line": 183, "column": 5 } }, "test": { "type": "CallExpression", - "start": 5026, - "end": 5038, + "start": 5071, + "end": 5083, "loc": { "start": { - "line": 179, + "line": 181, "column": 8 }, "end": { - "line": 179, + "line": 181, "column": 20 } }, "callee": { "type": "MemberExpression", - "start": 5026, - "end": 5036, + "start": 5071, + "end": 5081, "loc": { "start": { - "line": 179, + "line": 181, "column": 8 }, "end": { - "line": 179, + "line": 181, "column": 18 } }, "object": { "type": "ThisExpression", - "start": 5026, - "end": 5030, + "start": 5071, + "end": 5075, "loc": { "start": { - "line": 179, + "line": 181, "column": 8 }, "end": { - "line": 179, + "line": 181, "column": 12 } }, @@ -4915,15 +4915,15 @@ }, "property": { "type": "Identifier", - "start": 5031, - "end": 5036, + "start": 5076, + "end": 5081, "loc": { "start": { - "line": 179, + "line": 181, "column": 13 }, "end": { - "line": 179, + "line": 181, "column": 18 }, "identifierName": "valid" @@ -4938,115 +4938,115 @@ }, "consequent": { "type": "BlockStatement", - "start": 5040, - "end": 5093, + "start": 5085, + "end": 5138, "loc": { "start": { - "line": 179, + "line": 181, "column": 22 }, "end": { - "line": 181, + "line": 183, "column": 5 } }, "body": [ { "type": "ExpressionStatement", - "start": 5047, - "end": 5087, + "start": 5092, + "end": 5132, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 45 } }, "expression": { "type": "CallExpression", - "start": 5047, - "end": 5087, + "start": 5092, + "end": 5132, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 45 } }, "callee": { "type": "MemberExpression", - "start": 5047, - "end": 5070, + "start": 5092, + "end": 5115, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 28 } }, "object": { "type": "MemberExpression", - "start": 5047, - "end": 5063, + "start": 5092, + "end": 5108, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 5047, - "end": 5057, + "start": 5092, + "end": 5102, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 5047, - "end": 5051, + "start": 5092, + "end": 5096, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 9 } } }, "property": { "type": "Identifier", - "start": 5052, - "end": 5057, + "start": 5097, + "end": 5102, "loc": { "start": { - "line": 180, + "line": 182, "column": 10 }, "end": { - "line": 180, + "line": 182, "column": 15 }, "identifierName": "world" @@ -5057,15 +5057,15 @@ }, "property": { "type": "Identifier", - "start": 5058, - "end": 5063, + "start": 5103, + "end": 5108, "loc": { "start": { - "line": 180, + "line": 182, "column": 16 }, "end": { - "line": 180, + "line": 182, "column": 21 }, "identifierName": "index" @@ -5076,15 +5076,15 @@ }, "property": { "type": "Identifier", - "start": 5064, - "end": 5070, + "start": 5109, + "end": 5115, "loc": { "start": { - "line": 180, + "line": 182, "column": 22 }, "end": { - "line": 180, + "line": 182, "column": 28 }, "identifierName": "remove" @@ -5096,30 +5096,30 @@ "arguments": [ { "type": "ThisExpression", - "start": 5071, - "end": 5075, + "start": 5116, + "end": 5120, "loc": { "start": { - "line": 180, + "line": 182, "column": 29 }, "end": { - "line": 180, + "line": 182, "column": 33 } } }, { "type": "Identifier", - "start": 5077, - "end": 5086, + "start": 5122, + "end": 5131, "loc": { "start": { - "line": 180, + "line": 182, "column": 35 }, "end": { - "line": 180, + "line": 182, "column": 44 }, "identifierName": "component" @@ -5138,15 +5138,15 @@ { "type": "CommentLine", "value": " Remove from index", - "start": 4997, - "end": 5017, + "start": 5042, + "end": 5062, "loc": { "start": { - "line": 178, + "line": 180, "column": 4 }, "end": { - "line": 178, + "line": 180, "column": 24 } } @@ -5156,15 +5156,15 @@ { "type": "CommentLine", "value": " Call custom onRemove", - "start": 5099, - "end": 5122, + "start": 5144, + "end": 5167, "loc": { "start": { - "line": 183, + "line": 185, "column": 4 }, "end": { - "line": 183, + "line": 185, "column": 27 } } @@ -5173,43 +5173,43 @@ }, { "type": "ExpressionStatement", - "start": 5127, - "end": 5167, + "start": 5172, + "end": 5212, "loc": { "start": { - "line": 184, + "line": 186, "column": 4 }, "end": { - "line": 184, + "line": 186, "column": 44 } }, "expression": { "type": "CallExpression", - "start": 5127, - "end": 5167, + "start": 5172, + "end": 5212, "loc": { "start": { - "line": 184, + "line": 186, "column": 4 }, "end": { - "line": 184, + "line": 186, "column": 44 } }, "callee": { "type": "Identifier", - "start": 5127, - "end": 5133, + "start": 5172, + "end": 5178, "loc": { "start": { - "line": 184, + "line": 186, "column": 4 }, "end": { - "line": 184, + "line": 186, "column": 10 }, "identifierName": "invoke" @@ -5220,58 +5220,58 @@ "arguments": [ { "type": "MemberExpression", - "start": 5134, - "end": 5154, + "start": 5179, + "end": 5199, "loc": { "start": { - "line": 184, + "line": 186, "column": 11 }, "end": { - "line": 184, + "line": 186, "column": 31 } }, "object": { "type": "MemberExpression", - "start": 5134, - "end": 5143, + "start": 5179, + "end": 5188, "loc": { "start": { - "line": 184, + "line": 186, "column": 11 }, "end": { - "line": 184, + "line": 186, "column": 20 } }, "object": { "type": "ThisExpression", - "start": 5134, - "end": 5138, + "start": 5179, + "end": 5183, "loc": { "start": { - "line": 184, + "line": 186, "column": 11 }, "end": { - "line": 184, + "line": 186, "column": 15 } } }, "property": { "type": "Identifier", - "start": 5139, - "end": 5143, + "start": 5184, + "end": 5188, "loc": { "start": { - "line": 184, + "line": 186, "column": 16 }, "end": { - "line": 184, + "line": 186, "column": 20 }, "identifierName": "data" @@ -5282,15 +5282,15 @@ }, "property": { "type": "Identifier", - "start": 5144, - "end": 5153, + "start": 5189, + "end": 5198, "loc": { "start": { - "line": 184, + "line": 186, "column": 21 }, "end": { - "line": 184, + "line": 186, "column": 30 }, "identifierName": "component" @@ -5301,15 +5301,15 @@ }, { "type": "StringLiteral", - "start": 5156, - "end": 5166, + "start": 5201, + "end": 5211, "loc": { "start": { - "line": 184, + "line": 186, "column": 33 }, "end": { - "line": 184, + "line": 186, "column": 43 } }, @@ -5326,15 +5326,15 @@ { "type": "CommentLine", "value": " Call custom onRemove", - "start": 5099, - "end": 5122, + "start": 5144, + "end": 5167, "loc": { "start": { - "line": 183, + "line": 185, "column": 4 }, "end": { - "line": 183, + "line": 185, "column": 27 } } @@ -5343,29 +5343,29 @@ }, { "type": "ExpressionStatement", - "start": 5173, - "end": 5200, + "start": 5218, + "end": 5245, "loc": { "start": { - "line": 186, + "line": 188, "column": 4 }, "end": { - "line": 186, + "line": 188, "column": 31 } }, "expression": { "type": "UnaryExpression", - "start": 5173, - "end": 5200, + "start": 5218, + "end": 5245, "loc": { "start": { - "line": 186, + "line": 188, "column": 4 }, "end": { - "line": 186, + "line": 188, "column": 31 } }, @@ -5373,58 +5373,58 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 5180, - "end": 5200, + "start": 5225, + "end": 5245, "loc": { "start": { - "line": 186, + "line": 188, "column": 11 }, "end": { - "line": 186, + "line": 188, "column": 31 } }, "object": { "type": "MemberExpression", - "start": 5180, - "end": 5189, + "start": 5225, + "end": 5234, "loc": { "start": { - "line": 186, + "line": 188, "column": 11 }, "end": { - "line": 186, + "line": 188, "column": 20 } }, "object": { "type": "ThisExpression", - "start": 5180, - "end": 5184, + "start": 5225, + "end": 5229, "loc": { "start": { - "line": 186, + "line": 188, "column": 11 }, "end": { - "line": 186, + "line": 188, "column": 15 } } }, "property": { "type": "Identifier", - "start": 5185, - "end": 5189, + "start": 5230, + "end": 5234, "loc": { "start": { - "line": 186, + "line": 188, "column": 16 }, "end": { - "line": 186, + "line": 188, "column": 20 }, "identifierName": "data" @@ -5435,15 +5435,15 @@ }, "property": { "type": "Identifier", - "start": 5190, - "end": 5199, + "start": 5235, + "end": 5244, "loc": { "start": { - "line": 186, + "line": 188, "column": 21 }, "end": { - "line": 186, + "line": 188, "column": 30 }, "identifierName": "component" @@ -5468,29 +5468,29 @@ }, { "type": "ReturnStatement", - "start": 5212, - "end": 5223, + "start": 5257, + "end": 5268, "loc": { "start": { - "line": 189, + "line": 191, "column": 2 }, "end": { - "line": 189, + "line": 191, "column": 13 } }, "argument": { "type": "ThisExpression", - "start": 5219, - "end": 5223, + "start": 5264, + "end": 5268, "loc": { "start": { - "line": 189, + "line": 191, "column": 9 }, "end": { - "line": 189, + "line": 191, "column": 13 } } @@ -5504,15 +5504,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes a component from the entity - has no effect when it doesn't exist.\n\t * Can specify an onRemove() method in your component which gets called before it is removed.\n\t * If nothing is specified, then nothing will be removed. Use removeAll() to remove all components.\n\t *\n\t * @example\n\t * entity.remove('position')\n\t *\n\t * @param {...string} [components] - The component names to remove from the entity.\n\t *\n\t * @return {Object} The original entity that remove() was called on, so that operations can be chained.\n\t ", - "start": 4367, - "end": 4895, + "start": 4412, + "end": 4940, "loc": { "start": { - "line": 162, + "line": 164, "column": 1 }, "end": { - "line": 173, + "line": 175, "column": 4 } } @@ -5522,15 +5522,15 @@ { "type": "CommentLine", "value": " Remove all components", - "start": 5229, - "end": 5253, + "start": 5274, + "end": 5298, "loc": { "start": { - "line": 192, + "line": 194, "column": 1 }, "end": { - "line": 192, + "line": 194, "column": 25 } } @@ -5538,15 +5538,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes all components from the entity.\n\t *\n\t * @example\n\t * entity.removeAll()\n\t *\n\t * @return {Object} The original entity that removeAll() was called on, so that operations can be chained.\n\t ", - "start": 5256, - "end": 5460, + "start": 5301, + "end": 5505, "loc": { "start": { - "line": 194, + "line": 196, "column": 1 }, "end": { - "line": 201, + "line": 203, "column": 4 } } @@ -5555,15 +5555,15 @@ }, { "type": "ClassMethod", - "start": 5462, - "end": 5550, + "start": 5507, + "end": 5595, "loc": { "start": { - "line": 202, + "line": 204, "column": 1 }, "end": { - "line": 206, + "line": 208, "column": 2 } }, @@ -5571,15 +5571,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 5462, - "end": 5471, + "start": 5507, + "end": 5516, "loc": { "start": { - "line": 202, + "line": 204, "column": 1 }, "end": { - "line": 202, + "line": 204, "column": 10 }, "identifierName": "removeAll" @@ -5595,87 +5595,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5474, - "end": 5550, + "start": 5519, + "end": 5595, "loc": { "start": { - "line": 202, + "line": 204, "column": 13 }, "end": { - "line": 206, + "line": 208, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 5478, - "end": 5516, + "start": 5523, + "end": 5561, "loc": { "start": { - "line": 203, + "line": 205, "column": 2 }, "end": { - "line": 203, + "line": 205, "column": 40 } }, "expression": { "type": "CallExpression", - "start": 5478, - "end": 5516, + "start": 5523, + "end": 5561, "loc": { "start": { - "line": 203, + "line": 205, "column": 2 }, "end": { - "line": 203, + "line": 205, "column": 40 } }, "callee": { "type": "MemberExpression", - "start": 5478, - "end": 5489, + "start": 5523, + "end": 5534, "loc": { "start": { - "line": 203, + "line": 205, "column": 2 }, "end": { - "line": 203, + "line": 205, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 5478, - "end": 5482, + "start": 5523, + "end": 5527, "loc": { "start": { - "line": 203, + "line": 205, "column": 2 }, "end": { - "line": 203, + "line": 205, "column": 6 } } }, "property": { "type": "Identifier", - "start": 5483, - "end": 5489, + "start": 5528, + "end": 5534, "loc": { "start": { - "line": 203, + "line": 205, "column": 7 }, "end": { - "line": 203, + "line": 205, "column": 13 }, "identifierName": "remove" @@ -5687,57 +5687,57 @@ "arguments": [ { "type": "SpreadElement", - "start": 5490, - "end": 5515, + "start": 5535, + "end": 5560, "loc": { "start": { - "line": 203, + "line": 205, "column": 14 }, "end": { - "line": 203, + "line": 205, "column": 39 } }, "argument": { "type": "CallExpression", - "start": 5493, - "end": 5515, + "start": 5538, + "end": 5560, "loc": { "start": { - "line": 203, + "line": 205, "column": 17 }, "end": { - "line": 203, + "line": 205, "column": 39 } }, "callee": { "type": "MemberExpression", - "start": 5493, - "end": 5504, + "start": 5538, + "end": 5549, "loc": { "start": { - "line": 203, + "line": 205, "column": 17 }, "end": { - "line": 203, + "line": 205, "column": 28 } }, "object": { "type": "Identifier", - "start": 5493, - "end": 5499, + "start": 5538, + "end": 5544, "loc": { "start": { - "line": 203, + "line": 205, "column": 17 }, "end": { - "line": 203, + "line": 205, "column": 23 }, "identifierName": "Object" @@ -5746,15 +5746,15 @@ }, "property": { "type": "Identifier", - "start": 5500, - "end": 5504, + "start": 5545, + "end": 5549, "loc": { "start": { - "line": 203, + "line": 205, "column": 24 }, "end": { - "line": 203, + "line": 205, "column": 28 }, "identifierName": "keys" @@ -5766,44 +5766,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 5505, - "end": 5514, + "start": 5550, + "end": 5559, "loc": { "start": { - "line": 203, + "line": 205, "column": 29 }, "end": { - "line": 203, + "line": 205, "column": 38 } }, "object": { "type": "ThisExpression", - "start": 5505, - "end": 5509, + "start": 5550, + "end": 5554, "loc": { "start": { - "line": 203, + "line": 205, "column": 29 }, "end": { - "line": 203, + "line": 205, "column": 33 } } }, "property": { "type": "Identifier", - "start": 5510, - "end": 5514, + "start": 5555, + "end": 5559, "loc": { "start": { - "line": 203, + "line": 205, "column": 34 }, "end": { - "line": 203, + "line": 205, "column": 38 }, "identifierName": "data" @@ -5820,73 +5820,73 @@ }, { "type": "ExpressionStatement", - "start": 5519, - "end": 5533, + "start": 5564, + "end": 5578, "loc": { "start": { - "line": 204, + "line": 206, "column": 2 }, "end": { - "line": 204, + "line": 206, "column": 16 } }, "expression": { "type": "AssignmentExpression", - "start": 5519, - "end": 5533, + "start": 5564, + "end": 5578, "loc": { "start": { - "line": 204, + "line": 206, "column": 2 }, "end": { - "line": 204, + "line": 206, "column": 16 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 5519, - "end": 5528, + "start": 5564, + "end": 5573, "loc": { "start": { - "line": 204, + "line": 206, "column": 2 }, "end": { - "line": 204, + "line": 206, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 5519, - "end": 5523, + "start": 5564, + "end": 5568, "loc": { "start": { - "line": 204, + "line": 206, "column": 2 }, "end": { - "line": 204, + "line": 206, "column": 6 } } }, "property": { "type": "Identifier", - "start": 5524, - "end": 5528, + "start": 5569, + "end": 5573, "loc": { "start": { - "line": 204, + "line": 206, "column": 7 }, "end": { - "line": 204, + "line": 206, "column": 11 }, "identifierName": "data" @@ -5897,15 +5897,15 @@ }, "right": { "type": "ObjectExpression", - "start": 5531, - "end": 5533, + "start": 5576, + "end": 5578, "loc": { "start": { - "line": 204, + "line": 206, "column": 14 }, "end": { - "line": 204, + "line": 206, "column": 16 } }, @@ -5915,29 +5915,29 @@ }, { "type": "ReturnStatement", - "start": 5536, - "end": 5547, + "start": 5581, + "end": 5592, "loc": { "start": { - "line": 205, + "line": 207, "column": 2 }, "end": { - "line": 205, + "line": 207, "column": 13 } }, "argument": { "type": "ThisExpression", - "start": 5543, - "end": 5547, + "start": 5588, + "end": 5592, "loc": { "start": { - "line": 205, + "line": 207, "column": 9 }, "end": { - "line": 205, + "line": 207, "column": 13 } } @@ -5951,15 +5951,15 @@ { "type": "CommentLine", "value": " Remove all components", - "start": 5229, - "end": 5253, + "start": 5274, + "end": 5298, "loc": { "start": { - "line": 192, + "line": 194, "column": 1 }, "end": { - "line": 192, + "line": 194, "column": 25 } } @@ -5967,15 +5967,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes all components from the entity.\n\t *\n\t * @example\n\t * entity.removeAll()\n\t *\n\t * @return {Object} The original entity that removeAll() was called on, so that operations can be chained.\n\t ", - "start": 5256, - "end": 5460, + "start": 5301, + "end": 5505, "loc": { "start": { - "line": 194, + "line": 196, "column": 1 }, "end": { - "line": 201, + "line": 203, "column": 4 } } @@ -5985,15 +5985,15 @@ { "type": "CommentBlock", "value": "*\n\t * Remove this entity and all of its components from the world. After an entity is destroyed, the object should be discarded,\n\t * and it is recommended to avoid re-using it.\n\t *\n\t * @example\n\t * entity.destroy()\n\t ", - "start": 5553, - "end": 5774, + "start": 5598, + "end": 5819, "loc": { "start": { - "line": 208, + "line": 210, "column": 1 }, "end": { - "line": 214, + "line": 216, "column": 4 } } @@ -6002,15 +6002,15 @@ }, { "type": "ClassMethod", - "start": 5776, - "end": 6013, + "start": 5821, + "end": 6058, "loc": { "start": { - "line": 215, + "line": 217, "column": 1 }, "end": { - "line": 226, + "line": 228, "column": 2 } }, @@ -6018,15 +6018,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 5776, - "end": 5783, + "start": 5821, + "end": 5828, "loc": { "start": { - "line": 215, + "line": 217, "column": 1 }, "end": { - "line": 215, + "line": 217, "column": 8 }, "identifierName": "destroy" @@ -6042,87 +6042,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5786, - "end": 6013, + "start": 5831, + "end": 6058, "loc": { "start": { - "line": 215, + "line": 217, "column": 11 }, "end": { - "line": 226, + "line": 228, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 5790, - "end": 5806, + "start": 5835, + "end": 5851, "loc": { "start": { - "line": 216, + "line": 218, "column": 2 }, "end": { - "line": 216, + "line": 218, "column": 18 } }, "expression": { "type": "CallExpression", - "start": 5790, - "end": 5806, + "start": 5835, + "end": 5851, "loc": { "start": { - "line": 216, + "line": 218, "column": 2 }, "end": { - "line": 216, + "line": 218, "column": 18 } }, "callee": { "type": "MemberExpression", - "start": 5790, - "end": 5804, + "start": 5835, + "end": 5849, "loc": { "start": { - "line": 216, + "line": 218, "column": 2 }, "end": { - "line": 216, + "line": 218, "column": 16 } }, "object": { "type": "ThisExpression", - "start": 5790, - "end": 5794, + "start": 5835, + "end": 5839, "loc": { "start": { - "line": 216, + "line": 218, "column": 2 }, "end": { - "line": 216, + "line": 218, "column": 6 } } }, "property": { "type": "Identifier", - "start": 5795, - "end": 5804, + "start": 5840, + "end": 5849, "loc": { "start": { - "line": 216, + "line": 218, "column": 7 }, "end": { - "line": 216, + "line": 218, "column": 16 }, "identifierName": "removeAll" @@ -6136,72 +6136,72 @@ }, { "type": "IfStatement", - "start": 5810, - "end": 6010, + "start": 5855, + "end": 6055, "loc": { "start": { - "line": 218, + "line": 220, "column": 2 }, "end": { - "line": 225, + "line": 227, "column": 3 } }, "test": { "type": "CallExpression", - "start": 5814, - "end": 5826, + "start": 5859, + "end": 5871, "loc": { "start": { - "line": 218, + "line": 220, "column": 6 }, "end": { - "line": 218, + "line": 220, "column": 18 } }, "callee": { "type": "MemberExpression", - "start": 5814, - "end": 5824, + "start": 5859, + "end": 5869, "loc": { "start": { - "line": 218, + "line": 220, "column": 6 }, "end": { - "line": 218, + "line": 220, "column": 16 } }, "object": { "type": "ThisExpression", - "start": 5814, - "end": 5818, + "start": 5859, + "end": 5863, "loc": { "start": { - "line": 218, + "line": 220, "column": 6 }, "end": { - "line": 218, + "line": 220, "column": 10 } } }, "property": { "type": "Identifier", - "start": 5819, - "end": 5824, + "start": 5864, + "end": 5869, "loc": { "start": { - "line": 218, + "line": 220, "column": 11 }, "end": { - "line": 218, + "line": 220, "column": 16 }, "identifierName": "valid" @@ -6214,100 +6214,100 @@ }, "consequent": { "type": "BlockStatement", - "start": 5828, - "end": 6010, + "start": 5873, + "end": 6055, "loc": { "start": { - "line": 218, + "line": 220, "column": 20 }, "end": { - "line": 225, + "line": 227, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 5888, - "end": 5917, + "start": 5933, + "end": 5962, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 32 } }, "expression": { "type": "CallExpression", - "start": 5888, - "end": 5917, + "start": 5933, + "end": 5962, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 32 } }, "callee": { "type": "MemberExpression", - "start": 5888, - "end": 5911, + "start": 5933, + "end": 5956, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 26 } }, "object": { "type": "MemberExpression", - "start": 5888, - "end": 5904, + "start": 5933, + "end": 5949, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 19 } }, "object": { "type": "MemberExpression", - "start": 5888, - "end": 5898, + "start": 5933, + "end": 5943, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 5888, - "end": 5892, + "start": 5933, + "end": 5937, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 7 } }, @@ -6315,15 +6315,15 @@ }, "property": { "type": "Identifier", - "start": 5893, - "end": 5898, + "start": 5938, + "end": 5943, "loc": { "start": { - "line": 220, + "line": 222, "column": 8 }, "end": { - "line": 220, + "line": 222, "column": 13 }, "identifierName": "world" @@ -6335,15 +6335,15 @@ }, "property": { "type": "Identifier", - "start": 5899, - "end": 5904, + "start": 5944, + "end": 5949, "loc": { "start": { - "line": 220, + "line": 222, "column": 14 }, "end": { - "line": 220, + "line": 222, "column": 19 }, "identifierName": "index" @@ -6355,15 +6355,15 @@ }, "property": { "type": "Identifier", - "start": 5905, - "end": 5911, + "start": 5950, + "end": 5956, "loc": { "start": { - "line": 220, + "line": 222, "column": 20 }, "end": { - "line": 220, + "line": 222, "column": 26 }, "identifierName": "remove" @@ -6376,15 +6376,15 @@ "arguments": [ { "type": "ThisExpression", - "start": 5912, - "end": 5916, + "start": 5957, + "end": 5961, "loc": { "start": { - "line": 220, + "line": 222, "column": 27 }, "end": { - "line": 220, + "line": 222, "column": 31 } } @@ -6397,15 +6397,15 @@ { "type": "CommentLine", "value": " Remove from the index, to update match all index", - "start": 5833, - "end": 5884, + "start": 5878, + "end": 5929, "loc": { "start": { - "line": 219, + "line": 221, "column": 3 }, "end": { - "line": 219, + "line": 221, "column": 54 } } @@ -6415,15 +6415,15 @@ { "type": "CommentLine", "value": " Remove from world", - "start": 5922, - "end": 5942, + "start": 5967, + "end": 5987, "loc": { "start": { - "line": 222, + "line": 224, "column": 3 }, "end": { - "line": 222, + "line": 224, "column": 23 } } @@ -6432,85 +6432,85 @@ }, { "type": "ExpressionStatement", - "start": 5946, - "end": 5982, + "start": 5991, + "end": 6027, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 39 } }, "expression": { "type": "CallExpression", - "start": 5946, - "end": 5982, + "start": 5991, + "end": 6027, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 39 } }, "callee": { "type": "MemberExpression", - "start": 5946, - "end": 5972, + "start": 5991, + "end": 6017, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 29 } }, "object": { "type": "MemberExpression", - "start": 5946, - "end": 5965, + "start": 5991, + "end": 6010, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 22 } }, "object": { "type": "MemberExpression", - "start": 5946, - "end": 5956, + "start": 5991, + "end": 6001, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 5946, - "end": 5950, + "start": 5991, + "end": 5995, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 7 } }, @@ -6518,15 +6518,15 @@ }, "property": { "type": "Identifier", - "start": 5951, - "end": 5956, + "start": 5996, + "end": 6001, "loc": { "start": { - "line": 223, + "line": 225, "column": 8 }, "end": { - "line": 223, + "line": 225, "column": 13 }, "identifierName": "world" @@ -6538,15 +6538,15 @@ }, "property": { "type": "Identifier", - "start": 5957, - "end": 5965, + "start": 6002, + "end": 6010, "loc": { "start": { - "line": 223, + "line": 225, "column": 14 }, "end": { - "line": 223, + "line": 225, "column": 22 }, "identifierName": "entities" @@ -6558,15 +6558,15 @@ }, "property": { "type": "Identifier", - "start": 5966, - "end": 5972, + "start": 6011, + "end": 6017, "loc": { "start": { - "line": 223, + "line": 225, "column": 23 }, "end": { - "line": 223, + "line": 225, "column": 29 }, "identifierName": "delete" @@ -6579,44 +6579,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 5973, - "end": 5981, + "start": 6018, + "end": 6026, "loc": { "start": { - "line": 223, + "line": 225, "column": 30 }, "end": { - "line": 223, + "line": 225, "column": 38 } }, "object": { "type": "ThisExpression", - "start": 5973, - "end": 5977, + "start": 6018, + "end": 6022, "loc": { "start": { - "line": 223, + "line": 225, "column": 30 }, "end": { - "line": 223, + "line": 225, "column": 34 } } }, "property": { "type": "Identifier", - "start": 5978, - "end": 5981, + "start": 6023, + "end": 6026, "loc": { "start": { - "line": 223, + "line": 225, "column": 35 }, "end": { - "line": 223, + "line": 225, "column": 38 }, "identifierName": "_id" @@ -6632,15 +6632,15 @@ { "type": "CommentLine", "value": " Remove from world", - "start": 5922, - "end": 5942, + "start": 5967, + "end": 5987, "loc": { "start": { - "line": 222, + "line": 224, "column": 3 }, "end": { - "line": 222, + "line": 224, "column": 23 } } @@ -6649,73 +6649,73 @@ }, { "type": "ExpressionStatement", - "start": 5986, - "end": 6006, + "start": 6031, + "end": 6051, "loc": { "start": { - "line": 224, + "line": 226, "column": 3 }, "end": { - "line": 224, + "line": 226, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 5986, - "end": 6006, + "start": 6031, + "end": 6051, "loc": { "start": { - "line": 224, + "line": 226, "column": 3 }, "end": { - "line": 224, + "line": 226, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 5986, - "end": 5994, + "start": 6031, + "end": 6039, "loc": { "start": { - "line": 224, + "line": 226, "column": 3 }, "end": { - "line": 224, + "line": 226, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 5986, - "end": 5990, + "start": 6031, + "end": 6035, "loc": { "start": { - "line": 224, + "line": 226, "column": 3 }, "end": { - "line": 224, + "line": 226, "column": 7 } } }, "property": { "type": "Identifier", - "start": 5991, - "end": 5994, + "start": 6036, + "end": 6039, "loc": { "start": { - "line": 224, + "line": 226, "column": 8 }, "end": { - "line": 224, + "line": 226, "column": 11 }, "identifierName": "_id" @@ -6726,15 +6726,15 @@ }, "right": { "type": "Identifier", - "start": 5997, - "end": 6006, + "start": 6042, + "end": 6051, "loc": { "start": { - "line": 224, + "line": 226, "column": 14 }, "end": { - "line": 224, + "line": 226, "column": 23 }, "identifierName": "undefined" @@ -6756,15 +6756,15 @@ { "type": "CommentBlock", "value": "*\n\t * Remove this entity and all of its components from the world. After an entity is destroyed, the object should be discarded,\n\t * and it is recommended to avoid re-using it.\n\t *\n\t * @example\n\t * entity.destroy()\n\t ", - "start": 5553, - "end": 5774, + "start": 5598, + "end": 5819, "loc": { "start": { - "line": 208, + "line": 210, "column": 1 }, "end": { - "line": 214, + "line": 216, "column": 4 } } @@ -6774,15 +6774,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if this is a valid, existing, and usable entity, which is attached to a world.\n\t *\n\t * @example\n\t * if (entity.valid()) {...}\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 6016, - "end": 6207, + "start": 6061, + "end": 6252, "loc": { "start": { - "line": 228, + "line": 230, "column": 1 }, "end": { - "line": 235, + "line": 237, "column": 4 } } @@ -6791,15 +6791,15 @@ }, { "type": "ClassMethod", - "start": 6209, - "end": 6479, + "start": 6254, + "end": 6524, "loc": { "start": { - "line": 236, + "line": 238, "column": 1 }, "end": { - "line": 240, + "line": 242, "column": 2 } }, @@ -6807,15 +6807,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 6209, - "end": 6214, + "start": 6254, + "end": 6259, "loc": { "start": { - "line": 236, + "line": 238, "column": 1 }, "end": { - "line": 236, + "line": 238, "column": 6 }, "identifierName": "valid" @@ -6831,72 +6831,72 @@ "params": [], "body": { "type": "BlockStatement", - "start": 6217, - "end": 6479, + "start": 6262, + "end": 6524, "loc": { "start": { - "line": 236, + "line": 238, "column": 9 }, "end": { - "line": 240, + "line": 242, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 6433, - "end": 6476, + "start": 6478, + "end": 6521, "loc": { "start": { - "line": 239, + "line": 241, "column": 2 }, "end": { - "line": 239, + "line": 241, "column": 45 } }, "argument": { "type": "LogicalExpression", - "start": 6440, - "end": 6476, + "start": 6485, + "end": 6521, "loc": { "start": { - "line": 239, + "line": 241, "column": 9 }, "end": { - "line": 239, + "line": 241, "column": 45 } }, "left": { "type": "MemberExpression", - "start": 6440, - "end": 6450, + "start": 6485, + "end": 6495, "loc": { "start": { - "line": 239, + "line": 241, "column": 9 }, "end": { - "line": 239, + "line": 241, "column": 19 } }, "object": { "type": "ThisExpression", - "start": 6440, - "end": 6444, + "start": 6485, + "end": 6489, "loc": { "start": { - "line": 239, + "line": 241, "column": 9 }, "end": { - "line": 239, + "line": 241, "column": 13 } }, @@ -6904,15 +6904,15 @@ }, "property": { "type": "Identifier", - "start": 6445, - "end": 6450, + "start": 6490, + "end": 6495, "loc": { "start": { - "line": 239, + "line": 241, "column": 14 }, "end": { - "line": 239, + "line": 241, "column": 19 }, "identifierName": "world" @@ -6925,58 +6925,58 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 6454, - "end": 6476, + "start": 6499, + "end": 6521, "loc": { "start": { - "line": 239, + "line": 241, "column": 23 }, "end": { - "line": 239, + "line": 241, "column": 45 } }, "left": { "type": "MemberExpression", - "start": 6454, - "end": 6462, + "start": 6499, + "end": 6507, "loc": { "start": { - "line": 239, + "line": 241, "column": 23 }, "end": { - "line": 239, + "line": 241, "column": 31 } }, "object": { "type": "ThisExpression", - "start": 6454, - "end": 6458, + "start": 6499, + "end": 6503, "loc": { "start": { - "line": 239, + "line": 241, "column": 23 }, "end": { - "line": 239, + "line": 241, "column": 27 } } }, "property": { "type": "Identifier", - "start": 6459, - "end": 6462, + "start": 6504, + "end": 6507, "loc": { "start": { - "line": 239, + "line": 241, "column": 28 }, "end": { - "line": 239, + "line": 241, "column": 31 }, "identifierName": "_id" @@ -6988,15 +6988,15 @@ "operator": "!==", "right": { "type": "Identifier", - "start": 6467, - "end": 6476, + "start": 6512, + "end": 6521, "loc": { "start": { - "line": 239, + "line": 241, "column": 36 }, "end": { - "line": 239, + "line": 241, "column": 45 }, "identifierName": "undefined" @@ -7010,15 +7010,15 @@ { "type": "CommentLine", "value": " Note: No need to actually look in the world for the ID, if entities are only ever copied by reference.", - "start": 6221, - "end": 6326, + "start": 6266, + "end": 6371, "loc": { "start": { - "line": 237, + "line": 239, "column": 2 }, "end": { - "line": 237, + "line": 239, "column": 107 } } @@ -7026,15 +7026,15 @@ { "type": "CommentLine", "value": " If entities are ever deep/shallow copied, this function will need to check this to be more robust.", - "start": 6329, - "end": 6430, + "start": 6374, + "end": 6475, "loc": { "start": { - "line": 238, + "line": 240, "column": 2 }, "end": { - "line": 238, + "line": 240, "column": 103 } } @@ -7049,15 +7049,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if this is a valid, existing, and usable entity, which is attached to a world.\n\t *\n\t * @example\n\t * if (entity.valid()) {...}\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 6016, - "end": 6207, + "start": 6061, + "end": 6252, "loc": { "start": { - "line": 228, + "line": 230, "column": 1 }, "end": { - "line": 235, + "line": 237, "column": 4 } } @@ -7067,15 +7067,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns unique entity ID as a string.\n\t *\n\t * @example\n\t * let entityId = entity.toString()\n\t *\n\t * @return {string} String representation of the entity ID.\n\t ", - "start": 6482, - "end": 6651, + "start": 6527, + "end": 6696, "loc": { "start": { - "line": 242, + "line": 244, "column": 1 }, "end": { - "line": 249, + "line": 251, "column": 4 } } @@ -7084,15 +7084,15 @@ }, { "type": "ClassMethod", - "start": 6653, - "end": 6694, + "start": 6698, + "end": 6739, "loc": { "start": { - "line": 250, + "line": 252, "column": 1 }, "end": { - "line": 252, + "line": 254, "column": 2 } }, @@ -7100,15 +7100,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 6653, - "end": 6661, + "start": 6698, + "end": 6706, "loc": { "start": { - "line": 250, + "line": 252, "column": 1 }, "end": { - "line": 250, + "line": 252, "column": 9 }, "identifierName": "toString" @@ -7124,58 +7124,58 @@ "params": [], "body": { "type": "BlockStatement", - "start": 6664, - "end": 6694, + "start": 6709, + "end": 6739, "loc": { "start": { - "line": 250, + "line": 252, "column": 12 }, "end": { - "line": 252, + "line": 254, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 6668, - "end": 6691, + "start": 6713, + "end": 6736, "loc": { "start": { - "line": 251, + "line": 253, "column": 2 }, "end": { - "line": 251, + "line": 253, "column": 25 } }, "argument": { "type": "CallExpression", - "start": 6675, - "end": 6691, + "start": 6720, + "end": 6736, "loc": { "start": { - "line": 251, + "line": 253, "column": 9 }, "end": { - "line": 251, + "line": 253, "column": 25 } }, "callee": { "type": "Identifier", - "start": 6675, - "end": 6681, + "start": 6720, + "end": 6726, "loc": { "start": { - "line": 251, + "line": 253, "column": 9 }, "end": { - "line": 251, + "line": 253, "column": 15 }, "identifierName": "String" @@ -7185,44 +7185,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 6682, - "end": 6690, + "start": 6727, + "end": 6735, "loc": { "start": { - "line": 251, + "line": 253, "column": 16 }, "end": { - "line": 251, + "line": 253, "column": 24 } }, "object": { "type": "ThisExpression", - "start": 6682, - "end": 6686, + "start": 6727, + "end": 6731, "loc": { "start": { - "line": 251, + "line": 253, "column": 16 }, "end": { - "line": 251, + "line": 253, "column": 20 } } }, "property": { "type": "Identifier", - "start": 6687, - "end": 6690, + "start": 6732, + "end": 6735, "loc": { "start": { - "line": 251, + "line": 253, "column": 21 }, "end": { - "line": 251, + "line": 253, "column": 24 }, "identifierName": "_id" @@ -7242,15 +7242,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns unique entity ID as a string.\n\t *\n\t * @example\n\t * let entityId = entity.toString()\n\t *\n\t * @return {string} String representation of the entity ID.\n\t ", - "start": 6482, - "end": 6651, + "start": 6527, + "end": 6696, "loc": { "start": { - "line": 242, + "line": 244, "column": 1 }, "end": { - "line": 249, + "line": 251, "column": 4 } } @@ -7260,15 +7260,15 @@ { "type": "CommentBlock", "value": "*\n\t * Serializes entire entity and components to JSON.\n\t * Note: Defining toJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * let serializedEntity = entity.toJSON()\n\t *\n\t * @return {string} JSON encoded string\n\t ", - "start": 6697, - "end": 6953, + "start": 6742, + "end": 6998, "loc": { "start": { - "line": 254, + "line": 256, "column": 1 }, "end": { - "line": 262, + "line": 264, "column": 4 } } @@ -7277,15 +7277,15 @@ }, { "type": "ClassMethod", - "start": 6955, - "end": 7003, + "start": 7000, + "end": 7048, "loc": { "start": { - "line": 263, + "line": 265, "column": 1 }, "end": { - "line": 265, + "line": 267, "column": 2 } }, @@ -7293,15 +7293,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 6955, - "end": 6961, + "start": 7000, + "end": 7006, "loc": { "start": { - "line": 263, + "line": 265, "column": 1 }, "end": { - "line": 263, + "line": 265, "column": 7 }, "identifierName": "toJSON" @@ -7317,72 +7317,72 @@ "params": [], "body": { "type": "BlockStatement", - "start": 6964, - "end": 7003, + "start": 7009, + "end": 7048, "loc": { "start": { - "line": 263, + "line": 265, "column": 10 }, "end": { - "line": 265, + "line": 267, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 6968, - "end": 7000, + "start": 7013, + "end": 7045, "loc": { "start": { - "line": 264, + "line": 266, "column": 2 }, "end": { - "line": 264, + "line": 266, "column": 34 } }, "argument": { "type": "CallExpression", - "start": 6975, - "end": 7000, + "start": 7020, + "end": 7045, "loc": { "start": { - "line": 264, + "line": 266, "column": 9 }, "end": { - "line": 264, + "line": 266, "column": 34 } }, "callee": { "type": "MemberExpression", - "start": 6975, - "end": 6989, + "start": 7020, + "end": 7034, "loc": { "start": { - "line": 264, + "line": 266, "column": 9 }, "end": { - "line": 264, + "line": 266, "column": 23 } }, "object": { "type": "Identifier", - "start": 6975, - "end": 6979, + "start": 7020, + "end": 7024, "loc": { "start": { - "line": 264, + "line": 266, "column": 9 }, "end": { - "line": 264, + "line": 266, "column": 13 }, "identifierName": "JSON" @@ -7391,15 +7391,15 @@ }, "property": { "type": "Identifier", - "start": 6980, - "end": 6989, + "start": 7025, + "end": 7034, "loc": { "start": { - "line": 264, + "line": 266, "column": 14 }, "end": { - "line": 264, + "line": 266, "column": 23 }, "identifierName": "stringify" @@ -7411,44 +7411,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 6990, - "end": 6999, + "start": 7035, + "end": 7044, "loc": { "start": { - "line": 264, + "line": 266, "column": 24 }, "end": { - "line": 264, + "line": 266, "column": 33 } }, "object": { "type": "ThisExpression", - "start": 6990, - "end": 6994, + "start": 7035, + "end": 7039, "loc": { "start": { - "line": 264, + "line": 266, "column": 24 }, "end": { - "line": 264, + "line": 266, "column": 28 } } }, "property": { "type": "Identifier", - "start": 6995, - "end": 6999, + "start": 7040, + "end": 7044, "loc": { "start": { - "line": 264, + "line": 266, "column": 29 }, "end": { - "line": 264, + "line": 266, "column": 33 }, "identifierName": "data" @@ -7468,15 +7468,15 @@ { "type": "CommentBlock", "value": "*\n\t * Serializes entire entity and components to JSON.\n\t * Note: Defining toJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * let serializedEntity = entity.toJSON()\n\t *\n\t * @return {string} JSON encoded string\n\t ", - "start": 6697, - "end": 6953, + "start": 6742, + "end": 6998, "loc": { "start": { - "line": 254, + "line": 256, "column": 1 }, "end": { - "line": 262, + "line": 264, "column": 4 } } @@ -7486,15 +7486,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deserializes data from JSON, creating new components and overwriting existing components.\n\t * Note: Defining fromJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * entity.fromJSON(serializedEntity)\n\t *\n\t * @param {string} data - A JSON string containing component data to parse, and store in this entity.\n\t *\n\t * @return {Object} The original entity that fromJSON() was called on, so that operations can be chained.\n\t ", - "start": 7006, - "end": 7473, + "start": 7051, + "end": 7518, "loc": { "start": { - "line": 267, + "line": 269, "column": 1 }, "end": { - "line": 277, + "line": 279, "column": 4 } } @@ -7503,15 +7503,15 @@ }, { "type": "ClassMethod", - "start": 7475, - "end": 7792, + "start": 7520, + "end": 7837, "loc": { "start": { - "line": 278, + "line": 280, "column": 1 }, "end": { - "line": 291, + "line": 293, "column": 2 } }, @@ -7519,15 +7519,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 7475, - "end": 7483, + "start": 7520, + "end": 7528, "loc": { "start": { - "line": 278, + "line": 280, "column": 1 }, "end": { - "line": 278, + "line": 280, "column": 9 }, "identifierName": "fromJSON" @@ -7543,15 +7543,15 @@ "params": [ { "type": "Identifier", - "start": 7484, - "end": 7488, + "start": 7529, + "end": 7533, "loc": { "start": { - "line": 278, + "line": 280, "column": 10 }, "end": { - "line": 278, + "line": 280, "column": 14 }, "identifierName": "data" @@ -7561,59 +7561,59 @@ ], "body": { "type": "BlockStatement", - "start": 7490, - "end": 7792, + "start": 7535, + "end": 7837, "loc": { "start": { - "line": 278, + "line": 280, "column": 16 }, "end": { - "line": 291, + "line": 293, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 7494, - "end": 7523, + "start": 7539, + "end": 7568, "loc": { "start": { - "line": 279, + "line": 281, "column": 2 }, "end": { - "line": 279, + "line": 281, "column": 31 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 7498, - "end": 7523, + "start": 7543, + "end": 7568, "loc": { "start": { - "line": 279, + "line": 281, "column": 6 }, "end": { - "line": 279, + "line": 281, "column": 31 } }, "id": { "type": "Identifier", - "start": 7498, - "end": 7504, + "start": 7543, + "end": 7549, "loc": { "start": { - "line": 279, + "line": 281, "column": 6 }, "end": { - "line": 279, + "line": 281, "column": 12 }, "identifierName": "parsed" @@ -7622,43 +7622,43 @@ }, "init": { "type": "CallExpression", - "start": 7507, - "end": 7523, + "start": 7552, + "end": 7568, "loc": { "start": { - "line": 279, + "line": 281, "column": 15 }, "end": { - "line": 279, + "line": 281, "column": 31 } }, "callee": { "type": "MemberExpression", - "start": 7507, - "end": 7517, + "start": 7552, + "end": 7562, "loc": { "start": { - "line": 279, + "line": 281, "column": 15 }, "end": { - "line": 279, + "line": 281, "column": 25 } }, "object": { "type": "Identifier", - "start": 7507, - "end": 7511, + "start": 7552, + "end": 7556, "loc": { "start": { - "line": 279, + "line": 281, "column": 15 }, "end": { - "line": 279, + "line": 281, "column": 19 }, "identifierName": "JSON" @@ -7667,15 +7667,15 @@ }, "property": { "type": "Identifier", - "start": 7512, - "end": 7517, + "start": 7557, + "end": 7562, "loc": { "start": { - "line": 279, + "line": 281, "column": 20 }, "end": { - "line": 279, + "line": 281, "column": 25 }, "identifierName": "parse" @@ -7687,15 +7687,15 @@ "arguments": [ { "type": "Identifier", - "start": 7518, - "end": 7522, + "start": 7563, + "end": 7567, "loc": { "start": { - "line": 279, + "line": 281, "column": 26 }, "end": { - "line": 279, + "line": 281, "column": 30 }, "identifierName": "data" @@ -7710,58 +7710,58 @@ }, { "type": "ForInStatement", - "start": 7526, - "end": 7775, + "start": 7571, + "end": 7820, "loc": { "start": { - "line": 280, + "line": 282, "column": 2 }, "end": { - "line": 289, + "line": 291, "column": 3 } }, "left": { "type": "VariableDeclaration", - "start": 7531, - "end": 7539, + "start": 7576, + "end": 7584, "loc": { "start": { - "line": 280, + "line": 282, "column": 7 }, "end": { - "line": 280, + "line": 282, "column": 15 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 7535, - "end": 7539, + "start": 7580, + "end": 7584, "loc": { "start": { - "line": 280, + "line": 282, "column": 11 }, "end": { - "line": 280, + "line": 282, "column": 15 } }, "id": { "type": "Identifier", - "start": 7535, - "end": 7539, + "start": 7580, + "end": 7584, "loc": { "start": { - "line": 280, + "line": 282, "column": 11 }, "end": { - "line": 280, + "line": 282, "column": 15 }, "identifierName": "name" @@ -7775,15 +7775,15 @@ }, "right": { "type": "Identifier", - "start": 7543, - "end": 7549, + "start": 7588, + "end": 7594, "loc": { "start": { - "line": 280, + "line": 282, "column": 19 }, "end": { - "line": 280, + "line": 282, "column": 25 }, "identifierName": "parsed" @@ -7792,59 +7792,59 @@ }, "body": { "type": "BlockStatement", - "start": 7551, - "end": 7775, + "start": 7596, + "end": 7820, "loc": { "start": { - "line": 280, + "line": 282, "column": 27 }, "end": { - "line": 289, + "line": 291, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 7556, - "end": 7584, + "start": 7601, + "end": 7629, "loc": { "start": { - "line": 281, + "line": 283, "column": 3 }, "end": { - "line": 281, + "line": 283, "column": 31 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 7560, - "end": 7584, + "start": 7605, + "end": 7629, "loc": { "start": { - "line": 281, + "line": 283, "column": 7 }, "end": { - "line": 281, + "line": 283, "column": 31 } }, "id": { "type": "Identifier", - "start": 7560, - "end": 7564, + "start": 7605, + "end": 7609, "loc": { "start": { - "line": 281, + "line": 283, "column": 7 }, "end": { - "line": 281, + "line": 283, "column": 11 }, "identifierName": "comp" @@ -7853,58 +7853,58 @@ }, "init": { "type": "CallExpression", - "start": 7567, - "end": 7584, + "start": 7612, + "end": 7629, "loc": { "start": { - "line": 281, + "line": 283, "column": 14 }, "end": { - "line": 281, + "line": 283, "column": 31 } }, "callee": { "type": "MemberExpression", - "start": 7567, - "end": 7578, + "start": 7612, + "end": 7623, "loc": { "start": { - "line": 281, + "line": 283, "column": 14 }, "end": { - "line": 281, + "line": 283, "column": 25 } }, "object": { "type": "ThisExpression", - "start": 7567, - "end": 7571, + "start": 7612, + "end": 7616, "loc": { "start": { - "line": 281, + "line": 283, "column": 14 }, "end": { - "line": 281, + "line": 283, "column": 18 } } }, "property": { "type": "Identifier", - "start": 7572, - "end": 7578, + "start": 7617, + "end": 7623, "loc": { "start": { - "line": 281, + "line": 283, "column": 19 }, "end": { - "line": 281, + "line": 283, "column": 25 }, "identifierName": "access" @@ -7916,15 +7916,15 @@ "arguments": [ { "type": "Identifier", - "start": 7579, - "end": 7583, + "start": 7624, + "end": 7628, "loc": { "start": { - "line": 281, + "line": 283, "column": 26 }, "end": { - "line": 281, + "line": 283, "column": 30 }, "identifierName": "name" @@ -7942,15 +7942,15 @@ { "type": "CommentLine", "value": " Either call custom method or copy all properties", - "start": 7589, - "end": 7640, + "start": 7634, + "end": 7685, "loc": { "start": { - "line": 283, + "line": 285, "column": 3 }, "end": { - "line": 283, + "line": 285, "column": 54 } } @@ -7959,43 +7959,43 @@ }, { "type": "IfStatement", - "start": 7644, - "end": 7771, + "start": 7689, + "end": 7816, "loc": { "start": { - "line": 284, + "line": 286, "column": 3 }, "end": { - "line": 288, + "line": 290, "column": 4 } }, "test": { "type": "BinaryExpression", - "start": 7648, - "end": 7683, + "start": 7693, + "end": 7728, "loc": { "start": { - "line": 284, + "line": 286, "column": 7 }, "end": { - "line": 284, + "line": 286, "column": 42 } }, "left": { "type": "UnaryExpression", - "start": 7648, - "end": 7668, + "start": 7693, + "end": 7713, "loc": { "start": { - "line": 284, + "line": 286, "column": 7 }, "end": { - "line": 284, + "line": 286, "column": 27 } }, @@ -8003,29 +8003,29 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 7655, - "end": 7668, + "start": 7700, + "end": 7713, "loc": { "start": { - "line": 284, + "line": 286, "column": 14 }, "end": { - "line": 284, + "line": 286, "column": 27 } }, "object": { "type": "Identifier", - "start": 7655, - "end": 7659, + "start": 7700, + "end": 7704, "loc": { "start": { - "line": 284, + "line": 286, "column": 14 }, "end": { - "line": 284, + "line": 286, "column": 18 }, "identifierName": "comp" @@ -8035,15 +8035,15 @@ }, "property": { "type": "Identifier", - "start": 7660, - "end": 7668, + "start": 7705, + "end": 7713, "loc": { "start": { - "line": 284, + "line": 286, "column": 19 }, "end": { - "line": 284, + "line": 286, "column": 27 }, "identifierName": "fromJSON" @@ -8061,15 +8061,15 @@ "operator": "===", "right": { "type": "StringLiteral", - "start": 7673, - "end": 7683, + "start": 7718, + "end": 7728, "loc": { "start": { - "line": 284, + "line": 286, "column": 32 }, "end": { - "line": 284, + "line": 286, "column": 42 } }, @@ -8083,72 +8083,72 @@ }, "consequent": { "type": "BlockStatement", - "start": 7685, - "end": 7723, + "start": 7730, + "end": 7768, "loc": { "start": { - "line": 284, + "line": 286, "column": 44 }, "end": { - "line": 286, + "line": 288, "column": 4 } }, "body": [ { "type": "ExpressionStatement", - "start": 7691, - "end": 7718, + "start": 7736, + "end": 7763, "loc": { "start": { - "line": 285, + "line": 287, "column": 4 }, "end": { - "line": 285, + "line": 287, "column": 31 } }, "expression": { "type": "CallExpression", - "start": 7691, - "end": 7718, + "start": 7736, + "end": 7763, "loc": { "start": { - "line": 285, + "line": 287, "column": 4 }, "end": { - "line": 285, + "line": 287, "column": 31 } }, "callee": { "type": "MemberExpression", - "start": 7691, - "end": 7704, + "start": 7736, + "end": 7749, "loc": { "start": { - "line": 285, + "line": 287, "column": 4 }, "end": { - "line": 285, + "line": 287, "column": 17 } }, "object": { "type": "Identifier", - "start": 7691, - "end": 7695, + "start": 7736, + "end": 7740, "loc": { "start": { - "line": 285, + "line": 287, "column": 4 }, "end": { - "line": 285, + "line": 287, "column": 8 }, "identifierName": "comp" @@ -8157,15 +8157,15 @@ }, "property": { "type": "Identifier", - "start": 7696, - "end": 7704, + "start": 7741, + "end": 7749, "loc": { "start": { - "line": 285, + "line": 287, "column": 9 }, "end": { - "line": 285, + "line": 287, "column": 17 }, "identifierName": "fromJSON" @@ -8177,29 +8177,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 7705, - "end": 7717, + "start": 7750, + "end": 7762, "loc": { "start": { - "line": 285, + "line": 287, "column": 18 }, "end": { - "line": 285, + "line": 287, "column": 30 } }, "object": { "type": "Identifier", - "start": 7705, - "end": 7711, + "start": 7750, + "end": 7756, "loc": { "start": { - "line": 285, + "line": 287, "column": 18 }, "end": { - "line": 285, + "line": 287, "column": 24 }, "identifierName": "parsed" @@ -8208,15 +8208,15 @@ }, "property": { "type": "Identifier", - "start": 7712, - "end": 7716, + "start": 7757, + "end": 7761, "loc": { "start": { - "line": 285, + "line": 287, "column": 25 }, "end": { - "line": 285, + "line": 287, "column": 29 }, "identifierName": "name" @@ -8233,87 +8233,87 @@ }, "alternate": { "type": "BlockStatement", - "start": 7729, - "end": 7771, + "start": 7774, + "end": 7816, "loc": { "start": { - "line": 286, + "line": 288, "column": 10 }, "end": { - "line": 288, + "line": 290, "column": 4 } }, "body": [ { "type": "ExpressionStatement", - "start": 7735, - "end": 7766, + "start": 7780, + "end": 7811, "loc": { "start": { - "line": 287, + "line": 289, "column": 4 }, "end": { - "line": 287, + "line": 289, "column": 35 } }, "expression": { "type": "CallExpression", - "start": 7735, - "end": 7766, + "start": 7780, + "end": 7811, "loc": { "start": { - "line": 287, + "line": 289, "column": 4 }, "end": { - "line": 287, + "line": 289, "column": 35 } }, "callee": { "type": "MemberExpression", - "start": 7735, - "end": 7746, + "start": 7780, + "end": 7791, "loc": { "start": { - "line": 287, + "line": 289, "column": 4 }, "end": { - "line": 287, + "line": 289, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 7735, - "end": 7739, + "start": 7780, + "end": 7784, "loc": { "start": { - "line": 287, + "line": 289, "column": 4 }, "end": { - "line": 287, + "line": 289, "column": 8 } } }, "property": { "type": "Identifier", - "start": 7740, - "end": 7746, + "start": 7785, + "end": 7791, "loc": { "start": { - "line": 287, + "line": 289, "column": 9 }, "end": { - "line": 287, + "line": 289, "column": 15 }, "identifierName": "update" @@ -8325,15 +8325,15 @@ "arguments": [ { "type": "Identifier", - "start": 7747, - "end": 7751, + "start": 7792, + "end": 7796, "loc": { "start": { - "line": 287, + "line": 289, "column": 16 }, "end": { - "line": 287, + "line": 289, "column": 20 }, "identifierName": "name" @@ -8342,29 +8342,29 @@ }, { "type": "MemberExpression", - "start": 7753, - "end": 7765, + "start": 7798, + "end": 7810, "loc": { "start": { - "line": 287, + "line": 289, "column": 22 }, "end": { - "line": 287, + "line": 289, "column": 34 } }, "object": { "type": "Identifier", - "start": 7753, - "end": 7759, + "start": 7798, + "end": 7804, "loc": { "start": { - "line": 287, + "line": 289, "column": 22 }, "end": { - "line": 287, + "line": 289, "column": 28 }, "identifierName": "parsed" @@ -8373,15 +8373,15 @@ }, "property": { "type": "Identifier", - "start": 7760, - "end": 7764, + "start": 7805, + "end": 7809, "loc": { "start": { - "line": 287, + "line": 289, "column": 29 }, "end": { - "line": 287, + "line": 289, "column": 33 }, "identifierName": "name" @@ -8400,15 +8400,15 @@ { "type": "CommentLine", "value": " Either call custom method or copy all properties", - "start": 7589, - "end": 7640, + "start": 7634, + "end": 7685, "loc": { "start": { - "line": 283, + "line": 285, "column": 3 }, "end": { - "line": 283, + "line": 285, "column": 54 } } @@ -8421,29 +8421,29 @@ }, { "type": "ReturnStatement", - "start": 7778, - "end": 7789, + "start": 7823, + "end": 7834, "loc": { "start": { - "line": 290, + "line": 292, "column": 2 }, "end": { - "line": 290, + "line": 292, "column": 13 } }, "argument": { "type": "ThisExpression", - "start": 7785, - "end": 7789, + "start": 7830, + "end": 7834, "loc": { "start": { - "line": 290, + "line": 292, "column": 9 }, "end": { - "line": 290, + "line": 292, "column": 13 } } @@ -8457,15 +8457,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deserializes data from JSON, creating new components and overwriting existing components.\n\t * Note: Defining fromJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * entity.fromJSON(serializedEntity)\n\t *\n\t * @param {string} data - A JSON string containing component data to parse, and store in this entity.\n\t *\n\t * @return {Object} The original entity that fromJSON() was called on, so that operations can be chained.\n\t ", - "start": 7006, - "end": 7473, + "start": 7051, + "end": 7518, "loc": { "start": { - "line": 267, + "line": 269, "column": 1 }, "end": { - "line": 277, + "line": 279, "column": 4 } } @@ -8475,15 +8475,15 @@ { "type": "CommentBlock", "value": "*\n\t * Attaches a currently detached entity back to a world.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.attach(world)\n\t *\n\t * @param {World} world - The world to attach this entity to\n\t ", - "start": 7795, - "end": 8120, + "start": 7840, + "end": 8165, "loc": { "start": { - "line": 293, + "line": 295, "column": 1 }, "end": { - "line": 302, + "line": 304, "column": 4 } } @@ -8492,15 +8492,15 @@ }, { "type": "ClassMethod", - "start": 8122, - "end": 8357, + "start": 8167, + "end": 8402, "loc": { "start": { - "line": 303, + "line": 305, "column": 1 }, "end": { - "line": 311, + "line": 313, "column": 2 } }, @@ -8508,15 +8508,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 8122, - "end": 8128, + "start": 8167, + "end": 8173, "loc": { "start": { - "line": 303, + "line": 305, "column": 1 }, "end": { - "line": 303, + "line": 305, "column": 7 }, "identifierName": "attach" @@ -8532,15 +8532,15 @@ "params": [ { "type": "Identifier", - "start": 8129, - "end": 8134, + "start": 8174, + "end": 8179, "loc": { "start": { - "line": 303, + "line": 305, "column": 8 }, "end": { - "line": 303, + "line": 305, "column": 13 }, "identifierName": "world" @@ -8550,58 +8550,58 @@ ], "body": { "type": "BlockStatement", - "start": 8136, - "end": 8357, + "start": 8181, + "end": 8402, "loc": { "start": { - "line": 303, + "line": 305, "column": 15 }, "end": { - "line": 311, + "line": 313, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 8140, - "end": 8354, + "start": 8185, + "end": 8399, "loc": { "start": { - "line": 304, + "line": 306, "column": 2 }, "end": { - "line": 310, + "line": 312, "column": 3 } }, "test": { "type": "LogicalExpression", - "start": 8144, - "end": 8166, + "start": 8189, + "end": 8211, "loc": { "start": { - "line": 304, + "line": 306, "column": 6 }, "end": { - "line": 304, + "line": 306, "column": 28 } }, "left": { "type": "Identifier", - "start": 8144, - "end": 8149, + "start": 8189, + "end": 8194, "loc": { "start": { - "line": 304, + "line": 306, "column": 6 }, "end": { - "line": 304, + "line": 306, "column": 11 }, "identifierName": "world" @@ -8611,15 +8611,15 @@ "operator": "&&", "right": { "type": "UnaryExpression", - "start": 8153, - "end": 8166, + "start": 8198, + "end": 8211, "loc": { "start": { - "line": 304, + "line": 306, "column": 15 }, "end": { - "line": 304, + "line": 306, "column": 28 } }, @@ -8627,58 +8627,58 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 8154, - "end": 8166, + "start": 8199, + "end": 8211, "loc": { "start": { - "line": 304, + "line": 306, "column": 16 }, "end": { - "line": 304, + "line": 306, "column": 28 } }, "callee": { "type": "MemberExpression", - "start": 8154, - "end": 8164, + "start": 8199, + "end": 8209, "loc": { "start": { - "line": 304, + "line": 306, "column": 16 }, "end": { - "line": 304, + "line": 306, "column": 26 } }, "object": { "type": "ThisExpression", - "start": 8154, - "end": 8158, + "start": 8199, + "end": 8203, "loc": { "start": { - "line": 304, + "line": 306, "column": 16 }, "end": { - "line": 304, + "line": 306, "column": 20 } } }, "property": { "type": "Identifier", - "start": 8159, - "end": 8164, + "start": 8204, + "end": 8209, "loc": { "start": { - "line": 304, + "line": 306, "column": 21 }, "end": { - "line": 304, + "line": 306, "column": 26 }, "identifierName": "valid" @@ -8696,73 +8696,73 @@ }, "consequent": { "type": "BlockStatement", - "start": 8168, - "end": 8354, + "start": 8213, + "end": 8399, "loc": { "start": { - "line": 304, + "line": 306, "column": 30 }, "end": { - "line": 310, + "line": 312, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 8216, - "end": 8234, + "start": 8261, + "end": 8279, "loc": { "start": { - "line": 306, + "line": 308, "column": 3 }, "end": { - "line": 306, + "line": 308, "column": 21 } }, "expression": { "type": "AssignmentExpression", - "start": 8216, - "end": 8234, + "start": 8261, + "end": 8279, "loc": { "start": { - "line": 306, + "line": 308, "column": 3 }, "end": { - "line": 306, + "line": 308, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 8216, - "end": 8226, + "start": 8261, + "end": 8271, "loc": { "start": { - "line": 306, + "line": 308, "column": 3 }, "end": { - "line": 306, + "line": 308, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 8216, - "end": 8220, + "start": 8261, + "end": 8265, "loc": { "start": { - "line": 306, + "line": 308, "column": 3 }, "end": { - "line": 306, + "line": 308, "column": 7 } }, @@ -8770,15 +8770,15 @@ }, "property": { "type": "Identifier", - "start": 8221, - "end": 8226, + "start": 8266, + "end": 8271, "loc": { "start": { - "line": 306, + "line": 308, "column": 8 }, "end": { - "line": 306, + "line": 308, "column": 13 }, "identifierName": "world" @@ -8790,15 +8790,15 @@ }, "right": { "type": "Identifier", - "start": 8229, - "end": 8234, + "start": 8274, + "end": 8279, "loc": { "start": { - "line": 306, + "line": 308, "column": 16 }, "end": { - "line": 306, + "line": 308, "column": 21 }, "identifierName": "world" @@ -8811,15 +8811,15 @@ { "type": "CommentLine", "value": " Assign new id, and reattach to world", - "start": 8173, - "end": 8212, + "start": 8218, + "end": 8257, "loc": { "start": { - "line": 305, + "line": 307, "column": 3 }, "end": { - "line": 305, + "line": 307, "column": 42 } } @@ -8828,73 +8828,73 @@ }, { "type": "ExpressionStatement", - "start": 8238, - "end": 8271, + "start": 8283, + "end": 8316, "loc": { "start": { - "line": 307, + "line": 309, "column": 3 }, "end": { - "line": 307, + "line": 309, "column": 36 } }, "expression": { "type": "AssignmentExpression", - "start": 8238, - "end": 8271, + "start": 8283, + "end": 8316, "loc": { "start": { - "line": 307, + "line": 309, "column": 3 }, "end": { - "line": 307, + "line": 309, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 8238, - "end": 8246, + "start": 8283, + "end": 8291, "loc": { "start": { - "line": 307, + "line": 309, "column": 3 }, "end": { - "line": 307, + "line": 309, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 8238, - "end": 8242, + "start": 8283, + "end": 8287, "loc": { "start": { - "line": 307, + "line": 309, "column": 3 }, "end": { - "line": 307, + "line": 309, "column": 7 } } }, "property": { "type": "Identifier", - "start": 8243, - "end": 8246, + "start": 8288, + "end": 8291, "loc": { "start": { - "line": 307, + "line": 309, "column": 8 }, "end": { - "line": 307, + "line": 309, "column": 11 }, "identifierName": "_id" @@ -8905,15 +8905,15 @@ }, "right": { "type": "UpdateExpression", - "start": 8249, - "end": 8271, + "start": 8294, + "end": 8316, "loc": { "start": { - "line": 307, + "line": 309, "column": 14 }, "end": { - "line": 307, + "line": 309, "column": 36 } }, @@ -8921,58 +8921,58 @@ "prefix": false, "argument": { "type": "MemberExpression", - "start": 8249, - "end": 8269, + "start": 8294, + "end": 8314, "loc": { "start": { - "line": 307, + "line": 309, "column": 14 }, "end": { - "line": 307, + "line": 309, "column": 34 } }, "object": { "type": "MemberExpression", - "start": 8249, - "end": 8259, + "start": 8294, + "end": 8304, "loc": { "start": { - "line": 307, + "line": 309, "column": 14 }, "end": { - "line": 307, + "line": 309, "column": 24 } }, "object": { "type": "ThisExpression", - "start": 8249, - "end": 8253, + "start": 8294, + "end": 8298, "loc": { "start": { - "line": 307, + "line": 309, "column": 14 }, "end": { - "line": 307, + "line": 309, "column": 18 } } }, "property": { "type": "Identifier", - "start": 8254, - "end": 8259, + "start": 8299, + "end": 8304, "loc": { "start": { - "line": 307, + "line": 309, "column": 19 }, "end": { - "line": 307, + "line": 309, "column": 24 }, "identifierName": "world" @@ -8983,15 +8983,15 @@ }, "property": { "type": "Identifier", - "start": 8260, - "end": 8269, + "start": 8305, + "end": 8314, "loc": { "start": { - "line": 307, + "line": 309, "column": 25 }, "end": { - "line": 307, + "line": 309, "column": 34 }, "identifierName": "idCounter" @@ -9005,100 +9005,100 @@ }, { "type": "ExpressionStatement", - "start": 8275, - "end": 8314, + "start": 8320, + "end": 8359, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 42 } }, "expression": { "type": "CallExpression", - "start": 8275, - "end": 8314, + "start": 8320, + "end": 8359, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 42 } }, "callee": { "type": "MemberExpression", - "start": 8275, - "end": 8298, + "start": 8320, + "end": 8343, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 26 } }, "object": { "type": "MemberExpression", - "start": 8275, - "end": 8294, + "start": 8320, + "end": 8339, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 22 } }, "object": { "type": "MemberExpression", - "start": 8275, - "end": 8285, + "start": 8320, + "end": 8330, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 8275, - "end": 8279, + "start": 8320, + "end": 8324, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 7 } } }, "property": { "type": "Identifier", - "start": 8280, - "end": 8285, + "start": 8325, + "end": 8330, "loc": { "start": { - "line": 308, + "line": 310, "column": 8 }, "end": { - "line": 308, + "line": 310, "column": 13 }, "identifierName": "world" @@ -9109,15 +9109,15 @@ }, "property": { "type": "Identifier", - "start": 8286, - "end": 8294, + "start": 8331, + "end": 8339, "loc": { "start": { - "line": 308, + "line": 310, "column": 14 }, "end": { - "line": 308, + "line": 310, "column": 22 }, "identifierName": "entities" @@ -9128,15 +9128,15 @@ }, "property": { "type": "Identifier", - "start": 8295, - "end": 8298, + "start": 8340, + "end": 8343, "loc": { "start": { - "line": 308, + "line": 310, "column": 23 }, "end": { - "line": 308, + "line": 310, "column": 26 }, "identifierName": "set" @@ -9148,44 +9148,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 8299, - "end": 8307, + "start": 8344, + "end": 8352, "loc": { "start": { - "line": 308, + "line": 310, "column": 27 }, "end": { - "line": 308, + "line": 310, "column": 35 } }, "object": { "type": "ThisExpression", - "start": 8299, - "end": 8303, + "start": 8344, + "end": 8348, "loc": { "start": { - "line": 308, + "line": 310, "column": 27 }, "end": { - "line": 308, + "line": 310, "column": 31 } } }, "property": { "type": "Identifier", - "start": 8304, - "end": 8307, + "start": 8349, + "end": 8352, "loc": { "start": { - "line": 308, + "line": 310, "column": 32 }, "end": { - "line": 308, + "line": 310, "column": 35 }, "identifierName": "_id" @@ -9196,15 +9196,15 @@ }, { "type": "ThisExpression", - "start": 8309, - "end": 8313, + "start": 8354, + "end": 8358, "loc": { "start": { - "line": 308, + "line": 310, "column": 37 }, "end": { - "line": 308, + "line": 310, "column": 41 } } @@ -9214,100 +9214,100 @@ }, { "type": "ExpressionStatement", - "start": 8318, - "end": 8350, + "start": 8363, + "end": 8395, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 35 } }, "expression": { "type": "CallExpression", - "start": 8318, - "end": 8350, + "start": 8363, + "end": 8395, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 35 } }, "callee": { "type": "MemberExpression", - "start": 8318, - "end": 8344, + "start": 8363, + "end": 8389, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 29 } }, "object": { "type": "MemberExpression", - "start": 8318, - "end": 8334, + "start": 8363, + "end": 8379, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 19 } }, "object": { "type": "MemberExpression", - "start": 8318, - "end": 8328, + "start": 8363, + "end": 8373, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 8318, - "end": 8322, + "start": 8363, + "end": 8367, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 7 } } }, "property": { "type": "Identifier", - "start": 8323, - "end": 8328, + "start": 8368, + "end": 8373, "loc": { "start": { - "line": 309, + "line": 311, "column": 8 }, "end": { - "line": 309, + "line": 311, "column": 13 }, "identifierName": "world" @@ -9318,15 +9318,15 @@ }, "property": { "type": "Identifier", - "start": 8329, - "end": 8334, + "start": 8374, + "end": 8379, "loc": { "start": { - "line": 309, + "line": 311, "column": 14 }, "end": { - "line": 309, + "line": 311, "column": 19 }, "identifierName": "index" @@ -9337,15 +9337,15 @@ }, "property": { "type": "Identifier", - "start": 8335, - "end": 8344, + "start": 8380, + "end": 8389, "loc": { "start": { - "line": 309, + "line": 311, "column": 20 }, "end": { - "line": 309, + "line": 311, "column": 29 }, "identifierName": "addEntity" @@ -9357,15 +9357,15 @@ "arguments": [ { "type": "ThisExpression", - "start": 8345, - "end": 8349, + "start": 8390, + "end": 8394, "loc": { "start": { - "line": 309, + "line": 311, "column": 30 }, "end": { - "line": 309, + "line": 311, "column": 34 } } @@ -9386,15 +9386,15 @@ { "type": "CommentBlock", "value": "*\n\t * Attaches a currently detached entity back to a world.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.attach(world)\n\t *\n\t * @param {World} world - The world to attach this entity to\n\t ", - "start": 7795, - "end": 8120, + "start": 7840, + "end": 8165, "loc": { "start": { - "line": 293, + "line": 295, "column": 1 }, "end": { - "line": 302, + "line": 304, "column": 4 } } @@ -9404,15 +9404,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes this entity from the current world, without removing any components or data.\n\t * It can be re-attached to another world (or the same world), using the attach() method.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.detach()\n\t ", - "start": 8360, - "end": 8736, + "start": 8405, + "end": 8781, "loc": { "start": { - "line": 313, + "line": 315, "column": 1 }, "end": { - "line": 321, + "line": 323, "column": 4 } } @@ -9421,15 +9421,15 @@ }, { "type": "ClassMethod", - "start": 8738, - "end": 8938, + "start": 8783, + "end": 8983, "loc": { "start": { - "line": 322, + "line": 324, "column": 1 }, "end": { - "line": 330, + "line": 332, "column": 2 } }, @@ -9437,15 +9437,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 8738, - "end": 8744, + "start": 8783, + "end": 8789, "loc": { "start": { - "line": 322, + "line": 324, "column": 1 }, "end": { - "line": 322, + "line": 324, "column": 7 }, "identifierName": "detach" @@ -9461,87 +9461,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 8747, - "end": 8938, + "start": 8792, + "end": 8983, "loc": { "start": { - "line": 322, + "line": 324, "column": 10 }, "end": { - "line": 330, + "line": 332, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 8751, - "end": 8935, + "start": 8796, + "end": 8980, "loc": { "start": { - "line": 323, + "line": 325, "column": 2 }, "end": { - "line": 329, + "line": 331, "column": 3 } }, "test": { "type": "CallExpression", - "start": 8755, - "end": 8767, + "start": 8800, + "end": 8812, "loc": { "start": { - "line": 323, + "line": 325, "column": 6 }, "end": { - "line": 323, + "line": 325, "column": 18 } }, "callee": { "type": "MemberExpression", - "start": 8755, - "end": 8765, + "start": 8800, + "end": 8810, "loc": { "start": { - "line": 323, + "line": 325, "column": 6 }, "end": { - "line": 323, + "line": 325, "column": 16 } }, "object": { "type": "ThisExpression", - "start": 8755, - "end": 8759, + "start": 8800, + "end": 8804, "loc": { "start": { - "line": 323, + "line": 325, "column": 6 }, "end": { - "line": 323, + "line": 325, "column": 10 } } }, "property": { "type": "Identifier", - "start": 8760, - "end": 8765, + "start": 8805, + "end": 8810, "loc": { "start": { - "line": 323, + "line": 325, "column": 11 }, "end": { - "line": 323, + "line": 325, "column": 16 }, "identifierName": "valid" @@ -9554,100 +9554,100 @@ }, "consequent": { "type": "BlockStatement", - "start": 8769, - "end": 8935, + "start": 8814, + "end": 8980, "loc": { "start": { - "line": 323, + "line": 325, "column": 20 }, "end": { - "line": 329, + "line": 331, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 8806, - "end": 8841, + "start": 8851, + "end": 8886, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 38 } }, "expression": { "type": "CallExpression", - "start": 8806, - "end": 8841, + "start": 8851, + "end": 8886, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 38 } }, "callee": { "type": "MemberExpression", - "start": 8806, - "end": 8835, + "start": 8851, + "end": 8880, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 32 } }, "object": { "type": "MemberExpression", - "start": 8806, - "end": 8822, + "start": 8851, + "end": 8867, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 19 } }, "object": { "type": "MemberExpression", - "start": 8806, - "end": 8816, + "start": 8851, + "end": 8861, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 8806, - "end": 8810, + "start": 8851, + "end": 8855, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 7 } }, @@ -9655,15 +9655,15 @@ }, "property": { "type": "Identifier", - "start": 8811, - "end": 8816, + "start": 8856, + "end": 8861, "loc": { "start": { - "line": 325, + "line": 327, "column": 8 }, "end": { - "line": 325, + "line": 327, "column": 13 }, "identifierName": "world" @@ -9675,15 +9675,15 @@ }, "property": { "type": "Identifier", - "start": 8817, - "end": 8822, + "start": 8862, + "end": 8867, "loc": { "start": { - "line": 325, + "line": 327, "column": 14 }, "end": { - "line": 325, + "line": 327, "column": 19 }, "identifierName": "index" @@ -9695,15 +9695,15 @@ }, "property": { "type": "Identifier", - "start": 8823, - "end": 8835, + "start": 8868, + "end": 8880, "loc": { "start": { - "line": 325, + "line": 327, "column": 20 }, "end": { - "line": 325, + "line": 327, "column": 32 }, "identifierName": "removeEntity" @@ -9716,15 +9716,15 @@ "arguments": [ { "type": "ThisExpression", - "start": 8836, - "end": 8840, + "start": 8881, + "end": 8885, "loc": { "start": { - "line": 325, + "line": 327, "column": 33 }, "end": { - "line": 325, + "line": 327, "column": 37 } } @@ -9736,15 +9736,15 @@ { "type": "CommentLine", "value": " Remove from current world", - "start": 8774, - "end": 8802, + "start": 8819, + "end": 8847, "loc": { "start": { - "line": 324, + "line": 326, "column": 3 }, "end": { - "line": 324, + "line": 326, "column": 31 } } @@ -9753,100 +9753,100 @@ }, { "type": "ExpressionStatement", - "start": 8845, - "end": 8881, + "start": 8890, + "end": 8926, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 39 } }, "expression": { "type": "CallExpression", - "start": 8845, - "end": 8881, + "start": 8890, + "end": 8926, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 39 } }, "callee": { "type": "MemberExpression", - "start": 8845, - "end": 8871, + "start": 8890, + "end": 8916, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 29 } }, "object": { "type": "MemberExpression", - "start": 8845, - "end": 8864, + "start": 8890, + "end": 8909, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 22 } }, "object": { "type": "MemberExpression", - "start": 8845, - "end": 8855, + "start": 8890, + "end": 8900, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 8845, - "end": 8849, + "start": 8890, + "end": 8894, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 7 } } }, "property": { "type": "Identifier", - "start": 8850, - "end": 8855, + "start": 8895, + "end": 8900, "loc": { "start": { - "line": 326, + "line": 328, "column": 8 }, "end": { - "line": 326, + "line": 328, "column": 13 }, "identifierName": "world" @@ -9857,15 +9857,15 @@ }, "property": { "type": "Identifier", - "start": 8856, - "end": 8864, + "start": 8901, + "end": 8909, "loc": { "start": { - "line": 326, + "line": 328, "column": 14 }, "end": { - "line": 326, + "line": 328, "column": 22 }, "identifierName": "entities" @@ -9876,15 +9876,15 @@ }, "property": { "type": "Identifier", - "start": 8865, - "end": 8871, + "start": 8910, + "end": 8916, "loc": { "start": { - "line": 326, + "line": 328, "column": 23 }, "end": { - "line": 326, + "line": 328, "column": 29 }, "identifierName": "delete" @@ -9896,44 +9896,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 8872, - "end": 8880, + "start": 8917, + "end": 8925, "loc": { "start": { - "line": 326, + "line": 328, "column": 30 }, "end": { - "line": 326, + "line": 328, "column": 38 } }, "object": { "type": "ThisExpression", - "start": 8872, - "end": 8876, + "start": 8917, + "end": 8921, "loc": { "start": { - "line": 326, + "line": 328, "column": 30 }, "end": { - "line": 326, + "line": 328, "column": 34 } } }, "property": { "type": "Identifier", - "start": 8877, - "end": 8880, + "start": 8922, + "end": 8925, "loc": { "start": { - "line": 326, + "line": 328, "column": 35 }, "end": { - "line": 326, + "line": 328, "column": 38 }, "identifierName": "_id" @@ -9947,73 +9947,73 @@ }, { "type": "ExpressionStatement", - "start": 8885, - "end": 8905, + "start": 8930, + "end": 8950, "loc": { "start": { - "line": 327, + "line": 329, "column": 3 }, "end": { - "line": 327, + "line": 329, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 8885, - "end": 8905, + "start": 8930, + "end": 8950, "loc": { "start": { - "line": 327, + "line": 329, "column": 3 }, "end": { - "line": 327, + "line": 329, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 8885, - "end": 8893, + "start": 8930, + "end": 8938, "loc": { "start": { - "line": 327, + "line": 329, "column": 3 }, "end": { - "line": 327, + "line": 329, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 8885, - "end": 8889, + "start": 8930, + "end": 8934, "loc": { "start": { - "line": 327, + "line": 329, "column": 3 }, "end": { - "line": 327, + "line": 329, "column": 7 } } }, "property": { "type": "Identifier", - "start": 8890, - "end": 8893, + "start": 8935, + "end": 8938, "loc": { "start": { - "line": 327, + "line": 329, "column": 8 }, "end": { - "line": 327, + "line": 329, "column": 11 }, "identifierName": "_id" @@ -10024,15 +10024,15 @@ }, "right": { "type": "Identifier", - "start": 8896, - "end": 8905, + "start": 8941, + "end": 8950, "loc": { "start": { - "line": 327, + "line": 329, "column": 14 }, "end": { - "line": 327, + "line": 329, "column": 23 }, "identifierName": "undefined" @@ -10043,73 +10043,73 @@ }, { "type": "ExpressionStatement", - "start": 8909, - "end": 8931, + "start": 8954, + "end": 8976, "loc": { "start": { - "line": 328, + "line": 330, "column": 3 }, "end": { - "line": 328, + "line": 330, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 8909, - "end": 8931, + "start": 8954, + "end": 8976, "loc": { "start": { - "line": 328, + "line": 330, "column": 3 }, "end": { - "line": 328, + "line": 330, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 8909, - "end": 8919, + "start": 8954, + "end": 8964, "loc": { "start": { - "line": 328, + "line": 330, "column": 3 }, "end": { - "line": 328, + "line": 330, "column": 13 } }, "object": { "type": "ThisExpression", - "start": 8909, - "end": 8913, + "start": 8954, + "end": 8958, "loc": { "start": { - "line": 328, + "line": 330, "column": 3 }, "end": { - "line": 328, + "line": 330, "column": 7 } } }, "property": { "type": "Identifier", - "start": 8914, - "end": 8919, + "start": 8959, + "end": 8964, "loc": { "start": { - "line": 328, + "line": 330, "column": 8 }, "end": { - "line": 328, + "line": 330, "column": 13 }, "identifierName": "world" @@ -10120,15 +10120,15 @@ }, "right": { "type": "Identifier", - "start": 8922, - "end": 8931, + "start": 8967, + "end": 8976, "loc": { "start": { - "line": 328, + "line": 330, "column": 16 }, "end": { - "line": 328, + "line": 330, "column": 25 }, "identifierName": "undefined" @@ -10149,15 +10149,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes this entity from the current world, without removing any components or data.\n\t * It can be re-attached to another world (or the same world), using the attach() method.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.detach()\n\t ", - "start": 8360, - "end": 8736, + "start": 8405, + "end": 8781, "loc": { "start": { - "line": 313, + "line": 315, "column": 1 }, "end": { - "line": 321, + "line": 323, "column": 4 } } @@ -10187,58 +10187,58 @@ }, { "type": "ExpressionStatement", - "start": 8942, - "end": 8965, + "start": 8987, + "end": 9010, "loc": { "start": { - "line": 333, + "line": 335, "column": 0 }, "end": { - "line": 333, + "line": 335, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 8942, - "end": 8965, + "start": 8987, + "end": 9010, "loc": { "start": { - "line": 333, + "line": 335, "column": 0 }, "end": { - "line": 333, + "line": 335, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 8942, - "end": 8956, + "start": 8987, + "end": 9001, "loc": { "start": { - "line": 333, + "line": 335, "column": 0 }, "end": { - "line": 333, + "line": 335, "column": 14 } }, "object": { "type": "Identifier", - "start": 8942, - "end": 8949, + "start": 8987, + "end": 8994, "loc": { "start": { - "line": 333, + "line": 335, "column": 0 }, "end": { - "line": 333, + "line": 335, "column": 7 }, "identifierName": "exports" @@ -10247,15 +10247,15 @@ }, "property": { "type": "Identifier", - "start": 8950, - "end": 8956, + "start": 8995, + "end": 9001, "loc": { "start": { - "line": 333, + "line": 335, "column": 8 }, "end": { - "line": 333, + "line": 335, "column": 14 }, "identifierName": "Entity" @@ -10266,15 +10266,15 @@ }, "right": { "type": "Identifier", - "start": 8959, - "end": 8965, + "start": 9004, + "end": 9010, "loc": { "start": { - "line": 333, + "line": 335, "column": 17 }, "end": { - "line": 333, + "line": 335, "column": 23 }, "identifierName": "Entity" @@ -10417,16 +10417,16 @@ }, { "type": "CommentBlock", - "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t ", + "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t *\n\t * @throws {Error} Cannot set entity id\n\t ", "start": 794, - "end": 882, + "end": 927, "loc": { "start": { "line": 44, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 4 } } @@ -10434,15 +10434,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if the entity has ALL of the specified component names.\n\t * Additional components that the entity has, which are not specified in has(), will be ignored.\n\t * If no component names are specified, this method returns true.\n\t *\n\t * @example\n\t * if (entity.has('position', 'velocity')) {...}\n\t *\n\t * @param {...string} [components] - The component names to check for\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 944, - "end": 1372, + "start": 989, + "end": 1417, "loc": { "start": { - "line": 53, + "line": 55, "column": 1 }, "end": { - "line": 64, + "line": 66, "column": 4 } } @@ -10450,15 +10450,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name, or undefined if it doesn't exist\n\t *\n\t * @example\n\t * let position = entity.get('position')\n\t *\n\t * @param {string} component - The component name to get\n\t *\n\t * @return {Object} The component if defined, otherwise undefined\n\t ", - "start": 1453, - "end": 1719, + "start": 1498, + "end": 1764, "loc": { "start": { - "line": 69, + "line": 71, "column": 1 }, "end": { - "line": 78, + "line": 80, "column": 4 } } @@ -10466,15 +10466,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name (automatically created if it doesn't exist)\n\t *\n\t * @example\n\t * let position = entity.access('position', 3, 4)\n\t *\n\t * @param {string} component - The component name to create/get\n\t * @param {...Object} [args] - The arguments to forward to create the new component, only if it doesn't exist.\n\t *\n\t * @return {Object} Always returns either the existing component, or the newly created one.\n\t ", - "start": 1773, - "end": 2209, + "start": 1818, + "end": 2254, "loc": { "start": { - "line": 83, + "line": 85, "column": 1 }, "end": { - "line": 93, + "line": 95, "column": 4 } } @@ -10482,15 +10482,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a new component, or re-creates and overwrites an existing component\n\t *\n\t * @example\n\t * entity.set('position', 1, 2)\n\t *\n\t * @example\n\t * entity.set('anonymousComponent', { keys: 'values' })\n\t *\n\t * @example\n\t * entity.set('anotherAnonymousComponent', 'Any type of any value')\n\t *\n\t * @param {string} component - The component name to create. If there is a registered component for this name, then\n\t * its constructor will be called and an object of that type will be created.\n\t * @param {...Object} [args] - The arguments to forward to the registered component type. If the component type is\n\t * registered, then only the first additional argument will be used as the value of the entire component.\n\t *\n\t * @return {Object} The original entity that set() was called on, so that operations can be chained.\n\t ", - "start": 2341, - "end": 3171, + "start": 2386, + "end": 3216, "loc": { "start": { - "line": 101, + "line": 103, "column": 1 }, "end": { - "line": 119, + "line": 121, "column": 4 } } @@ -10498,15 +10498,15 @@ { "type": "CommentLine", "value": " Use defined component template, passing entity as first parameter", - "start": 3262, - "end": 3330, + "start": 3307, + "end": 3375, "loc": { "start": { - "line": 122, + "line": 124, "column": 3 }, "end": { - "line": 122, + "line": 124, "column": 71 } } @@ -10514,15 +10514,15 @@ { "type": "CommentLine", "value": " Use first argument as component value", - "start": 3444, - "end": 3484, + "start": 3489, + "end": 3529, "loc": { "start": { - "line": 125, + "line": 127, "column": 3 }, "end": { - "line": 125, + "line": 127, "column": 43 } } @@ -10530,15 +10530,15 @@ { "type": "CommentLine", "value": " Make an empty object", - "start": 3533, - "end": 3556, + "start": 3578, + "end": 3601, "loc": { "start": { - "line": 128, + "line": 130, "column": 3 }, "end": { - "line": 128, + "line": 130, "column": 26 } } @@ -10546,15 +10546,15 @@ { "type": "CommentLine", "value": " Update the index with this new component", - "start": 3593, - "end": 3636, + "start": 3638, + "end": 3681, "loc": { "start": { - "line": 132, + "line": 134, "column": 2 }, "end": { - "line": 132, + "line": 134, "column": 45 } } @@ -10562,15 +10562,15 @@ { "type": "CommentBlock", "value": "*\n\t * Updates component data from an object or other component. Similar to access() with a shallow merge applied after.\n\t *\n\t * @example\n\t * entity.update('position', { x: 1, y: 2 })\n\t *\n\t * @param {string} component - The component name to update\n\t * @param {Object} data - The object or other component to merge into the specified component.\n\t *\n\t * @return {Object} The original entity that update() was called on, so that operations can be chained.\n\t ", - "start": 3724, - "end": 4188, + "start": 3769, + "end": 4233, "loc": { "start": { - "line": 140, + "line": 142, "column": 1 }, "end": { - "line": 150, + "line": 152, "column": 4 } } @@ -10578,15 +10578,15 @@ { "type": "CommentLine", "value": " Shallow set keys of the component", - "start": 4255, - "end": 4291, + "start": 4300, + "end": 4336, "loc": { "start": { - "line": 154, + "line": 156, "column": 2 }, "end": { - "line": 154, + "line": 156, "column": 38 } } @@ -10594,15 +10594,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes a component from the entity - has no effect when it doesn't exist.\n\t * Can specify an onRemove() method in your component which gets called before it is removed.\n\t * If nothing is specified, then nothing will be removed. Use removeAll() to remove all components.\n\t *\n\t * @example\n\t * entity.remove('position')\n\t *\n\t * @param {...string} [components] - The component names to remove from the entity.\n\t *\n\t * @return {Object} The original entity that remove() was called on, so that operations can be chained.\n\t ", - "start": 4367, - "end": 4895, + "start": 4412, + "end": 4940, "loc": { "start": { - "line": 162, + "line": 164, "column": 1 }, "end": { - "line": 173, + "line": 175, "column": 4 } } @@ -10610,15 +10610,15 @@ { "type": "CommentLine", "value": " Remove from index", - "start": 4997, - "end": 5017, + "start": 5042, + "end": 5062, "loc": { "start": { - "line": 178, + "line": 180, "column": 4 }, "end": { - "line": 178, + "line": 180, "column": 24 } } @@ -10626,15 +10626,15 @@ { "type": "CommentLine", "value": " Call custom onRemove", - "start": 5099, - "end": 5122, + "start": 5144, + "end": 5167, "loc": { "start": { - "line": 183, + "line": 185, "column": 4 }, "end": { - "line": 183, + "line": 185, "column": 27 } } @@ -10642,15 +10642,15 @@ { "type": "CommentLine", "value": " Remove all components", - "start": 5229, - "end": 5253, + "start": 5274, + "end": 5298, "loc": { "start": { - "line": 192, + "line": 194, "column": 1 }, "end": { - "line": 192, + "line": 194, "column": 25 } } @@ -10658,15 +10658,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes all components from the entity.\n\t *\n\t * @example\n\t * entity.removeAll()\n\t *\n\t * @return {Object} The original entity that removeAll() was called on, so that operations can be chained.\n\t ", - "start": 5256, - "end": 5460, + "start": 5301, + "end": 5505, "loc": { "start": { - "line": 194, + "line": 196, "column": 1 }, "end": { - "line": 201, + "line": 203, "column": 4 } } @@ -10674,15 +10674,15 @@ { "type": "CommentBlock", "value": "*\n\t * Remove this entity and all of its components from the world. After an entity is destroyed, the object should be discarded,\n\t * and it is recommended to avoid re-using it.\n\t *\n\t * @example\n\t * entity.destroy()\n\t ", - "start": 5553, - "end": 5774, + "start": 5598, + "end": 5819, "loc": { "start": { - "line": 208, + "line": 210, "column": 1 }, "end": { - "line": 214, + "line": 216, "column": 4 } } @@ -10690,15 +10690,15 @@ { "type": "CommentLine", "value": " Remove from the index, to update match all index", - "start": 5833, - "end": 5884, + "start": 5878, + "end": 5929, "loc": { "start": { - "line": 219, + "line": 221, "column": 3 }, "end": { - "line": 219, + "line": 221, "column": 54 } } @@ -10706,15 +10706,15 @@ { "type": "CommentLine", "value": " Remove from world", - "start": 5922, - "end": 5942, + "start": 5967, + "end": 5987, "loc": { "start": { - "line": 222, + "line": 224, "column": 3 }, "end": { - "line": 222, + "line": 224, "column": 23 } } @@ -10722,15 +10722,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if this is a valid, existing, and usable entity, which is attached to a world.\n\t *\n\t * @example\n\t * if (entity.valid()) {...}\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 6016, - "end": 6207, + "start": 6061, + "end": 6252, "loc": { "start": { - "line": 228, + "line": 230, "column": 1 }, "end": { - "line": 235, + "line": 237, "column": 4 } } @@ -10738,15 +10738,15 @@ { "type": "CommentLine", "value": " Note: No need to actually look in the world for the ID, if entities are only ever copied by reference.", - "start": 6221, - "end": 6326, + "start": 6266, + "end": 6371, "loc": { "start": { - "line": 237, + "line": 239, "column": 2 }, "end": { - "line": 237, + "line": 239, "column": 107 } } @@ -10754,15 +10754,15 @@ { "type": "CommentLine", "value": " If entities are ever deep/shallow copied, this function will need to check this to be more robust.", - "start": 6329, - "end": 6430, + "start": 6374, + "end": 6475, "loc": { "start": { - "line": 238, + "line": 240, "column": 2 }, "end": { - "line": 238, + "line": 240, "column": 103 } } @@ -10770,15 +10770,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns unique entity ID as a string.\n\t *\n\t * @example\n\t * let entityId = entity.toString()\n\t *\n\t * @return {string} String representation of the entity ID.\n\t ", - "start": 6482, - "end": 6651, + "start": 6527, + "end": 6696, "loc": { "start": { - "line": 242, + "line": 244, "column": 1 }, "end": { - "line": 249, + "line": 251, "column": 4 } } @@ -10786,15 +10786,15 @@ { "type": "CommentBlock", "value": "*\n\t * Serializes entire entity and components to JSON.\n\t * Note: Defining toJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * let serializedEntity = entity.toJSON()\n\t *\n\t * @return {string} JSON encoded string\n\t ", - "start": 6697, - "end": 6953, + "start": 6742, + "end": 6998, "loc": { "start": { - "line": 254, + "line": 256, "column": 1 }, "end": { - "line": 262, + "line": 264, "column": 4 } } @@ -10802,15 +10802,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deserializes data from JSON, creating new components and overwriting existing components.\n\t * Note: Defining fromJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * entity.fromJSON(serializedEntity)\n\t *\n\t * @param {string} data - A JSON string containing component data to parse, and store in this entity.\n\t *\n\t * @return {Object} The original entity that fromJSON() was called on, so that operations can be chained.\n\t ", - "start": 7006, - "end": 7473, + "start": 7051, + "end": 7518, "loc": { "start": { - "line": 267, + "line": 269, "column": 1 }, "end": { - "line": 277, + "line": 279, "column": 4 } } @@ -10818,15 +10818,15 @@ { "type": "CommentLine", "value": " Either call custom method or copy all properties", - "start": 7589, - "end": 7640, + "start": 7634, + "end": 7685, "loc": { "start": { - "line": 283, + "line": 285, "column": 3 }, "end": { - "line": 283, + "line": 285, "column": 54 } } @@ -10834,15 +10834,15 @@ { "type": "CommentBlock", "value": "*\n\t * Attaches a currently detached entity back to a world.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.attach(world)\n\t *\n\t * @param {World} world - The world to attach this entity to\n\t ", - "start": 7795, - "end": 8120, + "start": 7840, + "end": 8165, "loc": { "start": { - "line": 293, + "line": 295, "column": 1 }, "end": { - "line": 302, + "line": 304, "column": 4 } } @@ -10850,15 +10850,15 @@ { "type": "CommentLine", "value": " Assign new id, and reattach to world", - "start": 8173, - "end": 8212, + "start": 8218, + "end": 8257, "loc": { "start": { - "line": 305, + "line": 307, "column": 3 }, "end": { - "line": 305, + "line": 307, "column": 42 } } @@ -10866,15 +10866,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes this entity from the current world, without removing any components or data.\n\t * It can be re-attached to another world (or the same world), using the attach() method.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.detach()\n\t ", - "start": 8360, - "end": 8736, + "start": 8405, + "end": 8781, "loc": { "start": { - "line": 313, + "line": 315, "column": 1 }, "end": { - "line": 321, + "line": 323, "column": 4 } } @@ -10882,15 +10882,15 @@ { "type": "CommentLine", "value": " Remove from current world", - "start": 8774, - "end": 8802, + "start": 8819, + "end": 8847, "loc": { "start": { - "line": 324, + "line": 326, "column": 3 }, "end": { - "line": 324, + "line": 326, "column": 31 } } @@ -12747,16 +12747,16 @@ }, { "type": "CommentBlock", - "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t ", + "value": "*\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t *\n\t * @throws {Error} Cannot set entity id\n\t ", "start": 794, - "end": 882, + "end": 927, "loc": { "start": { "line": 44, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 4 } } @@ -12774,15 +12774,15 @@ "binop": null }, "value": "set", - "start": 884, - "end": 887, + "start": 929, + "end": 932, "loc": { "start": { - "line": 49, + "line": 51, "column": 1 }, "end": { - "line": 49, + "line": 51, "column": 4 } } @@ -12800,15 +12800,15 @@ "binop": null }, "value": "id", - "start": 888, - "end": 890, + "start": 933, + "end": 935, "loc": { "start": { - "line": 49, + "line": 51, "column": 5 }, "end": { - "line": 49, + "line": 51, "column": 7 } } @@ -12825,15 +12825,15 @@ "postfix": false, "binop": null }, - "start": 890, - "end": 891, + "start": 935, + "end": 936, "loc": { "start": { - "line": 49, + "line": 51, "column": 7 }, "end": { - "line": 49, + "line": 51, "column": 8 } } @@ -12851,15 +12851,15 @@ "binop": null }, "value": "id", - "start": 891, - "end": 893, + "start": 936, + "end": 938, "loc": { "start": { - "line": 49, + "line": 51, "column": 8 }, "end": { - "line": 49, + "line": 51, "column": 10 } } @@ -12876,15 +12876,15 @@ "postfix": false, "binop": null }, - "start": 893, - "end": 894, + "start": 938, + "end": 939, "loc": { "start": { - "line": 49, + "line": 51, "column": 10 }, "end": { - "line": 49, + "line": 51, "column": 11 } } @@ -12901,15 +12901,15 @@ "postfix": false, "binop": null }, - "start": 895, - "end": 896, + "start": 940, + "end": 941, "loc": { "start": { - "line": 49, + "line": 51, "column": 12 }, "end": { - "line": 49, + "line": 51, "column": 13 } } @@ -12929,15 +12929,15 @@ "updateContext": null }, "value": "throw", - "start": 899, - "end": 904, + "start": 944, + "end": 949, "loc": { "start": { - "line": 50, + "line": 52, "column": 2 }, "end": { - "line": 50, + "line": 52, "column": 7 } } @@ -12957,15 +12957,15 @@ "updateContext": null }, "value": "new", - "start": 905, - "end": 908, + "start": 950, + "end": 953, "loc": { "start": { - "line": 50, + "line": 52, "column": 8 }, "end": { - "line": 50, + "line": 52, "column": 11 } } @@ -12983,15 +12983,15 @@ "binop": null }, "value": "Error", - "start": 909, - "end": 914, + "start": 954, + "end": 959, "loc": { "start": { - "line": 50, + "line": 52, "column": 12 }, "end": { - "line": 50, + "line": 52, "column": 17 } } @@ -13008,15 +13008,15 @@ "postfix": false, "binop": null }, - "start": 914, - "end": 915, + "start": 959, + "end": 960, "loc": { "start": { - "line": 50, + "line": 52, "column": 17 }, "end": { - "line": 50, + "line": 52, "column": 18 } } @@ -13035,15 +13035,15 @@ "updateContext": null }, "value": "Cannot set entity id", - "start": 915, - "end": 937, + "start": 960, + "end": 982, "loc": { "start": { - "line": 50, + "line": 52, "column": 18 }, "end": { - "line": 50, + "line": 52, "column": 40 } } @@ -13060,15 +13060,15 @@ "postfix": false, "binop": null }, - "start": 937, - "end": 938, + "start": 982, + "end": 983, "loc": { "start": { - "line": 50, + "line": 52, "column": 40 }, "end": { - "line": 50, + "line": 52, "column": 41 } } @@ -13085,15 +13085,15 @@ "postfix": false, "binop": null }, - "start": 940, - "end": 941, + "start": 985, + "end": 986, "loc": { "start": { - "line": 51, + "line": 53, "column": 1 }, "end": { - "line": 51, + "line": 53, "column": 2 } } @@ -13101,15 +13101,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if the entity has ALL of the specified component names.\n\t * Additional components that the entity has, which are not specified in has(), will be ignored.\n\t * If no component names are specified, this method returns true.\n\t *\n\t * @example\n\t * if (entity.has('position', 'velocity')) {...}\n\t *\n\t * @param {...string} [components] - The component names to check for\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 944, - "end": 1372, + "start": 989, + "end": 1417, "loc": { "start": { - "line": 53, + "line": 55, "column": 1 }, "end": { - "line": 64, + "line": 66, "column": 4 } } @@ -13127,15 +13127,15 @@ "binop": null }, "value": "has", - "start": 1374, - "end": 1377, + "start": 1419, + "end": 1422, "loc": { "start": { - "line": 65, + "line": 67, "column": 1 }, "end": { - "line": 65, + "line": 67, "column": 4 } } @@ -13152,15 +13152,15 @@ "postfix": false, "binop": null }, - "start": 1377, - "end": 1378, + "start": 1422, + "end": 1423, "loc": { "start": { - "line": 65, + "line": 67, "column": 4 }, "end": { - "line": 65, + "line": 67, "column": 5 } } @@ -13178,15 +13178,15 @@ "binop": null, "updateContext": null }, - "start": 1378, - "end": 1381, + "start": 1423, + "end": 1426, "loc": { "start": { - "line": 65, + "line": 67, "column": 5 }, "end": { - "line": 65, + "line": 67, "column": 8 } } @@ -13204,15 +13204,15 @@ "binop": null }, "value": "components", - "start": 1381, - "end": 1391, + "start": 1426, + "end": 1436, "loc": { "start": { - "line": 65, + "line": 67, "column": 8 }, "end": { - "line": 65, + "line": 67, "column": 18 } } @@ -13229,15 +13229,15 @@ "postfix": false, "binop": null }, - "start": 1391, - "end": 1392, + "start": 1436, + "end": 1437, "loc": { "start": { - "line": 65, + "line": 67, "column": 18 }, "end": { - "line": 65, + "line": 67, "column": 19 } } @@ -13254,15 +13254,15 @@ "postfix": false, "binop": null }, - "start": 1393, - "end": 1394, + "start": 1438, + "end": 1439, "loc": { "start": { - "line": 65, + "line": 67, "column": 20 }, "end": { - "line": 65, + "line": 67, "column": 21 } } @@ -13282,15 +13282,15 @@ "updateContext": null }, "value": "return", - "start": 1397, - "end": 1403, + "start": 1442, + "end": 1448, "loc": { "start": { - "line": 66, + "line": 68, "column": 2 }, "end": { - "line": 66, + "line": 68, "column": 8 } } @@ -13308,15 +13308,15 @@ "binop": null }, "value": "components", - "start": 1404, - "end": 1414, + "start": 1449, + "end": 1459, "loc": { "start": { - "line": 66, + "line": 68, "column": 9 }, "end": { - "line": 66, + "line": 68, "column": 19 } } @@ -13334,15 +13334,15 @@ "binop": null, "updateContext": null }, - "start": 1414, - "end": 1415, + "start": 1459, + "end": 1460, "loc": { "start": { - "line": 66, + "line": 68, "column": 19 }, "end": { - "line": 66, + "line": 68, "column": 20 } } @@ -13360,15 +13360,15 @@ "binop": null }, "value": "every", - "start": 1415, - "end": 1420, + "start": 1460, + "end": 1465, "loc": { "start": { - "line": 66, + "line": 68, "column": 20 }, "end": { - "line": 66, + "line": 68, "column": 25 } } @@ -13385,15 +13385,15 @@ "postfix": false, "binop": null }, - "start": 1420, - "end": 1421, + "start": 1465, + "end": 1466, "loc": { "start": { - "line": 66, + "line": 68, "column": 25 }, "end": { - "line": 66, + "line": 68, "column": 26 } } @@ -13411,15 +13411,15 @@ "binop": null }, "value": "name", - "start": 1421, - "end": 1425, + "start": 1466, + "end": 1470, "loc": { "start": { - "line": 66, + "line": 68, "column": 26 }, "end": { - "line": 66, + "line": 68, "column": 30 } } @@ -13437,15 +13437,15 @@ "binop": null, "updateContext": null }, - "start": 1426, - "end": 1428, + "start": 1471, + "end": 1473, "loc": { "start": { - "line": 66, + "line": 68, "column": 31 }, "end": { - "line": 66, + "line": 68, "column": 33 } } @@ -13463,15 +13463,15 @@ "binop": null }, "value": "name", - "start": 1429, - "end": 1433, + "start": 1474, + "end": 1478, "loc": { "start": { - "line": 66, + "line": 68, "column": 34 }, "end": { - "line": 66, + "line": 68, "column": 38 } } @@ -13491,15 +13491,15 @@ "updateContext": null }, "value": "in", - "start": 1434, - "end": 1436, + "start": 1479, + "end": 1481, "loc": { "start": { - "line": 66, + "line": 68, "column": 39 }, "end": { - "line": 66, + "line": 68, "column": 41 } } @@ -13519,15 +13519,15 @@ "updateContext": null }, "value": "this", - "start": 1437, - "end": 1441, + "start": 1482, + "end": 1486, "loc": { "start": { - "line": 66, + "line": 68, "column": 42 }, "end": { - "line": 66, + "line": 68, "column": 46 } } @@ -13545,15 +13545,15 @@ "binop": null, "updateContext": null }, - "start": 1441, - "end": 1442, + "start": 1486, + "end": 1487, "loc": { "start": { - "line": 66, + "line": 68, "column": 46 }, "end": { - "line": 66, + "line": 68, "column": 47 } } @@ -13571,15 +13571,15 @@ "binop": null }, "value": "data", - "start": 1442, - "end": 1446, + "start": 1487, + "end": 1491, "loc": { "start": { - "line": 66, + "line": 68, "column": 47 }, "end": { - "line": 66, + "line": 68, "column": 51 } } @@ -13596,15 +13596,15 @@ "postfix": false, "binop": null }, - "start": 1446, - "end": 1447, + "start": 1491, + "end": 1492, "loc": { "start": { - "line": 66, + "line": 68, "column": 51 }, "end": { - "line": 66, + "line": 68, "column": 52 } } @@ -13621,15 +13621,15 @@ "postfix": false, "binop": null }, - "start": 1449, - "end": 1450, + "start": 1494, + "end": 1495, "loc": { "start": { - "line": 67, + "line": 69, "column": 1 }, "end": { - "line": 67, + "line": 69, "column": 2 } } @@ -13637,15 +13637,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name, or undefined if it doesn't exist\n\t *\n\t * @example\n\t * let position = entity.get('position')\n\t *\n\t * @param {string} component - The component name to get\n\t *\n\t * @return {Object} The component if defined, otherwise undefined\n\t ", - "start": 1453, - "end": 1719, + "start": 1498, + "end": 1764, "loc": { "start": { - "line": 69, + "line": 71, "column": 1 }, "end": { - "line": 78, + "line": 80, "column": 4 } } @@ -13663,15 +13663,15 @@ "binop": null }, "value": "get", - "start": 1721, - "end": 1724, + "start": 1766, + "end": 1769, "loc": { "start": { - "line": 79, + "line": 81, "column": 1 }, "end": { - "line": 79, + "line": 81, "column": 4 } } @@ -13688,15 +13688,15 @@ "postfix": false, "binop": null }, - "start": 1724, - "end": 1725, + "start": 1769, + "end": 1770, "loc": { "start": { - "line": 79, + "line": 81, "column": 4 }, "end": { - "line": 79, + "line": 81, "column": 5 } } @@ -13714,15 +13714,15 @@ "binop": null }, "value": "component", - "start": 1725, - "end": 1734, + "start": 1770, + "end": 1779, "loc": { "start": { - "line": 79, + "line": 81, "column": 5 }, "end": { - "line": 79, + "line": 81, "column": 14 } } @@ -13739,15 +13739,15 @@ "postfix": false, "binop": null }, - "start": 1734, - "end": 1735, + "start": 1779, + "end": 1780, "loc": { "start": { - "line": 79, + "line": 81, "column": 14 }, "end": { - "line": 79, + "line": 81, "column": 15 } } @@ -13764,15 +13764,15 @@ "postfix": false, "binop": null }, - "start": 1736, - "end": 1737, + "start": 1781, + "end": 1782, "loc": { "start": { - "line": 79, + "line": 81, "column": 16 }, "end": { - "line": 79, + "line": 81, "column": 17 } } @@ -13792,15 +13792,15 @@ "updateContext": null }, "value": "return", - "start": 1740, - "end": 1746, + "start": 1785, + "end": 1791, "loc": { "start": { - "line": 80, + "line": 82, "column": 2 }, "end": { - "line": 80, + "line": 82, "column": 8 } } @@ -13820,15 +13820,15 @@ "updateContext": null }, "value": "this", - "start": 1747, - "end": 1751, + "start": 1792, + "end": 1796, "loc": { "start": { - "line": 80, + "line": 82, "column": 9 }, "end": { - "line": 80, + "line": 82, "column": 13 } } @@ -13846,15 +13846,15 @@ "binop": null, "updateContext": null }, - "start": 1751, - "end": 1752, + "start": 1796, + "end": 1797, "loc": { "start": { - "line": 80, + "line": 82, "column": 13 }, "end": { - "line": 80, + "line": 82, "column": 14 } } @@ -13872,15 +13872,15 @@ "binop": null }, "value": "data", - "start": 1752, - "end": 1756, + "start": 1797, + "end": 1801, "loc": { "start": { - "line": 80, + "line": 82, "column": 14 }, "end": { - "line": 80, + "line": 82, "column": 18 } } @@ -13898,15 +13898,15 @@ "binop": null, "updateContext": null }, - "start": 1756, - "end": 1757, + "start": 1801, + "end": 1802, "loc": { "start": { - "line": 80, + "line": 82, "column": 18 }, "end": { - "line": 80, + "line": 82, "column": 19 } } @@ -13924,15 +13924,15 @@ "binop": null }, "value": "component", - "start": 1757, - "end": 1766, + "start": 1802, + "end": 1811, "loc": { "start": { - "line": 80, + "line": 82, "column": 19 }, "end": { - "line": 80, + "line": 82, "column": 28 } } @@ -13950,15 +13950,15 @@ "binop": null, "updateContext": null }, - "start": 1766, - "end": 1767, + "start": 1811, + "end": 1812, "loc": { "start": { - "line": 80, + "line": 82, "column": 28 }, "end": { - "line": 80, + "line": 82, "column": 29 } } @@ -13975,15 +13975,15 @@ "postfix": false, "binop": null }, - "start": 1769, - "end": 1770, + "start": 1814, + "end": 1815, "loc": { "start": { - "line": 81, + "line": 83, "column": 1 }, "end": { - "line": 81, + "line": 83, "column": 2 } } @@ -13991,15 +13991,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns a component by name (automatically created if it doesn't exist)\n\t *\n\t * @example\n\t * let position = entity.access('position', 3, 4)\n\t *\n\t * @param {string} component - The component name to create/get\n\t * @param {...Object} [args] - The arguments to forward to create the new component, only if it doesn't exist.\n\t *\n\t * @return {Object} Always returns either the existing component, or the newly created one.\n\t ", - "start": 1773, - "end": 2209, + "start": 1818, + "end": 2254, "loc": { "start": { - "line": 83, + "line": 85, "column": 1 }, "end": { - "line": 93, + "line": 95, "column": 4 } } @@ -14017,15 +14017,15 @@ "binop": null }, "value": "access", - "start": 2211, - "end": 2217, + "start": 2256, + "end": 2262, "loc": { "start": { - "line": 94, + "line": 96, "column": 1 }, "end": { - "line": 94, + "line": 96, "column": 7 } } @@ -14042,15 +14042,15 @@ "postfix": false, "binop": null }, - "start": 2217, - "end": 2218, + "start": 2262, + "end": 2263, "loc": { "start": { - "line": 94, + "line": 96, "column": 7 }, "end": { - "line": 94, + "line": 96, "column": 8 } } @@ -14068,15 +14068,15 @@ "binop": null }, "value": "component", - "start": 2218, - "end": 2227, + "start": 2263, + "end": 2272, "loc": { "start": { - "line": 94, + "line": 96, "column": 8 }, "end": { - "line": 94, + "line": 96, "column": 17 } } @@ -14094,15 +14094,15 @@ "binop": null, "updateContext": null }, - "start": 2227, - "end": 2228, + "start": 2272, + "end": 2273, "loc": { "start": { - "line": 94, + "line": 96, "column": 17 }, "end": { - "line": 94, + "line": 96, "column": 18 } } @@ -14120,15 +14120,15 @@ "binop": null, "updateContext": null }, - "start": 2229, - "end": 2232, + "start": 2274, + "end": 2277, "loc": { "start": { - "line": 94, + "line": 96, "column": 19 }, "end": { - "line": 94, + "line": 96, "column": 22 } } @@ -14146,15 +14146,15 @@ "binop": null }, "value": "args", - "start": 2232, - "end": 2236, + "start": 2277, + "end": 2281, "loc": { "start": { - "line": 94, + "line": 96, "column": 22 }, "end": { - "line": 94, + "line": 96, "column": 26 } } @@ -14171,15 +14171,15 @@ "postfix": false, "binop": null }, - "start": 2236, - "end": 2237, + "start": 2281, + "end": 2282, "loc": { "start": { - "line": 94, + "line": 96, "column": 26 }, "end": { - "line": 94, + "line": 96, "column": 27 } } @@ -14196,15 +14196,15 @@ "postfix": false, "binop": null }, - "start": 2238, - "end": 2239, + "start": 2283, + "end": 2284, "loc": { "start": { - "line": 94, + "line": 96, "column": 28 }, "end": { - "line": 94, + "line": 96, "column": 29 } } @@ -14224,15 +14224,15 @@ "updateContext": null }, "value": "if", - "start": 2242, - "end": 2244, + "start": 2287, + "end": 2289, "loc": { "start": { - "line": 95, + "line": 97, "column": 2 }, "end": { - "line": 95, + "line": 97, "column": 4 } } @@ -14249,15 +14249,15 @@ "postfix": false, "binop": null }, - "start": 2245, - "end": 2246, + "start": 2290, + "end": 2291, "loc": { "start": { - "line": 95, + "line": 97, "column": 5 }, "end": { - "line": 95, + "line": 97, "column": 6 } } @@ -14276,15 +14276,15 @@ "updateContext": null }, "value": "!", - "start": 2246, - "end": 2247, + "start": 2291, + "end": 2292, "loc": { "start": { - "line": 95, + "line": 97, "column": 6 }, "end": { - "line": 95, + "line": 97, "column": 7 } } @@ -14304,15 +14304,15 @@ "updateContext": null }, "value": "this", - "start": 2247, - "end": 2251, + "start": 2292, + "end": 2296, "loc": { "start": { - "line": 95, + "line": 97, "column": 7 }, "end": { - "line": 95, + "line": 97, "column": 11 } } @@ -14330,15 +14330,15 @@ "binop": null, "updateContext": null }, - "start": 2251, - "end": 2252, + "start": 2296, + "end": 2297, "loc": { "start": { - "line": 95, + "line": 97, "column": 11 }, "end": { - "line": 95, + "line": 97, "column": 12 } } @@ -14356,15 +14356,15 @@ "binop": null }, "value": "has", - "start": 2252, - "end": 2255, + "start": 2297, + "end": 2300, "loc": { "start": { - "line": 95, + "line": 97, "column": 12 }, "end": { - "line": 95, + "line": 97, "column": 15 } } @@ -14381,15 +14381,15 @@ "postfix": false, "binop": null }, - "start": 2255, - "end": 2256, + "start": 2300, + "end": 2301, "loc": { "start": { - "line": 95, + "line": 97, "column": 15 }, "end": { - "line": 95, + "line": 97, "column": 16 } } @@ -14407,15 +14407,15 @@ "binop": null }, "value": "component", - "start": 2256, - "end": 2265, + "start": 2301, + "end": 2310, "loc": { "start": { - "line": 95, + "line": 97, "column": 16 }, "end": { - "line": 95, + "line": 97, "column": 25 } } @@ -14432,15 +14432,15 @@ "postfix": false, "binop": null }, - "start": 2265, - "end": 2266, + "start": 2310, + "end": 2311, "loc": { "start": { - "line": 95, + "line": 97, "column": 25 }, "end": { - "line": 95, + "line": 97, "column": 26 } } @@ -14457,15 +14457,15 @@ "postfix": false, "binop": null }, - "start": 2266, - "end": 2267, + "start": 2311, + "end": 2312, "loc": { "start": { - "line": 95, + "line": 97, "column": 26 }, "end": { - "line": 95, + "line": 97, "column": 27 } } @@ -14482,15 +14482,15 @@ "postfix": false, "binop": null }, - "start": 2268, - "end": 2269, + "start": 2313, + "end": 2314, "loc": { "start": { - "line": 95, + "line": 97, "column": 28 }, "end": { - "line": 95, + "line": 97, "column": 29 } } @@ -14510,15 +14510,15 @@ "updateContext": null }, "value": "this", - "start": 2273, - "end": 2277, + "start": 2318, + "end": 2322, "loc": { "start": { - "line": 96, + "line": 98, "column": 3 }, "end": { - "line": 96, + "line": 98, "column": 7 } } @@ -14536,15 +14536,15 @@ "binop": null, "updateContext": null }, - "start": 2277, - "end": 2278, + "start": 2322, + "end": 2323, "loc": { "start": { - "line": 96, + "line": 98, "column": 7 }, "end": { - "line": 96, + "line": 98, "column": 8 } } @@ -14562,15 +14562,15 @@ "binop": null }, "value": "set", - "start": 2278, - "end": 2281, + "start": 2323, + "end": 2326, "loc": { "start": { - "line": 96, + "line": 98, "column": 8 }, "end": { - "line": 96, + "line": 98, "column": 11 } } @@ -14587,15 +14587,15 @@ "postfix": false, "binop": null }, - "start": 2281, - "end": 2282, + "start": 2326, + "end": 2327, "loc": { "start": { - "line": 96, + "line": 98, "column": 11 }, "end": { - "line": 96, + "line": 98, "column": 12 } } @@ -14613,15 +14613,15 @@ "binop": null }, "value": "component", - "start": 2282, - "end": 2291, + "start": 2327, + "end": 2336, "loc": { "start": { - "line": 96, + "line": 98, "column": 12 }, "end": { - "line": 96, + "line": 98, "column": 21 } } @@ -14639,15 +14639,15 @@ "binop": null, "updateContext": null }, - "start": 2291, - "end": 2292, + "start": 2336, + "end": 2337, "loc": { "start": { - "line": 96, + "line": 98, "column": 21 }, "end": { - "line": 96, + "line": 98, "column": 22 } } @@ -14665,15 +14665,15 @@ "binop": null, "updateContext": null }, - "start": 2293, - "end": 2296, + "start": 2338, + "end": 2341, "loc": { "start": { - "line": 96, + "line": 98, "column": 23 }, "end": { - "line": 96, + "line": 98, "column": 26 } } @@ -14691,15 +14691,15 @@ "binop": null }, "value": "args", - "start": 2296, - "end": 2300, + "start": 2341, + "end": 2345, "loc": { "start": { - "line": 96, + "line": 98, "column": 26 }, "end": { - "line": 96, + "line": 98, "column": 30 } } @@ -14716,15 +14716,15 @@ "postfix": false, "binop": null }, - "start": 2300, - "end": 2301, + "start": 2345, + "end": 2346, "loc": { "start": { - "line": 96, + "line": 98, "column": 30 }, "end": { - "line": 96, + "line": 98, "column": 31 } } @@ -14741,15 +14741,15 @@ "postfix": false, "binop": null }, - "start": 2304, - "end": 2305, + "start": 2349, + "end": 2350, "loc": { "start": { - "line": 97, + "line": 99, "column": 2 }, "end": { - "line": 97, + "line": 99, "column": 3 } } @@ -14769,15 +14769,15 @@ "updateContext": null }, "value": "return", - "start": 2308, - "end": 2314, + "start": 2353, + "end": 2359, "loc": { "start": { - "line": 98, + "line": 100, "column": 2 }, "end": { - "line": 98, + "line": 100, "column": 8 } } @@ -14797,15 +14797,15 @@ "updateContext": null }, "value": "this", - "start": 2315, - "end": 2319, + "start": 2360, + "end": 2364, "loc": { "start": { - "line": 98, + "line": 100, "column": 9 }, "end": { - "line": 98, + "line": 100, "column": 13 } } @@ -14823,15 +14823,15 @@ "binop": null, "updateContext": null }, - "start": 2319, - "end": 2320, + "start": 2364, + "end": 2365, "loc": { "start": { - "line": 98, + "line": 100, "column": 13 }, "end": { - "line": 98, + "line": 100, "column": 14 } } @@ -14849,15 +14849,15 @@ "binop": null }, "value": "data", - "start": 2320, - "end": 2324, + "start": 2365, + "end": 2369, "loc": { "start": { - "line": 98, + "line": 100, "column": 14 }, "end": { - "line": 98, + "line": 100, "column": 18 } } @@ -14875,15 +14875,15 @@ "binop": null, "updateContext": null }, - "start": 2324, - "end": 2325, + "start": 2369, + "end": 2370, "loc": { "start": { - "line": 98, + "line": 100, "column": 18 }, "end": { - "line": 98, + "line": 100, "column": 19 } } @@ -14901,15 +14901,15 @@ "binop": null }, "value": "component", - "start": 2325, - "end": 2334, + "start": 2370, + "end": 2379, "loc": { "start": { - "line": 98, + "line": 100, "column": 19 }, "end": { - "line": 98, + "line": 100, "column": 28 } } @@ -14927,15 +14927,15 @@ "binop": null, "updateContext": null }, - "start": 2334, - "end": 2335, + "start": 2379, + "end": 2380, "loc": { "start": { - "line": 98, + "line": 100, "column": 28 }, "end": { - "line": 98, + "line": 100, "column": 29 } } @@ -14952,15 +14952,15 @@ "postfix": false, "binop": null }, - "start": 2337, - "end": 2338, + "start": 2382, + "end": 2383, "loc": { "start": { - "line": 99, + "line": 101, "column": 1 }, "end": { - "line": 99, + "line": 101, "column": 2 } } @@ -14968,15 +14968,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a new component, or re-creates and overwrites an existing component\n\t *\n\t * @example\n\t * entity.set('position', 1, 2)\n\t *\n\t * @example\n\t * entity.set('anonymousComponent', { keys: 'values' })\n\t *\n\t * @example\n\t * entity.set('anotherAnonymousComponent', 'Any type of any value')\n\t *\n\t * @param {string} component - The component name to create. If there is a registered component for this name, then\n\t * its constructor will be called and an object of that type will be created.\n\t * @param {...Object} [args] - The arguments to forward to the registered component type. If the component type is\n\t * registered, then only the first additional argument will be used as the value of the entire component.\n\t *\n\t * @return {Object} The original entity that set() was called on, so that operations can be chained.\n\t ", - "start": 2341, - "end": 3171, + "start": 2386, + "end": 3216, "loc": { "start": { - "line": 101, + "line": 103, "column": 1 }, "end": { - "line": 119, + "line": 121, "column": 4 } } @@ -14994,15 +14994,15 @@ "binop": null }, "value": "set", - "start": 3173, - "end": 3176, + "start": 3218, + "end": 3221, "loc": { "start": { - "line": 120, + "line": 122, "column": 1 }, "end": { - "line": 120, + "line": 122, "column": 4 } } @@ -15019,15 +15019,15 @@ "postfix": false, "binop": null }, - "start": 3176, - "end": 3177, + "start": 3221, + "end": 3222, "loc": { "start": { - "line": 120, + "line": 122, "column": 4 }, "end": { - "line": 120, + "line": 122, "column": 5 } } @@ -15045,15 +15045,15 @@ "binop": null }, "value": "component", - "start": 3177, - "end": 3186, + "start": 3222, + "end": 3231, "loc": { "start": { - "line": 120, + "line": 122, "column": 5 }, "end": { - "line": 120, + "line": 122, "column": 14 } } @@ -15071,15 +15071,15 @@ "binop": null, "updateContext": null }, - "start": 3186, - "end": 3187, + "start": 3231, + "end": 3232, "loc": { "start": { - "line": 120, + "line": 122, "column": 14 }, "end": { - "line": 120, + "line": 122, "column": 15 } } @@ -15097,15 +15097,15 @@ "binop": null, "updateContext": null }, - "start": 3188, - "end": 3191, + "start": 3233, + "end": 3236, "loc": { "start": { - "line": 120, + "line": 122, "column": 16 }, "end": { - "line": 120, + "line": 122, "column": 19 } } @@ -15123,15 +15123,15 @@ "binop": null }, "value": "args", - "start": 3191, - "end": 3195, + "start": 3236, + "end": 3240, "loc": { "start": { - "line": 120, + "line": 122, "column": 19 }, "end": { - "line": 120, + "line": 122, "column": 23 } } @@ -15148,15 +15148,15 @@ "postfix": false, "binop": null }, - "start": 3195, - "end": 3196, + "start": 3240, + "end": 3241, "loc": { "start": { - "line": 120, + "line": 122, "column": 23 }, "end": { - "line": 120, + "line": 122, "column": 24 } } @@ -15173,15 +15173,15 @@ "postfix": false, "binop": null }, - "start": 3197, - "end": 3198, + "start": 3242, + "end": 3243, "loc": { "start": { - "line": 120, + "line": 122, "column": 25 }, "end": { - "line": 120, + "line": 122, "column": 26 } } @@ -15201,15 +15201,15 @@ "updateContext": null }, "value": "if", - "start": 3201, - "end": 3203, + "start": 3246, + "end": 3248, "loc": { "start": { - "line": 121, + "line": 123, "column": 2 }, "end": { - "line": 121, + "line": 123, "column": 4 } } @@ -15226,15 +15226,15 @@ "postfix": false, "binop": null }, - "start": 3204, - "end": 3205, + "start": 3249, + "end": 3250, "loc": { "start": { - "line": 121, + "line": 123, "column": 5 }, "end": { - "line": 121, + "line": 123, "column": 6 } } @@ -15254,15 +15254,15 @@ "updateContext": null }, "value": "this", - "start": 3205, - "end": 3209, + "start": 3250, + "end": 3254, "loc": { "start": { - "line": 121, + "line": 123, "column": 6 }, "end": { - "line": 121, + "line": 123, "column": 10 } } @@ -15280,15 +15280,15 @@ "binop": null, "updateContext": null }, - "start": 3209, - "end": 3210, + "start": 3254, + "end": 3255, "loc": { "start": { - "line": 121, + "line": 123, "column": 10 }, "end": { - "line": 121, + "line": 123, "column": 11 } } @@ -15306,15 +15306,15 @@ "binop": null }, "value": "valid", - "start": 3210, - "end": 3215, + "start": 3255, + "end": 3260, "loc": { "start": { - "line": 121, + "line": 123, "column": 11 }, "end": { - "line": 121, + "line": 123, "column": 16 } } @@ -15331,15 +15331,15 @@ "postfix": false, "binop": null }, - "start": 3215, - "end": 3216, + "start": 3260, + "end": 3261, "loc": { "start": { - "line": 121, + "line": 123, "column": 16 }, "end": { - "line": 121, + "line": 123, "column": 17 } } @@ -15356,15 +15356,15 @@ "postfix": false, "binop": null }, - "start": 3216, - "end": 3217, + "start": 3261, + "end": 3262, "loc": { "start": { - "line": 121, + "line": 123, "column": 17 }, "end": { - "line": 121, + "line": 123, "column": 18 } } @@ -15383,15 +15383,15 @@ "updateContext": null }, "value": "&&", - "start": 3218, - "end": 3220, + "start": 3263, + "end": 3265, "loc": { "start": { - "line": 121, + "line": 123, "column": 19 }, "end": { - "line": 121, + "line": 123, "column": 21 } } @@ -15409,15 +15409,15 @@ "binop": null }, "value": "component", - "start": 3221, - "end": 3230, + "start": 3266, + "end": 3275, "loc": { "start": { - "line": 121, + "line": 123, "column": 22 }, "end": { - "line": 121, + "line": 123, "column": 31 } } @@ -15437,15 +15437,15 @@ "updateContext": null }, "value": "in", - "start": 3231, - "end": 3233, + "start": 3276, + "end": 3278, "loc": { "start": { - "line": 121, + "line": 123, "column": 32 }, "end": { - "line": 121, + "line": 123, "column": 34 } } @@ -15465,15 +15465,15 @@ "updateContext": null }, "value": "this", - "start": 3234, - "end": 3238, + "start": 3279, + "end": 3283, "loc": { "start": { - "line": 121, + "line": 123, "column": 35 }, "end": { - "line": 121, + "line": 123, "column": 39 } } @@ -15491,15 +15491,15 @@ "binop": null, "updateContext": null }, - "start": 3238, - "end": 3239, + "start": 3283, + "end": 3284, "loc": { "start": { - "line": 121, + "line": 123, "column": 39 }, "end": { - "line": 121, + "line": 123, "column": 40 } } @@ -15517,15 +15517,15 @@ "binop": null }, "value": "world", - "start": 3239, - "end": 3244, + "start": 3284, + "end": 3289, "loc": { "start": { - "line": 121, + "line": 123, "column": 40 }, "end": { - "line": 121, + "line": 123, "column": 45 } } @@ -15543,15 +15543,15 @@ "binop": null, "updateContext": null }, - "start": 3244, - "end": 3245, + "start": 3289, + "end": 3290, "loc": { "start": { - "line": 121, + "line": 123, "column": 45 }, "end": { - "line": 121, + "line": 123, "column": 46 } } @@ -15569,15 +15569,15 @@ "binop": null }, "value": "components", - "start": 3245, - "end": 3255, + "start": 3290, + "end": 3300, "loc": { "start": { - "line": 121, + "line": 123, "column": 46 }, "end": { - "line": 121, + "line": 123, "column": 56 } } @@ -15594,15 +15594,15 @@ "postfix": false, "binop": null }, - "start": 3255, - "end": 3256, + "start": 3300, + "end": 3301, "loc": { "start": { - "line": 121, + "line": 123, "column": 56 }, "end": { - "line": 121, + "line": 123, "column": 57 } } @@ -15619,15 +15619,15 @@ "postfix": false, "binop": null }, - "start": 3257, - "end": 3258, + "start": 3302, + "end": 3303, "loc": { "start": { - "line": 121, + "line": 123, "column": 58 }, "end": { - "line": 121, + "line": 123, "column": 59 } } @@ -15635,15 +15635,15 @@ { "type": "CommentLine", "value": " Use defined component template, passing entity as first parameter", - "start": 3262, - "end": 3330, + "start": 3307, + "end": 3375, "loc": { "start": { - "line": 122, + "line": 124, "column": 3 }, "end": { - "line": 122, + "line": 124, "column": 71 } } @@ -15663,15 +15663,15 @@ "updateContext": null }, "value": "this", - "start": 3334, - "end": 3338, + "start": 3379, + "end": 3383, "loc": { "start": { - "line": 123, + "line": 125, "column": 3 }, "end": { - "line": 123, + "line": 125, "column": 7 } } @@ -15689,15 +15689,15 @@ "binop": null, "updateContext": null }, - "start": 3338, - "end": 3339, + "start": 3383, + "end": 3384, "loc": { "start": { - "line": 123, + "line": 125, "column": 7 }, "end": { - "line": 123, + "line": 125, "column": 8 } } @@ -15715,15 +15715,15 @@ "binop": null }, "value": "data", - "start": 3339, - "end": 3343, + "start": 3384, + "end": 3388, "loc": { "start": { - "line": 123, + "line": 125, "column": 8 }, "end": { - "line": 123, + "line": 125, "column": 12 } } @@ -15741,15 +15741,15 @@ "binop": null, "updateContext": null }, - "start": 3343, - "end": 3344, + "start": 3388, + "end": 3389, "loc": { "start": { - "line": 123, + "line": 125, "column": 12 }, "end": { - "line": 123, + "line": 125, "column": 13 } } @@ -15767,15 +15767,15 @@ "binop": null }, "value": "component", - "start": 3344, - "end": 3353, + "start": 3389, + "end": 3398, "loc": { "start": { - "line": 123, + "line": 125, "column": 13 }, "end": { - "line": 123, + "line": 125, "column": 22 } } @@ -15793,15 +15793,15 @@ "binop": null, "updateContext": null }, - "start": 3353, - "end": 3354, + "start": 3398, + "end": 3399, "loc": { "start": { - "line": 123, + "line": 125, "column": 22 }, "end": { - "line": 123, + "line": 125, "column": 23 } } @@ -15820,15 +15820,15 @@ "updateContext": null }, "value": "=", - "start": 3355, - "end": 3356, + "start": 3400, + "end": 3401, "loc": { "start": { - "line": 123, + "line": 125, "column": 24 }, "end": { - "line": 123, + "line": 125, "column": 25 } } @@ -15848,15 +15848,15 @@ "updateContext": null }, "value": "new", - "start": 3357, - "end": 3360, + "start": 3402, + "end": 3405, "loc": { "start": { - "line": 123, + "line": 125, "column": 26 }, "end": { - "line": 123, + "line": 125, "column": 29 } } @@ -15876,15 +15876,15 @@ "updateContext": null }, "value": "this", - "start": 3361, - "end": 3365, + "start": 3406, + "end": 3410, "loc": { "start": { - "line": 123, + "line": 125, "column": 30 }, "end": { - "line": 123, + "line": 125, "column": 34 } } @@ -15902,15 +15902,15 @@ "binop": null, "updateContext": null }, - "start": 3365, - "end": 3366, + "start": 3410, + "end": 3411, "loc": { "start": { - "line": 123, + "line": 125, "column": 34 }, "end": { - "line": 123, + "line": 125, "column": 35 } } @@ -15928,15 +15928,15 @@ "binop": null }, "value": "world", - "start": 3366, - "end": 3371, + "start": 3411, + "end": 3416, "loc": { "start": { - "line": 123, + "line": 125, "column": 35 }, "end": { - "line": 123, + "line": 125, "column": 40 } } @@ -15954,15 +15954,15 @@ "binop": null, "updateContext": null }, - "start": 3371, - "end": 3372, + "start": 3416, + "end": 3417, "loc": { "start": { - "line": 123, + "line": 125, "column": 40 }, "end": { - "line": 123, + "line": 125, "column": 41 } } @@ -15980,15 +15980,15 @@ "binop": null }, "value": "components", - "start": 3372, - "end": 3382, + "start": 3417, + "end": 3427, "loc": { "start": { - "line": 123, + "line": 125, "column": 41 }, "end": { - "line": 123, + "line": 125, "column": 51 } } @@ -16006,15 +16006,15 @@ "binop": null, "updateContext": null }, - "start": 3382, - "end": 3383, + "start": 3427, + "end": 3428, "loc": { "start": { - "line": 123, + "line": 125, "column": 51 }, "end": { - "line": 123, + "line": 125, "column": 52 } } @@ -16032,15 +16032,15 @@ "binop": null }, "value": "component", - "start": 3383, - "end": 3392, + "start": 3428, + "end": 3437, "loc": { "start": { - "line": 123, + "line": 125, "column": 52 }, "end": { - "line": 123, + "line": 125, "column": 61 } } @@ -16058,15 +16058,15 @@ "binop": null, "updateContext": null }, - "start": 3392, - "end": 3393, + "start": 3437, + "end": 3438, "loc": { "start": { - "line": 123, + "line": 125, "column": 61 }, "end": { - "line": 123, + "line": 125, "column": 62 } } @@ -16083,15 +16083,15 @@ "postfix": false, "binop": null }, - "start": 3393, - "end": 3394, + "start": 3438, + "end": 3439, "loc": { "start": { - "line": 123, + "line": 125, "column": 62 }, "end": { - "line": 123, + "line": 125, "column": 63 } } @@ -16111,15 +16111,15 @@ "updateContext": null }, "value": "this", - "start": 3394, - "end": 3398, + "start": 3439, + "end": 3443, "loc": { "start": { - "line": 123, + "line": 125, "column": 63 }, "end": { - "line": 123, + "line": 125, "column": 67 } } @@ -16137,15 +16137,15 @@ "binop": null, "updateContext": null }, - "start": 3398, - "end": 3399, + "start": 3443, + "end": 3444, "loc": { "start": { - "line": 123, + "line": 125, "column": 67 }, "end": { - "line": 123, + "line": 125, "column": 68 } } @@ -16163,15 +16163,15 @@ "binop": null, "updateContext": null }, - "start": 3400, - "end": 3403, + "start": 3445, + "end": 3448, "loc": { "start": { - "line": 123, + "line": 125, "column": 69 }, "end": { - "line": 123, + "line": 125, "column": 72 } } @@ -16189,15 +16189,15 @@ "binop": null }, "value": "args", - "start": 3403, - "end": 3407, + "start": 3448, + "end": 3452, "loc": { "start": { - "line": 123, + "line": 125, "column": 72 }, "end": { - "line": 123, + "line": 125, "column": 76 } } @@ -16214,15 +16214,15 @@ "postfix": false, "binop": null }, - "start": 3407, - "end": 3408, + "start": 3452, + "end": 3453, "loc": { "start": { - "line": 123, + "line": 125, "column": 76 }, "end": { - "line": 123, + "line": 125, "column": 77 } } @@ -16239,15 +16239,15 @@ "postfix": false, "binop": null }, - "start": 3411, - "end": 3412, + "start": 3456, + "end": 3457, "loc": { "start": { - "line": 124, + "line": 126, "column": 2 }, "end": { - "line": 124, + "line": 126, "column": 3 } } @@ -16267,15 +16267,15 @@ "updateContext": null }, "value": "else", - "start": 3413, - "end": 3417, + "start": 3458, + "end": 3462, "loc": { "start": { - "line": 124, + "line": 126, "column": 4 }, "end": { - "line": 124, + "line": 126, "column": 8 } } @@ -16295,15 +16295,15 @@ "updateContext": null }, "value": "if", - "start": 3418, - "end": 3420, + "start": 3463, + "end": 3465, "loc": { "start": { - "line": 124, + "line": 126, "column": 9 }, "end": { - "line": 124, + "line": 126, "column": 11 } } @@ -16320,15 +16320,15 @@ "postfix": false, "binop": null }, - "start": 3421, - "end": 3422, + "start": 3466, + "end": 3467, "loc": { "start": { - "line": 124, + "line": 126, "column": 12 }, "end": { - "line": 124, + "line": 126, "column": 13 } } @@ -16346,15 +16346,15 @@ "binop": null }, "value": "args", - "start": 3422, - "end": 3426, + "start": 3467, + "end": 3471, "loc": { "start": { - "line": 124, + "line": 126, "column": 13 }, "end": { - "line": 124, + "line": 126, "column": 17 } } @@ -16372,15 +16372,15 @@ "binop": null, "updateContext": null }, - "start": 3426, - "end": 3427, + "start": 3471, + "end": 3472, "loc": { "start": { - "line": 124, + "line": 126, "column": 17 }, "end": { - "line": 124, + "line": 126, "column": 18 } } @@ -16398,15 +16398,15 @@ "binop": null }, "value": "length", - "start": 3427, - "end": 3433, + "start": 3472, + "end": 3478, "loc": { "start": { - "line": 124, + "line": 126, "column": 18 }, "end": { - "line": 124, + "line": 126, "column": 24 } } @@ -16425,15 +16425,15 @@ "updateContext": null }, "value": ">", - "start": 3434, - "end": 3435, + "start": 3479, + "end": 3480, "loc": { "start": { - "line": 124, + "line": 126, "column": 25 }, "end": { - "line": 124, + "line": 126, "column": 26 } } @@ -16452,15 +16452,15 @@ "updateContext": null }, "value": 0, - "start": 3436, - "end": 3437, + "start": 3481, + "end": 3482, "loc": { "start": { - "line": 124, + "line": 126, "column": 27 }, "end": { - "line": 124, + "line": 126, "column": 28 } } @@ -16477,15 +16477,15 @@ "postfix": false, "binop": null }, - "start": 3437, - "end": 3438, + "start": 3482, + "end": 3483, "loc": { "start": { - "line": 124, + "line": 126, "column": 28 }, "end": { - "line": 124, + "line": 126, "column": 29 } } @@ -16502,15 +16502,15 @@ "postfix": false, "binop": null }, - "start": 3439, - "end": 3440, + "start": 3484, + "end": 3485, "loc": { "start": { - "line": 124, + "line": 126, "column": 30 }, "end": { - "line": 124, + "line": 126, "column": 31 } } @@ -16518,15 +16518,15 @@ { "type": "CommentLine", "value": " Use first argument as component value", - "start": 3444, - "end": 3484, + "start": 3489, + "end": 3529, "loc": { "start": { - "line": 125, + "line": 127, "column": 3 }, "end": { - "line": 125, + "line": 127, "column": 43 } } @@ -16546,15 +16546,15 @@ "updateContext": null }, "value": "this", - "start": 3488, - "end": 3492, + "start": 3533, + "end": 3537, "loc": { "start": { - "line": 126, + "line": 128, "column": 3 }, "end": { - "line": 126, + "line": 128, "column": 7 } } @@ -16572,15 +16572,15 @@ "binop": null, "updateContext": null }, - "start": 3492, - "end": 3493, + "start": 3537, + "end": 3538, "loc": { "start": { - "line": 126, + "line": 128, "column": 7 }, "end": { - "line": 126, + "line": 128, "column": 8 } } @@ -16598,15 +16598,15 @@ "binop": null }, "value": "data", - "start": 3493, - "end": 3497, + "start": 3538, + "end": 3542, "loc": { "start": { - "line": 126, + "line": 128, "column": 8 }, "end": { - "line": 126, + "line": 128, "column": 12 } } @@ -16624,15 +16624,15 @@ "binop": null, "updateContext": null }, - "start": 3497, - "end": 3498, + "start": 3542, + "end": 3543, "loc": { "start": { - "line": 126, + "line": 128, "column": 12 }, "end": { - "line": 126, + "line": 128, "column": 13 } } @@ -16650,15 +16650,15 @@ "binop": null }, "value": "component", - "start": 3498, - "end": 3507, + "start": 3543, + "end": 3552, "loc": { "start": { - "line": 126, + "line": 128, "column": 13 }, "end": { - "line": 126, + "line": 128, "column": 22 } } @@ -16676,15 +16676,15 @@ "binop": null, "updateContext": null }, - "start": 3507, - "end": 3508, + "start": 3552, + "end": 3553, "loc": { "start": { - "line": 126, + "line": 128, "column": 22 }, "end": { - "line": 126, + "line": 128, "column": 23 } } @@ -16703,15 +16703,15 @@ "updateContext": null }, "value": "=", - "start": 3509, - "end": 3510, + "start": 3554, + "end": 3555, "loc": { "start": { - "line": 126, + "line": 128, "column": 24 }, "end": { - "line": 126, + "line": 128, "column": 25 } } @@ -16729,15 +16729,15 @@ "binop": null }, "value": "args", - "start": 3511, - "end": 3515, + "start": 3556, + "end": 3560, "loc": { "start": { - "line": 126, + "line": 128, "column": 26 }, "end": { - "line": 126, + "line": 128, "column": 30 } } @@ -16755,15 +16755,15 @@ "binop": null, "updateContext": null }, - "start": 3515, - "end": 3516, + "start": 3560, + "end": 3561, "loc": { "start": { - "line": 126, + "line": 128, "column": 30 }, "end": { - "line": 126, + "line": 128, "column": 31 } } @@ -16782,15 +16782,15 @@ "updateContext": null }, "value": 0, - "start": 3516, - "end": 3517, + "start": 3561, + "end": 3562, "loc": { "start": { - "line": 126, + "line": 128, "column": 31 }, "end": { - "line": 126, + "line": 128, "column": 32 } } @@ -16808,15 +16808,15 @@ "binop": null, "updateContext": null }, - "start": 3517, - "end": 3518, + "start": 3562, + "end": 3563, "loc": { "start": { - "line": 126, + "line": 128, "column": 32 }, "end": { - "line": 126, + "line": 128, "column": 33 } } @@ -16833,15 +16833,15 @@ "postfix": false, "binop": null }, - "start": 3521, - "end": 3522, + "start": 3566, + "end": 3567, "loc": { "start": { - "line": 127, + "line": 129, "column": 2 }, "end": { - "line": 127, + "line": 129, "column": 3 } } @@ -16861,15 +16861,15 @@ "updateContext": null }, "value": "else", - "start": 3523, - "end": 3527, + "start": 3568, + "end": 3572, "loc": { "start": { - "line": 127, + "line": 129, "column": 4 }, "end": { - "line": 127, + "line": 129, "column": 8 } } @@ -16886,15 +16886,15 @@ "postfix": false, "binop": null }, - "start": 3528, - "end": 3529, + "start": 3573, + "end": 3574, "loc": { "start": { - "line": 127, + "line": 129, "column": 9 }, "end": { - "line": 127, + "line": 129, "column": 10 } } @@ -16902,15 +16902,15 @@ { "type": "CommentLine", "value": " Make an empty object", - "start": 3533, - "end": 3556, + "start": 3578, + "end": 3601, "loc": { "start": { - "line": 128, + "line": 130, "column": 3 }, "end": { - "line": 128, + "line": 130, "column": 26 } } @@ -16930,15 +16930,15 @@ "updateContext": null }, "value": "this", - "start": 3560, - "end": 3564, + "start": 3605, + "end": 3609, "loc": { "start": { - "line": 129, + "line": 131, "column": 3 }, "end": { - "line": 129, + "line": 131, "column": 7 } } @@ -16956,15 +16956,15 @@ "binop": null, "updateContext": null }, - "start": 3564, - "end": 3565, + "start": 3609, + "end": 3610, "loc": { "start": { - "line": 129, + "line": 131, "column": 7 }, "end": { - "line": 129, + "line": 131, "column": 8 } } @@ -16982,15 +16982,15 @@ "binop": null }, "value": "data", - "start": 3565, - "end": 3569, + "start": 3610, + "end": 3614, "loc": { "start": { - "line": 129, + "line": 131, "column": 8 }, "end": { - "line": 129, + "line": 131, "column": 12 } } @@ -17008,15 +17008,15 @@ "binop": null, "updateContext": null }, - "start": 3569, - "end": 3570, + "start": 3614, + "end": 3615, "loc": { "start": { - "line": 129, + "line": 131, "column": 12 }, "end": { - "line": 129, + "line": 131, "column": 13 } } @@ -17034,15 +17034,15 @@ "binop": null }, "value": "component", - "start": 3570, - "end": 3579, + "start": 3615, + "end": 3624, "loc": { "start": { - "line": 129, + "line": 131, "column": 13 }, "end": { - "line": 129, + "line": 131, "column": 22 } } @@ -17060,15 +17060,15 @@ "binop": null, "updateContext": null }, - "start": 3579, - "end": 3580, + "start": 3624, + "end": 3625, "loc": { "start": { - "line": 129, + "line": 131, "column": 22 }, "end": { - "line": 129, + "line": 131, "column": 23 } } @@ -17087,15 +17087,15 @@ "updateContext": null }, "value": "=", - "start": 3581, - "end": 3582, + "start": 3626, + "end": 3627, "loc": { "start": { - "line": 129, + "line": 131, "column": 24 }, "end": { - "line": 129, + "line": 131, "column": 25 } } @@ -17112,15 +17112,15 @@ "postfix": false, "binop": null }, - "start": 3583, - "end": 3584, + "start": 3628, + "end": 3629, "loc": { "start": { - "line": 129, + "line": 131, "column": 26 }, "end": { - "line": 129, + "line": 131, "column": 27 } } @@ -17137,15 +17137,15 @@ "postfix": false, "binop": null }, - "start": 3584, - "end": 3585, + "start": 3629, + "end": 3630, "loc": { "start": { - "line": 129, + "line": 131, "column": 27 }, "end": { - "line": 129, + "line": 131, "column": 28 } } @@ -17162,15 +17162,15 @@ "postfix": false, "binop": null }, - "start": 3588, - "end": 3589, + "start": 3633, + "end": 3634, "loc": { "start": { - "line": 130, + "line": 132, "column": 2 }, "end": { - "line": 130, + "line": 132, "column": 3 } } @@ -17178,15 +17178,15 @@ { "type": "CommentLine", "value": " Update the index with this new component", - "start": 3593, - "end": 3636, + "start": 3638, + "end": 3681, "loc": { "start": { - "line": 132, + "line": 134, "column": 2 }, "end": { - "line": 132, + "line": 134, "column": 45 } } @@ -17206,15 +17206,15 @@ "updateContext": null }, "value": "if", - "start": 3639, - "end": 3641, + "start": 3684, + "end": 3686, "loc": { "start": { - "line": 133, + "line": 135, "column": 2 }, "end": { - "line": 133, + "line": 135, "column": 4 } } @@ -17231,15 +17231,15 @@ "postfix": false, "binop": null }, - "start": 3642, - "end": 3643, + "start": 3687, + "end": 3688, "loc": { "start": { - "line": 133, + "line": 135, "column": 5 }, "end": { - "line": 133, + "line": 135, "column": 6 } } @@ -17259,15 +17259,15 @@ "updateContext": null }, "value": "this", - "start": 3643, - "end": 3647, + "start": 3688, + "end": 3692, "loc": { "start": { - "line": 133, + "line": 135, "column": 6 }, "end": { - "line": 133, + "line": 135, "column": 10 } } @@ -17285,15 +17285,15 @@ "binop": null, "updateContext": null }, - "start": 3647, - "end": 3648, + "start": 3692, + "end": 3693, "loc": { "start": { - "line": 133, + "line": 135, "column": 10 }, "end": { - "line": 133, + "line": 135, "column": 11 } } @@ -17311,15 +17311,15 @@ "binop": null }, "value": "valid", - "start": 3648, - "end": 3653, + "start": 3693, + "end": 3698, "loc": { "start": { - "line": 133, + "line": 135, "column": 11 }, "end": { - "line": 133, + "line": 135, "column": 16 } } @@ -17336,15 +17336,15 @@ "postfix": false, "binop": null }, - "start": 3653, - "end": 3654, + "start": 3698, + "end": 3699, "loc": { "start": { - "line": 133, + "line": 135, "column": 16 }, "end": { - "line": 133, + "line": 135, "column": 17 } } @@ -17361,15 +17361,15 @@ "postfix": false, "binop": null }, - "start": 3654, - "end": 3655, + "start": 3699, + "end": 3700, "loc": { "start": { - "line": 133, + "line": 135, "column": 17 }, "end": { - "line": 133, + "line": 135, "column": 18 } } @@ -17386,15 +17386,15 @@ "postfix": false, "binop": null }, - "start": 3655, - "end": 3656, + "start": 3700, + "end": 3701, "loc": { "start": { - "line": 133, + "line": 135, "column": 18 }, "end": { - "line": 133, + "line": 135, "column": 19 } } @@ -17411,15 +17411,15 @@ "postfix": false, "binop": null }, - "start": 3657, - "end": 3658, + "start": 3702, + "end": 3703, "loc": { "start": { - "line": 133, + "line": 135, "column": 20 }, "end": { - "line": 133, + "line": 135, "column": 21 } } @@ -17439,15 +17439,15 @@ "updateContext": null }, "value": "this", - "start": 3662, - "end": 3666, + "start": 3707, + "end": 3711, "loc": { "start": { - "line": 134, + "line": 136, "column": 3 }, "end": { - "line": 134, + "line": 136, "column": 7 } } @@ -17465,15 +17465,15 @@ "binop": null, "updateContext": null }, - "start": 3666, - "end": 3667, + "start": 3711, + "end": 3712, "loc": { "start": { - "line": 134, + "line": 136, "column": 7 }, "end": { - "line": 134, + "line": 136, "column": 8 } } @@ -17491,15 +17491,15 @@ "binop": null }, "value": "world", - "start": 3667, - "end": 3672, + "start": 3712, + "end": 3717, "loc": { "start": { - "line": 134, + "line": 136, "column": 8 }, "end": { - "line": 134, + "line": 136, "column": 13 } } @@ -17517,15 +17517,15 @@ "binop": null, "updateContext": null }, - "start": 3672, - "end": 3673, + "start": 3717, + "end": 3718, "loc": { "start": { - "line": 134, + "line": 136, "column": 13 }, "end": { - "line": 134, + "line": 136, "column": 14 } } @@ -17543,15 +17543,15 @@ "binop": null }, "value": "index", - "start": 3673, - "end": 3678, + "start": 3718, + "end": 3723, "loc": { "start": { - "line": 134, + "line": 136, "column": 14 }, "end": { - "line": 134, + "line": 136, "column": 19 } } @@ -17569,15 +17569,15 @@ "binop": null, "updateContext": null }, - "start": 3678, - "end": 3679, + "start": 3723, + "end": 3724, "loc": { "start": { - "line": 134, + "line": 136, "column": 19 }, "end": { - "line": 134, + "line": 136, "column": 20 } } @@ -17595,15 +17595,15 @@ "binop": null }, "value": "add", - "start": 3679, - "end": 3682, + "start": 3724, + "end": 3727, "loc": { "start": { - "line": 134, + "line": 136, "column": 20 }, "end": { - "line": 134, + "line": 136, "column": 23 } } @@ -17620,15 +17620,15 @@ "postfix": false, "binop": null }, - "start": 3682, - "end": 3683, + "start": 3727, + "end": 3728, "loc": { "start": { - "line": 134, + "line": 136, "column": 23 }, "end": { - "line": 134, + "line": 136, "column": 24 } } @@ -17648,15 +17648,15 @@ "updateContext": null }, "value": "this", - "start": 3683, - "end": 3687, + "start": 3728, + "end": 3732, "loc": { "start": { - "line": 134, + "line": 136, "column": 24 }, "end": { - "line": 134, + "line": 136, "column": 28 } } @@ -17674,15 +17674,15 @@ "binop": null, "updateContext": null }, - "start": 3687, - "end": 3688, + "start": 3732, + "end": 3733, "loc": { "start": { - "line": 134, + "line": 136, "column": 28 }, "end": { - "line": 134, + "line": 136, "column": 29 } } @@ -17700,15 +17700,15 @@ "binop": null }, "value": "component", - "start": 3689, - "end": 3698, + "start": 3734, + "end": 3743, "loc": { "start": { - "line": 134, + "line": 136, "column": 30 }, "end": { - "line": 134, + "line": 136, "column": 39 } } @@ -17725,15 +17725,15 @@ "postfix": false, "binop": null }, - "start": 3698, - "end": 3699, + "start": 3743, + "end": 3744, "loc": { "start": { - "line": 134, + "line": 136, "column": 39 }, "end": { - "line": 134, + "line": 136, "column": 40 } } @@ -17750,15 +17750,15 @@ "postfix": false, "binop": null }, - "start": 3702, - "end": 3703, + "start": 3747, + "end": 3748, "loc": { "start": { - "line": 135, + "line": 137, "column": 2 }, "end": { - "line": 135, + "line": 137, "column": 3 } } @@ -17778,15 +17778,15 @@ "updateContext": null }, "value": "return", - "start": 3707, - "end": 3713, + "start": 3752, + "end": 3758, "loc": { "start": { - "line": 137, + "line": 139, "column": 2 }, "end": { - "line": 137, + "line": 139, "column": 8 } } @@ -17806,15 +17806,15 @@ "updateContext": null }, "value": "this", - "start": 3714, - "end": 3718, + "start": 3759, + "end": 3763, "loc": { "start": { - "line": 137, + "line": 139, "column": 9 }, "end": { - "line": 137, + "line": 139, "column": 13 } } @@ -17831,15 +17831,15 @@ "postfix": false, "binop": null }, - "start": 3720, - "end": 3721, + "start": 3765, + "end": 3766, "loc": { "start": { - "line": 138, + "line": 140, "column": 1 }, "end": { - "line": 138, + "line": 140, "column": 2 } } @@ -17847,15 +17847,15 @@ { "type": "CommentBlock", "value": "*\n\t * Updates component data from an object or other component. Similar to access() with a shallow merge applied after.\n\t *\n\t * @example\n\t * entity.update('position', { x: 1, y: 2 })\n\t *\n\t * @param {string} component - The component name to update\n\t * @param {Object} data - The object or other component to merge into the specified component.\n\t *\n\t * @return {Object} The original entity that update() was called on, so that operations can be chained.\n\t ", - "start": 3724, - "end": 4188, + "start": 3769, + "end": 4233, "loc": { "start": { - "line": 140, + "line": 142, "column": 1 }, "end": { - "line": 150, + "line": 152, "column": 4 } } @@ -17873,15 +17873,15 @@ "binop": null }, "value": "update", - "start": 4190, - "end": 4196, + "start": 4235, + "end": 4241, "loc": { "start": { - "line": 151, + "line": 153, "column": 1 }, "end": { - "line": 151, + "line": 153, "column": 7 } } @@ -17898,15 +17898,15 @@ "postfix": false, "binop": null }, - "start": 4196, - "end": 4197, + "start": 4241, + "end": 4242, "loc": { "start": { - "line": 151, + "line": 153, "column": 7 }, "end": { - "line": 151, + "line": 153, "column": 8 } } @@ -17924,15 +17924,15 @@ "binop": null }, "value": "component", - "start": 4197, - "end": 4206, + "start": 4242, + "end": 4251, "loc": { "start": { - "line": 151, + "line": 153, "column": 8 }, "end": { - "line": 151, + "line": 153, "column": 17 } } @@ -17950,15 +17950,15 @@ "binop": null, "updateContext": null }, - "start": 4206, - "end": 4207, + "start": 4251, + "end": 4252, "loc": { "start": { - "line": 151, + "line": 153, "column": 17 }, "end": { - "line": 151, + "line": 153, "column": 18 } } @@ -17976,15 +17976,15 @@ "binop": null }, "value": "data", - "start": 4208, - "end": 4212, + "start": 4253, + "end": 4257, "loc": { "start": { - "line": 151, + "line": 153, "column": 19 }, "end": { - "line": 151, + "line": 153, "column": 23 } } @@ -18001,15 +18001,15 @@ "postfix": false, "binop": null }, - "start": 4212, - "end": 4213, + "start": 4257, + "end": 4258, "loc": { "start": { - "line": 151, + "line": 153, "column": 23 }, "end": { - "line": 151, + "line": 153, "column": 24 } } @@ -18026,15 +18026,15 @@ "postfix": false, "binop": null }, - "start": 4214, - "end": 4215, + "start": 4259, + "end": 4260, "loc": { "start": { - "line": 151, + "line": 153, "column": 25 }, "end": { - "line": 151, + "line": 153, "column": 26 } } @@ -18054,15 +18054,15 @@ "updateContext": null }, "value": "let", - "start": 4218, - "end": 4221, + "start": 4263, + "end": 4266, "loc": { "start": { - "line": 152, + "line": 154, "column": 2 }, "end": { - "line": 152, + "line": 154, "column": 5 } } @@ -18080,15 +18080,15 @@ "binop": null }, "value": "comp", - "start": 4222, - "end": 4226, + "start": 4267, + "end": 4271, "loc": { "start": { - "line": 152, + "line": 154, "column": 6 }, "end": { - "line": 152, + "line": 154, "column": 10 } } @@ -18107,15 +18107,15 @@ "updateContext": null }, "value": "=", - "start": 4227, - "end": 4228, + "start": 4272, + "end": 4273, "loc": { "start": { - "line": 152, + "line": 154, "column": 11 }, "end": { - "line": 152, + "line": 154, "column": 12 } } @@ -18135,15 +18135,15 @@ "updateContext": null }, "value": "this", - "start": 4229, - "end": 4233, + "start": 4274, + "end": 4278, "loc": { "start": { - "line": 152, + "line": 154, "column": 13 }, "end": { - "line": 152, + "line": 154, "column": 17 } } @@ -18161,15 +18161,15 @@ "binop": null, "updateContext": null }, - "start": 4233, - "end": 4234, + "start": 4278, + "end": 4279, "loc": { "start": { - "line": 152, + "line": 154, "column": 17 }, "end": { - "line": 152, + "line": 154, "column": 18 } } @@ -18187,15 +18187,15 @@ "binop": null }, "value": "access", - "start": 4234, - "end": 4240, + "start": 4279, + "end": 4285, "loc": { "start": { - "line": 152, + "line": 154, "column": 18 }, "end": { - "line": 152, + "line": 154, "column": 24 } } @@ -18212,15 +18212,15 @@ "postfix": false, "binop": null }, - "start": 4240, - "end": 4241, + "start": 4285, + "end": 4286, "loc": { "start": { - "line": 152, + "line": 154, "column": 24 }, "end": { - "line": 152, + "line": 154, "column": 25 } } @@ -18238,15 +18238,15 @@ "binop": null }, "value": "component", - "start": 4241, - "end": 4250, + "start": 4286, + "end": 4295, "loc": { "start": { - "line": 152, + "line": 154, "column": 25 }, "end": { - "line": 152, + "line": 154, "column": 34 } } @@ -18263,15 +18263,15 @@ "postfix": false, "binop": null }, - "start": 4250, - "end": 4251, + "start": 4295, + "end": 4296, "loc": { "start": { - "line": 152, + "line": 154, "column": 34 }, "end": { - "line": 152, + "line": 154, "column": 35 } } @@ -18279,15 +18279,15 @@ { "type": "CommentLine", "value": " Shallow set keys of the component", - "start": 4255, - "end": 4291, + "start": 4300, + "end": 4336, "loc": { "start": { - "line": 154, + "line": 156, "column": 2 }, "end": { - "line": 154, + "line": 156, "column": 38 } } @@ -18307,15 +18307,15 @@ "updateContext": null }, "value": "for", - "start": 4294, - "end": 4297, + "start": 4339, + "end": 4342, "loc": { "start": { - "line": 155, + "line": 157, "column": 2 }, "end": { - "line": 155, + "line": 157, "column": 5 } } @@ -18332,15 +18332,15 @@ "postfix": false, "binop": null }, - "start": 4298, - "end": 4299, + "start": 4343, + "end": 4344, "loc": { "start": { - "line": 155, + "line": 157, "column": 6 }, "end": { - "line": 155, + "line": 157, "column": 7 } } @@ -18360,15 +18360,15 @@ "updateContext": null }, "value": "let", - "start": 4299, - "end": 4302, + "start": 4344, + "end": 4347, "loc": { "start": { - "line": 155, + "line": 157, "column": 7 }, "end": { - "line": 155, + "line": 157, "column": 10 } } @@ -18386,15 +18386,15 @@ "binop": null }, "value": "key", - "start": 4303, - "end": 4306, + "start": 4348, + "end": 4351, "loc": { "start": { - "line": 155, + "line": 157, "column": 11 }, "end": { - "line": 155, + "line": 157, "column": 14 } } @@ -18414,15 +18414,15 @@ "updateContext": null }, "value": "in", - "start": 4307, - "end": 4309, + "start": 4352, + "end": 4354, "loc": { "start": { - "line": 155, + "line": 157, "column": 15 }, "end": { - "line": 155, + "line": 157, "column": 17 } } @@ -18440,15 +18440,15 @@ "binop": null }, "value": "data", - "start": 4310, - "end": 4314, + "start": 4355, + "end": 4359, "loc": { "start": { - "line": 155, + "line": 157, "column": 18 }, "end": { - "line": 155, + "line": 157, "column": 22 } } @@ -18465,15 +18465,15 @@ "postfix": false, "binop": null }, - "start": 4314, - "end": 4315, + "start": 4359, + "end": 4360, "loc": { "start": { - "line": 155, + "line": 157, "column": 22 }, "end": { - "line": 155, + "line": 157, "column": 23 } } @@ -18490,15 +18490,15 @@ "postfix": false, "binop": null }, - "start": 4316, - "end": 4317, + "start": 4361, + "end": 4362, "loc": { "start": { - "line": 155, + "line": 157, "column": 24 }, "end": { - "line": 155, + "line": 157, "column": 25 } } @@ -18516,15 +18516,15 @@ "binop": null }, "value": "comp", - "start": 4321, - "end": 4325, + "start": 4366, + "end": 4370, "loc": { "start": { - "line": 156, + "line": 158, "column": 3 }, "end": { - "line": 156, + "line": 158, "column": 7 } } @@ -18542,15 +18542,15 @@ "binop": null, "updateContext": null }, - "start": 4325, - "end": 4326, + "start": 4370, + "end": 4371, "loc": { "start": { - "line": 156, + "line": 158, "column": 7 }, "end": { - "line": 156, + "line": 158, "column": 8 } } @@ -18568,15 +18568,15 @@ "binop": null }, "value": "key", - "start": 4326, - "end": 4329, + "start": 4371, + "end": 4374, "loc": { "start": { - "line": 156, + "line": 158, "column": 8 }, "end": { - "line": 156, + "line": 158, "column": 11 } } @@ -18594,15 +18594,15 @@ "binop": null, "updateContext": null }, - "start": 4329, - "end": 4330, + "start": 4374, + "end": 4375, "loc": { "start": { - "line": 156, + "line": 158, "column": 11 }, "end": { - "line": 156, + "line": 158, "column": 12 } } @@ -18621,15 +18621,15 @@ "updateContext": null }, "value": "=", - "start": 4331, - "end": 4332, + "start": 4376, + "end": 4377, "loc": { "start": { - "line": 156, + "line": 158, "column": 13 }, "end": { - "line": 156, + "line": 158, "column": 14 } } @@ -18647,15 +18647,15 @@ "binop": null }, "value": "data", - "start": 4333, - "end": 4337, + "start": 4378, + "end": 4382, "loc": { "start": { - "line": 156, + "line": 158, "column": 15 }, "end": { - "line": 156, + "line": 158, "column": 19 } } @@ -18673,15 +18673,15 @@ "binop": null, "updateContext": null }, - "start": 4337, - "end": 4338, + "start": 4382, + "end": 4383, "loc": { "start": { - "line": 156, + "line": 158, "column": 19 }, "end": { - "line": 156, + "line": 158, "column": 20 } } @@ -18699,15 +18699,15 @@ "binop": null }, "value": "key", - "start": 4338, - "end": 4341, + "start": 4383, + "end": 4386, "loc": { "start": { - "line": 156, + "line": 158, "column": 20 }, "end": { - "line": 156, + "line": 158, "column": 23 } } @@ -18725,15 +18725,15 @@ "binop": null, "updateContext": null }, - "start": 4341, - "end": 4342, + "start": 4386, + "end": 4387, "loc": { "start": { - "line": 156, + "line": 158, "column": 23 }, "end": { - "line": 156, + "line": 158, "column": 24 } } @@ -18750,15 +18750,15 @@ "postfix": false, "binop": null }, - "start": 4345, - "end": 4346, + "start": 4390, + "end": 4391, "loc": { "start": { - "line": 157, + "line": 159, "column": 2 }, "end": { - "line": 157, + "line": 159, "column": 3 } } @@ -18778,15 +18778,15 @@ "updateContext": null }, "value": "return", - "start": 4350, - "end": 4356, + "start": 4395, + "end": 4401, "loc": { "start": { - "line": 159, + "line": 161, "column": 2 }, "end": { - "line": 159, + "line": 161, "column": 8 } } @@ -18806,15 +18806,15 @@ "updateContext": null }, "value": "this", - "start": 4357, - "end": 4361, + "start": 4402, + "end": 4406, "loc": { "start": { - "line": 159, + "line": 161, "column": 9 }, "end": { - "line": 159, + "line": 161, "column": 13 } } @@ -18831,15 +18831,15 @@ "postfix": false, "binop": null }, - "start": 4363, - "end": 4364, + "start": 4408, + "end": 4409, "loc": { "start": { - "line": 160, + "line": 162, "column": 1 }, "end": { - "line": 160, + "line": 162, "column": 2 } } @@ -18847,15 +18847,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes a component from the entity - has no effect when it doesn't exist.\n\t * Can specify an onRemove() method in your component which gets called before it is removed.\n\t * If nothing is specified, then nothing will be removed. Use removeAll() to remove all components.\n\t *\n\t * @example\n\t * entity.remove('position')\n\t *\n\t * @param {...string} [components] - The component names to remove from the entity.\n\t *\n\t * @return {Object} The original entity that remove() was called on, so that operations can be chained.\n\t ", - "start": 4367, - "end": 4895, + "start": 4412, + "end": 4940, "loc": { "start": { - "line": 162, + "line": 164, "column": 1 }, "end": { - "line": 173, + "line": 175, "column": 4 } } @@ -18873,15 +18873,15 @@ "binop": null }, "value": "remove", - "start": 4897, - "end": 4903, + "start": 4942, + "end": 4948, "loc": { "start": { - "line": 174, + "line": 176, "column": 1 }, "end": { - "line": 174, + "line": 176, "column": 7 } } @@ -18898,15 +18898,15 @@ "postfix": false, "binop": null }, - "start": 4903, - "end": 4904, + "start": 4948, + "end": 4949, "loc": { "start": { - "line": 174, + "line": 176, "column": 7 }, "end": { - "line": 174, + "line": 176, "column": 8 } } @@ -18924,15 +18924,15 @@ "binop": null, "updateContext": null }, - "start": 4904, - "end": 4907, + "start": 4949, + "end": 4952, "loc": { "start": { - "line": 174, + "line": 176, "column": 8 }, "end": { - "line": 174, + "line": 176, "column": 11 } } @@ -18950,15 +18950,15 @@ "binop": null }, "value": "components", - "start": 4907, - "end": 4917, + "start": 4952, + "end": 4962, "loc": { "start": { - "line": 174, + "line": 176, "column": 11 }, "end": { - "line": 174, + "line": 176, "column": 21 } } @@ -18975,15 +18975,15 @@ "postfix": false, "binop": null }, - "start": 4917, - "end": 4918, + "start": 4962, + "end": 4963, "loc": { "start": { - "line": 174, + "line": 176, "column": 21 }, "end": { - "line": 174, + "line": 176, "column": 22 } } @@ -19000,15 +19000,15 @@ "postfix": false, "binop": null }, - "start": 4919, - "end": 4920, + "start": 4964, + "end": 4965, "loc": { "start": { - "line": 174, + "line": 176, "column": 23 }, "end": { - "line": 174, + "line": 176, "column": 24 } } @@ -19028,15 +19028,15 @@ "updateContext": null }, "value": "for", - "start": 4923, - "end": 4926, + "start": 4968, + "end": 4971, "loc": { "start": { - "line": 175, + "line": 177, "column": 2 }, "end": { - "line": 175, + "line": 177, "column": 5 } } @@ -19053,15 +19053,15 @@ "postfix": false, "binop": null }, - "start": 4927, - "end": 4928, + "start": 4972, + "end": 4973, "loc": { "start": { - "line": 175, + "line": 177, "column": 6 }, "end": { - "line": 175, + "line": 177, "column": 7 } } @@ -19081,15 +19081,15 @@ "updateContext": null }, "value": "let", - "start": 4928, - "end": 4931, + "start": 4973, + "end": 4976, "loc": { "start": { - "line": 175, + "line": 177, "column": 7 }, "end": { - "line": 175, + "line": 177, "column": 10 } } @@ -19107,15 +19107,15 @@ "binop": null }, "value": "component", - "start": 4932, - "end": 4941, + "start": 4977, + "end": 4986, "loc": { "start": { - "line": 175, + "line": 177, "column": 11 }, "end": { - "line": 175, + "line": 177, "column": 20 } } @@ -19133,15 +19133,15 @@ "binop": null }, "value": "of", - "start": 4942, - "end": 4944, + "start": 4987, + "end": 4989, "loc": { "start": { - "line": 175, + "line": 177, "column": 21 }, "end": { - "line": 175, + "line": 177, "column": 23 } } @@ -19159,15 +19159,15 @@ "binop": null }, "value": "components", - "start": 4945, - "end": 4955, + "start": 4990, + "end": 5000, "loc": { "start": { - "line": 175, + "line": 177, "column": 24 }, "end": { - "line": 175, + "line": 177, "column": 34 } } @@ -19184,15 +19184,15 @@ "postfix": false, "binop": null }, - "start": 4955, - "end": 4956, + "start": 5000, + "end": 5001, "loc": { "start": { - "line": 175, + "line": 177, "column": 34 }, "end": { - "line": 175, + "line": 177, "column": 35 } } @@ -19209,15 +19209,15 @@ "postfix": false, "binop": null }, - "start": 4957, - "end": 4958, + "start": 5002, + "end": 5003, "loc": { "start": { - "line": 175, + "line": 177, "column": 36 }, "end": { - "line": 175, + "line": 177, "column": 37 } } @@ -19237,15 +19237,15 @@ "updateContext": null }, "value": "if", - "start": 4962, - "end": 4964, + "start": 5007, + "end": 5009, "loc": { "start": { - "line": 176, + "line": 178, "column": 3 }, "end": { - "line": 176, + "line": 178, "column": 5 } } @@ -19262,15 +19262,15 @@ "postfix": false, "binop": null }, - "start": 4965, - "end": 4966, + "start": 5010, + "end": 5011, "loc": { "start": { - "line": 176, + "line": 178, "column": 6 }, "end": { - "line": 176, + "line": 178, "column": 7 } } @@ -19288,15 +19288,15 @@ "binop": null }, "value": "component", - "start": 4966, - "end": 4975, + "start": 5011, + "end": 5020, "loc": { "start": { - "line": 176, + "line": 178, "column": 7 }, "end": { - "line": 176, + "line": 178, "column": 16 } } @@ -19316,15 +19316,15 @@ "updateContext": null }, "value": "in", - "start": 4976, - "end": 4978, + "start": 5021, + "end": 5023, "loc": { "start": { - "line": 176, + "line": 178, "column": 17 }, "end": { - "line": 176, + "line": 178, "column": 19 } } @@ -19344,15 +19344,15 @@ "updateContext": null }, "value": "this", - "start": 4979, - "end": 4983, + "start": 5024, + "end": 5028, "loc": { "start": { - "line": 176, + "line": 178, "column": 20 }, "end": { - "line": 176, + "line": 178, "column": 24 } } @@ -19370,15 +19370,15 @@ "binop": null, "updateContext": null }, - "start": 4983, - "end": 4984, + "start": 5028, + "end": 5029, "loc": { "start": { - "line": 176, + "line": 178, "column": 24 }, "end": { - "line": 176, + "line": 178, "column": 25 } } @@ -19396,15 +19396,15 @@ "binop": null }, "value": "data", - "start": 4984, - "end": 4988, + "start": 5029, + "end": 5033, "loc": { "start": { - "line": 176, + "line": 178, "column": 25 }, "end": { - "line": 176, + "line": 178, "column": 29 } } @@ -19421,15 +19421,15 @@ "postfix": false, "binop": null }, - "start": 4988, - "end": 4989, + "start": 5033, + "end": 5034, "loc": { "start": { - "line": 176, + "line": 178, "column": 29 }, "end": { - "line": 176, + "line": 178, "column": 30 } } @@ -19446,15 +19446,15 @@ "postfix": false, "binop": null }, - "start": 4990, - "end": 4991, + "start": 5035, + "end": 5036, "loc": { "start": { - "line": 176, + "line": 178, "column": 31 }, "end": { - "line": 176, + "line": 178, "column": 32 } } @@ -19462,15 +19462,15 @@ { "type": "CommentLine", "value": " Remove from index", - "start": 4997, - "end": 5017, + "start": 5042, + "end": 5062, "loc": { "start": { - "line": 178, + "line": 180, "column": 4 }, "end": { - "line": 178, + "line": 180, "column": 24 } } @@ -19490,15 +19490,15 @@ "updateContext": null }, "value": "if", - "start": 5022, - "end": 5024, + "start": 5067, + "end": 5069, "loc": { "start": { - "line": 179, + "line": 181, "column": 4 }, "end": { - "line": 179, + "line": 181, "column": 6 } } @@ -19515,15 +19515,15 @@ "postfix": false, "binop": null }, - "start": 5025, - "end": 5026, + "start": 5070, + "end": 5071, "loc": { "start": { - "line": 179, + "line": 181, "column": 7 }, "end": { - "line": 179, + "line": 181, "column": 8 } } @@ -19543,15 +19543,15 @@ "updateContext": null }, "value": "this", - "start": 5026, - "end": 5030, + "start": 5071, + "end": 5075, "loc": { "start": { - "line": 179, + "line": 181, "column": 8 }, "end": { - "line": 179, + "line": 181, "column": 12 } } @@ -19569,15 +19569,15 @@ "binop": null, "updateContext": null }, - "start": 5030, - "end": 5031, + "start": 5075, + "end": 5076, "loc": { "start": { - "line": 179, + "line": 181, "column": 12 }, "end": { - "line": 179, + "line": 181, "column": 13 } } @@ -19595,15 +19595,15 @@ "binop": null }, "value": "valid", - "start": 5031, - "end": 5036, + "start": 5076, + "end": 5081, "loc": { "start": { - "line": 179, + "line": 181, "column": 13 }, "end": { - "line": 179, + "line": 181, "column": 18 } } @@ -19620,15 +19620,15 @@ "postfix": false, "binop": null }, - "start": 5036, - "end": 5037, + "start": 5081, + "end": 5082, "loc": { "start": { - "line": 179, + "line": 181, "column": 18 }, "end": { - "line": 179, + "line": 181, "column": 19 } } @@ -19645,15 +19645,15 @@ "postfix": false, "binop": null }, - "start": 5037, - "end": 5038, + "start": 5082, + "end": 5083, "loc": { "start": { - "line": 179, + "line": 181, "column": 19 }, "end": { - "line": 179, + "line": 181, "column": 20 } } @@ -19670,15 +19670,15 @@ "postfix": false, "binop": null }, - "start": 5038, - "end": 5039, + "start": 5083, + "end": 5084, "loc": { "start": { - "line": 179, + "line": 181, "column": 20 }, "end": { - "line": 179, + "line": 181, "column": 21 } } @@ -19695,15 +19695,15 @@ "postfix": false, "binop": null }, - "start": 5040, - "end": 5041, + "start": 5085, + "end": 5086, "loc": { "start": { - "line": 179, + "line": 181, "column": 22 }, "end": { - "line": 179, + "line": 181, "column": 23 } } @@ -19723,15 +19723,15 @@ "updateContext": null }, "value": "this", - "start": 5047, - "end": 5051, + "start": 5092, + "end": 5096, "loc": { "start": { - "line": 180, + "line": 182, "column": 5 }, "end": { - "line": 180, + "line": 182, "column": 9 } } @@ -19749,15 +19749,15 @@ "binop": null, "updateContext": null }, - "start": 5051, - "end": 5052, + "start": 5096, + "end": 5097, "loc": { "start": { - "line": 180, + "line": 182, "column": 9 }, "end": { - "line": 180, + "line": 182, "column": 10 } } @@ -19775,15 +19775,15 @@ "binop": null }, "value": "world", - "start": 5052, - "end": 5057, + "start": 5097, + "end": 5102, "loc": { "start": { - "line": 180, + "line": 182, "column": 10 }, "end": { - "line": 180, + "line": 182, "column": 15 } } @@ -19801,15 +19801,15 @@ "binop": null, "updateContext": null }, - "start": 5057, - "end": 5058, + "start": 5102, + "end": 5103, "loc": { "start": { - "line": 180, + "line": 182, "column": 15 }, "end": { - "line": 180, + "line": 182, "column": 16 } } @@ -19827,15 +19827,15 @@ "binop": null }, "value": "index", - "start": 5058, - "end": 5063, + "start": 5103, + "end": 5108, "loc": { "start": { - "line": 180, + "line": 182, "column": 16 }, "end": { - "line": 180, + "line": 182, "column": 21 } } @@ -19853,15 +19853,15 @@ "binop": null, "updateContext": null }, - "start": 5063, - "end": 5064, + "start": 5108, + "end": 5109, "loc": { "start": { - "line": 180, + "line": 182, "column": 21 }, "end": { - "line": 180, + "line": 182, "column": 22 } } @@ -19879,15 +19879,15 @@ "binop": null }, "value": "remove", - "start": 5064, - "end": 5070, + "start": 5109, + "end": 5115, "loc": { "start": { - "line": 180, + "line": 182, "column": 22 }, "end": { - "line": 180, + "line": 182, "column": 28 } } @@ -19904,15 +19904,15 @@ "postfix": false, "binop": null }, - "start": 5070, - "end": 5071, + "start": 5115, + "end": 5116, "loc": { "start": { - "line": 180, + "line": 182, "column": 28 }, "end": { - "line": 180, + "line": 182, "column": 29 } } @@ -19932,15 +19932,15 @@ "updateContext": null }, "value": "this", - "start": 5071, - "end": 5075, + "start": 5116, + "end": 5120, "loc": { "start": { - "line": 180, + "line": 182, "column": 29 }, "end": { - "line": 180, + "line": 182, "column": 33 } } @@ -19958,15 +19958,15 @@ "binop": null, "updateContext": null }, - "start": 5075, - "end": 5076, + "start": 5120, + "end": 5121, "loc": { "start": { - "line": 180, + "line": 182, "column": 33 }, "end": { - "line": 180, + "line": 182, "column": 34 } } @@ -19984,15 +19984,15 @@ "binop": null }, "value": "component", - "start": 5077, - "end": 5086, + "start": 5122, + "end": 5131, "loc": { "start": { - "line": 180, + "line": 182, "column": 35 }, "end": { - "line": 180, + "line": 182, "column": 44 } } @@ -20009,15 +20009,15 @@ "postfix": false, "binop": null }, - "start": 5086, - "end": 5087, + "start": 5131, + "end": 5132, "loc": { "start": { - "line": 180, + "line": 182, "column": 44 }, "end": { - "line": 180, + "line": 182, "column": 45 } } @@ -20034,15 +20034,15 @@ "postfix": false, "binop": null }, - "start": 5092, - "end": 5093, + "start": 5137, + "end": 5138, "loc": { "start": { - "line": 181, + "line": 183, "column": 4 }, "end": { - "line": 181, + "line": 183, "column": 5 } } @@ -20050,15 +20050,15 @@ { "type": "CommentLine", "value": " Call custom onRemove", - "start": 5099, - "end": 5122, + "start": 5144, + "end": 5167, "loc": { "start": { - "line": 183, + "line": 185, "column": 4 }, "end": { - "line": 183, + "line": 185, "column": 27 } } @@ -20076,15 +20076,15 @@ "binop": null }, "value": "invoke", - "start": 5127, - "end": 5133, + "start": 5172, + "end": 5178, "loc": { "start": { - "line": 184, + "line": 186, "column": 4 }, "end": { - "line": 184, + "line": 186, "column": 10 } } @@ -20101,15 +20101,15 @@ "postfix": false, "binop": null }, - "start": 5133, - "end": 5134, + "start": 5178, + "end": 5179, "loc": { "start": { - "line": 184, + "line": 186, "column": 10 }, "end": { - "line": 184, + "line": 186, "column": 11 } } @@ -20129,15 +20129,15 @@ "updateContext": null }, "value": "this", - "start": 5134, - "end": 5138, + "start": 5179, + "end": 5183, "loc": { "start": { - "line": 184, + "line": 186, "column": 11 }, "end": { - "line": 184, + "line": 186, "column": 15 } } @@ -20155,15 +20155,15 @@ "binop": null, "updateContext": null }, - "start": 5138, - "end": 5139, + "start": 5183, + "end": 5184, "loc": { "start": { - "line": 184, + "line": 186, "column": 15 }, "end": { - "line": 184, + "line": 186, "column": 16 } } @@ -20181,15 +20181,15 @@ "binop": null }, "value": "data", - "start": 5139, - "end": 5143, + "start": 5184, + "end": 5188, "loc": { "start": { - "line": 184, + "line": 186, "column": 16 }, "end": { - "line": 184, + "line": 186, "column": 20 } } @@ -20207,15 +20207,15 @@ "binop": null, "updateContext": null }, - "start": 5143, - "end": 5144, + "start": 5188, + "end": 5189, "loc": { "start": { - "line": 184, + "line": 186, "column": 20 }, "end": { - "line": 184, + "line": 186, "column": 21 } } @@ -20233,15 +20233,15 @@ "binop": null }, "value": "component", - "start": 5144, - "end": 5153, + "start": 5189, + "end": 5198, "loc": { "start": { - "line": 184, + "line": 186, "column": 21 }, "end": { - "line": 184, + "line": 186, "column": 30 } } @@ -20259,15 +20259,15 @@ "binop": null, "updateContext": null }, - "start": 5153, - "end": 5154, + "start": 5198, + "end": 5199, "loc": { "start": { - "line": 184, + "line": 186, "column": 30 }, "end": { - "line": 184, + "line": 186, "column": 31 } } @@ -20285,15 +20285,15 @@ "binop": null, "updateContext": null }, - "start": 5154, - "end": 5155, + "start": 5199, + "end": 5200, "loc": { "start": { - "line": 184, + "line": 186, "column": 31 }, "end": { - "line": 184, + "line": 186, "column": 32 } } @@ -20312,15 +20312,15 @@ "updateContext": null }, "value": "onRemove", - "start": 5156, - "end": 5166, + "start": 5201, + "end": 5211, "loc": { "start": { - "line": 184, + "line": 186, "column": 33 }, "end": { - "line": 184, + "line": 186, "column": 43 } } @@ -20337,15 +20337,15 @@ "postfix": false, "binop": null }, - "start": 5166, - "end": 5167, + "start": 5211, + "end": 5212, "loc": { "start": { - "line": 184, + "line": 186, "column": 43 }, "end": { - "line": 184, + "line": 186, "column": 44 } } @@ -20365,15 +20365,15 @@ "updateContext": null }, "value": "delete", - "start": 5173, - "end": 5179, + "start": 5218, + "end": 5224, "loc": { "start": { - "line": 186, + "line": 188, "column": 4 }, "end": { - "line": 186, + "line": 188, "column": 10 } } @@ -20393,15 +20393,15 @@ "updateContext": null }, "value": "this", - "start": 5180, - "end": 5184, + "start": 5225, + "end": 5229, "loc": { "start": { - "line": 186, + "line": 188, "column": 11 }, "end": { - "line": 186, + "line": 188, "column": 15 } } @@ -20419,15 +20419,15 @@ "binop": null, "updateContext": null }, - "start": 5184, - "end": 5185, + "start": 5229, + "end": 5230, "loc": { "start": { - "line": 186, + "line": 188, "column": 15 }, "end": { - "line": 186, + "line": 188, "column": 16 } } @@ -20445,15 +20445,15 @@ "binop": null }, "value": "data", - "start": 5185, - "end": 5189, + "start": 5230, + "end": 5234, "loc": { "start": { - "line": 186, + "line": 188, "column": 16 }, "end": { - "line": 186, + "line": 188, "column": 20 } } @@ -20471,15 +20471,15 @@ "binop": null, "updateContext": null }, - "start": 5189, - "end": 5190, + "start": 5234, + "end": 5235, "loc": { "start": { - "line": 186, + "line": 188, "column": 20 }, "end": { - "line": 186, + "line": 188, "column": 21 } } @@ -20497,15 +20497,15 @@ "binop": null }, "value": "component", - "start": 5190, - "end": 5199, + "start": 5235, + "end": 5244, "loc": { "start": { - "line": 186, + "line": 188, "column": 21 }, "end": { - "line": 186, + "line": 188, "column": 30 } } @@ -20523,15 +20523,15 @@ "binop": null, "updateContext": null }, - "start": 5199, - "end": 5200, + "start": 5244, + "end": 5245, "loc": { "start": { - "line": 186, + "line": 188, "column": 30 }, "end": { - "line": 186, + "line": 188, "column": 31 } } @@ -20548,15 +20548,15 @@ "postfix": false, "binop": null }, - "start": 5204, - "end": 5205, + "start": 5249, + "end": 5250, "loc": { "start": { - "line": 187, + "line": 189, "column": 3 }, "end": { - "line": 187, + "line": 189, "column": 4 } } @@ -20573,15 +20573,15 @@ "postfix": false, "binop": null }, - "start": 5208, - "end": 5209, + "start": 5253, + "end": 5254, "loc": { "start": { - "line": 188, + "line": 190, "column": 2 }, "end": { - "line": 188, + "line": 190, "column": 3 } } @@ -20601,15 +20601,15 @@ "updateContext": null }, "value": "return", - "start": 5212, - "end": 5218, + "start": 5257, + "end": 5263, "loc": { "start": { - "line": 189, + "line": 191, "column": 2 }, "end": { - "line": 189, + "line": 191, "column": 8 } } @@ -20629,15 +20629,15 @@ "updateContext": null }, "value": "this", - "start": 5219, - "end": 5223, + "start": 5264, + "end": 5268, "loc": { "start": { - "line": 189, + "line": 191, "column": 9 }, "end": { - "line": 189, + "line": 191, "column": 13 } } @@ -20654,15 +20654,15 @@ "postfix": false, "binop": null }, - "start": 5225, - "end": 5226, + "start": 5270, + "end": 5271, "loc": { "start": { - "line": 190, + "line": 192, "column": 1 }, "end": { - "line": 190, + "line": 192, "column": 2 } } @@ -20670,15 +20670,15 @@ { "type": "CommentLine", "value": " Remove all components", - "start": 5229, - "end": 5253, + "start": 5274, + "end": 5298, "loc": { "start": { - "line": 192, + "line": 194, "column": 1 }, "end": { - "line": 192, + "line": 194, "column": 25 } } @@ -20686,15 +20686,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes all components from the entity.\n\t *\n\t * @example\n\t * entity.removeAll()\n\t *\n\t * @return {Object} The original entity that removeAll() was called on, so that operations can be chained.\n\t ", - "start": 5256, - "end": 5460, + "start": 5301, + "end": 5505, "loc": { "start": { - "line": 194, + "line": 196, "column": 1 }, "end": { - "line": 201, + "line": 203, "column": 4 } } @@ -20712,15 +20712,15 @@ "binop": null }, "value": "removeAll", - "start": 5462, - "end": 5471, + "start": 5507, + "end": 5516, "loc": { "start": { - "line": 202, + "line": 204, "column": 1 }, "end": { - "line": 202, + "line": 204, "column": 10 } } @@ -20737,15 +20737,15 @@ "postfix": false, "binop": null }, - "start": 5471, - "end": 5472, + "start": 5516, + "end": 5517, "loc": { "start": { - "line": 202, + "line": 204, "column": 10 }, "end": { - "line": 202, + "line": 204, "column": 11 } } @@ -20762,15 +20762,15 @@ "postfix": false, "binop": null }, - "start": 5472, - "end": 5473, + "start": 5517, + "end": 5518, "loc": { "start": { - "line": 202, + "line": 204, "column": 11 }, "end": { - "line": 202, + "line": 204, "column": 12 } } @@ -20787,15 +20787,15 @@ "postfix": false, "binop": null }, - "start": 5474, - "end": 5475, + "start": 5519, + "end": 5520, "loc": { "start": { - "line": 202, + "line": 204, "column": 13 }, "end": { - "line": 202, + "line": 204, "column": 14 } } @@ -20815,15 +20815,15 @@ "updateContext": null }, "value": "this", - "start": 5478, - "end": 5482, + "start": 5523, + "end": 5527, "loc": { "start": { - "line": 203, + "line": 205, "column": 2 }, "end": { - "line": 203, + "line": 205, "column": 6 } } @@ -20841,15 +20841,15 @@ "binop": null, "updateContext": null }, - "start": 5482, - "end": 5483, + "start": 5527, + "end": 5528, "loc": { "start": { - "line": 203, + "line": 205, "column": 6 }, "end": { - "line": 203, + "line": 205, "column": 7 } } @@ -20867,15 +20867,15 @@ "binop": null }, "value": "remove", - "start": 5483, - "end": 5489, + "start": 5528, + "end": 5534, "loc": { "start": { - "line": 203, + "line": 205, "column": 7 }, "end": { - "line": 203, + "line": 205, "column": 13 } } @@ -20892,15 +20892,15 @@ "postfix": false, "binop": null }, - "start": 5489, - "end": 5490, + "start": 5534, + "end": 5535, "loc": { "start": { - "line": 203, + "line": 205, "column": 13 }, "end": { - "line": 203, + "line": 205, "column": 14 } } @@ -20918,15 +20918,15 @@ "binop": null, "updateContext": null }, - "start": 5490, - "end": 5493, + "start": 5535, + "end": 5538, "loc": { "start": { - "line": 203, + "line": 205, "column": 14 }, "end": { - "line": 203, + "line": 205, "column": 17 } } @@ -20944,15 +20944,15 @@ "binop": null }, "value": "Object", - "start": 5493, - "end": 5499, + "start": 5538, + "end": 5544, "loc": { "start": { - "line": 203, + "line": 205, "column": 17 }, "end": { - "line": 203, + "line": 205, "column": 23 } } @@ -20970,15 +20970,15 @@ "binop": null, "updateContext": null }, - "start": 5499, - "end": 5500, + "start": 5544, + "end": 5545, "loc": { "start": { - "line": 203, + "line": 205, "column": 23 }, "end": { - "line": 203, + "line": 205, "column": 24 } } @@ -20996,15 +20996,15 @@ "binop": null }, "value": "keys", - "start": 5500, - "end": 5504, + "start": 5545, + "end": 5549, "loc": { "start": { - "line": 203, + "line": 205, "column": 24 }, "end": { - "line": 203, + "line": 205, "column": 28 } } @@ -21021,15 +21021,15 @@ "postfix": false, "binop": null }, - "start": 5504, - "end": 5505, + "start": 5549, + "end": 5550, "loc": { "start": { - "line": 203, + "line": 205, "column": 28 }, "end": { - "line": 203, + "line": 205, "column": 29 } } @@ -21049,15 +21049,15 @@ "updateContext": null }, "value": "this", - "start": 5505, - "end": 5509, + "start": 5550, + "end": 5554, "loc": { "start": { - "line": 203, + "line": 205, "column": 29 }, "end": { - "line": 203, + "line": 205, "column": 33 } } @@ -21075,15 +21075,15 @@ "binop": null, "updateContext": null }, - "start": 5509, - "end": 5510, + "start": 5554, + "end": 5555, "loc": { "start": { - "line": 203, + "line": 205, "column": 33 }, "end": { - "line": 203, + "line": 205, "column": 34 } } @@ -21101,15 +21101,15 @@ "binop": null }, "value": "data", - "start": 5510, - "end": 5514, + "start": 5555, + "end": 5559, "loc": { "start": { - "line": 203, + "line": 205, "column": 34 }, "end": { - "line": 203, + "line": 205, "column": 38 } } @@ -21126,15 +21126,15 @@ "postfix": false, "binop": null }, - "start": 5514, - "end": 5515, + "start": 5559, + "end": 5560, "loc": { "start": { - "line": 203, + "line": 205, "column": 38 }, "end": { - "line": 203, + "line": 205, "column": 39 } } @@ -21151,15 +21151,15 @@ "postfix": false, "binop": null }, - "start": 5515, - "end": 5516, + "start": 5560, + "end": 5561, "loc": { "start": { - "line": 203, + "line": 205, "column": 39 }, "end": { - "line": 203, + "line": 205, "column": 40 } } @@ -21179,15 +21179,15 @@ "updateContext": null }, "value": "this", - "start": 5519, - "end": 5523, + "start": 5564, + "end": 5568, "loc": { "start": { - "line": 204, + "line": 206, "column": 2 }, "end": { - "line": 204, + "line": 206, "column": 6 } } @@ -21205,15 +21205,15 @@ "binop": null, "updateContext": null }, - "start": 5523, - "end": 5524, + "start": 5568, + "end": 5569, "loc": { "start": { - "line": 204, + "line": 206, "column": 6 }, "end": { - "line": 204, + "line": 206, "column": 7 } } @@ -21231,15 +21231,15 @@ "binop": null }, "value": "data", - "start": 5524, - "end": 5528, + "start": 5569, + "end": 5573, "loc": { "start": { - "line": 204, + "line": 206, "column": 7 }, "end": { - "line": 204, + "line": 206, "column": 11 } } @@ -21258,15 +21258,15 @@ "updateContext": null }, "value": "=", - "start": 5529, - "end": 5530, + "start": 5574, + "end": 5575, "loc": { "start": { - "line": 204, + "line": 206, "column": 12 }, "end": { - "line": 204, + "line": 206, "column": 13 } } @@ -21283,15 +21283,15 @@ "postfix": false, "binop": null }, - "start": 5531, - "end": 5532, + "start": 5576, + "end": 5577, "loc": { "start": { - "line": 204, + "line": 206, "column": 14 }, "end": { - "line": 204, + "line": 206, "column": 15 } } @@ -21308,15 +21308,15 @@ "postfix": false, "binop": null }, - "start": 5532, - "end": 5533, + "start": 5577, + "end": 5578, "loc": { "start": { - "line": 204, + "line": 206, "column": 15 }, "end": { - "line": 204, + "line": 206, "column": 16 } } @@ -21336,15 +21336,15 @@ "updateContext": null }, "value": "return", - "start": 5536, - "end": 5542, + "start": 5581, + "end": 5587, "loc": { "start": { - "line": 205, + "line": 207, "column": 2 }, "end": { - "line": 205, + "line": 207, "column": 8 } } @@ -21364,15 +21364,15 @@ "updateContext": null }, "value": "this", - "start": 5543, - "end": 5547, + "start": 5588, + "end": 5592, "loc": { "start": { - "line": 205, + "line": 207, "column": 9 }, "end": { - "line": 205, + "line": 207, "column": 13 } } @@ -21389,15 +21389,15 @@ "postfix": false, "binop": null }, - "start": 5549, - "end": 5550, + "start": 5594, + "end": 5595, "loc": { "start": { - "line": 206, + "line": 208, "column": 1 }, "end": { - "line": 206, + "line": 208, "column": 2 } } @@ -21405,15 +21405,15 @@ { "type": "CommentBlock", "value": "*\n\t * Remove this entity and all of its components from the world. After an entity is destroyed, the object should be discarded,\n\t * and it is recommended to avoid re-using it.\n\t *\n\t * @example\n\t * entity.destroy()\n\t ", - "start": 5553, - "end": 5774, + "start": 5598, + "end": 5819, "loc": { "start": { - "line": 208, + "line": 210, "column": 1 }, "end": { - "line": 214, + "line": 216, "column": 4 } } @@ -21431,15 +21431,15 @@ "binop": null }, "value": "destroy", - "start": 5776, - "end": 5783, + "start": 5821, + "end": 5828, "loc": { "start": { - "line": 215, + "line": 217, "column": 1 }, "end": { - "line": 215, + "line": 217, "column": 8 } } @@ -21456,15 +21456,15 @@ "postfix": false, "binop": null }, - "start": 5783, - "end": 5784, + "start": 5828, + "end": 5829, "loc": { "start": { - "line": 215, + "line": 217, "column": 8 }, "end": { - "line": 215, + "line": 217, "column": 9 } } @@ -21481,15 +21481,15 @@ "postfix": false, "binop": null }, - "start": 5784, - "end": 5785, + "start": 5829, + "end": 5830, "loc": { "start": { - "line": 215, + "line": 217, "column": 9 }, "end": { - "line": 215, + "line": 217, "column": 10 } } @@ -21506,15 +21506,15 @@ "postfix": false, "binop": null }, - "start": 5786, - "end": 5787, + "start": 5831, + "end": 5832, "loc": { "start": { - "line": 215, + "line": 217, "column": 11 }, "end": { - "line": 215, + "line": 217, "column": 12 } } @@ -21534,15 +21534,15 @@ "updateContext": null }, "value": "this", - "start": 5790, - "end": 5794, + "start": 5835, + "end": 5839, "loc": { "start": { - "line": 216, + "line": 218, "column": 2 }, "end": { - "line": 216, + "line": 218, "column": 6 } } @@ -21560,15 +21560,15 @@ "binop": null, "updateContext": null }, - "start": 5794, - "end": 5795, + "start": 5839, + "end": 5840, "loc": { "start": { - "line": 216, + "line": 218, "column": 6 }, "end": { - "line": 216, + "line": 218, "column": 7 } } @@ -21586,15 +21586,15 @@ "binop": null }, "value": "removeAll", - "start": 5795, - "end": 5804, + "start": 5840, + "end": 5849, "loc": { "start": { - "line": 216, + "line": 218, "column": 7 }, "end": { - "line": 216, + "line": 218, "column": 16 } } @@ -21611,15 +21611,15 @@ "postfix": false, "binop": null }, - "start": 5804, - "end": 5805, + "start": 5849, + "end": 5850, "loc": { "start": { - "line": 216, + "line": 218, "column": 16 }, "end": { - "line": 216, + "line": 218, "column": 17 } } @@ -21636,15 +21636,15 @@ "postfix": false, "binop": null }, - "start": 5805, - "end": 5806, + "start": 5850, + "end": 5851, "loc": { "start": { - "line": 216, + "line": 218, "column": 17 }, "end": { - "line": 216, + "line": 218, "column": 18 } } @@ -21664,15 +21664,15 @@ "updateContext": null }, "value": "if", - "start": 5810, - "end": 5812, + "start": 5855, + "end": 5857, "loc": { "start": { - "line": 218, + "line": 220, "column": 2 }, "end": { - "line": 218, + "line": 220, "column": 4 } } @@ -21689,15 +21689,15 @@ "postfix": false, "binop": null }, - "start": 5813, - "end": 5814, + "start": 5858, + "end": 5859, "loc": { "start": { - "line": 218, + "line": 220, "column": 5 }, "end": { - "line": 218, + "line": 220, "column": 6 } } @@ -21717,15 +21717,15 @@ "updateContext": null }, "value": "this", - "start": 5814, - "end": 5818, + "start": 5859, + "end": 5863, "loc": { "start": { - "line": 218, + "line": 220, "column": 6 }, "end": { - "line": 218, + "line": 220, "column": 10 } } @@ -21743,15 +21743,15 @@ "binop": null, "updateContext": null }, - "start": 5818, - "end": 5819, + "start": 5863, + "end": 5864, "loc": { "start": { - "line": 218, + "line": 220, "column": 10 }, "end": { - "line": 218, + "line": 220, "column": 11 } } @@ -21769,15 +21769,15 @@ "binop": null }, "value": "valid", - "start": 5819, - "end": 5824, + "start": 5864, + "end": 5869, "loc": { "start": { - "line": 218, + "line": 220, "column": 11 }, "end": { - "line": 218, + "line": 220, "column": 16 } } @@ -21794,15 +21794,15 @@ "postfix": false, "binop": null }, - "start": 5824, - "end": 5825, + "start": 5869, + "end": 5870, "loc": { "start": { - "line": 218, + "line": 220, "column": 16 }, "end": { - "line": 218, + "line": 220, "column": 17 } } @@ -21819,15 +21819,15 @@ "postfix": false, "binop": null }, - "start": 5825, - "end": 5826, + "start": 5870, + "end": 5871, "loc": { "start": { - "line": 218, + "line": 220, "column": 17 }, "end": { - "line": 218, + "line": 220, "column": 18 } } @@ -21844,15 +21844,15 @@ "postfix": false, "binop": null }, - "start": 5826, - "end": 5827, + "start": 5871, + "end": 5872, "loc": { "start": { - "line": 218, + "line": 220, "column": 18 }, "end": { - "line": 218, + "line": 220, "column": 19 } } @@ -21869,15 +21869,15 @@ "postfix": false, "binop": null }, - "start": 5828, - "end": 5829, + "start": 5873, + "end": 5874, "loc": { "start": { - "line": 218, + "line": 220, "column": 20 }, "end": { - "line": 218, + "line": 220, "column": 21 } } @@ -21885,15 +21885,15 @@ { "type": "CommentLine", "value": " Remove from the index, to update match all index", - "start": 5833, - "end": 5884, + "start": 5878, + "end": 5929, "loc": { "start": { - "line": 219, + "line": 221, "column": 3 }, "end": { - "line": 219, + "line": 221, "column": 54 } } @@ -21913,15 +21913,15 @@ "updateContext": null }, "value": "this", - "start": 5888, - "end": 5892, + "start": 5933, + "end": 5937, "loc": { "start": { - "line": 220, + "line": 222, "column": 3 }, "end": { - "line": 220, + "line": 222, "column": 7 } } @@ -21939,15 +21939,15 @@ "binop": null, "updateContext": null }, - "start": 5892, - "end": 5893, + "start": 5937, + "end": 5938, "loc": { "start": { - "line": 220, + "line": 222, "column": 7 }, "end": { - "line": 220, + "line": 222, "column": 8 } } @@ -21965,15 +21965,15 @@ "binop": null }, "value": "world", - "start": 5893, - "end": 5898, + "start": 5938, + "end": 5943, "loc": { "start": { - "line": 220, + "line": 222, "column": 8 }, "end": { - "line": 220, + "line": 222, "column": 13 } } @@ -21991,15 +21991,15 @@ "binop": null, "updateContext": null }, - "start": 5898, - "end": 5899, + "start": 5943, + "end": 5944, "loc": { "start": { - "line": 220, + "line": 222, "column": 13 }, "end": { - "line": 220, + "line": 222, "column": 14 } } @@ -22017,15 +22017,15 @@ "binop": null }, "value": "index", - "start": 5899, - "end": 5904, + "start": 5944, + "end": 5949, "loc": { "start": { - "line": 220, + "line": 222, "column": 14 }, "end": { - "line": 220, + "line": 222, "column": 19 } } @@ -22043,15 +22043,15 @@ "binop": null, "updateContext": null }, - "start": 5904, - "end": 5905, + "start": 5949, + "end": 5950, "loc": { "start": { - "line": 220, + "line": 222, "column": 19 }, "end": { - "line": 220, + "line": 222, "column": 20 } } @@ -22069,15 +22069,15 @@ "binop": null }, "value": "remove", - "start": 5905, - "end": 5911, + "start": 5950, + "end": 5956, "loc": { "start": { - "line": 220, + "line": 222, "column": 20 }, "end": { - "line": 220, + "line": 222, "column": 26 } } @@ -22094,15 +22094,15 @@ "postfix": false, "binop": null }, - "start": 5911, - "end": 5912, + "start": 5956, + "end": 5957, "loc": { "start": { - "line": 220, + "line": 222, "column": 26 }, "end": { - "line": 220, + "line": 222, "column": 27 } } @@ -22122,15 +22122,15 @@ "updateContext": null }, "value": "this", - "start": 5912, - "end": 5916, + "start": 5957, + "end": 5961, "loc": { "start": { - "line": 220, + "line": 222, "column": 27 }, "end": { - "line": 220, + "line": 222, "column": 31 } } @@ -22147,15 +22147,15 @@ "postfix": false, "binop": null }, - "start": 5916, - "end": 5917, + "start": 5961, + "end": 5962, "loc": { "start": { - "line": 220, + "line": 222, "column": 31 }, "end": { - "line": 220, + "line": 222, "column": 32 } } @@ -22163,15 +22163,15 @@ { "type": "CommentLine", "value": " Remove from world", - "start": 5922, - "end": 5942, + "start": 5967, + "end": 5987, "loc": { "start": { - "line": 222, + "line": 224, "column": 3 }, "end": { - "line": 222, + "line": 224, "column": 23 } } @@ -22191,15 +22191,15 @@ "updateContext": null }, "value": "this", - "start": 5946, - "end": 5950, + "start": 5991, + "end": 5995, "loc": { "start": { - "line": 223, + "line": 225, "column": 3 }, "end": { - "line": 223, + "line": 225, "column": 7 } } @@ -22217,15 +22217,15 @@ "binop": null, "updateContext": null }, - "start": 5950, - "end": 5951, + "start": 5995, + "end": 5996, "loc": { "start": { - "line": 223, + "line": 225, "column": 7 }, "end": { - "line": 223, + "line": 225, "column": 8 } } @@ -22243,15 +22243,15 @@ "binop": null }, "value": "world", - "start": 5951, - "end": 5956, + "start": 5996, + "end": 6001, "loc": { "start": { - "line": 223, + "line": 225, "column": 8 }, "end": { - "line": 223, + "line": 225, "column": 13 } } @@ -22269,15 +22269,15 @@ "binop": null, "updateContext": null }, - "start": 5956, - "end": 5957, + "start": 6001, + "end": 6002, "loc": { "start": { - "line": 223, + "line": 225, "column": 13 }, "end": { - "line": 223, + "line": 225, "column": 14 } } @@ -22295,15 +22295,15 @@ "binop": null }, "value": "entities", - "start": 5957, - "end": 5965, + "start": 6002, + "end": 6010, "loc": { "start": { - "line": 223, + "line": 225, "column": 14 }, "end": { - "line": 223, + "line": 225, "column": 22 } } @@ -22321,15 +22321,15 @@ "binop": null, "updateContext": null }, - "start": 5965, - "end": 5966, + "start": 6010, + "end": 6011, "loc": { "start": { - "line": 223, + "line": 225, "column": 22 }, "end": { - "line": 223, + "line": 225, "column": 23 } } @@ -22349,15 +22349,15 @@ "updateContext": null }, "value": "delete", - "start": 5966, - "end": 5972, + "start": 6011, + "end": 6017, "loc": { "start": { - "line": 223, + "line": 225, "column": 23 }, "end": { - "line": 223, + "line": 225, "column": 29 } } @@ -22374,15 +22374,15 @@ "postfix": false, "binop": null }, - "start": 5972, - "end": 5973, + "start": 6017, + "end": 6018, "loc": { "start": { - "line": 223, + "line": 225, "column": 29 }, "end": { - "line": 223, + "line": 225, "column": 30 } } @@ -22402,15 +22402,15 @@ "updateContext": null }, "value": "this", - "start": 5973, - "end": 5977, + "start": 6018, + "end": 6022, "loc": { "start": { - "line": 223, + "line": 225, "column": 30 }, "end": { - "line": 223, + "line": 225, "column": 34 } } @@ -22428,15 +22428,15 @@ "binop": null, "updateContext": null }, - "start": 5977, - "end": 5978, + "start": 6022, + "end": 6023, "loc": { "start": { - "line": 223, + "line": 225, "column": 34 }, "end": { - "line": 223, + "line": 225, "column": 35 } } @@ -22454,15 +22454,15 @@ "binop": null }, "value": "_id", - "start": 5978, - "end": 5981, + "start": 6023, + "end": 6026, "loc": { "start": { - "line": 223, + "line": 225, "column": 35 }, "end": { - "line": 223, + "line": 225, "column": 38 } } @@ -22479,15 +22479,15 @@ "postfix": false, "binop": null }, - "start": 5981, - "end": 5982, + "start": 6026, + "end": 6027, "loc": { "start": { - "line": 223, + "line": 225, "column": 38 }, "end": { - "line": 223, + "line": 225, "column": 39 } } @@ -22507,15 +22507,15 @@ "updateContext": null }, "value": "this", - "start": 5986, - "end": 5990, + "start": 6031, + "end": 6035, "loc": { "start": { - "line": 224, + "line": 226, "column": 3 }, "end": { - "line": 224, + "line": 226, "column": 7 } } @@ -22533,15 +22533,15 @@ "binop": null, "updateContext": null }, - "start": 5990, - "end": 5991, + "start": 6035, + "end": 6036, "loc": { "start": { - "line": 224, + "line": 226, "column": 7 }, "end": { - "line": 224, + "line": 226, "column": 8 } } @@ -22559,15 +22559,15 @@ "binop": null }, "value": "_id", - "start": 5991, - "end": 5994, + "start": 6036, + "end": 6039, "loc": { "start": { - "line": 224, + "line": 226, "column": 8 }, "end": { - "line": 224, + "line": 226, "column": 11 } } @@ -22586,15 +22586,15 @@ "updateContext": null }, "value": "=", - "start": 5995, - "end": 5996, + "start": 6040, + "end": 6041, "loc": { "start": { - "line": 224, + "line": 226, "column": 12 }, "end": { - "line": 224, + "line": 226, "column": 13 } } @@ -22612,15 +22612,15 @@ "binop": null }, "value": "undefined", - "start": 5997, - "end": 6006, + "start": 6042, + "end": 6051, "loc": { "start": { - "line": 224, + "line": 226, "column": 14 }, "end": { - "line": 224, + "line": 226, "column": 23 } } @@ -22637,15 +22637,15 @@ "postfix": false, "binop": null }, - "start": 6009, - "end": 6010, + "start": 6054, + "end": 6055, "loc": { "start": { - "line": 225, + "line": 227, "column": 2 }, "end": { - "line": 225, + "line": 227, "column": 3 } } @@ -22662,15 +22662,15 @@ "postfix": false, "binop": null }, - "start": 6012, - "end": 6013, + "start": 6057, + "end": 6058, "loc": { "start": { - "line": 226, + "line": 228, "column": 1 }, "end": { - "line": 226, + "line": 228, "column": 2 } } @@ -22678,15 +22678,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns true if this is a valid, existing, and usable entity, which is attached to a world.\n\t *\n\t * @example\n\t * if (entity.valid()) {...}\n\t *\n\t * @return {boolean} true or false\n\t ", - "start": 6016, - "end": 6207, + "start": 6061, + "end": 6252, "loc": { "start": { - "line": 228, + "line": 230, "column": 1 }, "end": { - "line": 235, + "line": 237, "column": 4 } } @@ -22704,15 +22704,15 @@ "binop": null }, "value": "valid", - "start": 6209, - "end": 6214, + "start": 6254, + "end": 6259, "loc": { "start": { - "line": 236, + "line": 238, "column": 1 }, "end": { - "line": 236, + "line": 238, "column": 6 } } @@ -22729,15 +22729,15 @@ "postfix": false, "binop": null }, - "start": 6214, - "end": 6215, + "start": 6259, + "end": 6260, "loc": { "start": { - "line": 236, + "line": 238, "column": 6 }, "end": { - "line": 236, + "line": 238, "column": 7 } } @@ -22754,15 +22754,15 @@ "postfix": false, "binop": null }, - "start": 6215, - "end": 6216, + "start": 6260, + "end": 6261, "loc": { "start": { - "line": 236, + "line": 238, "column": 7 }, "end": { - "line": 236, + "line": 238, "column": 8 } } @@ -22779,15 +22779,15 @@ "postfix": false, "binop": null }, - "start": 6217, - "end": 6218, + "start": 6262, + "end": 6263, "loc": { "start": { - "line": 236, + "line": 238, "column": 9 }, "end": { - "line": 236, + "line": 238, "column": 10 } } @@ -22795,15 +22795,15 @@ { "type": "CommentLine", "value": " Note: No need to actually look in the world for the ID, if entities are only ever copied by reference.", - "start": 6221, - "end": 6326, + "start": 6266, + "end": 6371, "loc": { "start": { - "line": 237, + "line": 239, "column": 2 }, "end": { - "line": 237, + "line": 239, "column": 107 } } @@ -22811,15 +22811,15 @@ { "type": "CommentLine", "value": " If entities are ever deep/shallow copied, this function will need to check this to be more robust.", - "start": 6329, - "end": 6430, + "start": 6374, + "end": 6475, "loc": { "start": { - "line": 238, + "line": 240, "column": 2 }, "end": { - "line": 238, + "line": 240, "column": 103 } } @@ -22839,15 +22839,15 @@ "updateContext": null }, "value": "return", - "start": 6433, - "end": 6439, + "start": 6478, + "end": 6484, "loc": { "start": { - "line": 239, + "line": 241, "column": 2 }, "end": { - "line": 239, + "line": 241, "column": 8 } } @@ -22867,15 +22867,15 @@ "updateContext": null }, "value": "this", - "start": 6440, - "end": 6444, + "start": 6485, + "end": 6489, "loc": { "start": { - "line": 239, + "line": 241, "column": 9 }, "end": { - "line": 239, + "line": 241, "column": 13 } } @@ -22893,15 +22893,15 @@ "binop": null, "updateContext": null }, - "start": 6444, - "end": 6445, + "start": 6489, + "end": 6490, "loc": { "start": { - "line": 239, + "line": 241, "column": 13 }, "end": { - "line": 239, + "line": 241, "column": 14 } } @@ -22919,15 +22919,15 @@ "binop": null }, "value": "world", - "start": 6445, - "end": 6450, + "start": 6490, + "end": 6495, "loc": { "start": { - "line": 239, + "line": 241, "column": 14 }, "end": { - "line": 239, + "line": 241, "column": 19 } } @@ -22946,15 +22946,15 @@ "updateContext": null }, "value": "&&", - "start": 6451, - "end": 6453, + "start": 6496, + "end": 6498, "loc": { "start": { - "line": 239, + "line": 241, "column": 20 }, "end": { - "line": 239, + "line": 241, "column": 22 } } @@ -22974,15 +22974,15 @@ "updateContext": null }, "value": "this", - "start": 6454, - "end": 6458, + "start": 6499, + "end": 6503, "loc": { "start": { - "line": 239, + "line": 241, "column": 23 }, "end": { - "line": 239, + "line": 241, "column": 27 } } @@ -23000,15 +23000,15 @@ "binop": null, "updateContext": null }, - "start": 6458, - "end": 6459, + "start": 6503, + "end": 6504, "loc": { "start": { - "line": 239, + "line": 241, "column": 27 }, "end": { - "line": 239, + "line": 241, "column": 28 } } @@ -23026,15 +23026,15 @@ "binop": null }, "value": "_id", - "start": 6459, - "end": 6462, + "start": 6504, + "end": 6507, "loc": { "start": { - "line": 239, + "line": 241, "column": 28 }, "end": { - "line": 239, + "line": 241, "column": 31 } } @@ -23053,15 +23053,15 @@ "updateContext": null }, "value": "!==", - "start": 6463, - "end": 6466, + "start": 6508, + "end": 6511, "loc": { "start": { - "line": 239, + "line": 241, "column": 32 }, "end": { - "line": 239, + "line": 241, "column": 35 } } @@ -23079,15 +23079,15 @@ "binop": null }, "value": "undefined", - "start": 6467, - "end": 6476, + "start": 6512, + "end": 6521, "loc": { "start": { - "line": 239, + "line": 241, "column": 36 }, "end": { - "line": 239, + "line": 241, "column": 45 } } @@ -23104,15 +23104,15 @@ "postfix": false, "binop": null }, - "start": 6478, - "end": 6479, + "start": 6523, + "end": 6524, "loc": { "start": { - "line": 240, + "line": 242, "column": 1 }, "end": { - "line": 240, + "line": 242, "column": 2 } } @@ -23120,15 +23120,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns unique entity ID as a string.\n\t *\n\t * @example\n\t * let entityId = entity.toString()\n\t *\n\t * @return {string} String representation of the entity ID.\n\t ", - "start": 6482, - "end": 6651, + "start": 6527, + "end": 6696, "loc": { "start": { - "line": 242, + "line": 244, "column": 1 }, "end": { - "line": 249, + "line": 251, "column": 4 } } @@ -23146,15 +23146,15 @@ "binop": null }, "value": "toString", - "start": 6653, - "end": 6661, + "start": 6698, + "end": 6706, "loc": { "start": { - "line": 250, + "line": 252, "column": 1 }, "end": { - "line": 250, + "line": 252, "column": 9 } } @@ -23171,15 +23171,15 @@ "postfix": false, "binop": null }, - "start": 6661, - "end": 6662, + "start": 6706, + "end": 6707, "loc": { "start": { - "line": 250, + "line": 252, "column": 9 }, "end": { - "line": 250, + "line": 252, "column": 10 } } @@ -23196,15 +23196,15 @@ "postfix": false, "binop": null }, - "start": 6662, - "end": 6663, + "start": 6707, + "end": 6708, "loc": { "start": { - "line": 250, + "line": 252, "column": 10 }, "end": { - "line": 250, + "line": 252, "column": 11 } } @@ -23221,15 +23221,15 @@ "postfix": false, "binop": null }, - "start": 6664, - "end": 6665, + "start": 6709, + "end": 6710, "loc": { "start": { - "line": 250, + "line": 252, "column": 12 }, "end": { - "line": 250, + "line": 252, "column": 13 } } @@ -23249,15 +23249,15 @@ "updateContext": null }, "value": "return", - "start": 6668, - "end": 6674, + "start": 6713, + "end": 6719, "loc": { "start": { - "line": 251, + "line": 253, "column": 2 }, "end": { - "line": 251, + "line": 253, "column": 8 } } @@ -23275,15 +23275,15 @@ "binop": null }, "value": "String", - "start": 6675, - "end": 6681, + "start": 6720, + "end": 6726, "loc": { "start": { - "line": 251, + "line": 253, "column": 9 }, "end": { - "line": 251, + "line": 253, "column": 15 } } @@ -23300,15 +23300,15 @@ "postfix": false, "binop": null }, - "start": 6681, - "end": 6682, + "start": 6726, + "end": 6727, "loc": { "start": { - "line": 251, + "line": 253, "column": 15 }, "end": { - "line": 251, + "line": 253, "column": 16 } } @@ -23328,15 +23328,15 @@ "updateContext": null }, "value": "this", - "start": 6682, - "end": 6686, + "start": 6727, + "end": 6731, "loc": { "start": { - "line": 251, + "line": 253, "column": 16 }, "end": { - "line": 251, + "line": 253, "column": 20 } } @@ -23354,15 +23354,15 @@ "binop": null, "updateContext": null }, - "start": 6686, - "end": 6687, + "start": 6731, + "end": 6732, "loc": { "start": { - "line": 251, + "line": 253, "column": 20 }, "end": { - "line": 251, + "line": 253, "column": 21 } } @@ -23380,15 +23380,15 @@ "binop": null }, "value": "_id", - "start": 6687, - "end": 6690, + "start": 6732, + "end": 6735, "loc": { "start": { - "line": 251, + "line": 253, "column": 21 }, "end": { - "line": 251, + "line": 253, "column": 24 } } @@ -23405,15 +23405,15 @@ "postfix": false, "binop": null }, - "start": 6690, - "end": 6691, + "start": 6735, + "end": 6736, "loc": { "start": { - "line": 251, + "line": 253, "column": 24 }, "end": { - "line": 251, + "line": 253, "column": 25 } } @@ -23430,15 +23430,15 @@ "postfix": false, "binop": null }, - "start": 6693, - "end": 6694, + "start": 6738, + "end": 6739, "loc": { "start": { - "line": 252, + "line": 254, "column": 1 }, "end": { - "line": 252, + "line": 254, "column": 2 } } @@ -23446,15 +23446,15 @@ { "type": "CommentBlock", "value": "*\n\t * Serializes entire entity and components to JSON.\n\t * Note: Defining toJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * let serializedEntity = entity.toJSON()\n\t *\n\t * @return {string} JSON encoded string\n\t ", - "start": 6697, - "end": 6953, + "start": 6742, + "end": 6998, "loc": { "start": { - "line": 254, + "line": 256, "column": 1 }, "end": { - "line": 262, + "line": 264, "column": 4 } } @@ -23472,15 +23472,15 @@ "binop": null }, "value": "toJSON", - "start": 6955, - "end": 6961, + "start": 7000, + "end": 7006, "loc": { "start": { - "line": 263, + "line": 265, "column": 1 }, "end": { - "line": 263, + "line": 265, "column": 7 } } @@ -23497,15 +23497,15 @@ "postfix": false, "binop": null }, - "start": 6961, - "end": 6962, + "start": 7006, + "end": 7007, "loc": { "start": { - "line": 263, + "line": 265, "column": 7 }, "end": { - "line": 263, + "line": 265, "column": 8 } } @@ -23522,15 +23522,15 @@ "postfix": false, "binop": null }, - "start": 6962, - "end": 6963, + "start": 7007, + "end": 7008, "loc": { "start": { - "line": 263, + "line": 265, "column": 8 }, "end": { - "line": 263, + "line": 265, "column": 9 } } @@ -23547,15 +23547,15 @@ "postfix": false, "binop": null }, - "start": 6964, - "end": 6965, + "start": 7009, + "end": 7010, "loc": { "start": { - "line": 263, + "line": 265, "column": 10 }, "end": { - "line": 263, + "line": 265, "column": 11 } } @@ -23575,15 +23575,15 @@ "updateContext": null }, "value": "return", - "start": 6968, - "end": 6974, + "start": 7013, + "end": 7019, "loc": { "start": { - "line": 264, + "line": 266, "column": 2 }, "end": { - "line": 264, + "line": 266, "column": 8 } } @@ -23601,15 +23601,15 @@ "binop": null }, "value": "JSON", - "start": 6975, - "end": 6979, + "start": 7020, + "end": 7024, "loc": { "start": { - "line": 264, + "line": 266, "column": 9 }, "end": { - "line": 264, + "line": 266, "column": 13 } } @@ -23627,15 +23627,15 @@ "binop": null, "updateContext": null }, - "start": 6979, - "end": 6980, + "start": 7024, + "end": 7025, "loc": { "start": { - "line": 264, + "line": 266, "column": 13 }, "end": { - "line": 264, + "line": 266, "column": 14 } } @@ -23653,15 +23653,15 @@ "binop": null }, "value": "stringify", - "start": 6980, - "end": 6989, + "start": 7025, + "end": 7034, "loc": { "start": { - "line": 264, + "line": 266, "column": 14 }, "end": { - "line": 264, + "line": 266, "column": 23 } } @@ -23678,15 +23678,15 @@ "postfix": false, "binop": null }, - "start": 6989, - "end": 6990, + "start": 7034, + "end": 7035, "loc": { "start": { - "line": 264, + "line": 266, "column": 23 }, "end": { - "line": 264, + "line": 266, "column": 24 } } @@ -23706,15 +23706,15 @@ "updateContext": null }, "value": "this", - "start": 6990, - "end": 6994, + "start": 7035, + "end": 7039, "loc": { "start": { - "line": 264, + "line": 266, "column": 24 }, "end": { - "line": 264, + "line": 266, "column": 28 } } @@ -23732,15 +23732,15 @@ "binop": null, "updateContext": null }, - "start": 6994, - "end": 6995, + "start": 7039, + "end": 7040, "loc": { "start": { - "line": 264, + "line": 266, "column": 28 }, "end": { - "line": 264, + "line": 266, "column": 29 } } @@ -23758,15 +23758,15 @@ "binop": null }, "value": "data", - "start": 6995, - "end": 6999, + "start": 7040, + "end": 7044, "loc": { "start": { - "line": 264, + "line": 266, "column": 29 }, "end": { - "line": 264, + "line": 266, "column": 33 } } @@ -23783,15 +23783,15 @@ "postfix": false, "binop": null }, - "start": 6999, - "end": 7000, + "start": 7044, + "end": 7045, "loc": { "start": { - "line": 264, + "line": 266, "column": 33 }, "end": { - "line": 264, + "line": 266, "column": 34 } } @@ -23808,15 +23808,15 @@ "postfix": false, "binop": null }, - "start": 7002, - "end": 7003, + "start": 7047, + "end": 7048, "loc": { "start": { - "line": 265, + "line": 267, "column": 1 }, "end": { - "line": 265, + "line": 267, "column": 2 } } @@ -23824,15 +23824,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deserializes data from JSON, creating new components and overwriting existing components.\n\t * Note: Defining fromJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * entity.fromJSON(serializedEntity)\n\t *\n\t * @param {string} data - A JSON string containing component data to parse, and store in this entity.\n\t *\n\t * @return {Object} The original entity that fromJSON() was called on, so that operations can be chained.\n\t ", - "start": 7006, - "end": 7473, + "start": 7051, + "end": 7518, "loc": { "start": { - "line": 267, + "line": 269, "column": 1 }, "end": { - "line": 277, + "line": 279, "column": 4 } } @@ -23850,15 +23850,15 @@ "binop": null }, "value": "fromJSON", - "start": 7475, - "end": 7483, + "start": 7520, + "end": 7528, "loc": { "start": { - "line": 278, + "line": 280, "column": 1 }, "end": { - "line": 278, + "line": 280, "column": 9 } } @@ -23875,15 +23875,15 @@ "postfix": false, "binop": null }, - "start": 7483, - "end": 7484, + "start": 7528, + "end": 7529, "loc": { "start": { - "line": 278, + "line": 280, "column": 9 }, "end": { - "line": 278, + "line": 280, "column": 10 } } @@ -23901,15 +23901,15 @@ "binop": null }, "value": "data", - "start": 7484, - "end": 7488, + "start": 7529, + "end": 7533, "loc": { "start": { - "line": 278, + "line": 280, "column": 10 }, "end": { - "line": 278, + "line": 280, "column": 14 } } @@ -23926,15 +23926,15 @@ "postfix": false, "binop": null }, - "start": 7488, - "end": 7489, + "start": 7533, + "end": 7534, "loc": { "start": { - "line": 278, + "line": 280, "column": 14 }, "end": { - "line": 278, + "line": 280, "column": 15 } } @@ -23951,15 +23951,15 @@ "postfix": false, "binop": null }, - "start": 7490, - "end": 7491, + "start": 7535, + "end": 7536, "loc": { "start": { - "line": 278, + "line": 280, "column": 16 }, "end": { - "line": 278, + "line": 280, "column": 17 } } @@ -23979,15 +23979,15 @@ "updateContext": null }, "value": "let", - "start": 7494, - "end": 7497, + "start": 7539, + "end": 7542, "loc": { "start": { - "line": 279, + "line": 281, "column": 2 }, "end": { - "line": 279, + "line": 281, "column": 5 } } @@ -24005,15 +24005,15 @@ "binop": null }, "value": "parsed", - "start": 7498, - "end": 7504, + "start": 7543, + "end": 7549, "loc": { "start": { - "line": 279, + "line": 281, "column": 6 }, "end": { - "line": 279, + "line": 281, "column": 12 } } @@ -24032,15 +24032,15 @@ "updateContext": null }, "value": "=", - "start": 7505, - "end": 7506, + "start": 7550, + "end": 7551, "loc": { "start": { - "line": 279, + "line": 281, "column": 13 }, "end": { - "line": 279, + "line": 281, "column": 14 } } @@ -24058,15 +24058,15 @@ "binop": null }, "value": "JSON", - "start": 7507, - "end": 7511, + "start": 7552, + "end": 7556, "loc": { "start": { - "line": 279, + "line": 281, "column": 15 }, "end": { - "line": 279, + "line": 281, "column": 19 } } @@ -24084,15 +24084,15 @@ "binop": null, "updateContext": null }, - "start": 7511, - "end": 7512, + "start": 7556, + "end": 7557, "loc": { "start": { - "line": 279, + "line": 281, "column": 19 }, "end": { - "line": 279, + "line": 281, "column": 20 } } @@ -24110,15 +24110,15 @@ "binop": null }, "value": "parse", - "start": 7512, - "end": 7517, + "start": 7557, + "end": 7562, "loc": { "start": { - "line": 279, + "line": 281, "column": 20 }, "end": { - "line": 279, + "line": 281, "column": 25 } } @@ -24135,15 +24135,15 @@ "postfix": false, "binop": null }, - "start": 7517, - "end": 7518, + "start": 7562, + "end": 7563, "loc": { "start": { - "line": 279, + "line": 281, "column": 25 }, "end": { - "line": 279, + "line": 281, "column": 26 } } @@ -24161,15 +24161,15 @@ "binop": null }, "value": "data", - "start": 7518, - "end": 7522, + "start": 7563, + "end": 7567, "loc": { "start": { - "line": 279, + "line": 281, "column": 26 }, "end": { - "line": 279, + "line": 281, "column": 30 } } @@ -24186,15 +24186,15 @@ "postfix": false, "binop": null }, - "start": 7522, - "end": 7523, + "start": 7567, + "end": 7568, "loc": { "start": { - "line": 279, + "line": 281, "column": 30 }, "end": { - "line": 279, + "line": 281, "column": 31 } } @@ -24214,15 +24214,15 @@ "updateContext": null }, "value": "for", - "start": 7526, - "end": 7529, + "start": 7571, + "end": 7574, "loc": { "start": { - "line": 280, + "line": 282, "column": 2 }, "end": { - "line": 280, + "line": 282, "column": 5 } } @@ -24239,15 +24239,15 @@ "postfix": false, "binop": null }, - "start": 7530, - "end": 7531, + "start": 7575, + "end": 7576, "loc": { "start": { - "line": 280, + "line": 282, "column": 6 }, "end": { - "line": 280, + "line": 282, "column": 7 } } @@ -24267,15 +24267,15 @@ "updateContext": null }, "value": "let", - "start": 7531, - "end": 7534, + "start": 7576, + "end": 7579, "loc": { "start": { - "line": 280, + "line": 282, "column": 7 }, "end": { - "line": 280, + "line": 282, "column": 10 } } @@ -24293,15 +24293,15 @@ "binop": null }, "value": "name", - "start": 7535, - "end": 7539, + "start": 7580, + "end": 7584, "loc": { "start": { - "line": 280, + "line": 282, "column": 11 }, "end": { - "line": 280, + "line": 282, "column": 15 } } @@ -24321,15 +24321,15 @@ "updateContext": null }, "value": "in", - "start": 7540, - "end": 7542, + "start": 7585, + "end": 7587, "loc": { "start": { - "line": 280, + "line": 282, "column": 16 }, "end": { - "line": 280, + "line": 282, "column": 18 } } @@ -24347,15 +24347,15 @@ "binop": null }, "value": "parsed", - "start": 7543, - "end": 7549, + "start": 7588, + "end": 7594, "loc": { "start": { - "line": 280, + "line": 282, "column": 19 }, "end": { - "line": 280, + "line": 282, "column": 25 } } @@ -24372,15 +24372,15 @@ "postfix": false, "binop": null }, - "start": 7549, - "end": 7550, + "start": 7594, + "end": 7595, "loc": { "start": { - "line": 280, + "line": 282, "column": 25 }, "end": { - "line": 280, + "line": 282, "column": 26 } } @@ -24397,15 +24397,15 @@ "postfix": false, "binop": null }, - "start": 7551, - "end": 7552, + "start": 7596, + "end": 7597, "loc": { "start": { - "line": 280, + "line": 282, "column": 27 }, "end": { - "line": 280, + "line": 282, "column": 28 } } @@ -24425,15 +24425,15 @@ "updateContext": null }, "value": "let", - "start": 7556, - "end": 7559, + "start": 7601, + "end": 7604, "loc": { "start": { - "line": 281, + "line": 283, "column": 3 }, "end": { - "line": 281, + "line": 283, "column": 6 } } @@ -24451,15 +24451,15 @@ "binop": null }, "value": "comp", - "start": 7560, - "end": 7564, + "start": 7605, + "end": 7609, "loc": { "start": { - "line": 281, + "line": 283, "column": 7 }, "end": { - "line": 281, + "line": 283, "column": 11 } } @@ -24478,15 +24478,15 @@ "updateContext": null }, "value": "=", - "start": 7565, - "end": 7566, + "start": 7610, + "end": 7611, "loc": { "start": { - "line": 281, + "line": 283, "column": 12 }, "end": { - "line": 281, + "line": 283, "column": 13 } } @@ -24506,15 +24506,15 @@ "updateContext": null }, "value": "this", - "start": 7567, - "end": 7571, + "start": 7612, + "end": 7616, "loc": { "start": { - "line": 281, + "line": 283, "column": 14 }, "end": { - "line": 281, + "line": 283, "column": 18 } } @@ -24532,15 +24532,15 @@ "binop": null, "updateContext": null }, - "start": 7571, - "end": 7572, + "start": 7616, + "end": 7617, "loc": { "start": { - "line": 281, + "line": 283, "column": 18 }, "end": { - "line": 281, + "line": 283, "column": 19 } } @@ -24558,15 +24558,15 @@ "binop": null }, "value": "access", - "start": 7572, - "end": 7578, + "start": 7617, + "end": 7623, "loc": { "start": { - "line": 281, + "line": 283, "column": 19 }, "end": { - "line": 281, + "line": 283, "column": 25 } } @@ -24583,15 +24583,15 @@ "postfix": false, "binop": null }, - "start": 7578, - "end": 7579, + "start": 7623, + "end": 7624, "loc": { "start": { - "line": 281, + "line": 283, "column": 25 }, "end": { - "line": 281, + "line": 283, "column": 26 } } @@ -24609,15 +24609,15 @@ "binop": null }, "value": "name", - "start": 7579, - "end": 7583, + "start": 7624, + "end": 7628, "loc": { "start": { - "line": 281, + "line": 283, "column": 26 }, "end": { - "line": 281, + "line": 283, "column": 30 } } @@ -24634,15 +24634,15 @@ "postfix": false, "binop": null }, - "start": 7583, - "end": 7584, + "start": 7628, + "end": 7629, "loc": { "start": { - "line": 281, + "line": 283, "column": 30 }, "end": { - "line": 281, + "line": 283, "column": 31 } } @@ -24650,15 +24650,15 @@ { "type": "CommentLine", "value": " Either call custom method or copy all properties", - "start": 7589, - "end": 7640, + "start": 7634, + "end": 7685, "loc": { "start": { - "line": 283, + "line": 285, "column": 3 }, "end": { - "line": 283, + "line": 285, "column": 54 } } @@ -24678,15 +24678,15 @@ "updateContext": null }, "value": "if", - "start": 7644, - "end": 7646, + "start": 7689, + "end": 7691, "loc": { "start": { - "line": 284, + "line": 286, "column": 3 }, "end": { - "line": 284, + "line": 286, "column": 5 } } @@ -24703,15 +24703,15 @@ "postfix": false, "binop": null }, - "start": 7647, - "end": 7648, + "start": 7692, + "end": 7693, "loc": { "start": { - "line": 284, + "line": 286, "column": 6 }, "end": { - "line": 284, + "line": 286, "column": 7 } } @@ -24731,15 +24731,15 @@ "updateContext": null }, "value": "typeof", - "start": 7648, - "end": 7654, + "start": 7693, + "end": 7699, "loc": { "start": { - "line": 284, + "line": 286, "column": 7 }, "end": { - "line": 284, + "line": 286, "column": 13 } } @@ -24757,15 +24757,15 @@ "binop": null }, "value": "comp", - "start": 7655, - "end": 7659, + "start": 7700, + "end": 7704, "loc": { "start": { - "line": 284, + "line": 286, "column": 14 }, "end": { - "line": 284, + "line": 286, "column": 18 } } @@ -24783,15 +24783,15 @@ "binop": null, "updateContext": null }, - "start": 7659, - "end": 7660, + "start": 7704, + "end": 7705, "loc": { "start": { - "line": 284, + "line": 286, "column": 18 }, "end": { - "line": 284, + "line": 286, "column": 19 } } @@ -24809,15 +24809,15 @@ "binop": null }, "value": "fromJSON", - "start": 7660, - "end": 7668, + "start": 7705, + "end": 7713, "loc": { "start": { - "line": 284, + "line": 286, "column": 19 }, "end": { - "line": 284, + "line": 286, "column": 27 } } @@ -24836,15 +24836,15 @@ "updateContext": null }, "value": "===", - "start": 7669, - "end": 7672, + "start": 7714, + "end": 7717, "loc": { "start": { - "line": 284, + "line": 286, "column": 28 }, "end": { - "line": 284, + "line": 286, "column": 31 } } @@ -24863,15 +24863,15 @@ "updateContext": null }, "value": "function", - "start": 7673, - "end": 7683, + "start": 7718, + "end": 7728, "loc": { "start": { - "line": 284, + "line": 286, "column": 32 }, "end": { - "line": 284, + "line": 286, "column": 42 } } @@ -24888,15 +24888,15 @@ "postfix": false, "binop": null }, - "start": 7683, - "end": 7684, + "start": 7728, + "end": 7729, "loc": { "start": { - "line": 284, + "line": 286, "column": 42 }, "end": { - "line": 284, + "line": 286, "column": 43 } } @@ -24913,15 +24913,15 @@ "postfix": false, "binop": null }, - "start": 7685, - "end": 7686, + "start": 7730, + "end": 7731, "loc": { "start": { - "line": 284, + "line": 286, "column": 44 }, "end": { - "line": 284, + "line": 286, "column": 45 } } @@ -24939,15 +24939,15 @@ "binop": null }, "value": "comp", - "start": 7691, - "end": 7695, + "start": 7736, + "end": 7740, "loc": { "start": { - "line": 285, + "line": 287, "column": 4 }, "end": { - "line": 285, + "line": 287, "column": 8 } } @@ -24965,15 +24965,15 @@ "binop": null, "updateContext": null }, - "start": 7695, - "end": 7696, + "start": 7740, + "end": 7741, "loc": { "start": { - "line": 285, + "line": 287, "column": 8 }, "end": { - "line": 285, + "line": 287, "column": 9 } } @@ -24991,15 +24991,15 @@ "binop": null }, "value": "fromJSON", - "start": 7696, - "end": 7704, + "start": 7741, + "end": 7749, "loc": { "start": { - "line": 285, + "line": 287, "column": 9 }, "end": { - "line": 285, + "line": 287, "column": 17 } } @@ -25016,15 +25016,15 @@ "postfix": false, "binop": null }, - "start": 7704, - "end": 7705, + "start": 7749, + "end": 7750, "loc": { "start": { - "line": 285, + "line": 287, "column": 17 }, "end": { - "line": 285, + "line": 287, "column": 18 } } @@ -25042,15 +25042,15 @@ "binop": null }, "value": "parsed", - "start": 7705, - "end": 7711, + "start": 7750, + "end": 7756, "loc": { "start": { - "line": 285, + "line": 287, "column": 18 }, "end": { - "line": 285, + "line": 287, "column": 24 } } @@ -25068,15 +25068,15 @@ "binop": null, "updateContext": null }, - "start": 7711, - "end": 7712, + "start": 7756, + "end": 7757, "loc": { "start": { - "line": 285, + "line": 287, "column": 24 }, "end": { - "line": 285, + "line": 287, "column": 25 } } @@ -25094,15 +25094,15 @@ "binop": null }, "value": "name", - "start": 7712, - "end": 7716, + "start": 7757, + "end": 7761, "loc": { "start": { - "line": 285, + "line": 287, "column": 25 }, "end": { - "line": 285, + "line": 287, "column": 29 } } @@ -25120,15 +25120,15 @@ "binop": null, "updateContext": null }, - "start": 7716, - "end": 7717, + "start": 7761, + "end": 7762, "loc": { "start": { - "line": 285, + "line": 287, "column": 29 }, "end": { - "line": 285, + "line": 287, "column": 30 } } @@ -25145,15 +25145,15 @@ "postfix": false, "binop": null }, - "start": 7717, - "end": 7718, + "start": 7762, + "end": 7763, "loc": { "start": { - "line": 285, + "line": 287, "column": 30 }, "end": { - "line": 285, + "line": 287, "column": 31 } } @@ -25170,15 +25170,15 @@ "postfix": false, "binop": null }, - "start": 7722, - "end": 7723, + "start": 7767, + "end": 7768, "loc": { "start": { - "line": 286, + "line": 288, "column": 3 }, "end": { - "line": 286, + "line": 288, "column": 4 } } @@ -25198,15 +25198,15 @@ "updateContext": null }, "value": "else", - "start": 7724, - "end": 7728, + "start": 7769, + "end": 7773, "loc": { "start": { - "line": 286, + "line": 288, "column": 5 }, "end": { - "line": 286, + "line": 288, "column": 9 } } @@ -25223,15 +25223,15 @@ "postfix": false, "binop": null }, - "start": 7729, - "end": 7730, + "start": 7774, + "end": 7775, "loc": { "start": { - "line": 286, + "line": 288, "column": 10 }, "end": { - "line": 286, + "line": 288, "column": 11 } } @@ -25251,15 +25251,15 @@ "updateContext": null }, "value": "this", - "start": 7735, - "end": 7739, + "start": 7780, + "end": 7784, "loc": { "start": { - "line": 287, + "line": 289, "column": 4 }, "end": { - "line": 287, + "line": 289, "column": 8 } } @@ -25277,15 +25277,15 @@ "binop": null, "updateContext": null }, - "start": 7739, - "end": 7740, + "start": 7784, + "end": 7785, "loc": { "start": { - "line": 287, + "line": 289, "column": 8 }, "end": { - "line": 287, + "line": 289, "column": 9 } } @@ -25303,15 +25303,15 @@ "binop": null }, "value": "update", - "start": 7740, - "end": 7746, + "start": 7785, + "end": 7791, "loc": { "start": { - "line": 287, + "line": 289, "column": 9 }, "end": { - "line": 287, + "line": 289, "column": 15 } } @@ -25328,15 +25328,15 @@ "postfix": false, "binop": null }, - "start": 7746, - "end": 7747, + "start": 7791, + "end": 7792, "loc": { "start": { - "line": 287, + "line": 289, "column": 15 }, "end": { - "line": 287, + "line": 289, "column": 16 } } @@ -25354,15 +25354,15 @@ "binop": null }, "value": "name", - "start": 7747, - "end": 7751, + "start": 7792, + "end": 7796, "loc": { "start": { - "line": 287, + "line": 289, "column": 16 }, "end": { - "line": 287, + "line": 289, "column": 20 } } @@ -25380,15 +25380,15 @@ "binop": null, "updateContext": null }, - "start": 7751, - "end": 7752, + "start": 7796, + "end": 7797, "loc": { "start": { - "line": 287, + "line": 289, "column": 20 }, "end": { - "line": 287, + "line": 289, "column": 21 } } @@ -25406,15 +25406,15 @@ "binop": null }, "value": "parsed", - "start": 7753, - "end": 7759, + "start": 7798, + "end": 7804, "loc": { "start": { - "line": 287, + "line": 289, "column": 22 }, "end": { - "line": 287, + "line": 289, "column": 28 } } @@ -25432,15 +25432,15 @@ "binop": null, "updateContext": null }, - "start": 7759, - "end": 7760, + "start": 7804, + "end": 7805, "loc": { "start": { - "line": 287, + "line": 289, "column": 28 }, "end": { - "line": 287, + "line": 289, "column": 29 } } @@ -25458,15 +25458,15 @@ "binop": null }, "value": "name", - "start": 7760, - "end": 7764, + "start": 7805, + "end": 7809, "loc": { "start": { - "line": 287, + "line": 289, "column": 29 }, "end": { - "line": 287, + "line": 289, "column": 33 } } @@ -25484,15 +25484,15 @@ "binop": null, "updateContext": null }, - "start": 7764, - "end": 7765, + "start": 7809, + "end": 7810, "loc": { "start": { - "line": 287, + "line": 289, "column": 33 }, "end": { - "line": 287, + "line": 289, "column": 34 } } @@ -25509,15 +25509,15 @@ "postfix": false, "binop": null }, - "start": 7765, - "end": 7766, + "start": 7810, + "end": 7811, "loc": { "start": { - "line": 287, + "line": 289, "column": 34 }, "end": { - "line": 287, + "line": 289, "column": 35 } } @@ -25534,15 +25534,15 @@ "postfix": false, "binop": null }, - "start": 7770, - "end": 7771, + "start": 7815, + "end": 7816, "loc": { "start": { - "line": 288, + "line": 290, "column": 3 }, "end": { - "line": 288, + "line": 290, "column": 4 } } @@ -25559,15 +25559,15 @@ "postfix": false, "binop": null }, - "start": 7774, - "end": 7775, + "start": 7819, + "end": 7820, "loc": { "start": { - "line": 289, + "line": 291, "column": 2 }, "end": { - "line": 289, + "line": 291, "column": 3 } } @@ -25587,15 +25587,15 @@ "updateContext": null }, "value": "return", - "start": 7778, - "end": 7784, + "start": 7823, + "end": 7829, "loc": { "start": { - "line": 290, + "line": 292, "column": 2 }, "end": { - "line": 290, + "line": 292, "column": 8 } } @@ -25615,15 +25615,15 @@ "updateContext": null }, "value": "this", - "start": 7785, - "end": 7789, + "start": 7830, + "end": 7834, "loc": { "start": { - "line": 290, + "line": 292, "column": 9 }, "end": { - "line": 290, + "line": 292, "column": 13 } } @@ -25640,15 +25640,15 @@ "postfix": false, "binop": null }, - "start": 7791, - "end": 7792, + "start": 7836, + "end": 7837, "loc": { "start": { - "line": 291, + "line": 293, "column": 1 }, "end": { - "line": 291, + "line": 293, "column": 2 } } @@ -25656,15 +25656,15 @@ { "type": "CommentBlock", "value": "*\n\t * Attaches a currently detached entity back to a world.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.attach(world)\n\t *\n\t * @param {World} world - The world to attach this entity to\n\t ", - "start": 7795, - "end": 8120, + "start": 7840, + "end": 8165, "loc": { "start": { - "line": 293, + "line": 295, "column": 1 }, "end": { - "line": 302, + "line": 304, "column": 4 } } @@ -25682,15 +25682,15 @@ "binop": null }, "value": "attach", - "start": 8122, - "end": 8128, + "start": 8167, + "end": 8173, "loc": { "start": { - "line": 303, + "line": 305, "column": 1 }, "end": { - "line": 303, + "line": 305, "column": 7 } } @@ -25707,15 +25707,15 @@ "postfix": false, "binop": null }, - "start": 8128, - "end": 8129, + "start": 8173, + "end": 8174, "loc": { "start": { - "line": 303, + "line": 305, "column": 7 }, "end": { - "line": 303, + "line": 305, "column": 8 } } @@ -25733,15 +25733,15 @@ "binop": null }, "value": "world", - "start": 8129, - "end": 8134, + "start": 8174, + "end": 8179, "loc": { "start": { - "line": 303, + "line": 305, "column": 8 }, "end": { - "line": 303, + "line": 305, "column": 13 } } @@ -25758,15 +25758,15 @@ "postfix": false, "binop": null }, - "start": 8134, - "end": 8135, + "start": 8179, + "end": 8180, "loc": { "start": { - "line": 303, + "line": 305, "column": 13 }, "end": { - "line": 303, + "line": 305, "column": 14 } } @@ -25783,15 +25783,15 @@ "postfix": false, "binop": null }, - "start": 8136, - "end": 8137, + "start": 8181, + "end": 8182, "loc": { "start": { - "line": 303, + "line": 305, "column": 15 }, "end": { - "line": 303, + "line": 305, "column": 16 } } @@ -25811,15 +25811,15 @@ "updateContext": null }, "value": "if", - "start": 8140, - "end": 8142, + "start": 8185, + "end": 8187, "loc": { "start": { - "line": 304, + "line": 306, "column": 2 }, "end": { - "line": 304, + "line": 306, "column": 4 } } @@ -25836,15 +25836,15 @@ "postfix": false, "binop": null }, - "start": 8143, - "end": 8144, + "start": 8188, + "end": 8189, "loc": { "start": { - "line": 304, + "line": 306, "column": 5 }, "end": { - "line": 304, + "line": 306, "column": 6 } } @@ -25862,15 +25862,15 @@ "binop": null }, "value": "world", - "start": 8144, - "end": 8149, + "start": 8189, + "end": 8194, "loc": { "start": { - "line": 304, + "line": 306, "column": 6 }, "end": { - "line": 304, + "line": 306, "column": 11 } } @@ -25889,15 +25889,15 @@ "updateContext": null }, "value": "&&", - "start": 8150, - "end": 8152, + "start": 8195, + "end": 8197, "loc": { "start": { - "line": 304, + "line": 306, "column": 12 }, "end": { - "line": 304, + "line": 306, "column": 14 } } @@ -25916,15 +25916,15 @@ "updateContext": null }, "value": "!", - "start": 8153, - "end": 8154, + "start": 8198, + "end": 8199, "loc": { "start": { - "line": 304, + "line": 306, "column": 15 }, "end": { - "line": 304, + "line": 306, "column": 16 } } @@ -25944,15 +25944,15 @@ "updateContext": null }, "value": "this", - "start": 8154, - "end": 8158, + "start": 8199, + "end": 8203, "loc": { "start": { - "line": 304, + "line": 306, "column": 16 }, "end": { - "line": 304, + "line": 306, "column": 20 } } @@ -25970,15 +25970,15 @@ "binop": null, "updateContext": null }, - "start": 8158, - "end": 8159, + "start": 8203, + "end": 8204, "loc": { "start": { - "line": 304, + "line": 306, "column": 20 }, "end": { - "line": 304, + "line": 306, "column": 21 } } @@ -25996,15 +25996,15 @@ "binop": null }, "value": "valid", - "start": 8159, - "end": 8164, + "start": 8204, + "end": 8209, "loc": { "start": { - "line": 304, + "line": 306, "column": 21 }, "end": { - "line": 304, + "line": 306, "column": 26 } } @@ -26021,15 +26021,15 @@ "postfix": false, "binop": null }, - "start": 8164, - "end": 8165, + "start": 8209, + "end": 8210, "loc": { "start": { - "line": 304, + "line": 306, "column": 26 }, "end": { - "line": 304, + "line": 306, "column": 27 } } @@ -26046,15 +26046,15 @@ "postfix": false, "binop": null }, - "start": 8165, - "end": 8166, + "start": 8210, + "end": 8211, "loc": { "start": { - "line": 304, + "line": 306, "column": 27 }, "end": { - "line": 304, + "line": 306, "column": 28 } } @@ -26071,15 +26071,15 @@ "postfix": false, "binop": null }, - "start": 8166, - "end": 8167, + "start": 8211, + "end": 8212, "loc": { "start": { - "line": 304, + "line": 306, "column": 28 }, "end": { - "line": 304, + "line": 306, "column": 29 } } @@ -26096,15 +26096,15 @@ "postfix": false, "binop": null }, - "start": 8168, - "end": 8169, + "start": 8213, + "end": 8214, "loc": { "start": { - "line": 304, + "line": 306, "column": 30 }, "end": { - "line": 304, + "line": 306, "column": 31 } } @@ -26112,15 +26112,15 @@ { "type": "CommentLine", "value": " Assign new id, and reattach to world", - "start": 8173, - "end": 8212, + "start": 8218, + "end": 8257, "loc": { "start": { - "line": 305, + "line": 307, "column": 3 }, "end": { - "line": 305, + "line": 307, "column": 42 } } @@ -26140,15 +26140,15 @@ "updateContext": null }, "value": "this", - "start": 8216, - "end": 8220, + "start": 8261, + "end": 8265, "loc": { "start": { - "line": 306, + "line": 308, "column": 3 }, "end": { - "line": 306, + "line": 308, "column": 7 } } @@ -26166,15 +26166,15 @@ "binop": null, "updateContext": null }, - "start": 8220, - "end": 8221, + "start": 8265, + "end": 8266, "loc": { "start": { - "line": 306, + "line": 308, "column": 7 }, "end": { - "line": 306, + "line": 308, "column": 8 } } @@ -26192,15 +26192,15 @@ "binop": null }, "value": "world", - "start": 8221, - "end": 8226, + "start": 8266, + "end": 8271, "loc": { "start": { - "line": 306, + "line": 308, "column": 8 }, "end": { - "line": 306, + "line": 308, "column": 13 } } @@ -26219,15 +26219,15 @@ "updateContext": null }, "value": "=", - "start": 8227, - "end": 8228, + "start": 8272, + "end": 8273, "loc": { "start": { - "line": 306, + "line": 308, "column": 14 }, "end": { - "line": 306, + "line": 308, "column": 15 } } @@ -26245,15 +26245,15 @@ "binop": null }, "value": "world", - "start": 8229, - "end": 8234, + "start": 8274, + "end": 8279, "loc": { "start": { - "line": 306, + "line": 308, "column": 16 }, "end": { - "line": 306, + "line": 308, "column": 21 } } @@ -26273,15 +26273,15 @@ "updateContext": null }, "value": "this", - "start": 8238, - "end": 8242, + "start": 8283, + "end": 8287, "loc": { "start": { - "line": 307, + "line": 309, "column": 3 }, "end": { - "line": 307, + "line": 309, "column": 7 } } @@ -26299,15 +26299,15 @@ "binop": null, "updateContext": null }, - "start": 8242, - "end": 8243, + "start": 8287, + "end": 8288, "loc": { "start": { - "line": 307, + "line": 309, "column": 7 }, "end": { - "line": 307, + "line": 309, "column": 8 } } @@ -26325,15 +26325,15 @@ "binop": null }, "value": "_id", - "start": 8243, - "end": 8246, + "start": 8288, + "end": 8291, "loc": { "start": { - "line": 307, + "line": 309, "column": 8 }, "end": { - "line": 307, + "line": 309, "column": 11 } } @@ -26352,15 +26352,15 @@ "updateContext": null }, "value": "=", - "start": 8247, - "end": 8248, + "start": 8292, + "end": 8293, "loc": { "start": { - "line": 307, + "line": 309, "column": 12 }, "end": { - "line": 307, + "line": 309, "column": 13 } } @@ -26380,15 +26380,15 @@ "updateContext": null }, "value": "this", - "start": 8249, - "end": 8253, + "start": 8294, + "end": 8298, "loc": { "start": { - "line": 307, + "line": 309, "column": 14 }, "end": { - "line": 307, + "line": 309, "column": 18 } } @@ -26406,15 +26406,15 @@ "binop": null, "updateContext": null }, - "start": 8253, - "end": 8254, + "start": 8298, + "end": 8299, "loc": { "start": { - "line": 307, + "line": 309, "column": 18 }, "end": { - "line": 307, + "line": 309, "column": 19 } } @@ -26432,15 +26432,15 @@ "binop": null }, "value": "world", - "start": 8254, - "end": 8259, + "start": 8299, + "end": 8304, "loc": { "start": { - "line": 307, + "line": 309, "column": 19 }, "end": { - "line": 307, + "line": 309, "column": 24 } } @@ -26458,15 +26458,15 @@ "binop": null, "updateContext": null }, - "start": 8259, - "end": 8260, + "start": 8304, + "end": 8305, "loc": { "start": { - "line": 307, + "line": 309, "column": 24 }, "end": { - "line": 307, + "line": 309, "column": 25 } } @@ -26484,15 +26484,15 @@ "binop": null }, "value": "idCounter", - "start": 8260, - "end": 8269, + "start": 8305, + "end": 8314, "loc": { "start": { - "line": 307, + "line": 309, "column": 25 }, "end": { - "line": 307, + "line": 309, "column": 34 } } @@ -26510,15 +26510,15 @@ "binop": null }, "value": "++", - "start": 8269, - "end": 8271, + "start": 8314, + "end": 8316, "loc": { "start": { - "line": 307, + "line": 309, "column": 34 }, "end": { - "line": 307, + "line": 309, "column": 36 } } @@ -26538,15 +26538,15 @@ "updateContext": null }, "value": "this", - "start": 8275, - "end": 8279, + "start": 8320, + "end": 8324, "loc": { "start": { - "line": 308, + "line": 310, "column": 3 }, "end": { - "line": 308, + "line": 310, "column": 7 } } @@ -26564,15 +26564,15 @@ "binop": null, "updateContext": null }, - "start": 8279, - "end": 8280, + "start": 8324, + "end": 8325, "loc": { "start": { - "line": 308, + "line": 310, "column": 7 }, "end": { - "line": 308, + "line": 310, "column": 8 } } @@ -26590,15 +26590,15 @@ "binop": null }, "value": "world", - "start": 8280, - "end": 8285, + "start": 8325, + "end": 8330, "loc": { "start": { - "line": 308, + "line": 310, "column": 8 }, "end": { - "line": 308, + "line": 310, "column": 13 } } @@ -26616,15 +26616,15 @@ "binop": null, "updateContext": null }, - "start": 8285, - "end": 8286, + "start": 8330, + "end": 8331, "loc": { "start": { - "line": 308, + "line": 310, "column": 13 }, "end": { - "line": 308, + "line": 310, "column": 14 } } @@ -26642,15 +26642,15 @@ "binop": null }, "value": "entities", - "start": 8286, - "end": 8294, + "start": 8331, + "end": 8339, "loc": { "start": { - "line": 308, + "line": 310, "column": 14 }, "end": { - "line": 308, + "line": 310, "column": 22 } } @@ -26668,15 +26668,15 @@ "binop": null, "updateContext": null }, - "start": 8294, - "end": 8295, + "start": 8339, + "end": 8340, "loc": { "start": { - "line": 308, + "line": 310, "column": 22 }, "end": { - "line": 308, + "line": 310, "column": 23 } } @@ -26694,15 +26694,15 @@ "binop": null }, "value": "set", - "start": 8295, - "end": 8298, + "start": 8340, + "end": 8343, "loc": { "start": { - "line": 308, + "line": 310, "column": 23 }, "end": { - "line": 308, + "line": 310, "column": 26 } } @@ -26719,15 +26719,15 @@ "postfix": false, "binop": null }, - "start": 8298, - "end": 8299, + "start": 8343, + "end": 8344, "loc": { "start": { - "line": 308, + "line": 310, "column": 26 }, "end": { - "line": 308, + "line": 310, "column": 27 } } @@ -26747,15 +26747,15 @@ "updateContext": null }, "value": "this", - "start": 8299, - "end": 8303, + "start": 8344, + "end": 8348, "loc": { "start": { - "line": 308, + "line": 310, "column": 27 }, "end": { - "line": 308, + "line": 310, "column": 31 } } @@ -26773,15 +26773,15 @@ "binop": null, "updateContext": null }, - "start": 8303, - "end": 8304, + "start": 8348, + "end": 8349, "loc": { "start": { - "line": 308, + "line": 310, "column": 31 }, "end": { - "line": 308, + "line": 310, "column": 32 } } @@ -26799,15 +26799,15 @@ "binop": null }, "value": "_id", - "start": 8304, - "end": 8307, + "start": 8349, + "end": 8352, "loc": { "start": { - "line": 308, + "line": 310, "column": 32 }, "end": { - "line": 308, + "line": 310, "column": 35 } } @@ -26825,15 +26825,15 @@ "binop": null, "updateContext": null }, - "start": 8307, - "end": 8308, + "start": 8352, + "end": 8353, "loc": { "start": { - "line": 308, + "line": 310, "column": 35 }, "end": { - "line": 308, + "line": 310, "column": 36 } } @@ -26853,15 +26853,15 @@ "updateContext": null }, "value": "this", - "start": 8309, - "end": 8313, + "start": 8354, + "end": 8358, "loc": { "start": { - "line": 308, + "line": 310, "column": 37 }, "end": { - "line": 308, + "line": 310, "column": 41 } } @@ -26878,15 +26878,15 @@ "postfix": false, "binop": null }, - "start": 8313, - "end": 8314, + "start": 8358, + "end": 8359, "loc": { "start": { - "line": 308, + "line": 310, "column": 41 }, "end": { - "line": 308, + "line": 310, "column": 42 } } @@ -26906,15 +26906,15 @@ "updateContext": null }, "value": "this", - "start": 8318, - "end": 8322, + "start": 8363, + "end": 8367, "loc": { "start": { - "line": 309, + "line": 311, "column": 3 }, "end": { - "line": 309, + "line": 311, "column": 7 } } @@ -26932,15 +26932,15 @@ "binop": null, "updateContext": null }, - "start": 8322, - "end": 8323, + "start": 8367, + "end": 8368, "loc": { "start": { - "line": 309, + "line": 311, "column": 7 }, "end": { - "line": 309, + "line": 311, "column": 8 } } @@ -26958,15 +26958,15 @@ "binop": null }, "value": "world", - "start": 8323, - "end": 8328, + "start": 8368, + "end": 8373, "loc": { "start": { - "line": 309, + "line": 311, "column": 8 }, "end": { - "line": 309, + "line": 311, "column": 13 } } @@ -26984,15 +26984,15 @@ "binop": null, "updateContext": null }, - "start": 8328, - "end": 8329, + "start": 8373, + "end": 8374, "loc": { "start": { - "line": 309, + "line": 311, "column": 13 }, "end": { - "line": 309, + "line": 311, "column": 14 } } @@ -27010,15 +27010,15 @@ "binop": null }, "value": "index", - "start": 8329, - "end": 8334, + "start": 8374, + "end": 8379, "loc": { "start": { - "line": 309, + "line": 311, "column": 14 }, "end": { - "line": 309, + "line": 311, "column": 19 } } @@ -27036,15 +27036,15 @@ "binop": null, "updateContext": null }, - "start": 8334, - "end": 8335, + "start": 8379, + "end": 8380, "loc": { "start": { - "line": 309, + "line": 311, "column": 19 }, "end": { - "line": 309, + "line": 311, "column": 20 } } @@ -27062,15 +27062,15 @@ "binop": null }, "value": "addEntity", - "start": 8335, - "end": 8344, + "start": 8380, + "end": 8389, "loc": { "start": { - "line": 309, + "line": 311, "column": 20 }, "end": { - "line": 309, + "line": 311, "column": 29 } } @@ -27087,15 +27087,15 @@ "postfix": false, "binop": null }, - "start": 8344, - "end": 8345, + "start": 8389, + "end": 8390, "loc": { "start": { - "line": 309, + "line": 311, "column": 29 }, "end": { - "line": 309, + "line": 311, "column": 30 } } @@ -27115,15 +27115,15 @@ "updateContext": null }, "value": "this", - "start": 8345, - "end": 8349, + "start": 8390, + "end": 8394, "loc": { "start": { - "line": 309, + "line": 311, "column": 30 }, "end": { - "line": 309, + "line": 311, "column": 34 } } @@ -27140,15 +27140,15 @@ "postfix": false, "binop": null }, - "start": 8349, - "end": 8350, + "start": 8394, + "end": 8395, "loc": { "start": { - "line": 309, + "line": 311, "column": 34 }, "end": { - "line": 309, + "line": 311, "column": 35 } } @@ -27165,15 +27165,15 @@ "postfix": false, "binop": null }, - "start": 8353, - "end": 8354, + "start": 8398, + "end": 8399, "loc": { "start": { - "line": 310, + "line": 312, "column": 2 }, "end": { - "line": 310, + "line": 312, "column": 3 } } @@ -27190,15 +27190,15 @@ "postfix": false, "binop": null }, - "start": 8356, - "end": 8357, + "start": 8401, + "end": 8402, "loc": { "start": { - "line": 311, + "line": 313, "column": 1 }, "end": { - "line": 311, + "line": 313, "column": 2 } } @@ -27206,15 +27206,15 @@ { "type": "CommentBlock", "value": "*\n\t * Removes this entity from the current world, without removing any components or data.\n\t * It can be re-attached to another world (or the same world), using the attach() method.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.detach()\n\t ", - "start": 8360, - "end": 8736, + "start": 8405, + "end": 8781, "loc": { "start": { - "line": 313, + "line": 315, "column": 1 }, "end": { - "line": 321, + "line": 323, "column": 4 } } @@ -27232,15 +27232,15 @@ "binop": null }, "value": "detach", - "start": 8738, - "end": 8744, + "start": 8783, + "end": 8789, "loc": { "start": { - "line": 322, + "line": 324, "column": 1 }, "end": { - "line": 322, + "line": 324, "column": 7 } } @@ -27257,15 +27257,15 @@ "postfix": false, "binop": null }, - "start": 8744, - "end": 8745, + "start": 8789, + "end": 8790, "loc": { "start": { - "line": 322, + "line": 324, "column": 7 }, "end": { - "line": 322, + "line": 324, "column": 8 } } @@ -27282,15 +27282,15 @@ "postfix": false, "binop": null }, - "start": 8745, - "end": 8746, + "start": 8790, + "end": 8791, "loc": { "start": { - "line": 322, + "line": 324, "column": 8 }, "end": { - "line": 322, + "line": 324, "column": 9 } } @@ -27307,15 +27307,15 @@ "postfix": false, "binop": null }, - "start": 8747, - "end": 8748, + "start": 8792, + "end": 8793, "loc": { "start": { - "line": 322, + "line": 324, "column": 10 }, "end": { - "line": 322, + "line": 324, "column": 11 } } @@ -27335,15 +27335,15 @@ "updateContext": null }, "value": "if", - "start": 8751, - "end": 8753, + "start": 8796, + "end": 8798, "loc": { "start": { - "line": 323, + "line": 325, "column": 2 }, "end": { - "line": 323, + "line": 325, "column": 4 } } @@ -27360,15 +27360,15 @@ "postfix": false, "binop": null }, - "start": 8754, - "end": 8755, + "start": 8799, + "end": 8800, "loc": { "start": { - "line": 323, + "line": 325, "column": 5 }, "end": { - "line": 323, + "line": 325, "column": 6 } } @@ -27388,15 +27388,15 @@ "updateContext": null }, "value": "this", - "start": 8755, - "end": 8759, + "start": 8800, + "end": 8804, "loc": { "start": { - "line": 323, + "line": 325, "column": 6 }, "end": { - "line": 323, + "line": 325, "column": 10 } } @@ -27414,15 +27414,15 @@ "binop": null, "updateContext": null }, - "start": 8759, - "end": 8760, + "start": 8804, + "end": 8805, "loc": { "start": { - "line": 323, + "line": 325, "column": 10 }, "end": { - "line": 323, + "line": 325, "column": 11 } } @@ -27440,15 +27440,15 @@ "binop": null }, "value": "valid", - "start": 8760, - "end": 8765, + "start": 8805, + "end": 8810, "loc": { "start": { - "line": 323, + "line": 325, "column": 11 }, "end": { - "line": 323, + "line": 325, "column": 16 } } @@ -27465,15 +27465,15 @@ "postfix": false, "binop": null }, - "start": 8765, - "end": 8766, + "start": 8810, + "end": 8811, "loc": { "start": { - "line": 323, + "line": 325, "column": 16 }, "end": { - "line": 323, + "line": 325, "column": 17 } } @@ -27490,15 +27490,15 @@ "postfix": false, "binop": null }, - "start": 8766, - "end": 8767, + "start": 8811, + "end": 8812, "loc": { "start": { - "line": 323, + "line": 325, "column": 17 }, "end": { - "line": 323, + "line": 325, "column": 18 } } @@ -27515,15 +27515,15 @@ "postfix": false, "binop": null }, - "start": 8767, - "end": 8768, + "start": 8812, + "end": 8813, "loc": { "start": { - "line": 323, + "line": 325, "column": 18 }, "end": { - "line": 323, + "line": 325, "column": 19 } } @@ -27540,15 +27540,15 @@ "postfix": false, "binop": null }, - "start": 8769, - "end": 8770, + "start": 8814, + "end": 8815, "loc": { "start": { - "line": 323, + "line": 325, "column": 20 }, "end": { - "line": 323, + "line": 325, "column": 21 } } @@ -27556,15 +27556,15 @@ { "type": "CommentLine", "value": " Remove from current world", - "start": 8774, - "end": 8802, + "start": 8819, + "end": 8847, "loc": { "start": { - "line": 324, + "line": 326, "column": 3 }, "end": { - "line": 324, + "line": 326, "column": 31 } } @@ -27584,15 +27584,15 @@ "updateContext": null }, "value": "this", - "start": 8806, - "end": 8810, + "start": 8851, + "end": 8855, "loc": { "start": { - "line": 325, + "line": 327, "column": 3 }, "end": { - "line": 325, + "line": 327, "column": 7 } } @@ -27610,15 +27610,15 @@ "binop": null, "updateContext": null }, - "start": 8810, - "end": 8811, + "start": 8855, + "end": 8856, "loc": { "start": { - "line": 325, + "line": 327, "column": 7 }, "end": { - "line": 325, + "line": 327, "column": 8 } } @@ -27636,15 +27636,15 @@ "binop": null }, "value": "world", - "start": 8811, - "end": 8816, + "start": 8856, + "end": 8861, "loc": { "start": { - "line": 325, + "line": 327, "column": 8 }, "end": { - "line": 325, + "line": 327, "column": 13 } } @@ -27662,15 +27662,15 @@ "binop": null, "updateContext": null }, - "start": 8816, - "end": 8817, + "start": 8861, + "end": 8862, "loc": { "start": { - "line": 325, + "line": 327, "column": 13 }, "end": { - "line": 325, + "line": 327, "column": 14 } } @@ -27688,15 +27688,15 @@ "binop": null }, "value": "index", - "start": 8817, - "end": 8822, + "start": 8862, + "end": 8867, "loc": { "start": { - "line": 325, + "line": 327, "column": 14 }, "end": { - "line": 325, + "line": 327, "column": 19 } } @@ -27714,15 +27714,15 @@ "binop": null, "updateContext": null }, - "start": 8822, - "end": 8823, + "start": 8867, + "end": 8868, "loc": { "start": { - "line": 325, + "line": 327, "column": 19 }, "end": { - "line": 325, + "line": 327, "column": 20 } } @@ -27740,15 +27740,15 @@ "binop": null }, "value": "removeEntity", - "start": 8823, - "end": 8835, + "start": 8868, + "end": 8880, "loc": { "start": { - "line": 325, + "line": 327, "column": 20 }, "end": { - "line": 325, + "line": 327, "column": 32 } } @@ -27765,15 +27765,15 @@ "postfix": false, "binop": null }, - "start": 8835, - "end": 8836, + "start": 8880, + "end": 8881, "loc": { "start": { - "line": 325, + "line": 327, "column": 32 }, "end": { - "line": 325, + "line": 327, "column": 33 } } @@ -27793,15 +27793,15 @@ "updateContext": null }, "value": "this", - "start": 8836, - "end": 8840, + "start": 8881, + "end": 8885, "loc": { "start": { - "line": 325, + "line": 327, "column": 33 }, "end": { - "line": 325, + "line": 327, "column": 37 } } @@ -27818,15 +27818,15 @@ "postfix": false, "binop": null }, - "start": 8840, - "end": 8841, + "start": 8885, + "end": 8886, "loc": { "start": { - "line": 325, + "line": 327, "column": 37 }, "end": { - "line": 325, + "line": 327, "column": 38 } } @@ -27846,15 +27846,15 @@ "updateContext": null }, "value": "this", - "start": 8845, - "end": 8849, + "start": 8890, + "end": 8894, "loc": { "start": { - "line": 326, + "line": 328, "column": 3 }, "end": { - "line": 326, + "line": 328, "column": 7 } } @@ -27872,15 +27872,15 @@ "binop": null, "updateContext": null }, - "start": 8849, - "end": 8850, + "start": 8894, + "end": 8895, "loc": { "start": { - "line": 326, + "line": 328, "column": 7 }, "end": { - "line": 326, + "line": 328, "column": 8 } } @@ -27898,15 +27898,15 @@ "binop": null }, "value": "world", - "start": 8850, - "end": 8855, + "start": 8895, + "end": 8900, "loc": { "start": { - "line": 326, + "line": 328, "column": 8 }, "end": { - "line": 326, + "line": 328, "column": 13 } } @@ -27924,15 +27924,15 @@ "binop": null, "updateContext": null }, - "start": 8855, - "end": 8856, + "start": 8900, + "end": 8901, "loc": { "start": { - "line": 326, + "line": 328, "column": 13 }, "end": { - "line": 326, + "line": 328, "column": 14 } } @@ -27950,15 +27950,15 @@ "binop": null }, "value": "entities", - "start": 8856, - "end": 8864, + "start": 8901, + "end": 8909, "loc": { "start": { - "line": 326, + "line": 328, "column": 14 }, "end": { - "line": 326, + "line": 328, "column": 22 } } @@ -27976,15 +27976,15 @@ "binop": null, "updateContext": null }, - "start": 8864, - "end": 8865, + "start": 8909, + "end": 8910, "loc": { "start": { - "line": 326, + "line": 328, "column": 22 }, "end": { - "line": 326, + "line": 328, "column": 23 } } @@ -28004,15 +28004,15 @@ "updateContext": null }, "value": "delete", - "start": 8865, - "end": 8871, + "start": 8910, + "end": 8916, "loc": { "start": { - "line": 326, + "line": 328, "column": 23 }, "end": { - "line": 326, + "line": 328, "column": 29 } } @@ -28029,15 +28029,15 @@ "postfix": false, "binop": null }, - "start": 8871, - "end": 8872, + "start": 8916, + "end": 8917, "loc": { "start": { - "line": 326, + "line": 328, "column": 29 }, "end": { - "line": 326, + "line": 328, "column": 30 } } @@ -28057,15 +28057,15 @@ "updateContext": null }, "value": "this", - "start": 8872, - "end": 8876, + "start": 8917, + "end": 8921, "loc": { "start": { - "line": 326, + "line": 328, "column": 30 }, "end": { - "line": 326, + "line": 328, "column": 34 } } @@ -28083,15 +28083,15 @@ "binop": null, "updateContext": null }, - "start": 8876, - "end": 8877, + "start": 8921, + "end": 8922, "loc": { "start": { - "line": 326, + "line": 328, "column": 34 }, "end": { - "line": 326, + "line": 328, "column": 35 } } @@ -28109,15 +28109,15 @@ "binop": null }, "value": "_id", - "start": 8877, - "end": 8880, + "start": 8922, + "end": 8925, "loc": { "start": { - "line": 326, + "line": 328, "column": 35 }, "end": { - "line": 326, + "line": 328, "column": 38 } } @@ -28134,15 +28134,15 @@ "postfix": false, "binop": null }, - "start": 8880, - "end": 8881, + "start": 8925, + "end": 8926, "loc": { "start": { - "line": 326, + "line": 328, "column": 38 }, "end": { - "line": 326, + "line": 328, "column": 39 } } @@ -28162,15 +28162,15 @@ "updateContext": null }, "value": "this", - "start": 8885, - "end": 8889, + "start": 8930, + "end": 8934, "loc": { "start": { - "line": 327, + "line": 329, "column": 3 }, "end": { - "line": 327, + "line": 329, "column": 7 } } @@ -28188,15 +28188,15 @@ "binop": null, "updateContext": null }, - "start": 8889, - "end": 8890, + "start": 8934, + "end": 8935, "loc": { "start": { - "line": 327, + "line": 329, "column": 7 }, "end": { - "line": 327, + "line": 329, "column": 8 } } @@ -28214,15 +28214,15 @@ "binop": null }, "value": "_id", - "start": 8890, - "end": 8893, + "start": 8935, + "end": 8938, "loc": { "start": { - "line": 327, + "line": 329, "column": 8 }, "end": { - "line": 327, + "line": 329, "column": 11 } } @@ -28241,15 +28241,15 @@ "updateContext": null }, "value": "=", - "start": 8894, - "end": 8895, + "start": 8939, + "end": 8940, "loc": { "start": { - "line": 327, + "line": 329, "column": 12 }, "end": { - "line": 327, + "line": 329, "column": 13 } } @@ -28267,15 +28267,15 @@ "binop": null }, "value": "undefined", - "start": 8896, - "end": 8905, + "start": 8941, + "end": 8950, "loc": { "start": { - "line": 327, + "line": 329, "column": 14 }, "end": { - "line": 327, + "line": 329, "column": 23 } } @@ -28295,15 +28295,15 @@ "updateContext": null }, "value": "this", - "start": 8909, - "end": 8913, + "start": 8954, + "end": 8958, "loc": { "start": { - "line": 328, + "line": 330, "column": 3 }, "end": { - "line": 328, + "line": 330, "column": 7 } } @@ -28321,15 +28321,15 @@ "binop": null, "updateContext": null }, - "start": 8913, - "end": 8914, + "start": 8958, + "end": 8959, "loc": { "start": { - "line": 328, + "line": 330, "column": 7 }, "end": { - "line": 328, + "line": 330, "column": 8 } } @@ -28347,15 +28347,15 @@ "binop": null }, "value": "world", - "start": 8914, - "end": 8919, + "start": 8959, + "end": 8964, "loc": { "start": { - "line": 328, + "line": 330, "column": 8 }, "end": { - "line": 328, + "line": 330, "column": 13 } } @@ -28374,15 +28374,15 @@ "updateContext": null }, "value": "=", - "start": 8920, - "end": 8921, + "start": 8965, + "end": 8966, "loc": { "start": { - "line": 328, + "line": 330, "column": 14 }, "end": { - "line": 328, + "line": 330, "column": 15 } } @@ -28400,15 +28400,15 @@ "binop": null }, "value": "undefined", - "start": 8922, - "end": 8931, + "start": 8967, + "end": 8976, "loc": { "start": { - "line": 328, + "line": 330, "column": 16 }, "end": { - "line": 328, + "line": 330, "column": 25 } } @@ -28425,15 +28425,15 @@ "postfix": false, "binop": null }, - "start": 8934, - "end": 8935, + "start": 8979, + "end": 8980, "loc": { "start": { - "line": 329, + "line": 331, "column": 2 }, "end": { - "line": 329, + "line": 331, "column": 3 } } @@ -28450,15 +28450,15 @@ "postfix": false, "binop": null }, - "start": 8937, - "end": 8938, + "start": 8982, + "end": 8983, "loc": { "start": { - "line": 330, + "line": 332, "column": 1 }, "end": { - "line": 330, + "line": 332, "column": 2 } } @@ -28475,15 +28475,15 @@ "postfix": false, "binop": null }, - "start": 8939, - "end": 8940, + "start": 8984, + "end": 8985, "loc": { "start": { - "line": 331, + "line": 333, "column": 0 }, "end": { - "line": 331, + "line": 333, "column": 1 } } @@ -28501,15 +28501,15 @@ "binop": null }, "value": "exports", - "start": 8942, - "end": 8949, + "start": 8987, + "end": 8994, "loc": { "start": { - "line": 333, + "line": 335, "column": 0 }, "end": { - "line": 333, + "line": 335, "column": 7 } } @@ -28527,15 +28527,15 @@ "binop": null, "updateContext": null }, - "start": 8949, - "end": 8950, + "start": 8994, + "end": 8995, "loc": { "start": { - "line": 333, + "line": 335, "column": 7 }, "end": { - "line": 333, + "line": 335, "column": 8 } } @@ -28553,15 +28553,15 @@ "binop": null }, "value": "Entity", - "start": 8950, - "end": 8956, + "start": 8995, + "end": 9001, "loc": { "start": { - "line": 333, + "line": 335, "column": 8 }, "end": { - "line": 333, + "line": 335, "column": 14 } } @@ -28580,15 +28580,15 @@ "updateContext": null }, "value": "=", - "start": 8957, - "end": 8958, + "start": 9002, + "end": 9003, "loc": { "start": { - "line": 333, + "line": 335, "column": 15 }, "end": { - "line": 333, + "line": 335, "column": 16 } } @@ -28606,15 +28606,15 @@ "binop": null }, "value": "Entity", - "start": 8959, - "end": 8965, + "start": 9004, + "end": 9010, "loc": { "start": { - "line": 333, + "line": 335, "column": 17 }, "end": { - "line": 333, + "line": 335, "column": 23 } } @@ -28632,15 +28632,15 @@ "binop": null, "updateContext": null }, - "start": 8966, - "end": 8966, + "start": 9011, + "end": 9011, "loc": { "start": { - "line": 334, + "line": 336, "column": 0 }, "end": { - "line": 334, + "line": 336, "column": 0 } } diff --git a/docs/ast/source/world.js.json b/docs/ast/source/world.js.json index bd26954..88d4d59 100644 --- a/docs/ast/source/world.js.json +++ b/docs/ast/source/world.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 8816, + "end": 9513, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 316, + "line": 345, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 8816, + "end": 9513, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 316, + "line": 345, "column": 0 } }, @@ -689,14 +689,14 @@ { "type": "ClassDeclaration", "start": 265, - "end": 8792, + "end": 9489, "loc": { "start": { "line": 15, "column": 0 }, "end": { - "line": 313, + "line": 342, "column": 1 } }, @@ -722,14 +722,14 @@ "body": { "type": "ClassBody", "start": 277, - "end": 8792, + "end": 9489, "loc": { "start": { "line": 15, "column": 12 }, "end": { - "line": 313, + "line": 342, "column": 1 } }, @@ -4335,16 +4335,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * })\n\t *\n\t * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize,\n\t * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run()\n\t * for an example of the call order.\n\t * @param {...Object} [args] - The arguments to forward to the system's constructors\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", + "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * constructor(context) {\n\t * // This is showing how you can optionally pass parameters to the system's constructor\n\t * this.context = context\n\t * }\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * }, context)\n\t *\n\t * @example\n\t * // System that doesn't use every()\n\t * world.system(class {\n\t * constructor(context) {\n\t * this.context = context\n\t * }\n\t * pre() {\n\t * // Handle events or something\n\t * }\n\t * }, context)\n\t *\n\t * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).\n\t *\n\t * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t *\n\t * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.\n\t *\n\t * **[...args]**: The arguments to forward to the system's constructors.\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", "start": 3066, - "end": 4045, + "end": 4560, "loc": { "start": { "line": 129, "column": 1 }, "end": { - "line": 149, + "line": 166, "column": 4 } } @@ -4353,15 +4353,15 @@ }, { "type": "ClassMethod", - "start": 4047, - "end": 4455, + "start": 4562, + "end": 5160, "loc": { "start": { - "line": 150, + "line": 167, "column": 1 }, "end": { - "line": 161, + "line": 190, "column": 2 } }, @@ -4369,15 +4369,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 4047, - "end": 4053, + "start": 4562, + "end": 4568, "loc": { "start": { - "line": 150, + "line": 167, "column": 1 }, "end": { - "line": 150, + "line": 167, "column": 7 }, "identifierName": "system" @@ -4391,66 +4391,32 @@ "expression": false, "async": false, "params": [ - { - "type": "Identifier", - "start": 4054, - "end": 4064, - "loc": { - "start": { - "line": 150, - "column": 8 - }, - "end": { - "line": 150, - "column": 18 - }, - "identifierName": "components" - }, - "name": "components" - }, - { - "type": "Identifier", - "start": 4066, - "end": 4077, - "loc": { - "start": { - "line": 150, - "column": 20 - }, - "end": { - "line": 150, - "column": 31 - }, - "identifierName": "systemClass" - }, - "name": "systemClass" - }, { "type": "RestElement", - "start": 4079, - "end": 4086, + "start": 4569, + "end": 4576, "loc": { "start": { - "line": 150, - "column": 33 + "line": 167, + "column": 8 }, "end": { - "line": 150, - "column": 40 + "line": 167, + "column": 15 } }, "argument": { "type": "Identifier", - "start": 4082, - "end": 4086, + "start": 4572, + "end": 4576, "loc": { "start": { - "line": 150, - "column": 36 + "line": 167, + "column": 11 }, "end": { - "line": 150, - "column": 40 + "line": 167, + "column": 15 }, "identifierName": "args" }, @@ -4460,1964 +4426,1585 @@ ], "body": { "type": "BlockStatement", - "start": 4088, - "end": 4455, + "start": 4578, + "end": 5160, "loc": { "start": { - "line": 150, - "column": 42 + "line": 167, + "column": 17 }, "end": { - "line": 161, + "line": 190, "column": 2 } }, "body": [ + { + "type": "VariableDeclaration", + "start": 4633, + "end": 4652, + "loc": { + "start": { + "line": 169, + "column": 2 + }, + "end": { + "line": 169, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4637, + "end": 4652, + "loc": { + "start": { + "line": 169, + "column": 6 + }, + "end": { + "line": 169, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 4637, + "end": 4647, + "loc": { + "start": { + "line": 169, + "column": 6 + }, + "end": { + "line": 169, + "column": 16 + }, + "identifierName": "components" + }, + "name": "components", + "leadingComments": null + }, + "init": { + "type": "ArrayExpression", + "start": 4650, + "end": 4652, + "loc": { + "start": { + "line": 169, + "column": 19 + }, + "end": { + "line": 169, + "column": 21 + } + }, + "elements": [] + }, + "leadingComments": null + } + ], + "kind": "let", + "leadingComments": [ + { + "type": "CommentLine", + "value": " Get components and systemClass from arguments", + "start": 4582, + "end": 4630, + "loc": { + "start": { + "line": 168, + "column": 2 + }, + "end": { + "line": 168, + "column": 50 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "start": 4655, + "end": 4676, + "loc": { + "start": { + "line": 170, + "column": 2 + }, + "end": { + "line": 170, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4659, + "end": 4670, + "loc": { + "start": { + "line": 170, + "column": 6 + }, + "end": { + "line": 170, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 4659, + "end": 4670, + "loc": { + "start": { + "line": 170, + "column": 6 + }, + "end": { + "line": 170, + "column": 17 + }, + "identifierName": "systemClass" + }, + "name": "systemClass" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "start": 4672, + "end": 4676, + "loc": { + "start": { + "line": 170, + "column": 19 + }, + "end": { + "line": 170, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 4672, + "end": 4676, + "loc": { + "start": { + "line": 170, + "column": 19 + }, + "end": { + "line": 170, + "column": 23 + }, + "identifierName": "rest" + }, + "name": "rest" + }, + "init": null + } + ], + "kind": "let" + }, { "type": "IfStatement", - "start": 4179, - "end": 4433, + "start": 4679, + "end": 4845, "loc": { "start": { - "line": 152, + "line": 171, "column": 2 }, "end": { - "line": 159, + "line": 178, "column": 3 } }, "test": { "type": "CallExpression", - "start": 4183, - "end": 4206, + "start": 4683, + "end": 4705, "loc": { "start": { - "line": 152, + "line": 171, "column": 6 }, "end": { - "line": 152, - "column": 29 + "line": 171, + "column": 28 } }, "callee": { - "type": "Identifier", - "start": 4183, - "end": 4193, + "type": "MemberExpression", + "start": 4683, + "end": 4696, "loc": { "start": { - "line": 152, + "line": 171, "column": 6 }, "end": { - "line": 152, - "column": 16 + "line": 171, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 4683, + "end": 4688, + "loc": { + "start": { + "line": 171, + "column": 6 + }, + "end": { + "line": 171, + "column": 11 + }, + "identifierName": "Array" }, - "identifierName": "isFunction" + "name": "Array" }, - "name": "isFunction", - "leadingComments": null + "property": { + "type": "Identifier", + "start": 4689, + "end": 4696, + "loc": { + "start": { + "line": 171, + "column": 12 + }, + "end": { + "line": 171, + "column": 19 + }, + "identifierName": "isArray" + }, + "name": "isArray" + }, + "computed": false }, "arguments": [ { - "type": "Identifier", - "start": 4194, - "end": 4205, + "type": "MemberExpression", + "start": 4697, + "end": 4704, "loc": { "start": { - "line": 152, - "column": 17 + "line": 171, + "column": 20 }, "end": { - "line": 152, - "column": 28 + "line": 171, + "column": 27 + } + }, + "object": { + "type": "Identifier", + "start": 4697, + "end": 4701, + "loc": { + "start": { + "line": 171, + "column": 20 + }, + "end": { + "line": 171, + "column": 24 + }, + "identifierName": "args" }, - "identifierName": "systemClass" + "name": "args" }, - "name": "systemClass" + "property": { + "type": "NumericLiteral", + "start": 4702, + "end": 4703, + "loc": { + "start": { + "line": 171, + "column": 25 + }, + "end": { + "line": 171, + "column": 26 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true } - ], - "leadingComments": null + ] }, "consequent": { "type": "BlockStatement", - "start": 4208, - "end": 4433, + "start": 4707, + "end": 4785, "loc": { "start": { - "line": 152, - "column": 31 + "line": 171, + "column": 30 }, "end": { - "line": 159, + "line": 175, "column": 3 } }, "body": [ { - "type": "VariableDeclaration", - "start": 4272, - "end": 4312, + "type": "ExpressionStatement", + "start": 4712, + "end": 4732, "loc": { "start": { - "line": 154, + "line": 172, "column": 3 }, "end": { - "line": 154, - "column": 43 + "line": 172, + "column": 23 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4276, - "end": 4312, + "expression": { + "type": "AssignmentExpression", + "start": 4712, + "end": 4732, + "loc": { + "start": { + "line": 172, + "column": 3 + }, + "end": { + "line": 172, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 4712, + "end": 4722, "loc": { "start": { - "line": 154, - "column": 7 + "line": 172, + "column": 3 }, "end": { - "line": 154, - "column": 43 + "line": 172, + "column": 13 + }, + "identifierName": "components" + }, + "name": "components" + }, + "right": { + "type": "MemberExpression", + "start": 4725, + "end": 4732, + "loc": { + "start": { + "line": 172, + "column": 16 + }, + "end": { + "line": 172, + "column": 23 } }, - "id": { + "object": { "type": "Identifier", - "start": 4276, - "end": 4285, + "start": 4725, + "end": 4729, "loc": { "start": { - "line": 154, - "column": 7 + "line": 172, + "column": 16 }, "end": { - "line": 154, - "column": 16 + "line": 172, + "column": 20 }, - "identifierName": "newSystem" + "identifierName": "args" }, - "name": "newSystem", - "leadingComments": null + "name": "args" }, - "init": { - "type": "NewExpression", - "start": 4288, - "end": 4312, + "property": { + "type": "NumericLiteral", + "start": 4730, + "end": 4731, "loc": { "start": { - "line": 154, - "column": 19 + "line": 172, + "column": 21 }, "end": { - "line": 154, - "column": 43 + "line": 172, + "column": 22 } }, - "callee": { - "type": "Identifier", - "start": 4292, - "end": 4303, - "loc": { - "start": { - "line": 154, - "column": 23 - }, - "end": { - "line": 154, - "column": 34 - }, - "identifierName": "systemClass" - }, - "name": "systemClass" + "extra": { + "rawValue": 0, + "raw": "0" }, - "arguments": [ - { - "type": "SpreadElement", - "start": 4304, - "end": 4311, - "loc": { - "start": { - "line": 154, - "column": 35 - }, - "end": { - "line": 154, - "column": 42 - } - }, - "argument": { - "type": "Identifier", - "start": 4307, - "end": 4311, - "loc": { - "start": { - "line": 154, - "column": 38 - }, - "end": { - "line": 154, - "column": 42 - }, - "identifierName": "args" - }, - "name": "args" - } - } - ] + "value": 0 }, - "leadingComments": null - } - ], - "kind": "let", - "leadingComments": [ - { - "type": "CommentLine", - "value": " Create the system, and set the component array query", - "start": 4213, - "end": 4268, - "loc": { - "start": { - "line": 153, - "column": 3 - }, - "end": { - "line": 153, - "column": 58 - } - } + "computed": true } - ] + } }, { "type": "ExpressionStatement", - "start": 4316, - "end": 4349, + "start": 4736, + "end": 4757, "loc": { "start": { - "line": 155, + "line": 173, "column": 3 }, "end": { - "line": 155, - "column": 36 + "line": 173, + "column": 24 } }, "expression": { "type": "AssignmentExpression", - "start": 4316, - "end": 4349, + "start": 4736, + "end": 4757, "loc": { "start": { - "line": 155, + "line": 173, "column": 3 }, "end": { - "line": 155, - "column": 36 + "line": 173, + "column": 24 } }, "operator": "=", "left": { - "type": "MemberExpression", - "start": 4316, - "end": 4336, + "type": "Identifier", + "start": 4736, + "end": 4747, "loc": { "start": { - "line": 155, + "line": 173, "column": 3 }, "end": { - "line": 155, - "column": 23 + "line": 173, + "column": 14 + }, + "identifierName": "systemClass" + }, + "name": "systemClass" + }, + "right": { + "type": "MemberExpression", + "start": 4750, + "end": 4757, + "loc": { + "start": { + "line": 173, + "column": 17 + }, + "end": { + "line": 173, + "column": 24 } }, "object": { "type": "Identifier", - "start": 4316, - "end": 4325, + "start": 4750, + "end": 4754, "loc": { "start": { - "line": 155, - "column": 3 + "line": 173, + "column": 17 }, "end": { - "line": 155, - "column": 12 + "line": 173, + "column": 21 }, - "identifierName": "newSystem" + "identifierName": "args" }, - "name": "newSystem" + "name": "args" }, "property": { - "type": "Identifier", - "start": 4326, - "end": 4336, + "type": "NumericLiteral", + "start": 4755, + "end": 4756, "loc": { "start": { - "line": 155, - "column": 13 + "line": 173, + "column": 22 }, "end": { - "line": 155, + "line": 173, "column": 23 - }, - "identifierName": "components" - }, - "name": "components" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 4339, - "end": 4349, - "loc": { - "start": { - "line": 155, - "column": 26 + } }, - "end": { - "line": 155, - "column": 36 + "extra": { + "rawValue": 1, + "raw": "1" }, - "identifierName": "components" + "value": 1 }, - "name": "components", - "leadingComments": null, - "trailingComments": null - }, - "trailingComments": null - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Add the system, return its ID", - "start": 4354, - "end": 4386, - "loc": { - "start": { - "line": 157, - "column": 3 - }, - "end": { - "line": 157, - "column": 35 - } - } + "computed": true } - ] + } }, { - "type": "ReturnStatement", - "start": 4390, - "end": 4429, + "type": "ExpressionStatement", + "start": 4761, + "end": 4781, "loc": { "start": { - "line": 158, + "line": 174, "column": 3 }, "end": { - "line": 158, - "column": 42 + "line": 174, + "column": 23 } }, - "argument": { - "type": "BinaryExpression", - "start": 4397, - "end": 4429, + "expression": { + "type": "AssignmentExpression", + "start": 4761, + "end": 4781, "loc": { "start": { - "line": 158, - "column": 10 + "line": 174, + "column": 3 }, "end": { - "line": 158, - "column": 42 + "line": 174, + "column": 23 } }, + "operator": "=", "left": { + "type": "Identifier", + "start": 4761, + "end": 4765, + "loc": { + "start": { + "line": 174, + "column": 3 + }, + "end": { + "line": 174, + "column": 7 + }, + "identifierName": "rest" + }, + "name": "rest" + }, + "right": { "type": "CallExpression", - "start": 4397, - "end": 4425, + "start": 4768, + "end": 4781, "loc": { "start": { - "line": 158, + "line": 174, "column": 10 }, "end": { - "line": 158, - "column": 38 + "line": 174, + "column": 23 } }, "callee": { "type": "MemberExpression", - "start": 4397, - "end": 4414, + "start": 4768, + "end": 4778, "loc": { "start": { - "line": 158, + "line": 174, "column": 10 }, "end": { - "line": 158, - "column": 27 + "line": 174, + "column": 20 } }, "object": { - "type": "MemberExpression", - "start": 4397, - "end": 4409, + "type": "Identifier", + "start": 4768, + "end": 4772, "loc": { "start": { - "line": 158, + "line": 174, "column": 10 }, "end": { - "line": 158, - "column": 22 - } - }, - "object": { - "type": "ThisExpression", - "start": 4397, - "end": 4401, - "loc": { - "start": { - "line": 158, - "column": 10 - }, - "end": { - "line": 158, - "column": 14 - } - }, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 4402, - "end": 4409, - "loc": { - "start": { - "line": 158, - "column": 15 - }, - "end": { - "line": 158, - "column": 22 - }, - "identifierName": "systems" + "line": 174, + "column": 14 }, - "name": "systems" + "identifierName": "args" }, - "computed": false, - "leadingComments": null + "name": "args" }, "property": { "type": "Identifier", - "start": 4410, - "end": 4414, + "start": 4773, + "end": 4778, "loc": { "start": { - "line": 158, - "column": 23 + "line": 174, + "column": 15 }, "end": { - "line": 158, - "column": 27 + "line": 174, + "column": 20 }, - "identifierName": "push" + "identifierName": "slice" }, - "name": "push" + "name": "slice" }, - "computed": false, - "leadingComments": null + "computed": false }, "arguments": [ { - "type": "Identifier", - "start": 4415, - "end": 4424, + "type": "NumericLiteral", + "start": 4779, + "end": 4780, "loc": { "start": { - "line": 158, - "column": 28 + "line": 174, + "column": 21 }, "end": { - "line": 158, - "column": 37 - }, - "identifierName": "newSystem" + "line": 174, + "column": 22 + } }, - "name": "newSystem" + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 } - ], - "leadingComments": null + ] + } + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 4791, + "end": 4845, + "loc": { + "start": { + "line": 175, + "column": 9 + }, + "end": { + "line": 178, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 4796, + "end": 4817, + "loc": { + "start": { + "line": 176, + "column": 3 }, - "operator": "-", - "right": { - "type": "NumericLiteral", - "start": 4428, - "end": 4429, - "loc": { - "start": { - "line": 158, - "column": 41 - }, - "end": { - "line": 158, - "column": 42 + "end": { + "line": 176, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 4796, + "end": 4817, + "loc": { + "start": { + "line": 176, + "column": 3 + }, + "end": { + "line": 176, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 4796, + "end": 4807, + "loc": { + "start": { + "line": 176, + "column": 3 + }, + "end": { + "line": 176, + "column": 14 + }, + "identifierName": "systemClass" + }, + "name": "systemClass" + }, + "right": { + "type": "MemberExpression", + "start": 4810, + "end": 4817, + "loc": { + "start": { + "line": 176, + "column": 17 + }, + "end": { + "line": 176, + "column": 24 } }, - "extra": { - "rawValue": 1, - "raw": "1" + "object": { + "type": "Identifier", + "start": 4810, + "end": 4814, + "loc": { + "start": { + "line": 176, + "column": 17 + }, + "end": { + "line": 176, + "column": 21 + }, + "identifierName": "args" + }, + "name": "args" }, - "value": 1 + "property": { + "type": "NumericLiteral", + "start": 4815, + "end": 4816, + "loc": { + "start": { + "line": 176, + "column": 22 + }, + "end": { + "line": 176, + "column": 23 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + }, + { + "type": "ExpressionStatement", + "start": 4821, + "end": 4841, + "loc": { + "start": { + "line": 177, + "column": 3 }, - "leadingComments": null + "end": { + "line": 177, + "column": 23 + } }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Add the system, return its ID", - "start": 4354, - "end": 4386, + "expression": { + "type": "AssignmentExpression", + "start": 4821, + "end": 4841, + "loc": { + "start": { + "line": 177, + "column": 3 + }, + "end": { + "line": 177, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 4821, + "end": 4825, "loc": { "start": { - "line": 157, + "line": 177, "column": 3 }, "end": { - "line": 157, - "column": 35 + "line": 177, + "column": 7 + }, + "identifierName": "rest" + }, + "name": "rest" + }, + "right": { + "type": "CallExpression", + "start": 4828, + "end": 4841, + "loc": { + "start": { + "line": 177, + "column": 10 + }, + "end": { + "line": 177, + "column": 23 } - } + }, + "callee": { + "type": "MemberExpression", + "start": 4828, + "end": 4838, + "loc": { + "start": { + "line": 177, + "column": 10 + }, + "end": { + "line": 177, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 4828, + "end": 4832, + "loc": { + "start": { + "line": 177, + "column": 10 + }, + "end": { + "line": 177, + "column": 14 + }, + "identifierName": "args" + }, + "name": "args" + }, + "property": { + "type": "Identifier", + "start": 4833, + "end": 4838, + "loc": { + "start": { + "line": 177, + "column": 15 + }, + "end": { + "line": 177, + "column": 20 + }, + "identifierName": "slice" + }, + "name": "slice" + }, + "computed": false + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 4839, + "end": 4840, + "loc": { + "start": { + "line": 177, + "column": 21 + }, + "end": { + "line": 177, + "column": 22 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ] } - ] + } } ], - "directives": [] + "directives": [], + "trailingComments": null }, - "alternate": null, - "leadingComments": [ + "trailingComments": [ { "type": "CommentLine", - "value": " TODO: Make components optional, and parameters more dynamic by only using ...args", - "start": 4092, - "end": 4176, + "value": " Make sure the system is valid", + "start": 4849, + "end": 4881, "loc": { "start": { - "line": 151, + "line": 180, "column": 2 }, "end": { - "line": 151, - "column": 86 + "line": 180, + "column": 34 } } } ] }, { - "type": "ReturnStatement", - "start": 4436, - "end": 4452, + "type": "IfStatement", + "start": 4884, + "end": 5138, "loc": { "start": { - "line": 160, + "line": 181, "column": 2 }, "end": { - "line": 160, - "column": 18 + "line": 188, + "column": 3 } }, - "argument": { - "type": "Identifier", - "start": 4443, - "end": 4452, + "test": { + "type": "CallExpression", + "start": 4888, + "end": 4911, "loc": { "start": { - "line": 160, - "column": 9 + "line": 181, + "column": 6 }, "end": { - "line": 160, - "column": 18 + "line": 181, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 4888, + "end": 4898, + "loc": { + "start": { + "line": 181, + "column": 6 + }, + "end": { + "line": 181, + "column": 16 + }, + "identifierName": "isFunction" }, - "identifierName": "undefined" + "name": "isFunction", + "leadingComments": null }, - "name": "undefined" - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * })\n\t *\n\t * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize,\n\t * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run()\n\t * for an example of the call order.\n\t * @param {...Object} [args] - The arguments to forward to the system's constructors\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", - "start": 3066, - "end": 4045, - "loc": { - "start": { - "line": 129, - "column": 1 - }, - "end": { - "line": 149, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", - "start": 4458, - "end": 4655, - "loc": { - "start": { - "line": 163, - "column": 1 + "arguments": [ + { + "type": "Identifier", + "start": 4899, + "end": 4910, + "loc": { + "start": { + "line": 181, + "column": 17 + }, + "end": { + "line": 181, + "column": 28 + }, + "identifierName": "systemClass" + }, + "name": "systemClass" + } + ], + "leadingComments": null }, - "end": { - "line": 170, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 4657, - "end": 4763, - "loc": { - "start": { - "line": 171, - "column": 1 - }, - "end": { - "line": 175, - "column": 2 - } - }, - "static": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 4657, - "end": 4667, - "loc": { - "start": { - "line": 171, - "column": 1 - }, - "end": { - "line": 171, - "column": 11 - }, - "identifierName": "initialize" - }, - "name": "initialize", - "leadingComments": null - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "start": 4668, - "end": 4675, - "loc": { - "start": { - "line": 171, - "column": 12 - }, - "end": { - "line": 171, - "column": 19 - } - }, - "argument": { - "type": "Identifier", - "start": 4671, - "end": 4675, - "loc": { - "start": { - "line": 171, - "column": 15 - }, - "end": { - "line": 171, - "column": 19 - }, - "identifierName": "args" - }, - "name": "args" - } - } - ], - "body": { - "type": "BlockStatement", - "start": 4677, - "end": 4763, - "loc": { - "start": { - "line": 171, - "column": 21 - }, - "end": { - "line": 175, - "column": 2 - } - }, - "body": [ - { - "type": "ForOfStatement", - "start": 4681, - "end": 4760, - "loc": { - "start": { - "line": 172, - "column": 2 - }, - "end": { - "line": 174, - "column": 3 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 4686, - "end": 4696, - "loc": { - "start": { - "line": 172, - "column": 7 - }, - "end": { - "line": 172, - "column": 17 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4690, - "end": 4696, - "loc": { - "start": { - "line": 172, - "column": 11 - }, - "end": { - "line": 172, - "column": 17 - } - }, - "id": { - "type": "Identifier", - "start": 4690, - "end": 4696, - "loc": { - "start": { - "line": 172, - "column": 11 - }, - "end": { - "line": 172, - "column": 17 - }, - "identifierName": "system" - }, - "name": "system" - }, - "init": null - } - ], - "kind": "let" - }, - "right": { - "type": "MemberExpression", - "start": 4700, - "end": 4712, - "loc": { - "start": { - "line": 172, - "column": 21 - }, - "end": { - "line": 172, - "column": 33 - } - }, - "object": { - "type": "ThisExpression", - "start": 4700, - "end": 4704, - "loc": { - "start": { - "line": 172, - "column": 21 - }, - "end": { - "line": 172, - "column": 25 - } - } - }, - "property": { - "type": "Identifier", - "start": 4705, - "end": 4712, - "loc": { - "start": { - "line": 172, - "column": 26 - }, - "end": { - "line": 172, - "column": 33 - }, - "identifierName": "systems" - }, - "name": "systems" - }, - "computed": false - }, - "body": { + "consequent": { "type": "BlockStatement", - "start": 4714, - "end": 4760, + "start": 4913, + "end": 5138, "loc": { "start": { - "line": 172, - "column": 35 + "line": 181, + "column": 31 }, "end": { - "line": 174, + "line": 188, "column": 3 } }, "body": [ { - "type": "ExpressionStatement", - "start": 4719, - "end": 4756, + "type": "VariableDeclaration", + "start": 4977, + "end": 5017, "loc": { "start": { - "line": 173, + "line": 183, "column": 3 }, "end": { - "line": 173, - "column": 40 + "line": 183, + "column": 43 } }, - "expression": { - "type": "CallExpression", - "start": 4719, - "end": 4756, - "loc": { - "start": { - "line": 173, - "column": 3 - }, - "end": { - "line": 173, - "column": 40 - } - }, - "callee": { - "type": "Identifier", - "start": 4719, - "end": 4725, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4981, + "end": 5017, "loc": { "start": { - "line": 173, - "column": 3 + "line": 183, + "column": 7 }, "end": { - "line": 173, - "column": 9 - }, - "identifierName": "invoke" + "line": 183, + "column": 43 + } }, - "name": "invoke" - }, - "arguments": [ - { + "id": { "type": "Identifier", - "start": 4726, - "end": 4732, + "start": 4981, + "end": 4990, "loc": { "start": { - "line": 173, - "column": 10 + "line": 183, + "column": 7 }, "end": { - "line": 173, + "line": 183, "column": 16 }, - "identifierName": "system" - }, - "name": "system" - }, - { - "type": "StringLiteral", - "start": 4734, - "end": 4746, - "loc": { - "start": { - "line": 173, - "column": 18 - }, - "end": { - "line": 173, - "column": 30 - } - }, - "extra": { - "rawValue": "initialize", - "raw": "'initialize'" + "identifierName": "newSystem" }, - "value": "initialize" + "name": "newSystem", + "leadingComments": null }, - { - "type": "SpreadElement", - "start": 4748, - "end": 4755, + "init": { + "type": "NewExpression", + "start": 4993, + "end": 5017, "loc": { "start": { - "line": 173, - "column": 32 + "line": 183, + "column": 19 }, "end": { - "line": 173, - "column": 39 + "line": 183, + "column": 43 } }, - "argument": { + "callee": { "type": "Identifier", - "start": 4751, - "end": 4755, + "start": 4997, + "end": 5008, "loc": { "start": { - "line": 173, - "column": 35 + "line": 183, + "column": 23 }, "end": { - "line": 173, - "column": 39 + "line": 183, + "column": 34 }, - "identifierName": "args" + "identifierName": "systemClass" }, - "name": "args" - } - } - ] - } - } - ], - "directives": [] - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", - "start": 4458, - "end": 4655, - "loc": { - "start": { - "line": 163, - "column": 1 - }, - "end": { - "line": 170, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system([], systemA)\n\t * world.system([], systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", - "start": 4766, - "end": 5295, - "loc": { - "start": { - "line": 177, - "column": 1 - }, - "end": { - "line": 197, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 5297, - "end": 5579, - "loc": { - "start": { - "line": 198, - "column": 1 - }, - "end": { - "line": 209, - "column": 2 - } - }, - "static": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 5297, - "end": 5300, - "loc": { - "start": { - "line": 198, - "column": 1 - }, - "end": { - "line": 198, - "column": 4 - }, - "identifierName": "run" - }, - "name": "run", - "leadingComments": null - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "start": 5301, - "end": 5308, - "loc": { - "start": { - "line": 198, - "column": 5 - }, - "end": { - "line": 198, - "column": 12 - } - }, - "argument": { - "type": "Identifier", - "start": 5304, - "end": 5308, - "loc": { - "start": { - "line": 198, - "column": 8 - }, - "end": { - "line": 198, - "column": 12 - }, - "identifierName": "args" - }, - "name": "args" - } - } - ], - "body": { - "type": "BlockStatement", - "start": 5310, - "end": 5579, - "loc": { - "start": { - "line": 198, - "column": 14 - }, - "end": { - "line": 209, - "column": 2 - } - }, - "body": [ - { - "type": "ForOfStatement", - "start": 5314, - "end": 5576, - "loc": { - "start": { - "line": 199, - "column": 2 - }, - "end": { - "line": 208, - "column": 3 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 5319, - "end": 5329, - "loc": { - "start": { - "line": 199, - "column": 7 - }, - "end": { - "line": 199, - "column": 17 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 5323, - "end": 5329, - "loc": { - "start": { - "line": 199, - "column": 11 - }, - "end": { - "line": 199, - "column": 17 - } - }, - "id": { - "type": "Identifier", - "start": 5323, - "end": 5329, - "loc": { - "start": { - "line": 199, - "column": 11 - }, - "end": { - "line": 199, - "column": 17 + "name": "systemClass" + }, + "arguments": [ + { + "type": "SpreadElement", + "start": 5009, + "end": 5016, + "loc": { + "start": { + "line": 183, + "column": 35 + }, + "end": { + "line": 183, + "column": 42 + } + }, + "argument": { + "type": "Identifier", + "start": 5012, + "end": 5016, + "loc": { + "start": { + "line": 183, + "column": 38 + }, + "end": { + "line": 183, + "column": 42 + }, + "identifierName": "rest" + }, + "name": "rest" + } + } + ] }, - "identifierName": "system" - }, - "name": "system" - }, - "init": null - } - ], - "kind": "let" - }, - "right": { - "type": "MemberExpression", - "start": 5333, - "end": 5345, - "loc": { - "start": { - "line": 199, - "column": 21 - }, - "end": { - "line": 199, - "column": 33 - } - }, - "object": { - "type": "ThisExpression", - "start": 5333, - "end": 5337, - "loc": { - "start": { - "line": 199, - "column": 21 - }, - "end": { - "line": 199, - "column": 25 - } - } - }, - "property": { - "type": "Identifier", - "start": 5338, - "end": 5345, - "loc": { - "start": { - "line": 199, - "column": 26 - }, - "end": { - "line": 199, - "column": 33 - }, - "identifierName": "systems" - }, - "name": "systems" - }, - "computed": false - }, - "body": { - "type": "BlockStatement", - "start": 5347, - "end": 5576, - "loc": { - "start": { - "line": 199, - "column": 35 + "leadingComments": null + } + ], + "kind": "let", + "leadingComments": [ + { + "type": "CommentLine", + "value": " Create the system, and set the component array query", + "start": 4918, + "end": 4973, + "loc": { + "start": { + "line": 182, + "column": 3 + }, + "end": { + "line": 182, + "column": 58 + } + } + } + ] }, - "end": { - "line": 208, - "column": 3 - } - }, - "body": [ { "type": "ExpressionStatement", - "start": 5352, - "end": 5382, + "start": 5021, + "end": 5054, "loc": { "start": { - "line": 200, + "line": 184, "column": 3 }, "end": { - "line": 200, - "column": 33 + "line": 184, + "column": 36 } }, "expression": { - "type": "CallExpression", - "start": 5352, - "end": 5382, + "type": "AssignmentExpression", + "start": 5021, + "end": 5054, "loc": { "start": { - "line": 200, + "line": 184, "column": 3 }, "end": { - "line": 200, - "column": 33 + "line": 184, + "column": 36 } }, - "callee": { - "type": "Identifier", - "start": 5352, - "end": 5358, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 5021, + "end": 5041, "loc": { "start": { - "line": 200, + "line": 184, "column": 3 }, "end": { - "line": 200, - "column": 9 - }, - "identifierName": "invoke" + "line": 184, + "column": 23 + } }, - "name": "invoke" - }, - "arguments": [ - { + "object": { "type": "Identifier", - "start": 5359, - "end": 5365, + "start": 5021, + "end": 5030, "loc": { "start": { - "line": 200, - "column": 10 + "line": 184, + "column": 3 }, "end": { - "line": 200, - "column": 16 + "line": 184, + "column": 12 }, - "identifierName": "system" + "identifierName": "newSystem" }, - "name": "system" + "name": "newSystem" }, - { - "type": "StringLiteral", - "start": 5367, - "end": 5372, + "property": { + "type": "Identifier", + "start": 5031, + "end": 5041, "loc": { "start": { - "line": 200, - "column": 18 + "line": 184, + "column": 13 }, "end": { - "line": 200, + "line": 184, "column": 23 - } - }, - "extra": { - "rawValue": "pre", - "raw": "'pre'" + }, + "identifierName": "components" }, - "value": "pre" + "name": "components" }, - { - "type": "SpreadElement", - "start": 5374, - "end": 5381, - "loc": { - "start": { - "line": 200, - "column": 25 - }, - "end": { - "line": 200, - "column": 32 - } + "computed": false + }, + "right": { + "type": "Identifier", + "start": 5044, + "end": 5054, + "loc": { + "start": { + "line": 184, + "column": 26 }, - "argument": { - "type": "Identifier", - "start": 5377, - "end": 5381, - "loc": { - "start": { - "line": 200, - "column": 28 - }, - "end": { - "line": 200, - "column": 32 - }, - "identifierName": "args" - }, - "name": "args" - } - } - ], + "end": { + "line": 184, + "column": 36 + }, + "identifierName": "components" + }, + "name": "components", + "leadingComments": null, + "trailingComments": null + }, "trailingComments": null }, "trailingComments": [ { "type": "CommentLine", - "value": " Run the \"every\" method in the system", - "start": 5387, - "end": 5426, + "value": " Add the system, return its ID", + "start": 5059, + "end": 5091, "loc": { "start": { - "line": 202, + "line": 186, "column": 3 }, "end": { - "line": 202, - "column": 42 + "line": 186, + "column": 35 } } } ] }, { - "type": "IfStatement", - "start": 5430, - "end": 5536, + "type": "ReturnStatement", + "start": 5095, + "end": 5134, "loc": { "start": { - "line": 203, + "line": 187, "column": 3 }, "end": { - "line": 205, - "column": 4 + "line": 187, + "column": 42 } }, - "test": { - "type": "CallExpression", - "start": 5434, - "end": 5458, + "argument": { + "type": "BinaryExpression", + "start": 5102, + "end": 5134, "loc": { "start": { - "line": 203, - "column": 7 + "line": 187, + "column": 10 }, "end": { - "line": 203, - "column": 31 + "line": 187, + "column": 42 } }, - "callee": { - "type": "Identifier", - "start": 5434, - "end": 5444, + "left": { + "type": "CallExpression", + "start": 5102, + "end": 5130, "loc": { "start": { - "line": 203, - "column": 7 + "line": 187, + "column": 10 }, "end": { - "line": 203, - "column": 17 - }, - "identifierName": "isFunction" + "line": 187, + "column": 38 + } }, - "name": "isFunction", - "leadingComments": null - }, - "arguments": [ - { + "callee": { "type": "MemberExpression", - "start": 5445, - "end": 5457, + "start": 5102, + "end": 5119, "loc": { "start": { - "line": 203, - "column": 18 + "line": 187, + "column": 10 }, "end": { - "line": 203, - "column": 30 + "line": 187, + "column": 27 } }, "object": { - "type": "Identifier", - "start": 5445, - "end": 5451, + "type": "MemberExpression", + "start": 5102, + "end": 5114, "loc": { "start": { - "line": 203, - "column": 18 + "line": 187, + "column": 10 }, "end": { - "line": 203, - "column": 24 + "line": 187, + "column": 22 + } + }, + "object": { + "type": "ThisExpression", + "start": 5102, + "end": 5106, + "loc": { + "start": { + "line": 187, + "column": 10 + }, + "end": { + "line": 187, + "column": 14 + } }, - "identifierName": "system" + "leadingComments": null }, - "name": "system" + "property": { + "type": "Identifier", + "start": 5107, + "end": 5114, + "loc": { + "start": { + "line": 187, + "column": 15 + }, + "end": { + "line": 187, + "column": 22 + }, + "identifierName": "systems" + }, + "name": "systems" + }, + "computed": false, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 5452, - "end": 5457, + "start": 5115, + "end": 5119, "loc": { "start": { - "line": 203, - "column": 25 + "line": 187, + "column": 23 }, "end": { - "line": 203, - "column": 30 + "line": 187, + "column": 27 }, - "identifierName": "every" + "identifierName": "push" }, - "name": "every" + "name": "push" }, - "computed": false - } - ], - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 5460, - "end": 5536, - "loc": { - "start": { - "line": 203, - "column": 33 + "computed": false, + "leadingComments": null }, - "end": { - "line": 205, - "column": 4 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 5466, - "end": 5531, - "loc": { - "start": { - "line": 204, - "column": 4 - }, - "end": { - "line": 204, - "column": 69 - } - }, - "expression": { - "type": "CallExpression", - "start": 5466, - "end": 5531, + "arguments": [ + { + "type": "Identifier", + "start": 5120, + "end": 5129, "loc": { "start": { - "line": 204, - "column": 4 + "line": 187, + "column": 28 }, "end": { - "line": 204, - "column": 69 - } - }, - "callee": { - "type": "MemberExpression", - "start": 5466, - "end": 5476, - "loc": { - "start": { - "line": 204, - "column": 4 - }, - "end": { - "line": 204, - "column": 14 - } - }, - "object": { - "type": "ThisExpression", - "start": 5466, - "end": 5470, - "loc": { - "start": { - "line": 204, - "column": 4 - }, - "end": { - "line": 204, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "start": 5471, - "end": 5476, - "loc": { - "start": { - "line": 204, - "column": 9 - }, - "end": { - "line": 204, - "column": 14 - }, - "identifierName": "every" - }, - "name": "every" + "line": 187, + "column": 37 }, - "computed": false + "identifierName": "newSystem" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 5477, - "end": 5494, - "loc": { - "start": { - "line": 204, - "column": 15 - }, - "end": { - "line": 204, - "column": 32 - } - }, - "object": { - "type": "Identifier", - "start": 5477, - "end": 5483, - "loc": { - "start": { - "line": 204, - "column": 15 - }, - "end": { - "line": 204, - "column": 21 - }, - "identifierName": "system" - }, - "name": "system" - }, - "property": { - "type": "Identifier", - "start": 5484, - "end": 5494, - "loc": { - "start": { - "line": 204, - "column": 22 - }, - "end": { - "line": 204, - "column": 32 - }, - "identifierName": "components" - }, - "name": "components" - }, - "computed": false - }, - { - "type": "CallExpression", - "start": 5496, - "end": 5521, - "loc": { - "start": { - "line": 204, - "column": 34 - }, - "end": { - "line": 204, - "column": 59 - } - }, - "callee": { - "type": "MemberExpression", - "start": 5496, - "end": 5513, - "loc": { - "start": { - "line": 204, - "column": 34 - }, - "end": { - "line": 204, - "column": 51 - } - }, - "object": { - "type": "MemberExpression", - "start": 5496, - "end": 5508, - "loc": { - "start": { - "line": 204, - "column": 34 - }, - "end": { - "line": 204, - "column": 46 - } - }, - "object": { - "type": "Identifier", - "start": 5496, - "end": 5502, - "loc": { - "start": { - "line": 204, - "column": 34 - }, - "end": { - "line": 204, - "column": 40 - }, - "identifierName": "system" - }, - "name": "system" - }, - "property": { - "type": "Identifier", - "start": 5503, - "end": 5508, - "loc": { - "start": { - "line": 204, - "column": 41 - }, - "end": { - "line": 204, - "column": 46 - }, - "identifierName": "every" - }, - "name": "every" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 5509, - "end": 5513, - "loc": { - "start": { - "line": 204, - "column": 47 - }, - "end": { - "line": 204, - "column": 51 - }, - "identifierName": "bind" - }, - "name": "bind" - }, - "computed": false - }, - "arguments": [ - { - "type": "Identifier", - "start": 5514, - "end": 5520, - "loc": { - "start": { - "line": 204, - "column": 52 - }, - "end": { - "line": 204, - "column": 58 - }, - "identifierName": "system" - }, - "name": "system" - } - ] - }, - { - "type": "SpreadElement", - "start": 5523, - "end": 5530, - "loc": { - "start": { - "line": 204, - "column": 61 - }, - "end": { - "line": 204, - "column": 68 - } - }, - "argument": { - "type": "Identifier", - "start": 5526, - "end": 5530, - "loc": { - "start": { - "line": 204, - "column": 64 - }, - "end": { - "line": 204, - "column": 68 - }, - "identifierName": "args" - }, - "name": "args" - } - } - ] + "name": "newSystem" } - } - ], - "directives": [] - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Run the \"every\" method in the system", - "start": 5387, - "end": 5426, + ], + "leadingComments": null + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start": 5133, + "end": 5134, "loc": { "start": { - "line": 202, - "column": 3 + "line": 187, + "column": 41 }, "end": { - "line": 202, + "line": 187, "column": 42 } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 5541, - "end": 5572, - "loc": { - "start": { - "line": 207, - "column": 3 - }, - "end": { - "line": 207, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 5541, - "end": 5572, - "loc": { - "start": { - "line": 207, - "column": 3 }, - "end": { - "line": 207, - "column": 34 - } + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 }, - "callee": { - "type": "Identifier", - "start": 5541, - "end": 5547, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Add the system, return its ID", + "start": 5059, + "end": 5091, "loc": { "start": { - "line": 207, + "line": 186, "column": 3 }, "end": { - "line": 207, - "column": 9 - }, - "identifierName": "invoke" - }, - "name": "invoke" - }, - "arguments": [ - { - "type": "Identifier", - "start": 5548, - "end": 5554, - "loc": { - "start": { - "line": 207, - "column": 10 - }, - "end": { - "line": 207, - "column": 16 - }, - "identifierName": "system" - }, - "name": "system" - }, - { - "type": "StringLiteral", - "start": 5556, - "end": 5562, - "loc": { - "start": { - "line": 207, - "column": 18 - }, - "end": { - "line": 207, - "column": 24 - } - }, - "extra": { - "rawValue": "post", - "raw": "'post'" - }, - "value": "post" - }, - { - "type": "SpreadElement", - "start": 5564, - "end": 5571, - "loc": { - "start": { - "line": 207, - "column": 26 - }, - "end": { - "line": 207, - "column": 33 - } - }, - "argument": { - "type": "Identifier", - "start": 5567, - "end": 5571, - "loc": { - "start": { - "line": 207, - "column": 29 - }, - "end": { - "line": 207, - "column": 33 - }, - "identifierName": "args" - }, - "name": "args" + "line": 186, + "column": 35 } } - ] - } + } + ] } ], "directives": [] - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system([], systemA)\n\t * world.system([], systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", - "start": 4766, - "end": 5295, - "loc": { - "start": { - "line": 177, - "column": 1 - }, - "end": { - "line": 197, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", - "start": 5582, - "end": 6373, - "loc": { - "start": { - "line": 211, - "column": 1 }, - "end": { - "line": 229, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 6375, - "end": 7188, - "loc": { + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Make sure the system is valid", + "start": 4849, + "end": 4881, + "loc": { + "start": { + "line": 180, + "column": 2 + }, + "end": { + "line": 180, + "column": 34 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 5141, + "end": 5157, + "loc": { + "start": { + "line": 189, + "column": 2 + }, + "end": { + "line": 189, + "column": 18 + } + }, + "argument": { + "type": "Identifier", + "start": 5148, + "end": 5157, + "loc": { + "start": { + "line": 189, + "column": 9 + }, + "end": { + "line": 189, + "column": 18 + }, + "identifierName": "undefined" + }, + "name": "undefined" + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * constructor(context) {\n\t * // This is showing how you can optionally pass parameters to the system's constructor\n\t * this.context = context\n\t * }\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * }, context)\n\t *\n\t * @example\n\t * // System that doesn't use every()\n\t * world.system(class {\n\t * constructor(context) {\n\t * this.context = context\n\t * }\n\t * pre() {\n\t * // Handle events or something\n\t * }\n\t * }, context)\n\t *\n\t * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).\n\t *\n\t * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t *\n\t * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.\n\t *\n\t * **[...args]**: The arguments to forward to the system's constructors.\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", + "start": 3066, + "end": 4560, + "loc": { + "start": { + "line": 129, + "column": 1 + }, + "end": { + "line": 166, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", + "start": 5163, + "end": 5360, + "loc": { + "start": { + "line": 192, + "column": 1 + }, + "end": { + "line": 199, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 5362, + "end": 5468, + "loc": { "start": { - "line": 230, + "line": 200, "column": 1 }, "end": { - "line": 254, + "line": 204, "column": 2 } }, @@ -6425,20 +6012,20 @@ "computed": false, "key": { "type": "Identifier", - "start": 6375, - "end": 6380, + "start": 5362, + "end": 5372, "loc": { "start": { - "line": 230, + "line": 200, "column": 1 }, "end": { - "line": 230, - "column": 6 + "line": 200, + "column": 11 }, - "identifierName": "every" + "identifierName": "initialize" }, - "name": "every", + "name": "initialize", "leadingComments": null }, "kind": "method", @@ -6447,66 +6034,32 @@ "expression": false, "async": false, "params": [ - { - "type": "Identifier", - "start": 6381, - "end": 6395, - "loc": { - "start": { - "line": 230, - "column": 7 - }, - "end": { - "line": 230, - "column": 21 - }, - "identifierName": "componentNames" - }, - "name": "componentNames" - }, - { - "type": "Identifier", - "start": 6397, - "end": 6405, - "loc": { - "start": { - "line": 230, - "column": 23 - }, - "end": { - "line": 230, - "column": 31 - }, - "identifierName": "callback" - }, - "name": "callback" - }, { "type": "RestElement", - "start": 6407, - "end": 6414, + "start": 5373, + "end": 5380, "loc": { "start": { - "line": 230, - "column": 33 + "line": 200, + "column": 12 }, "end": { - "line": 230, - "column": 40 + "line": 200, + "column": 19 } }, "argument": { "type": "Identifier", - "start": 6410, - "end": 6414, + "start": 5376, + "end": 5380, "loc": { "start": { - "line": 230, - "column": 36 + "line": 200, + "column": 15 }, "end": { - "line": 230, - "column": 40 + "line": 200, + "column": 19 }, "identifierName": "args" }, @@ -6516,1174 +6069,1200 @@ ], "body": { "type": "BlockStatement", - "start": 6416, - "end": 7188, + "start": 5382, + "end": 5468, "loc": { "start": { - "line": 230, - "column": 42 + "line": 200, + "column": 21 }, "end": { - "line": 254, + "line": 204, "column": 2 } }, "body": [ { - "type": "VariableDeclaration", - "start": 6453, - "end": 6500, + "type": "ForOfStatement", + "start": 5386, + "end": 5465, "loc": { "start": { - "line": 232, + "line": 201, "column": 2 }, "end": { - "line": 232, - "column": 49 + "line": 203, + "column": 3 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6457, - "end": 6500, - "loc": { - "start": { - "line": 232, - "column": 6 - }, - "end": { - "line": 232, - "column": 49 - } + "left": { + "type": "VariableDeclaration", + "start": 5391, + "end": 5401, + "loc": { + "start": { + "line": 201, + "column": 7 }, - "id": { - "type": "Identifier", - "start": 6457, - "end": 6465, + "end": { + "line": 201, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 5395, + "end": 5401, "loc": { "start": { - "line": 232, - "column": 6 + "line": 201, + "column": 11 }, "end": { - "line": 232, - "column": 14 + "line": 201, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 5395, + "end": 5401, + "loc": { + "start": { + "line": 201, + "column": 11 + }, + "end": { + "line": 201, + "column": 17 + }, + "identifierName": "system" }, - "identifierName": "entities" + "name": "system" }, - "name": "entities", - "leadingComments": null + "init": null + } + ], + "kind": "let" + }, + "right": { + "type": "MemberExpression", + "start": 5405, + "end": 5417, + "loc": { + "start": { + "line": 201, + "column": 21 }, - "init": { - "type": "CallExpression", - "start": 6468, - "end": 6500, + "end": { + "line": 201, + "column": 33 + } + }, + "object": { + "type": "ThisExpression", + "start": 5405, + "end": 5409, + "loc": { + "start": { + "line": 201, + "column": 21 + }, + "end": { + "line": 201, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "start": 5410, + "end": 5417, + "loc": { + "start": { + "line": 201, + "column": 26 + }, + "end": { + "line": 201, + "column": 33 + }, + "identifierName": "systems" + }, + "name": "systems" + }, + "computed": false + }, + "body": { + "type": "BlockStatement", + "start": 5419, + "end": 5465, + "loc": { + "start": { + "line": 201, + "column": 35 + }, + "end": { + "line": 203, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 5424, + "end": 5461, "loc": { "start": { - "line": 232, - "column": 17 + "line": 202, + "column": 3 }, "end": { - "line": 232, - "column": 49 + "line": 202, + "column": 40 } }, - "callee": { - "type": "MemberExpression", - "start": 6468, - "end": 6484, + "expression": { + "type": "CallExpression", + "start": 5424, + "end": 5461, "loc": { "start": { - "line": 232, - "column": 17 + "line": 202, + "column": 3 }, "end": { - "line": 232, - "column": 33 + "line": 202, + "column": 40 } }, - "object": { - "type": "MemberExpression", - "start": 6468, - "end": 6478, + "callee": { + "type": "Identifier", + "start": 5424, + "end": 5430, "loc": { "start": { - "line": 232, - "column": 17 + "line": 202, + "column": 3 }, "end": { - "line": 232, - "column": 27 - } + "line": 202, + "column": 9 + }, + "identifierName": "invoke" }, - "object": { - "type": "ThisExpression", - "start": 6468, - "end": 6472, - "loc": { - "start": { - "line": 232, - "column": 17 - }, - "end": { - "line": 232, - "column": 21 - } - } - }, - "property": { + "name": "invoke" + }, + "arguments": [ + { "type": "Identifier", - "start": 6473, - "end": 6478, + "start": 5431, + "end": 5437, "loc": { "start": { - "line": 232, - "column": 22 + "line": 202, + "column": 10 }, "end": { - "line": 232, - "column": 27 + "line": 202, + "column": 16 }, - "identifierName": "index" + "identifierName": "system" }, - "name": "index" + "name": "system" }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 6479, - "end": 6484, - "loc": { - "start": { - "line": 232, - "column": 28 + { + "type": "StringLiteral", + "start": 5439, + "end": 5451, + "loc": { + "start": { + "line": 202, + "column": 18 + }, + "end": { + "line": 202, + "column": 30 + } }, - "end": { - "line": 232, - "column": 33 + "extra": { + "rawValue": "initialize", + "raw": "'initialize'" }, - "identifierName": "query" + "value": "initialize" }, - "name": "query" - }, - "computed": false - }, - "arguments": [ - { - "type": "Identifier", - "start": 6485, - "end": 6499, - "loc": { - "start": { - "line": 232, - "column": 34 - }, - "end": { - "line": 232, - "column": 48 + { + "type": "SpreadElement", + "start": 5453, + "end": 5460, + "loc": { + "start": { + "line": 202, + "column": 32 + }, + "end": { + "line": 202, + "column": 39 + } }, - "identifierName": "componentNames" - }, - "name": "componentNames" - } - ] - }, - "leadingComments": null - } - ], - "kind": "let", - "leadingComments": [ - { - "type": "CommentLine", - "value": " Get indexed map of entities", - "start": 6420, - "end": 6450, - "loc": { - "start": { - "line": 231, - "column": 2 - }, - "end": { - "line": 231, - "column": 32 + "argument": { + "type": "Identifier", + "start": 5456, + "end": 5460, + "loc": { + "start": { + "line": 202, + "column": 35 + }, + "end": { + "line": 202, + "column": 39 + }, + "identifierName": "args" + }, + "name": "args" + } + } + ] } } - } - ] + ], + "directives": [] + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", + "start": 5163, + "end": 5360, + "loc": { + "start": { + "line": 192, + "column": 1 + }, + "end": { + "line": 199, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system(systemA)\n\t * world.system(systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", + "start": 5471, + "end": 5992, + "loc": { + "start": { + "line": 206, + "column": 1 + }, + "end": { + "line": 226, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 5994, + "end": 6276, + "loc": { + "start": { + "line": 227, + "column": 1 + }, + "end": { + "line": 238, + "column": 2 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 5994, + "end": 5997, + "loc": { + "start": { + "line": 227, + "column": 1 + }, + "end": { + "line": 227, + "column": 4 + }, + "identifierName": "run" + }, + "name": "run", + "leadingComments": null + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 5998, + "end": 6005, + "loc": { + "start": { + "line": 227, + "column": 5 + }, + "end": { + "line": 227, + "column": 12 + } + }, + "argument": { + "type": "Identifier", + "start": 6001, + "end": 6005, + "loc": { + "start": { + "line": 227, + "column": 8 + }, + "end": { + "line": 227, + "column": 12 + }, + "identifierName": "args" + }, + "name": "args" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 6007, + "end": 6276, + "loc": { + "start": { + "line": 227, + "column": 14 }, + "end": { + "line": 238, + "column": 2 + } + }, + "body": [ { - "type": "IfStatement", - "start": 6504, - "end": 7157, + "type": "ForOfStatement", + "start": 6011, + "end": 6273, "loc": { "start": { - "line": 234, + "line": 228, "column": 2 }, "end": { - "line": 251, + "line": 237, "column": 3 } }, - "test": { - "type": "CallExpression", - "start": 6508, - "end": 6528, + "left": { + "type": "VariableDeclaration", + "start": 6016, + "end": 6026, "loc": { "start": { - "line": 234, - "column": 6 + "line": 228, + "column": 7 }, "end": { - "line": 234, - "column": 26 + "line": 228, + "column": 17 } }, - "callee": { - "type": "Identifier", - "start": 6508, - "end": 6518, - "loc": { - "start": { - "line": 234, - "column": 6 - }, - "end": { - "line": 234, - "column": 16 - }, - "identifierName": "isFunction" - }, - "name": "isFunction" - }, - "arguments": [ + "declarations": [ { - "type": "Identifier", - "start": 6519, - "end": 6527, + "type": "VariableDeclarator", + "start": 6020, + "end": 6026, "loc": { "start": { - "line": 234, - "column": 17 + "line": 228, + "column": 11 }, "end": { - "line": 234, - "column": 25 - }, - "identifierName": "callback" + "line": 228, + "column": 17 + } }, - "name": "callback" - } - ] - }, - "consequent": { - "type": "BlockStatement", - "start": 6530, - "end": 7157, + "id": { + "type": "Identifier", + "start": 6020, + "end": 6026, + "loc": { + "start": { + "line": 228, + "column": 11 + }, + "end": { + "line": 228, + "column": 17 + }, + "identifierName": "system" + }, + "name": "system" + }, + "init": null + } + ], + "kind": "let" + }, + "right": { + "type": "MemberExpression", + "start": 6030, + "end": 6042, "loc": { "start": { - "line": 234, - "column": 28 + "line": 228, + "column": 21 + }, + "end": { + "line": 228, + "column": 33 + } + }, + "object": { + "type": "ThisExpression", + "start": 6030, + "end": 6034, + "loc": { + "start": { + "line": 228, + "column": 21 + }, + "end": { + "line": 228, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "start": 6035, + "end": 6042, + "loc": { + "start": { + "line": 228, + "column": 26 + }, + "end": { + "line": 228, + "column": 33 + }, + "identifierName": "systems" + }, + "name": "systems" + }, + "computed": false + }, + "body": { + "type": "BlockStatement", + "start": 6044, + "end": 6273, + "loc": { + "start": { + "line": 228, + "column": 35 }, "end": { - "line": 251, + "line": 237, "column": 3 } }, "body": [ { - "type": "ForOfStatement", - "start": 6572, - "end": 7153, + "type": "ExpressionStatement", + "start": 6049, + "end": 6079, "loc": { "start": { - "line": 236, + "line": 229, "column": 3 }, "end": { - "line": 250, - "column": 4 + "line": 229, + "column": 33 } }, - "left": { - "type": "VariableDeclaration", - "start": 6577, - "end": 6587, + "expression": { + "type": "CallExpression", + "start": 6049, + "end": 6079, "loc": { "start": { - "line": 236, - "column": 8 + "line": 229, + "column": 3 }, "end": { - "line": 236, - "column": 18 + "line": 229, + "column": 33 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 6049, + "end": 6055, + "loc": { + "start": { + "line": 229, + "column": 3 + }, + "end": { + "line": 229, + "column": 9 + }, + "identifierName": "invoke" + }, + "name": "invoke" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 6581, - "end": 6587, + "type": "Identifier", + "start": 6056, + "end": 6062, "loc": { "start": { - "line": 236, - "column": 12 + "line": 229, + "column": 10 }, "end": { - "line": 236, + "line": 229, + "column": 16 + }, + "identifierName": "system" + }, + "name": "system" + }, + { + "type": "StringLiteral", + "start": 6064, + "end": 6069, + "loc": { + "start": { + "line": 229, "column": 18 + }, + "end": { + "line": 229, + "column": 23 } }, - "id": { + "extra": { + "rawValue": "pre", + "raw": "'pre'" + }, + "value": "pre" + }, + { + "type": "SpreadElement", + "start": 6071, + "end": 6078, + "loc": { + "start": { + "line": 229, + "column": 25 + }, + "end": { + "line": 229, + "column": 32 + } + }, + "argument": { "type": "Identifier", - "start": 6581, - "end": 6587, + "start": 6074, + "end": 6078, "loc": { "start": { - "line": 236, - "column": 12 + "line": 229, + "column": 28 }, "end": { - "line": 236, - "column": 18 + "line": 229, + "column": 32 }, - "identifierName": "entity" + "identifierName": "args" }, - "name": "entity", - "leadingComments": null - }, - "init": null, - "leadingComments": null + "name": "args" + } } ], - "kind": "let", - "leadingComments": null + "trailingComments": null }, - "right": { + "trailingComments": [ + { + "type": "CommentLine", + "value": " Run the \"every\" method in the system", + "start": 6084, + "end": 6123, + "loc": { + "start": { + "line": 231, + "column": 3 + }, + "end": { + "line": 231, + "column": 42 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 6127, + "end": 6233, + "loc": { + "start": { + "line": 232, + "column": 3 + }, + "end": { + "line": 234, + "column": 4 + } + }, + "test": { "type": "CallExpression", - "start": 6591, - "end": 6608, + "start": 6131, + "end": 6155, "loc": { "start": { - "line": 236, - "column": 22 + "line": 232, + "column": 7 }, "end": { - "line": 236, - "column": 39 + "line": 232, + "column": 31 } }, "callee": { - "type": "MemberExpression", - "start": 6591, - "end": 6606, + "type": "Identifier", + "start": 6131, + "end": 6141, "loc": { "start": { - "line": 236, - "column": 22 + "line": 232, + "column": 7 }, "end": { - "line": 236, - "column": 37 - } + "line": 232, + "column": 17 + }, + "identifierName": "isFunction" }, - "object": { - "type": "Identifier", - "start": 6591, - "end": 6599, + "name": "isFunction", + "leadingComments": null + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 6142, + "end": 6154, "loc": { "start": { - "line": 236, - "column": 22 + "line": 232, + "column": 18 }, "end": { - "line": 236, + "line": 232, "column": 30 - }, - "identifierName": "entities" + } }, - "name": "entities" - }, - "property": { - "type": "Identifier", - "start": 6600, - "end": 6606, - "loc": { - "start": { - "line": 236, - "column": 31 + "object": { + "type": "Identifier", + "start": 6142, + "end": 6148, + "loc": { + "start": { + "line": 232, + "column": 18 + }, + "end": { + "line": 232, + "column": 24 + }, + "identifierName": "system" }, - "end": { - "line": 236, - "column": 37 + "name": "system" + }, + "property": { + "type": "Identifier", + "start": 6149, + "end": 6154, + "loc": { + "start": { + "line": 232, + "column": 25 + }, + "end": { + "line": 232, + "column": 30 + }, + "identifierName": "every" }, - "identifierName": "values" + "name": "every" }, - "name": "values" - }, - "computed": false - }, - "arguments": [] + "computed": false + } + ], + "leadingComments": null }, - "body": { + "consequent": { "type": "BlockStatement", - "start": 6610, - "end": 7153, + "start": 6157, + "end": 6233, "loc": { "start": { - "line": 236, - "column": 41 + "line": 232, + "column": 33 }, "end": { - "line": 250, + "line": 234, "column": 4 } }, "body": [ { - "type": "VariableDeclaration", - "start": 6848, - "end": 6909, + "type": "ExpressionStatement", + "start": 6163, + "end": 6228, "loc": { "start": { - "line": 241, + "line": 233, "column": 4 }, "end": { - "line": 241, - "column": 65 + "line": 233, + "column": 69 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6852, - "end": 6909, + "expression": { + "type": "CallExpression", + "start": 6163, + "end": 6228, + "loc": { + "start": { + "line": 233, + "column": 4 + }, + "end": { + "line": 233, + "column": 69 + } + }, + "callee": { + "type": "MemberExpression", + "start": 6163, + "end": 6173, "loc": { "start": { - "line": 241, - "column": 8 + "line": 233, + "column": 4 }, "end": { - "line": 241, - "column": 65 + "line": 233, + "column": 14 } }, - "id": { - "type": "Identifier", - "start": 6852, - "end": 6862, + "object": { + "type": "ThisExpression", + "start": 6163, + "end": 6167, "loc": { "start": { - "line": 241, + "line": 233, + "column": 4 + }, + "end": { + "line": 233, "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 6168, + "end": 6173, + "loc": { + "start": { + "line": 233, + "column": 9 }, "end": { - "line": 241, - "column": 18 + "line": 233, + "column": 14 }, - "identifierName": "components" + "identifierName": "every" }, - "name": "components", - "leadingComments": null + "name": "every" }, - "init": { + "computed": false + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 6174, + "end": 6191, + "loc": { + "start": { + "line": 233, + "column": 15 + }, + "end": { + "line": 233, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 6174, + "end": 6180, + "loc": { + "start": { + "line": 233, + "column": 15 + }, + "end": { + "line": 233, + "column": 21 + }, + "identifierName": "system" + }, + "name": "system" + }, + "property": { + "type": "Identifier", + "start": 6181, + "end": 6191, + "loc": { + "start": { + "line": 233, + "column": 22 + }, + "end": { + "line": 233, + "column": 32 + }, + "identifierName": "components" + }, + "name": "components" + }, + "computed": false + }, + { "type": "CallExpression", - "start": 6865, - "end": 6909, + "start": 6193, + "end": 6218, "loc": { "start": { - "line": 241, - "column": 21 + "line": 233, + "column": 34 }, "end": { - "line": 241, - "column": 65 + "line": 233, + "column": 59 } }, "callee": { "type": "MemberExpression", - "start": 6865, - "end": 6883, + "start": 6193, + "end": 6210, "loc": { "start": { - "line": 241, - "column": 21 + "line": 233, + "column": 34 }, "end": { - "line": 241, - "column": 39 + "line": 233, + "column": 51 } }, "object": { - "type": "Identifier", - "start": 6865, - "end": 6879, + "type": "MemberExpression", + "start": 6193, + "end": 6205, "loc": { "start": { - "line": 241, - "column": 21 + "line": 233, + "column": 34 }, "end": { - "line": 241, - "column": 35 + "line": 233, + "column": 46 + } + }, + "object": { + "type": "Identifier", + "start": 6193, + "end": 6199, + "loc": { + "start": { + "line": 233, + "column": 34 + }, + "end": { + "line": 233, + "column": 40 + }, + "identifierName": "system" }, - "identifierName": "componentNames" + "name": "system" }, - "name": "componentNames" + "property": { + "type": "Identifier", + "start": 6200, + "end": 6205, + "loc": { + "start": { + "line": 233, + "column": 41 + }, + "end": { + "line": 233, + "column": 46 + }, + "identifierName": "every" + }, + "name": "every" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 6880, - "end": 6883, + "start": 6206, + "end": 6210, "loc": { "start": { - "line": 241, - "column": 36 + "line": 233, + "column": 47 }, "end": { - "line": 241, - "column": 39 + "line": 233, + "column": 51 }, - "identifierName": "map" + "identifierName": "bind" }, - "name": "map" + "name": "bind" }, "computed": false }, "arguments": [ { - "type": "ArrowFunctionExpression", - "start": 6884, - "end": 6908, + "type": "Identifier", + "start": 6211, + "end": 6217, "loc": { "start": { - "line": 241, - "column": 40 + "line": 233, + "column": 52 }, "end": { - "line": 241, - "column": 64 - } - }, - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 6884, - "end": 6888, - "loc": { - "start": { - "line": 241, - "column": 40 - }, - "end": { - "line": 241, - "column": 44 - }, - "identifierName": "name" - }, - "name": "name" - } - ], - "body": { - "type": "CallExpression", - "start": 6892, - "end": 6908, - "loc": { - "start": { - "line": 241, - "column": 48 - }, - "end": { - "line": 241, - "column": 64 - } - }, - "callee": { - "type": "MemberExpression", - "start": 6892, - "end": 6902, - "loc": { - "start": { - "line": 241, - "column": 48 - }, - "end": { - "line": 241, - "column": 58 - } - }, - "object": { - "type": "Identifier", - "start": 6892, - "end": 6898, - "loc": { - "start": { - "line": 241, - "column": 48 - }, - "end": { - "line": 241, - "column": 54 - }, - "identifierName": "entity" - }, - "name": "entity" - }, - "property": { - "type": "Identifier", - "start": 6899, - "end": 6902, - "loc": { - "start": { - "line": 241, - "column": 55 - }, - "end": { - "line": 241, - "column": 58 - }, - "identifierName": "get" - }, - "name": "get" - }, - "computed": false + "line": 233, + "column": 58 }, - "arguments": [ - { - "type": "Identifier", - "start": 6903, - "end": 6907, - "loc": { - "start": { - "line": 241, - "column": 59 - }, - "end": { - "line": 241, - "column": 63 - }, - "identifierName": "name" - }, - "name": "name" - } - ] - } + "identifierName": "system" + }, + "name": "system" } - ], - "trailingComments": null + ] }, - "leadingComments": null, - "trailingComments": null - } - ], - "kind": "let", - "leadingComments": [ - { - "type": "CommentLine", - "value": " At this point, we can safely assume that all components exist, even if entities/components", - "start": 6616, - "end": 6709, - "loc": { - "start": { - "line": 237, - "column": 4 - }, - "end": { - "line": 237, - "column": 97 - } - } - }, - { - "type": "CommentLine", - "value": " are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.", - "start": 6714, - "end": 6804, - "loc": { - "start": { - "line": 238, - "column": 4 - }, - "end": { - "line": 238, - "column": 94 - } - } - }, - { - "type": "CommentLine", - "value": " Get all components as an array", - "start": 6810, - "end": 6843, - "loc": { - "start": { - "line": 240, - "column": 4 - }, - "end": { - "line": 240, - "column": 37 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Pass components, then the main entity, then any additional arguments", - "start": 6915, - "end": 6986, - "loc": { - "start": { - "line": 243, - "column": 4 - }, - "end": { - "line": 243, - "column": 75 - } - } - } - ] - }, - { - "type": "VariableDeclaration", - "start": 6991, - "end": 7044, - "loc": { - "start": { - "line": 244, - "column": 4 - }, - "end": { - "line": 244, - "column": 57 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6995, - "end": 7044, - "loc": { - "start": { - "line": 244, - "column": 8 - }, - "end": { - "line": 244, - "column": 57 - } - }, - "id": { - "type": "Identifier", - "start": 6995, - "end": 7001, - "loc": { - "start": { - "line": 244, - "column": 8 - }, - "end": { - "line": 244, - "column": 14 - }, - "identifierName": "status" - }, - "name": "status", - "leadingComments": null - }, - "init": { - "type": "CallExpression", - "start": 7004, - "end": 7044, + { + "type": "SpreadElement", + "start": 6220, + "end": 6227, "loc": { "start": { - "line": 244, - "column": 17 + "line": 233, + "column": 61 }, "end": { - "line": 244, - "column": 57 + "line": 233, + "column": 68 } }, - "callee": { + "argument": { "type": "Identifier", - "start": 7004, - "end": 7012, + "start": 6223, + "end": 6227, "loc": { "start": { - "line": 244, - "column": 17 + "line": 233, + "column": 64 }, "end": { - "line": 244, - "column": 25 - }, - "identifierName": "callback" - }, - "name": "callback" - }, - "arguments": [ - { - "type": "SpreadElement", - "start": 7013, - "end": 7026, - "loc": { - "start": { - "line": 244, - "column": 26 - }, - "end": { - "line": 244, - "column": 39 - } - }, - "argument": { - "type": "Identifier", - "start": 7016, - "end": 7026, - "loc": { - "start": { - "line": 244, - "column": 29 - }, - "end": { - "line": 244, - "column": 39 - }, - "identifierName": "components" - }, - "name": "components" - } - }, - { - "type": "Identifier", - "start": 7028, - "end": 7034, - "loc": { - "start": { - "line": 244, - "column": 41 - }, - "end": { - "line": 244, - "column": 47 - }, - "identifierName": "entity" + "line": 233, + "column": 68 }, - "name": "entity" + "identifierName": "args" }, - { - "type": "SpreadElement", - "start": 7036, - "end": 7043, - "loc": { - "start": { - "line": 244, - "column": 49 - }, - "end": { - "line": 244, - "column": 56 - } - }, - "argument": { - "type": "Identifier", - "start": 7039, - "end": 7043, - "loc": { - "start": { - "line": 244, - "column": 52 - }, - "end": { - "line": 244, - "column": 56 - }, - "identifierName": "args" - }, - "name": "args" - } - } - ], - "trailingComments": null - }, - "leadingComments": null, - "trailingComments": null - } - ], - "kind": "let", - "leadingComments": [ - { - "type": "CommentLine", - "value": " Pass components, then the main entity, then any additional arguments", - "start": 6915, - "end": 6986, - "loc": { - "start": { - "line": 243, - "column": 4 - }, - "end": { - "line": 243, - "column": 75 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Stop the iteration when the callback returns false", - "start": 7050, - "end": 7103, - "loc": { - "start": { - "line": 246, - "column": 4 - }, - "end": { - "line": 246, - "column": 57 + "name": "args" } } - } - ] + ] + } + } + ], + "directives": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Run the \"every\" method in the system", + "start": 6084, + "end": 6123, + "loc": { + "start": { + "line": 231, + "column": 3 + }, + "end": { + "line": 231, + "column": 42 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 6238, + "end": 6269, + "loc": { + "start": { + "line": 236, + "column": 3 + }, + "end": { + "line": 236, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 6238, + "end": 6269, + "loc": { + "start": { + "line": 236, + "column": 3 + }, + "end": { + "line": 236, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 6238, + "end": 6244, + "loc": { + "start": { + "line": 236, + "column": 3 + }, + "end": { + "line": 236, + "column": 9 + }, + "identifierName": "invoke" }, + "name": "invoke" + }, + "arguments": [ { - "type": "IfStatement", - "start": 7108, - "end": 7148, + "type": "Identifier", + "start": 6245, + "end": 6251, "loc": { "start": { - "line": 247, - "column": 4 - }, + "line": 236, + "column": 10 + }, "end": { - "line": 249, - "column": 5 - } - }, - "test": { - "type": "BinaryExpression", - "start": 7112, - "end": 7128, - "loc": { - "start": { - "line": 247, - "column": 8 - }, - "end": { - "line": 247, - "column": 24 - } + "line": 236, + "column": 16 }, - "left": { - "type": "Identifier", - "start": 7112, - "end": 7118, - "loc": { - "start": { - "line": 247, - "column": 8 - }, - "end": { - "line": 247, - "column": 14 - }, - "identifierName": "status" - }, - "name": "status", - "leadingComments": null + "identifierName": "system" + }, + "name": "system" + }, + { + "type": "StringLiteral", + "start": 6253, + "end": 6259, + "loc": { + "start": { + "line": 236, + "column": 18 }, - "operator": "===", - "right": { - "type": "BooleanLiteral", - "start": 7123, - "end": 7128, - "loc": { - "start": { - "line": 247, - "column": 19 - }, - "end": { - "line": 247, - "column": 24 - } - }, - "value": false + "end": { + "line": 236, + "column": 24 + } + }, + "extra": { + "rawValue": "post", + "raw": "'post'" + }, + "value": "post" + }, + { + "type": "SpreadElement", + "start": 6261, + "end": 6268, + "loc": { + "start": { + "line": 236, + "column": 26 }, - "leadingComments": null + "end": { + "line": 236, + "column": 33 + } }, - "consequent": { - "type": "BlockStatement", - "start": 7130, - "end": 7148, + "argument": { + "type": "Identifier", + "start": 6264, + "end": 6268, "loc": { "start": { - "line": 247, - "column": 26 + "line": 236, + "column": 29 }, "end": { - "line": 249, - "column": 5 - } + "line": 236, + "column": 33 + }, + "identifierName": "args" }, - "body": [ - { - "type": "BreakStatement", - "start": 7137, - "end": 7142, - "loc": { - "start": { - "line": 248, - "column": 5 - }, - "end": { - "line": 248, - "column": 10 - } - }, - "label": null - } - ], - "directives": [] - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Stop the iteration when the callback returns false", - "start": 7050, - "end": 7103, - "loc": { - "start": { - "line": 246, - "column": 4 - }, - "end": { - "line": 246, - "column": 57 - } - } - } - ] - } - ], - "directives": [] - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Go through the map of entities", - "start": 6535, - "end": 6568, - "loc": { - "start": { - "line": 235, - "column": 3 - }, - "end": { - "line": 235, - "column": 36 + "name": "args" } } - } - ] + ] + } } ], "directives": [] - }, - "alternate": null - }, - { - "type": "ReturnStatement", - "start": 7161, - "end": 7185, - "loc": { - "start": { - "line": 253, - "column": 2 - }, - "end": { - "line": 253, - "column": 26 - } - }, - "argument": { - "type": "CallExpression", - "start": 7168, - "end": 7185, - "loc": { - "start": { - "line": 253, - "column": 9 - }, - "end": { - "line": 253, - "column": 26 - } - }, - "callee": { - "type": "MemberExpression", - "start": 7168, - "end": 7183, - "loc": { - "start": { - "line": 253, - "column": 9 - }, - "end": { - "line": 253, - "column": 24 - } - }, - "object": { - "type": "Identifier", - "start": 7168, - "end": 7176, - "loc": { - "start": { - "line": 253, - "column": 9 - }, - "end": { - "line": 253, - "column": 17 - }, - "identifierName": "entities" - }, - "name": "entities" - }, - "property": { - "type": "Identifier", - "start": 7177, - "end": 7183, - "loc": { - "start": { - "line": 253, - "column": 18 - }, - "end": { - "line": 253, - "column": 24 - }, - "identifierName": "values" - }, - "name": "values" - }, - "computed": false - }, - "arguments": [] } } ], @@ -7693,16 +7272,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", - "start": 5582, - "end": 6373, + "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system(systemA)\n\t * world.system(systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", + "start": 5471, + "end": 5992, "loc": { "start": { - "line": 211, + "line": 206, "column": 1 }, "end": { - "line": 229, + "line": 226, "column": 4 } } @@ -7711,16 +7290,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", - "start": 7191, - "end": 7597, + "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", + "start": 6279, + "end": 7070, "loc": { "start": { - "line": 256, + "line": 240, "column": 1 }, "end": { - "line": 266, + "line": 258, "column": 4 } } @@ -7729,15 +7308,15 @@ }, { "type": "ClassMethod", - "start": 7599, - "end": 7667, + "start": 7072, + "end": 7885, "loc": { "start": { - "line": 267, + "line": 259, "column": 1 }, "end": { - "line": 269, + "line": 283, "column": 2 } }, @@ -7745,20 +7324,20 @@ "computed": false, "key": { "type": "Identifier", - "start": 7599, - "end": 7602, + "start": 7072, + "end": 7077, "loc": { "start": { - "line": 267, + "line": 259, "column": 1 }, "end": { - "line": 267, - "column": 4 + "line": 259, + "column": 6 }, - "identifierName": "get" + "identifierName": "every" }, - "name": "get", + "name": "every", "leadingComments": null }, "kind": "method", @@ -7767,383 +7346,268 @@ "expression": false, "async": false, "params": [ + { + "type": "Identifier", + "start": 7078, + "end": 7092, + "loc": { + "start": { + "line": 259, + "column": 7 + }, + "end": { + "line": 259, + "column": 21 + }, + "identifierName": "componentNames" + }, + "name": "componentNames" + }, + { + "type": "Identifier", + "start": 7094, + "end": 7102, + "loc": { + "start": { + "line": 259, + "column": 23 + }, + "end": { + "line": 259, + "column": 31 + }, + "identifierName": "callback" + }, + "name": "callback" + }, { "type": "RestElement", - "start": 7603, - "end": 7620, + "start": 7104, + "end": 7111, "loc": { "start": { - "line": 267, - "column": 5 + "line": 259, + "column": 33 }, "end": { - "line": 267, - "column": 22 + "line": 259, + "column": 40 } }, "argument": { "type": "Identifier", - "start": 7606, - "end": 7620, + "start": 7107, + "end": 7111, "loc": { "start": { - "line": 267, - "column": 8 + "line": 259, + "column": 36 }, "end": { - "line": 267, - "column": 22 + "line": 259, + "column": 40 }, - "identifierName": "componentNames" + "identifierName": "args" }, - "name": "componentNames" + "name": "args" } } ], "body": { "type": "BlockStatement", - "start": 7622, - "end": 7667, + "start": 7113, + "end": 7885, "loc": { "start": { - "line": 267, - "column": 24 + "line": 259, + "column": 42 }, "end": { - "line": 269, + "line": 283, "column": 2 } }, "body": [ { - "type": "ReturnStatement", - "start": 7626, - "end": 7664, + "type": "VariableDeclaration", + "start": 7150, + "end": 7197, "loc": { "start": { - "line": 268, + "line": 261, "column": 2 }, "end": { - "line": 268, - "column": 40 + "line": 261, + "column": 49 } }, - "argument": { - "type": "ArrayExpression", - "start": 7633, - "end": 7664, - "loc": { - "start": { - "line": 268, - "column": 9 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 7154, + "end": 7197, + "loc": { + "start": { + "line": 261, + "column": 6 + }, + "end": { + "line": 261, + "column": 49 + } }, - "end": { - "line": 268, - "column": 40 - } - }, - "elements": [ - { - "type": "SpreadElement", - "start": 7634, - "end": 7663, + "id": { + "type": "Identifier", + "start": 7154, + "end": 7162, "loc": { "start": { - "line": 268, - "column": 10 + "line": 261, + "column": 6 }, "end": { - "line": 268, - "column": 39 + "line": 261, + "column": 14 + }, + "identifierName": "entities" + }, + "name": "entities", + "leadingComments": null + }, + "init": { + "type": "CallExpression", + "start": 7165, + "end": 7197, + "loc": { + "start": { + "line": 261, + "column": 17 + }, + "end": { + "line": 261, + "column": 49 } }, - "argument": { - "type": "CallExpression", - "start": 7637, - "end": 7663, + "callee": { + "type": "MemberExpression", + "start": 7165, + "end": 7181, "loc": { "start": { - "line": 268, - "column": 13 + "line": 261, + "column": 17 }, "end": { - "line": 268, - "column": 39 + "line": 261, + "column": 33 } }, - "callee": { + "object": { "type": "MemberExpression", - "start": 7637, - "end": 7647, + "start": 7165, + "end": 7175, "loc": { "start": { - "line": 268, - "column": 13 + "line": 261, + "column": 17 }, "end": { - "line": 268, - "column": 23 + "line": 261, + "column": 27 } }, "object": { "type": "ThisExpression", - "start": 7637, - "end": 7641, + "start": 7165, + "end": 7169, "loc": { "start": { - "line": 268, - "column": 13 + "line": 261, + "column": 17 }, "end": { - "line": 268, - "column": 17 + "line": 261, + "column": 21 } } }, "property": { "type": "Identifier", - "start": 7642, - "end": 7647, + "start": 7170, + "end": 7175, "loc": { "start": { - "line": 268, - "column": 18 + "line": 261, + "column": 22 }, "end": { - "line": 268, - "column": 23 + "line": 261, + "column": 27 }, - "identifierName": "every" + "identifierName": "index" }, - "name": "every" + "name": "index" }, "computed": false }, - "arguments": [ - { - "type": "Identifier", - "start": 7648, - "end": 7662, - "loc": { - "start": { - "line": 268, - "column": 24 - }, - "end": { - "line": 268, - "column": 38 - }, - "identifierName": "componentNames" + "property": { + "type": "Identifier", + "start": 7176, + "end": 7181, + "loc": { + "start": { + "line": 261, + "column": 28 }, - "name": "componentNames" - } - ] - } - } - ] - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", - "start": 7191, - "end": 7597, - "loc": { - "start": { - "line": 256, - "column": 1 - }, - "end": { - "line": 266, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", - "start": 7670, - "end": 8150, - "loc": { - "start": { - "line": 271, - "column": 1 - }, - "end": { - "line": 286, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 8152, - "end": 8790, - "loc": { - "start": { - "line": 287, - "column": 1 - }, - "end": { - "line": 312, - "column": 2 - } - }, - "static": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 8152, - "end": 8161, - "loc": { - "start": { - "line": 287, - "column": 1 - }, - "end": { - "line": 287, - "column": 10 - }, - "identifierName": "prototype" - }, - "name": "prototype", - "leadingComments": null - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 8162, - "end": 8166, - "loc": { - "start": { - "line": 287, - "column": 11 - }, - "end": { - "line": 287, - "column": 15 - }, - "identifierName": "data" - }, - "name": "data" - } - ], - "body": { - "type": "BlockStatement", - "start": 8168, - "end": 8790, - "loc": { - "start": { - "line": 287, - "column": 17 - }, - "end": { - "line": 312, - "column": 2 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 8172, - "end": 8185, - "loc": { - "start": { - "line": 288, - "column": 2 - }, - "end": { - "line": 288, - "column": 15 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 8176, - "end": 8185, - "loc": { - "start": { - "line": 288, - "column": 6 - }, - "end": { - "line": 288, - "column": 15 - } - }, - "id": { - "type": "Identifier", - "start": 8176, - "end": 8181, - "loc": { - "start": { - "line": 288, - "column": 6 - }, - "end": { - "line": 288, - "column": 11 + "end": { + "line": 261, + "column": 33 + }, + "identifierName": "query" + }, + "name": "query" }, - "identifierName": "count" + "computed": false }, - "name": "count" - }, - "init": { - "type": "NumericLiteral", - "start": 8184, - "end": 8185, - "loc": { - "start": { - "line": 288, - "column": 14 - }, - "end": { - "line": 288, - "column": 15 + "arguments": [ + { + "type": "Identifier", + "start": 7182, + "end": 7196, + "loc": { + "start": { + "line": 261, + "column": 34 + }, + "end": { + "line": 261, + "column": 48 + }, + "identifierName": "componentNames" + }, + "name": "componentNames" } - }, - "extra": { - "rawValue": 0, - "raw": "0" - }, - "value": 0, - "leadingComments": null, - "trailingComments": null + ] }, - "trailingComments": null + "leadingComments": null } ], "kind": "let", - "trailingComments": [ + "leadingComments": [ { "type": "CommentLine", - "value": " Convert to an object when given a string", - "start": 8189, - "end": 8232, + "value": " Get indexed map of entities", + "start": 7117, + "end": 7147, "loc": { "start": { - "line": 290, + "line": 260, "column": 2 }, "end": { - "line": 290, - "column": 45 + "line": 260, + "column": 32 } } } @@ -8151,1196 +7615,867 @@ }, { "type": "IfStatement", - "start": 8235, - "end": 8297, + "start": 7201, + "end": 7854, "loc": { "start": { - "line": 291, + "line": 263, "column": 2 }, "end": { - "line": 293, + "line": 280, "column": 3 } }, "test": { - "type": "BinaryExpression", - "start": 8239, - "end": 8263, + "type": "CallExpression", + "start": 7205, + "end": 7225, "loc": { "start": { - "line": 291, + "line": 263, "column": 6 }, "end": { - "line": 291, - "column": 30 + "line": 263, + "column": 26 } }, - "left": { - "type": "UnaryExpression", - "start": 8239, - "end": 8250, + "callee": { + "type": "Identifier", + "start": 7205, + "end": 7215, "loc": { "start": { - "line": 291, + "line": 263, "column": 6 }, "end": { - "line": 291, - "column": 17 - } + "line": 263, + "column": 16 + }, + "identifierName": "isFunction" }, - "operator": "typeof", - "prefix": true, - "argument": { + "name": "isFunction" + }, + "arguments": [ + { "type": "Identifier", - "start": 8246, - "end": 8250, + "start": 7216, + "end": 7224, "loc": { "start": { - "line": 291, - "column": 13 + "line": 263, + "column": 17 }, "end": { - "line": 291, - "column": 17 + "line": 263, + "column": 25 }, - "identifierName": "data" - }, - "name": "data", - "leadingComments": null - }, - "extra": { - "parenthesizedArgument": false - }, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "StringLiteral", - "start": 8255, - "end": 8263, - "loc": { - "start": { - "line": 291, - "column": 22 + "identifierName": "callback" }, - "end": { - "line": 291, - "column": 30 - } - }, - "extra": { - "rawValue": "string", - "raw": "'string'" - }, - "value": "string" - }, - "leadingComments": null + "name": "callback" + } + ] }, "consequent": { "type": "BlockStatement", - "start": 8265, - "end": 8297, + "start": 7227, + "end": 7854, "loc": { "start": { - "line": 291, - "column": 32 + "line": 263, + "column": 28 }, "end": { - "line": 293, + "line": 280, "column": 3 } }, "body": [ { - "type": "ExpressionStatement", - "start": 8270, - "end": 8293, + "type": "ForOfStatement", + "start": 7269, + "end": 7850, "loc": { "start": { - "line": 292, + "line": 265, "column": 3 }, "end": { - "line": 292, - "column": 26 + "line": 279, + "column": 4 } }, - "expression": { - "type": "AssignmentExpression", - "start": 8270, - "end": 8293, + "left": { + "type": "VariableDeclaration", + "start": 7274, + "end": 7284, "loc": { "start": { - "line": 292, - "column": 3 + "line": 265, + "column": 8 }, "end": { - "line": 292, - "column": 26 + "line": 265, + "column": 18 } }, - "operator": "=", - "left": { - "type": "Identifier", - "start": 8270, - "end": 8274, - "loc": { - "start": { - "line": 292, - "column": 3 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 7278, + "end": 7284, + "loc": { + "start": { + "line": 265, + "column": 12 + }, + "end": { + "line": 265, + "column": 18 + } }, - "end": { - "line": 292, - "column": 7 + "id": { + "type": "Identifier", + "start": 7278, + "end": 7284, + "loc": { + "start": { + "line": 265, + "column": 12 + }, + "end": { + "line": 265, + "column": 18 + }, + "identifierName": "entity" + }, + "name": "entity", + "leadingComments": null }, - "identifierName": "data" + "init": null, + "leadingComments": null + } + ], + "kind": "let", + "leadingComments": null + }, + "right": { + "type": "CallExpression", + "start": 7288, + "end": 7305, + "loc": { + "start": { + "line": 265, + "column": 22 }, - "name": "data" + "end": { + "line": 265, + "column": 39 + } }, - "right": { - "type": "CallExpression", - "start": 8277, - "end": 8293, + "callee": { + "type": "MemberExpression", + "start": 7288, + "end": 7303, "loc": { "start": { - "line": 292, - "column": 10 + "line": 265, + "column": 22 }, "end": { - "line": 292, - "column": 26 + "line": 265, + "column": 37 } }, - "callee": { - "type": "MemberExpression", - "start": 8277, - "end": 8287, + "object": { + "type": "Identifier", + "start": 7288, + "end": 7296, "loc": { "start": { - "line": 292, - "column": 10 + "line": 265, + "column": 22 }, "end": { - "line": 292, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 8277, - "end": 8281, - "loc": { - "start": { - "line": 292, - "column": 10 - }, - "end": { - "line": 292, - "column": 14 - }, - "identifierName": "JSON" + "line": 265, + "column": 30 }, - "name": "JSON" + "identifierName": "entities" }, - "property": { - "type": "Identifier", - "start": 8282, - "end": 8287, - "loc": { - "start": { - "line": 292, - "column": 15 - }, - "end": { - "line": 292, - "column": 20 - }, - "identifierName": "parse" + "name": "entities" + }, + "property": { + "type": "Identifier", + "start": 7297, + "end": 7303, + "loc": { + "start": { + "line": 265, + "column": 31 }, - "name": "parse" + "end": { + "line": 265, + "column": 37 + }, + "identifierName": "values" }, - "computed": false + "name": "values" }, - "arguments": [ - { - "type": "Identifier", - "start": 8288, - "end": 8292, - "loc": { - "start": { - "line": 292, - "column": 21 + "computed": false + }, + "arguments": [] + }, + "body": { + "type": "BlockStatement", + "start": 7307, + "end": 7850, + "loc": { + "start": { + "line": 265, + "column": 41 + }, + "end": { + "line": 279, + "column": 4 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 7545, + "end": 7606, + "loc": { + "start": { + "line": 270, + "column": 4 + }, + "end": { + "line": 270, + "column": 65 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 7549, + "end": 7606, + "loc": { + "start": { + "line": 270, + "column": 8 + }, + "end": { + "line": 270, + "column": 65 + } }, - "end": { - "line": 292, - "column": 25 - }, - "identifierName": "data" - }, - "name": "data" - } - ] - } - } - } - ], - "directives": [], - "trailingComments": null - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Convert to an object when given a string", - "start": 8189, - "end": 8232, - "loc": { - "start": { - "line": 290, - "column": 2 - }, - "end": { - "line": 290, - "column": 45 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Data must be an object at this point", - "start": 8301, - "end": 8340, - "loc": { - "start": { - "line": 295, - "column": 2 - }, - "end": { - "line": 295, - "column": 41 - } - } - } - ] - }, - { - "type": "IfStatement", - "start": 8343, - "end": 8771, - "loc": { - "start": { - "line": 296, - "column": 2 - }, - "end": { - "line": 309, - "column": 3 - } - }, - "test": { - "type": "BinaryExpression", - "start": 8347, - "end": 8371, - "loc": { - "start": { - "line": 296, - "column": 6 - }, - "end": { - "line": 296, - "column": 30 - } - }, - "left": { - "type": "UnaryExpression", - "start": 8347, - "end": 8358, - "loc": { - "start": { - "line": 296, - "column": 6 - }, - "end": { - "line": 296, - "column": 17 - } - }, - "operator": "typeof", - "prefix": true, - "argument": { - "type": "Identifier", - "start": 8354, - "end": 8358, - "loc": { - "start": { - "line": 296, - "column": 13 - }, - "end": { - "line": 296, - "column": 17 - }, - "identifierName": "data" - }, - "name": "data", - "leadingComments": null - }, - "extra": { - "parenthesizedArgument": false - }, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "StringLiteral", - "start": 8363, - "end": 8371, - "loc": { - "start": { - "line": 296, - "column": 22 - }, - "end": { - "line": 296, - "column": 30 - } - }, - "extra": { - "rawValue": "object", - "raw": "'object'" - }, - "value": "object" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 8373, - "end": 8771, - "loc": { - "start": { - "line": 296, - "column": 32 - }, - "end": { - "line": 309, - "column": 3 - } - }, - "body": [ - { - "type": "ForInStatement", - "start": 8416, - "end": 8767, - "loc": { - "start": { - "line": 298, - "column": 3 - }, - "end": { - "line": 308, - "column": 4 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 8421, - "end": 8434, - "loc": { - "start": { - "line": 298, - "column": 8 - }, - "end": { - "line": 298, - "column": 21 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 8425, - "end": 8434, - "loc": { - "start": { - "line": 298, - "column": 12 - }, - "end": { - "line": 298, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 8425, - "end": 8434, - "loc": { - "start": { - "line": 298, - "column": 12 - }, - "end": { - "line": 298, - "column": 21 - }, - "identifierName": "protoName" - }, - "name": "protoName", - "leadingComments": null - }, - "init": null, - "leadingComments": null - } - ], - "kind": "let", - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 8438, - "end": 8442, - "loc": { - "start": { - "line": 298, - "column": 25 - }, - "end": { - "line": 298, - "column": 29 - }, - "identifierName": "data" - }, - "name": "data" - }, - "body": { - "type": "BlockStatement", - "start": 8444, - "end": 8767, - "loc": { - "start": { - "line": 298, - "column": 31 - }, - "end": { - "line": 308, - "column": 4 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 8450, - "end": 8483, - "loc": { - "start": { - "line": 299, - "column": 4 - }, - "end": { - "line": 299, - "column": 37 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 8454, - "end": 8483, - "loc": { - "start": { - "line": 299, - "column": 8 - }, - "end": { - "line": 299, - "column": 37 - } - }, - "id": { - "type": "Identifier", - "start": 8454, - "end": 8465, - "loc": { - "start": { - "line": 299, - "column": 8 - }, - "end": { - "line": 299, - "column": 19 - }, - "identifierName": "inputObject" - }, - "name": "inputObject" + "id": { + "type": "Identifier", + "start": 7549, + "end": 7559, + "loc": { + "start": { + "line": 270, + "column": 8 + }, + "end": { + "line": 270, + "column": 18 + }, + "identifierName": "components" + }, + "name": "components", + "leadingComments": null }, "init": { - "type": "MemberExpression", - "start": 8468, - "end": 8483, + "type": "CallExpression", + "start": 7562, + "end": 7606, "loc": { "start": { - "line": 299, - "column": 22 + "line": 270, + "column": 21 }, "end": { - "line": 299, - "column": 37 + "line": 270, + "column": 65 } }, - "object": { - "type": "Identifier", - "start": 8468, - "end": 8472, + "callee": { + "type": "MemberExpression", + "start": 7562, + "end": 7580, "loc": { "start": { - "line": 299, - "column": 22 + "line": 270, + "column": 21 }, "end": { - "line": 299, - "column": 26 - }, - "identifierName": "data" + "line": 270, + "column": 39 + } }, - "name": "data" - }, - "property": { - "type": "Identifier", - "start": 8473, - "end": 8482, - "loc": { - "start": { - "line": 299, - "column": 27 + "object": { + "type": "Identifier", + "start": 7562, + "end": 7576, + "loc": { + "start": { + "line": 270, + "column": 21 + }, + "end": { + "line": 270, + "column": 35 + }, + "identifierName": "componentNames" }, - "end": { - "line": 299, - "column": 36 + "name": "componentNames" + }, + "property": { + "type": "Identifier", + "start": 7577, + "end": 7580, + "loc": { + "start": { + "line": 270, + "column": 36 + }, + "end": { + "line": 270, + "column": 39 + }, + "identifierName": "map" }, - "identifierName": "protoName" + "name": "map" }, - "name": "protoName" + "computed": false }, - "computed": true + "arguments": [ + { + "type": "ArrowFunctionExpression", + "start": 7581, + "end": 7605, + "loc": { + "start": { + "line": 270, + "column": 40 + }, + "end": { + "line": 270, + "column": 64 + } + }, + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 7581, + "end": 7585, + "loc": { + "start": { + "line": 270, + "column": 40 + }, + "end": { + "line": 270, + "column": 44 + }, + "identifierName": "name" + }, + "name": "name" + } + ], + "body": { + "type": "CallExpression", + "start": 7589, + "end": 7605, + "loc": { + "start": { + "line": 270, + "column": 48 + }, + "end": { + "line": 270, + "column": 64 + } + }, + "callee": { + "type": "MemberExpression", + "start": 7589, + "end": 7599, + "loc": { + "start": { + "line": 270, + "column": 48 + }, + "end": { + "line": 270, + "column": 58 + } + }, + "object": { + "type": "Identifier", + "start": 7589, + "end": 7595, + "loc": { + "start": { + "line": 270, + "column": 48 + }, + "end": { + "line": 270, + "column": 54 + }, + "identifierName": "entity" + }, + "name": "entity" + }, + "property": { + "type": "Identifier", + "start": 7596, + "end": 7599, + "loc": { + "start": { + "line": 270, + "column": 55 + }, + "end": { + "line": 270, + "column": 58 + }, + "identifierName": "get" + }, + "name": "get" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 7600, + "end": 7604, + "loc": { + "start": { + "line": 270, + "column": 59 + }, + "end": { + "line": 270, + "column": 63 + }, + "identifierName": "name" + }, + "name": "name" + } + ] + } + } + ], + "trailingComments": null + }, + "leadingComments": null, + "trailingComments": null + } + ], + "kind": "let", + "leadingComments": [ + { + "type": "CommentLine", + "value": " At this point, we can safely assume that all components exist, even if entities/components", + "start": 7313, + "end": 7406, + "loc": { + "start": { + "line": 266, + "column": 4 + }, + "end": { + "line": 266, + "column": 97 + } + } + }, + { + "type": "CommentLine", + "value": " are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.", + "start": 7411, + "end": 7501, + "loc": { + "start": { + "line": 267, + "column": 4 + }, + "end": { + "line": 267, + "column": 94 + } + } + }, + { + "type": "CommentLine", + "value": " Get all components as an array", + "start": 7507, + "end": 7540, + "loc": { + "start": { + "line": 269, + "column": 4 + }, + "end": { + "line": 269, + "column": 37 + } } } ], - "kind": "let" + "trailingComments": [ + { + "type": "CommentLine", + "value": " Pass components, then the main entity, then any additional arguments", + "start": 7612, + "end": 7683, + "loc": { + "start": { + "line": 272, + "column": 4 + }, + "end": { + "line": 272, + "column": 75 + } + } + } + ] }, { "type": "VariableDeclaration", - "start": 8488, - "end": 8508, + "start": 7688, + "end": 7741, "loc": { "start": { - "line": 300, + "line": 273, "column": 4 }, "end": { - "line": 300, - "column": 24 + "line": 273, + "column": 57 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 8492, - "end": 8508, + "start": 7692, + "end": 7741, "loc": { "start": { - "line": 300, + "line": 273, "column": 8 }, "end": { - "line": 300, - "column": 24 + "line": 273, + "column": 57 } }, "id": { "type": "Identifier", - "start": 8492, - "end": 8503, + "start": 7692, + "end": 7698, "loc": { "start": { - "line": 300, + "line": 273, "column": 8 }, "end": { - "line": 300, - "column": 19 + "line": 273, + "column": 14 }, - "identifierName": "protoObject" + "identifierName": "status" }, - "name": "protoObject" + "name": "status", + "leadingComments": null }, "init": { - "type": "ObjectExpression", - "start": 8506, - "end": 8508, + "type": "CallExpression", + "start": 7701, + "end": 7741, "loc": { "start": { - "line": 300, - "column": 22 + "line": 273, + "column": 17 }, "end": { - "line": 300, - "column": 24 + "line": 273, + "column": 57 } }, - "properties": [], - "leadingComments": null, + "callee": { + "type": "Identifier", + "start": 7701, + "end": 7709, + "loc": { + "start": { + "line": 273, + "column": 17 + }, + "end": { + "line": 273, + "column": 25 + }, + "identifierName": "callback" + }, + "name": "callback" + }, + "arguments": [ + { + "type": "SpreadElement", + "start": 7710, + "end": 7723, + "loc": { + "start": { + "line": 273, + "column": 26 + }, + "end": { + "line": 273, + "column": 39 + } + }, + "argument": { + "type": "Identifier", + "start": 7713, + "end": 7723, + "loc": { + "start": { + "line": 273, + "column": 29 + }, + "end": { + "line": 273, + "column": 39 + }, + "identifierName": "components" + }, + "name": "components" + } + }, + { + "type": "Identifier", + "start": 7725, + "end": 7731, + "loc": { + "start": { + "line": 273, + "column": 41 + }, + "end": { + "line": 273, + "column": 47 + }, + "identifierName": "entity" + }, + "name": "entity" + }, + { + "type": "SpreadElement", + "start": 7733, + "end": 7740, + "loc": { + "start": { + "line": 273, + "column": 49 + }, + "end": { + "line": 273, + "column": 56 + } + }, + "argument": { + "type": "Identifier", + "start": 7736, + "end": 7740, + "loc": { + "start": { + "line": 273, + "column": 52 + }, + "end": { + "line": 273, + "column": 56 + }, + "identifierName": "args" + }, + "name": "args" + } + } + ], "trailingComments": null }, + "leadingComments": null, "trailingComments": null } ], "kind": "let", - "trailingComments": [ + "leadingComments": [ { "type": "CommentLine", - "value": " Iterate through component names", - "start": 8513, - "end": 8547, + "value": " Pass components, then the main entity, then any additional arguments", + "start": 7612, + "end": 7683, "loc": { "start": { - "line": 301, + "line": 272, "column": 4 }, "end": { - "line": 301, - "column": 38 + "line": 272, + "column": 75 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Stop the iteration when the callback returns false", + "start": 7747, + "end": 7800, + "loc": { + "start": { + "line": 275, + "column": 4 + }, + "end": { + "line": 275, + "column": 57 } } } ] }, { - "type": "ForInStatement", - "start": 8552, - "end": 8700, + "type": "IfStatement", + "start": 7805, + "end": 7845, "loc": { "start": { - "line": 302, + "line": 276, "column": 4 }, "end": { - "line": 305, + "line": 278, "column": 5 } }, - "left": { - "type": "VariableDeclaration", - "start": 8557, - "end": 8569, + "test": { + "type": "BinaryExpression", + "start": 7809, + "end": 7825, "loc": { "start": { - "line": 302, - "column": 9 + "line": 276, + "column": 8 }, "end": { - "line": 302, - "column": 21 + "line": 276, + "column": 24 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 8561, - "end": 8569, - "loc": { - "start": { - "line": 302, - "column": 13 - }, - "end": { - "line": 302, - "column": 21 - } + "left": { + "type": "Identifier", + "start": 7809, + "end": 7815, + "loc": { + "start": { + "line": 276, + "column": 8 }, - "id": { - "type": "Identifier", - "start": 8561, - "end": 8569, - "loc": { - "start": { - "line": 302, - "column": 13 - }, - "end": { - "line": 302, - "column": 21 - }, - "identifierName": "compName" - }, - "name": "compName", - "leadingComments": null + "end": { + "line": 276, + "column": 14 }, - "init": null, - "leadingComments": null - } - ], - "kind": "let", - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 8573, - "end": 8584, - "loc": { - "start": { - "line": 302, - "column": 25 + "identifierName": "status" }, - "end": { - "line": 302, - "column": 36 + "name": "status", + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "BooleanLiteral", + "start": 7820, + "end": 7825, + "loc": { + "start": { + "line": 276, + "column": 19 + }, + "end": { + "line": 276, + "column": 24 + } }, - "identifierName": "inputObject" + "value": false }, - "name": "inputObject" + "leadingComments": null }, - "body": { + "consequent": { "type": "BlockStatement", - "start": 8586, - "end": 8700, + "start": 7827, + "end": 7845, "loc": { "start": { - "line": 302, - "column": 38 + "line": 276, + "column": 26 }, "end": { - "line": 305, + "line": 278, "column": 5 } }, "body": [ { - "type": "ExpressionStatement", - "start": 8633, - "end": 8694, + "type": "BreakStatement", + "start": 7834, + "end": 7839, "loc": { "start": { - "line": 304, + "line": 277, "column": 5 }, "end": { - "line": 304, - "column": 66 + "line": 277, + "column": 10 } }, - "expression": { - "type": "AssignmentExpression", - "start": 8633, - "end": 8694, - "loc": { - "start": { - "line": 304, - "column": 5 - }, - "end": { - "line": 304, - "column": 66 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 8633, - "end": 8654, - "loc": { - "start": { - "line": 304, - "column": 5 - }, - "end": { - "line": 304, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 8633, - "end": 8644, - "loc": { - "start": { - "line": 304, - "column": 5 - }, - "end": { - "line": 304, - "column": 16 - }, - "identifierName": "protoObject" - }, - "name": "protoObject", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 8645, - "end": 8653, - "loc": { - "start": { - "line": 304, - "column": 17 - }, - "end": { - "line": 304, - "column": 25 - }, - "identifierName": "compName" - }, - "name": "compName" - }, - "computed": true, - "leadingComments": null - }, - "right": { - "type": "CallExpression", - "start": 8657, - "end": 8694, - "loc": { - "start": { - "line": 304, - "column": 29 - }, - "end": { - "line": 304, - "column": 66 - } - }, - "callee": { - "type": "MemberExpression", - "start": 8657, - "end": 8671, - "loc": { - "start": { - "line": 304, - "column": 29 - }, - "end": { - "line": 304, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 8657, - "end": 8661, - "loc": { - "start": { - "line": 304, - "column": 29 - }, - "end": { - "line": 304, - "column": 33 - }, - "identifierName": "JSON" - }, - "name": "JSON" - }, - "property": { - "type": "Identifier", - "start": 8662, - "end": 8671, - "loc": { - "start": { - "line": 304, - "column": 34 - }, - "end": { - "line": 304, - "column": 43 - }, - "identifierName": "stringify" - }, - "name": "stringify" - }, - "computed": false - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 8672, - "end": 8693, - "loc": { - "start": { - "line": 304, - "column": 44 - }, - "end": { - "line": 304, - "column": 65 - } - }, - "object": { - "type": "Identifier", - "start": 8672, - "end": 8683, - "loc": { - "start": { - "line": 304, - "column": 44 - }, - "end": { - "line": 304, - "column": 55 - }, - "identifierName": "inputObject" - }, - "name": "inputObject" - }, - "property": { - "type": "Identifier", - "start": 8684, - "end": 8692, - "loc": { - "start": { - "line": 304, - "column": 56 - }, - "end": { - "line": 304, - "column": 64 - }, - "identifierName": "compName" - }, - "name": "compName" - }, - "computed": true - } - ] - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Store strings of each component", - "start": 8593, - "end": 8627, - "loc": { - "start": { - "line": 303, - "column": 5 - }, - "end": { - "line": 303, - "column": 39 - } - } - } - ] + "label": null } ], "directives": [] }, + "alternate": null, "leadingComments": [ { "type": "CommentLine", - "value": " Iterate through component names", - "start": 8513, - "end": 8547, + "value": " Stop the iteration when the callback returns false", + "start": 7747, + "end": 7800, "loc": { "start": { - "line": 301, + "line": 275, "column": 4 }, "end": { - "line": 301, - "column": 38 + "line": 275, + "column": 57 } } } ] - }, - { - "type": "ExpressionStatement", - "start": 8705, - "end": 8750, - "loc": { - "start": { - "line": 306, - "column": 4 - }, - "end": { - "line": 306, - "column": 49 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 8705, - "end": 8750, - "loc": { - "start": { - "line": 306, - "column": 4 - }, - "end": { - "line": 306, - "column": 49 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 8705, - "end": 8736, - "loc": { - "start": { - "line": 306, - "column": 4 - }, - "end": { - "line": 306, - "column": 35 - } - }, - "object": { - "type": "MemberExpression", - "start": 8705, - "end": 8725, - "loc": { - "start": { - "line": 306, - "column": 4 - }, - "end": { - "line": 306, - "column": 24 - } - }, - "object": { - "type": "ThisExpression", - "start": 8705, - "end": 8709, - "loc": { - "start": { - "line": 306, - "column": 4 - }, - "end": { - "line": 306, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "start": 8710, - "end": 8725, - "loc": { - "start": { - "line": 306, - "column": 9 - }, - "end": { - "line": 306, - "column": 24 - }, - "identifierName": "entityTemplates" - }, - "name": "entityTemplates" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 8726, - "end": 8735, - "loc": { - "start": { - "line": 306, - "column": 25 - }, - "end": { - "line": 306, - "column": 34 - }, - "identifierName": "protoName" - }, - "name": "protoName" - }, - "computed": true - }, - "right": { - "type": "Identifier", - "start": 8739, - "end": 8750, - "loc": { - "start": { - "line": 306, - "column": 38 - }, - "end": { - "line": 306, - "column": 49 - }, - "identifierName": "protoObject" - }, - "name": "protoObject" - } - } - }, - { - "type": "ExpressionStatement", - "start": 8755, - "end": 8762, - "loc": { - "start": { - "line": 307, - "column": 4 - }, - "end": { - "line": 307, - "column": 11 - } - }, - "expression": { - "type": "UpdateExpression", - "start": 8755, - "end": 8762, - "loc": { - "start": { - "line": 307, - "column": 4 - }, - "end": { - "line": 307, - "column": 11 - } - }, - "operator": "++", - "prefix": true, - "argument": { - "type": "Identifier", - "start": 8757, - "end": 8762, - "loc": { - "start": { - "line": 307, - "column": 6 - }, - "end": { - "line": 307, - "column": 11 - }, - "identifierName": "count" - }, - "name": "count" - }, - "extra": { - "parenthesizedArgument": false - } - } } ], "directives": [] @@ -9348,17 +8483,17 @@ "leadingComments": [ { "type": "CommentLine", - "value": " Iterate through prototype names", - "start": 8378, - "end": 8412, + "value": " Go through the map of entities", + "start": 7232, + "end": 7265, "loc": { "start": { - "line": 297, + "line": 264, "column": 3 }, "end": { - "line": 297, - "column": 37 + "line": 264, + "column": 36 } } } @@ -9367,232 +8502,3222 @@ ], "directives": [] }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Data must be an object at this point", - "start": 8301, - "end": 8340, - "loc": { - "start": { - "line": 295, - "column": 2 - }, - "end": { - "line": 295, - "column": 41 - } - } - } - ] + "alternate": null }, { "type": "ReturnStatement", - "start": 8775, - "end": 8787, + "start": 7858, + "end": 7882, "loc": { "start": { - "line": 311, + "line": 282, "column": 2 }, "end": { - "line": 311, - "column": 14 + "line": 282, + "column": 26 } }, "argument": { - "type": "Identifier", - "start": 8782, - "end": 8787, + "type": "CallExpression", + "start": 7865, + "end": 7882, "loc": { "start": { - "line": 311, + "line": 282, "column": 9 }, "end": { - "line": 311, - "column": 14 + "line": 282, + "column": 26 + } + }, + "callee": { + "type": "MemberExpression", + "start": 7865, + "end": 7880, + "loc": { + "start": { + "line": 282, + "column": 9 + }, + "end": { + "line": 282, + "column": 24 + } }, - "identifierName": "count" + "object": { + "type": "Identifier", + "start": 7865, + "end": 7873, + "loc": { + "start": { + "line": 282, + "column": 9 + }, + "end": { + "line": 282, + "column": 17 + }, + "identifierName": "entities" + }, + "name": "entities" + }, + "property": { + "type": "Identifier", + "start": 7874, + "end": 7880, + "loc": { + "start": { + "line": 282, + "column": 18 + }, + "end": { + "line": 282, + "column": 24 + }, + "identifierName": "values" + }, + "name": "values" + }, + "computed": false }, - "name": "count" + "arguments": [] } } ], - "directives": [] + "directives": [], + "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", - "start": 7670, - "end": 8150, + "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", + "start": 6279, + "end": 7070, + "loc": { + "start": { + "line": 240, + "column": 1 + }, + "end": { + "line": 258, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", + "start": 7888, + "end": 8294, "loc": { "start": { - "line": 271, + "line": 285, "column": 1 }, "end": { - "line": 286, + "line": 295, "column": 4 } } } ] - } - ] + }, + { + "type": "ClassMethod", + "start": 8296, + "end": 8364, + "loc": { + "start": { + "line": 296, + "column": 1 + }, + "end": { + "line": 298, + "column": 2 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 8296, + "end": 8299, + "loc": { + "start": { + "line": 296, + "column": 1 + }, + "end": { + "line": 296, + "column": 4 + }, + "identifierName": "get" + }, + "name": "get", + "leadingComments": null + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 8300, + "end": 8317, + "loc": { + "start": { + "line": 296, + "column": 5 + }, + "end": { + "line": 296, + "column": 22 + } + }, + "argument": { + "type": "Identifier", + "start": 8303, + "end": 8317, + "loc": { + "start": { + "line": 296, + "column": 8 + }, + "end": { + "line": 296, + "column": 22 + }, + "identifierName": "componentNames" + }, + "name": "componentNames" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 8319, + "end": 8364, + "loc": { + "start": { + "line": 296, + "column": 24 + }, + "end": { + "line": 298, + "column": 2 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 8323, + "end": 8361, + "loc": { + "start": { + "line": 297, + "column": 2 + }, + "end": { + "line": 297, + "column": 40 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 8330, + "end": 8361, + "loc": { + "start": { + "line": 297, + "column": 9 + }, + "end": { + "line": 297, + "column": 40 + } + }, + "elements": [ + { + "type": "SpreadElement", + "start": 8331, + "end": 8360, + "loc": { + "start": { + "line": 297, + "column": 10 + }, + "end": { + "line": 297, + "column": 39 + } + }, + "argument": { + "type": "CallExpression", + "start": 8334, + "end": 8360, + "loc": { + "start": { + "line": 297, + "column": 13 + }, + "end": { + "line": 297, + "column": 39 + } + }, + "callee": { + "type": "MemberExpression", + "start": 8334, + "end": 8344, + "loc": { + "start": { + "line": 297, + "column": 13 + }, + "end": { + "line": 297, + "column": 23 + } + }, + "object": { + "type": "ThisExpression", + "start": 8334, + "end": 8338, + "loc": { + "start": { + "line": 297, + "column": 13 + }, + "end": { + "line": 297, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "start": 8339, + "end": 8344, + "loc": { + "start": { + "line": 297, + "column": 18 + }, + "end": { + "line": 297, + "column": 23 + }, + "identifierName": "every" + }, + "name": "every" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 8345, + "end": 8359, + "loc": { + "start": { + "line": 297, + "column": 24 + }, + "end": { + "line": 297, + "column": 38 + }, + "identifierName": "componentNames" + }, + "name": "componentNames" + } + ] + } + } + ] + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", + "start": 7888, + "end": 8294, + "loc": { + "start": { + "line": 285, + "column": 1 + }, + "end": { + "line": 295, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", + "start": 8367, + "end": 8847, + "loc": { + "start": { + "line": 300, + "column": 1 + }, + "end": { + "line": 315, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 8849, + "end": 9487, + "loc": { + "start": { + "line": 316, + "column": 1 + }, + "end": { + "line": 341, + "column": 2 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 8849, + "end": 8858, + "loc": { + "start": { + "line": 316, + "column": 1 + }, + "end": { + "line": 316, + "column": 10 + }, + "identifierName": "prototype" + }, + "name": "prototype", + "leadingComments": null + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 8859, + "end": 8863, + "loc": { + "start": { + "line": 316, + "column": 11 + }, + "end": { + "line": 316, + "column": 15 + }, + "identifierName": "data" + }, + "name": "data" + } + ], + "body": { + "type": "BlockStatement", + "start": 8865, + "end": 9487, + "loc": { + "start": { + "line": 316, + "column": 17 + }, + "end": { + "line": 341, + "column": 2 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 8869, + "end": 8882, + "loc": { + "start": { + "line": 317, + "column": 2 + }, + "end": { + "line": 317, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8873, + "end": 8882, + "loc": { + "start": { + "line": 317, + "column": 6 + }, + "end": { + "line": 317, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 8873, + "end": 8878, + "loc": { + "start": { + "line": 317, + "column": 6 + }, + "end": { + "line": 317, + "column": 11 + }, + "identifierName": "count" + }, + "name": "count" + }, + "init": { + "type": "NumericLiteral", + "start": 8881, + "end": 8882, + "loc": { + "start": { + "line": 317, + "column": 14 + }, + "end": { + "line": 317, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0, + "leadingComments": null, + "trailingComments": null + }, + "trailingComments": null + } + ], + "kind": "let", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Convert to an object when given a string", + "start": 8886, + "end": 8929, + "loc": { + "start": { + "line": 319, + "column": 2 + }, + "end": { + "line": 319, + "column": 45 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 8932, + "end": 8994, + "loc": { + "start": { + "line": 320, + "column": 2 + }, + "end": { + "line": 322, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 8936, + "end": 8960, + "loc": { + "start": { + "line": 320, + "column": 6 + }, + "end": { + "line": 320, + "column": 30 + } + }, + "left": { + "type": "UnaryExpression", + "start": 8936, + "end": 8947, + "loc": { + "start": { + "line": 320, + "column": 6 + }, + "end": { + "line": 320, + "column": 17 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 8943, + "end": 8947, + "loc": { + "start": { + "line": 320, + "column": 13 + }, + "end": { + "line": 320, + "column": 17 + }, + "identifierName": "data" + }, + "name": "data", + "leadingComments": null + }, + "extra": { + "parenthesizedArgument": false + }, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start": 8952, + "end": 8960, + "loc": { + "start": { + "line": 320, + "column": 22 + }, + "end": { + "line": 320, + "column": 30 + } + }, + "extra": { + "rawValue": "string", + "raw": "'string'" + }, + "value": "string" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 8962, + "end": 8994, + "loc": { + "start": { + "line": 320, + "column": 32 + }, + "end": { + "line": 322, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 8967, + "end": 8990, + "loc": { + "start": { + "line": 321, + "column": 3 + }, + "end": { + "line": 321, + "column": 26 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 8967, + "end": 8990, + "loc": { + "start": { + "line": 321, + "column": 3 + }, + "end": { + "line": 321, + "column": 26 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 8967, + "end": 8971, + "loc": { + "start": { + "line": 321, + "column": 3 + }, + "end": { + "line": 321, + "column": 7 + }, + "identifierName": "data" + }, + "name": "data" + }, + "right": { + "type": "CallExpression", + "start": 8974, + "end": 8990, + "loc": { + "start": { + "line": 321, + "column": 10 + }, + "end": { + "line": 321, + "column": 26 + } + }, + "callee": { + "type": "MemberExpression", + "start": 8974, + "end": 8984, + "loc": { + "start": { + "line": 321, + "column": 10 + }, + "end": { + "line": 321, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 8974, + "end": 8978, + "loc": { + "start": { + "line": 321, + "column": 10 + }, + "end": { + "line": 321, + "column": 14 + }, + "identifierName": "JSON" + }, + "name": "JSON" + }, + "property": { + "type": "Identifier", + "start": 8979, + "end": 8984, + "loc": { + "start": { + "line": 321, + "column": 15 + }, + "end": { + "line": 321, + "column": 20 + }, + "identifierName": "parse" + }, + "name": "parse" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 8985, + "end": 8989, + "loc": { + "start": { + "line": 321, + "column": 21 + }, + "end": { + "line": 321, + "column": 25 + }, + "identifierName": "data" + }, + "name": "data" + } + ] + } + } + } + ], + "directives": [], + "trailingComments": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Convert to an object when given a string", + "start": 8886, + "end": 8929, + "loc": { + "start": { + "line": 319, + "column": 2 + }, + "end": { + "line": 319, + "column": 45 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Data must be an object at this point", + "start": 8998, + "end": 9037, + "loc": { + "start": { + "line": 324, + "column": 2 + }, + "end": { + "line": 324, + "column": 41 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 9040, + "end": 9468, + "loc": { + "start": { + "line": 325, + "column": 2 + }, + "end": { + "line": 338, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 9044, + "end": 9068, + "loc": { + "start": { + "line": 325, + "column": 6 + }, + "end": { + "line": 325, + "column": 30 + } + }, + "left": { + "type": "UnaryExpression", + "start": 9044, + "end": 9055, + "loc": { + "start": { + "line": 325, + "column": 6 + }, + "end": { + "line": 325, + "column": 17 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 9051, + "end": 9055, + "loc": { + "start": { + "line": 325, + "column": 13 + }, + "end": { + "line": 325, + "column": 17 + }, + "identifierName": "data" + }, + "name": "data", + "leadingComments": null + }, + "extra": { + "parenthesizedArgument": false + }, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start": 9060, + "end": 9068, + "loc": { + "start": { + "line": 325, + "column": 22 + }, + "end": { + "line": 325, + "column": 30 + } + }, + "extra": { + "rawValue": "object", + "raw": "'object'" + }, + "value": "object" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 9070, + "end": 9468, + "loc": { + "start": { + "line": 325, + "column": 32 + }, + "end": { + "line": 338, + "column": 3 + } + }, + "body": [ + { + "type": "ForInStatement", + "start": 9113, + "end": 9464, + "loc": { + "start": { + "line": 327, + "column": 3 + }, + "end": { + "line": 337, + "column": 4 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 9118, + "end": 9131, + "loc": { + "start": { + "line": 327, + "column": 8 + }, + "end": { + "line": 327, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9122, + "end": 9131, + "loc": { + "start": { + "line": 327, + "column": 12 + }, + "end": { + "line": 327, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 9122, + "end": 9131, + "loc": { + "start": { + "line": 327, + "column": 12 + }, + "end": { + "line": 327, + "column": 21 + }, + "identifierName": "protoName" + }, + "name": "protoName", + "leadingComments": null + }, + "init": null, + "leadingComments": null + } + ], + "kind": "let", + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 9135, + "end": 9139, + "loc": { + "start": { + "line": 327, + "column": 25 + }, + "end": { + "line": 327, + "column": 29 + }, + "identifierName": "data" + }, + "name": "data" + }, + "body": { + "type": "BlockStatement", + "start": 9141, + "end": 9464, + "loc": { + "start": { + "line": 327, + "column": 31 + }, + "end": { + "line": 337, + "column": 4 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 9147, + "end": 9180, + "loc": { + "start": { + "line": 328, + "column": 4 + }, + "end": { + "line": 328, + "column": 37 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9151, + "end": 9180, + "loc": { + "start": { + "line": 328, + "column": 8 + }, + "end": { + "line": 328, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9151, + "end": 9162, + "loc": { + "start": { + "line": 328, + "column": 8 + }, + "end": { + "line": 328, + "column": 19 + }, + "identifierName": "inputObject" + }, + "name": "inputObject" + }, + "init": { + "type": "MemberExpression", + "start": 9165, + "end": 9180, + "loc": { + "start": { + "line": 328, + "column": 22 + }, + "end": { + "line": 328, + "column": 37 + } + }, + "object": { + "type": "Identifier", + "start": 9165, + "end": 9169, + "loc": { + "start": { + "line": 328, + "column": 22 + }, + "end": { + "line": 328, + "column": 26 + }, + "identifierName": "data" + }, + "name": "data" + }, + "property": { + "type": "Identifier", + "start": 9170, + "end": 9179, + "loc": { + "start": { + "line": 328, + "column": 27 + }, + "end": { + "line": 328, + "column": 36 + }, + "identifierName": "protoName" + }, + "name": "protoName" + }, + "computed": true + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 9185, + "end": 9205, + "loc": { + "start": { + "line": 329, + "column": 4 + }, + "end": { + "line": 329, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9189, + "end": 9205, + "loc": { + "start": { + "line": 329, + "column": 8 + }, + "end": { + "line": 329, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 9189, + "end": 9200, + "loc": { + "start": { + "line": 329, + "column": 8 + }, + "end": { + "line": 329, + "column": 19 + }, + "identifierName": "protoObject" + }, + "name": "protoObject" + }, + "init": { + "type": "ObjectExpression", + "start": 9203, + "end": 9205, + "loc": { + "start": { + "line": 329, + "column": 22 + }, + "end": { + "line": 329, + "column": 24 + } + }, + "properties": [], + "leadingComments": null, + "trailingComments": null + }, + "trailingComments": null + } + ], + "kind": "let", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Iterate through component names", + "start": 9210, + "end": 9244, + "loc": { + "start": { + "line": 330, + "column": 4 + }, + "end": { + "line": 330, + "column": 38 + } + } + } + ] + }, + { + "type": "ForInStatement", + "start": 9249, + "end": 9397, + "loc": { + "start": { + "line": 331, + "column": 4 + }, + "end": { + "line": 334, + "column": 5 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 9254, + "end": 9266, + "loc": { + "start": { + "line": 331, + "column": 9 + }, + "end": { + "line": 331, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9258, + "end": 9266, + "loc": { + "start": { + "line": 331, + "column": 13 + }, + "end": { + "line": 331, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 9258, + "end": 9266, + "loc": { + "start": { + "line": 331, + "column": 13 + }, + "end": { + "line": 331, + "column": 21 + }, + "identifierName": "compName" + }, + "name": "compName", + "leadingComments": null + }, + "init": null, + "leadingComments": null + } + ], + "kind": "let", + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 9270, + "end": 9281, + "loc": { + "start": { + "line": 331, + "column": 25 + }, + "end": { + "line": 331, + "column": 36 + }, + "identifierName": "inputObject" + }, + "name": "inputObject" + }, + "body": { + "type": "BlockStatement", + "start": 9283, + "end": 9397, + "loc": { + "start": { + "line": 331, + "column": 38 + }, + "end": { + "line": 334, + "column": 5 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 9330, + "end": 9391, + "loc": { + "start": { + "line": 333, + "column": 5 + }, + "end": { + "line": 333, + "column": 66 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 9330, + "end": 9391, + "loc": { + "start": { + "line": 333, + "column": 5 + }, + "end": { + "line": 333, + "column": 66 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 9330, + "end": 9351, + "loc": { + "start": { + "line": 333, + "column": 5 + }, + "end": { + "line": 333, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 9330, + "end": 9341, + "loc": { + "start": { + "line": 333, + "column": 5 + }, + "end": { + "line": 333, + "column": 16 + }, + "identifierName": "protoObject" + }, + "name": "protoObject", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 9342, + "end": 9350, + "loc": { + "start": { + "line": 333, + "column": 17 + }, + "end": { + "line": 333, + "column": 25 + }, + "identifierName": "compName" + }, + "name": "compName" + }, + "computed": true, + "leadingComments": null + }, + "right": { + "type": "CallExpression", + "start": 9354, + "end": 9391, + "loc": { + "start": { + "line": 333, + "column": 29 + }, + "end": { + "line": 333, + "column": 66 + } + }, + "callee": { + "type": "MemberExpression", + "start": 9354, + "end": 9368, + "loc": { + "start": { + "line": 333, + "column": 29 + }, + "end": { + "line": 333, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 9354, + "end": 9358, + "loc": { + "start": { + "line": 333, + "column": 29 + }, + "end": { + "line": 333, + "column": 33 + }, + "identifierName": "JSON" + }, + "name": "JSON" + }, + "property": { + "type": "Identifier", + "start": 9359, + "end": 9368, + "loc": { + "start": { + "line": 333, + "column": 34 + }, + "end": { + "line": 333, + "column": 43 + }, + "identifierName": "stringify" + }, + "name": "stringify" + }, + "computed": false + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 9369, + "end": 9390, + "loc": { + "start": { + "line": 333, + "column": 44 + }, + "end": { + "line": 333, + "column": 65 + } + }, + "object": { + "type": "Identifier", + "start": 9369, + "end": 9380, + "loc": { + "start": { + "line": 333, + "column": 44 + }, + "end": { + "line": 333, + "column": 55 + }, + "identifierName": "inputObject" + }, + "name": "inputObject" + }, + "property": { + "type": "Identifier", + "start": 9381, + "end": 9389, + "loc": { + "start": { + "line": 333, + "column": 56 + }, + "end": { + "line": 333, + "column": 64 + }, + "identifierName": "compName" + }, + "name": "compName" + }, + "computed": true + } + ] + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Store strings of each component", + "start": 9290, + "end": 9324, + "loc": { + "start": { + "line": 332, + "column": 5 + }, + "end": { + "line": 332, + "column": 39 + } + } + } + ] + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Iterate through component names", + "start": 9210, + "end": 9244, + "loc": { + "start": { + "line": 330, + "column": 4 + }, + "end": { + "line": 330, + "column": 38 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 9402, + "end": 9447, + "loc": { + "start": { + "line": 335, + "column": 4 + }, + "end": { + "line": 335, + "column": 49 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 9402, + "end": 9447, + "loc": { + "start": { + "line": 335, + "column": 4 + }, + "end": { + "line": 335, + "column": 49 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 9402, + "end": 9433, + "loc": { + "start": { + "line": 335, + "column": 4 + }, + "end": { + "line": 335, + "column": 35 + } + }, + "object": { + "type": "MemberExpression", + "start": 9402, + "end": 9422, + "loc": { + "start": { + "line": 335, + "column": 4 + }, + "end": { + "line": 335, + "column": 24 + } + }, + "object": { + "type": "ThisExpression", + "start": 9402, + "end": 9406, + "loc": { + "start": { + "line": 335, + "column": 4 + }, + "end": { + "line": 335, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 9407, + "end": 9422, + "loc": { + "start": { + "line": 335, + "column": 9 + }, + "end": { + "line": 335, + "column": 24 + }, + "identifierName": "entityTemplates" + }, + "name": "entityTemplates" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 9423, + "end": 9432, + "loc": { + "start": { + "line": 335, + "column": 25 + }, + "end": { + "line": 335, + "column": 34 + }, + "identifierName": "protoName" + }, + "name": "protoName" + }, + "computed": true + }, + "right": { + "type": "Identifier", + "start": 9436, + "end": 9447, + "loc": { + "start": { + "line": 335, + "column": 38 + }, + "end": { + "line": 335, + "column": 49 + }, + "identifierName": "protoObject" + }, + "name": "protoObject" + } + } + }, + { + "type": "ExpressionStatement", + "start": 9452, + "end": 9459, + "loc": { + "start": { + "line": 336, + "column": 4 + }, + "end": { + "line": 336, + "column": 11 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 9452, + "end": 9459, + "loc": { + "start": { + "line": 336, + "column": 4 + }, + "end": { + "line": 336, + "column": 11 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 9454, + "end": 9459, + "loc": { + "start": { + "line": 336, + "column": 6 + }, + "end": { + "line": 336, + "column": 11 + }, + "identifierName": "count" + }, + "name": "count" + }, + "extra": { + "parenthesizedArgument": false + } + } + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Iterate through prototype names", + "start": 9075, + "end": 9109, + "loc": { + "start": { + "line": 326, + "column": 3 + }, + "end": { + "line": 326, + "column": 37 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Data must be an object at this point", + "start": 8998, + "end": 9037, + "loc": { + "start": { + "line": 324, + "column": 2 + }, + "end": { + "line": 324, + "column": 41 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 9472, + "end": 9484, + "loc": { + "start": { + "line": 340, + "column": 2 + }, + "end": { + "line": 340, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "start": 9479, + "end": 9484, + "loc": { + "start": { + "line": 340, + "column": 9 + }, + "end": { + "line": 340, + "column": 14 + }, + "identifierName": "count" + }, + "name": "count" + } + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", + "start": 8367, + "end": 8847, + "loc": { + "start": { + "line": 300, + "column": 1 + }, + "end": { + "line": 315, + "column": 4 + } + } + } + ] + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Class for world.\n *\n * @class World (name)\n ", + "start": 206, + "end": 264, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 9491, + "end": 9512, + "loc": { + "start": { + "line": 344, + "column": 0 + }, + "end": { + "line": 344, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 9491, + "end": 9512, + "loc": { + "start": { + "line": 344, + "column": 0 + }, + "end": { + "line": 344, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 9491, + "end": 9504, + "loc": { + "start": { + "line": 344, + "column": 0 + }, + "end": { + "line": 344, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 9491, + "end": 9498, + "loc": { + "start": { + "line": 344, + "column": 0 + }, + "end": { + "line": 344, + "column": 7 + }, + "identifierName": "exports" + }, + "name": "exports" + }, + "property": { + "type": "Identifier", + "start": 9499, + "end": 9504, + "loc": { + "start": { + "line": 344, + "column": 8 + }, + "end": { + "line": 344, + "column": 13 + }, + "identifierName": "World" + }, + "name": "World" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 9507, + "end": 9512, + "loc": { + "start": { + "line": 344, + "column": 16 + }, + "end": { + "line": 344, + "column": 21 + }, + "identifierName": "World" + }, + "name": "World" + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 73, + "end": 87, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 131, + "end": 145, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Class for world.\n *\n * @class World (name)\n ", + "start": 206, + "end": 264, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Constructs an instance of the world.\n\t ", + "start": 280, + "end": 329, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 18, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 349, + "end": 363, + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Maps entity IDs to entities\n\t\t * @ignore\n\t\t ", + "start": 387, + "end": 442, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 26, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 474, + "end": 488, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 16 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 515, + "end": 529, + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 16 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 561, + "end": 575, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 16 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Maps entire queries to arrays of entities\n\t\t * @ignore\n\t\t ", + "start": 600, + "end": 669, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 41, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Removes all entities from the world.\n\t * Does not affect registered systems, components, or prototypes.\n\t *\n\t * @example\n\t * world.clear()\n\t ", + "start": 724, + "end": 875, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 51, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Call onRemove on all components of all entities", + "start": 889, + "end": 939, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 52 + } + } + }, + { + "type": "CommentLine", + "value": " Get component, and call onRemove if it exists as a function", + "start": 1040, + "end": 1102, + "loc": { + "start": { + "line": 56, + "column": 4 + }, + "end": { + "line": 56, + "column": 66 + } + } + }, + { + "type": "CommentLine", + "value": " Clear entities", + "start": 1196, + "end": 1213, + "loc": { + "start": { + "line": 62, + "column": 2 + }, + "end": { + "line": 62, + "column": 19 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Registers a component type to the world. Components must be constructable. They are passed the entity first,\n\t * then the rest of the arguments from methods like entity.set(). Components also can have an onRemove() method.\n\t *\n\t * @param {string} name - The name\n\t * @param {function} componentClass - The component class, must be a constructable class or function\n\t *\n\t * @example\n\t * world.component('myComponent', class {\n\t * constructor(entity, some, args) {\n\t * this.entity = entity\n\t * this.some = some\n\t * this.args = args\n\t * }\n\t * })\n\t * // entity === the new entity object\n\t * // some === 10\n\t * // args === 500\n\t * world.entity().set('myComponent', 10, 500)\n\t *\n\t * @return {string} Registered component name on success, undefined on failure\n\t ", + "start": 1281, + "end": 2090, + "loc": { + "start": { + "line": 67, + "column": 1 + }, + "end": { + "line": 88, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Only allow functions and classes to be components", + "start": 2128, + "end": 2180, + "loc": { + "start": { + "line": 90, + "column": 2 + }, + "end": { + "line": 90, + "column": 54 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Creates a new entity in the world\n\t *\n\t * @param {string} [name] - The prototype name to use\n\t *\n\t * @example\n\t * world.entity()\n\t *\n\t * @example\n\t * world.entity('Player')\n\t *\n\t * @return {Entity} The new entity created\n\t ", + "start": 2283, + "end": 2516, + "loc": { + "start": { + "line": 97, + "column": 1 + }, + "end": { + "line": 109, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Use 'name' to get prototype data (if specified)", + "start": 2612, + "end": 2662, + "loc": { + "start": { + "line": 114, + "column": 2 + }, + "end": { + "line": 114, + "column": 52 + } + } + }, + { + "type": "CommentLine", + "value": " Add all components from prototype", + "start": 2712, + "end": 2748, + "loc": { + "start": { + "line": 116, + "column": 3 + }, + "end": { + "line": 116, + "column": 39 + } + } + }, + { + "type": "CommentLine", + "value": " Update component with data from template", + "start": 2839, + "end": 2882, + "loc": { + "start": { + "line": 119, + "column": 4 + }, + "end": { + "line": 119, + "column": 47 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * constructor(context) {\n\t * // This is showing how you can optionally pass parameters to the system's constructor\n\t * this.context = context\n\t * }\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * }, context)\n\t *\n\t * @example\n\t * // System that doesn't use every()\n\t * world.system(class {\n\t * constructor(context) {\n\t * this.context = context\n\t * }\n\t * pre() {\n\t * // Handle events or something\n\t * }\n\t * }, context)\n\t *\n\t * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).\n\t *\n\t * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t *\n\t * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.\n\t *\n\t * **[...args]**: The arguments to forward to the system's constructors.\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", + "start": 3066, + "end": 4560, + "loc": { + "start": { + "line": 129, + "column": 1 + }, + "end": { + "line": 166, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Get components and systemClass from arguments", + "start": 4582, + "end": 4630, + "loc": { + "start": { + "line": 168, + "column": 2 + }, + "end": { + "line": 168, + "column": 50 + } + } + }, + { + "type": "CommentLine", + "value": " Make sure the system is valid", + "start": 4849, + "end": 4881, + "loc": { + "start": { + "line": 180, + "column": 2 + }, + "end": { + "line": 180, + "column": 34 + } + } + }, + { + "type": "CommentLine", + "value": " Create the system, and set the component array query", + "start": 4918, + "end": 4973, + "loc": { + "start": { + "line": 182, + "column": 3 + }, + "end": { + "line": 182, + "column": 58 + } + } + }, + { + "type": "CommentLine", + "value": " Add the system, return its ID", + "start": 5059, + "end": 5091, + "loc": { + "start": { + "line": 186, + "column": 3 + }, + "end": { + "line": 186, + "column": 35 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", + "start": 5163, + "end": 5360, + "loc": { + "start": { + "line": 192, + "column": 1 + }, + "end": { + "line": 199, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system(systemA)\n\t * world.system(systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", + "start": 5471, + "end": 5992, + "loc": { + "start": { + "line": 206, + "column": 1 + }, + "end": { + "line": 226, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Run the \"every\" method in the system", + "start": 6084, + "end": 6123, + "loc": { + "start": { + "line": 231, + "column": 3 + }, + "end": { + "line": 231, + "column": 42 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", + "start": 6279, + "end": 7070, + "loc": { + "start": { + "line": 240, + "column": 1 + }, + "end": { + "line": 258, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Get indexed map of entities", + "start": 7117, + "end": 7147, + "loc": { + "start": { + "line": 260, + "column": 2 + }, + "end": { + "line": 260, + "column": 32 + } + } + }, + { + "type": "CommentLine", + "value": " Go through the map of entities", + "start": 7232, + "end": 7265, + "loc": { + "start": { + "line": 264, + "column": 3 + }, + "end": { + "line": 264, + "column": 36 + } + } + }, + { + "type": "CommentLine", + "value": " At this point, we can safely assume that all components exist, even if entities/components", + "start": 7313, + "end": 7406, + "loc": { + "start": { + "line": 266, + "column": 4 + }, + "end": { + "line": 266, + "column": 97 + } + } + }, + { + "type": "CommentLine", + "value": " are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.", + "start": 7411, + "end": 7501, + "loc": { + "start": { + "line": 267, + "column": 4 + }, + "end": { + "line": 267, + "column": 94 + } + } + }, + { + "type": "CommentLine", + "value": " Get all components as an array", + "start": 7507, + "end": 7540, + "loc": { + "start": { + "line": 269, + "column": 4 + }, + "end": { + "line": 269, + "column": 37 + } + } + }, + { + "type": "CommentLine", + "value": " Pass components, then the main entity, then any additional arguments", + "start": 7612, + "end": 7683, + "loc": { + "start": { + "line": 272, + "column": 4 + }, + "end": { + "line": 272, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " Stop the iteration when the callback returns false", + "start": 7747, + "end": 7800, + "loc": { + "start": { + "line": 275, + "column": 4 + }, + "end": { + "line": 275, + "column": 57 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", + "start": 7888, + "end": 8294, + "loc": { + "start": { + "line": 285, + "column": 1 + }, + "end": { + "line": 295, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", + "start": 8367, + "end": 8847, + "loc": { + "start": { + "line": 300, + "column": 1 + }, + "end": { + "line": 315, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Convert to an object when given a string", + "start": 8886, + "end": 8929, + "loc": { + "start": { + "line": 319, + "column": 2 + }, + "end": { + "line": 319, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " Data must be an object at this point", + "start": 8998, + "end": 9037, + "loc": { + "start": { + "line": 324, + "column": 2 + }, + "end": { + "line": 324, + "column": 41 + } + } + }, + { + "type": "CommentLine", + "value": " Iterate through prototype names", + "start": 9075, + "end": 9109, + "loc": { + "start": { + "line": 326, + "column": 3 + }, + "end": { + "line": 326, + "column": 37 + } + } + }, + { + "type": "CommentLine", + "value": " Iterate through component names", + "start": 9210, + "end": 9244, + "loc": { + "start": { + "line": 330, + "column": 4 + }, + "end": { + "line": 330, + "column": 38 + } + } + }, + { + "type": "CommentLine", + "value": " Store strings of each component", + "start": 9290, + "end": 9324, + "loc": { + "start": { + "line": 332, + "column": 5 + }, + "end": { + "line": 332, + "column": 39 + } + } + } + ], + "tokens": [ + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "invoke", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "isFunction", + "start": 31, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "require", + "start": 46, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./utilities.js", + "start": 54, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 70, + "end": 71, + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 73, + "end": 87, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 88, + "end": 93, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 94, + "end": 95, + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Entity", + "start": 96, + "end": 102, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 105, + "end": 106, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "require", + "start": 107, + "end": 114, + "loc": { + "start": { + "line": 5, + "column": 19 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Class for world.\n *\n * @class World (name)\n ", - "start": 206, - "end": 264, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 14, - "column": 3 - } - } - } - ] + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null }, - { - "type": "ExpressionStatement", - "start": 8794, - "end": 8815, - "loc": { - "start": { - "line": 315, - "column": 0 - }, - "end": { - "line": 315, - "column": 21 - } + "start": 114, + "end": 115, + "loc": { + "start": { + "line": 5, + "column": 26 }, - "expression": { - "type": "AssignmentExpression", - "start": 8794, - "end": 8815, - "loc": { - "start": { - "line": 315, - "column": 0 - }, - "end": { - "line": 315, - "column": 21 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 8794, - "end": 8807, - "loc": { - "start": { - "line": 315, - "column": 0 - }, - "end": { - "line": 315, - "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 8794, - "end": 8801, - "loc": { - "start": { - "line": 315, - "column": 0 - }, - "end": { - "line": 315, - "column": 7 - }, - "identifierName": "exports" - }, - "name": "exports" - }, - "property": { - "type": "Identifier", - "start": 8802, - "end": 8807, - "loc": { - "start": { - "line": 315, - "column": 8 - }, - "end": { - "line": 315, - "column": 13 - }, - "identifierName": "World" - }, - "name": "World" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 8810, - "end": 8815, - "loc": { - "start": { - "line": 315, - "column": 16 - }, - "end": { - "line": 315, - "column": 21 - }, - "identifierName": "World" - }, - "name": "World" - } + "end": { + "line": 5, + "column": 27 } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 0, - "end": 14, + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./entity.js", + "start": 115, + "end": 128, "loc": { "start": { - "line": 1, - "column": 0 + "line": 5, + "column": 27 }, "end": { - "line": 1, - "column": 14 + "line": 5, + "column": 40 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 73, - "end": 87, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 128, + "end": 129, "loc": { "start": { - "line": 4, - "column": 0 + "line": 5, + "column": 40 }, "end": { - "line": 4, - "column": 14 + "line": 5, + "column": 41 } } }, @@ -9613,669 +11738,1048 @@ } }, { - "type": "CommentBlock", - "value": "*\n * Class for world.\n *\n * @class World (name)\n ", - "start": 206, - "end": 264, + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 146, + "end": 151, "loc": { "start": { - "line": 10, + "line": 8, "column": 0 }, "end": { - "line": 14, - "column": 3 + "line": 8, + "column": 5 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Constructs an instance of the world.\n\t ", - "start": 280, - "end": 329, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 152, + "end": 153, + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "ComponentIndex", + "start": 154, + "end": 168, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 169, + "end": 170, "loc": { "start": { - "line": 16, - "column": 1 + "line": 8, + "column": 23 }, "end": { - "line": 18, - "column": 4 + "line": 8, + "column": 24 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 349, - "end": 363, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 171, + "end": 172, "loc": { "start": { - "line": 20, - "column": 2 + "line": 8, + "column": 25 }, "end": { - "line": 20, - "column": 16 + "line": 8, + "column": 26 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Maps entity IDs to entities\n\t\t * @ignore\n\t\t ", - "start": 387, - "end": 442, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "require", + "start": 173, + "end": 180, "loc": { "start": { - "line": 23, - "column": 2 + "line": 8, + "column": 27 }, "end": { - "line": 26, - "column": 5 + "line": 8, + "column": 34 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 474, - "end": 488, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 180, + "end": 181, "loc": { "start": { - "line": 29, - "column": 2 + "line": 8, + "column": 34 }, "end": { - "line": 29, - "column": 16 + "line": 8, + "column": 35 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 515, - "end": 529, + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./component_index.js", + "start": 181, + "end": 203, "loc": { "start": { - "line": 32, - "column": 2 + "line": 8, + "column": 35 }, "end": { - "line": 32, - "column": 16 + "line": 8, + "column": 57 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 561, - "end": 575, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 203, + "end": 204, "loc": { "start": { - "line": 35, - "column": 2 + "line": 8, + "column": 57 }, "end": { - "line": 35, - "column": 16 + "line": 8, + "column": 58 } } }, { "type": "CommentBlock", - "value": "*\n\t\t * Maps entire queries to arrays of entities\n\t\t * @ignore\n\t\t ", - "start": 600, - "end": 669, + "value": "*\n * Class for world.\n *\n * @class World (name)\n ", + "start": 206, + "end": 264, "loc": { "start": { - "line": 38, - "column": 2 + "line": 10, + "column": 0 }, "end": { - "line": 41, - "column": 5 + "line": 14, + "column": 3 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Removes all entities from the world.\n\t * Does not affect registered systems, components, or prototypes.\n\t *\n\t * @example\n\t * world.clear()\n\t ", - "start": 724, - "end": 875, + "type": { + "label": "class", + "keyword": "class", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "class", + "start": 265, + "end": 270, "loc": { "start": { - "line": 45, - "column": 1 + "line": 15, + "column": 0 }, "end": { - "line": 51, - "column": 4 + "line": 15, + "column": 5 } } }, { - "type": "CommentLine", - "value": " Call onRemove on all components of all entities", - "start": 889, - "end": 939, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "World", + "start": 271, + "end": 276, "loc": { "start": { - "line": 53, - "column": 2 + "line": 15, + "column": 6 }, "end": { - "line": 53, - "column": 52 + "line": 15, + "column": 11 } } }, { - "type": "CommentLine", - "value": " Get component, and call onRemove if it exists as a function", - "start": 1040, - "end": 1102, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 277, + "end": 278, "loc": { "start": { - "line": 56, - "column": 4 + "line": 15, + "column": 12 }, "end": { - "line": 56, - "column": 66 + "line": 15, + "column": 13 } } }, { - "type": "CommentLine", - "value": " Clear entities", - "start": 1196, - "end": 1213, + "type": "CommentBlock", + "value": "*\n\t * Constructs an instance of the world.\n\t ", + "start": 280, + "end": 329, "loc": { "start": { - "line": 62, - "column": 2 + "line": 16, + "column": 1 }, "end": { - "line": 62, - "column": 19 + "line": 18, + "column": 4 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Registers a component type to the world. Components must be constructable. They are passed the entity first,\n\t * then the rest of the arguments from methods like entity.set(). Components also can have an onRemove() method.\n\t *\n\t * @param {string} name - The name\n\t * @param {function} componentClass - The component class, must be a constructable class or function\n\t *\n\t * @example\n\t * world.component('myComponent', class {\n\t * constructor(entity, some, args) {\n\t * this.entity = entity\n\t * this.some = some\n\t * this.args = args\n\t * }\n\t * })\n\t * // entity === the new entity object\n\t * // some === 10\n\t * // args === 500\n\t * world.entity().set('myComponent', 10, 500)\n\t *\n\t * @return {string} Registered component name on success, undefined on failure\n\t ", - "start": 1281, - "end": 2090, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "constructor", + "start": 331, + "end": 342, "loc": { "start": { - "line": 67, + "line": 19, "column": 1 }, "end": { - "line": 88, - "column": 4 + "line": 19, + "column": 12 } } }, { - "type": "CommentLine", - "value": " Only allow functions and classes to be components", - "start": 2128, - "end": 2180, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 342, + "end": 343, "loc": { "start": { - "line": 90, - "column": 2 + "line": 19, + "column": 12 }, "end": { - "line": 90, - "column": 54 + "line": 19, + "column": 13 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Creates a new entity in the world\n\t *\n\t * @param {string} [name] - The prototype name to use\n\t *\n\t * @example\n\t * world.entity()\n\t *\n\t * @example\n\t * world.entity('Player')\n\t *\n\t * @return {Entity} The new entity created\n\t ", - "start": 2283, - "end": 2516, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 343, + "end": 344, "loc": { "start": { - "line": 97, - "column": 1 + "line": 19, + "column": 13 }, "end": { - "line": 109, - "column": 4 + "line": 19, + "column": 14 } } }, { - "type": "CommentLine", - "value": " Use 'name' to get prototype data (if specified)", - "start": 2612, - "end": 2662, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 345, + "end": 346, "loc": { "start": { - "line": 114, - "column": 2 + "line": 19, + "column": 15 }, "end": { - "line": 114, - "column": 52 + "line": 19, + "column": 16 } } }, { - "type": "CommentLine", - "value": " Add all components from prototype", - "start": 2712, - "end": 2748, + "type": "CommentBlock", + "value": "* @ignore ", + "start": 349, + "end": 363, "loc": { "start": { - "line": 116, - "column": 3 + "line": 20, + "column": 2 }, "end": { - "line": 116, - "column": 39 + "line": 20, + "column": 16 } } }, { - "type": "CommentLine", - "value": " Update component with data from template", - "start": 2839, - "end": 2882, + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 366, + "end": 370, "loc": { "start": { - "line": 119, - "column": 4 + "line": 21, + "column": 2 }, "end": { - "line": 119, - "column": 47 + "line": 21, + "column": 6 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * })\n\t *\n\t * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize,\n\t * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run()\n\t * for an example of the call order.\n\t * @param {...Object} [args] - The arguments to forward to the system's constructors\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", - "start": 3066, - "end": 4045, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 370, + "end": 371, "loc": { "start": { - "line": 129, - "column": 1 + "line": 21, + "column": 6 }, "end": { - "line": 149, - "column": 4 + "line": 21, + "column": 7 } } }, { - "type": "CommentLine", - "value": " TODO: Make components optional, and parameters more dynamic by only using ...args", - "start": 4092, - "end": 4176, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "systems", + "start": 371, + "end": 378, "loc": { "start": { - "line": 151, - "column": 2 + "line": 21, + "column": 7 }, "end": { - "line": 151, - "column": 86 + "line": 21, + "column": 14 } } }, { - "type": "CommentLine", - "value": " Create the system, and set the component array query", - "start": 4213, - "end": 4268, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 379, + "end": 380, "loc": { "start": { - "line": 153, - "column": 3 + "line": 21, + "column": 15 }, "end": { - "line": 153, - "column": 58 + "line": 21, + "column": 16 } } }, { - "type": "CommentLine", - "value": " Add the system, return its ID", - "start": 4354, - "end": 4386, + "type": { + "label": "[", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 381, + "end": 382, "loc": { "start": { - "line": 157, - "column": 3 + "line": 21, + "column": 17 }, "end": { - "line": 157, - "column": 35 + "line": 21, + "column": 18 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", - "start": 4458, - "end": 4655, + "type": { + "label": "]", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 382, + "end": 383, "loc": { "start": { - "line": 163, - "column": 1 + "line": 21, + "column": 18 }, "end": { - "line": 170, - "column": 4 + "line": 21, + "column": 19 } } }, { "type": "CommentBlock", - "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system([], systemA)\n\t * world.system([], systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", - "start": 4766, - "end": 5295, + "value": "*\n\t\t * Maps entity IDs to entities\n\t\t * @ignore\n\t\t ", + "start": 387, + "end": 442, "loc": { "start": { - "line": 177, - "column": 1 + "line": 23, + "column": 2 }, "end": { - "line": 197, - "column": 4 + "line": 26, + "column": 5 } } }, { - "type": "CommentLine", - "value": " Run the \"every\" method in the system", - "start": 5387, - "end": 5426, + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 445, + "end": 449, "loc": { "start": { - "line": 202, - "column": 3 + "line": 27, + "column": 2 }, "end": { - "line": 202, - "column": 42 + "line": 27, + "column": 6 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", - "start": 5582, - "end": 6373, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 449, + "end": 450, "loc": { "start": { - "line": 211, - "column": 1 + "line": 27, + "column": 6 }, "end": { - "line": 229, - "column": 4 + "line": 27, + "column": 7 } } }, { - "type": "CommentLine", - "value": " Get indexed map of entities", - "start": 6420, - "end": 6450, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "entities", + "start": 450, + "end": 458, "loc": { "start": { - "line": 231, - "column": 2 + "line": 27, + "column": 7 }, "end": { - "line": 231, - "column": 32 + "line": 27, + "column": 15 } } }, { - "type": "CommentLine", - "value": " Go through the map of entities", - "start": 6535, - "end": 6568, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 459, + "end": 460, "loc": { "start": { - "line": 235, - "column": 3 + "line": 27, + "column": 16 }, "end": { - "line": 235, - "column": 36 + "line": 27, + "column": 17 } } }, { - "type": "CommentLine", - "value": " At this point, we can safely assume that all components exist, even if entities/components", - "start": 6616, - "end": 6709, + "type": { + "label": "new", + "keyword": "new", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "new", + "start": 461, + "end": 464, "loc": { "start": { - "line": 237, - "column": 4 + "line": 27, + "column": 18 }, "end": { - "line": 237, - "column": 97 + "line": 27, + "column": 21 } } }, { - "type": "CommentLine", - "value": " are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.", - "start": 6714, - "end": 6804, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Map", + "start": 465, + "end": 468, "loc": { "start": { - "line": 238, - "column": 4 + "line": 27, + "column": 22 }, "end": { - "line": 238, - "column": 94 + "line": 27, + "column": 25 } } }, { - "type": "CommentLine", - "value": " Get all components as an array", - "start": 6810, - "end": 6843, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 468, + "end": 469, "loc": { "start": { - "line": 240, - "column": 4 + "line": 27, + "column": 25 }, "end": { - "line": 240, - "column": 37 + "line": 27, + "column": 26 } } }, { - "type": "CommentLine", - "value": " Pass components, then the main entity, then any additional arguments", - "start": 6915, - "end": 6986, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 469, + "end": 470, "loc": { "start": { - "line": 243, - "column": 4 + "line": 27, + "column": 26 }, "end": { - "line": 243, - "column": 75 + "line": 27, + "column": 27 } } }, { - "type": "CommentLine", - "value": " Stop the iteration when the callback returns false", - "start": 7050, - "end": 7103, + "type": "CommentBlock", + "value": "* @ignore ", + "start": 474, + "end": 488, "loc": { "start": { - "line": 246, - "column": 4 + "line": 29, + "column": 2 }, "end": { - "line": 246, - "column": 57 + "line": 29, + "column": 16 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", - "start": 7191, - "end": 7597, + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 491, + "end": 495, "loc": { "start": { - "line": 256, - "column": 1 + "line": 30, + "column": 2 }, "end": { - "line": 266, - "column": 4 + "line": 30, + "column": 6 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", - "start": 7670, - "end": 8150, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 495, + "end": 496, "loc": { "start": { - "line": 271, - "column": 1 + "line": 30, + "column": 6 }, "end": { - "line": 286, - "column": 4 + "line": 30, + "column": 7 } } }, { - "type": "CommentLine", - "value": " Convert to an object when given a string", - "start": 8189, - "end": 8232, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "components", + "start": 496, + "end": 506, "loc": { "start": { - "line": 290, - "column": 2 + "line": 30, + "column": 7 }, "end": { - "line": 290, - "column": 45 + "line": 30, + "column": 17 } } }, { - "type": "CommentLine", - "value": " Data must be an object at this point", - "start": 8301, - "end": 8340, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 507, + "end": 508, "loc": { "start": { - "line": 295, - "column": 2 + "line": 30, + "column": 18 }, "end": { - "line": 295, - "column": 41 + "line": 30, + "column": 19 } } }, { - "type": "CommentLine", - "value": " Iterate through prototype names", - "start": 8378, - "end": 8412, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 509, + "end": 510, "loc": { "start": { - "line": 297, - "column": 3 + "line": 30, + "column": 20 }, "end": { - "line": 297, - "column": 37 + "line": 30, + "column": 21 } } }, { - "type": "CommentLine", - "value": " Iterate through component names", - "start": 8513, - "end": 8547, + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 510, + "end": 511, "loc": { "start": { - "line": 301, - "column": 4 + "line": 30, + "column": 21 }, "end": { - "line": 301, - "column": 38 + "line": 30, + "column": 22 } } }, - { - "type": "CommentLine", - "value": " Store strings of each component", - "start": 8593, - "end": 8627, - "loc": { - "start": { - "line": 303, - "column": 5 - }, - "end": { - "line": 303, - "column": 39 - } - } - } - ], - "tokens": [ { "type": "CommentBlock", "value": "* @ignore ", - "start": 0, - "end": 14, + "start": 515, + "end": 529, "loc": { "start": { - "line": 1, - "column": 0 + "line": 32, + "column": 2 }, "end": { - "line": 1, - "column": 14 + "line": 32, + "column": 16 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "this", + "keyword": "this", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10284,41 +12788,42 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 15, - "end": 20, + "value": "this", + "start": 532, + "end": 536, "loc": { "start": { - "line": 2, - "column": 0 + "line": 33, + "column": 2 }, "end": { - "line": 2, - "column": 5 + "line": 33, + "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 21, - "end": 22, + "start": 536, + "end": 537, "loc": { "start": { - "line": 2, + "line": 33, "column": 6 }, "end": { - "line": 2, + "line": 33, "column": 7 } } @@ -10335,50 +12840,51 @@ "postfix": false, "binop": null }, - "value": "invoke", - "start": 23, - "end": 29, + "value": "entityTemplates", + "start": 537, + "end": 552, "loc": { "start": { - "line": 2, - "column": 8 + "line": 33, + "column": 7 }, "end": { - "line": 2, - "column": 14 + "line": 33, + "column": 22 } } }, { "type": { - "label": ",", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 29, - "end": 30, + "value": "=", + "start": 553, + "end": 554, "loc": { "start": { - "line": 2, - "column": 14 + "line": 33, + "column": 23 }, "end": { - "line": 2, - "column": 15 + "line": 33, + "column": 24 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -10387,16 +12893,15 @@ "postfix": false, "binop": null }, - "value": "isFunction", - "start": 31, - "end": 41, + "start": 555, + "end": 556, "loc": { "start": { - "line": 2, - "column": 16 + "line": 33, + "column": 25 }, "end": { - "line": 2, + "line": 33, "column": 26 } } @@ -10413,76 +12918,93 @@ "postfix": false, "binop": null }, - "start": 42, - "end": 43, + "start": 556, + "end": 557, "loc": { "start": { - "line": 2, + "line": 33, + "column": 26 + }, + "end": { + "line": 33, "column": 27 + } + } + }, + { + "type": "CommentBlock", + "value": "* @ignore ", + "start": 561, + "end": 575, + "loc": { + "start": { + "line": 35, + "column": 2 }, "end": { - "line": 2, - "column": 28 + "line": 35, + "column": 16 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 44, - "end": 45, + "value": "this", + "start": 578, + "end": 582, "loc": { "start": { - "line": 2, - "column": 29 + "line": 36, + "column": 2 }, "end": { - "line": 2, - "column": 30 + "line": 36, + "column": 6 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "require", - "start": 46, - "end": 53, + "start": 582, + "end": 583, "loc": { "start": { - "line": 2, - "column": 31 + "line": 36, + "column": 6 }, "end": { - "line": 2, - "column": 38 + "line": 36, + "column": 7 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -10491,93 +13013,96 @@ "postfix": false, "binop": null }, - "start": 53, - "end": 54, + "value": "idCounter", + "start": 583, + "end": 592, "loc": { "start": { - "line": 2, - "column": 38 + "line": 36, + "column": 7 }, "end": { - "line": 2, - "column": 39 + "line": 36, + "column": 16 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "./utilities.js", - "start": 54, - "end": 70, + "value": "=", + "start": 593, + "end": 594, "loc": { "start": { - "line": 2, - "column": 39 + "line": 36, + "column": 17 }, "end": { - "line": 2, - "column": 55 + "line": 36, + "column": 18 } } }, { "type": { - "label": ")", + "label": "num", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 70, - "end": 71, + "value": 1, + "start": 595, + "end": 596, "loc": { "start": { - "line": 2, - "column": 55 + "line": 36, + "column": 19 }, "end": { - "line": 2, - "column": 56 + "line": 36, + "column": 20 } } }, { "type": "CommentBlock", - "value": "* @ignore ", - "start": 73, - "end": 87, + "value": "*\n\t\t * Maps entire queries to arrays of entities\n\t\t * @ignore\n\t\t ", + "start": 600, + "end": 669, "loc": { "start": { - "line": 4, - "column": 0 + "line": 38, + "column": 2 }, "end": { - "line": 4, - "column": 14 + "line": 41, + "column": 5 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "this", + "keyword": "this", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10586,41 +13111,42 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 88, - "end": 93, + "value": "this", + "start": 672, + "end": 676, "loc": { "start": { - "line": 5, - "column": 0 + "line": 42, + "column": 2 }, "end": { - "line": 5, - "column": 5 + "line": 42, + "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 94, - "end": 95, + "start": 676, + "end": 677, "loc": { "start": { - "line": 5, + "line": 42, "column": 6 }, "end": { - "line": 5, + "line": 42, "column": 7 } } @@ -10637,68 +13163,71 @@ "postfix": false, "binop": null }, - "value": "Entity", - "start": 96, - "end": 102, + "value": "index", + "start": 677, + "end": 682, "loc": { "start": { - "line": 5, - "column": 8 + "line": 42, + "column": 7 }, "end": { - "line": 5, - "column": 14 + "line": 42, + "column": 12 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 103, - "end": 104, + "value": "=", + "start": 683, + "end": 684, "loc": { "start": { - "line": 5, - "column": 15 + "line": 42, + "column": 13 }, "end": { - "line": 5, - "column": 16 + "line": 42, + "column": 14 } } }, { "type": { - "label": "=", + "label": "new", + "keyword": "new", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 105, - "end": 106, + "value": "new", + "start": 685, + "end": 688, "loc": { "start": { - "line": 5, - "column": 17 + "line": 42, + "column": 15 }, "end": { - "line": 5, + "line": 42, "column": 18 } } @@ -10715,17 +13244,17 @@ "postfix": false, "binop": null }, - "value": "require", - "start": 107, - "end": 114, + "value": "ComponentIndex", + "start": 689, + "end": 703, "loc": { "start": { - "line": 5, + "line": 42, "column": 19 }, "end": { - "line": 5, - "column": 26 + "line": 42, + "column": 33 } } }, @@ -10741,91 +13270,50 @@ "postfix": false, "binop": null }, - "start": 114, - "end": 115, - "loc": { - "start": { - "line": 5, - "column": 26 - }, - "end": { - "line": 5, - "column": 27 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./entity.js", - "start": 115, - "end": 128, - "loc": { - "start": { - "line": 5, - "column": 27 - }, - "end": { - "line": 5, - "column": 40 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 128, - "end": 129, + "start": 703, + "end": 704, "loc": { "start": { - "line": 5, - "column": 40 + "line": 42, + "column": 33 }, "end": { - "line": 5, - "column": 41 + "line": 42, + "column": 34 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 131, - "end": 145, + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 704, + "end": 708, "loc": { "start": { - "line": 7, - "column": 0 + "line": 42, + "column": 34 }, "end": { - "line": 7, - "column": 14 + "line": 42, + "column": 38 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -10836,24 +13324,23 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 146, - "end": 151, + "start": 708, + "end": 709, "loc": { "start": { - "line": 8, - "column": 0 + "line": 42, + "column": 38 }, "end": { - "line": 8, - "column": 5 + "line": 42, + "column": 39 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -10862,24 +13349,25 @@ "postfix": false, "binop": null }, - "start": 152, - "end": 153, + "value": "entities", + "start": 709, + "end": 717, "loc": { "start": { - "line": 8, - "column": 6 + "line": 42, + "column": 39 }, "end": { - "line": 8, - "column": 7 + "line": 42, + "column": 47 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10887,17 +13375,16 @@ "postfix": false, "binop": null }, - "value": "ComponentIndex", - "start": 154, - "end": 168, + "start": 717, + "end": 718, "loc": { "start": { - "line": 8, - "column": 8 + "line": 42, + "column": 47 }, "end": { - "line": 8, - "column": 22 + "line": 42, + "column": 48 } } }, @@ -10913,43 +13400,32 @@ "postfix": false, "binop": null }, - "start": 169, - "end": 170, + "start": 720, + "end": 721, "loc": { "start": { - "line": 8, - "column": 23 + "line": 43, + "column": 1 }, "end": { - "line": 8, - "column": 24 + "line": 43, + "column": 2 } } }, { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 171, - "end": 172, + "type": "CommentBlock", + "value": "*\n\t * Removes all entities from the world.\n\t * Does not affect registered systems, components, or prototypes.\n\t *\n\t * @example\n\t * world.clear()\n\t ", + "start": 724, + "end": 875, "loc": { "start": { - "line": 8, - "column": 25 + "line": 45, + "column": 1 }, "end": { - "line": 8, - "column": 26 + "line": 51, + "column": 4 } } }, @@ -10965,17 +13441,17 @@ "postfix": false, "binop": null }, - "value": "require", - "start": 173, - "end": 180, + "value": "clear", + "start": 877, + "end": 882, "loc": { "start": { - "line": 8, - "column": 27 + "line": 52, + "column": 1 }, "end": { - "line": 8, - "column": 34 + "line": 52, + "column": 6 } } }, @@ -10991,51 +13467,49 @@ "postfix": false, "binop": null }, - "start": 180, - "end": 181, + "start": 882, + "end": 883, "loc": { "start": { - "line": 8, - "column": 34 + "line": 52, + "column": 6 }, "end": { - "line": 8, - "column": 35 + "line": 52, + "column": 7 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./component_index.js", - "start": 181, - "end": 203, + "start": 883, + "end": 884, "loc": { "start": { - "line": 8, - "column": 35 + "line": 52, + "column": 7 }, "end": { - "line": 8, - "column": 57 + "line": 52, + "column": 8 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11043,67 +13517,67 @@ "postfix": false, "binop": null }, - "start": 203, - "end": 204, + "start": 885, + "end": 886, "loc": { "start": { - "line": 8, - "column": 57 + "line": 52, + "column": 9 }, "end": { - "line": 8, - "column": 58 + "line": 52, + "column": 10 } } }, { - "type": "CommentBlock", - "value": "*\n * Class for world.\n *\n * @class World (name)\n ", - "start": 206, - "end": 264, + "type": "CommentLine", + "value": " Call onRemove on all components of all entities", + "start": 889, + "end": 939, "loc": { "start": { - "line": 10, - "column": 0 + "line": 53, + "column": 2 }, "end": { - "line": 14, - "column": 3 + "line": 53, + "column": 52 } } }, { "type": { - "label": "class", - "keyword": "class", + "label": "for", + "keyword": "for", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, - "isLoop": false, + "isLoop": true, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "class", - "start": 265, - "end": 270, + "value": "for", + "start": 942, + "end": 945, "loc": { "start": { - "line": 15, - "column": 0 + "line": 54, + "column": 2 }, "end": { - "line": 15, + "line": 54, "column": 5 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11112,58 +13586,70 @@ "postfix": false, "binop": null }, - "value": "World", - "start": 271, - "end": 276, + "start": 946, + "end": 947, "loc": { "start": { - "line": 15, + "line": 54, "column": 6 }, "end": { - "line": 15, - "column": 11 + "line": 54, + "column": 7 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 277, - "end": 278, + "value": "const", + "start": 947, + "end": 952, "loc": { "start": { - "line": 15, - "column": 12 + "line": 54, + "column": 7 }, "end": { - "line": 15, - "column": 13 + "line": 54, + "column": 12 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Constructs an instance of the world.\n\t ", - "start": 280, - "end": 329, + "type": { + "label": "[", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 953, + "end": 954, "loc": { "start": { - "line": 16, - "column": 1 + "line": 54, + "column": 13 }, "end": { - "line": 18, - "column": 4 + "line": 54, + "column": 14 } } }, @@ -11179,50 +13665,51 @@ "postfix": false, "binop": null }, - "value": "constructor", - "start": 331, - "end": 342, + "value": "entityId", + "start": 954, + "end": 962, "loc": { "start": { - "line": 19, - "column": 1 + "line": 54, + "column": 14 }, "end": { - "line": 19, - "column": 12 + "line": 54, + "column": 22 } } }, { "type": { - "label": "(", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 342, - "end": 343, + "start": 962, + "end": 963, "loc": { "start": { - "line": 19, - "column": 12 + "line": 54, + "column": 22 }, "end": { - "line": 19, - "column": 13 + "line": 54, + "column": 23 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11230,57 +13717,69 @@ "postfix": false, "binop": null }, - "start": 343, - "end": 344, + "value": "entity", + "start": 964, + "end": 970, "loc": { "start": { - "line": 19, - "column": 13 + "line": 54, + "column": 24 }, "end": { - "line": 19, - "column": 14 + "line": 54, + "column": 30 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "]", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 345, - "end": 346, + "start": 970, + "end": 971, "loc": { "start": { - "line": 19, - "column": 15 + "line": 54, + "column": 30 }, "end": { - "line": 19, - "column": 16 + "line": 54, + "column": 31 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 349, - "end": 363, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "of", + "start": 972, + "end": 974, "loc": { "start": { - "line": 20, - "column": 2 + "line": 54, + "column": 32 }, "end": { - "line": 20, - "column": 16 + "line": 54, + "column": 34 } } }, @@ -11299,16 +13798,16 @@ "updateContext": null }, "value": "this", - "start": 366, - "end": 370, + "start": 975, + "end": 979, "loc": { "start": { - "line": 21, - "column": 2 + "line": 54, + "column": 35 }, "end": { - "line": 21, - "column": 6 + "line": 54, + "column": 39 } } }, @@ -11325,16 +13824,16 @@ "binop": null, "updateContext": null }, - "start": 370, - "end": 371, + "start": 979, + "end": 980, "loc": { "start": { - "line": 21, - "column": 6 + "line": 54, + "column": 39 }, "end": { - "line": 21, - "column": 7 + "line": 54, + "column": 40 } } }, @@ -11350,50 +13849,48 @@ "postfix": false, "binop": null }, - "value": "systems", - "start": 371, - "end": 378, + "value": "entities", + "start": 980, + "end": 988, "loc": { "start": { - "line": 21, - "column": 7 + "line": 54, + "column": 40 }, "end": { - "line": 21, - "column": 14 + "line": 54, + "column": 48 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 379, - "end": 380, + "start": 988, + "end": 989, "loc": { "start": { - "line": 21, - "column": 15 + "line": 54, + "column": 48 }, "end": { - "line": 21, - "column": 16 + "line": 54, + "column": 49 } } }, { "type": { - "label": "[", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -11401,95 +13898,78 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 381, - "end": 382, + "start": 990, + "end": 991, "loc": { "start": { - "line": 21, - "column": 17 + "line": 54, + "column": 50 }, "end": { - "line": 21, - "column": 18 + "line": 54, + "column": 51 } } }, { "type": { - "label": "]", + "label": "for", + "keyword": "for", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, - "isLoop": false, + "isLoop": true, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 382, - "end": 383, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 19 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * Maps entity IDs to entities\n\t\t * @ignore\n\t\t ", - "start": 387, - "end": 442, + "value": "for", + "start": 995, + "end": 998, "loc": { "start": { - "line": 23, - "column": 2 + "line": 55, + "column": 3 }, "end": { - "line": 26, - "column": 5 + "line": 55, + "column": 6 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 445, - "end": 449, + "start": 999, + "end": 1000, "loc": { "start": { - "line": 27, - "column": 2 + "line": 55, + "column": 7 }, - "end": { - "line": 27, - "column": 6 + "end": { + "line": 55, + "column": 8 } } }, { "type": { - "label": ".", + "label": "let", + "keyword": "let", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -11500,16 +13980,17 @@ "binop": null, "updateContext": null }, - "start": 449, - "end": 450, + "value": "let", + "start": 1000, + "end": 1003, "loc": { "start": { - "line": 27, - "column": 6 + "line": 55, + "column": 8 }, "end": { - "line": 27, - "column": 7 + "line": 55, + "column": 11 } } }, @@ -11525,105 +14006,104 @@ "postfix": false, "binop": null }, - "value": "entities", - "start": 450, - "end": 458, + "value": "componentName", + "start": 1004, + "end": 1017, "loc": { "start": { - "line": 27, - "column": 7 + "line": 55, + "column": 12 }, "end": { - "line": 27, - "column": 15 + "line": 55, + "column": 25 } } }, { "type": { - "label": "=", + "label": "in", + "keyword": "in", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "=", - "start": 459, - "end": 460, + "value": "in", + "start": 1018, + "end": 1020, "loc": { "start": { - "line": 27, - "column": 16 + "line": 55, + "column": 26 }, "end": { - "line": 27, - "column": 17 + "line": 55, + "column": 28 } } }, { "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "new", - "start": 461, - "end": 464, + "value": "entity", + "start": 1021, + "end": 1027, "loc": { "start": { - "line": 27, - "column": 18 + "line": 55, + "column": 29 }, "end": { - "line": 27, - "column": 21 + "line": 55, + "column": 35 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Map", - "start": 465, - "end": 468, + "start": 1027, + "end": 1028, "loc": { "start": { - "line": 27, - "column": 22 + "line": 55, + "column": 35 }, "end": { - "line": 27, - "column": 25 + "line": 55, + "column": 36 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11632,16 +14112,17 @@ "postfix": false, "binop": null }, - "start": 468, - "end": 469, + "value": "data", + "start": 1028, + "end": 1032, "loc": { "start": { - "line": 27, - "column": 25 + "line": 55, + "column": 36 }, "end": { - "line": 27, - "column": 26 + "line": 55, + "column": 40 } } }, @@ -11657,66 +14138,64 @@ "postfix": false, "binop": null }, - "start": 469, - "end": 470, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 27 - } - } - }, - { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 474, - "end": 488, + "start": 1032, + "end": 1033, "loc": { "start": { - "line": 29, - "column": 2 + "line": 55, + "column": 40 }, "end": { - "line": 29, - "column": 16 + "line": 55, + "column": 41 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 491, - "end": 495, + "start": 1034, + "end": 1035, "loc": { "start": { - "line": 30, - "column": 2 + "line": 55, + "column": 42 }, "end": { - "line": 30, - "column": 6 + "line": 55, + "column": 43 + } + } + }, + { + "type": "CommentLine", + "value": " Get component, and call onRemove if it exists as a function", + "start": 1040, + "end": 1102, + "loc": { + "start": { + "line": 56, + "column": 4 + }, + "end": { + "line": 56, + "column": 66 } } }, { "type": { - "label": ".", + "label": "let", + "keyword": "let", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -11727,15 +14206,16 @@ "binop": null, "updateContext": null }, - "start": 495, - "end": 496, + "value": "let", + "start": 1107, + "end": 1110, "loc": { "start": { - "line": 30, - "column": 6 + "line": 57, + "column": 4 }, "end": { - "line": 30, + "line": 57, "column": 7 } } @@ -11752,16 +14232,16 @@ "postfix": false, "binop": null }, - "value": "components", - "start": 496, - "end": 506, + "value": "component", + "start": 1111, + "end": 1120, "loc": { "start": { - "line": 30, - "column": 7 + "line": 57, + "column": 8 }, "end": { - "line": 30, + "line": 57, "column": 17 } } @@ -11780,23 +14260,23 @@ "updateContext": null }, "value": "=", - "start": 507, - "end": 508, + "start": 1121, + "end": 1122, "loc": { "start": { - "line": 30, + "line": 57, "column": 18 }, "end": { - "line": 30, + "line": 57, "column": 19 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11805,64 +14285,49 @@ "postfix": false, "binop": null }, - "start": 509, - "end": 510, + "value": "entity", + "start": 1123, + "end": 1129, "loc": { "start": { - "line": 30, + "line": 57, "column": 20 }, "end": { - "line": 30, - "column": 21 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 510, - "end": 511, - "loc": { - "start": { - "line": 30, - "column": 21 - }, - "end": { - "line": 30, - "column": 22 + "line": 57, + "column": 26 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 515, - "end": 529, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1129, + "end": 1130, "loc": { "start": { - "line": 32, - "column": 2 + "line": 57, + "column": 26 }, "end": { - "line": 32, - "column": 16 + "line": 57, + "column": 27 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -11870,28 +14335,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 532, - "end": 536, + "value": "data", + "start": 1130, + "end": 1134, "loc": { "start": { - "line": 33, - "column": 2 + "line": 57, + "column": 27 }, "end": { - "line": 33, - "column": 6 + "line": 57, + "column": 31 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "[", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11900,16 +14364,16 @@ "binop": null, "updateContext": null }, - "start": 536, - "end": 537, + "start": 1134, + "end": 1135, "loc": { "start": { - "line": 33, - "column": 6 + "line": 57, + "column": 31 }, "end": { - "line": 33, - "column": 7 + "line": 57, + "column": 32 } } }, @@ -11925,51 +14389,50 @@ "postfix": false, "binop": null }, - "value": "entityTemplates", - "start": 537, - "end": 552, + "value": "componentName", + "start": 1135, + "end": 1148, "loc": { "start": { - "line": 33, - "column": 7 + "line": 57, + "column": 32 }, "end": { - "line": 33, - "column": 22 + "line": 57, + "column": 45 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": "]", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 553, - "end": 554, + "start": 1148, + "end": 1149, "loc": { "start": { - "line": 33, - "column": 23 + "line": 57, + "column": 45 }, "end": { - "line": 33, - "column": 24 + "line": 57, + "column": 46 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11978,24 +14441,25 @@ "postfix": false, "binop": null }, - "start": 555, - "end": 556, + "value": "invoke", + "start": 1154, + "end": 1160, "loc": { "start": { - "line": 33, - "column": 25 + "line": 58, + "column": 4 }, "end": { - "line": 33, - "column": 26 + "line": 58, + "column": 10 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12003,41 +14467,50 @@ "postfix": false, "binop": null }, - "start": 556, - "end": 557, + "start": 1160, + "end": 1161, "loc": { "start": { - "line": 33, - "column": 26 + "line": 58, + "column": 10 }, "end": { - "line": 33, - "column": 27 + "line": 58, + "column": 11 } } }, { - "type": "CommentBlock", - "value": "* @ignore ", - "start": 561, - "end": 575, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "component", + "start": 1161, + "end": 1170, "loc": { "start": { - "line": 35, - "column": 2 + "line": 58, + "column": 11 }, "end": { - "line": 35, - "column": 16 + "line": 58, + "column": 20 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, + "label": ",", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12046,25 +14519,24 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 578, - "end": 582, + "start": 1170, + "end": 1171, "loc": { "start": { - "line": 36, - "column": 2 + "line": 58, + "column": 20 }, "end": { - "line": 36, - "column": 6 + "line": 58, + "column": 21 } } }, { "type": { - "label": ".", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12073,24 +14545,25 @@ "binop": null, "updateContext": null }, - "start": 582, - "end": 583, + "value": "onRemove", + "start": 1172, + "end": 1182, "loc": { "start": { - "line": 36, - "column": 6 + "line": 58, + "column": 22 }, "end": { - "line": 36, - "column": 7 + "line": 58, + "column": 32 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12098,87 +14571,82 @@ "postfix": false, "binop": null }, - "value": "idCounter", - "start": 583, - "end": 592, + "start": 1182, + "end": 1183, "loc": { "start": { - "line": 36, - "column": 7 + "line": 58, + "column": 32 }, "end": { - "line": 36, - "column": 16 + "line": 58, + "column": 33 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 593, - "end": 594, + "start": 1187, + "end": 1188, "loc": { "start": { - "line": 36, - "column": 17 + "line": 59, + "column": 3 }, "end": { - "line": 36, - "column": 18 + "line": 59, + "column": 4 } } }, { "type": { - "label": "num", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": 1, - "start": 595, - "end": 596, + "start": 1191, + "end": 1192, "loc": { "start": { - "line": 36, - "column": 19 + "line": 60, + "column": 2 }, "end": { - "line": 36, - "column": 20 + "line": 60, + "column": 3 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Maps entire queries to arrays of entities\n\t\t * @ignore\n\t\t ", - "start": 600, - "end": 669, + "type": "CommentLine", + "value": " Clear entities", + "start": 1196, + "end": 1213, "loc": { "start": { - "line": 38, + "line": 62, "column": 2 }, "end": { - "line": 41, - "column": 5 + "line": 62, + "column": 19 } } }, @@ -12197,15 +14665,15 @@ "updateContext": null }, "value": "this", - "start": 672, - "end": 676, + "start": 1216, + "end": 1220, "loc": { "start": { - "line": 42, + "line": 63, "column": 2 }, "end": { - "line": 42, + "line": 63, "column": 6 } } @@ -12223,15 +14691,15 @@ "binop": null, "updateContext": null }, - "start": 676, - "end": 677, + "start": 1220, + "end": 1221, "loc": { "start": { - "line": 42, + "line": 63, "column": 6 }, "end": { - "line": 42, + "line": 63, "column": 7 } } @@ -12248,17 +14716,17 @@ "postfix": false, "binop": null }, - "value": "index", - "start": 677, - "end": 682, + "value": "entities", + "start": 1221, + "end": 1229, "loc": { "start": { - "line": 42, + "line": 63, "column": 7 }, "end": { - "line": 42, - "column": 12 + "line": 63, + "column": 15 } } }, @@ -12276,16 +14744,16 @@ "updateContext": null }, "value": "=", - "start": 683, - "end": 684, + "start": 1230, + "end": 1231, "loc": { "start": { - "line": 42, - "column": 13 + "line": 63, + "column": 16 }, "end": { - "line": 42, - "column": 14 + "line": 63, + "column": 17 } } }, @@ -12304,16 +14772,16 @@ "updateContext": null }, "value": "new", - "start": 685, - "end": 688, + "start": 1232, + "end": 1235, "loc": { "start": { - "line": 42, - "column": 15 + "line": 63, + "column": 18 }, "end": { - "line": 42, - "column": 18 + "line": 63, + "column": 21 } } }, @@ -12329,17 +14797,17 @@ "postfix": false, "binop": null }, - "value": "ComponentIndex", - "start": 689, - "end": 703, + "value": "Map", + "start": 1236, + "end": 1239, "loc": { "start": { - "line": 42, - "column": 19 + "line": 63, + "column": 22 }, "end": { - "line": 42, - "column": 33 + "line": 63, + "column": 25 } } }, @@ -12355,16 +14823,41 @@ "postfix": false, "binop": null }, - "start": 703, - "end": 704, + "start": 1239, + "end": 1240, "loc": { "start": { - "line": 42, - "column": 33 + "line": 63, + "column": 25 }, "end": { - "line": 42, - "column": 34 + "line": 63, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1240, + "end": 1241, + "loc": { + "start": { + "line": 63, + "column": 26 + }, + "end": { + "line": 63, + "column": 27 } } }, @@ -12383,16 +14876,16 @@ "updateContext": null }, "value": "this", - "start": 704, - "end": 708, + "start": 1244, + "end": 1248, "loc": { "start": { - "line": 42, - "column": 34 + "line": 64, + "column": 2 }, "end": { - "line": 42, - "column": 38 + "line": 64, + "column": 6 } } }, @@ -12409,16 +14902,16 @@ "binop": null, "updateContext": null }, - "start": 708, - "end": 709, + "start": 1248, + "end": 1249, "loc": { "start": { - "line": 42, - "column": 38 + "line": 64, + "column": 6 }, "end": { - "line": 42, - "column": 39 + "line": 64, + "column": 7 } } }, @@ -12434,23 +14927,23 @@ "postfix": false, "binop": null }, - "value": "entities", - "start": 709, - "end": 717, + "value": "index", + "start": 1249, + "end": 1254, "loc": { "start": { - "line": 42, - "column": 39 + "line": 64, + "column": 7 }, "end": { - "line": 42, - "column": 47 + "line": 64, + "column": 12 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12458,26 +14951,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 717, - "end": 718, + "start": 1254, + "end": 1255, "loc": { "start": { - "line": 42, - "column": 47 + "line": 64, + "column": 12 }, "end": { - "line": 42, - "column": 48 + "line": 64, + "column": 13 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12485,38 +14979,49 @@ "postfix": false, "binop": null }, - "start": 720, - "end": 721, + "value": "clear", + "start": 1255, + "end": 1260, "loc": { "start": { - "line": 43, - "column": 1 + "line": 64, + "column": 13 }, "end": { - "line": 43, - "column": 2 + "line": 64, + "column": 18 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Removes all entities from the world.\n\t * Does not affect registered systems, components, or prototypes.\n\t *\n\t * @example\n\t * world.clear()\n\t ", - "start": 724, - "end": 875, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1260, + "end": 1261, "loc": { "start": { - "line": 45, - "column": 1 + "line": 64, + "column": 18 }, "end": { - "line": 51, - "column": 4 + "line": 64, + "column": 19 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -12524,26 +15029,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "clear", - "start": 877, - "end": 882, + "value": "this", + "start": 1261, + "end": 1265, "loc": { "start": { - "line": 52, - "column": 1 + "line": 64, + "column": 19 }, "end": { - "line": 52, - "column": 6 + "line": 64, + "column": 23 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1265, + "end": 1266, + "loc": { + "start": { + "line": 64, + "column": 23 + }, + "end": { + "line": 64, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -12552,16 +15084,17 @@ "postfix": false, "binop": null }, - "start": 882, - "end": 883, + "value": "entities", + "start": 1266, + "end": 1274, "loc": { "start": { - "line": 52, - "column": 6 + "line": 64, + "column": 24 }, "end": { - "line": 52, - "column": 7 + "line": 64, + "column": 32 } } }, @@ -12577,24 +15110,24 @@ "postfix": false, "binop": null }, - "start": 883, - "end": 884, + "start": 1274, + "end": 1275, "loc": { "start": { - "line": 52, - "column": 7 + "line": 64, + "column": 32 }, "end": { - "line": 52, - "column": 8 + "line": 64, + "column": 33 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12602,60 +15135,58 @@ "postfix": false, "binop": null }, - "start": 885, - "end": 886, + "start": 1277, + "end": 1278, "loc": { "start": { - "line": 52, - "column": 9 + "line": 65, + "column": 1 }, "end": { - "line": 52, - "column": 10 + "line": 65, + "column": 2 } } }, { - "type": "CommentLine", - "value": " Call onRemove on all components of all entities", - "start": 889, - "end": 939, + "type": "CommentBlock", + "value": "*\n\t * Registers a component type to the world. Components must be constructable. They are passed the entity first,\n\t * then the rest of the arguments from methods like entity.set(). Components also can have an onRemove() method.\n\t *\n\t * @param {string} name - The name\n\t * @param {function} componentClass - The component class, must be a constructable class or function\n\t *\n\t * @example\n\t * world.component('myComponent', class {\n\t * constructor(entity, some, args) {\n\t * this.entity = entity\n\t * this.some = some\n\t * this.args = args\n\t * }\n\t * })\n\t * // entity === the new entity object\n\t * // some === 10\n\t * // args === 500\n\t * world.entity().set('myComponent', 10, 500)\n\t *\n\t * @return {string} Registered component name on success, undefined on failure\n\t ", + "start": 1281, + "end": 2090, "loc": { "start": { - "line": 53, - "column": 2 + "line": 67, + "column": 1 }, "end": { - "line": 53, - "column": 52 + "line": 88, + "column": 4 } } }, { "type": { - "label": "for", - "keyword": "for", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, - "isLoop": true, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "for", - "start": 942, - "end": 945, + "value": "component", + "start": 2092, + "end": 2101, "loc": { "start": { - "line": 54, - "column": 2 + "line": 89, + "column": 1 }, "end": { - "line": 54, - "column": 5 + "line": 89, + "column": 10 } } }, @@ -12671,52 +15202,50 @@ "postfix": false, "binop": null }, - "start": 946, - "end": 947, + "start": 2101, + "end": 2102, "loc": { "start": { - "line": 54, - "column": 6 + "line": 89, + "column": 10 }, "end": { - "line": 54, - "column": 7 + "line": 89, + "column": 11 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 947, - "end": 952, + "value": "name", + "start": 2102, + "end": 2106, "loc": { "start": { - "line": 54, - "column": 7 + "line": 89, + "column": 11 }, "end": { - "line": 54, - "column": 12 + "line": 89, + "column": 15 } } }, { "type": { - "label": "[", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12725,16 +15254,16 @@ "binop": null, "updateContext": null }, - "start": 953, - "end": 954, + "start": 2106, + "end": 2107, "loc": { "start": { - "line": 54, - "column": 13 + "line": 89, + "column": 15 }, "end": { - "line": 54, - "column": 14 + "line": 89, + "column": 16 } } }, @@ -12750,50 +15279,49 @@ "postfix": false, "binop": null }, - "value": "entityId", - "start": 954, - "end": 962, + "value": "componentClass", + "start": 2108, + "end": 2122, "loc": { "start": { - "line": 54, - "column": 14 + "line": 89, + "column": 17 }, "end": { - "line": 54, - "column": 22 + "line": 89, + "column": 31 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 962, - "end": 963, + "start": 2122, + "end": 2123, "loc": { "start": { - "line": 54, - "column": 22 + "line": 89, + "column": 31 }, "end": { - "line": 54, - "column": 23 + "line": 89, + "column": 32 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -12802,23 +15330,39 @@ "postfix": false, "binop": null }, - "value": "entity", - "start": 964, - "end": 970, + "start": 2124, + "end": 2125, "loc": { "start": { - "line": 54, - "column": 24 + "line": 89, + "column": 33 }, "end": { - "line": 54, - "column": 30 + "line": 89, + "column": 34 + } + } + }, + { + "type": "CommentLine", + "value": " Only allow functions and classes to be components", + "start": 2128, + "end": 2180, + "loc": { + "start": { + "line": 90, + "column": 2 + }, + "end": { + "line": 90, + "column": 54 } } }, { "type": { - "label": "]", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12829,16 +15373,42 @@ "binop": null, "updateContext": null }, - "start": 970, - "end": 971, + "value": "if", + "start": 2183, + "end": 2185, "loc": { "start": { - "line": 54, - "column": 30 + "line": 91, + "column": 2 }, "end": { - "line": 54, - "column": 31 + "line": 91, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2186, + "end": 2187, + "loc": { + "start": { + "line": 91, + "column": 5 + }, + "end": { + "line": 91, + "column": 6 } } }, @@ -12854,79 +15424,76 @@ "postfix": false, "binop": null }, - "value": "of", - "start": 972, - "end": 974, + "value": "isFunction", + "start": 2187, + "end": 2197, "loc": { "start": { - "line": 54, - "column": 32 + "line": 91, + "column": 6 }, "end": { - "line": 54, - "column": 34 + "line": 91, + "column": 16 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 975, - "end": 979, + "start": 2197, + "end": 2198, "loc": { "start": { - "line": 54, - "column": 35 + "line": 91, + "column": 16 }, "end": { - "line": 54, - "column": 39 + "line": 91, + "column": 17 } } }, { "type": { - "label": ".", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 979, - "end": 980, + "value": "componentClass", + "start": 2198, + "end": 2212, "loc": { "start": { - "line": 54, - "column": 39 + "line": 91, + "column": 17 }, "end": { - "line": 54, - "column": 40 + "line": 91, + "column": 31 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12934,17 +15501,16 @@ "postfix": false, "binop": null }, - "value": "entities", - "start": 980, - "end": 988, + "start": 2212, + "end": 2213, "loc": { "start": { - "line": 54, - "column": 40 + "line": 91, + "column": 31 }, "end": { - "line": 54, - "column": 48 + "line": 91, + "column": 32 } } }, @@ -12960,16 +15526,16 @@ "postfix": false, "binop": null }, - "start": 988, - "end": 989, + "start": 2213, + "end": 2214, "loc": { "start": { - "line": 54, - "column": 48 + "line": 91, + "column": 32 }, "end": { - "line": 54, - "column": 49 + "line": 91, + "column": 33 } } }, @@ -12985,203 +15551,201 @@ "postfix": false, "binop": null }, - "start": 990, - "end": 991, + "start": 2215, + "end": 2216, "loc": { "start": { - "line": 54, - "column": 50 + "line": 91, + "column": 34 }, "end": { - "line": 54, - "column": 51 + "line": 91, + "column": 35 } } }, { "type": { - "label": "for", - "keyword": "for", + "label": "this", + "keyword": "this", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, - "isLoop": true, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "for", - "start": 995, - "end": 998, + "value": "this", + "start": 2220, + "end": 2224, "loc": { "start": { - "line": 55, + "line": 92, "column": 3 }, "end": { - "line": 55, - "column": 6 + "line": 92, + "column": 7 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 999, - "end": 1000, + "start": 2224, + "end": 2225, "loc": { "start": { - "line": 55, + "line": 92, "column": 7 }, "end": { - "line": 55, + "line": 92, "column": 8 } } }, { "type": { - "label": "let", - "keyword": "let", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "let", - "start": 1000, - "end": 1003, + "value": "components", + "start": 2225, + "end": 2235, "loc": { "start": { - "line": 55, + "line": 92, "column": 8 }, "end": { - "line": 55, - "column": 11 + "line": 92, + "column": 18 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "[", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "componentName", - "start": 1004, - "end": 1017, + "start": 2235, + "end": 2236, "loc": { "start": { - "line": 55, - "column": 12 + "line": 92, + "column": 18 }, "end": { - "line": 55, - "column": 25 + "line": 92, + "column": 19 } } }, { "type": { - "label": "in", - "keyword": "in", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, - "updateContext": null + "binop": null }, - "value": "in", - "start": 1018, - "end": 1020, + "value": "name", + "start": 2236, + "end": 2240, "loc": { "start": { - "line": 55, - "column": 26 + "line": 92, + "column": 19 }, "end": { - "line": 55, - "column": 28 + "line": 92, + "column": 23 } } }, { "type": { - "label": "name", + "label": "]", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "entity", - "start": 1021, - "end": 1027, + "start": 2240, + "end": 2241, "loc": { "start": { - "line": 55, - "column": 29 + "line": 92, + "column": 23 }, "end": { - "line": 55, - "column": 35 + "line": 92, + "column": 24 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 1027, - "end": 1028, + "value": "=", + "start": 2242, + "end": 2243, "loc": { "start": { - "line": 55, - "column": 35 + "line": 92, + "column": 25 }, "end": { - "line": 55, - "column": 36 + "line": 92, + "column": 26 } } }, @@ -13197,49 +15761,52 @@ "postfix": false, "binop": null }, - "value": "data", - "start": 1028, - "end": 1032, + "value": "componentClass", + "start": 2244, + "end": 2258, "loc": { "start": { - "line": 55, - "column": 36 + "line": 92, + "column": 27 }, "end": { - "line": 55, - "column": 40 + "line": 92, + "column": 41 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1032, - "end": 1033, + "value": "return", + "start": 2262, + "end": 2268, "loc": { "start": { - "line": 55, - "column": 40 + "line": 93, + "column": 3 }, "end": { - "line": 55, - "column": 41 + "line": 93, + "column": 9 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -13248,39 +15815,23 @@ "postfix": false, "binop": null }, - "start": 1034, - "end": 1035, - "loc": { - "start": { - "line": 55, - "column": 42 - }, - "end": { - "line": 55, - "column": 43 - } - } - }, - { - "type": "CommentLine", - "value": " Get component, and call onRemove if it exists as a function", - "start": 1040, - "end": 1102, + "value": "name", + "start": 2269, + "end": 2273, "loc": { "start": { - "line": 56, - "column": 4 + "line": 93, + "column": 10 }, "end": { - "line": 56, - "column": 66 + "line": 93, + "column": 14 } } }, { "type": { - "label": "let", - "keyword": "let", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -13288,28 +15839,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "let", - "start": 1107, - "end": 1110, + "start": 2276, + "end": 2277, "loc": { "start": { - "line": 57, - "column": 4 + "line": 94, + "column": 2 }, "end": { - "line": 57, - "column": 7 + "line": 94, + "column": 3 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13317,44 +15866,32 @@ "postfix": false, "binop": null }, - "value": "component", - "start": 1111, - "end": 1120, + "start": 2279, + "end": 2280, "loc": { "start": { - "line": 57, - "column": 8 + "line": 95, + "column": 1 }, "end": { - "line": 57, - "column": 17 + "line": 95, + "column": 2 } } }, { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1121, - "end": 1122, + "type": "CommentBlock", + "value": "*\n\t * Creates a new entity in the world\n\t *\n\t * @param {string} [name] - The prototype name to use\n\t *\n\t * @example\n\t * world.entity()\n\t *\n\t * @example\n\t * world.entity('Player')\n\t *\n\t * @return {Entity} The new entity created\n\t ", + "start": 2283, + "end": 2516, "loc": { "start": { - "line": 57, - "column": 18 + "line": 97, + "column": 1 }, "end": { - "line": 57, - "column": 19 + "line": 109, + "column": 4 } } }, @@ -13371,42 +15908,41 @@ "binop": null }, "value": "entity", - "start": 1123, - "end": 1129, + "start": 2518, + "end": 2524, "loc": { "start": { - "line": 57, - "column": 20 + "line": 110, + "column": 1 }, "end": { - "line": 57, - "column": 26 + "line": 110, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1129, - "end": 1130, + "start": 2524, + "end": 2525, "loc": { "start": { - "line": 57, - "column": 26 + "line": 110, + "column": 7 }, "end": { - "line": 57, - "column": 27 + "line": 110, + "column": 8 } } }, @@ -13422,50 +15958,49 @@ "postfix": false, "binop": null }, - "value": "data", - "start": 1130, - "end": 1134, + "value": "name", + "start": 2525, + "end": 2529, "loc": { "start": { - "line": 57, - "column": 27 + "line": 110, + "column": 8 }, "end": { - "line": 57, - "column": 31 + "line": 110, + "column": 12 } } }, { "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1134, - "end": 1135, + "start": 2529, + "end": 2530, "loc": { "start": { - "line": 57, - "column": 31 + "line": 110, + "column": 12 }, "end": { - "line": 57, - "column": 32 + "line": 110, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -13474,23 +16009,23 @@ "postfix": false, "binop": null }, - "value": "componentName", - "start": 1135, - "end": 1148, + "start": 2531, + "end": 2532, "loc": { "start": { - "line": 57, - "column": 32 + "line": 110, + "column": 14 }, "end": { - "line": 57, - "column": 45 + "line": 110, + "column": 15 } } }, { "type": { - "label": "]", + "label": "let", + "keyword": "let", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -13501,16 +16036,17 @@ "binop": null, "updateContext": null }, - "start": 1148, - "end": 1149, + "value": "let", + "start": 2535, + "end": 2538, "loc": { "start": { - "line": 57, - "column": 45 + "line": 111, + "column": 2 }, "end": { - "line": 57, - "column": 46 + "line": 111, + "column": 5 } } }, @@ -13526,48 +16062,51 @@ "postfix": false, "binop": null }, - "value": "invoke", - "start": 1154, - "end": 1160, + "value": "entityId", + "start": 2539, + "end": 2547, "loc": { "start": { - "line": 58, - "column": 4 + "line": 111, + "column": 6 }, "end": { - "line": 58, - "column": 10 + "line": 111, + "column": 14 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1160, - "end": 1161, + "value": "=", + "start": 2548, + "end": 2549, "loc": { "start": { - "line": 58, - "column": 10 + "line": 111, + "column": 15 }, "end": { - "line": 58, - "column": 11 + "line": 111, + "column": 16 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13575,26 +16114,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "component", - "start": 1161, - "end": 1170, + "value": "this", + "start": 2550, + "end": 2554, "loc": { "start": { - "line": 58, - "column": 11 + "line": 111, + "column": 17 }, "end": { - "line": 58, - "column": 20 + "line": 111, + "column": 21 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -13604,22 +16144,22 @@ "binop": null, "updateContext": null }, - "start": 1170, - "end": 1171, + "start": 2554, + "end": 2555, "loc": { "start": { - "line": 58, - "column": 20 + "line": 111, + "column": 21 }, "end": { - "line": 58, - "column": 21 + "line": 111, + "column": 22 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13627,51 +16167,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "onRemove", - "start": 1172, - "end": 1182, + "value": "idCounter", + "start": 2555, + "end": 2564, "loc": { "start": { - "line": 58, + "line": 111, "column": 22 }, "end": { - "line": 58, - "column": 32 + "line": 111, + "column": 31 } } }, { "type": { - "label": ")", + "label": "++/--", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": false, - "postfix": false, + "prefix": true, + "postfix": true, "binop": null }, - "start": 1182, - "end": 1183, + "value": "++", + "start": 2564, + "end": 2566, "loc": { "start": { - "line": 58, - "column": 32 + "line": 111, + "column": 31 }, "end": { - "line": 58, + "line": 111, "column": 33 } } }, { "type": { - "label": "}", + "label": "let", + "keyword": "let", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -13679,26 +16220,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1187, - "end": 1188, + "value": "let", + "start": 2569, + "end": 2572, "loc": { "start": { - "line": 59, - "column": 3 + "line": 112, + "column": 2 }, "end": { - "line": 59, - "column": 4 + "line": 112, + "column": 5 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13706,68 +16249,53 @@ "postfix": false, "binop": null }, - "start": 1191, - "end": 1192, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 3 - } - } - }, - { - "type": "CommentLine", - "value": " Clear entities", - "start": 1196, - "end": 1213, + "value": "entity", + "start": 2573, + "end": 2579, "loc": { "start": { - "line": 62, - "column": 2 + "line": 112, + "column": 6 }, "end": { - "line": 62, - "column": 19 + "line": 112, + "column": 12 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "this", - "start": 1216, - "end": 1220, + "value": "=", + "start": 2580, + "end": 2581, "loc": { "start": { - "line": 63, - "column": 2 + "line": 112, + "column": 13 }, "end": { - "line": 63, - "column": 6 + "line": 112, + "column": 14 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "new", + "keyword": "new", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13776,16 +16304,17 @@ "binop": null, "updateContext": null }, - "start": 1220, - "end": 1221, + "value": "new", + "start": 2582, + "end": 2585, "loc": { "start": { - "line": 63, - "column": 6 + "line": 112, + "column": 15 }, "end": { - "line": 63, - "column": 7 + "line": 112, + "column": 18 } } }, @@ -13801,52 +16330,50 @@ "postfix": false, "binop": null }, - "value": "entities", - "start": 1221, - "end": 1229, + "value": "Entity", + "start": 2586, + "end": 2592, "loc": { "start": { - "line": 63, - "column": 7 + "line": 112, + "column": 19 }, "end": { - "line": 63, - "column": 15 + "line": 112, + "column": 25 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 1230, - "end": 1231, + "start": 2592, + "end": 2593, "loc": { "start": { - "line": 63, - "column": 16 + "line": 112, + "column": 25 }, "end": { - "line": 63, - "column": 17 + "line": 112, + "column": 26 } } }, { "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, + "label": "this", + "keyword": "this", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -13856,50 +16383,50 @@ "binop": null, "updateContext": null }, - "value": "new", - "start": 1232, - "end": 1235, + "value": "this", + "start": 2593, + "end": 2597, "loc": { "start": { - "line": 63, - "column": 18 + "line": 112, + "column": 26 }, "end": { - "line": 63, - "column": 21 + "line": 112, + "column": 30 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ",", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Map", - "start": 1236, - "end": 1239, + "start": 2597, + "end": 2598, "loc": { "start": { - "line": 63, - "column": 22 + "line": 112, + "column": 30 }, "end": { - "line": 63, - "column": 25 + "line": 112, + "column": 31 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -13908,16 +16435,17 @@ "postfix": false, "binop": null }, - "start": 1239, - "end": 1240, + "value": "entityId", + "start": 2599, + "end": 2607, "loc": { "start": { - "line": 63, - "column": 25 + "line": 112, + "column": 32 }, "end": { - "line": 63, - "column": 26 + "line": 112, + "column": 40 } } }, @@ -13933,25 +16461,41 @@ "postfix": false, "binop": null }, - "start": 1240, - "end": 1241, + "start": 2607, + "end": 2608, + "loc": { + "start": { + "line": 112, + "column": 40 + }, + "end": { + "line": 112, + "column": 41 + } + } + }, + { + "type": "CommentLine", + "value": " Use 'name' to get prototype data (if specified)", + "start": 2612, + "end": 2662, "loc": { "start": { - "line": 63, - "column": 26 + "line": 114, + "column": 2 }, "end": { - "line": 63, - "column": 27 + "line": 114, + "column": 52 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13960,43 +16504,42 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 1244, - "end": 1248, + "value": "if", + "start": 2665, + "end": 2667, "loc": { "start": { - "line": 64, + "line": 115, "column": 2 }, "end": { - "line": 64, - "column": 6 + "line": 115, + "column": 4 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1248, - "end": 1249, + "start": 2668, + "end": 2669, "loc": { "start": { - "line": 64, - "column": 6 + "line": 115, + "column": 5 }, "end": { - "line": 64, - "column": 7 + "line": 115, + "column": 6 } } }, @@ -14012,42 +16555,43 @@ "postfix": false, "binop": null }, - "value": "index", - "start": 1249, - "end": 1254, + "value": "name", + "start": 2669, + "end": 2673, "loc": { "start": { - "line": 64, - "column": 7 + "line": 115, + "column": 6 }, "end": { - "line": 64, - "column": 12 + "line": 115, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "&&", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 2, "updateContext": null }, - "start": 1254, - "end": 1255, + "value": "&&", + "start": 2674, + "end": 2676, "loc": { "start": { - "line": 64, - "column": 12 + "line": 115, + "column": 11 }, "end": { - "line": 64, + "line": 115, "column": 13 } } @@ -14064,42 +16608,45 @@ "postfix": false, "binop": null }, - "value": "clear", - "start": 1255, - "end": 1260, + "value": "name", + "start": 2677, + "end": 2681, "loc": { "start": { - "line": 64, - "column": 13 + "line": 115, + "column": 14 }, "end": { - "line": 64, + "line": 115, "column": 18 } } }, { "type": { - "label": "(", + "label": "in", + "keyword": "in", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 1260, - "end": 1261, + "value": "in", + "start": 2682, + "end": 2684, "loc": { "start": { - "line": 64, - "column": 18 + "line": 115, + "column": 19 }, "end": { - "line": 64, - "column": 19 + "line": 115, + "column": 21 } } }, @@ -14118,16 +16665,16 @@ "updateContext": null }, "value": "this", - "start": 1261, - "end": 1265, + "start": 2685, + "end": 2689, "loc": { "start": { - "line": 64, - "column": 19 + "line": 115, + "column": 22 }, "end": { - "line": 64, - "column": 23 + "line": 115, + "column": 26 } } }, @@ -14144,16 +16691,16 @@ "binop": null, "updateContext": null }, - "start": 1265, - "end": 1266, + "start": 2689, + "end": 2690, "loc": { "start": { - "line": 64, - "column": 23 + "line": 115, + "column": 26 }, "end": { - "line": 64, - "column": 24 + "line": 115, + "column": 27 } } }, @@ -14169,17 +16716,17 @@ "postfix": false, "binop": null }, - "value": "entities", - "start": 1266, - "end": 1274, + "value": "entityTemplates", + "start": 2690, + "end": 2705, "loc": { "start": { - "line": 64, - "column": 24 + "line": 115, + "column": 27 }, "end": { - "line": 64, - "column": 32 + "line": 115, + "column": 42 } } }, @@ -14195,24 +16742,24 @@ "postfix": false, "binop": null }, - "start": 1274, - "end": 1275, + "start": 2705, + "end": 2706, "loc": { "start": { - "line": 64, - "column": 32 + "line": 115, + "column": 42 }, "end": { - "line": 64, - "column": 33 + "line": 115, + "column": 43 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14220,83 +16767,60 @@ "postfix": false, "binop": null }, - "start": 1277, - "end": 1278, + "start": 2707, + "end": 2708, "loc": { "start": { - "line": 65, - "column": 1 + "line": 115, + "column": 44 }, "end": { - "line": 65, - "column": 2 + "line": 115, + "column": 45 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Registers a component type to the world. Components must be constructable. They are passed the entity first,\n\t * then the rest of the arguments from methods like entity.set(). Components also can have an onRemove() method.\n\t *\n\t * @param {string} name - The name\n\t * @param {function} componentClass - The component class, must be a constructable class or function\n\t *\n\t * @example\n\t * world.component('myComponent', class {\n\t * constructor(entity, some, args) {\n\t * this.entity = entity\n\t * this.some = some\n\t * this.args = args\n\t * }\n\t * })\n\t * // entity === the new entity object\n\t * // some === 10\n\t * // args === 500\n\t * world.entity().set('myComponent', 10, 500)\n\t *\n\t * @return {string} Registered component name on success, undefined on failure\n\t ", - "start": 1281, - "end": 2090, + "type": "CommentLine", + "value": " Add all components from prototype", + "start": 2712, + "end": 2748, "loc": { "start": { - "line": 67, - "column": 1 + "line": 116, + "column": 3 }, "end": { - "line": 88, - "column": 4 + "line": 116, + "column": 39 } } }, { "type": { - "label": "name", + "label": "let", + "keyword": "let", "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "component", - "start": 2092, - "end": 2101, - "loc": { - "start": { - "line": 89, - "column": 1 - }, - "end": { - "line": 89, - "column": 10 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2101, - "end": 2102, + "value": "let", + "start": 2752, + "end": 2755, "loc": { "start": { - "line": 89, - "column": 10 + "line": 117, + "column": 3 }, "end": { - "line": 89, - "column": 11 + "line": 117, + "column": 6 } } }, @@ -14312,49 +16836,51 @@ "postfix": false, "binop": null }, - "value": "name", - "start": 2102, - "end": 2106, + "value": "template", + "start": 2756, + "end": 2764, "loc": { "start": { - "line": 89, - "column": 11 + "line": 117, + "column": 7 }, "end": { - "line": 89, + "line": 117, "column": 15 } } }, { "type": { - "label": ",", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 2106, - "end": 2107, + "value": "=", + "start": 2765, + "end": 2766, "loc": { "start": { - "line": 89, - "column": 15 + "line": 117, + "column": 16 }, "end": { - "line": 89, - "column": 16 + "line": 117, + "column": 17 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -14362,25 +16888,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "componentClass", - "start": 2108, - "end": 2122, + "value": "this", + "start": 2767, + "end": 2771, "loc": { "start": { - "line": 89, - "column": 17 + "line": 117, + "column": 18 }, "end": { - "line": 89, - "column": 31 + "line": 117, + "column": 22 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14388,25 +16915,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2122, - "end": 2123, + "start": 2771, + "end": 2772, "loc": { "start": { - "line": 89, - "column": 31 + "line": 117, + "column": 22 }, "end": { - "line": 89, - "column": 32 + "line": 117, + "column": 23 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14415,41 +16943,25 @@ "postfix": false, "binop": null }, - "start": 2124, - "end": 2125, - "loc": { - "start": { - "line": 89, - "column": 33 - }, - "end": { - "line": 89, - "column": 34 - } - } - }, - { - "type": "CommentLine", - "value": " Only allow functions and classes to be components", - "start": 2128, - "end": 2180, + "value": "entityTemplates", + "start": 2772, + "end": 2787, "loc": { "start": { - "line": 90, - "column": 2 + "line": 117, + "column": 23 }, "end": { - "line": 90, - "column": 54 + "line": 117, + "column": 38 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, + "label": "[", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14458,24 +16970,23 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 2183, - "end": 2185, + "start": 2787, + "end": 2788, "loc": { "start": { - "line": 91, - "column": 2 + "line": 117, + "column": 38 }, "end": { - "line": 91, - "column": 4 + "line": 117, + "column": 39 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14484,74 +16995,78 @@ "postfix": false, "binop": null }, - "start": 2186, - "end": 2187, + "value": "name", + "start": 2788, + "end": 2792, "loc": { "start": { - "line": 91, - "column": 5 + "line": 117, + "column": 39 }, "end": { - "line": 91, - "column": 6 + "line": 117, + "column": 43 } } }, { "type": { - "label": "name", + "label": "]", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isFunction", - "start": 2187, - "end": 2197, + "start": 2792, + "end": 2793, "loc": { "start": { - "line": 91, - "column": 6 + "line": 117, + "column": 43 }, "end": { - "line": 91, - "column": 16 + "line": 117, + "column": 44 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "for", + "keyword": "for", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, - "isLoop": false, + "isLoop": true, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2197, - "end": 2198, + "value": "for", + "start": 2797, + "end": 2800, "loc": { "start": { - "line": 91, - "column": 16 + "line": 118, + "column": 3 }, "end": { - "line": 91, - "column": 17 + "line": 118, + "column": 6 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14560,23 +17075,23 @@ "postfix": false, "binop": null }, - "value": "componentClass", - "start": 2198, - "end": 2212, + "start": 2801, + "end": 2802, "loc": { "start": { - "line": 91, - "column": 17 + "line": 118, + "column": 7 }, "end": { - "line": 91, - "column": 31 + "line": 118, + "column": 8 } } }, { "type": { - "label": ")", + "label": "let", + "keyword": "let", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14584,26 +17099,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2212, - "end": 2213, + "value": "let", + "start": 2802, + "end": 2805, "loc": { "start": { - "line": 91, - "column": 31 + "line": 118, + "column": 8 }, "end": { - "line": 91, - "column": 32 + "line": 118, + "column": 11 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14611,48 +17128,51 @@ "postfix": false, "binop": null }, - "start": 2213, - "end": 2214, + "value": "componentName", + "start": 2806, + "end": 2819, "loc": { "start": { - "line": 91, - "column": 32 + "line": 118, + "column": 12 }, "end": { - "line": 91, - "column": 33 + "line": 118, + "column": 25 } } }, { "type": { - "label": "{", + "label": "in", + "keyword": "in", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 2215, - "end": 2216, + "value": "in", + "start": 2820, + "end": 2822, "loc": { "start": { - "line": 91, - "column": 34 + "line": 118, + "column": 26 }, "end": { - "line": 91, - "column": 35 + "line": 118, + "column": 28 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -14660,26 +17180,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 2220, - "end": 2224, + "value": "template", + "start": 2823, + "end": 2831, "loc": { "start": { - "line": 92, - "column": 3 + "line": 118, + "column": 29 }, "end": { - "line": 92, - "column": 7 + "line": 118, + "column": 37 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14687,26 +17206,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2224, - "end": 2225, + "start": 2831, + "end": 2832, "loc": { "start": { - "line": 92, - "column": 7 + "line": 118, + "column": 37 }, "end": { - "line": 92, - "column": 8 + "line": 118, + "column": 38 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14715,94 +17233,85 @@ "postfix": false, "binop": null }, - "value": "components", - "start": 2225, - "end": 2235, + "start": 2833, + "end": 2834, "loc": { "start": { - "line": 92, - "column": 8 + "line": 118, + "column": 39 }, "end": { - "line": 92, - "column": 18 + "line": 118, + "column": 40 } } }, { - "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 2235, - "end": 2236, + "type": "CommentLine", + "value": " Update component with data from template", + "start": 2839, + "end": 2882, "loc": { "start": { - "line": 92, - "column": 18 + "line": 119, + "column": 4 }, "end": { - "line": 92, - "column": 19 + "line": 119, + "column": 47 } } }, { "type": { - "label": "name", + "label": "let", + "keyword": "let", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "name", - "start": 2236, - "end": 2240, + "value": "let", + "start": 2887, + "end": 2890, "loc": { "start": { - "line": 92, - "column": 19 + "line": 120, + "column": 4 }, "end": { - "line": 92, - "column": 23 + "line": 120, + "column": 7 } } }, { "type": { - "label": "]", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2240, - "end": 2241, + "value": "newComponentData", + "start": 2891, + "end": 2907, "loc": { "start": { - "line": 92, - "column": 23 + "line": 120, + "column": 8 }, "end": { - "line": 92, + "line": 120, "column": 24 } } @@ -14821,15 +17330,15 @@ "updateContext": null }, "value": "=", - "start": 2242, - "end": 2243, + "start": 2908, + "end": 2909, "loc": { "start": { - "line": 92, + "line": 120, "column": 25 }, "end": { - "line": 92, + "line": 120, "column": 26 } } @@ -14846,25 +17355,24 @@ "postfix": false, "binop": null }, - "value": "componentClass", - "start": 2244, - "end": 2258, + "value": "JSON", + "start": 2910, + "end": 2914, "loc": { "start": { - "line": 92, + "line": 120, "column": 27 }, "end": { - "line": 92, - "column": 41 + "line": 120, + "column": 31 } } }, { "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -14874,17 +17382,16 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 2262, - "end": 2268, + "start": 2914, + "end": 2915, "loc": { "start": { - "line": 93, - "column": 3 + "line": 120, + "column": 31 }, "end": { - "line": 93, - "column": 9 + "line": 120, + "column": 32 } } }, @@ -14900,25 +17407,25 @@ "postfix": false, "binop": null }, - "value": "name", - "start": 2269, - "end": 2273, + "value": "parse", + "start": 2915, + "end": 2920, "loc": { "start": { - "line": 93, - "column": 10 + "line": 120, + "column": 32 }, "end": { - "line": 93, - "column": 14 + "line": 120, + "column": 37 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14926,24 +17433,24 @@ "postfix": false, "binop": null }, - "start": 2276, - "end": 2277, + "start": 2920, + "end": 2921, "loc": { "start": { - "line": 94, - "column": 2 + "line": 120, + "column": 37 }, "end": { - "line": 94, - "column": 3 + "line": 120, + "column": 38 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14951,32 +17458,43 @@ "postfix": false, "binop": null }, - "start": 2279, - "end": 2280, + "value": "template", + "start": 2921, + "end": 2929, "loc": { "start": { - "line": 95, - "column": 1 + "line": 120, + "column": 38 }, "end": { - "line": 95, - "column": 2 + "line": 120, + "column": 46 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Creates a new entity in the world\n\t *\n\t * @param {string} [name] - The prototype name to use\n\t *\n\t * @example\n\t * world.entity()\n\t *\n\t * @example\n\t * world.entity('Player')\n\t *\n\t * @return {Entity} The new entity created\n\t ", - "start": 2283, - "end": 2516, + "type": { + "label": "[", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2929, + "end": 2930, "loc": { "start": { - "line": 97, - "column": 1 + "line": 120, + "column": 46 }, "end": { - "line": 109, - "column": 4 + "line": 120, + "column": 47 } } }, @@ -14992,25 +17510,51 @@ "postfix": false, "binop": null }, - "value": "entity", - "start": 2518, - "end": 2524, + "value": "componentName", + "start": 2930, + "end": 2943, "loc": { "start": { - "line": 110, - "column": 1 + "line": 120, + "column": 47 + }, + "end": { + "line": 120, + "column": 60 + } + } + }, + { + "type": { + "label": "]", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2943, + "end": 2944, + "loc": { + "start": { + "line": 120, + "column": 60 }, "end": { - "line": 110, - "column": 7 + "line": 120, + "column": 61 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15018,16 +17562,16 @@ "postfix": false, "binop": null }, - "start": 2524, - "end": 2525, + "start": 2944, + "end": 2945, "loc": { "start": { - "line": 110, - "column": 7 + "line": 120, + "column": 61 }, "end": { - "line": 110, - "column": 8 + "line": 120, + "column": 62 } } }, @@ -15043,23 +17587,23 @@ "postfix": false, "binop": null }, - "value": "name", - "start": 2525, - "end": 2529, + "value": "entity", + "start": 2950, + "end": 2956, "loc": { "start": { - "line": 110, - "column": 8 + "line": 121, + "column": 4 }, "end": { - "line": 110, - "column": 12 + "line": 121, + "column": 10 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -15067,25 +17611,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2529, - "end": 2530, + "start": 2956, + "end": 2957, "loc": { "start": { - "line": 110, - "column": 12 + "line": 121, + "column": 10 }, "end": { - "line": 110, - "column": 13 + "line": 121, + "column": 11 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -15094,44 +17639,42 @@ "postfix": false, "binop": null }, - "start": 2531, - "end": 2532, + "value": "update", + "start": 2957, + "end": 2963, "loc": { "start": { - "line": 110, - "column": 14 + "line": 121, + "column": 11 }, "end": { - "line": 110, - "column": 15 + "line": 121, + "column": 17 } } }, { "type": { - "label": "let", - "keyword": "let", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "let", - "start": 2535, - "end": 2538, + "start": 2963, + "end": 2964, "loc": { "start": { - "line": 111, - "column": 2 + "line": 121, + "column": 17 }, "end": { - "line": 111, - "column": 5 + "line": 121, + "column": 18 } } }, @@ -15147,51 +17690,49 @@ "postfix": false, "binop": null }, - "value": "entityId", - "start": 2539, - "end": 2547, + "value": "componentName", + "start": 2964, + "end": 2977, "loc": { "start": { - "line": 111, - "column": 6 + "line": 121, + "column": 18 }, "end": { - "line": 111, - "column": 14 + "line": 121, + "column": 31 } } }, { "type": { - "label": "=", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 2548, - "end": 2549, + "start": 2977, + "end": 2978, "loc": { "start": { - "line": 111, - "column": 15 + "line": 121, + "column": 31 }, "end": { - "line": 111, - "column": 16 + "line": 121, + "column": 32 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -15199,26 +17740,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 2550, - "end": 2554, + "value": "newComponentData", + "start": 2979, + "end": 2995, "loc": { "start": { - "line": 111, - "column": 17 + "line": 121, + "column": 33 }, "end": { - "line": 111, - "column": 21 + "line": 121, + "column": 49 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -15226,27 +17766,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2554, - "end": 2555, + "start": 2995, + "end": 2996, "loc": { "start": { - "line": 111, - "column": 21 + "line": 121, + "column": 49 }, "end": { - "line": 111, - "column": 22 + "line": 121, + "column": 50 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15254,52 +17793,50 @@ "postfix": false, "binop": null }, - "value": "idCounter", - "start": 2555, - "end": 2564, + "start": 3000, + "end": 3001, "loc": { "start": { - "line": 111, - "column": 22 + "line": 122, + "column": 3 }, "end": { - "line": 111, - "column": 31 + "line": 122, + "column": 4 } } }, { "type": { - "label": "++/--", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, - "postfix": true, + "prefix": false, + "postfix": false, "binop": null }, - "value": "++", - "start": 2564, - "end": 2566, + "start": 3004, + "end": 3005, "loc": { "start": { - "line": 111, - "column": 31 + "line": 123, + "column": 2 }, "end": { - "line": 111, - "column": 33 + "line": 123, + "column": 3 } } }, { "type": { - "label": "let", - "keyword": "let", + "label": "this", + "keyword": "this", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15308,79 +17845,77 @@ "binop": null, "updateContext": null }, - "value": "let", - "start": 2569, - "end": 2572, + "value": "this", + "start": 3009, + "end": 3013, "loc": { "start": { - "line": 112, + "line": 125, "column": 2 }, "end": { - "line": 112, - "column": 5 + "line": 125, + "column": 6 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "entity", - "start": 2573, - "end": 2579, + "start": 3013, + "end": 3014, "loc": { "start": { - "line": 112, + "line": 125, "column": 6 }, "end": { - "line": 112, - "column": 12 + "line": 125, + "column": 7 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 2580, - "end": 2581, + "value": "entities", + "start": 3014, + "end": 3022, "loc": { "start": { - "line": 112, - "column": 13 + "line": 125, + "column": 7 }, "end": { - "line": 112, - "column": 14 + "line": 125, + "column": 15 } } }, { "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15389,17 +17924,16 @@ "binop": null, "updateContext": null }, - "value": "new", - "start": 2582, - "end": 2585, + "start": 3022, + "end": 3023, "loc": { "start": { - "line": 112, + "line": 125, "column": 15 }, "end": { - "line": 112, - "column": 18 + "line": 125, + "column": 16 } } }, @@ -15415,17 +17949,17 @@ "postfix": false, "binop": null }, - "value": "Entity", - "start": 2586, - "end": 2592, + "value": "set", + "start": 3023, + "end": 3026, "loc": { "start": { - "line": 112, - "column": 19 + "line": 125, + "column": 16 }, "end": { - "line": 112, - "column": 25 + "line": 125, + "column": 19 } } }, @@ -15441,23 +17975,22 @@ "postfix": false, "binop": null }, - "start": 2592, - "end": 2593, + "start": 3026, + "end": 3027, "loc": { "start": { - "line": 112, - "column": 25 + "line": 125, + "column": 19 }, "end": { - "line": 112, - "column": 26 + "line": 125, + "column": 20 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -15465,20 +17998,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 2593, - "end": 2597, + "value": "entityId", + "start": 3027, + "end": 3035, "loc": { "start": { - "line": 112, - "column": 26 + "line": 125, + "column": 20 }, "end": { - "line": 112, - "column": 30 + "line": 125, + "column": 28 } } }, @@ -15495,16 +18027,16 @@ "binop": null, "updateContext": null }, - "start": 2597, - "end": 2598, + "start": 3035, + "end": 3036, "loc": { "start": { - "line": 112, - "column": 30 + "line": 125, + "column": 28 }, "end": { - "line": 112, - "column": 31 + "line": 125, + "column": 29 } } }, @@ -15520,17 +18052,17 @@ "postfix": false, "binop": null }, - "value": "entityId", - "start": 2599, - "end": 2607, + "value": "entity", + "start": 3037, + "end": 3043, "loc": { "start": { - "line": 112, - "column": 32 + "line": 125, + "column": 30 }, "end": { - "line": 112, - "column": 40 + "line": 125, + "column": 36 } } }, @@ -15546,40 +18078,24 @@ "postfix": false, "binop": null }, - "start": 2607, - "end": 2608, - "loc": { - "start": { - "line": 112, - "column": 40 - }, - "end": { - "line": 112, - "column": 41 - } - } - }, - { - "type": "CommentLine", - "value": " Use 'name' to get prototype data (if specified)", - "start": 2612, - "end": 2662, + "start": 3043, + "end": 3044, "loc": { "start": { - "line": 114, - "column": 2 + "line": 125, + "column": 36 }, "end": { - "line": 114, - "column": 52 + "line": 125, + "column": 37 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -15589,24 +18105,24 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 2665, - "end": 2667, + "value": "return", + "start": 3047, + "end": 3053, "loc": { "start": { - "line": 115, + "line": 126, "column": 2 }, "end": { - "line": 115, - "column": 4 + "line": 126, + "column": 8 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -15615,24 +18131,25 @@ "postfix": false, "binop": null }, - "start": 2668, - "end": 2669, + "value": "entity", + "start": 3054, + "end": 3060, "loc": { "start": { - "line": 115, - "column": 5 + "line": 126, + "column": 9 }, "end": { - "line": 115, - "column": 6 + "line": 126, + "column": 15 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15640,44 +18157,32 @@ "postfix": false, "binop": null }, - "value": "name", - "start": 2669, - "end": 2673, + "start": 3062, + "end": 3063, "loc": { "start": { - "line": 115, - "column": 6 + "line": 127, + "column": 1 }, "end": { - "line": 115, - "column": 10 + "line": 127, + "column": 2 } } }, { - "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 2, - "updateContext": null - }, - "value": "&&", - "start": 2674, - "end": 2676, + "type": "CommentBlock", + "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * constructor(context) {\n\t * // This is showing how you can optionally pass parameters to the system's constructor\n\t * this.context = context\n\t * }\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * }, context)\n\t *\n\t * @example\n\t * // System that doesn't use every()\n\t * world.system(class {\n\t * constructor(context) {\n\t * this.context = context\n\t * }\n\t * pre() {\n\t * // Handle events or something\n\t * }\n\t * }, context)\n\t *\n\t * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).\n\t *\n\t * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t *\n\t * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.\n\t *\n\t * **[...args]**: The arguments to forward to the system's constructors.\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", + "start": 3066, + "end": 4560, "loc": { "start": { - "line": 115, - "column": 11 + "line": 129, + "column": 1 }, "end": { - "line": 115, - "column": 13 + "line": 166, + "column": 4 } } }, @@ -15693,80 +18198,49 @@ "postfix": false, "binop": null }, - "value": "name", - "start": 2677, - "end": 2681, + "value": "system", + "start": 4562, + "end": 4568, "loc": { "start": { - "line": 115, - "column": 14 + "line": 167, + "column": 1 }, "end": { - "line": 115, - "column": 18 + "line": 167, + "column": 7 } } }, { "type": { - "label": "in", - "keyword": "in", + "label": "(", "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "in", - "start": 2682, - "end": 2684, - "loc": { - "start": { - "line": 115, - "column": 19 - }, - "end": { - "line": 115, - "column": 21 - } - } - }, - { - "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 2685, - "end": 2689, + "start": 4568, + "end": 4569, "loc": { "start": { - "line": 115, - "column": 22 + "line": 167, + "column": 7 }, "end": { - "line": 115, - "column": 26 + "line": 167, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "...", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -15776,16 +18250,16 @@ "binop": null, "updateContext": null }, - "start": 2689, - "end": 2690, + "start": 4569, + "end": 4572, "loc": { "start": { - "line": 115, - "column": 26 + "line": 167, + "column": 8 }, "end": { - "line": 115, - "column": 27 + "line": 167, + "column": 11 } } }, @@ -15801,17 +18275,17 @@ "postfix": false, "binop": null }, - "value": "entityTemplates", - "start": 2690, - "end": 2705, + "value": "args", + "start": 4572, + "end": 4576, "loc": { "start": { - "line": 115, - "column": 27 + "line": 167, + "column": 11 }, "end": { - "line": 115, - "column": 42 + "line": 167, + "column": 15 } } }, @@ -15827,16 +18301,16 @@ "postfix": false, "binop": null }, - "start": 2705, - "end": 2706, + "start": 4576, + "end": 4577, "loc": { "start": { - "line": 115, - "column": 42 + "line": 167, + "column": 15 }, "end": { - "line": 115, - "column": 43 + "line": 167, + "column": 16 } } }, @@ -15852,32 +18326,32 @@ "postfix": false, "binop": null }, - "start": 2707, - "end": 2708, + "start": 4578, + "end": 4579, "loc": { "start": { - "line": 115, - "column": 44 + "line": 167, + "column": 17 }, "end": { - "line": 115, - "column": 45 + "line": 167, + "column": 18 } } }, { "type": "CommentLine", - "value": " Add all components from prototype", - "start": 2712, - "end": 2748, + "value": " Get components and systemClass from arguments", + "start": 4582, + "end": 4630, "loc": { "start": { - "line": 116, - "column": 3 + "line": 168, + "column": 2 }, "end": { - "line": 116, - "column": 39 + "line": 168, + "column": 50 } } }, @@ -15896,16 +18370,16 @@ "updateContext": null }, "value": "let", - "start": 2752, - "end": 2755, + "start": 4633, + "end": 4636, "loc": { "start": { - "line": 117, - "column": 3 + "line": 169, + "column": 2 }, "end": { - "line": 117, - "column": 6 + "line": 169, + "column": 5 } } }, @@ -15921,17 +18395,17 @@ "postfix": false, "binop": null }, - "value": "template", - "start": 2756, - "end": 2764, + "value": "components", + "start": 4637, + "end": 4647, "loc": { "start": { - "line": 117, - "column": 7 + "line": 169, + "column": 6 }, "end": { - "line": 117, - "column": 15 + "line": 169, + "column": 16 } } }, @@ -15949,24 +18423,23 @@ "updateContext": null }, "value": "=", - "start": 2765, - "end": 2766, + "start": 4648, + "end": 4649, "loc": { "start": { - "line": 117, - "column": 16 + "line": 169, + "column": 17 }, "end": { - "line": 117, - "column": 17 + "line": 169, + "column": 18 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "[", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -15976,23 +18449,22 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 2767, - "end": 2771, + "start": 4650, + "end": 4651, "loc": { "start": { - "line": 117, - "column": 18 + "line": 169, + "column": 19 }, "end": { - "line": 117, - "column": 22 + "line": 169, + "column": 20 } } }, { "type": { - "label": ".", + "label": "]", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16003,50 +18475,25 @@ "binop": null, "updateContext": null }, - "start": 2771, - "end": 2772, + "start": 4651, + "end": 4652, "loc": { "start": { - "line": 117, - "column": 22 + "line": 169, + "column": 20 }, "end": { - "line": 117, - "column": 23 + "line": 169, + "column": 21 } } }, { "type": { - "label": "name", + "label": "let", + "keyword": "let", "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "entityTemplates", - "start": 2772, - "end": 2787, - "loc": { - "start": { - "line": 117, - "column": 23 - }, - "end": { - "line": 117, - "column": 38 - } - } - }, - { - "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16055,16 +18502,17 @@ "binop": null, "updateContext": null }, - "start": 2787, - "end": 2788, + "value": "let", + "start": 4655, + "end": 4658, "loc": { "start": { - "line": 117, - "column": 38 + "line": 170, + "column": 2 }, "end": { - "line": 117, - "column": 39 + "line": 170, + "column": 5 } } }, @@ -16080,24 +18528,24 @@ "postfix": false, "binop": null }, - "value": "name", - "start": 2788, - "end": 2792, + "value": "systemClass", + "start": 4659, + "end": 4670, "loc": { "start": { - "line": 117, - "column": 39 + "line": 170, + "column": 6 }, "end": { - "line": 117, - "column": 43 + "line": 170, + "column": 17 } } }, { "type": { - "label": "]", - "beforeExpr": false, + "label": ",", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -16107,51 +18555,23 @@ "binop": null, "updateContext": null }, - "start": 2792, - "end": 2793, + "start": 4670, + "end": 4671, "loc": { "start": { - "line": 117, - "column": 43 + "line": 170, + "column": 17 }, "end": { - "line": 117, - "column": 44 + "line": 170, + "column": 18 } } }, { "type": { - "label": "for", - "keyword": "for", + "label": "name", "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": true, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "for", - "start": 2797, - "end": 2800, - "loc": { - "start": { - "line": 118, - "column": 3 - }, - "end": { - "line": 118, - "column": 6 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -16160,23 +18580,24 @@ "postfix": false, "binop": null }, - "start": 2801, - "end": 2802, + "value": "rest", + "start": 4672, + "end": 4676, "loc": { "start": { - "line": 118, - "column": 7 + "line": 170, + "column": 19 }, "end": { - "line": 118, - "column": 8 + "line": 170, + "column": 23 } } }, { "type": { - "label": "let", - "keyword": "let", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16187,24 +18608,24 @@ "binop": null, "updateContext": null }, - "value": "let", - "start": 2802, - "end": 2805, + "value": "if", + "start": 4679, + "end": 4681, "loc": { "start": { - "line": 118, - "column": 8 + "line": 171, + "column": 2 }, "end": { - "line": 118, - "column": 11 + "line": 171, + "column": 4 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -16212,46 +18633,17 @@ "prefix": false, "postfix": false, "binop": null - }, - "value": "componentName", - "start": 2806, - "end": 2819, - "loc": { - "start": { - "line": 118, - "column": 12 - }, - "end": { - "line": 118, - "column": 25 - } - } - }, - { - "type": { - "label": "in", - "keyword": "in", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "in", - "start": 2820, - "end": 2822, + }, + "start": 4682, + "end": 4683, "loc": { "start": { - "line": 118, - "column": 26 + "line": 171, + "column": 5 }, "end": { - "line": 118, - "column": 28 + "line": 171, + "column": 6 } } }, @@ -16267,23 +18659,23 @@ "postfix": false, "binop": null }, - "value": "template", - "start": 2823, - "end": 2831, + "value": "Array", + "start": 4683, + "end": 4688, "loc": { "start": { - "line": 118, - "column": 29 + "line": 171, + "column": 6 }, "end": { - "line": 118, - "column": 37 + "line": 171, + "column": 11 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16291,25 +18683,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2831, - "end": 2832, + "start": 4688, + "end": 4689, "loc": { "start": { - "line": 118, - "column": 37 + "line": 171, + "column": 11 }, "end": { - "line": 118, - "column": 38 + "line": 171, + "column": 12 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -16318,60 +18711,42 @@ "postfix": false, "binop": null }, - "start": 2833, - "end": 2834, - "loc": { - "start": { - "line": 118, - "column": 39 - }, - "end": { - "line": 118, - "column": 40 - } - } - }, - { - "type": "CommentLine", - "value": " Update component with data from template", - "start": 2839, - "end": 2882, + "value": "isArray", + "start": 4689, + "end": 4696, "loc": { "start": { - "line": 119, - "column": 4 + "line": 171, + "column": 12 }, "end": { - "line": 119, - "column": 47 + "line": 171, + "column": 19 } } }, { "type": { - "label": "let", - "keyword": "let", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "let", - "start": 2887, - "end": 2890, + "start": 4696, + "end": 4697, "loc": { "start": { - "line": 120, - "column": 4 + "line": 171, + "column": 19 }, "end": { - "line": 120, - "column": 7 + "line": 171, + "column": 20 } } }, @@ -16387,50 +18762,49 @@ "postfix": false, "binop": null }, - "value": "newComponentData", - "start": 2891, - "end": 2907, + "value": "args", + "start": 4697, + "end": 4701, "loc": { "start": { - "line": 120, - "column": 8 + "line": 171, + "column": 20 }, "end": { - "line": 120, + "line": 171, "column": 24 } } }, { "type": { - "label": "=", + "label": "[", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 2908, - "end": 2909, + "start": 4701, + "end": 4702, "loc": { "start": { - "line": 120, - "column": 25 + "line": 171, + "column": 24 }, "end": { - "line": 120, - "column": 26 + "line": 171, + "column": 25 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16438,25 +18812,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "JSON", - "start": 2910, - "end": 2914, + "value": 0, + "start": 4702, + "end": 4703, "loc": { "start": { - "line": 120, - "column": 27 + "line": 171, + "column": 25 }, "end": { - "line": 120, - "column": 31 + "line": 171, + "column": 26 } } }, { "type": { - "label": ".", + "label": "]", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16467,24 +18842,24 @@ "binop": null, "updateContext": null }, - "start": 2914, - "end": 2915, + "start": 4703, + "end": 4704, "loc": { "start": { - "line": 120, - "column": 31 + "line": 171, + "column": 26 }, "end": { - "line": 120, - "column": 32 + "line": 171, + "column": 27 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16492,25 +18867,24 @@ "postfix": false, "binop": null }, - "value": "parse", - "start": 2915, - "end": 2920, + "start": 4704, + "end": 4705, "loc": { "start": { - "line": 120, - "column": 32 + "line": 171, + "column": 27 }, "end": { - "line": 120, - "column": 37 + "line": 171, + "column": 28 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16518,23 +18892,23 @@ "postfix": false, "binop": null }, - "start": 2920, - "end": 2921, + "start": 4705, + "end": 4706, "loc": { "start": { - "line": 120, - "column": 37 + "line": 171, + "column": 28 }, "end": { - "line": 120, - "column": 38 + "line": 171, + "column": 29 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -16543,126 +18917,127 @@ "postfix": false, "binop": null }, - "value": "template", - "start": 2921, - "end": 2929, + "start": 4707, + "end": 4708, "loc": { "start": { - "line": 120, - "column": 38 + "line": 171, + "column": 30 }, "end": { - "line": 120, - "column": 46 + "line": 171, + "column": 31 } } }, { "type": { - "label": "[", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2929, - "end": 2930, + "value": "components", + "start": 4712, + "end": 4722, "loc": { "start": { - "line": 120, - "column": 46 + "line": 172, + "column": 3 }, "end": { - "line": 120, - "column": 47 + "line": 172, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "componentName", - "start": 2930, - "end": 2943, + "value": "=", + "start": 4723, + "end": 4724, "loc": { "start": { - "line": 120, - "column": 47 + "line": 172, + "column": 14 }, "end": { - "line": 120, - "column": 60 + "line": 172, + "column": 15 } } }, { "type": { - "label": "]", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2943, - "end": 2944, + "value": "args", + "start": 4725, + "end": 4729, "loc": { "start": { - "line": 120, - "column": 60 + "line": 172, + "column": 16 }, "end": { - "line": 120, - "column": 61 + "line": 172, + "column": 20 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "[", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2944, - "end": 2945, + "start": 4729, + "end": 4730, "loc": { "start": { - "line": 120, - "column": 61 + "line": 172, + "column": 20 }, "end": { - "line": 120, - "column": 62 + "line": 172, + "column": 21 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16670,25 +19045,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "entity", - "start": 2950, - "end": 2956, + "value": 0, + "start": 4730, + "end": 4731, "loc": { "start": { - "line": 121, - "column": 4 + "line": 172, + "column": 21 }, "end": { - "line": 121, - "column": 10 + "line": 172, + "column": 22 } } }, { "type": { - "label": ".", + "label": "]", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16699,16 +19075,16 @@ "binop": null, "updateContext": null }, - "start": 2956, - "end": 2957, + "start": 4731, + "end": 4732, "loc": { "start": { - "line": 121, - "column": 10 + "line": 172, + "column": 22 }, "end": { - "line": 121, - "column": 11 + "line": 172, + "column": 23 } } }, @@ -16724,42 +19100,44 @@ "postfix": false, "binop": null }, - "value": "update", - "start": 2957, - "end": 2963, + "value": "systemClass", + "start": 4736, + "end": 4747, "loc": { "start": { - "line": 121, - "column": 11 + "line": 173, + "column": 3 }, "end": { - "line": 121, - "column": 17 + "line": 173, + "column": 14 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2963, - "end": 2964, + "value": "=", + "start": 4748, + "end": 4749, "loc": { "start": { - "line": 121, - "column": 17 + "line": 173, + "column": 15 }, "end": { - "line": 121, - "column": 18 + "line": 173, + "column": 16 } } }, @@ -16775,25 +19153,25 @@ "postfix": false, "binop": null }, - "value": "componentName", - "start": 2964, - "end": 2977, + "value": "args", + "start": 4750, + "end": 4754, "loc": { "start": { - "line": 121, - "column": 18 + "line": 173, + "column": 17 }, "end": { - "line": 121, - "column": 31 + "line": 173, + "column": 21 } } }, { "type": { - "label": ",", + "label": "[", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16802,22 +19180,22 @@ "binop": null, "updateContext": null }, - "start": 2977, - "end": 2978, + "start": 4754, + "end": 4755, "loc": { "start": { - "line": 121, - "column": 31 + "line": 173, + "column": 21 }, "end": { - "line": 121, - "column": 32 + "line": 173, + "column": 22 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16825,25 +19203,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "newComponentData", - "start": 2979, - "end": 2995, + "value": 1, + "start": 4755, + "end": 4756, "loc": { "start": { - "line": 121, - "column": 33 + "line": 173, + "column": 22 }, "end": { - "line": 121, - "column": 49 + "line": 173, + "column": 23 } } }, { "type": { - "label": ")", + "label": "]", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16851,26 +19230,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2995, - "end": 2996, + "start": 4756, + "end": 4757, "loc": { "start": { - "line": 121, - "column": 49 + "line": 173, + "column": 23 }, "end": { - "line": 121, - "column": 50 + "line": 173, + "column": 24 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16878,48 +19258,50 @@ "postfix": false, "binop": null }, - "start": 3000, - "end": 3001, + "value": "rest", + "start": 4761, + "end": 4765, "loc": { "start": { - "line": 122, + "line": 174, "column": 3 }, "end": { - "line": 122, - "column": 4 + "line": 174, + "column": 7 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3004, - "end": 3005, + "value": "=", + "start": 4766, + "end": 4767, "loc": { "start": { - "line": 123, - "column": 2 + "line": 174, + "column": 8 }, "end": { - "line": 123, - "column": 3 + "line": 174, + "column": 9 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16927,20 +19309,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 3009, - "end": 3013, + "value": "args", + "start": 4768, + "end": 4772, "loc": { "start": { - "line": 125, - "column": 2 + "line": 174, + "column": 10 }, "end": { - "line": 125, - "column": 6 + "line": 174, + "column": 14 } } }, @@ -16957,16 +19338,16 @@ "binop": null, "updateContext": null }, - "start": 3013, - "end": 3014, + "start": 4772, + "end": 4773, "loc": { "start": { - "line": 125, - "column": 6 + "line": 174, + "column": 14 }, "end": { - "line": 125, - "column": 7 + "line": 174, + "column": 15 } } }, @@ -16982,49 +19363,48 @@ "postfix": false, "binop": null }, - "value": "entities", - "start": 3014, - "end": 3022, + "value": "slice", + "start": 4773, + "end": 4778, "loc": { "start": { - "line": 125, - "column": 7 + "line": 174, + "column": 15 }, "end": { - "line": 125, - "column": 15 + "line": 174, + "column": 20 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 3022, - "end": 3023, + "start": 4778, + "end": 4779, "loc": { "start": { - "line": 125, - "column": 15 + "line": 174, + "column": 20 }, "end": { - "line": 125, - "column": 16 + "line": 174, + "column": 21 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -17032,27 +19412,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "set", - "start": 3023, - "end": 3026, + "value": 2, + "start": 4779, + "end": 4780, "loc": { "start": { - "line": 125, - "column": 16 + "line": 174, + "column": 21 }, "end": { - "line": 125, - "column": 19 + "line": 174, + "column": 22 } } }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -17060,24 +19441,24 @@ "postfix": false, "binop": null }, - "start": 3026, - "end": 3027, + "start": 4780, + "end": 4781, "loc": { "start": { - "line": 125, - "column": 19 + "line": 174, + "column": 22 }, "end": { - "line": 125, - "column": 20 + "line": 174, + "column": 23 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -17085,23 +19466,23 @@ "postfix": false, "binop": null }, - "value": "entityId", - "start": 3027, - "end": 3035, + "start": 4784, + "end": 4785, "loc": { "start": { - "line": 125, - "column": 20 + "line": 175, + "column": 2 }, "end": { - "line": 125, - "column": 28 + "line": 175, + "column": 3 } } }, { "type": { - "label": ",", + "label": "else", + "keyword": "else", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -17112,23 +19493,24 @@ "binop": null, "updateContext": null }, - "start": 3035, - "end": 3036, + "value": "else", + "start": 4786, + "end": 4790, "loc": { "start": { - "line": 125, - "column": 28 + "line": 175, + "column": 4 }, "end": { - "line": 125, - "column": 29 + "line": 175, + "column": 8 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -17137,25 +19519,24 @@ "postfix": false, "binop": null }, - "value": "entity", - "start": 3037, - "end": 3043, + "start": 4791, + "end": 4792, "loc": { "start": { - "line": 125, - "column": 30 + "line": 175, + "column": 9 }, "end": { - "line": 125, - "column": 36 + "line": 175, + "column": 10 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -17163,44 +19544,44 @@ "postfix": false, "binop": null }, - "start": 3043, - "end": 3044, + "value": "systemClass", + "start": 4796, + "end": 4807, "loc": { "start": { - "line": 125, - "column": 36 + "line": 176, + "column": 3 }, "end": { - "line": 125, - "column": 37 + "line": 176, + "column": 14 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "return", - "start": 3047, - "end": 3053, + "value": "=", + "start": 4808, + "end": 4809, "loc": { "start": { - "line": 126, - "column": 2 + "line": 176, + "column": 15 }, "end": { - "line": 126, - "column": 8 + "line": 176, + "column": 16 } } }, @@ -17216,64 +19597,49 @@ "postfix": false, "binop": null }, - "value": "entity", - "start": 3054, - "end": 3060, + "value": "args", + "start": 4810, + "end": 4814, "loc": { "start": { - "line": 126, - "column": 9 + "line": 176, + "column": 17 }, "end": { - "line": 126, - "column": 15 + "line": 176, + "column": 21 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "[", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3062, - "end": 3063, - "loc": { - "start": { - "line": 127, - "column": 1 - }, - "end": { - "line": 127, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * })\n\t *\n\t * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize,\n\t * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run()\n\t * for an example of the call order.\n\t * @param {...Object} [args] - The arguments to forward to the system's constructors\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t ", - "start": 3066, - "end": 4045, + "start": 4814, + "end": 4815, "loc": { "start": { - "line": 129, - "column": 1 + "line": 176, + "column": 21 }, "end": { - "line": 149, - "column": 4 + "line": 176, + "column": 22 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -17281,44 +19647,46 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "system", - "start": 4047, - "end": 4053, + "value": 0, + "start": 4815, + "end": 4816, "loc": { "start": { - "line": 150, - "column": 1 + "line": 176, + "column": 22 }, "end": { - "line": 150, - "column": 7 + "line": 176, + "column": 23 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "]", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 4053, - "end": 4054, + "start": 4816, + "end": 4817, "loc": { "start": { - "line": 150, - "column": 7 + "line": 176, + "column": 23 }, "end": { - "line": 150, - "column": 8 + "line": 176, + "column": 24 } } }, @@ -17334,43 +19702,44 @@ "postfix": false, "binop": null }, - "value": "components", - "start": 4054, - "end": 4064, + "value": "rest", + "start": 4821, + "end": 4825, "loc": { "start": { - "line": 150, - "column": 8 + "line": 177, + "column": 3 }, "end": { - "line": 150, - "column": 18 + "line": 177, + "column": 7 } } }, { "type": { - "label": ",", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 4064, - "end": 4065, + "value": "=", + "start": 4826, + "end": 4827, "loc": { "start": { - "line": 150, - "column": 18 + "line": 177, + "column": 8 }, "end": { - "line": 150, - "column": 19 + "line": 177, + "column": 9 } } }, @@ -17386,24 +19755,24 @@ "postfix": false, "binop": null }, - "value": "systemClass", - "start": 4066, - "end": 4077, + "value": "args", + "start": 4828, + "end": 4832, "loc": { "start": { - "line": 150, - "column": 20 + "line": 177, + "column": 10 }, "end": { - "line": 150, - "column": 31 + "line": 177, + "column": 14 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -17413,48 +19782,73 @@ "binop": null, "updateContext": null }, - "start": 4077, - "end": 4078, + "start": 4832, + "end": 4833, "loc": { "start": { - "line": 150, - "column": 31 + "line": 177, + "column": 14 }, "end": { - "line": 150, - "column": 32 + "line": 177, + "column": 15 } } }, { "type": { - "label": "...", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "slice", + "start": 4833, + "end": 4838, + "loc": { + "start": { + "line": 177, + "column": 15 + }, + "end": { + "line": 177, + "column": 20 + } + } + }, + { + "type": { + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 4079, - "end": 4082, + "start": 4838, + "end": 4839, "loc": { "start": { - "line": 150, - "column": 33 + "line": 177, + "column": 20 }, "end": { - "line": 150, - "column": 36 + "line": 177, + "column": 21 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -17462,19 +19856,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "args", - "start": 4082, - "end": 4086, + "value": 1, + "start": 4839, + "end": 4840, "loc": { "start": { - "line": 150, - "column": 36 + "line": 177, + "column": 21 }, "end": { - "line": 150, - "column": 40 + "line": 177, + "column": 22 } } }, @@ -17490,24 +19885,24 @@ "postfix": false, "binop": null }, - "start": 4086, - "end": 4087, + "start": 4840, + "end": 4841, "loc": { "start": { - "line": 150, - "column": 40 + "line": 177, + "column": 22 }, "end": { - "line": 150, - "column": 41 + "line": 177, + "column": 23 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -17515,32 +19910,32 @@ "postfix": false, "binop": null }, - "start": 4088, - "end": 4089, + "start": 4844, + "end": 4845, "loc": { "start": { - "line": 150, - "column": 42 + "line": 178, + "column": 2 }, "end": { - "line": 150, - "column": 43 + "line": 178, + "column": 3 } } }, { "type": "CommentLine", - "value": " TODO: Make components optional, and parameters more dynamic by only using ...args", - "start": 4092, - "end": 4176, + "value": " Make sure the system is valid", + "start": 4849, + "end": 4881, "loc": { "start": { - "line": 151, + "line": 180, "column": 2 }, "end": { - "line": 151, - "column": 86 + "line": 180, + "column": 34 } } }, @@ -17559,15 +19954,15 @@ "updateContext": null }, "value": "if", - "start": 4179, - "end": 4181, + "start": 4884, + "end": 4886, "loc": { "start": { - "line": 152, + "line": 181, "column": 2 }, "end": { - "line": 152, + "line": 181, "column": 4 } } @@ -17584,15 +19979,15 @@ "postfix": false, "binop": null }, - "start": 4182, - "end": 4183, + "start": 4887, + "end": 4888, "loc": { "start": { - "line": 152, + "line": 181, "column": 5 }, "end": { - "line": 152, + "line": 181, "column": 6 } } @@ -17610,15 +20005,15 @@ "binop": null }, "value": "isFunction", - "start": 4183, - "end": 4193, + "start": 4888, + "end": 4898, "loc": { "start": { - "line": 152, + "line": 181, "column": 6 }, "end": { - "line": 152, + "line": 181, "column": 16 } } @@ -17635,15 +20030,15 @@ "postfix": false, "binop": null }, - "start": 4193, - "end": 4194, + "start": 4898, + "end": 4899, "loc": { "start": { - "line": 152, + "line": 181, "column": 16 }, "end": { - "line": 152, + "line": 181, "column": 17 } } @@ -17661,15 +20056,15 @@ "binop": null }, "value": "systemClass", - "start": 4194, - "end": 4205, + "start": 4899, + "end": 4910, "loc": { "start": { - "line": 152, + "line": 181, "column": 17 }, "end": { - "line": 152, + "line": 181, "column": 28 } } @@ -17686,15 +20081,15 @@ "postfix": false, "binop": null }, - "start": 4205, - "end": 4206, + "start": 4910, + "end": 4911, "loc": { "start": { - "line": 152, + "line": 181, "column": 28 }, "end": { - "line": 152, + "line": 181, "column": 29 } } @@ -17711,15 +20106,15 @@ "postfix": false, "binop": null }, - "start": 4206, - "end": 4207, + "start": 4911, + "end": 4912, "loc": { "start": { - "line": 152, + "line": 181, "column": 29 }, "end": { - "line": 152, + "line": 181, "column": 30 } } @@ -17736,15 +20131,15 @@ "postfix": false, "binop": null }, - "start": 4208, - "end": 4209, + "start": 4913, + "end": 4914, "loc": { "start": { - "line": 152, + "line": 181, "column": 31 }, "end": { - "line": 152, + "line": 181, "column": 32 } } @@ -17752,15 +20147,15 @@ { "type": "CommentLine", "value": " Create the system, and set the component array query", - "start": 4213, - "end": 4268, + "start": 4918, + "end": 4973, "loc": { "start": { - "line": 153, + "line": 182, "column": 3 }, "end": { - "line": 153, + "line": 182, "column": 58 } } @@ -17780,15 +20175,15 @@ "updateContext": null }, "value": "let", - "start": 4272, - "end": 4275, + "start": 4977, + "end": 4980, "loc": { "start": { - "line": 154, + "line": 183, "column": 3 }, "end": { - "line": 154, + "line": 183, "column": 6 } } @@ -17806,15 +20201,15 @@ "binop": null }, "value": "newSystem", - "start": 4276, - "end": 4285, + "start": 4981, + "end": 4990, "loc": { "start": { - "line": 154, + "line": 183, "column": 7 }, "end": { - "line": 154, + "line": 183, "column": 16 } } @@ -17833,15 +20228,15 @@ "updateContext": null }, "value": "=", - "start": 4286, - "end": 4287, + "start": 4991, + "end": 4992, "loc": { "start": { - "line": 154, + "line": 183, "column": 17 }, "end": { - "line": 154, + "line": 183, "column": 18 } } @@ -17861,15 +20256,15 @@ "updateContext": null }, "value": "new", - "start": 4288, - "end": 4291, + "start": 4993, + "end": 4996, "loc": { "start": { - "line": 154, + "line": 183, "column": 19 }, "end": { - "line": 154, + "line": 183, "column": 22 } } @@ -17887,15 +20282,15 @@ "binop": null }, "value": "systemClass", - "start": 4292, - "end": 4303, + "start": 4997, + "end": 5008, "loc": { "start": { - "line": 154, + "line": 183, "column": 23 }, "end": { - "line": 154, + "line": 183, "column": 34 } } @@ -17912,15 +20307,15 @@ "postfix": false, "binop": null }, - "start": 4303, - "end": 4304, + "start": 5008, + "end": 5009, "loc": { "start": { - "line": 154, + "line": 183, "column": 34 }, "end": { - "line": 154, + "line": 183, "column": 35 } } @@ -17938,15 +20333,15 @@ "binop": null, "updateContext": null }, - "start": 4304, - "end": 4307, + "start": 5009, + "end": 5012, "loc": { "start": { - "line": 154, + "line": 183, "column": 35 }, "end": { - "line": 154, + "line": 183, "column": 38 } } @@ -17963,16 +20358,16 @@ "postfix": false, "binop": null }, - "value": "args", - "start": 4307, - "end": 4311, + "value": "rest", + "start": 5012, + "end": 5016, "loc": { "start": { - "line": 154, + "line": 183, "column": 38 }, "end": { - "line": 154, + "line": 183, "column": 42 } } @@ -17989,15 +20384,15 @@ "postfix": false, "binop": null }, - "start": 4311, - "end": 4312, + "start": 5016, + "end": 5017, "loc": { "start": { - "line": 154, + "line": 183, "column": 42 }, "end": { - "line": 154, + "line": 183, "column": 43 } } @@ -18015,15 +20410,15 @@ "binop": null }, "value": "newSystem", - "start": 4316, - "end": 4325, + "start": 5021, + "end": 5030, "loc": { "start": { - "line": 155, + "line": 184, "column": 3 }, "end": { - "line": 155, + "line": 184, "column": 12 } } @@ -18041,15 +20436,15 @@ "binop": null, "updateContext": null }, - "start": 4325, - "end": 4326, + "start": 5030, + "end": 5031, "loc": { "start": { - "line": 155, + "line": 184, "column": 12 }, "end": { - "line": 155, + "line": 184, "column": 13 } } @@ -18067,15 +20462,15 @@ "binop": null }, "value": "components", - "start": 4326, - "end": 4336, + "start": 5031, + "end": 5041, "loc": { "start": { - "line": 155, + "line": 184, "column": 13 }, "end": { - "line": 155, + "line": 184, "column": 23 } } @@ -18094,15 +20489,15 @@ "updateContext": null }, "value": "=", - "start": 4337, - "end": 4338, + "start": 5042, + "end": 5043, "loc": { "start": { - "line": 155, + "line": 184, "column": 24 }, "end": { - "line": 155, + "line": 184, "column": 25 } } @@ -18120,15 +20515,15 @@ "binop": null }, "value": "components", - "start": 4339, - "end": 4349, + "start": 5044, + "end": 5054, "loc": { "start": { - "line": 155, + "line": 184, "column": 26 }, "end": { - "line": 155, + "line": 184, "column": 36 } } @@ -18136,15 +20531,15 @@ { "type": "CommentLine", "value": " Add the system, return its ID", - "start": 4354, - "end": 4386, + "start": 5059, + "end": 5091, "loc": { "start": { - "line": 157, + "line": 186, "column": 3 }, "end": { - "line": 157, + "line": 186, "column": 35 } } @@ -18164,15 +20559,15 @@ "updateContext": null }, "value": "return", - "start": 4390, - "end": 4396, + "start": 5095, + "end": 5101, "loc": { "start": { - "line": 158, + "line": 187, "column": 3 }, "end": { - "line": 158, + "line": 187, "column": 9 } } @@ -18192,15 +20587,15 @@ "updateContext": null }, "value": "this", - "start": 4397, - "end": 4401, + "start": 5102, + "end": 5106, "loc": { "start": { - "line": 158, + "line": 187, "column": 10 }, "end": { - "line": 158, + "line": 187, "column": 14 } } @@ -18218,15 +20613,15 @@ "binop": null, "updateContext": null }, - "start": 4401, - "end": 4402, + "start": 5106, + "end": 5107, "loc": { "start": { - "line": 158, + "line": 187, "column": 14 }, "end": { - "line": 158, + "line": 187, "column": 15 } } @@ -18244,15 +20639,15 @@ "binop": null }, "value": "systems", - "start": 4402, - "end": 4409, + "start": 5107, + "end": 5114, "loc": { "start": { - "line": 158, + "line": 187, "column": 15 }, "end": { - "line": 158, + "line": 187, "column": 22 } } @@ -18270,15 +20665,15 @@ "binop": null, "updateContext": null }, - "start": 4409, - "end": 4410, + "start": 5114, + "end": 5115, "loc": { "start": { - "line": 158, + "line": 187, "column": 22 }, "end": { - "line": 158, + "line": 187, "column": 23 } } @@ -18296,15 +20691,15 @@ "binop": null }, "value": "push", - "start": 4410, - "end": 4414, + "start": 5115, + "end": 5119, "loc": { "start": { - "line": 158, + "line": 187, "column": 23 }, "end": { - "line": 158, + "line": 187, "column": 27 } } @@ -18321,15 +20716,15 @@ "postfix": false, "binop": null }, - "start": 4414, - "end": 4415, + "start": 5119, + "end": 5120, "loc": { "start": { - "line": 158, + "line": 187, "column": 27 }, "end": { - "line": 158, + "line": 187, "column": 28 } } @@ -18347,15 +20742,15 @@ "binop": null }, "value": "newSystem", - "start": 4415, - "end": 4424, + "start": 5120, + "end": 5129, "loc": { "start": { - "line": 158, + "line": 187, "column": 28 }, "end": { - "line": 158, + "line": 187, "column": 37 } } @@ -18372,15 +20767,15 @@ "postfix": false, "binop": null }, - "start": 4424, - "end": 4425, + "start": 5129, + "end": 5130, "loc": { "start": { - "line": 158, + "line": 187, "column": 37 }, "end": { - "line": 158, + "line": 187, "column": 38 } } @@ -18399,15 +20794,15 @@ "updateContext": null }, "value": "-", - "start": 4426, - "end": 4427, + "start": 5131, + "end": 5132, "loc": { "start": { - "line": 158, + "line": 187, "column": 39 }, "end": { - "line": 158, + "line": 187, "column": 40 } } @@ -18426,15 +20821,15 @@ "updateContext": null }, "value": 1, - "start": 4428, - "end": 4429, + "start": 5133, + "end": 5134, "loc": { "start": { - "line": 158, + "line": 187, "column": 41 }, "end": { - "line": 158, + "line": 187, "column": 42 } } @@ -18451,15 +20846,15 @@ "postfix": false, "binop": null }, - "start": 4432, - "end": 4433, + "start": 5137, + "end": 5138, "loc": { "start": { - "line": 159, + "line": 188, "column": 2 }, "end": { - "line": 159, + "line": 188, "column": 3 } } @@ -18479,15 +20874,15 @@ "updateContext": null }, "value": "return", - "start": 4436, - "end": 4442, + "start": 5141, + "end": 5147, "loc": { "start": { - "line": 160, + "line": 189, "column": 2 }, "end": { - "line": 160, + "line": 189, "column": 8 } } @@ -18505,15 +20900,15 @@ "binop": null }, "value": "undefined", - "start": 4443, - "end": 4452, + "start": 5148, + "end": 5157, "loc": { "start": { - "line": 160, + "line": 189, "column": 9 }, "end": { - "line": 160, + "line": 189, "column": 18 } } @@ -18530,15 +20925,15 @@ "postfix": false, "binop": null }, - "start": 4454, - "end": 4455, + "start": 5159, + "end": 5160, "loc": { "start": { - "line": 161, + "line": 190, "column": 1 }, "end": { - "line": 161, + "line": 190, "column": 2 } } @@ -18546,15 +20941,15 @@ { "type": "CommentBlock", "value": "*\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t ", - "start": 4458, - "end": 4655, + "start": 5163, + "end": 5360, "loc": { "start": { - "line": 163, + "line": 192, "column": 1 }, "end": { - "line": 170, + "line": 199, "column": 4 } } @@ -18572,15 +20967,15 @@ "binop": null }, "value": "initialize", - "start": 4657, - "end": 4667, + "start": 5362, + "end": 5372, "loc": { "start": { - "line": 171, + "line": 200, "column": 1 }, "end": { - "line": 171, + "line": 200, "column": 11 } } @@ -18597,15 +20992,15 @@ "postfix": false, "binop": null }, - "start": 4667, - "end": 4668, + "start": 5372, + "end": 5373, "loc": { "start": { - "line": 171, + "line": 200, "column": 11 }, "end": { - "line": 171, + "line": 200, "column": 12 } } @@ -18623,15 +21018,15 @@ "binop": null, "updateContext": null }, - "start": 4668, - "end": 4671, + "start": 5373, + "end": 5376, "loc": { "start": { - "line": 171, + "line": 200, "column": 12 }, "end": { - "line": 171, + "line": 200, "column": 15 } } @@ -18649,15 +21044,15 @@ "binop": null }, "value": "args", - "start": 4671, - "end": 4675, + "start": 5376, + "end": 5380, "loc": { "start": { - "line": 171, + "line": 200, "column": 15 }, "end": { - "line": 171, + "line": 200, "column": 19 } } @@ -18674,15 +21069,15 @@ "postfix": false, "binop": null }, - "start": 4675, - "end": 4676, + "start": 5380, + "end": 5381, "loc": { "start": { - "line": 171, + "line": 200, "column": 19 }, "end": { - "line": 171, + "line": 200, "column": 20 } } @@ -18699,15 +21094,15 @@ "postfix": false, "binop": null }, - "start": 4677, - "end": 4678, + "start": 5382, + "end": 5383, "loc": { "start": { - "line": 171, + "line": 200, "column": 21 }, "end": { - "line": 171, + "line": 200, "column": 22 } } @@ -18727,15 +21122,15 @@ "updateContext": null }, "value": "for", - "start": 4681, - "end": 4684, + "start": 5386, + "end": 5389, "loc": { "start": { - "line": 172, + "line": 201, "column": 2 }, "end": { - "line": 172, + "line": 201, "column": 5 } } @@ -18752,15 +21147,15 @@ "postfix": false, "binop": null }, - "start": 4685, - "end": 4686, + "start": 5390, + "end": 5391, "loc": { "start": { - "line": 172, + "line": 201, "column": 6 }, "end": { - "line": 172, + "line": 201, "column": 7 } } @@ -18780,15 +21175,15 @@ "updateContext": null }, "value": "let", - "start": 4686, - "end": 4689, + "start": 5391, + "end": 5394, "loc": { "start": { - "line": 172, + "line": 201, "column": 7 }, "end": { - "line": 172, + "line": 201, "column": 10 } } @@ -18806,15 +21201,15 @@ "binop": null }, "value": "system", - "start": 4690, - "end": 4696, + "start": 5395, + "end": 5401, "loc": { "start": { - "line": 172, + "line": 201, "column": 11 }, "end": { - "line": 172, + "line": 201, "column": 17 } } @@ -18832,15 +21227,15 @@ "binop": null }, "value": "of", - "start": 4697, - "end": 4699, + "start": 5402, + "end": 5404, "loc": { "start": { - "line": 172, + "line": 201, "column": 18 }, "end": { - "line": 172, + "line": 201, "column": 20 } } @@ -18860,15 +21255,15 @@ "updateContext": null }, "value": "this", - "start": 4700, - "end": 4704, + "start": 5405, + "end": 5409, "loc": { "start": { - "line": 172, + "line": 201, "column": 21 }, "end": { - "line": 172, + "line": 201, "column": 25 } } @@ -18886,15 +21281,15 @@ "binop": null, "updateContext": null }, - "start": 4704, - "end": 4705, + "start": 5409, + "end": 5410, "loc": { "start": { - "line": 172, + "line": 201, "column": 25 }, "end": { - "line": 172, + "line": 201, "column": 26 } } @@ -18912,15 +21307,15 @@ "binop": null }, "value": "systems", - "start": 4705, - "end": 4712, + "start": 5410, + "end": 5417, "loc": { "start": { - "line": 172, + "line": 201, "column": 26 }, "end": { - "line": 172, + "line": 201, "column": 33 } } @@ -18937,15 +21332,15 @@ "postfix": false, "binop": null }, - "start": 4712, - "end": 4713, + "start": 5417, + "end": 5418, "loc": { "start": { - "line": 172, + "line": 201, "column": 33 }, "end": { - "line": 172, + "line": 201, "column": 34 } } @@ -18962,15 +21357,15 @@ "postfix": false, "binop": null }, - "start": 4714, - "end": 4715, + "start": 5419, + "end": 5420, "loc": { "start": { - "line": 172, + "line": 201, "column": 35 }, "end": { - "line": 172, + "line": 201, "column": 36 } } @@ -18988,15 +21383,15 @@ "binop": null }, "value": "invoke", - "start": 4719, - "end": 4725, + "start": 5424, + "end": 5430, "loc": { "start": { - "line": 173, + "line": 202, "column": 3 }, "end": { - "line": 173, + "line": 202, "column": 9 } } @@ -19013,15 +21408,15 @@ "postfix": false, "binop": null }, - "start": 4725, - "end": 4726, + "start": 5430, + "end": 5431, "loc": { "start": { - "line": 173, + "line": 202, "column": 9 }, "end": { - "line": 173, + "line": 202, "column": 10 } } @@ -19039,15 +21434,15 @@ "binop": null }, "value": "system", - "start": 4726, - "end": 4732, + "start": 5431, + "end": 5437, "loc": { "start": { - "line": 173, + "line": 202, "column": 10 }, "end": { - "line": 173, + "line": 202, "column": 16 } } @@ -19065,15 +21460,15 @@ "binop": null, "updateContext": null }, - "start": 4732, - "end": 4733, + "start": 5437, + "end": 5438, "loc": { "start": { - "line": 173, + "line": 202, "column": 16 }, "end": { - "line": 173, + "line": 202, "column": 17 } } @@ -19092,15 +21487,15 @@ "updateContext": null }, "value": "initialize", - "start": 4734, - "end": 4746, + "start": 5439, + "end": 5451, "loc": { "start": { - "line": 173, + "line": 202, "column": 18 }, "end": { - "line": 173, + "line": 202, "column": 30 } } @@ -19118,15 +21513,15 @@ "binop": null, "updateContext": null }, - "start": 4746, - "end": 4747, + "start": 5451, + "end": 5452, "loc": { "start": { - "line": 173, + "line": 202, "column": 30 }, "end": { - "line": 173, + "line": 202, "column": 31 } } @@ -19144,15 +21539,15 @@ "binop": null, "updateContext": null }, - "start": 4748, - "end": 4751, + "start": 5453, + "end": 5456, "loc": { "start": { - "line": 173, + "line": 202, "column": 32 }, "end": { - "line": 173, + "line": 202, "column": 35 } } @@ -19170,15 +21565,15 @@ "binop": null }, "value": "args", - "start": 4751, - "end": 4755, + "start": 5456, + "end": 5460, "loc": { "start": { - "line": 173, + "line": 202, "column": 35 }, "end": { - "line": 173, + "line": 202, "column": 39 } } @@ -19195,15 +21590,15 @@ "postfix": false, "binop": null }, - "start": 4755, - "end": 4756, + "start": 5460, + "end": 5461, "loc": { "start": { - "line": 173, + "line": 202, "column": 39 }, "end": { - "line": 173, + "line": 202, "column": 40 } } @@ -19220,15 +21615,15 @@ "postfix": false, "binop": null }, - "start": 4759, - "end": 4760, + "start": 5464, + "end": 5465, "loc": { "start": { - "line": 174, + "line": 203, "column": 2 }, "end": { - "line": 174, + "line": 203, "column": 3 } } @@ -19245,31 +21640,31 @@ "postfix": false, "binop": null }, - "start": 4762, - "end": 4763, + "start": 5467, + "end": 5468, "loc": { "start": { - "line": 175, + "line": 204, "column": 1 }, "end": { - "line": 175, + "line": 204, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system([], systemA)\n\t * world.system([], systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", - "start": 4766, - "end": 5295, + "value": "*\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system(systemA)\n\t * world.system(systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t ", + "start": 5471, + "end": 5992, "loc": { "start": { - "line": 177, + "line": 206, "column": 1 }, "end": { - "line": 197, + "line": 226, "column": 4 } } @@ -19287,15 +21682,15 @@ "binop": null }, "value": "run", - "start": 5297, - "end": 5300, + "start": 5994, + "end": 5997, "loc": { "start": { - "line": 198, + "line": 227, "column": 1 }, "end": { - "line": 198, + "line": 227, "column": 4 } } @@ -19312,15 +21707,15 @@ "postfix": false, "binop": null }, - "start": 5300, - "end": 5301, + "start": 5997, + "end": 5998, "loc": { "start": { - "line": 198, + "line": 227, "column": 4 }, "end": { - "line": 198, + "line": 227, "column": 5 } } @@ -19338,15 +21733,15 @@ "binop": null, "updateContext": null }, - "start": 5301, - "end": 5304, + "start": 5998, + "end": 6001, "loc": { "start": { - "line": 198, + "line": 227, "column": 5 }, "end": { - "line": 198, + "line": 227, "column": 8 } } @@ -19364,15 +21759,15 @@ "binop": null }, "value": "args", - "start": 5304, - "end": 5308, + "start": 6001, + "end": 6005, "loc": { "start": { - "line": 198, + "line": 227, "column": 8 }, "end": { - "line": 198, + "line": 227, "column": 12 } } @@ -19389,15 +21784,15 @@ "postfix": false, "binop": null }, - "start": 5308, - "end": 5309, + "start": 6005, + "end": 6006, "loc": { "start": { - "line": 198, + "line": 227, "column": 12 }, "end": { - "line": 198, + "line": 227, "column": 13 } } @@ -19414,15 +21809,15 @@ "postfix": false, "binop": null }, - "start": 5310, - "end": 5311, + "start": 6007, + "end": 6008, "loc": { "start": { - "line": 198, + "line": 227, "column": 14 }, "end": { - "line": 198, + "line": 227, "column": 15 } } @@ -19442,15 +21837,15 @@ "updateContext": null }, "value": "for", - "start": 5314, - "end": 5317, + "start": 6011, + "end": 6014, "loc": { "start": { - "line": 199, + "line": 228, "column": 2 }, "end": { - "line": 199, + "line": 228, "column": 5 } } @@ -19467,15 +21862,15 @@ "postfix": false, "binop": null }, - "start": 5318, - "end": 5319, + "start": 6015, + "end": 6016, "loc": { "start": { - "line": 199, + "line": 228, "column": 6 }, "end": { - "line": 199, + "line": 228, "column": 7 } } @@ -19495,15 +21890,15 @@ "updateContext": null }, "value": "let", - "start": 5319, - "end": 5322, + "start": 6016, + "end": 6019, "loc": { "start": { - "line": 199, + "line": 228, "column": 7 }, "end": { - "line": 199, + "line": 228, "column": 10 } } @@ -19521,15 +21916,15 @@ "binop": null }, "value": "system", - "start": 5323, - "end": 5329, + "start": 6020, + "end": 6026, "loc": { "start": { - "line": 199, + "line": 228, "column": 11 }, "end": { - "line": 199, + "line": 228, "column": 17 } } @@ -19547,15 +21942,15 @@ "binop": null }, "value": "of", - "start": 5330, - "end": 5332, + "start": 6027, + "end": 6029, "loc": { "start": { - "line": 199, + "line": 228, "column": 18 }, "end": { - "line": 199, + "line": 228, "column": 20 } } @@ -19575,15 +21970,15 @@ "updateContext": null }, "value": "this", - "start": 5333, - "end": 5337, + "start": 6030, + "end": 6034, "loc": { "start": { - "line": 199, + "line": 228, "column": 21 }, "end": { - "line": 199, + "line": 228, "column": 25 } } @@ -19601,15 +21996,15 @@ "binop": null, "updateContext": null }, - "start": 5337, - "end": 5338, + "start": 6034, + "end": 6035, "loc": { "start": { - "line": 199, + "line": 228, "column": 25 }, "end": { - "line": 199, + "line": 228, "column": 26 } } @@ -19627,15 +22022,15 @@ "binop": null }, "value": "systems", - "start": 5338, - "end": 5345, + "start": 6035, + "end": 6042, "loc": { "start": { - "line": 199, + "line": 228, "column": 26 }, "end": { - "line": 199, + "line": 228, "column": 33 } } @@ -19652,15 +22047,15 @@ "postfix": false, "binop": null }, - "start": 5345, - "end": 5346, + "start": 6042, + "end": 6043, "loc": { "start": { - "line": 199, + "line": 228, "column": 33 }, "end": { - "line": 199, + "line": 228, "column": 34 } } @@ -19677,15 +22072,15 @@ "postfix": false, "binop": null }, - "start": 5347, - "end": 5348, + "start": 6044, + "end": 6045, "loc": { "start": { - "line": 199, + "line": 228, "column": 35 }, "end": { - "line": 199, + "line": 228, "column": 36 } } @@ -19703,15 +22098,15 @@ "binop": null }, "value": "invoke", - "start": 5352, - "end": 5358, + "start": 6049, + "end": 6055, "loc": { "start": { - "line": 200, + "line": 229, "column": 3 }, "end": { - "line": 200, + "line": 229, "column": 9 } } @@ -19728,15 +22123,15 @@ "postfix": false, "binop": null }, - "start": 5358, - "end": 5359, + "start": 6055, + "end": 6056, "loc": { "start": { - "line": 200, + "line": 229, "column": 9 }, "end": { - "line": 200, + "line": 229, "column": 10 } } @@ -19754,15 +22149,15 @@ "binop": null }, "value": "system", - "start": 5359, - "end": 5365, + "start": 6056, + "end": 6062, "loc": { "start": { - "line": 200, + "line": 229, "column": 10 }, "end": { - "line": 200, + "line": 229, "column": 16 } } @@ -19780,15 +22175,15 @@ "binop": null, "updateContext": null }, - "start": 5365, - "end": 5366, + "start": 6062, + "end": 6063, "loc": { "start": { - "line": 200, + "line": 229, "column": 16 }, "end": { - "line": 200, + "line": 229, "column": 17 } } @@ -19807,15 +22202,15 @@ "updateContext": null }, "value": "pre", - "start": 5367, - "end": 5372, + "start": 6064, + "end": 6069, "loc": { "start": { - "line": 200, + "line": 229, "column": 18 }, "end": { - "line": 200, + "line": 229, "column": 23 } } @@ -19833,15 +22228,15 @@ "binop": null, "updateContext": null }, - "start": 5372, - "end": 5373, + "start": 6069, + "end": 6070, "loc": { "start": { - "line": 200, + "line": 229, "column": 23 }, "end": { - "line": 200, + "line": 229, "column": 24 } } @@ -19859,15 +22254,15 @@ "binop": null, "updateContext": null }, - "start": 5374, - "end": 5377, + "start": 6071, + "end": 6074, "loc": { "start": { - "line": 200, + "line": 229, "column": 25 }, "end": { - "line": 200, + "line": 229, "column": 28 } } @@ -19885,15 +22280,15 @@ "binop": null }, "value": "args", - "start": 5377, - "end": 5381, + "start": 6074, + "end": 6078, "loc": { "start": { - "line": 200, + "line": 229, "column": 28 }, "end": { - "line": 200, + "line": 229, "column": 32 } } @@ -19910,15 +22305,15 @@ "postfix": false, "binop": null }, - "start": 5381, - "end": 5382, + "start": 6078, + "end": 6079, "loc": { "start": { - "line": 200, + "line": 229, "column": 32 }, "end": { - "line": 200, + "line": 229, "column": 33 } } @@ -19926,15 +22321,15 @@ { "type": "CommentLine", "value": " Run the \"every\" method in the system", - "start": 5387, - "end": 5426, + "start": 6084, + "end": 6123, "loc": { "start": { - "line": 202, + "line": 231, "column": 3 }, "end": { - "line": 202, + "line": 231, "column": 42 } } @@ -19954,15 +22349,15 @@ "updateContext": null }, "value": "if", - "start": 5430, - "end": 5432, + "start": 6127, + "end": 6129, "loc": { "start": { - "line": 203, + "line": 232, "column": 3 }, "end": { - "line": 203, + "line": 232, "column": 5 } } @@ -19979,15 +22374,15 @@ "postfix": false, "binop": null }, - "start": 5433, - "end": 5434, + "start": 6130, + "end": 6131, "loc": { "start": { - "line": 203, + "line": 232, "column": 6 }, "end": { - "line": 203, + "line": 232, "column": 7 } } @@ -20005,15 +22400,15 @@ "binop": null }, "value": "isFunction", - "start": 5434, - "end": 5444, + "start": 6131, + "end": 6141, "loc": { "start": { - "line": 203, + "line": 232, "column": 7 }, "end": { - "line": 203, + "line": 232, "column": 17 } } @@ -20030,15 +22425,15 @@ "postfix": false, "binop": null }, - "start": 5444, - "end": 5445, + "start": 6141, + "end": 6142, "loc": { "start": { - "line": 203, + "line": 232, "column": 17 }, "end": { - "line": 203, + "line": 232, "column": 18 } } @@ -20056,15 +22451,15 @@ "binop": null }, "value": "system", - "start": 5445, - "end": 5451, + "start": 6142, + "end": 6148, "loc": { "start": { - "line": 203, + "line": 232, "column": 18 }, "end": { - "line": 203, + "line": 232, "column": 24 } } @@ -20082,15 +22477,15 @@ "binop": null, "updateContext": null }, - "start": 5451, - "end": 5452, + "start": 6148, + "end": 6149, "loc": { "start": { - "line": 203, + "line": 232, "column": 24 }, "end": { - "line": 203, + "line": 232, "column": 25 } } @@ -20108,15 +22503,15 @@ "binop": null }, "value": "every", - "start": 5452, - "end": 5457, + "start": 6149, + "end": 6154, "loc": { "start": { - "line": 203, + "line": 232, "column": 25 }, "end": { - "line": 203, + "line": 232, "column": 30 } } @@ -20133,15 +22528,15 @@ "postfix": false, "binop": null }, - "start": 5457, - "end": 5458, + "start": 6154, + "end": 6155, "loc": { "start": { - "line": 203, + "line": 232, "column": 30 }, "end": { - "line": 203, + "line": 232, "column": 31 } } @@ -20158,15 +22553,15 @@ "postfix": false, "binop": null }, - "start": 5458, - "end": 5459, + "start": 6155, + "end": 6156, "loc": { "start": { - "line": 203, + "line": 232, "column": 31 }, "end": { - "line": 203, + "line": 232, "column": 32 } } @@ -20183,15 +22578,15 @@ "postfix": false, "binop": null }, - "start": 5460, - "end": 5461, + "start": 6157, + "end": 6158, "loc": { "start": { - "line": 203, + "line": 232, "column": 33 }, "end": { - "line": 203, + "line": 232, "column": 34 } } @@ -20211,15 +22606,15 @@ "updateContext": null }, "value": "this", - "start": 5466, - "end": 5470, + "start": 6163, + "end": 6167, "loc": { "start": { - "line": 204, + "line": 233, "column": 4 }, "end": { - "line": 204, + "line": 233, "column": 8 } } @@ -20237,15 +22632,15 @@ "binop": null, "updateContext": null }, - "start": 5470, - "end": 5471, + "start": 6167, + "end": 6168, "loc": { "start": { - "line": 204, + "line": 233, "column": 8 }, "end": { - "line": 204, + "line": 233, "column": 9 } } @@ -20263,15 +22658,15 @@ "binop": null }, "value": "every", - "start": 5471, - "end": 5476, + "start": 6168, + "end": 6173, "loc": { "start": { - "line": 204, + "line": 233, "column": 9 }, "end": { - "line": 204, + "line": 233, "column": 14 } } @@ -20288,15 +22683,15 @@ "postfix": false, "binop": null }, - "start": 5476, - "end": 5477, + "start": 6173, + "end": 6174, "loc": { "start": { - "line": 204, + "line": 233, "column": 14 }, "end": { - "line": 204, + "line": 233, "column": 15 } } @@ -20314,15 +22709,15 @@ "binop": null }, "value": "system", - "start": 5477, - "end": 5483, + "start": 6174, + "end": 6180, "loc": { "start": { - "line": 204, + "line": 233, "column": 15 }, "end": { - "line": 204, + "line": 233, "column": 21 } } @@ -20340,15 +22735,15 @@ "binop": null, "updateContext": null }, - "start": 5483, - "end": 5484, + "start": 6180, + "end": 6181, "loc": { "start": { - "line": 204, + "line": 233, "column": 21 }, "end": { - "line": 204, + "line": 233, "column": 22 } } @@ -20366,15 +22761,15 @@ "binop": null }, "value": "components", - "start": 5484, - "end": 5494, + "start": 6181, + "end": 6191, "loc": { "start": { - "line": 204, + "line": 233, "column": 22 }, "end": { - "line": 204, + "line": 233, "column": 32 } } @@ -20392,15 +22787,15 @@ "binop": null, "updateContext": null }, - "start": 5494, - "end": 5495, + "start": 6191, + "end": 6192, "loc": { "start": { - "line": 204, + "line": 233, "column": 32 }, "end": { - "line": 204, + "line": 233, "column": 33 } } @@ -20418,15 +22813,15 @@ "binop": null }, "value": "system", - "start": 5496, - "end": 5502, + "start": 6193, + "end": 6199, "loc": { "start": { - "line": 204, + "line": 233, "column": 34 }, "end": { - "line": 204, + "line": 233, "column": 40 } } @@ -20444,15 +22839,15 @@ "binop": null, "updateContext": null }, - "start": 5502, - "end": 5503, + "start": 6199, + "end": 6200, "loc": { "start": { - "line": 204, + "line": 233, "column": 40 }, "end": { - "line": 204, + "line": 233, "column": 41 } } @@ -20470,15 +22865,15 @@ "binop": null }, "value": "every", - "start": 5503, - "end": 5508, + "start": 6200, + "end": 6205, "loc": { "start": { - "line": 204, + "line": 233, "column": 41 }, "end": { - "line": 204, + "line": 233, "column": 46 } } @@ -20496,15 +22891,15 @@ "binop": null, "updateContext": null }, - "start": 5508, - "end": 5509, + "start": 6205, + "end": 6206, "loc": { "start": { - "line": 204, + "line": 233, "column": 46 }, "end": { - "line": 204, + "line": 233, "column": 47 } } @@ -20522,15 +22917,15 @@ "binop": null }, "value": "bind", - "start": 5509, - "end": 5513, + "start": 6206, + "end": 6210, "loc": { "start": { - "line": 204, + "line": 233, "column": 47 }, "end": { - "line": 204, + "line": 233, "column": 51 } } @@ -20547,15 +22942,15 @@ "postfix": false, "binop": null }, - "start": 5513, - "end": 5514, + "start": 6210, + "end": 6211, "loc": { "start": { - "line": 204, + "line": 233, "column": 51 }, "end": { - "line": 204, + "line": 233, "column": 52 } } @@ -20573,15 +22968,15 @@ "binop": null }, "value": "system", - "start": 5514, - "end": 5520, + "start": 6211, + "end": 6217, "loc": { "start": { - "line": 204, + "line": 233, "column": 52 }, "end": { - "line": 204, + "line": 233, "column": 58 } } @@ -20598,15 +22993,15 @@ "postfix": false, "binop": null }, - "start": 5520, - "end": 5521, + "start": 6217, + "end": 6218, "loc": { "start": { - "line": 204, + "line": 233, "column": 58 }, "end": { - "line": 204, + "line": 233, "column": 59 } } @@ -20624,15 +23019,15 @@ "binop": null, "updateContext": null }, - "start": 5521, - "end": 5522, + "start": 6218, + "end": 6219, "loc": { "start": { - "line": 204, + "line": 233, "column": 59 }, "end": { - "line": 204, + "line": 233, "column": 60 } } @@ -20650,15 +23045,15 @@ "binop": null, "updateContext": null }, - "start": 5523, - "end": 5526, + "start": 6220, + "end": 6223, "loc": { "start": { - "line": 204, + "line": 233, "column": 61 }, "end": { - "line": 204, + "line": 233, "column": 64 } } @@ -20676,15 +23071,15 @@ "binop": null }, "value": "args", - "start": 5526, - "end": 5530, + "start": 6223, + "end": 6227, "loc": { "start": { - "line": 204, + "line": 233, "column": 64 }, "end": { - "line": 204, + "line": 233, "column": 68 } } @@ -20701,15 +23096,15 @@ "postfix": false, "binop": null }, - "start": 5530, - "end": 5531, + "start": 6227, + "end": 6228, "loc": { "start": { - "line": 204, + "line": 233, "column": 68 }, "end": { - "line": 204, + "line": 233, "column": 69 } } @@ -20726,15 +23121,15 @@ "postfix": false, "binop": null }, - "start": 5535, - "end": 5536, + "start": 6232, + "end": 6233, "loc": { "start": { - "line": 205, + "line": 234, "column": 3 }, "end": { - "line": 205, + "line": 234, "column": 4 } } @@ -20752,15 +23147,15 @@ "binop": null }, "value": "invoke", - "start": 5541, - "end": 5547, + "start": 6238, + "end": 6244, "loc": { "start": { - "line": 207, + "line": 236, "column": 3 }, "end": { - "line": 207, + "line": 236, "column": 9 } } @@ -20777,15 +23172,15 @@ "postfix": false, "binop": null }, - "start": 5547, - "end": 5548, + "start": 6244, + "end": 6245, "loc": { "start": { - "line": 207, + "line": 236, "column": 9 }, "end": { - "line": 207, + "line": 236, "column": 10 } } @@ -20803,15 +23198,15 @@ "binop": null }, "value": "system", - "start": 5548, - "end": 5554, + "start": 6245, + "end": 6251, "loc": { "start": { - "line": 207, + "line": 236, "column": 10 }, "end": { - "line": 207, + "line": 236, "column": 16 } } @@ -20829,15 +23224,15 @@ "binop": null, "updateContext": null }, - "start": 5554, - "end": 5555, + "start": 6251, + "end": 6252, "loc": { "start": { - "line": 207, + "line": 236, "column": 16 }, "end": { - "line": 207, + "line": 236, "column": 17 } } @@ -20856,15 +23251,15 @@ "updateContext": null }, "value": "post", - "start": 5556, - "end": 5562, + "start": 6253, + "end": 6259, "loc": { "start": { - "line": 207, + "line": 236, "column": 18 }, "end": { - "line": 207, + "line": 236, "column": 24 } } @@ -20882,15 +23277,15 @@ "binop": null, "updateContext": null }, - "start": 5562, - "end": 5563, + "start": 6259, + "end": 6260, "loc": { "start": { - "line": 207, + "line": 236, "column": 24 }, "end": { - "line": 207, + "line": 236, "column": 25 } } @@ -20908,15 +23303,15 @@ "binop": null, "updateContext": null }, - "start": 5564, - "end": 5567, + "start": 6261, + "end": 6264, "loc": { "start": { - "line": 207, + "line": 236, "column": 26 }, "end": { - "line": 207, + "line": 236, "column": 29 } } @@ -20934,15 +23329,15 @@ "binop": null }, "value": "args", - "start": 5567, - "end": 5571, + "start": 6264, + "end": 6268, "loc": { "start": { - "line": 207, + "line": 236, "column": 29 }, "end": { - "line": 207, + "line": 236, "column": 33 } } @@ -20959,15 +23354,15 @@ "postfix": false, "binop": null }, - "start": 5571, - "end": 5572, + "start": 6268, + "end": 6269, "loc": { "start": { - "line": 207, + "line": 236, "column": 33 }, "end": { - "line": 207, + "line": 236, "column": 34 } } @@ -20984,15 +23379,15 @@ "postfix": false, "binop": null }, - "start": 5575, - "end": 5576, + "start": 6272, + "end": 6273, "loc": { "start": { - "line": 208, + "line": 237, "column": 2 }, "end": { - "line": 208, + "line": 237, "column": 3 } } @@ -21009,15 +23404,15 @@ "postfix": false, "binop": null }, - "start": 5578, - "end": 5579, + "start": 6275, + "end": 6276, "loc": { "start": { - "line": 209, + "line": 238, "column": 1 }, "end": { - "line": 209, + "line": 238, "column": 2 } } @@ -21025,15 +23420,15 @@ { "type": "CommentBlock", "value": "*\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t ", - "start": 5582, - "end": 6373, + "start": 6279, + "end": 7070, "loc": { "start": { - "line": 211, + "line": 240, "column": 1 }, "end": { - "line": 229, + "line": 258, "column": 4 } } @@ -21051,15 +23446,15 @@ "binop": null }, "value": "every", - "start": 6375, - "end": 6380, + "start": 7072, + "end": 7077, "loc": { "start": { - "line": 230, + "line": 259, "column": 1 }, "end": { - "line": 230, + "line": 259, "column": 6 } } @@ -21076,15 +23471,15 @@ "postfix": false, "binop": null }, - "start": 6380, - "end": 6381, + "start": 7077, + "end": 7078, "loc": { "start": { - "line": 230, + "line": 259, "column": 6 }, "end": { - "line": 230, + "line": 259, "column": 7 } } @@ -21102,15 +23497,15 @@ "binop": null }, "value": "componentNames", - "start": 6381, - "end": 6395, + "start": 7078, + "end": 7092, "loc": { "start": { - "line": 230, + "line": 259, "column": 7 }, "end": { - "line": 230, + "line": 259, "column": 21 } } @@ -21128,15 +23523,15 @@ "binop": null, "updateContext": null }, - "start": 6395, - "end": 6396, + "start": 7092, + "end": 7093, "loc": { "start": { - "line": 230, + "line": 259, "column": 21 }, "end": { - "line": 230, + "line": 259, "column": 22 } } @@ -21154,15 +23549,15 @@ "binop": null }, "value": "callback", - "start": 6397, - "end": 6405, + "start": 7094, + "end": 7102, "loc": { "start": { - "line": 230, + "line": 259, "column": 23 }, "end": { - "line": 230, + "line": 259, "column": 31 } } @@ -21180,15 +23575,15 @@ "binop": null, "updateContext": null }, - "start": 6405, - "end": 6406, + "start": 7102, + "end": 7103, "loc": { "start": { - "line": 230, + "line": 259, "column": 31 }, "end": { - "line": 230, + "line": 259, "column": 32 } } @@ -21206,15 +23601,15 @@ "binop": null, "updateContext": null }, - "start": 6407, - "end": 6410, + "start": 7104, + "end": 7107, "loc": { "start": { - "line": 230, + "line": 259, "column": 33 }, "end": { - "line": 230, + "line": 259, "column": 36 } } @@ -21232,15 +23627,15 @@ "binop": null }, "value": "args", - "start": 6410, - "end": 6414, + "start": 7107, + "end": 7111, "loc": { "start": { - "line": 230, + "line": 259, "column": 36 }, "end": { - "line": 230, + "line": 259, "column": 40 } } @@ -21257,15 +23652,15 @@ "postfix": false, "binop": null }, - "start": 6414, - "end": 6415, + "start": 7111, + "end": 7112, "loc": { "start": { - "line": 230, + "line": 259, "column": 40 }, "end": { - "line": 230, + "line": 259, "column": 41 } } @@ -21282,15 +23677,15 @@ "postfix": false, "binop": null }, - "start": 6416, - "end": 6417, + "start": 7113, + "end": 7114, "loc": { "start": { - "line": 230, + "line": 259, "column": 42 }, "end": { - "line": 230, + "line": 259, "column": 43 } } @@ -21298,15 +23693,15 @@ { "type": "CommentLine", "value": " Get indexed map of entities", - "start": 6420, - "end": 6450, + "start": 7117, + "end": 7147, "loc": { "start": { - "line": 231, + "line": 260, "column": 2 }, "end": { - "line": 231, + "line": 260, "column": 32 } } @@ -21326,15 +23721,15 @@ "updateContext": null }, "value": "let", - "start": 6453, - "end": 6456, + "start": 7150, + "end": 7153, "loc": { "start": { - "line": 232, + "line": 261, "column": 2 }, "end": { - "line": 232, + "line": 261, "column": 5 } } @@ -21352,15 +23747,15 @@ "binop": null }, "value": "entities", - "start": 6457, - "end": 6465, + "start": 7154, + "end": 7162, "loc": { "start": { - "line": 232, + "line": 261, "column": 6 }, "end": { - "line": 232, + "line": 261, "column": 14 } } @@ -21379,15 +23774,15 @@ "updateContext": null }, "value": "=", - "start": 6466, - "end": 6467, + "start": 7163, + "end": 7164, "loc": { "start": { - "line": 232, + "line": 261, "column": 15 }, "end": { - "line": 232, + "line": 261, "column": 16 } } @@ -21407,15 +23802,15 @@ "updateContext": null }, "value": "this", - "start": 6468, - "end": 6472, + "start": 7165, + "end": 7169, "loc": { "start": { - "line": 232, + "line": 261, "column": 17 }, "end": { - "line": 232, + "line": 261, "column": 21 } } @@ -21433,15 +23828,15 @@ "binop": null, "updateContext": null }, - "start": 6472, - "end": 6473, + "start": 7169, + "end": 7170, "loc": { "start": { - "line": 232, + "line": 261, "column": 21 }, "end": { - "line": 232, + "line": 261, "column": 22 } } @@ -21459,15 +23854,15 @@ "binop": null }, "value": "index", - "start": 6473, - "end": 6478, + "start": 7170, + "end": 7175, "loc": { "start": { - "line": 232, + "line": 261, "column": 22 }, "end": { - "line": 232, + "line": 261, "column": 27 } } @@ -21485,15 +23880,15 @@ "binop": null, "updateContext": null }, - "start": 6478, - "end": 6479, + "start": 7175, + "end": 7176, "loc": { "start": { - "line": 232, + "line": 261, "column": 27 }, "end": { - "line": 232, + "line": 261, "column": 28 } } @@ -21511,15 +23906,15 @@ "binop": null }, "value": "query", - "start": 6479, - "end": 6484, + "start": 7176, + "end": 7181, "loc": { "start": { - "line": 232, + "line": 261, "column": 28 }, "end": { - "line": 232, + "line": 261, "column": 33 } } @@ -21536,15 +23931,15 @@ "postfix": false, "binop": null }, - "start": 6484, - "end": 6485, + "start": 7181, + "end": 7182, "loc": { "start": { - "line": 232, + "line": 261, "column": 33 }, "end": { - "line": 232, + "line": 261, "column": 34 } } @@ -21562,15 +23957,15 @@ "binop": null }, "value": "componentNames", - "start": 6485, - "end": 6499, + "start": 7182, + "end": 7196, "loc": { "start": { - "line": 232, + "line": 261, "column": 34 }, "end": { - "line": 232, + "line": 261, "column": 48 } } @@ -21587,15 +23982,15 @@ "postfix": false, "binop": null }, - "start": 6499, - "end": 6500, + "start": 7196, + "end": 7197, "loc": { "start": { - "line": 232, + "line": 261, "column": 48 }, "end": { - "line": 232, + "line": 261, "column": 49 } } @@ -21615,15 +24010,15 @@ "updateContext": null }, "value": "if", - "start": 6504, - "end": 6506, + "start": 7201, + "end": 7203, "loc": { "start": { - "line": 234, + "line": 263, "column": 2 }, "end": { - "line": 234, + "line": 263, "column": 4 } } @@ -21640,15 +24035,15 @@ "postfix": false, "binop": null }, - "start": 6507, - "end": 6508, + "start": 7204, + "end": 7205, "loc": { "start": { - "line": 234, + "line": 263, "column": 5 }, "end": { - "line": 234, + "line": 263, "column": 6 } } @@ -21666,15 +24061,15 @@ "binop": null }, "value": "isFunction", - "start": 6508, - "end": 6518, + "start": 7205, + "end": 7215, "loc": { "start": { - "line": 234, + "line": 263, "column": 6 }, "end": { - "line": 234, + "line": 263, "column": 16 } } @@ -21691,15 +24086,15 @@ "postfix": false, "binop": null }, - "start": 6518, - "end": 6519, + "start": 7215, + "end": 7216, "loc": { "start": { - "line": 234, + "line": 263, "column": 16 }, "end": { - "line": 234, + "line": 263, "column": 17 } } @@ -21717,15 +24112,15 @@ "binop": null }, "value": "callback", - "start": 6519, - "end": 6527, + "start": 7216, + "end": 7224, "loc": { "start": { - "line": 234, + "line": 263, "column": 17 }, "end": { - "line": 234, + "line": 263, "column": 25 } } @@ -21742,15 +24137,15 @@ "postfix": false, "binop": null }, - "start": 6527, - "end": 6528, + "start": 7224, + "end": 7225, "loc": { "start": { - "line": 234, + "line": 263, "column": 25 }, "end": { - "line": 234, + "line": 263, "column": 26 } } @@ -21767,15 +24162,15 @@ "postfix": false, "binop": null }, - "start": 6528, - "end": 6529, + "start": 7225, + "end": 7226, "loc": { "start": { - "line": 234, + "line": 263, "column": 26 }, "end": { - "line": 234, + "line": 263, "column": 27 } } @@ -21792,15 +24187,15 @@ "postfix": false, "binop": null }, - "start": 6530, - "end": 6531, + "start": 7227, + "end": 7228, "loc": { "start": { - "line": 234, + "line": 263, "column": 28 }, "end": { - "line": 234, + "line": 263, "column": 29 } } @@ -21808,15 +24203,15 @@ { "type": "CommentLine", "value": " Go through the map of entities", - "start": 6535, - "end": 6568, + "start": 7232, + "end": 7265, "loc": { "start": { - "line": 235, + "line": 264, "column": 3 }, "end": { - "line": 235, + "line": 264, "column": 36 } } @@ -21836,15 +24231,15 @@ "updateContext": null }, "value": "for", - "start": 6572, - "end": 6575, + "start": 7269, + "end": 7272, "loc": { "start": { - "line": 236, + "line": 265, "column": 3 }, "end": { - "line": 236, + "line": 265, "column": 6 } } @@ -21861,15 +24256,15 @@ "postfix": false, "binop": null }, - "start": 6576, - "end": 6577, + "start": 7273, + "end": 7274, "loc": { "start": { - "line": 236, + "line": 265, "column": 7 }, "end": { - "line": 236, + "line": 265, "column": 8 } } @@ -21889,15 +24284,15 @@ "updateContext": null }, "value": "let", - "start": 6577, - "end": 6580, + "start": 7274, + "end": 7277, "loc": { "start": { - "line": 236, + "line": 265, "column": 8 }, "end": { - "line": 236, + "line": 265, "column": 11 } } @@ -21915,15 +24310,15 @@ "binop": null }, "value": "entity", - "start": 6581, - "end": 6587, + "start": 7278, + "end": 7284, "loc": { "start": { - "line": 236, + "line": 265, "column": 12 }, "end": { - "line": 236, + "line": 265, "column": 18 } } @@ -21941,15 +24336,15 @@ "binop": null }, "value": "of", - "start": 6588, - "end": 6590, + "start": 7285, + "end": 7287, "loc": { "start": { - "line": 236, + "line": 265, "column": 19 }, "end": { - "line": 236, + "line": 265, "column": 21 } } @@ -21967,15 +24362,15 @@ "binop": null }, "value": "entities", - "start": 6591, - "end": 6599, + "start": 7288, + "end": 7296, "loc": { "start": { - "line": 236, + "line": 265, "column": 22 }, "end": { - "line": 236, + "line": 265, "column": 30 } } @@ -21993,15 +24388,15 @@ "binop": null, "updateContext": null }, - "start": 6599, - "end": 6600, + "start": 7296, + "end": 7297, "loc": { "start": { - "line": 236, + "line": 265, "column": 30 }, "end": { - "line": 236, + "line": 265, "column": 31 } } @@ -22019,15 +24414,15 @@ "binop": null }, "value": "values", - "start": 6600, - "end": 6606, + "start": 7297, + "end": 7303, "loc": { "start": { - "line": 236, + "line": 265, "column": 31 }, "end": { - "line": 236, + "line": 265, "column": 37 } } @@ -22044,15 +24439,15 @@ "postfix": false, "binop": null }, - "start": 6606, - "end": 6607, + "start": 7303, + "end": 7304, "loc": { "start": { - "line": 236, + "line": 265, "column": 37 }, "end": { - "line": 236, + "line": 265, "column": 38 } } @@ -22069,15 +24464,15 @@ "postfix": false, "binop": null }, - "start": 6607, - "end": 6608, + "start": 7304, + "end": 7305, "loc": { "start": { - "line": 236, + "line": 265, "column": 38 }, "end": { - "line": 236, + "line": 265, "column": 39 } } @@ -22094,15 +24489,15 @@ "postfix": false, "binop": null }, - "start": 6608, - "end": 6609, + "start": 7305, + "end": 7306, "loc": { "start": { - "line": 236, + "line": 265, "column": 39 }, "end": { - "line": 236, + "line": 265, "column": 40 } } @@ -22119,15 +24514,15 @@ "postfix": false, "binop": null }, - "start": 6610, - "end": 6611, + "start": 7307, + "end": 7308, "loc": { "start": { - "line": 236, + "line": 265, "column": 41 }, "end": { - "line": 236, + "line": 265, "column": 42 } } @@ -22135,15 +24530,15 @@ { "type": "CommentLine", "value": " At this point, we can safely assume that all components exist, even if entities/components", - "start": 6616, - "end": 6709, + "start": 7313, + "end": 7406, "loc": { "start": { - "line": 237, + "line": 266, "column": 4 }, "end": { - "line": 237, + "line": 266, "column": 97 } } @@ -22151,15 +24546,15 @@ { "type": "CommentLine", "value": " are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.", - "start": 6714, - "end": 6804, + "start": 7411, + "end": 7501, "loc": { "start": { - "line": 238, + "line": 267, "column": 4 }, "end": { - "line": 238, + "line": 267, "column": 94 } } @@ -22167,15 +24562,15 @@ { "type": "CommentLine", "value": " Get all components as an array", - "start": 6810, - "end": 6843, + "start": 7507, + "end": 7540, "loc": { "start": { - "line": 240, + "line": 269, "column": 4 }, "end": { - "line": 240, + "line": 269, "column": 37 } } @@ -22195,15 +24590,15 @@ "updateContext": null }, "value": "let", - "start": 6848, - "end": 6851, + "start": 7545, + "end": 7548, "loc": { "start": { - "line": 241, + "line": 270, "column": 4 }, "end": { - "line": 241, + "line": 270, "column": 7 } } @@ -22221,15 +24616,15 @@ "binop": null }, "value": "components", - "start": 6852, - "end": 6862, + "start": 7549, + "end": 7559, "loc": { "start": { - "line": 241, + "line": 270, "column": 8 }, "end": { - "line": 241, + "line": 270, "column": 18 } } @@ -22248,15 +24643,15 @@ "updateContext": null }, "value": "=", - "start": 6863, - "end": 6864, + "start": 7560, + "end": 7561, "loc": { "start": { - "line": 241, + "line": 270, "column": 19 }, "end": { - "line": 241, + "line": 270, "column": 20 } } @@ -22274,15 +24669,15 @@ "binop": null }, "value": "componentNames", - "start": 6865, - "end": 6879, + "start": 7562, + "end": 7576, "loc": { "start": { - "line": 241, + "line": 270, "column": 21 }, "end": { - "line": 241, + "line": 270, "column": 35 } } @@ -22300,15 +24695,15 @@ "binop": null, "updateContext": null }, - "start": 6879, - "end": 6880, + "start": 7576, + "end": 7577, "loc": { "start": { - "line": 241, + "line": 270, "column": 35 }, "end": { - "line": 241, + "line": 270, "column": 36 } } @@ -22326,15 +24721,15 @@ "binop": null }, "value": "map", - "start": 6880, - "end": 6883, + "start": 7577, + "end": 7580, "loc": { "start": { - "line": 241, + "line": 270, "column": 36 }, "end": { - "line": 241, + "line": 270, "column": 39 } } @@ -22351,15 +24746,15 @@ "postfix": false, "binop": null }, - "start": 6883, - "end": 6884, + "start": 7580, + "end": 7581, "loc": { "start": { - "line": 241, + "line": 270, "column": 39 }, "end": { - "line": 241, + "line": 270, "column": 40 } } @@ -22377,15 +24772,15 @@ "binop": null }, "value": "name", - "start": 6884, - "end": 6888, + "start": 7581, + "end": 7585, "loc": { "start": { - "line": 241, + "line": 270, "column": 40 }, "end": { - "line": 241, + "line": 270, "column": 44 } } @@ -22403,15 +24798,15 @@ "binop": null, "updateContext": null }, - "start": 6889, - "end": 6891, + "start": 7586, + "end": 7588, "loc": { "start": { - "line": 241, + "line": 270, "column": 45 }, "end": { - "line": 241, + "line": 270, "column": 47 } } @@ -22429,15 +24824,15 @@ "binop": null }, "value": "entity", - "start": 6892, - "end": 6898, + "start": 7589, + "end": 7595, "loc": { "start": { - "line": 241, + "line": 270, "column": 48 }, "end": { - "line": 241, + "line": 270, "column": 54 } } @@ -22455,15 +24850,15 @@ "binop": null, "updateContext": null }, - "start": 6898, - "end": 6899, + "start": 7595, + "end": 7596, "loc": { "start": { - "line": 241, + "line": 270, "column": 54 }, "end": { - "line": 241, + "line": 270, "column": 55 } } @@ -22481,15 +24876,15 @@ "binop": null }, "value": "get", - "start": 6899, - "end": 6902, + "start": 7596, + "end": 7599, "loc": { "start": { - "line": 241, + "line": 270, "column": 55 }, "end": { - "line": 241, + "line": 270, "column": 58 } } @@ -22506,15 +24901,15 @@ "postfix": false, "binop": null }, - "start": 6902, - "end": 6903, + "start": 7599, + "end": 7600, "loc": { "start": { - "line": 241, + "line": 270, "column": 58 }, "end": { - "line": 241, + "line": 270, "column": 59 } } @@ -22532,15 +24927,15 @@ "binop": null }, "value": "name", - "start": 6903, - "end": 6907, + "start": 7600, + "end": 7604, "loc": { "start": { - "line": 241, + "line": 270, "column": 59 }, "end": { - "line": 241, + "line": 270, "column": 63 } } @@ -22557,15 +24952,15 @@ "postfix": false, "binop": null }, - "start": 6907, - "end": 6908, + "start": 7604, + "end": 7605, "loc": { "start": { - "line": 241, + "line": 270, "column": 63 }, "end": { - "line": 241, + "line": 270, "column": 64 } } @@ -22582,15 +24977,15 @@ "postfix": false, "binop": null }, - "start": 6908, - "end": 6909, + "start": 7605, + "end": 7606, "loc": { "start": { - "line": 241, + "line": 270, "column": 64 }, "end": { - "line": 241, + "line": 270, "column": 65 } } @@ -22598,15 +24993,15 @@ { "type": "CommentLine", "value": " Pass components, then the main entity, then any additional arguments", - "start": 6915, - "end": 6986, + "start": 7612, + "end": 7683, "loc": { "start": { - "line": 243, + "line": 272, "column": 4 }, "end": { - "line": 243, + "line": 272, "column": 75 } } @@ -22626,15 +25021,15 @@ "updateContext": null }, "value": "let", - "start": 6991, - "end": 6994, + "start": 7688, + "end": 7691, "loc": { "start": { - "line": 244, + "line": 273, "column": 4 }, "end": { - "line": 244, + "line": 273, "column": 7 } } @@ -22652,15 +25047,15 @@ "binop": null }, "value": "status", - "start": 6995, - "end": 7001, + "start": 7692, + "end": 7698, "loc": { "start": { - "line": 244, + "line": 273, "column": 8 }, "end": { - "line": 244, + "line": 273, "column": 14 } } @@ -22679,15 +25074,15 @@ "updateContext": null }, "value": "=", - "start": 7002, - "end": 7003, + "start": 7699, + "end": 7700, "loc": { "start": { - "line": 244, + "line": 273, "column": 15 }, "end": { - "line": 244, + "line": 273, "column": 16 } } @@ -22705,15 +25100,15 @@ "binop": null }, "value": "callback", - "start": 7004, - "end": 7012, + "start": 7701, + "end": 7709, "loc": { "start": { - "line": 244, + "line": 273, "column": 17 }, "end": { - "line": 244, + "line": 273, "column": 25 } } @@ -22730,15 +25125,15 @@ "postfix": false, "binop": null }, - "start": 7012, - "end": 7013, + "start": 7709, + "end": 7710, "loc": { "start": { - "line": 244, + "line": 273, "column": 25 }, "end": { - "line": 244, + "line": 273, "column": 26 } } @@ -22756,15 +25151,15 @@ "binop": null, "updateContext": null }, - "start": 7013, - "end": 7016, + "start": 7710, + "end": 7713, "loc": { "start": { - "line": 244, + "line": 273, "column": 26 }, "end": { - "line": 244, + "line": 273, "column": 29 } } @@ -22782,15 +25177,15 @@ "binop": null }, "value": "components", - "start": 7016, - "end": 7026, + "start": 7713, + "end": 7723, "loc": { "start": { - "line": 244, + "line": 273, "column": 29 }, "end": { - "line": 244, + "line": 273, "column": 39 } } @@ -22808,15 +25203,15 @@ "binop": null, "updateContext": null }, - "start": 7026, - "end": 7027, + "start": 7723, + "end": 7724, "loc": { "start": { - "line": 244, + "line": 273, "column": 39 }, "end": { - "line": 244, + "line": 273, "column": 40 } } @@ -22834,15 +25229,15 @@ "binop": null }, "value": "entity", - "start": 7028, - "end": 7034, + "start": 7725, + "end": 7731, "loc": { "start": { - "line": 244, + "line": 273, "column": 41 }, "end": { - "line": 244, + "line": 273, "column": 47 } } @@ -22860,15 +25255,15 @@ "binop": null, "updateContext": null }, - "start": 7034, - "end": 7035, + "start": 7731, + "end": 7732, "loc": { "start": { - "line": 244, + "line": 273, "column": 47 }, "end": { - "line": 244, + "line": 273, "column": 48 } } @@ -22886,15 +25281,15 @@ "binop": null, "updateContext": null }, - "start": 7036, - "end": 7039, + "start": 7733, + "end": 7736, "loc": { "start": { - "line": 244, + "line": 273, "column": 49 }, "end": { - "line": 244, + "line": 273, "column": 52 } } @@ -22912,15 +25307,15 @@ "binop": null }, "value": "args", - "start": 7039, - "end": 7043, + "start": 7736, + "end": 7740, "loc": { "start": { - "line": 244, + "line": 273, "column": 52 }, "end": { - "line": 244, + "line": 273, "column": 56 } } @@ -22937,15 +25332,15 @@ "postfix": false, "binop": null }, - "start": 7043, - "end": 7044, + "start": 7740, + "end": 7741, "loc": { "start": { - "line": 244, + "line": 273, "column": 56 }, "end": { - "line": 244, + "line": 273, "column": 57 } } @@ -22953,15 +25348,15 @@ { "type": "CommentLine", "value": " Stop the iteration when the callback returns false", - "start": 7050, - "end": 7103, + "start": 7747, + "end": 7800, "loc": { "start": { - "line": 246, + "line": 275, "column": 4 }, "end": { - "line": 246, + "line": 275, "column": 57 } } @@ -22981,15 +25376,15 @@ "updateContext": null }, "value": "if", - "start": 7108, - "end": 7110, + "start": 7805, + "end": 7807, "loc": { "start": { - "line": 247, + "line": 276, "column": 4 }, "end": { - "line": 247, + "line": 276, "column": 6 } } @@ -23006,15 +25401,15 @@ "postfix": false, "binop": null }, - "start": 7111, - "end": 7112, + "start": 7808, + "end": 7809, "loc": { "start": { - "line": 247, + "line": 276, "column": 7 }, "end": { - "line": 247, + "line": 276, "column": 8 } } @@ -23032,15 +25427,15 @@ "binop": null }, "value": "status", - "start": 7112, - "end": 7118, + "start": 7809, + "end": 7815, "loc": { "start": { - "line": 247, + "line": 276, "column": 8 }, "end": { - "line": 247, + "line": 276, "column": 14 } } @@ -23059,15 +25454,15 @@ "updateContext": null }, "value": "===", - "start": 7119, - "end": 7122, + "start": 7816, + "end": 7819, "loc": { "start": { - "line": 247, + "line": 276, "column": 15 }, "end": { - "line": 247, + "line": 276, "column": 18 } } @@ -23087,15 +25482,15 @@ "updateContext": null }, "value": "false", - "start": 7123, - "end": 7128, + "start": 7820, + "end": 7825, "loc": { "start": { - "line": 247, + "line": 276, "column": 19 }, "end": { - "line": 247, + "line": 276, "column": 24 } } @@ -23112,15 +25507,15 @@ "postfix": false, "binop": null }, - "start": 7128, - "end": 7129, + "start": 7825, + "end": 7826, "loc": { "start": { - "line": 247, + "line": 276, "column": 24 }, "end": { - "line": 247, + "line": 276, "column": 25 } } @@ -23137,15 +25532,15 @@ "postfix": false, "binop": null }, - "start": 7130, - "end": 7131, + "start": 7827, + "end": 7828, "loc": { "start": { - "line": 247, + "line": 276, "column": 26 }, "end": { - "line": 247, + "line": 276, "column": 27 } } @@ -23165,15 +25560,15 @@ "updateContext": null }, "value": "break", - "start": 7137, - "end": 7142, + "start": 7834, + "end": 7839, "loc": { "start": { - "line": 248, + "line": 277, "column": 5 }, "end": { - "line": 248, + "line": 277, "column": 10 } } @@ -23190,15 +25585,15 @@ "postfix": false, "binop": null }, - "start": 7147, - "end": 7148, + "start": 7844, + "end": 7845, "loc": { "start": { - "line": 249, + "line": 278, "column": 4 }, "end": { - "line": 249, + "line": 278, "column": 5 } } @@ -23215,15 +25610,15 @@ "postfix": false, "binop": null }, - "start": 7152, - "end": 7153, + "start": 7849, + "end": 7850, "loc": { "start": { - "line": 250, + "line": 279, "column": 3 }, "end": { - "line": 250, + "line": 279, "column": 4 } } @@ -23240,15 +25635,15 @@ "postfix": false, "binop": null }, - "start": 7156, - "end": 7157, + "start": 7853, + "end": 7854, "loc": { "start": { - "line": 251, + "line": 280, "column": 2 }, "end": { - "line": 251, + "line": 280, "column": 3 } } @@ -23268,15 +25663,15 @@ "updateContext": null }, "value": "return", - "start": 7161, - "end": 7167, + "start": 7858, + "end": 7864, "loc": { "start": { - "line": 253, + "line": 282, "column": 2 }, "end": { - "line": 253, + "line": 282, "column": 8 } } @@ -23294,15 +25689,15 @@ "binop": null }, "value": "entities", - "start": 7168, - "end": 7176, + "start": 7865, + "end": 7873, "loc": { "start": { - "line": 253, + "line": 282, "column": 9 }, "end": { - "line": 253, + "line": 282, "column": 17 } } @@ -23320,15 +25715,15 @@ "binop": null, "updateContext": null }, - "start": 7176, - "end": 7177, + "start": 7873, + "end": 7874, "loc": { "start": { - "line": 253, + "line": 282, "column": 17 }, "end": { - "line": 253, + "line": 282, "column": 18 } } @@ -23346,15 +25741,15 @@ "binop": null }, "value": "values", - "start": 7177, - "end": 7183, + "start": 7874, + "end": 7880, "loc": { "start": { - "line": 253, + "line": 282, "column": 18 }, "end": { - "line": 253, + "line": 282, "column": 24 } } @@ -23371,15 +25766,15 @@ "postfix": false, "binop": null }, - "start": 7183, - "end": 7184, + "start": 7880, + "end": 7881, "loc": { "start": { - "line": 253, + "line": 282, "column": 24 }, "end": { - "line": 253, + "line": 282, "column": 25 } } @@ -23396,15 +25791,15 @@ "postfix": false, "binop": null }, - "start": 7184, - "end": 7185, + "start": 7881, + "end": 7882, "loc": { "start": { - "line": 253, + "line": 282, "column": 25 }, "end": { - "line": 253, + "line": 282, "column": 26 } } @@ -23421,15 +25816,15 @@ "postfix": false, "binop": null }, - "start": 7187, - "end": 7188, + "start": 7884, + "end": 7885, "loc": { "start": { - "line": 254, + "line": 283, "column": 1 }, "end": { - "line": 254, + "line": 283, "column": 2 } } @@ -23437,15 +25832,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t ", - "start": 7191, - "end": 7597, + "start": 7888, + "end": 8294, "loc": { "start": { - "line": 256, + "line": 285, "column": 1 }, "end": { - "line": 266, + "line": 295, "column": 4 } } @@ -23463,15 +25858,15 @@ "binop": null }, "value": "get", - "start": 7599, - "end": 7602, + "start": 8296, + "end": 8299, "loc": { "start": { - "line": 267, + "line": 296, "column": 1 }, "end": { - "line": 267, + "line": 296, "column": 4 } } @@ -23488,15 +25883,15 @@ "postfix": false, "binop": null }, - "start": 7602, - "end": 7603, + "start": 8299, + "end": 8300, "loc": { "start": { - "line": 267, + "line": 296, "column": 4 }, "end": { - "line": 267, + "line": 296, "column": 5 } } @@ -23514,15 +25909,15 @@ "binop": null, "updateContext": null }, - "start": 7603, - "end": 7606, + "start": 8300, + "end": 8303, "loc": { "start": { - "line": 267, + "line": 296, "column": 5 }, "end": { - "line": 267, + "line": 296, "column": 8 } } @@ -23540,15 +25935,15 @@ "binop": null }, "value": "componentNames", - "start": 7606, - "end": 7620, + "start": 8303, + "end": 8317, "loc": { "start": { - "line": 267, + "line": 296, "column": 8 }, "end": { - "line": 267, + "line": 296, "column": 22 } } @@ -23565,15 +25960,15 @@ "postfix": false, "binop": null }, - "start": 7620, - "end": 7621, + "start": 8317, + "end": 8318, "loc": { "start": { - "line": 267, + "line": 296, "column": 22 }, "end": { - "line": 267, + "line": 296, "column": 23 } } @@ -23590,15 +25985,15 @@ "postfix": false, "binop": null }, - "start": 7622, - "end": 7623, + "start": 8319, + "end": 8320, "loc": { "start": { - "line": 267, + "line": 296, "column": 24 }, "end": { - "line": 267, + "line": 296, "column": 25 } } @@ -23618,15 +26013,15 @@ "updateContext": null }, "value": "return", - "start": 7626, - "end": 7632, + "start": 8323, + "end": 8329, "loc": { "start": { - "line": 268, + "line": 297, "column": 2 }, "end": { - "line": 268, + "line": 297, "column": 8 } } @@ -23644,15 +26039,15 @@ "binop": null, "updateContext": null }, - "start": 7633, - "end": 7634, + "start": 8330, + "end": 8331, "loc": { "start": { - "line": 268, + "line": 297, "column": 9 }, "end": { - "line": 268, + "line": 297, "column": 10 } } @@ -23670,15 +26065,15 @@ "binop": null, "updateContext": null }, - "start": 7634, - "end": 7637, + "start": 8331, + "end": 8334, "loc": { "start": { - "line": 268, + "line": 297, "column": 10 }, "end": { - "line": 268, + "line": 297, "column": 13 } } @@ -23698,15 +26093,15 @@ "updateContext": null }, "value": "this", - "start": 7637, - "end": 7641, + "start": 8334, + "end": 8338, "loc": { "start": { - "line": 268, + "line": 297, "column": 13 }, "end": { - "line": 268, + "line": 297, "column": 17 } } @@ -23724,15 +26119,15 @@ "binop": null, "updateContext": null }, - "start": 7641, - "end": 7642, + "start": 8338, + "end": 8339, "loc": { "start": { - "line": 268, + "line": 297, "column": 17 }, "end": { - "line": 268, + "line": 297, "column": 18 } } @@ -23750,15 +26145,15 @@ "binop": null }, "value": "every", - "start": 7642, - "end": 7647, + "start": 8339, + "end": 8344, "loc": { "start": { - "line": 268, + "line": 297, "column": 18 }, "end": { - "line": 268, + "line": 297, "column": 23 } } @@ -23775,15 +26170,15 @@ "postfix": false, "binop": null }, - "start": 7647, - "end": 7648, + "start": 8344, + "end": 8345, "loc": { "start": { - "line": 268, + "line": 297, "column": 23 }, "end": { - "line": 268, + "line": 297, "column": 24 } } @@ -23801,15 +26196,15 @@ "binop": null }, "value": "componentNames", - "start": 7648, - "end": 7662, + "start": 8345, + "end": 8359, "loc": { "start": { - "line": 268, + "line": 297, "column": 24 }, "end": { - "line": 268, + "line": 297, "column": 38 } } @@ -23826,15 +26221,15 @@ "postfix": false, "binop": null }, - "start": 7662, - "end": 7663, + "start": 8359, + "end": 8360, "loc": { "start": { - "line": 268, + "line": 297, "column": 38 }, "end": { - "line": 268, + "line": 297, "column": 39 } } @@ -23852,15 +26247,15 @@ "binop": null, "updateContext": null }, - "start": 7663, - "end": 7664, + "start": 8360, + "end": 8361, "loc": { "start": { - "line": 268, + "line": 297, "column": 39 }, "end": { - "line": 268, + "line": 297, "column": 40 } } @@ -23877,15 +26272,15 @@ "postfix": false, "binop": null }, - "start": 7666, - "end": 7667, + "start": 8363, + "end": 8364, "loc": { "start": { - "line": 269, + "line": 298, "column": 1 }, "end": { - "line": 269, + "line": 298, "column": 2 } } @@ -23893,15 +26288,15 @@ { "type": "CommentBlock", "value": "*\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t ", - "start": 7670, - "end": 8150, + "start": 8367, + "end": 8847, "loc": { "start": { - "line": 271, + "line": 300, "column": 1 }, "end": { - "line": 286, + "line": 315, "column": 4 } } @@ -23919,15 +26314,15 @@ "binop": null }, "value": "prototype", - "start": 8152, - "end": 8161, + "start": 8849, + "end": 8858, "loc": { "start": { - "line": 287, + "line": 316, "column": 1 }, "end": { - "line": 287, + "line": 316, "column": 10 } } @@ -23944,15 +26339,15 @@ "postfix": false, "binop": null }, - "start": 8161, - "end": 8162, + "start": 8858, + "end": 8859, "loc": { "start": { - "line": 287, + "line": 316, "column": 10 }, "end": { - "line": 287, + "line": 316, "column": 11 } } @@ -23970,15 +26365,15 @@ "binop": null }, "value": "data", - "start": 8162, - "end": 8166, + "start": 8859, + "end": 8863, "loc": { "start": { - "line": 287, + "line": 316, "column": 11 }, "end": { - "line": 287, + "line": 316, "column": 15 } } @@ -23995,15 +26390,15 @@ "postfix": false, "binop": null }, - "start": 8166, - "end": 8167, + "start": 8863, + "end": 8864, "loc": { "start": { - "line": 287, + "line": 316, "column": 15 }, "end": { - "line": 287, + "line": 316, "column": 16 } } @@ -24020,15 +26415,15 @@ "postfix": false, "binop": null }, - "start": 8168, - "end": 8169, + "start": 8865, + "end": 8866, "loc": { "start": { - "line": 287, + "line": 316, "column": 17 }, "end": { - "line": 287, + "line": 316, "column": 18 } } @@ -24048,15 +26443,15 @@ "updateContext": null }, "value": "let", - "start": 8172, - "end": 8175, + "start": 8869, + "end": 8872, "loc": { "start": { - "line": 288, + "line": 317, "column": 2 }, "end": { - "line": 288, + "line": 317, "column": 5 } } @@ -24074,15 +26469,15 @@ "binop": null }, "value": "count", - "start": 8176, - "end": 8181, + "start": 8873, + "end": 8878, "loc": { "start": { - "line": 288, + "line": 317, "column": 6 }, "end": { - "line": 288, + "line": 317, "column": 11 } } @@ -24101,15 +26496,15 @@ "updateContext": null }, "value": "=", - "start": 8182, - "end": 8183, + "start": 8879, + "end": 8880, "loc": { "start": { - "line": 288, + "line": 317, "column": 12 }, "end": { - "line": 288, + "line": 317, "column": 13 } } @@ -24128,15 +26523,15 @@ "updateContext": null }, "value": 0, - "start": 8184, - "end": 8185, + "start": 8881, + "end": 8882, "loc": { "start": { - "line": 288, + "line": 317, "column": 14 }, "end": { - "line": 288, + "line": 317, "column": 15 } } @@ -24144,15 +26539,15 @@ { "type": "CommentLine", "value": " Convert to an object when given a string", - "start": 8189, - "end": 8232, + "start": 8886, + "end": 8929, "loc": { "start": { - "line": 290, + "line": 319, "column": 2 }, "end": { - "line": 290, + "line": 319, "column": 45 } } @@ -24172,15 +26567,15 @@ "updateContext": null }, "value": "if", - "start": 8235, - "end": 8237, + "start": 8932, + "end": 8934, "loc": { "start": { - "line": 291, + "line": 320, "column": 2 }, "end": { - "line": 291, + "line": 320, "column": 4 } } @@ -24197,15 +26592,15 @@ "postfix": false, "binop": null }, - "start": 8238, - "end": 8239, + "start": 8935, + "end": 8936, "loc": { "start": { - "line": 291, + "line": 320, "column": 5 }, "end": { - "line": 291, + "line": 320, "column": 6 } } @@ -24225,15 +26620,15 @@ "updateContext": null }, "value": "typeof", - "start": 8239, - "end": 8245, + "start": 8936, + "end": 8942, "loc": { "start": { - "line": 291, + "line": 320, "column": 6 }, "end": { - "line": 291, + "line": 320, "column": 12 } } @@ -24251,15 +26646,15 @@ "binop": null }, "value": "data", - "start": 8246, - "end": 8250, + "start": 8943, + "end": 8947, "loc": { "start": { - "line": 291, + "line": 320, "column": 13 }, "end": { - "line": 291, + "line": 320, "column": 17 } } @@ -24278,15 +26673,15 @@ "updateContext": null }, "value": "===", - "start": 8251, - "end": 8254, + "start": 8948, + "end": 8951, "loc": { "start": { - "line": 291, + "line": 320, "column": 18 }, "end": { - "line": 291, + "line": 320, "column": 21 } } @@ -24305,15 +26700,15 @@ "updateContext": null }, "value": "string", - "start": 8255, - "end": 8263, + "start": 8952, + "end": 8960, "loc": { "start": { - "line": 291, + "line": 320, "column": 22 }, "end": { - "line": 291, + "line": 320, "column": 30 } } @@ -24330,15 +26725,15 @@ "postfix": false, "binop": null }, - "start": 8263, - "end": 8264, + "start": 8960, + "end": 8961, "loc": { "start": { - "line": 291, + "line": 320, "column": 30 }, "end": { - "line": 291, + "line": 320, "column": 31 } } @@ -24355,15 +26750,15 @@ "postfix": false, "binop": null }, - "start": 8265, - "end": 8266, + "start": 8962, + "end": 8963, "loc": { "start": { - "line": 291, + "line": 320, "column": 32 }, "end": { - "line": 291, + "line": 320, "column": 33 } } @@ -24381,15 +26776,15 @@ "binop": null }, "value": "data", - "start": 8270, - "end": 8274, + "start": 8967, + "end": 8971, "loc": { "start": { - "line": 292, + "line": 321, "column": 3 }, "end": { - "line": 292, + "line": 321, "column": 7 } } @@ -24408,15 +26803,15 @@ "updateContext": null }, "value": "=", - "start": 8275, - "end": 8276, + "start": 8972, + "end": 8973, "loc": { "start": { - "line": 292, + "line": 321, "column": 8 }, "end": { - "line": 292, + "line": 321, "column": 9 } } @@ -24434,15 +26829,15 @@ "binop": null }, "value": "JSON", - "start": 8277, - "end": 8281, + "start": 8974, + "end": 8978, "loc": { "start": { - "line": 292, + "line": 321, "column": 10 }, "end": { - "line": 292, + "line": 321, "column": 14 } } @@ -24460,15 +26855,15 @@ "binop": null, "updateContext": null }, - "start": 8281, - "end": 8282, + "start": 8978, + "end": 8979, "loc": { "start": { - "line": 292, + "line": 321, "column": 14 }, "end": { - "line": 292, + "line": 321, "column": 15 } } @@ -24486,15 +26881,15 @@ "binop": null }, "value": "parse", - "start": 8282, - "end": 8287, + "start": 8979, + "end": 8984, "loc": { "start": { - "line": 292, + "line": 321, "column": 15 }, "end": { - "line": 292, + "line": 321, "column": 20 } } @@ -24511,15 +26906,15 @@ "postfix": false, "binop": null }, - "start": 8287, - "end": 8288, + "start": 8984, + "end": 8985, "loc": { "start": { - "line": 292, + "line": 321, "column": 20 }, "end": { - "line": 292, + "line": 321, "column": 21 } } @@ -24537,15 +26932,15 @@ "binop": null }, "value": "data", - "start": 8288, - "end": 8292, + "start": 8985, + "end": 8989, "loc": { "start": { - "line": 292, + "line": 321, "column": 21 }, "end": { - "line": 292, + "line": 321, "column": 25 } } @@ -24562,15 +26957,15 @@ "postfix": false, "binop": null }, - "start": 8292, - "end": 8293, + "start": 8989, + "end": 8990, "loc": { "start": { - "line": 292, + "line": 321, "column": 25 }, "end": { - "line": 292, + "line": 321, "column": 26 } } @@ -24587,15 +26982,15 @@ "postfix": false, "binop": null }, - "start": 8296, - "end": 8297, + "start": 8993, + "end": 8994, "loc": { "start": { - "line": 293, + "line": 322, "column": 2 }, "end": { - "line": 293, + "line": 322, "column": 3 } } @@ -24603,15 +26998,15 @@ { "type": "CommentLine", "value": " Data must be an object at this point", - "start": 8301, - "end": 8340, + "start": 8998, + "end": 9037, "loc": { "start": { - "line": 295, + "line": 324, "column": 2 }, "end": { - "line": 295, + "line": 324, "column": 41 } } @@ -24631,15 +27026,15 @@ "updateContext": null }, "value": "if", - "start": 8343, - "end": 8345, + "start": 9040, + "end": 9042, "loc": { "start": { - "line": 296, + "line": 325, "column": 2 }, "end": { - "line": 296, + "line": 325, "column": 4 } } @@ -24656,15 +27051,15 @@ "postfix": false, "binop": null }, - "start": 8346, - "end": 8347, + "start": 9043, + "end": 9044, "loc": { "start": { - "line": 296, + "line": 325, "column": 5 }, "end": { - "line": 296, + "line": 325, "column": 6 } } @@ -24684,15 +27079,15 @@ "updateContext": null }, "value": "typeof", - "start": 8347, - "end": 8353, + "start": 9044, + "end": 9050, "loc": { "start": { - "line": 296, + "line": 325, "column": 6 }, "end": { - "line": 296, + "line": 325, "column": 12 } } @@ -24710,15 +27105,15 @@ "binop": null }, "value": "data", - "start": 8354, - "end": 8358, + "start": 9051, + "end": 9055, "loc": { "start": { - "line": 296, + "line": 325, "column": 13 }, "end": { - "line": 296, + "line": 325, "column": 17 } } @@ -24737,15 +27132,15 @@ "updateContext": null }, "value": "===", - "start": 8359, - "end": 8362, + "start": 9056, + "end": 9059, "loc": { "start": { - "line": 296, + "line": 325, "column": 18 }, "end": { - "line": 296, + "line": 325, "column": 21 } } @@ -24764,15 +27159,15 @@ "updateContext": null }, "value": "object", - "start": 8363, - "end": 8371, + "start": 9060, + "end": 9068, "loc": { "start": { - "line": 296, + "line": 325, "column": 22 }, "end": { - "line": 296, + "line": 325, "column": 30 } } @@ -24789,15 +27184,15 @@ "postfix": false, "binop": null }, - "start": 8371, - "end": 8372, + "start": 9068, + "end": 9069, "loc": { "start": { - "line": 296, + "line": 325, "column": 30 }, "end": { - "line": 296, + "line": 325, "column": 31 } } @@ -24814,15 +27209,15 @@ "postfix": false, "binop": null }, - "start": 8373, - "end": 8374, + "start": 9070, + "end": 9071, "loc": { "start": { - "line": 296, + "line": 325, "column": 32 }, "end": { - "line": 296, + "line": 325, "column": 33 } } @@ -24830,15 +27225,15 @@ { "type": "CommentLine", "value": " Iterate through prototype names", - "start": 8378, - "end": 8412, + "start": 9075, + "end": 9109, "loc": { "start": { - "line": 297, + "line": 326, "column": 3 }, "end": { - "line": 297, + "line": 326, "column": 37 } } @@ -24858,15 +27253,15 @@ "updateContext": null }, "value": "for", - "start": 8416, - "end": 8419, + "start": 9113, + "end": 9116, "loc": { "start": { - "line": 298, + "line": 327, "column": 3 }, "end": { - "line": 298, + "line": 327, "column": 6 } } @@ -24883,15 +27278,15 @@ "postfix": false, "binop": null }, - "start": 8420, - "end": 8421, + "start": 9117, + "end": 9118, "loc": { "start": { - "line": 298, + "line": 327, "column": 7 }, "end": { - "line": 298, + "line": 327, "column": 8 } } @@ -24911,15 +27306,15 @@ "updateContext": null }, "value": "let", - "start": 8421, - "end": 8424, + "start": 9118, + "end": 9121, "loc": { "start": { - "line": 298, + "line": 327, "column": 8 }, "end": { - "line": 298, + "line": 327, "column": 11 } } @@ -24937,15 +27332,15 @@ "binop": null }, "value": "protoName", - "start": 8425, - "end": 8434, + "start": 9122, + "end": 9131, "loc": { "start": { - "line": 298, + "line": 327, "column": 12 }, "end": { - "line": 298, + "line": 327, "column": 21 } } @@ -24965,15 +27360,15 @@ "updateContext": null }, "value": "in", - "start": 8435, - "end": 8437, + "start": 9132, + "end": 9134, "loc": { "start": { - "line": 298, + "line": 327, "column": 22 }, "end": { - "line": 298, + "line": 327, "column": 24 } } @@ -24991,15 +27386,15 @@ "binop": null }, "value": "data", - "start": 8438, - "end": 8442, + "start": 9135, + "end": 9139, "loc": { "start": { - "line": 298, + "line": 327, "column": 25 }, "end": { - "line": 298, + "line": 327, "column": 29 } } @@ -25016,15 +27411,15 @@ "postfix": false, "binop": null }, - "start": 8442, - "end": 8443, + "start": 9139, + "end": 9140, "loc": { "start": { - "line": 298, + "line": 327, "column": 29 }, "end": { - "line": 298, + "line": 327, "column": 30 } } @@ -25041,15 +27436,15 @@ "postfix": false, "binop": null }, - "start": 8444, - "end": 8445, + "start": 9141, + "end": 9142, "loc": { "start": { - "line": 298, + "line": 327, "column": 31 }, "end": { - "line": 298, + "line": 327, "column": 32 } } @@ -25069,15 +27464,15 @@ "updateContext": null }, "value": "let", - "start": 8450, - "end": 8453, + "start": 9147, + "end": 9150, "loc": { "start": { - "line": 299, + "line": 328, "column": 4 }, "end": { - "line": 299, + "line": 328, "column": 7 } } @@ -25095,15 +27490,15 @@ "binop": null }, "value": "inputObject", - "start": 8454, - "end": 8465, + "start": 9151, + "end": 9162, "loc": { "start": { - "line": 299, + "line": 328, "column": 8 }, "end": { - "line": 299, + "line": 328, "column": 19 } } @@ -25122,15 +27517,15 @@ "updateContext": null }, "value": "=", - "start": 8466, - "end": 8467, + "start": 9163, + "end": 9164, "loc": { "start": { - "line": 299, + "line": 328, "column": 20 }, "end": { - "line": 299, + "line": 328, "column": 21 } } @@ -25148,15 +27543,15 @@ "binop": null }, "value": "data", - "start": 8468, - "end": 8472, + "start": 9165, + "end": 9169, "loc": { "start": { - "line": 299, + "line": 328, "column": 22 }, "end": { - "line": 299, + "line": 328, "column": 26 } } @@ -25174,15 +27569,15 @@ "binop": null, "updateContext": null }, - "start": 8472, - "end": 8473, + "start": 9169, + "end": 9170, "loc": { "start": { - "line": 299, + "line": 328, "column": 26 }, "end": { - "line": 299, + "line": 328, "column": 27 } } @@ -25200,15 +27595,15 @@ "binop": null }, "value": "protoName", - "start": 8473, - "end": 8482, + "start": 9170, + "end": 9179, "loc": { "start": { - "line": 299, + "line": 328, "column": 27 }, "end": { - "line": 299, + "line": 328, "column": 36 } } @@ -25226,15 +27621,15 @@ "binop": null, "updateContext": null }, - "start": 8482, - "end": 8483, + "start": 9179, + "end": 9180, "loc": { "start": { - "line": 299, + "line": 328, "column": 36 }, "end": { - "line": 299, + "line": 328, "column": 37 } } @@ -25254,15 +27649,15 @@ "updateContext": null }, "value": "let", - "start": 8488, - "end": 8491, + "start": 9185, + "end": 9188, "loc": { "start": { - "line": 300, + "line": 329, "column": 4 }, "end": { - "line": 300, + "line": 329, "column": 7 } } @@ -25280,15 +27675,15 @@ "binop": null }, "value": "protoObject", - "start": 8492, - "end": 8503, + "start": 9189, + "end": 9200, "loc": { "start": { - "line": 300, + "line": 329, "column": 8 }, "end": { - "line": 300, + "line": 329, "column": 19 } } @@ -25307,15 +27702,15 @@ "updateContext": null }, "value": "=", - "start": 8504, - "end": 8505, + "start": 9201, + "end": 9202, "loc": { "start": { - "line": 300, + "line": 329, "column": 20 }, "end": { - "line": 300, + "line": 329, "column": 21 } } @@ -25332,15 +27727,15 @@ "postfix": false, "binop": null }, - "start": 8506, - "end": 8507, + "start": 9203, + "end": 9204, "loc": { "start": { - "line": 300, + "line": 329, "column": 22 }, "end": { - "line": 300, + "line": 329, "column": 23 } } @@ -25357,15 +27752,15 @@ "postfix": false, "binop": null }, - "start": 8507, - "end": 8508, + "start": 9204, + "end": 9205, "loc": { "start": { - "line": 300, + "line": 329, "column": 23 }, "end": { - "line": 300, + "line": 329, "column": 24 } } @@ -25373,15 +27768,15 @@ { "type": "CommentLine", "value": " Iterate through component names", - "start": 8513, - "end": 8547, + "start": 9210, + "end": 9244, "loc": { "start": { - "line": 301, + "line": 330, "column": 4 }, "end": { - "line": 301, + "line": 330, "column": 38 } } @@ -25401,15 +27796,15 @@ "updateContext": null }, "value": "for", - "start": 8552, - "end": 8555, + "start": 9249, + "end": 9252, "loc": { "start": { - "line": 302, + "line": 331, "column": 4 }, "end": { - "line": 302, + "line": 331, "column": 7 } } @@ -25426,15 +27821,15 @@ "postfix": false, "binop": null }, - "start": 8556, - "end": 8557, + "start": 9253, + "end": 9254, "loc": { "start": { - "line": 302, + "line": 331, "column": 8 }, "end": { - "line": 302, + "line": 331, "column": 9 } } @@ -25454,15 +27849,15 @@ "updateContext": null }, "value": "let", - "start": 8557, - "end": 8560, + "start": 9254, + "end": 9257, "loc": { "start": { - "line": 302, + "line": 331, "column": 9 }, "end": { - "line": 302, + "line": 331, "column": 12 } } @@ -25480,15 +27875,15 @@ "binop": null }, "value": "compName", - "start": 8561, - "end": 8569, + "start": 9258, + "end": 9266, "loc": { "start": { - "line": 302, + "line": 331, "column": 13 }, "end": { - "line": 302, + "line": 331, "column": 21 } } @@ -25508,15 +27903,15 @@ "updateContext": null }, "value": "in", - "start": 8570, - "end": 8572, + "start": 9267, + "end": 9269, "loc": { "start": { - "line": 302, + "line": 331, "column": 22 }, "end": { - "line": 302, + "line": 331, "column": 24 } } @@ -25534,15 +27929,15 @@ "binop": null }, "value": "inputObject", - "start": 8573, - "end": 8584, + "start": 9270, + "end": 9281, "loc": { "start": { - "line": 302, + "line": 331, "column": 25 }, "end": { - "line": 302, + "line": 331, "column": 36 } } @@ -25559,15 +27954,15 @@ "postfix": false, "binop": null }, - "start": 8584, - "end": 8585, + "start": 9281, + "end": 9282, "loc": { "start": { - "line": 302, + "line": 331, "column": 36 }, "end": { - "line": 302, + "line": 331, "column": 37 } } @@ -25584,15 +27979,15 @@ "postfix": false, "binop": null }, - "start": 8586, - "end": 8587, + "start": 9283, + "end": 9284, "loc": { "start": { - "line": 302, + "line": 331, "column": 38 }, "end": { - "line": 302, + "line": 331, "column": 39 } } @@ -25600,15 +27995,15 @@ { "type": "CommentLine", "value": " Store strings of each component", - "start": 8593, - "end": 8627, + "start": 9290, + "end": 9324, "loc": { "start": { - "line": 303, + "line": 332, "column": 5 }, "end": { - "line": 303, + "line": 332, "column": 39 } } @@ -25626,15 +28021,15 @@ "binop": null }, "value": "protoObject", - "start": 8633, - "end": 8644, + "start": 9330, + "end": 9341, "loc": { "start": { - "line": 304, + "line": 333, "column": 5 }, "end": { - "line": 304, + "line": 333, "column": 16 } } @@ -25652,15 +28047,15 @@ "binop": null, "updateContext": null }, - "start": 8644, - "end": 8645, + "start": 9341, + "end": 9342, "loc": { "start": { - "line": 304, + "line": 333, "column": 16 }, "end": { - "line": 304, + "line": 333, "column": 17 } } @@ -25678,15 +28073,15 @@ "binop": null }, "value": "compName", - "start": 8645, - "end": 8653, + "start": 9342, + "end": 9350, "loc": { "start": { - "line": 304, + "line": 333, "column": 17 }, "end": { - "line": 304, + "line": 333, "column": 25 } } @@ -25704,15 +28099,15 @@ "binop": null, "updateContext": null }, - "start": 8653, - "end": 8654, + "start": 9350, + "end": 9351, "loc": { "start": { - "line": 304, + "line": 333, "column": 25 }, "end": { - "line": 304, + "line": 333, "column": 26 } } @@ -25731,15 +28126,15 @@ "updateContext": null }, "value": "=", - "start": 8655, - "end": 8656, + "start": 9352, + "end": 9353, "loc": { "start": { - "line": 304, + "line": 333, "column": 27 }, "end": { - "line": 304, + "line": 333, "column": 28 } } @@ -25757,15 +28152,15 @@ "binop": null }, "value": "JSON", - "start": 8657, - "end": 8661, + "start": 9354, + "end": 9358, "loc": { "start": { - "line": 304, + "line": 333, "column": 29 }, "end": { - "line": 304, + "line": 333, "column": 33 } } @@ -25783,15 +28178,15 @@ "binop": null, "updateContext": null }, - "start": 8661, - "end": 8662, + "start": 9358, + "end": 9359, "loc": { "start": { - "line": 304, + "line": 333, "column": 33 }, "end": { - "line": 304, + "line": 333, "column": 34 } } @@ -25809,15 +28204,15 @@ "binop": null }, "value": "stringify", - "start": 8662, - "end": 8671, + "start": 9359, + "end": 9368, "loc": { "start": { - "line": 304, + "line": 333, "column": 34 }, "end": { - "line": 304, + "line": 333, "column": 43 } } @@ -25834,15 +28229,15 @@ "postfix": false, "binop": null }, - "start": 8671, - "end": 8672, + "start": 9368, + "end": 9369, "loc": { "start": { - "line": 304, + "line": 333, "column": 43 }, "end": { - "line": 304, + "line": 333, "column": 44 } } @@ -25860,15 +28255,15 @@ "binop": null }, "value": "inputObject", - "start": 8672, - "end": 8683, + "start": 9369, + "end": 9380, "loc": { "start": { - "line": 304, + "line": 333, "column": 44 }, "end": { - "line": 304, + "line": 333, "column": 55 } } @@ -25886,15 +28281,15 @@ "binop": null, "updateContext": null }, - "start": 8683, - "end": 8684, + "start": 9380, + "end": 9381, "loc": { "start": { - "line": 304, + "line": 333, "column": 55 }, "end": { - "line": 304, + "line": 333, "column": 56 } } @@ -25912,15 +28307,15 @@ "binop": null }, "value": "compName", - "start": 8684, - "end": 8692, + "start": 9381, + "end": 9389, "loc": { "start": { - "line": 304, + "line": 333, "column": 56 }, "end": { - "line": 304, + "line": 333, "column": 64 } } @@ -25938,15 +28333,15 @@ "binop": null, "updateContext": null }, - "start": 8692, - "end": 8693, + "start": 9389, + "end": 9390, "loc": { "start": { - "line": 304, + "line": 333, "column": 64 }, "end": { - "line": 304, + "line": 333, "column": 65 } } @@ -25963,15 +28358,15 @@ "postfix": false, "binop": null }, - "start": 8693, - "end": 8694, + "start": 9390, + "end": 9391, "loc": { "start": { - "line": 304, + "line": 333, "column": 65 }, "end": { - "line": 304, + "line": 333, "column": 66 } } @@ -25988,15 +28383,15 @@ "postfix": false, "binop": null }, - "start": 8699, - "end": 8700, + "start": 9396, + "end": 9397, "loc": { "start": { - "line": 305, + "line": 334, "column": 4 }, "end": { - "line": 305, + "line": 334, "column": 5 } } @@ -26016,15 +28411,15 @@ "updateContext": null }, "value": "this", - "start": 8705, - "end": 8709, + "start": 9402, + "end": 9406, "loc": { "start": { - "line": 306, + "line": 335, "column": 4 }, "end": { - "line": 306, + "line": 335, "column": 8 } } @@ -26042,15 +28437,15 @@ "binop": null, "updateContext": null }, - "start": 8709, - "end": 8710, + "start": 9406, + "end": 9407, "loc": { "start": { - "line": 306, + "line": 335, "column": 8 }, "end": { - "line": 306, + "line": 335, "column": 9 } } @@ -26068,15 +28463,15 @@ "binop": null }, "value": "entityTemplates", - "start": 8710, - "end": 8725, + "start": 9407, + "end": 9422, "loc": { "start": { - "line": 306, + "line": 335, "column": 9 }, "end": { - "line": 306, + "line": 335, "column": 24 } } @@ -26094,15 +28489,15 @@ "binop": null, "updateContext": null }, - "start": 8725, - "end": 8726, + "start": 9422, + "end": 9423, "loc": { "start": { - "line": 306, + "line": 335, "column": 24 }, "end": { - "line": 306, + "line": 335, "column": 25 } } @@ -26120,15 +28515,15 @@ "binop": null }, "value": "protoName", - "start": 8726, - "end": 8735, + "start": 9423, + "end": 9432, "loc": { "start": { - "line": 306, + "line": 335, "column": 25 }, "end": { - "line": 306, + "line": 335, "column": 34 } } @@ -26146,15 +28541,15 @@ "binop": null, "updateContext": null }, - "start": 8735, - "end": 8736, + "start": 9432, + "end": 9433, "loc": { "start": { - "line": 306, + "line": 335, "column": 34 }, "end": { - "line": 306, + "line": 335, "column": 35 } } @@ -26173,15 +28568,15 @@ "updateContext": null }, "value": "=", - "start": 8737, - "end": 8738, + "start": 9434, + "end": 9435, "loc": { "start": { - "line": 306, + "line": 335, "column": 36 }, "end": { - "line": 306, + "line": 335, "column": 37 } } @@ -26199,15 +28594,15 @@ "binop": null }, "value": "protoObject", - "start": 8739, - "end": 8750, + "start": 9436, + "end": 9447, "loc": { "start": { - "line": 306, + "line": 335, "column": 38 }, "end": { - "line": 306, + "line": 335, "column": 49 } } @@ -26225,15 +28620,15 @@ "binop": null }, "value": "++", - "start": 8755, - "end": 8757, + "start": 9452, + "end": 9454, "loc": { "start": { - "line": 307, + "line": 336, "column": 4 }, "end": { - "line": 307, + "line": 336, "column": 6 } } @@ -26251,15 +28646,15 @@ "binop": null }, "value": "count", - "start": 8757, - "end": 8762, + "start": 9454, + "end": 9459, "loc": { "start": { - "line": 307, + "line": 336, "column": 6 }, "end": { - "line": 307, + "line": 336, "column": 11 } } @@ -26276,15 +28671,15 @@ "postfix": false, "binop": null }, - "start": 8766, - "end": 8767, + "start": 9463, + "end": 9464, "loc": { "start": { - "line": 308, + "line": 337, "column": 3 }, "end": { - "line": 308, + "line": 337, "column": 4 } } @@ -26301,15 +28696,15 @@ "postfix": false, "binop": null }, - "start": 8770, - "end": 8771, + "start": 9467, + "end": 9468, "loc": { "start": { - "line": 309, + "line": 338, "column": 2 }, "end": { - "line": 309, + "line": 338, "column": 3 } } @@ -26329,15 +28724,15 @@ "updateContext": null }, "value": "return", - "start": 8775, - "end": 8781, + "start": 9472, + "end": 9478, "loc": { "start": { - "line": 311, + "line": 340, "column": 2 }, "end": { - "line": 311, + "line": 340, "column": 8 } } @@ -26355,15 +28750,15 @@ "binop": null }, "value": "count", - "start": 8782, - "end": 8787, + "start": 9479, + "end": 9484, "loc": { "start": { - "line": 311, + "line": 340, "column": 9 }, "end": { - "line": 311, + "line": 340, "column": 14 } } @@ -26380,15 +28775,15 @@ "postfix": false, "binop": null }, - "start": 8789, - "end": 8790, + "start": 9486, + "end": 9487, "loc": { "start": { - "line": 312, + "line": 341, "column": 1 }, "end": { - "line": 312, + "line": 341, "column": 2 } } @@ -26405,15 +28800,15 @@ "postfix": false, "binop": null }, - "start": 8791, - "end": 8792, + "start": 9488, + "end": 9489, "loc": { "start": { - "line": 313, + "line": 342, "column": 0 }, "end": { - "line": 313, + "line": 342, "column": 1 } } @@ -26431,15 +28826,15 @@ "binop": null }, "value": "exports", - "start": 8794, - "end": 8801, + "start": 9491, + "end": 9498, "loc": { "start": { - "line": 315, + "line": 344, "column": 0 }, "end": { - "line": 315, + "line": 344, "column": 7 } } @@ -26457,15 +28852,15 @@ "binop": null, "updateContext": null }, - "start": 8801, - "end": 8802, + "start": 9498, + "end": 9499, "loc": { "start": { - "line": 315, + "line": 344, "column": 7 }, "end": { - "line": 315, + "line": 344, "column": 8 } } @@ -26483,15 +28878,15 @@ "binop": null }, "value": "World", - "start": 8802, - "end": 8807, + "start": 9499, + "end": 9504, "loc": { "start": { - "line": 315, + "line": 344, "column": 8 }, "end": { - "line": 315, + "line": 344, "column": 13 } } @@ -26510,15 +28905,15 @@ "updateContext": null }, "value": "=", - "start": 8808, - "end": 8809, + "start": 9505, + "end": 9506, "loc": { "start": { - "line": 315, + "line": 344, "column": 14 }, "end": { - "line": 315, + "line": 344, "column": 15 } } @@ -26536,15 +28931,15 @@ "binop": null }, "value": "World", - "start": 8810, - "end": 8815, + "start": 9507, + "end": 9512, "loc": { "start": { - "line": 315, + "line": 344, "column": 16 }, "end": { - "line": 315, + "line": 344, "column": 21 } } @@ -26562,15 +28957,15 @@ "binop": null, "updateContext": null }, - "start": 8816, - "end": 8816, + "start": 9513, + "end": 9513, "loc": { "start": { - "line": 316, + "line": 345, "column": 0 }, "end": { - "line": 316, + "line": 345, "column": 0 } } diff --git a/docs/class/src/entity.js~Entity.html b/docs/class/src/entity.js~Entity.html index d9e2807..83b7b12 100644 --- a/docs/class/src/entity.js~Entity.html +++ b/docs/class/src/entity.js~Entity.html @@ -749,7 +749,7 @@

- source + source

@@ -770,7 +770,19 @@

- +
+

Throw:

+ + + + + + + + +

Error

Cannot set entity id

+
+
@@ -796,7 +808,7 @@

- source + source

@@ -884,7 +896,7 @@

- source + source

@@ -954,7 +966,7 @@

- source + source

@@ -1006,7 +1018,7 @@

- source + source

@@ -1060,7 +1072,7 @@

- source + source

@@ -1142,7 +1154,7 @@

- source + source

@@ -1223,7 +1235,7 @@

- source + source

@@ -1306,7 +1318,7 @@

- source + source

@@ -1389,7 +1401,7 @@

- source + source

@@ -1453,7 +1465,7 @@

- source + source

@@ -1551,7 +1563,7 @@

- source + source

@@ -1616,7 +1628,7 @@

- source + source

@@ -1680,7 +1692,7 @@

- source + source

@@ -1768,7 +1780,7 @@

- source + source

diff --git a/docs/class/src/world.js~World.html b/docs/class/src/world.js~World.html index 918d859..767b2f8 100644 --- a/docs/class/src/world.js~World.html +++ b/docs/class/src/world.js~World.html @@ -365,7 +365,7 @@

World

- system(components: Array, systemClass: Function, args: ...Object): number + system(args: ...Object): number

@@ -686,7 +686,7 @@

- source + source

@@ -789,7 +789,7 @@

- source + source

@@ -871,7 +871,7 @@

- source + source

@@ -939,7 +939,7 @@

- source + source

@@ -1026,7 +1026,7 @@

- source + source

@@ -1079,8 +1079,8 @@

Example:

// Example flow of method call order:
 // Setup systems:
-world.system([], systemA)
-world.system([], systemB)
+world.system(systemA)
+world.system(systemB)
 // During world.run():
 // systemA.pre()
 // systemA.every() * number of entities
@@ -1104,11 +1104,11 @@ 

- system(components: Array, systemClass: Function, args: ...Object): number + system(args: ...Object): number - source + source

@@ -1130,26 +1130,13 @@

Params:

- components - Array - -

The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().

- - - - systemClass - Function - -

The system class to instantiate. Can contain the following methods: constructor, initialize, -pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() -for an example of the call order.

- - - args ...Object -
  • optional
-

The arguments to forward to the system's constructors

+ +

Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).

+

[components]: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().

+

{systemClass}: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.

+

[...args]: The arguments to forward to the system's constructors.

@@ -1187,11 +1174,27 @@

Example:

// Movement system
 world.system(['position', 'velocity'], class {
+     constructor(context) {
+         // This is showing how you can optionally pass parameters to the system's constructor
+         this.context = context
+     }
      every(position, velocity, entity) {
          position.x += velocity.x
          position.y += velocity.y
      }
- })
+ }, context)
+
+
+ +
// System that doesn't use every()
+world.system(class {
+     constructor(context) {
+         this.context = context
+     }
+     pre() {
+         // Handle events or something
+     }
+ }, context)
diff --git a/docs/file/src/entity.js.html b/docs/file/src/entity.js.html index 64f29e5..c71dea0 100644 --- a/docs/file/src/entity.js.html +++ b/docs/file/src/entity.js.html @@ -83,6 +83,8 @@ * ID is read-only, attempting to set it will throw an error. * * @private + * + * @throws {Error} Cannot set entity id */ set id(id) { throw new Error('Cannot set entity id') diff --git a/docs/file/src/world.js.html b/docs/file/src/world.js.html index a0c373d..97c2b1f 100644 --- a/docs/file/src/world.js.html +++ b/docs/file/src/world.js.html @@ -171,25 +171,54 @@ * @example * // Movement system * world.system(['position', 'velocity'], class { + * constructor(context) { + * // This is showing how you can optionally pass parameters to the system's constructor + * this.context = context + * } * every(position, velocity, entity) { * position.x += velocity.x * position.y += velocity.y * } - * }) + * }, context) + * + * @example + * // System that doesn't use every() + * world.system(class { + * constructor(context) { + * this.context = context + * } + * pre() { + * // Handle events or something + * } + * }, context) * - * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every(). - * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize, - * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() - * for an example of the call order. - * @param {...Object} [args] - The arguments to forward to the system's constructors + * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args). + * + * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every(). + * + * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order. + * + * **[...args]**: The arguments to forward to the system's constructors. * * @return {number} Unique ID of the system on success or undefined on failure */ - system(components, systemClass, ...args) { - // TODO: Make components optional, and parameters more dynamic by only using ...args + system(...args) { + // Get components and systemClass from arguments + let components = [] + let systemClass, rest + if (Array.isArray(args[0])) { + components = args[0] + systemClass = args[1] + rest = args.slice(2) + } else { + systemClass = args[0] + rest = args.slice(1) + } + + // Make sure the system is valid if (isFunction(systemClass)) { // Create the system, and set the component array query - let newSystem = new systemClass(...args) + let newSystem = new systemClass(...rest) newSystem.components = components // Add the system, return its ID @@ -221,8 +250,8 @@ * @example * // Example flow of method call order: * // Setup systems: - * world.system([], systemA) - * world.system([], systemB) + * world.system(systemA) + * world.system(systemB) * // During world.run(): * // systemA.pre() * // systemA.every() * number of entities diff --git a/docs/index.json b/docs/index.json index 9b15697..7e69cb8 100644 --- a/docs/index.json +++ b/docs/index.json @@ -887,7 +887,7 @@ "__docId__": 62, "kind": "file", "name": "src/entity.js", - "content": "/** @ignore */\nconst { invoke } = require('./utilities.js')\n\n/**\n * Entity class used for storing components.\n *\n * @class Entity (name)\n */\nclass Entity {\n\t/**\n\t * Do not construct an Entity yourself - use the entity() method in World instead.\n\t * Also, do not shallow/deep copy entity objects, only pass around references.\n\t *\n\t * @private\n\t *\n\t * @param {World} world - The world\n\t * @param {number} id - The identifier\n\t */\n\tconstructor(world, id) {\n\t\t/** @ignore */\n\t\tthis.world = world\n\n\t\t/** @ignore */\n\t\tthis._id = id\n\n\t\t/** @ignore */\n\t\tthis.data = {}\n\n\t\t// Add to the index, to update match all index\n\t\tif (this.valid()) {\n\t\t\tthis.world.index.add(this)\n\t\t}\n\t}\n\n\t/**\n\t * Return the entity ID.\n\t *\n\t * @return {number} Integer entity ID\n\t */\n\tget id() {\n\t\treturn this._id\n\t}\n\n\t/**\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t */\n\tset id(id) {\n\t\tthrow new Error('Cannot set entity id')\n\t}\n\n\t/**\n\t * Returns true if the entity has ALL of the specified component names.\n\t * Additional components that the entity has, which are not specified in has(), will be ignored.\n\t * If no component names are specified, this method returns true.\n\t *\n\t * @example\n\t * if (entity.has('position', 'velocity')) {...}\n\t *\n\t * @param {...string} [components] - The component names to check for\n\t *\n\t * @return {boolean} true or false\n\t */\n\thas(...components) {\n\t\treturn components.every(name => name in this.data)\n\t}\n\n\t/**\n\t * Returns a component by name, or undefined if it doesn't exist\n\t *\n\t * @example\n\t * let position = entity.get('position')\n\t *\n\t * @param {string} component - The component name to get\n\t *\n\t * @return {Object} The component if defined, otherwise undefined\n\t */\n\tget(component) {\n\t\treturn this.data[component]\n\t}\n\n\t/**\n\t * Returns a component by name (automatically created if it doesn't exist)\n\t *\n\t * @example\n\t * let position = entity.access('position', 3, 4)\n\t *\n\t * @param {string} component - The component name to create/get\n\t * @param {...Object} [args] - The arguments to forward to create the new component, only if it doesn't exist.\n\t *\n\t * @return {Object} Always returns either the existing component, or the newly created one.\n\t */\n\taccess(component, ...args) {\n\t\tif (!this.has(component)) {\n\t\t\tthis.set(component, ...args)\n\t\t}\n\t\treturn this.data[component]\n\t}\n\n\t/**\n\t * Adds a new component, or re-creates and overwrites an existing component\n\t *\n\t * @example\n\t * entity.set('position', 1, 2)\n\t *\n\t * @example\n\t * entity.set('anonymousComponent', { keys: 'values' })\n\t *\n\t * @example\n\t * entity.set('anotherAnonymousComponent', 'Any type of any value')\n\t *\n\t * @param {string} component - The component name to create. If there is a registered component for this name, then\n\t * its constructor will be called and an object of that type will be created.\n\t * @param {...Object} [args] - The arguments to forward to the registered component type. If the component type is\n\t * registered, then only the first additional argument will be used as the value of the entire component.\n\t *\n\t * @return {Object} The original entity that set() was called on, so that operations can be chained.\n\t */\n\tset(component, ...args) {\n\t\tif (this.valid() && component in this.world.components) {\n\t\t\t// Use defined component template, passing entity as first parameter\n\t\t\tthis.data[component] = new this.world.components[component](this, ...args)\n\t\t} else if (args.length > 0) {\n\t\t\t// Use first argument as component value\n\t\t\tthis.data[component] = args[0]\n\t\t} else {\n\t\t\t// Make an empty object\n\t\t\tthis.data[component] = {}\n\t\t}\n\n\t\t// Update the index with this new component\n\t\tif (this.valid()) {\n\t\t\tthis.world.index.add(this, component)\n\t\t}\n\n\t\treturn this\n\t}\n\n\t/**\n\t * Updates component data from an object or other component. Similar to access() with a shallow merge applied after.\n\t *\n\t * @example\n\t * entity.update('position', { x: 1, y: 2 })\n\t *\n\t * @param {string} component - The component name to update\n\t * @param {Object} data - The object or other component to merge into the specified component.\n\t *\n\t * @return {Object} The original entity that update() was called on, so that operations can be chained.\n\t */\n\tupdate(component, data) {\n\t\tlet comp = this.access(component)\n\n\t\t// Shallow set keys of the component\n\t\tfor (let key in data) {\n\t\t\tcomp[key] = data[key]\n\t\t}\n\n\t\treturn this\n\t}\n\n\t/**\n\t * Removes a component from the entity - has no effect when it doesn't exist.\n\t * Can specify an onRemove() method in your component which gets called before it is removed.\n\t * If nothing is specified, then nothing will be removed. Use removeAll() to remove all components.\n\t *\n\t * @example\n\t * entity.remove('position')\n\t *\n\t * @param {...string} [components] - The component names to remove from the entity.\n\t *\n\t * @return {Object} The original entity that remove() was called on, so that operations can be chained.\n\t */\n\tremove(...components) {\n\t\tfor (let component of components) {\n\t\t\tif (component in this.data) {\n\n\t\t\t\t// Remove from index\n\t\t\t\tif (this.valid()) {\n\t\t\t\t\tthis.world.index.remove(this, component)\n\t\t\t\t}\n\n\t\t\t\t// Call custom onRemove\n\t\t\t\tinvoke(this.data[component], 'onRemove')\n\n\t\t\t\tdelete this.data[component]\n\t\t\t}\n\t\t}\n\t\treturn this\n\t}\n\n\t// Remove all components\n\n\t/**\n\t * Removes all components from the entity.\n\t *\n\t * @example\n\t * entity.removeAll()\n\t *\n\t * @return {Object} The original entity that removeAll() was called on, so that operations can be chained.\n\t */\n\tremoveAll() {\n\t\tthis.remove(...Object.keys(this.data))\n\t\tthis.data = {}\n\t\treturn this\n\t}\n\n\t/**\n\t * Remove this entity and all of its components from the world. After an entity is destroyed, the object should be discarded,\n\t * and it is recommended to avoid re-using it.\n\t *\n\t * @example\n\t * entity.destroy()\n\t */\n\tdestroy() {\n\t\tthis.removeAll()\n\n\t\tif (this.valid()) {\n\t\t\t// Remove from the index, to update match all index\n\t\t\tthis.world.index.remove(this)\n\n\t\t\t// Remove from world\n\t\t\tthis.world.entities.delete(this._id)\n\t\t\tthis._id = undefined\n\t\t}\n\t}\n\n\t/**\n\t * Returns true if this is a valid, existing, and usable entity, which is attached to a world.\n\t *\n\t * @example\n\t * if (entity.valid()) {...}\n\t *\n\t * @return {boolean} true or false\n\t */\n\tvalid() {\n\t\t// Note: No need to actually look in the world for the ID, if entities are only ever copied by reference.\n\t\t// If entities are ever deep/shallow copied, this function will need to check this to be more robust.\n\t\treturn this.world && this._id !== undefined\n\t}\n\n\t/**\n\t * Returns unique entity ID as a string.\n\t *\n\t * @example\n\t * let entityId = entity.toString()\n\t *\n\t * @return {string} String representation of the entity ID.\n\t */\n\ttoString() {\n\t\treturn String(this._id)\n\t}\n\n\t/**\n\t * Serializes entire entity and components to JSON.\n\t * Note: Defining toJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * let serializedEntity = entity.toJSON()\n\t *\n\t * @return {string} JSON encoded string\n\t */\n\ttoJSON() {\n\t\treturn JSON.stringify(this.data)\n\t}\n\n\t/**\n\t * Deserializes data from JSON, creating new components and overwriting existing components.\n\t * Note: Defining fromJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * entity.fromJSON(serializedEntity)\n\t *\n\t * @param {string} data - A JSON string containing component data to parse, and store in this entity.\n\t *\n\t * @return {Object} The original entity that fromJSON() was called on, so that operations can be chained.\n\t */\n\tfromJSON(data) {\n\t\tlet parsed = JSON.parse(data)\n\t\tfor (let name in parsed) {\n\t\t\tlet comp = this.access(name)\n\n\t\t\t// Either call custom method or copy all properties\n\t\t\tif (typeof comp.fromJSON === 'function') {\n\t\t\t\tcomp.fromJSON(parsed[name])\n\t\t\t} else {\n\t\t\t\tthis.update(name, parsed[name])\n\t\t\t}\n\t\t}\n\t\treturn this\n\t}\n\n\t/**\n\t * Attaches a currently detached entity back to a world.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.attach(world)\n\t *\n\t * @param {World} world - The world to attach this entity to\n\t */\n\tattach(world) {\n\t\tif (world && !this.valid()) {\n\t\t\t// Assign new id, and reattach to world\n\t\t\tthis.world = world\n\t\t\tthis._id = this.world.idCounter++\n\t\t\tthis.world.entities.set(this._id, this)\n\t\t\tthis.world.index.addEntity(this)\n\t\t}\n\t}\n\n\t/**\n\t * Removes this entity from the current world, without removing any components or data.\n\t * It can be re-attached to another world (or the same world), using the attach() method.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.detach()\n\t */\n\tdetach() {\n\t\tif (this.valid()) {\n\t\t\t// Remove from current world\n\t\t\tthis.world.index.removeEntity(this)\n\t\t\tthis.world.entities.delete(this._id)\n\t\t\tthis._id = undefined\n\t\t\tthis.world = undefined\n\t\t}\n\t}\n}\n\nexports.Entity = Entity\n", + "content": "/** @ignore */\nconst { invoke } = require('./utilities.js')\n\n/**\n * Entity class used for storing components.\n *\n * @class Entity (name)\n */\nclass Entity {\n\t/**\n\t * Do not construct an Entity yourself - use the entity() method in World instead.\n\t * Also, do not shallow/deep copy entity objects, only pass around references.\n\t *\n\t * @private\n\t *\n\t * @param {World} world - The world\n\t * @param {number} id - The identifier\n\t */\n\tconstructor(world, id) {\n\t\t/** @ignore */\n\t\tthis.world = world\n\n\t\t/** @ignore */\n\t\tthis._id = id\n\n\t\t/** @ignore */\n\t\tthis.data = {}\n\n\t\t// Add to the index, to update match all index\n\t\tif (this.valid()) {\n\t\t\tthis.world.index.add(this)\n\t\t}\n\t}\n\n\t/**\n\t * Return the entity ID.\n\t *\n\t * @return {number} Integer entity ID\n\t */\n\tget id() {\n\t\treturn this._id\n\t}\n\n\t/**\n\t * ID is read-only, attempting to set it will throw an error.\n\t *\n\t * @private\n\t *\n\t * @throws {Error} Cannot set entity id\n\t */\n\tset id(id) {\n\t\tthrow new Error('Cannot set entity id')\n\t}\n\n\t/**\n\t * Returns true if the entity has ALL of the specified component names.\n\t * Additional components that the entity has, which are not specified in has(), will be ignored.\n\t * If no component names are specified, this method returns true.\n\t *\n\t * @example\n\t * if (entity.has('position', 'velocity')) {...}\n\t *\n\t * @param {...string} [components] - The component names to check for\n\t *\n\t * @return {boolean} true or false\n\t */\n\thas(...components) {\n\t\treturn components.every(name => name in this.data)\n\t}\n\n\t/**\n\t * Returns a component by name, or undefined if it doesn't exist\n\t *\n\t * @example\n\t * let position = entity.get('position')\n\t *\n\t * @param {string} component - The component name to get\n\t *\n\t * @return {Object} The component if defined, otherwise undefined\n\t */\n\tget(component) {\n\t\treturn this.data[component]\n\t}\n\n\t/**\n\t * Returns a component by name (automatically created if it doesn't exist)\n\t *\n\t * @example\n\t * let position = entity.access('position', 3, 4)\n\t *\n\t * @param {string} component - The component name to create/get\n\t * @param {...Object} [args] - The arguments to forward to create the new component, only if it doesn't exist.\n\t *\n\t * @return {Object} Always returns either the existing component, or the newly created one.\n\t */\n\taccess(component, ...args) {\n\t\tif (!this.has(component)) {\n\t\t\tthis.set(component, ...args)\n\t\t}\n\t\treturn this.data[component]\n\t}\n\n\t/**\n\t * Adds a new component, or re-creates and overwrites an existing component\n\t *\n\t * @example\n\t * entity.set('position', 1, 2)\n\t *\n\t * @example\n\t * entity.set('anonymousComponent', { keys: 'values' })\n\t *\n\t * @example\n\t * entity.set('anotherAnonymousComponent', 'Any type of any value')\n\t *\n\t * @param {string} component - The component name to create. If there is a registered component for this name, then\n\t * its constructor will be called and an object of that type will be created.\n\t * @param {...Object} [args] - The arguments to forward to the registered component type. If the component type is\n\t * registered, then only the first additional argument will be used as the value of the entire component.\n\t *\n\t * @return {Object} The original entity that set() was called on, so that operations can be chained.\n\t */\n\tset(component, ...args) {\n\t\tif (this.valid() && component in this.world.components) {\n\t\t\t// Use defined component template, passing entity as first parameter\n\t\t\tthis.data[component] = new this.world.components[component](this, ...args)\n\t\t} else if (args.length > 0) {\n\t\t\t// Use first argument as component value\n\t\t\tthis.data[component] = args[0]\n\t\t} else {\n\t\t\t// Make an empty object\n\t\t\tthis.data[component] = {}\n\t\t}\n\n\t\t// Update the index with this new component\n\t\tif (this.valid()) {\n\t\t\tthis.world.index.add(this, component)\n\t\t}\n\n\t\treturn this\n\t}\n\n\t/**\n\t * Updates component data from an object or other component. Similar to access() with a shallow merge applied after.\n\t *\n\t * @example\n\t * entity.update('position', { x: 1, y: 2 })\n\t *\n\t * @param {string} component - The component name to update\n\t * @param {Object} data - The object or other component to merge into the specified component.\n\t *\n\t * @return {Object} The original entity that update() was called on, so that operations can be chained.\n\t */\n\tupdate(component, data) {\n\t\tlet comp = this.access(component)\n\n\t\t// Shallow set keys of the component\n\t\tfor (let key in data) {\n\t\t\tcomp[key] = data[key]\n\t\t}\n\n\t\treturn this\n\t}\n\n\t/**\n\t * Removes a component from the entity - has no effect when it doesn't exist.\n\t * Can specify an onRemove() method in your component which gets called before it is removed.\n\t * If nothing is specified, then nothing will be removed. Use removeAll() to remove all components.\n\t *\n\t * @example\n\t * entity.remove('position')\n\t *\n\t * @param {...string} [components] - The component names to remove from the entity.\n\t *\n\t * @return {Object} The original entity that remove() was called on, so that operations can be chained.\n\t */\n\tremove(...components) {\n\t\tfor (let component of components) {\n\t\t\tif (component in this.data) {\n\n\t\t\t\t// Remove from index\n\t\t\t\tif (this.valid()) {\n\t\t\t\t\tthis.world.index.remove(this, component)\n\t\t\t\t}\n\n\t\t\t\t// Call custom onRemove\n\t\t\t\tinvoke(this.data[component], 'onRemove')\n\n\t\t\t\tdelete this.data[component]\n\t\t\t}\n\t\t}\n\t\treturn this\n\t}\n\n\t// Remove all components\n\n\t/**\n\t * Removes all components from the entity.\n\t *\n\t * @example\n\t * entity.removeAll()\n\t *\n\t * @return {Object} The original entity that removeAll() was called on, so that operations can be chained.\n\t */\n\tremoveAll() {\n\t\tthis.remove(...Object.keys(this.data))\n\t\tthis.data = {}\n\t\treturn this\n\t}\n\n\t/**\n\t * Remove this entity and all of its components from the world. After an entity is destroyed, the object should be discarded,\n\t * and it is recommended to avoid re-using it.\n\t *\n\t * @example\n\t * entity.destroy()\n\t */\n\tdestroy() {\n\t\tthis.removeAll()\n\n\t\tif (this.valid()) {\n\t\t\t// Remove from the index, to update match all index\n\t\t\tthis.world.index.remove(this)\n\n\t\t\t// Remove from world\n\t\t\tthis.world.entities.delete(this._id)\n\t\t\tthis._id = undefined\n\t\t}\n\t}\n\n\t/**\n\t * Returns true if this is a valid, existing, and usable entity, which is attached to a world.\n\t *\n\t * @example\n\t * if (entity.valid()) {...}\n\t *\n\t * @return {boolean} true or false\n\t */\n\tvalid() {\n\t\t// Note: No need to actually look in the world for the ID, if entities are only ever copied by reference.\n\t\t// If entities are ever deep/shallow copied, this function will need to check this to be more robust.\n\t\treturn this.world && this._id !== undefined\n\t}\n\n\t/**\n\t * Returns unique entity ID as a string.\n\t *\n\t * @example\n\t * let entityId = entity.toString()\n\t *\n\t * @return {string} String representation of the entity ID.\n\t */\n\ttoString() {\n\t\treturn String(this._id)\n\t}\n\n\t/**\n\t * Serializes entire entity and components to JSON.\n\t * Note: Defining toJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * let serializedEntity = entity.toJSON()\n\t *\n\t * @return {string} JSON encoded string\n\t */\n\ttoJSON() {\n\t\treturn JSON.stringify(this.data)\n\t}\n\n\t/**\n\t * Deserializes data from JSON, creating new components and overwriting existing components.\n\t * Note: Defining fromJSON methods in your components will override the built-in behavior.\n\t *\n\t * @example\n\t * entity.fromJSON(serializedEntity)\n\t *\n\t * @param {string} data - A JSON string containing component data to parse, and store in this entity.\n\t *\n\t * @return {Object} The original entity that fromJSON() was called on, so that operations can be chained.\n\t */\n\tfromJSON(data) {\n\t\tlet parsed = JSON.parse(data)\n\t\tfor (let name in parsed) {\n\t\t\tlet comp = this.access(name)\n\n\t\t\t// Either call custom method or copy all properties\n\t\t\tif (typeof comp.fromJSON === 'function') {\n\t\t\t\tcomp.fromJSON(parsed[name])\n\t\t\t} else {\n\t\t\t\tthis.update(name, parsed[name])\n\t\t\t}\n\t\t}\n\t\treturn this\n\t}\n\n\t/**\n\t * Attaches a currently detached entity back to a world.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.attach(world)\n\t *\n\t * @param {World} world - The world to attach this entity to\n\t */\n\tattach(world) {\n\t\tif (world && !this.valid()) {\n\t\t\t// Assign new id, and reattach to world\n\t\t\tthis.world = world\n\t\t\tthis._id = this.world.idCounter++\n\t\t\tthis.world.entities.set(this._id, this)\n\t\t\tthis.world.index.addEntity(this)\n\t\t}\n\t}\n\n\t/**\n\t * Removes this entity from the current world, without removing any components or data.\n\t * It can be re-attached to another world (or the same world), using the attach() method.\n\t * Note: Do not use detached entities, get() may be safe, but avoid calling other methods\n\t * Note: The ID will be reassigned, so do not rely on this\n\t *\n\t * @example\n\t * entity.detach()\n\t */\n\tdetach() {\n\t\tif (this.valid()) {\n\t\t\t// Remove from current world\n\t\t\tthis.world.index.removeEntity(this)\n\t\t\tthis.world.entities.delete(this._id)\n\t\t\tthis._id = undefined\n\t\t\tthis.world = undefined\n\t\t}\n\t}\n}\n\nexports.Entity = Entity\n", "static": true, "longname": "/srv/http/picoes/src/entity.js", "access": "public", @@ -1058,7 +1058,15 @@ "longname": "src/entity.js~Entity#id", "access": "private", "description": "ID is read-only, attempting to set it will throw an error.", - "lineNumber": 49 + "lineNumber": 51, + "throws": [ + { + "types": [ + "Error" + ], + "description": "Cannot set entity id" + } + ] }, { "__docId__": 71, @@ -1074,7 +1082,7 @@ "examples": [ "if (entity.has('position', 'velocity')) {...}" ], - "lineNumber": 65, + "lineNumber": 67, "params": [ { "nullable": null, @@ -1110,7 +1118,7 @@ "examples": [ "let position = entity.get('position')" ], - "lineNumber": 79, + "lineNumber": 81, "params": [ { "nullable": null, @@ -1146,7 +1154,7 @@ "examples": [ "let position = entity.access('position', 3, 4)" ], - "lineNumber": 94, + "lineNumber": 96, "params": [ { "nullable": null, @@ -1194,7 +1202,7 @@ "entity.set('anonymousComponent', { keys: 'values' })", "entity.set('anotherAnonymousComponent', 'Any type of any value')" ], - "lineNumber": 120, + "lineNumber": 122, "params": [ { "nullable": null, @@ -1240,7 +1248,7 @@ "examples": [ "entity.update('position', { x: 1, y: 2 })" ], - "lineNumber": 151, + "lineNumber": 153, "params": [ { "nullable": null, @@ -1286,7 +1294,7 @@ "examples": [ "entity.remove('position')" ], - "lineNumber": 174, + "lineNumber": 176, "params": [ { "nullable": null, @@ -1322,7 +1330,7 @@ "examples": [ "entity.removeAll()" ], - "lineNumber": 202, + "lineNumber": 204, "return": { "nullable": null, "types": [ @@ -1347,7 +1355,7 @@ "examples": [ "entity.destroy()" ], - "lineNumber": 215, + "lineNumber": 217, "params": [], "return": null }, @@ -1365,7 +1373,7 @@ "examples": [ "if (entity.valid()) {...}" ], - "lineNumber": 236, + "lineNumber": 238, "return": { "nullable": null, "types": [ @@ -1390,7 +1398,7 @@ "examples": [ "let entityId = entity.toString()" ], - "lineNumber": 250, + "lineNumber": 252, "return": { "nullable": null, "types": [ @@ -1415,7 +1423,7 @@ "examples": [ "let serializedEntity = entity.toJSON()" ], - "lineNumber": 263, + "lineNumber": 265, "return": { "nullable": null, "types": [ @@ -1440,7 +1448,7 @@ "examples": [ "entity.fromJSON(serializedEntity)" ], - "lineNumber": 278, + "lineNumber": 280, "params": [ { "nullable": null, @@ -1476,7 +1484,7 @@ "examples": [ "entity.attach(world)" ], - "lineNumber": 303, + "lineNumber": 305, "params": [ { "nullable": null, @@ -1505,7 +1513,7 @@ "examples": [ "entity.detach()" ], - "lineNumber": 322, + "lineNumber": 324, "params": [], "return": null }, @@ -1611,7 +1619,7 @@ "__docId__": 94, "kind": "file", "name": "src/world.js", - "content": "/** @ignore */\nconst { invoke, isFunction } = require('./utilities.js')\n\n/** @ignore */\nconst { Entity } = require('./entity.js')\n\n/** @ignore */\nconst { ComponentIndex } = require('./component_index.js')\n\n/**\n * Class for world.\n *\n * @class World (name)\n */\nclass World {\n\t/**\n\t * Constructs an instance of the world.\n\t */\n\tconstructor() {\n\t\t/** @ignore */\n\t\tthis.systems = []\n\n\t\t/**\n\t\t * Maps entity IDs to entities\n\t\t * @ignore\n\t\t */\n\t\tthis.entities = new Map()\n\n\t\t/** @ignore */\n\t\tthis.components = {}\n\n\t\t/** @ignore */\n\t\tthis.entityTemplates = {}\n\n\t\t/** @ignore */\n\t\tthis.idCounter = 1\n\n\t\t/**\n\t\t * Maps entire queries to arrays of entities\n\t\t * @ignore\n\t\t */\n\t\tthis.index = new ComponentIndex(this.entities)\n\t}\n\n\t/**\n\t * Removes all entities from the world.\n\t * Does not affect registered systems, components, or prototypes.\n\t *\n\t * @example\n\t * world.clear()\n\t */\n\tclear() {\n\t\t// Call onRemove on all components of all entities\n\t\tfor (const [entityId, entity] of this.entities) {\n\t\t\tfor (let componentName in entity.data) {\n\t\t\t\t// Get component, and call onRemove if it exists as a function\n\t\t\t\tlet component = entity.data[componentName]\n\t\t\t\tinvoke(component, 'onRemove')\n\t\t\t}\n\t\t}\n\n\t\t// Clear entities\n\t\tthis.entities = new Map()\n\t\tthis.index.clear(this.entities)\n\t}\n\n\t/**\n\t * Registers a component type to the world. Components must be constructable. They are passed the entity first,\n\t * then the rest of the arguments from methods like entity.set(). Components also can have an onRemove() method.\n\t *\n\t * @param {string} name - The name\n\t * @param {function} componentClass - The component class, must be a constructable class or function\n\t *\n\t * @example\n\t * world.component('myComponent', class {\n\t * constructor(entity, some, args) {\n\t * this.entity = entity\n\t * this.some = some\n\t * this.args = args\n\t * }\n\t * })\n\t * // entity === the new entity object\n\t * // some === 10\n\t * // args === 500\n\t * world.entity().set('myComponent', 10, 500)\n\t *\n\t * @return {string} Registered component name on success, undefined on failure\n\t */\n\tcomponent(name, componentClass) {\n\t\t// Only allow functions and classes to be components\n\t\tif (isFunction(componentClass)) {\n\t\t\tthis.components[name] = componentClass\n\t\t\treturn name\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new entity in the world\n\t *\n\t * @param {string} [name] - The prototype name to use\n\t *\n\t * @example\n\t * world.entity()\n\t *\n\t * @example\n\t * world.entity('Player')\n\t *\n\t * @return {Entity} The new entity created\n\t */\n\tentity(name) {\n\t\tlet entityId = this.idCounter++\n\t\tlet entity = new Entity(this, entityId)\n\n\t\t// Use 'name' to get prototype data (if specified)\n\t\tif (name && name in this.entityTemplates) {\n\t\t\t// Add all components from prototype\n\t\t\tlet template = this.entityTemplates[name]\n\t\t\tfor (let componentName in template) {\n\t\t\t\t// Update component with data from template\n\t\t\t\tlet newComponentData = JSON.parse(template[componentName])\n\t\t\t\tentity.update(componentName, newComponentData)\n\t\t\t}\n\t\t}\n\n\t\tthis.entities.set(entityId, entity)\n\t\treturn entity\n\t}\n\n\t/**\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * })\n\t *\n\t * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize,\n\t * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run()\n\t * for an example of the call order.\n\t * @param {...Object} [args] - The arguments to forward to the system's constructors\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t */\n\tsystem(components, systemClass, ...args) {\n\t\t// TODO: Make components optional, and parameters more dynamic by only using ...args\n\t\tif (isFunction(systemClass)) {\n\t\t\t// Create the system, and set the component array query\n\t\t\tlet newSystem = new systemClass(...args)\n\t\t\tnewSystem.components = components\n\n\t\t\t// Add the system, return its ID\n\t\t\treturn this.systems.push(newSystem) - 1\n\t\t}\n\t\treturn undefined\n\t}\n\n\t/**\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t */\n\tinitialize(...args) {\n\t\tfor (let system of this.systems) {\n\t\t\tinvoke(system, 'initialize', ...args)\n\t\t}\n\t}\n\n\t/**\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system([], systemA)\n\t * world.system([], systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t */\n\trun(...args) {\n\t\tfor (let system of this.systems) {\n\t\t\tinvoke(system, 'pre', ...args)\n\n\t\t\t// Run the \"every\" method in the system\n\t\t\tif (isFunction(system.every)) {\n\t\t\t\tthis.every(system.components, system.every.bind(system), ...args)\n\t\t\t}\n\n\t\t\tinvoke(system, 'post', ...args)\n\t\t}\n\t}\n\n\t/**\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t */\n\tevery(componentNames, callback, ...args) {\n\t\t// Get indexed map of entities\n\t\tlet entities = this.index.query(componentNames)\n\n\t\tif (isFunction(callback)) {\n\t\t\t// Go through the map of entities\n\t\t\tfor (let entity of entities.values()) {\n\t\t\t\t// At this point, we can safely assume that all components exist, even if entities/components\n\t\t\t\t// are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.\n\n\t\t\t\t// Get all components as an array\n\t\t\t\tlet components = componentNames.map(name => entity.get(name))\n\n\t\t\t\t// Pass components, then the main entity, then any additional arguments\n\t\t\t\tlet status = callback(...components, entity, ...args)\n\n\t\t\t\t// Stop the iteration when the callback returns false\n\t\t\t\tif (status === false) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn entities.values()\n\t}\n\n\t/**\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t */\n\tget(...componentNames) {\n\t\treturn [...this.every(componentNames)]\n\t}\n\n\t/**\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t */\n\tprototype(data) {\n\t\tlet count = 0\n\n\t\t// Convert to an object when given a string\n\t\tif (typeof data === 'string') {\n\t\t\tdata = JSON.parse(data)\n\t\t}\n\n\t\t// Data must be an object at this point\n\t\tif (typeof data === 'object') {\n\t\t\t// Iterate through prototype names\n\t\t\tfor (let protoName in data) {\n\t\t\t\tlet inputObject = data[protoName]\n\t\t\t\tlet protoObject = {}\n\t\t\t\t// Iterate through component names\n\t\t\t\tfor (let compName in inputObject) {\n\t\t\t\t\t// Store strings of each component\n\t\t\t\t\tprotoObject[compName] = JSON.stringify(inputObject[compName])\n\t\t\t\t}\n\t\t\t\tthis.entityTemplates[protoName] = protoObject\n\t\t\t\t++count\n\t\t\t}\n\t\t}\n\n\t\treturn count\n\t}\n}\n\nexports.World = World\n", + "content": "/** @ignore */\nconst { invoke, isFunction } = require('./utilities.js')\n\n/** @ignore */\nconst { Entity } = require('./entity.js')\n\n/** @ignore */\nconst { ComponentIndex } = require('./component_index.js')\n\n/**\n * Class for world.\n *\n * @class World (name)\n */\nclass World {\n\t/**\n\t * Constructs an instance of the world.\n\t */\n\tconstructor() {\n\t\t/** @ignore */\n\t\tthis.systems = []\n\n\t\t/**\n\t\t * Maps entity IDs to entities\n\t\t * @ignore\n\t\t */\n\t\tthis.entities = new Map()\n\n\t\t/** @ignore */\n\t\tthis.components = {}\n\n\t\t/** @ignore */\n\t\tthis.entityTemplates = {}\n\n\t\t/** @ignore */\n\t\tthis.idCounter = 1\n\n\t\t/**\n\t\t * Maps entire queries to arrays of entities\n\t\t * @ignore\n\t\t */\n\t\tthis.index = new ComponentIndex(this.entities)\n\t}\n\n\t/**\n\t * Removes all entities from the world.\n\t * Does not affect registered systems, components, or prototypes.\n\t *\n\t * @example\n\t * world.clear()\n\t */\n\tclear() {\n\t\t// Call onRemove on all components of all entities\n\t\tfor (const [entityId, entity] of this.entities) {\n\t\t\tfor (let componentName in entity.data) {\n\t\t\t\t// Get component, and call onRemove if it exists as a function\n\t\t\t\tlet component = entity.data[componentName]\n\t\t\t\tinvoke(component, 'onRemove')\n\t\t\t}\n\t\t}\n\n\t\t// Clear entities\n\t\tthis.entities = new Map()\n\t\tthis.index.clear(this.entities)\n\t}\n\n\t/**\n\t * Registers a component type to the world. Components must be constructable. They are passed the entity first,\n\t * then the rest of the arguments from methods like entity.set(). Components also can have an onRemove() method.\n\t *\n\t * @param {string} name - The name\n\t * @param {function} componentClass - The component class, must be a constructable class or function\n\t *\n\t * @example\n\t * world.component('myComponent', class {\n\t * constructor(entity, some, args) {\n\t * this.entity = entity\n\t * this.some = some\n\t * this.args = args\n\t * }\n\t * })\n\t * // entity === the new entity object\n\t * // some === 10\n\t * // args === 500\n\t * world.entity().set('myComponent', 10, 500)\n\t *\n\t * @return {string} Registered component name on success, undefined on failure\n\t */\n\tcomponent(name, componentClass) {\n\t\t// Only allow functions and classes to be components\n\t\tif (isFunction(componentClass)) {\n\t\t\tthis.components[name] = componentClass\n\t\t\treturn name\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new entity in the world\n\t *\n\t * @param {string} [name] - The prototype name to use\n\t *\n\t * @example\n\t * world.entity()\n\t *\n\t * @example\n\t * world.entity('Player')\n\t *\n\t * @return {Entity} The new entity created\n\t */\n\tentity(name) {\n\t\tlet entityId = this.idCounter++\n\t\tlet entity = new Entity(this, entityId)\n\n\t\t// Use 'name' to get prototype data (if specified)\n\t\tif (name && name in this.entityTemplates) {\n\t\t\t// Add all components from prototype\n\t\t\tlet template = this.entityTemplates[name]\n\t\t\tfor (let componentName in template) {\n\t\t\t\t// Update component with data from template\n\t\t\t\tlet newComponentData = JSON.parse(template[componentName])\n\t\t\t\tentity.update(componentName, newComponentData)\n\t\t\t}\n\t\t}\n\n\t\tthis.entities.set(entityId, entity)\n\t\treturn entity\n\t}\n\n\t/**\n\t * Registers a system to the world.\n\t * The order the systems get registered, is the order then run in.\n\t *\n\t * @example\n\t * // Movement system\n\t * world.system(['position', 'velocity'], class {\n\t * constructor(context) {\n\t * // This is showing how you can optionally pass parameters to the system's constructor\n\t * this.context = context\n\t * }\n\t * every(position, velocity, entity) {\n\t * position.x += velocity.x\n\t * position.y += velocity.y\n\t * }\n\t * }, context)\n\t *\n\t * @example\n\t * // System that doesn't use every()\n\t * world.system(class {\n\t * constructor(context) {\n\t * this.context = context\n\t * }\n\t * pre() {\n\t * // Handle events or something\n\t * }\n\t * }, context)\n\t *\n\t * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).\n\t *\n\t * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\t *\n\t * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.\n\t *\n\t * **[...args]**: The arguments to forward to the system's constructors.\n\t *\n\t * @return {number} Unique ID of the system on success or undefined on failure\n\t */\n\tsystem(...args) {\n\t\t// Get components and systemClass from arguments\n\t\tlet components = []\n\t\tlet systemClass, rest\n\t\tif (Array.isArray(args[0])) {\n\t\t\tcomponents = args[0]\n\t\t\tsystemClass = args[1]\n\t\t\trest = args.slice(2)\n\t\t} else {\n\t\t\tsystemClass = args[0]\n\t\t\trest = args.slice(1)\n\t\t}\n\n\t\t// Make sure the system is valid\n\t\tif (isFunction(systemClass)) {\n\t\t\t// Create the system, and set the component array query\n\t\t\tlet newSystem = new systemClass(...rest)\n\t\t\tnewSystem.components = components\n\n\t\t\t// Add the system, return its ID\n\t\t\treturn this.systems.push(newSystem) - 1\n\t\t}\n\t\treturn undefined\n\t}\n\n\t/**\n\t * Calls initialize() on all systems\n\t *\n\t * @example\n\t * world.initialize(renderContext)\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' initialize() methods\n\t */\n\tinitialize(...args) {\n\t\tfor (let system of this.systems) {\n\t\t\tinvoke(system, 'initialize', ...args)\n\t\t}\n\t}\n\n\t/**\n\t * Calls pre(), every(), and post() on all systems\n\t *\n\t * @example\n\t * world.run(deltaTime)\n\t *\n\t * @example\n\t * // Example flow of method call order:\n\t * // Setup systems:\n\t * world.system(systemA)\n\t * world.system(systemB)\n\t * // During world.run():\n\t * // systemA.pre()\n\t * // systemA.every() * number of entities\n\t * // systemA.post()\n\t * // systemB.pre()\n\t * // systemB.every() * number of entities\n\t * // systemB.post()\n\t *\n\t * @param {...Object} [args] - The arguments to forward to the systems' methods\n\t */\n\trun(...args) {\n\t\tfor (let system of this.systems) {\n\t\t\tinvoke(system, 'pre', ...args)\n\n\t\t\t// Run the \"every\" method in the system\n\t\t\tif (isFunction(system.every)) {\n\t\t\t\tthis.every(system.components, system.every.bind(system), ...args)\n\t\t\t}\n\n\t\t\tinvoke(system, 'post', ...args)\n\t\t}\n\t}\n\n\t/**\n\t * Iterate through entities with the specified components\n\t *\n\t * @example\n\t * // Use a callback to process entities one-by-one\n\t * world.every(['comp'], comp => {comp.value = 0})\n\t *\n\t * @example\n\t * // Get an iterator for the entities\n\t * let it = world.every(['comp'])\n\t * for (let entity of it) {...}\n\t *\n\t * @param {Array} componentNames - The component names to match entites with. This checks if the entity\n\t * has ALL of the specified components, but does not check for additional components.\n\t * @param {Function} callback - The callback to call for each entity. Takes (...components, entity, ...args).\n\t * @param {...Object} [args] - Any additional arguments to pass to the callback.\n\t *\n\t * @return {MapIterator} An iterator to the entities themselves\n\t */\n\tevery(componentNames, callback, ...args) {\n\t\t// Get indexed map of entities\n\t\tlet entities = this.index.query(componentNames)\n\n\t\tif (isFunction(callback)) {\n\t\t\t// Go through the map of entities\n\t\t\tfor (let entity of entities.values()) {\n\t\t\t\t// At this point, we can safely assume that all components exist, even if entities/components\n\t\t\t\t// are deleted/modified during the loop, because JavaScript's MapIterator is smart enough.\n\n\t\t\t\t// Get all components as an array\n\t\t\t\tlet components = componentNames.map(name => entity.get(name))\n\n\t\t\t\t// Pass components, then the main entity, then any additional arguments\n\t\t\t\tlet status = callback(...components, entity, ...args)\n\n\t\t\t\t// Stop the iteration when the callback returns false\n\t\t\t\tif (status === false) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn entities.values()\n\t}\n\n\t/**\n\t * Returns an array of entities with matching components\n\t * Simplified version of every(), returns an actual array, and only takes component names as arguments.\n\t *\n\t * @example\n\t * world.get('player', 'sprite')\n\t *\n\t * @param {Array} componentNames - The component names to match on. See every() for how this matches.\n\t *\n\t * @return {Array} Array of entities, instead of iterator like every().\n\t */\n\tget(...componentNames) {\n\t\treturn [...this.every(componentNames)]\n\t}\n\n\t/**\n\t * Registers entity prototype(s). Any existing prototype names that are the same will be overwritten\n\t *\n\t * @example\n\t * world.prototype({\n\t * Movable: {\n\t * position: {},\n\t * velocity: {}\n\t * }\n\t * })\n\t *\n\t * @param {Object} data - Object structure to register as a prototype. Should be a dictionary with the top level keys\n\t * being the prototype names. Can also be a JSON formatted string.\n\t *\n\t * @return {number} Number of prototypes added.\n\t */\n\tprototype(data) {\n\t\tlet count = 0\n\n\t\t// Convert to an object when given a string\n\t\tif (typeof data === 'string') {\n\t\t\tdata = JSON.parse(data)\n\t\t}\n\n\t\t// Data must be an object at this point\n\t\tif (typeof data === 'object') {\n\t\t\t// Iterate through prototype names\n\t\t\tfor (let protoName in data) {\n\t\t\t\tlet inputObject = data[protoName]\n\t\t\t\tlet protoObject = {}\n\t\t\t\t// Iterate through component names\n\t\t\t\tfor (let compName in inputObject) {\n\t\t\t\t\t// Store strings of each component\n\t\t\t\t\tprotoObject[compName] = JSON.stringify(inputObject[compName])\n\t\t\t\t}\n\t\t\t\tthis.entityTemplates[protoName] = protoObject\n\t\t\t\t++count\n\t\t\t}\n\t\t}\n\n\t\treturn count\n\t}\n}\n\nexports.World = World\n", "static": true, "longname": "/srv/http/picoes/src/world.js", "access": "public", @@ -1927,39 +1935,20 @@ "access": "public", "description": "Registers a system to the world.\nThe order the systems get registered, is the order then run in.", "examples": [ - "// Movement system\nworld.system(['position', 'velocity'], class {\n every(position, velocity, entity) {\n position.x += velocity.x\n position.y += velocity.y\n }\n })" + "// Movement system\nworld.system(['position', 'velocity'], class {\n constructor(context) {\n // This is showing how you can optionally pass parameters to the system's constructor\n this.context = context\n }\n every(position, velocity, entity) {\n position.x += velocity.x\n position.y += velocity.y\n }\n }, context)", + "// System that doesn't use every()\nworld.system(class {\n constructor(context) {\n this.context = context\n }\n pre() {\n // Handle events or something\n }\n }, context)" ], - "lineNumber": 150, + "lineNumber": 167, "params": [ - { - "nullable": null, - "types": [ - "Array" - ], - "spread": false, - "optional": false, - "name": "components", - "description": "The list of components the system will process in every(). This follows the same logic as entity.has() and world.every()." - }, - { - "nullable": null, - "types": [ - "Function" - ], - "spread": false, - "optional": false, - "name": "systemClass", - "description": "The system class to instantiate. Can contain the following methods: constructor, initialize,\npre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run()\nfor an example of the call order." - }, { "nullable": null, "types": [ "...Object" ], "spread": true, - "optional": true, + "optional": false, "name": "args", - "description": "The arguments to forward to the system's constructors" + "description": "Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args).\n\n**[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every().\n\n**{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order.\n\n**[...args]**: The arguments to forward to the system's constructors." } ], "return": { @@ -1985,7 +1974,7 @@ "examples": [ "world.initialize(renderContext)" ], - "lineNumber": 171, + "lineNumber": 200, "params": [ { "nullable": null, @@ -2013,9 +2002,9 @@ "description": "Calls pre(), every(), and post() on all systems", "examples": [ "world.run(deltaTime)", - "// Example flow of method call order:\n// Setup systems:\nworld.system([], systemA)\nworld.system([], systemB)\n// During world.run():\n// systemA.pre()\n// systemA.every() * number of entities\n// systemA.post()\n// systemB.pre()\n// systemB.every() * number of entities\n// systemB.post()" + "// Example flow of method call order:\n// Setup systems:\nworld.system(systemA)\nworld.system(systemB)\n// During world.run():\n// systemA.pre()\n// systemA.every() * number of entities\n// systemA.post()\n// systemB.pre()\n// systemB.every() * number of entities\n// systemB.post()" ], - "lineNumber": 198, + "lineNumber": 227, "params": [ { "nullable": null, @@ -2045,7 +2034,7 @@ "// Use a callback to process entities one-by-one\nworld.every(['comp'], comp => {comp.value = 0})", "// Get an iterator for the entities\nlet it = world.every(['comp'])\nfor (let entity of it) {...}" ], - "lineNumber": 230, + "lineNumber": 259, "params": [ { "nullable": null, @@ -2101,7 +2090,7 @@ "examples": [ "world.get('player', 'sprite')" ], - "lineNumber": 267, + "lineNumber": 296, "params": [ { "nullable": null, @@ -2137,7 +2126,7 @@ "examples": [ "world.prototype({\n Movable: {\n position: {},\n velocity: {}\n }\n})" ], - "lineNumber": 287, + "lineNumber": 316, "params": [ { "nullable": null, diff --git a/docs/source.html b/docs/source.html index 2f790a5..f62beab 100644 --- a/docs/source.html +++ b/docs/source.html @@ -62,9 +62,9 @@ src/entity.js Entity 100 %22/22 - 8966 byte - 333 - 2018-04-07 19:37:01 (UTC) + 9011 byte + 335 + 2018-04-07 20:08:04 (UTC) src/utilities.js @@ -78,9 +78,9 @@ src/world.js World 100 %20/20 - 8816 byte - 315 - 2018-04-07 19:39:12 (UTC) + 9513 byte + 344 + 2018-04-07 21:01:02 (UTC) diff --git a/src/entity.js b/src/entity.js index a6c3078..a607bcb 100644 --- a/src/entity.js +++ b/src/entity.js @@ -45,6 +45,8 @@ class Entity { * ID is read-only, attempting to set it will throw an error. * * @private + * + * @throws {Error} Cannot set entity id */ set id(id) { throw new Error('Cannot set entity id') diff --git a/src/world.js b/src/world.js index e6f010c..2e70a73 100644 --- a/src/world.js +++ b/src/world.js @@ -133,25 +133,54 @@ class World { * @example * // Movement system * world.system(['position', 'velocity'], class { + * constructor(context) { + * // This is showing how you can optionally pass parameters to the system's constructor + * this.context = context + * } * every(position, velocity, entity) { * position.x += velocity.x * position.y += velocity.y * } - * }) + * }, context) + * + * @example + * // System that doesn't use every() + * world.system(class { + * constructor(context) { + * this.context = context + * } + * pre() { + * // Handle events or something + * } + * }, context) * - * @param {Array} components - The list of components the system will process in every(). This follows the same logic as entity.has() and world.every(). - * @param {Function} systemClass - The system class to instantiate. Can contain the following methods: constructor, initialize, - * pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() - * for an example of the call order. - * @param {...Object} [args] - The arguments to forward to the system's constructors + * @param {...Object} args - Both signatures are accepted: (components, systemClass, ...args) or (systemClass, ...args). + * + * **[components]**: The list of components the system will process in every(). This follows the same logic as entity.has() and world.every(). + * + * **{systemClass}**: The system class to instantiate. Can contain the following methods: constructor, initialize, pre, every, post. Pre() and post() get called before and after every(), for each of the independent systems. See world.run() for an example of the call order. + * + * **[...args]**: The arguments to forward to the system's constructors. * * @return {number} Unique ID of the system on success or undefined on failure */ - system(components, systemClass, ...args) { - // TODO: Make components optional, and parameters more dynamic by only using ...args + system(...args) { + // Get components and systemClass from arguments + let components = [] + let systemClass, rest + if (Array.isArray(args[0])) { + components = args[0] + systemClass = args[1] + rest = args.slice(2) + } else { + systemClass = args[0] + rest = args.slice(1) + } + + // Make sure the system is valid if (isFunction(systemClass)) { // Create the system, and set the component array query - let newSystem = new systemClass(...args) + let newSystem = new systemClass(...rest) newSystem.components = components // Add the system, return its ID @@ -183,8 +212,8 @@ class World { * @example * // Example flow of method call order: * // Setup systems: - * world.system([], systemA) - * world.system([], systemB) + * world.system(systemA) + * world.system(systemB) * // During world.run(): * // systemA.pre() * // systemA.every() * number of entities diff --git a/test/tests.js b/test/tests.js index 0943947..762f8cb 100644 --- a/test/tests.js +++ b/test/tests.js @@ -487,6 +487,31 @@ describe('World', function() { assert(entA.get('position').x == 3 && entA.get('position').y == 1) assert(entB.get('position').x == 28 && entB.get('position').y == 44) }) + it('system variadic arguments with optional components', function() { + let world = new World() + + // Test optional case + let created = false + world.system(class { + constructor(first, second) { + assert(first === 1) + assert(second === 2) + created = true + } + }, 1, 2) + assert(created) + + // Test specified case + created = false + world.system(['whatever'], class { + constructor(first, second) { + assert(first === 1) + assert(second === 2) + created = true + } + }, 1, 2) + assert(created) + }) it('use the every() method', function() { let world = new World() let ent1 = world.entity().set('position').set('"velocity"') @@ -603,7 +628,7 @@ describe('World', function() { assert(count == 3) count = 0 - world.system([], class { + world.system(class { every(ent) { ++count }