UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,593 lines 3.68 MB
{ "type": "File", "start": 0, "end": 18828, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 777, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 18828, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 777, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 30, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 30 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 13, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 13 } }, "local": { "type": "Identifier", "start": 7, "end": 13, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 13 }, "identifierName": "Script" }, "name": "Script" } } ], "source": { "type": "StringLiteral", "start": 19, "end": 29, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 29 } }, "extra": { "rawValue": "./Script", "raw": "'./Script'" }, "value": "./Script" } }, { "type": "ImportDeclaration", "start": 32, "end": 169, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 10, "column": 24 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 44, "end": 50, "loc": { "start": { "line": 3, "column": 2 }, "end": { "line": 3, "column": 8 } }, "imported": { "type": "Identifier", "start": 44, "end": 50, "loc": { "start": { "line": 3, "column": 2 }, "end": { "line": 3, "column": 8 }, "identifierName": "b2Vec2" }, "name": "b2Vec2" }, "local": { "type": "Identifier", "start": 44, "end": 50, "loc": { "start": { "line": 3, "column": 2 }, "end": { "line": 3, "column": 8 }, "identifierName": "b2Vec2" }, "name": "b2Vec2" } }, { "type": "ImportSpecifier", "start": 55, "end": 64, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 11 } }, "imported": { "type": "Identifier", "start": 55, "end": 64, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 11 }, "identifierName": "b2BodyDef" }, "name": "b2BodyDef" }, "local": { "type": "Identifier", "start": 55, "end": 64, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 11 }, "identifierName": "b2BodyDef" }, "name": "b2BodyDef" } }, { "type": "ImportSpecifier", "start": 69, "end": 81, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 14 } }, "imported": { "type": "Identifier", "start": 69, "end": 81, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 14 }, "identifierName": "b2FixtureDef" }, "name": "b2FixtureDef" }, "local": { "type": "Identifier", "start": 69, "end": 81, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 14 }, "identifierName": "b2FixtureDef" }, "name": "b2FixtureDef" } }, { "type": "ImportSpecifier", "start": 86, "end": 99, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 15 } }, "imported": { "type": "Identifier", "start": 86, "end": 99, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 15 }, "identifierName": "b2CircleShape" }, "name": "b2CircleShape" }, "local": { "type": "Identifier", "start": 86, "end": 99, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 15 }, "identifierName": "b2CircleShape" }, "name": "b2CircleShape" } }, { "type": "ImportSpecifier", "start": 104, "end": 118, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 16 } }, "imported": { "type": "Identifier", "start": 104, "end": 118, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 16 }, "identifierName": "b2PolygonShape" }, "name": "b2PolygonShape" }, "local": { "type": "Identifier", "start": 104, "end": 118, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 16 }, "identifierName": "b2PolygonShape" }, "name": "b2PolygonShape" } }, { "type": "ImportSpecifier", "start": 123, "end": 129, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 8 } }, "imported": { "type": "Identifier", "start": 123, "end": 129, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 8 }, "identifierName": "b2Body" }, "name": "b2Body" }, "local": { "type": "Identifier", "start": 123, "end": 129, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 8 }, "identifierName": "b2Body" }, "name": "b2Body" } }, { "type": "ImportSpecifier", "start": 134, "end": 143, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 9, "column": 11 } }, "imported": { "type": "Identifier", "start": 134, "end": 143, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 9, "column": 11 }, "identifierName": "b2Fixture" }, "name": "b2Fixture" }, "local": { "type": "Identifier", "start": 134, "end": 143, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 9, "column": 11 }, "identifierName": "b2Fixture" }, "name": "b2Fixture" } } ], "source": { "type": "StringLiteral", "start": 152, "end": 168, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 23 } }, "extra": { "rawValue": "../utils/box2d", "raw": "'../utils/box2d'" }, "value": "../utils/box2d" } }, { "type": "VariableDeclaration", "start": 173, "end": 239, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 15, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 179, "end": 238, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 15, "column": 1 } }, "id": { "type": "Identifier", "start": 179, "end": 188, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 15 }, "identifierName": "ShapeType" }, "name": "ShapeType" }, "init": { "type": "ObjectExpression", "start": 191, "end": 238, "loc": { "start": { "line": 12, "column": 18 }, "end": { "line": 15, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 196, "end": 212, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 18 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 196, "end": 202, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 8 }, "identifierName": "CIRCLE" }, "name": "CIRCLE" }, "value": { "type": "StringLiteral", "start": 204, "end": 212, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 18 } }, "extra": { "rawValue": "circle", "raw": "'circle'" }, "value": "circle" } }, { "type": "ObjectProperty", "start": 217, "end": 235, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 217, "end": 224, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 9 }, "identifierName": "POLYGON" }, "name": "POLYGON" }, "value": { "type": "StringLiteral", "start": 226, "end": 235, "loc": { "start": { "line": 14, "column": 11 }, "end": { "line": 14, "column": 20 } }, "extra": { "rawValue": "polygon", "raw": "'polygon'" }, "value": "polygon" } } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 243, "end": 335, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 21, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 249, "end": 334, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 249, "end": 257, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 14 }, "identifierName": "BodyType" }, "name": "BodyType" }, "init": { "type": "ObjectExpression", "start": 260, "end": 334, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 21, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 265, "end": 281, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 18 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 265, "end": 271, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 8 }, "identifierName": "STATIC" }, "name": "STATIC" }, "value": { "type": "StringLiteral", "start": 273, "end": 281, "loc": { "start": { "line": 18, "column": 10 }, "end": { "line": 18, "column": 18 } }, "extra": { "rawValue": "static", "raw": "'static'" }, "value": "static" } }, { "type": "ObjectProperty", "start": 286, "end": 304, "loc": { "start": { "line": 19, "column": 2 }, "end": { "line": 19, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 286, "end": 293, "loc": { "start": { "line": 19, "column": 2 }, "end": { "line": 19, "column": 9 }, "identifierName": "DYNAMIC" }, "name": "DYNAMIC" }, "value": { "type": "StringLiteral", "start": 295, "end": 304, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 20 } }, "extra": { "rawValue": "dynamic", "raw": "'dynamic'" }, "value": "dynamic" } }, { "type": "ObjectProperty", "start": 309, "end": 331, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 24 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 309, "end": 318, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 11 }, "identifierName": "KINEMATIC" }, "name": "KINEMATIC" }, "value": { "type": "StringLiteral", "start": 320, "end": 331, "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 24 } }, "extra": { "rawValue": "kinematic", "raw": "'kinematic'" }, "value": "kinematic" } } ] } } ], "kind": "const" }, { "type": "ExportDefaultDeclaration", "start": 339, "end": 18826, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 776, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 354, "end": 18826, "loc": { "start": { "line": 23, "column": 15 }, "end": { "line": 776, "column": 1 } }, "id": { "type": "Identifier", "start": 360, "end": 371, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 23, "column": 32 }, "identifierName": "PhysicsBody" }, "name": "PhysicsBody" }, "superClass": { "type": "Identifier", "start": 380, "end": 386, "loc": { "start": { "line": 23, "column": 41 }, "end": { "line": 23, "column": 47 }, "identifierName": "Script" }, "name": "Script" }, "body": { "type": "ClassBody", "start": 387, "end": 18826, "loc": { "start": { "line": 23, "column": 48 }, "end": { "line": 776, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 394, "end": 448, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 27, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 401, "end": 408, "loc": { "start": { "line": 25, "column": 9 }, "end": { "line": 25, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 411, "end": 448, "loc": { "start": { "line": 25, "column": 19 }, "end": { "line": 27, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 418, "end": 443, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 29 } }, "argument": { "type": "NewExpression", "start": 425, "end": 442, "loc": { "start": { "line": 26, "column": 11 }, "end": { "line": 26, "column": 28 } }, "callee": { "type": "Identifier", "start": 429, "end": 440, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 26 }, "identifierName": "PhysicsBody" }, "name": "PhysicsBody" }, "arguments": [] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 454, "end": 1214, "loc": { "start": { "line": 29, "column": 2 }, "end": { "line": 53, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 465, "end": 475, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 23 }, "identifierName": "propsTypes" }, "name": "propsTypes" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 478, "end": 1214, "loc": { "start": { "line": 29, "column": 26 }, "end": { "line": 53, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 485, "end": 1209, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 52, "column": 6 } }, "argument": { "type": "ObjectExpression", "start": 492, "end": 1208, "loc": { "start": { "line": 30, "column": 11 }, "end": { "line": 52, "column": 5 } }, "properties": [ { "type": "SpreadProperty", "start": 501, "end": 521, "loc": { "start": { "line": 31, "column": 6 }, "end": { "line": 31, "column": 26 } }, "argument": { "type": "MemberExpression", "start": 504, "end": 521, "loc": { "start": { "line": 31, "column": 9 }, "end": { "line": 31, "column": 26 } }, "object": { "type": "Identifier", "start": 504, "end": 510, "loc": { "start": { "line": 31, "column": 9 }, "end": { "line": 31, "column": 15 }, "identifierName": "Script" }, "name": "Script" }, "property": { "type": "Identifier", "start": 511, "end": 521, "loc": { "start": { "line": 31, "column": 16 }, "end": { "line": 31, "column": 26 }, "identifierName": "propsTypes" }, "name": "propsTypes" }, "computed": false } }, { "type": "ObjectProperty", "start": 530, "end": 560, "loc": { "start": { "line": 32, "column": 6 }, "end": { "line": 32, "column": 36 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 530, "end": 545, "loc": { "start": { "line": 32, "column": 6 }, "end": { "line": 32, "column": 21 }, "identifierName": "applyPositionTo" }, "name": "applyPositionTo" }, "value": { "type": "StringLiteral", "start": 547, "end": 560, "loc": { "start": { "line": 32, "column": 23 }, "end": { "line": 32, "column": 36 } }, "extra": { "rawValue": "string_null", "raw": "'string_null'" }, "value": "string_null" } }, { "type": "ObjectProperty", "start": 569, "end": 599, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 36 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 569, "end": 584, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 21 }, "identifierName": "applyRotationTo" }, "name": "applyRotationTo" }, "value": { "type": "StringLiteral", "start": 586, "end": 599, "loc": { "start": { "line": 33, "column": 23 }, "end": { "line": 33, "column": 36 } }, "extra": { "rawValue": "string_null", "raw": "'string_null'" }, "value": "string_null" } }, { "type": "ObjectProperty", "start": 608, "end": 640, "loc": { "start": { "line": 34, "column": 6 }, "end": { "line": 34, "column": 38 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 608, "end": 625, "loc": { "start": { "line": 34, "column": 6 }, "end": { "line": 34, "column": 23 }, "identifierName": "applyPositionFrom" }, "name": "applyPositionFrom" }, "value": { "type": "StringLiteral", "start": 627, "end": 640, "loc": { "start": { "line": 34, "column": 25 }, "end": { "line": 34, "column": 38 } }, "extra": { "rawValue": "string_null", "raw": "'string_null'" }, "value": "string_null" } }, { "type": "ObjectProperty", "start": 649, "end": 681, "loc": { "start": { "line": 35, "column": 6 }, "end": { "line": 35, "column": 38 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 649, "end": 666, "loc": { "start": { "line": 35, "column": 6 }, "end": { "line": 35, "column": 23 }, "identifierName": "applyRotationFrom" }, "name": "applyRotationFrom" }, "value": { "type": "StringLiteral", "start": 668, "end": 681, "loc": { "start": { "line": 35, "column": 25 }, "end": { "line": 35, "column": 38 } }, "extra": { "rawValue": "string_null", "raw": "'string_null'" }, "value": "string_null" } }, { "type": "ObjectProperty", "start": 690, "end": 734, "loc": { "start": { "line": 36, "column": 6 }, "end": { "line": 36, "column": 50 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 690, "end": 698, "loc": { "start": { "line": 36, "column": 6 }, "end": { "line": 36, "column": 14 }, "identifierName": "bodyType" }, "name": "bodyType" }, "value": { "type": "StringLiteral", "start": 700, "end": 734, "loc": { "start": { "line": 36, "column": 16 }, "end": { "line": 36, "column": 50 } }, "extra": { "rawValue": "enum(static, dynamic, kinematic)", "raw": "'enum(static, dynamic, kinematic)'" }, "value": "enum(static, dynamic, kinematic)" } }, { "type": "ObjectProperty", "start": 743, "end": 759, "loc": { "start": { "line": 37, "column": 6 }, "end": { "line": 37, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 743, "end": 749, "loc": { "start": { "line": 37, "column": 6 }, "end": { "line": 37, "column": 12 }, "identifierName": "radius" }, "name": "radius" }, "value": { "type": "StringLiteral", "start": 751, "end": 759, "loc": { "start": { "line": 37, "column": 14 }, "end": { "line": 37, "column": 22 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, { "type": "ObjectProperty", "start": 768, "end": 793, "loc": { "start": { "line": 38, "column": 6 }, "end": { "line": 38, "column": 31 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 768, "end": 776, "loc": { "start": { "line": 38, "column": 6 }, "end": { "line": 38, "column": 14 }, "identifierName": "vertices" }, "name": "vertices" }, "value": { "type": "StringLiteral", "start": 778, "end": 793, "loc": { "start": { "line": 38, "column": 16 }, "end"