oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,504 lines (1,503 loc) • 1.2 MB
JSON
{
"type": "File",
"start": 0,
"end": 6143,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 252,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 6143,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 252,
"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": 74,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 42
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 41,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
}
},
"imported": {
"type": "Identifier",
"start": 41,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "vec2"
},
"name": "vec2"
},
"local": {
"type": "Identifier",
"start": 41,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "vec2"
},
"name": "vec2"
}
}
],
"source": {
"type": "StringLiteral",
"start": 53,
"end": 73,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 41
}
},
"extra": {
"rawValue": "../utils/gl-matrix",
"raw": "'../utils/gl-matrix'"
},
"value": "../utils/gl-matrix"
}
},
{
"type": "ImportDeclaration",
"start": 76,
"end": 135,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 59
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 85,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 85,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 16
},
"identifierName": "b2World"
},
"name": "b2World"
},
"local": {
"type": "Identifier",
"start": 85,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 16
},
"identifierName": "b2World"
},
"name": "b2World"
}
},
{
"type": "ImportSpecifier",
"start": 94,
"end": 100,
"loc": {
"start": {
"line": 3,
"column": 18
},
"end": {
"line": 3,
"column": 24
}
},
"imported": {
"type": "Identifier",
"start": 94,
"end": 100,
"loc": {
"start": {
"line": 3,
"column": 18
},
"end": {
"line": 3,
"column": 24
},
"identifierName": "b2Vec2"
},
"name": "b2Vec2"
},
"local": {
"type": "Identifier",
"start": 94,
"end": 100,
"loc": {
"start": {
"line": 3,
"column": 18
},
"end": {
"line": 3,
"column": 24
},
"identifierName": "b2Vec2"
},
"name": "b2Vec2"
}
},
{
"type": "ImportSpecifier",
"start": 102,
"end": 110,
"loc": {
"start": {
"line": 3,
"column": 26
},
"end": {
"line": 3,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 102,
"end": 110,
"loc": {
"start": {
"line": 3,
"column": 26
},
"end": {
"line": 3,
"column": 34
},
"identifierName": "Dynamics"
},
"name": "Dynamics"
},
"local": {
"type": "Identifier",
"start": 102,
"end": 110,
"loc": {
"start": {
"line": 3,
"column": 26
},
"end": {
"line": 3,
"column": 34
},
"identifierName": "Dynamics"
},
"name": "Dynamics"
}
}
],
"source": {
"type": "StringLiteral",
"start": 118,
"end": 134,
"loc": {
"start": {
"line": 3,
"column": 42
},
"end": {
"line": 3,
"column": 58
}
},
"extra": {
"rawValue": "../utils/box2d",
"raw": "'../utils/box2d'"
},
"value": "../utils/box2d"
}
},
{
"type": "ExportDefaultDeclaration",
"start": 139,
"end": 6141,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 251,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 154,
"end": 6141,
"loc": {
"start": {
"line": 5,
"column": 15
},
"end": {
"line": 251,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 160,
"end": 172,
"loc": {
"start": {
"line": 5,
"column": 21
},
"end": {
"line": 5,
"column": 33
},
"identifierName": "PhysicsWorld"
},
"name": "PhysicsWorld"
},
"superClass": {
"type": "Identifier",
"start": 181,
"end": 187,
"loc": {
"start": {
"line": 5,
"column": 42
},
"end": {
"line": 5,
"column": 48
},
"identifierName": "Script"
},
"name": "Script"
},
"body": {
"type": "ClassBody",
"start": 188,
"end": 6141,
"loc": {
"start": {
"line": 5,
"column": 49
},
"end": {
"line": 251,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 195,
"end": 250,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 9,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 202,
"end": 209,
"loc": {
"start": {
"line": 7,
"column": 9
},
"end": {
"line": 7,
"column": 16
},
"identifierName": "factory"
},
"name": "factory"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 212,
"end": 250,
"loc": {
"start": {
"line": 7,
"column": 19
},
"end": {
"line": 9,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 219,
"end": 245,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 30
}
},
"argument": {
"type": "NewExpression",
"start": 226,
"end": 244,
"loc": {
"start": {
"line": 8,
"column": 11
},
"end": {
"line": 8,
"column": 29
}
},
"callee": {
"type": "Identifier",
"start": 230,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 27
},
"identifierName": "PhysicsWorld"
},
"name": "PhysicsWorld"
},
"arguments": []
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 256,
"end": 445,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 267,
"end": 277,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 23
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 280,
"end": 445,
"loc": {
"start": {
"line": 11,
"column": 26
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 287,
"end": 440,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 18,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 294,
"end": 439,
"loc": {
"start": {
"line": 12,
"column": 11
},
"end": {
"line": 18,
"column": 5
}
},
"properties": [
{
"type": "SpreadProperty",
"start": 303,
"end": 323,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 26
}
},
"argument": {
"type": "MemberExpression",
"start": 306,
"end": 323,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 306,
"end": 312,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 15
},
"identifierName": "Script"
},
"name": "Script"
},
"property": {
"type": "Identifier",
"start": 313,
"end": 323,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 26
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 332,
"end": 347,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 21
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 332,
"end": 339,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 13
},
"identifierName": "gravity"
},
"name": "gravity"
},
"value": {
"type": "StringLiteral",
"start": 341,
"end": 347,
"loc": {
"start": {
"line": 14,
"column": 15
},
"end": {
"line": 14,
"column": 21
}
},
"extra": {
"rawValue": "vec2",
"raw": "'vec2'"
},
"value": "vec2"
}
},
{
"type": "ObjectProperty",
"start": 356,
"end": 374,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 15,
"column": 24
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 356,
"end": 363,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 15,
"column": 13
},
"identifierName": "doSleep"
},
"name": "doSleep"
},
"value": {
"type": "StringLiteral",
"start": 365,
"end": 374,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 24
}
},
"extra": {
"rawValue": "boolean",
"raw": "'boolean'"
},
"value": "boolean"
}
},
{
"type": "ObjectProperty",
"start": 383,
"end": 404,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 16,
"column": 27
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 383,
"end": 393,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 16,
"column": 16
},
"identifierName": "iterations"
},
"name": "iterations"
},
"value": {
"type": "StringLiteral",
"start": 395,
"end": 404,
"loc": {
"start": {
"line": 16,
"column": 18
},
"end": {
"line": 16,
"column": 27
}
},
"extra": {
"rawValue": "integer",
"raw": "'integer'"
},
"value": "integer"
}
},
{
"type": "ObjectProperty",
"start": 413,
"end": 432,
"loc": {
"start": {
"line": 17,
"column": 6
},
"end": {
"line": 17,
"column": 25
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 413,
"end": 422,
"loc": {
"start": {
"line": 17,
"column": 6
},
"end": {
"line": 17,
"column": 15
},
"identifierName": "timeScale"
},
"name": "timeScale"
},
"value": {
"type": "StringLiteral",
"start": 424,
"end": 432,
"loc": {
"start": {
"line": 17,
"column": 17
},
"end": {
"line": 17,
"column": 25
}
},
"extra": {
"rawValue": "number",
"raw": "'number'"
},
"value": "number"
}
}
]
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 451,
"end": 498,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 455,
"end": 462,
"loc": {
"start": {
"line": 21,
"column": 6
},
"end": {
"line": 21,
"column": 13
},
"identifierName": "gravity"
},
"name": "gravity"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 465,
"end": 498,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 472,
"end": 493,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 25
}
},
"argument": {
"type": "MemberExpression",
"start": 479,
"end": 492,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 479,
"end": 483,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 484,
"end": 492,
"loc": {
"start": {
"line": 22,
"column": 16
},
"end": {
"line": 22,
"column": 24
},
"identifierName": "_gravity"
},
"name": "_gravity"
},
"computed": false
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 504,
"end": 890,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 39,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 508,
"end": 515,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 13
},
"identifierName": "gravity"
},
"name": "gravity"
},
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 516,
"end": 521,
"loc": {
"start": {
"line": 25,
"column": 14
},
"end": {
"line": 25,
"column": 19
},
"identifierName": "value"
},
"name": "value"
}
],
"body": {
"type": "BlockStatement",
"start": 523,
"end": 890,
"loc": {
"start": {
"line": 25,
"column": 21
},
"end": {
"line": 39,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 530,
"end": 626,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 28,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 534,
"end": 559,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 33
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "BinaryExpression",
"start": 536,
"end": 558,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 32
}
},
"left": {
"type": "Identifier",
"start": 536,
"end": 541,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 15
},
"identifierName": "value"
},
"name": "value"
},
"operator": "instanceof",
"right": {
"type": "Identifier",
"start": 553,
"end": 558,
"loc": {
"start": {
"line": 26,
"column": 27
},
"end": {
"line": 26,
"column": 32
},
"identifierName": "Array"
},
"name": "Array"
},
"extra": {
"parenthesized": true,
"parenStart": 535
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 561,
"end": 626,
"loc": {
"start": {
"line": 26,
"column": 35
},
"end": {
"line": 28,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 570,
"end": 619,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 55
}
},
"argument": {
"type": "NewExpression",
"start": 576,
"end": 618,
"loc": {
"start": {
"line": 27,
"column": 12
},
"end": {
"line": 27,
"column": 54
}
},
"callee": {
"type": "Identifier",
"start": 580,
"end": 585,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 21
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 586,
"end": 617,
"loc": {
"start": {
"line": 27,
"column": 22
},
"end": {
"line": 27,
"column": 53
}
},
"extra": {
"rawValue": "`value` is not type of Array!",
"raw": "'`value` is not type of Array!'"
},
"value": "`value` is not type of Array!"
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "IfStatement",
"start": 632,
"end": 728,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 31,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 636,
"end": 652,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 24
}
},
"left": {
"type": "MemberExpression",
"start": 636,
"end": 648,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 20
}
},
"object": {
"type": "Identifier",
"start": 636,
"end": 641,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 13
},
"identifierName": "value"
},
"name": "value"
},
"property": {
"type": "Identifier",
"start": 642,
"end": 648,
"loc": {
"start": {
"line": 29,
"column": 14
},
"end": {
"line": 29,
"column": 20
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
},
"operator": "<",
"right": {
"type": "NumericLiteral",
"start": 651,
"end": 652,
"loc": {
"start": {
"line": 29,
"column": 23
},
"end": {
"line": 29,
"column": 24
}
},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
},
"consequent": {
"type": "BlockStatement",
"start": 654,
"end": 728,
"loc": {
"start": {
"line": 29,
"column": 26
},
"end": {
"line": 31,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 663,
"end": 721,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 64
}
},
"argument": {
"type": "NewExpression",
"start": 669,
"end": 720,
"loc": {
"start": {
"line": 30,
"column": 12
},
"end": {
"line": 30,
"column": 63
}
},
"callee": {
"type": "Identifier",
"start": 673,
"end": 678,
"loc": {
"start": {
"line": 30,
"column": 16
},
"end": {
"line": 30,
"column": 21
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 679,
"end": 719,
"loc": {
"start": {
"line": 30,
"column": 22
},
"end": {
"line": 30,
"column": 62
}
},
"extra": {
"rawValue": "`value` must have at least 2 elements!",
"raw": "'`value` must have at least 2 elements!'"
},
"value": "`value` must have at least 2 elements!"
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "ExpressionStatement",
"start": 736,
"end": 768,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 36
}
},
"expression": {
"type": "CallExpression",
"start": 736,