UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,529 lines (1,528 loc) 571 kB
{ "type": "File", "start": 0, "end": 2808, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 132, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2808, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 132, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 58, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 58 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 } }, "local": { "type": "Identifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 }, "identifierName": "Component" }, "name": "Component" } } ], "source": { "type": "StringLiteral", "start": 22, "end": 57, "loc": { "start": { "line": 1, "column": 22 }, "end": { "line": 1, "column": 57 } }, "extra": { "rawValue": "../systems/EntitySystem/Component", "raw": "'../systems/EntitySystem/Component'" }, "value": "../systems/EntitySystem/Component" } }, { "type": "ImportDeclaration", "start": 60, "end": 99, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 39 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 67, "end": 73, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } }, "local": { "type": "Identifier", "start": 67, "end": 73, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 }, "identifierName": "System" }, "name": "System" } } ], "source": { "type": "StringLiteral", "start": 79, "end": 98, "loc": { "start": { "line": 2, "column": 19 }, "end": { "line": 2, "column": 38 } }, "extra": { "rawValue": "../systems/System", "raw": "'../systems/System'" }, "value": "../systems/System" } }, { "type": "ImportDeclaration", "start": 101, "end": 138, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 37 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 108, "end": 114, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 13 } }, "local": { "type": "Identifier", "start": 108, "end": 114, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 13 }, "identifierName": "Events" }, "name": "Events" } } ], "source": { "type": "StringLiteral", "start": 120, "end": 137, "loc": { "start": { "line": 3, "column": 19 }, "end": { "line": 3, "column": 36 } }, "extra": { "rawValue": "../utils/Events", "raw": "'../utils/Events'" }, "value": "../utils/Events" } }, { "type": "VariableDeclaration", "start": 142, "end": 161, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 19 } }, "declarations": [ { "type": "VariableDeclarator", "start": 146, "end": 160, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 18 } }, "id": { "type": "Identifier", "start": 146, "end": 156, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 14 }, "identifierName": "instancing" }, "name": "instancing" }, "init": { "type": "NumericLiteral", "start": 159, "end": 160, "loc": { "start": { "line": 5, "column": 17 }, "end": { "line": 5, "column": 18 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "let" }, { "type": "ExportDefaultDeclaration", "start": 165, "end": 2806, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 131, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 180, "end": 2806, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 131, "column": 1 } }, "id": { "type": "Identifier", "start": 186, "end": 200, "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 35 }, "identifierName": "PrefabInstance" }, "name": "PrefabInstance" }, "superClass": { "type": "Identifier", "start": 209, "end": 218, "loc": { "start": { "line": 7, "column": 44 }, "end": { "line": 7, "column": 53 }, "identifierName": "Component" }, "name": "Component" }, "body": { "type": "ClassBody", "start": 219, "end": 2806, "loc": { "start": { "line": 7, "column": 54 }, "end": { "line": 131, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 226, "end": 283, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 11, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 233, "end": 240, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 243, "end": 283, "loc": { "start": { "line": 9, "column": 19 }, "end": { "line": 11, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 250, "end": 278, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 32 } }, "argument": { "type": "NewExpression", "start": 257, "end": 277, "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 31 } }, "callee": { "type": "Identifier", "start": 261, "end": 275, "loc": { "start": { "line": 10, "column": 15 }, "end": { "line": 10, "column": 29 }, "identifierName": "PrefabInstance" }, "name": "PrefabInstance" }, "arguments": [] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 289, "end": 425, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 19, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 300, "end": 310, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 23 }, "identifierName": "propsTypes" }, "name": "propsTypes" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 313, "end": 425, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 19, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 320, "end": 420, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 18, "column": 6 } }, "argument": { "type": "ObjectExpression", "start": 327, "end": 419, "loc": { "start": { "line": 14, "column": 11 }, "end": { "line": 18, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 336, "end": 356, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 336, "end": 341, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 11 }, "identifierName": "asset" }, "name": "asset" }, "value": { "type": "StringLiteral", "start": 343, "end": 356, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 26 } }, "extra": { "rawValue": "string_null", "raw": "'string_null'" }, "value": "string_null" } }, { "type": "ObjectProperty", "start": 365, "end": 381, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 365, "end": 370, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 11 }, "identifierName": "count" }, "name": "count" }, "value": { "type": "StringLiteral", "start": 372, "end": 381, "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 22 } }, "extra": { "rawValue": "integer", "raw": "'integer'" }, "value": "integer" } }, { "type": "ObjectProperty", "start": 390, "end": 412, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 28 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 390, "end": 400, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 16 }, "identifierName": "components" }, "name": "components" }, "value": { "type": "StringLiteral", "start": 402, "end": 412, "loc": { "start": { "line": 17, "column": 18 }, "end": { "line": 17, "column": 28 } }, "extra": { "rawValue": "map(any)", "raw": "'map(any)'" }, "value": "map(any)" } } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 431, "end": 485, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 23, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 442, "end": 452, "loc": { "start": { "line": 21, "column": 13 }, "end": { "line": 21, "column": 23 }, "identifierName": "instancing" }, "name": "instancing" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 455, "end": 485, "loc": { "start": { "line": 21, "column": 26 }, "end": { "line": 23, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 462, "end": 480, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 22 } }, "argument": { "type": "Identifier", "start": 469, "end": 479, "loc": { "start": { "line": 22, "column": 11 }, "end": { "line": 22, "column": 21 }, "identifierName": "instancing" }, "name": "instancing" } } ], "directives": [] } }, { "type": "ClassMethod", "start": 491, "end": 536, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 27, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 495, "end": 501, "loc": { "start": { "line": 25, "column": 6 }, "end": { "line": 25, "column": 12 }, "identifierName": "events" }, "name": "events" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 504, "end": 536, "loc": { "start": { "line": 25, "column": 15 }, "end": { "line": 27, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 511, "end": 531, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 24 } }, "argument": { "type": "MemberExpression", "start": 518, "end": 530, "loc": { "start": { "line": 26, "column": 11 }, "end": { "line": 26, "column": 23 } }, "object": { "type": "ThisExpression", "start": 518, "end": 522, "loc": { "start": { "line": 26, "column": 11 }, "end": { "line": 26, "column": 15 } } }, "property": { "type": "Identifier", "start": 523, "end": 530, "loc": { "start": { "line": 26, "column": 16 }, "end": { "line": 26, "column": 23 }, "identifierName": "_events" }, "name": "_events" }, "computed": false } } ], "directives": [] } }, { "type": "ClassMethod", "start": 542, "end": 585, "loc": { "start": { "line": 29, "column": 2 }, "end": { "line": 31, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 546, "end": 551, "loc": { "start": { "line": 29, "column": 6 }, "end": { "line": 29, "column": 11 }, "identifierName": "asset" }, "name": "asset" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 554, "end": 585, "loc": { "start": { "line": 29, "column": 14 }, "end": { "line": 31, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 561, "end": 580, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 23 } }, "argument": { "type": "MemberExpression", "start": 568, "end": 579, "loc": { "start": { "line": 30, "column": 11 }, "end": { "line": 30, "column": 22 } }, "object": { "type": "ThisExpression", "start": 568, "end": 572, "loc": { "start": { "line": 30, "column": 11 }, "end": { "line": 30, "column": 15 } } }, "property": { "type": "Identifier", "start": 573, "end": 579, "loc": { "start": { "line": 30, "column": 16 }, "end": { "line": 30, "column": 22 }, "identifierName": "_asset" }, "name": "_asset" }, "computed": false } } ], "directives": [] } }, { "type": "ClassMethod", "start": 591, "end": 815, "loc": { "start": { "line": 33, "column": 2 }, "end": { "line": 44, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 595, "end": 600, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 11 }, "identifierName": "asset" }, "name": "asset" }, "kind": "set", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 601, "end": 606, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 17 }, "identifierName": "value" }, "name": "value" } ], "body": { "type": "BlockStatement", "start": 608, "end": 815, "loc": { "start": { "line": 33, "column": 19 }, "end": { "line": 44, "column": 3 } }, "body": [ { "type": "IfStatement", "start": 615, "end": 677, "loc": { "start": { "line": 34, "column": 4 }, "end": { "line": 37, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 619, "end": 625, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 14 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 620, "end": 625, "loc": { "start": { "line": 34, "column": 9 }, "end": { "line": 34, "column": 14 }, "identifierName": "value" }, "name": "value" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 627, "end": 677, "loc": { "start": { "line": 34, "column": 16 }, "end": { "line": 37, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 636, "end": 655, "loc": { "start": { "line": 35, "column": 6 }, "end": { "line": 35, "column": 25 } }, "expression": { "type": "AssignmentExpression", "start": 636, "end": 654, "loc": { "start": { "line": 35, "column": 6 }, "end": { "line": 35, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 636, "end": 647, "loc": { "start": { "line": 35, "column": 6 }, "end": { "line": 35, "column": 17 } }, "object": { "type": "ThisExpression", "start": 636, "end": 640, "loc": { "start": { "line": 35, "column": 6 }, "end": { "line": 35, "column": 10 } } }, "property": { "type": "Identifier", "start": 641, "end": 647, "loc": { "start": { "line": 35, "column": 11 }, "end": { "line": 35, "column": 17 }, "identifierName": "_asset" }, "name": "_asset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 650, "end": 654, "loc": { "start": { "line": 35, "column": 20 }, "end": { "line": 35, "column": 24 } } } } }, { "type": "ReturnStatement", "start": 663, "end": 670, "loc": { "start": { "line": 36, "column": 6 }, "end": { "line": 36, "column": 13 } }, "argument": null } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 685, "end": 782, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "test": { "type": "BinaryExpression", "start": 689, "end": 714, "loc": { "start": { "line": 39, "column": 8 }, "end": { "line": 39, "column": 33 } }, "left": { "type": "UnaryExpression", "start": 689, "end": 701, "loc": { "start": { "line": 39, "column": 8 }, "end": { "line": 39, "column": 20 } }, "operator": "typeof", "prefix": true, "argument": { "type": "Identifier", "start": 696, "end": 701, "loc": { "start": { "line": 39, "column": 15 }, "end": { "line": 39, "column": 20 }, "identifierName": "value" }, "name": "value" }, "extra": { "parenthesizedArgument": false } }, "operator": "!==", "right": { "type": "StringLiteral", "start": 706, "end": 714, "loc": { "start": { "line": 39, "column": 25 }, "end": { "line": 39, "column": 33 } }, "extra": { "rawValue": "string", "raw": "'string'" }, "value": "string" } }, "consequent": { "type": "BlockStatement", "start": 716, "end": 782, "loc": { "start": { "line": 39, "column": 35 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 725, "end": 775, "loc": { "start": { "line": 40, "column": 6 }, "end": { "line": 40, "column": 56 } }, "argument": { "type": "NewExpression", "start": 731, "end": 774, "loc": { "start": { "line": 40, "column": 12 }, "end": { "line": 40, "column": 55 } }, "callee": { "type": "Identifier", "start": 735, "end": 740, "loc": { "start": { "line": 40, "column": 16 }, "end": { "line": 40, "column": 21 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 741, "end": 773, "loc": { "start": { "line": 40, "column": 22 }, "end": { "line": 40, "column": 54 } }, "extra": { "rawValue": "`value` is not type of String!", "raw": "'`value` is not type of String!'" }, "value": "`value` is not type of String!" } ] } } ], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "start": 790, "end": 810, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 790, "end": 809, "loc": { "start": { "line": 43, "column": 4