oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,537 lines (1,536 loc) • 2.77 MB
JSON
{
"type": "File",
"start": 0,
"end": 11880,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 500,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 11880,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 500,
"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": 71,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 39
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "System"
},
"name": "System"
}
}
],
"source": {
"type": "StringLiteral",
"start": 51,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 19
},
"end": {
"line": 2,
"column": 38
}
},
"extra": {
"rawValue": "../systems/System",
"raw": "'../systems/System'"
},
"value": "../systems/System"
}
},
{
"type": "ImportDeclaration",
"start": 73,
"end": 110,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 37
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 80,
"end": 86,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 80,
"end": 86,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 13
},
"identifierName": "Events"
},
"name": "Events"
}
}
],
"source": {
"type": "StringLiteral",
"start": 92,
"end": 109,
"loc": {
"start": {
"line": 3,
"column": 19
},
"end": {
"line": 3,
"column": 36
}
},
"extra": {
"rawValue": "../utils/Events",
"raw": "'../utils/Events'"
},
"value": "../utils/Events"
}
},
{
"type": "ImportDeclaration",
"start": 112,
"end": 155,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 43
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 121,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 24
}
},
"imported": {
"type": "Identifier",
"start": 121,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 24
},
"identifierName": "angleDifference"
},
"name": "angleDifference"
},
"local": {
"type": "Identifier",
"start": 121,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 24
},
"identifierName": "angleDifference"
},
"name": "angleDifference"
}
}
],
"source": {
"type": "StringLiteral",
"start": 144,
"end": 154,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 42
}
},
"extra": {
"rawValue": "../utils",
"raw": "'../utils'"
},
"value": "../utils"
}
},
{
"type": "FunctionDeclaration",
"start": 159,
"end": 495,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 22,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 168,
"end": 177,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 18
},
"identifierName": "findFrame"
},
"name": "findFrame"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 178,
"end": 182,
"loc": {
"start": {
"line": 6,
"column": 19
},
"end": {
"line": 6,
"column": 23
},
"identifierName": "time"
},
"name": "time"
},
{
"type": "Identifier",
"start": 184,
"end": 190,
"loc": {
"start": {
"line": 6,
"column": 25
},
"end": {
"line": 6,
"column": 31
},
"identifierName": "frames"
},
"name": "frames"
}
],
"body": {
"type": "BlockStatement",
"start": 192,
"end": 495,
"loc": {
"start": {
"line": 6,
"column": 33
},
"end": {
"line": 22,
"column": 1
}
},
"body": [
{
"type": "ForStatement",
"start": 197,
"end": 474,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"init": {
"type": "VariableDeclaration",
"start": 202,
"end": 230,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 35
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 206,
"end": 211,
"loc": {
"start": {
"line": 7,
"column": 11
},
"end": {
"line": 7,
"column": 16
}
},
"id": {
"type": "Identifier",
"start": 206,
"end": 207,
"loc": {
"start": {
"line": 7,
"column": 11
},
"end": {
"line": 7,
"column": 12
},
"identifierName": "i"
},
"name": "i"
},
"init": {
"type": "NumericLiteral",
"start": 210,
"end": 211,
"loc": {
"start": {
"line": 7,
"column": 15
},
"end": {
"line": 7,
"column": 16
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "VariableDeclarator",
"start": 213,
"end": 230,
"loc": {
"start": {
"line": 7,
"column": 18
},
"end": {
"line": 7,
"column": 35
}
},
"id": {
"type": "Identifier",
"start": 213,
"end": 214,
"loc": {
"start": {
"line": 7,
"column": 18
},
"end": {
"line": 7,
"column": 19
},
"identifierName": "c"
},
"name": "c"
},
"init": {
"type": "MemberExpression",
"start": 217,
"end": 230,
"loc": {
"start": {
"line": 7,
"column": 22
},
"end": {
"line": 7,
"column": 35
}
},
"object": {
"type": "Identifier",
"start": 217,
"end": 223,
"loc": {
"start": {
"line": 7,
"column": 22
},
"end": {
"line": 7,
"column": 28
},
"identifierName": "frames"
},
"name": "frames"
},
"property": {
"type": "Identifier",
"start": 224,
"end": 230,
"loc": {
"start": {
"line": 7,
"column": 29
},
"end": {
"line": 7,
"column": 35
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
}
}
],
"kind": "let"
},
"test": {
"type": "BinaryExpression",
"start": 232,
"end": 237,
"loc": {
"start": {
"line": 7,
"column": 37
},
"end": {
"line": 7,
"column": 42
}
},
"left": {
"type": "Identifier",
"start": 232,
"end": 233,
"loc": {
"start": {
"line": 7,
"column": 37
},
"end": {
"line": 7,
"column": 38
},
"identifierName": "i"
},
"name": "i"
},
"operator": "<",
"right": {
"type": "Identifier",
"start": 236,
"end": 237,
"loc": {
"start": {
"line": 7,
"column": 41
},
"end": {
"line": 7,
"column": 42
},
"identifierName": "c"
},
"name": "c"
}
},
"update": {
"type": "UpdateExpression",
"start": 239,
"end": 242,
"loc": {
"start": {
"line": 7,
"column": 44
},
"end": {
"line": 7,
"column": 47
}
},
"operator": "++",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 241,
"end": 242,
"loc": {
"start": {
"line": 7,
"column": 46
},
"end": {
"line": 7,
"column": 47
},
"identifierName": "i"
},
"name": "i"
},
"extra": {
"parenthesizedArgument": false
}
},
"body": {
"type": "BlockStatement",
"start": 244,
"end": 474,
"loc": {
"start": {
"line": 7,
"column": 49
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 251,
"end": 271,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 24
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 257,
"end": 270,
"loc": {
"start": {
"line": 8,
"column": 10
},
"end": {
"line": 8,
"column": 23
}
},
"id": {
"type": "Identifier",
"start": 257,
"end": 258,
"loc": {
"start": {
"line": 8,
"column": 10
},
"end": {
"line": 8,
"column": 11
},
"identifierName": "a"
},
"name": "a"
},
"init": {
"type": "MemberExpression",
"start": 261,
"end": 270,
"loc": {
"start": {
"line": 8,
"column": 14
},
"end": {
"line": 8,
"column": 23
}
},
"object": {
"type": "Identifier",
"start": 261,
"end": 267,
"loc": {
"start": {
"line": 8,
"column": 14
},
"end": {
"line": 8,
"column": 20
},
"identifierName": "frames"
},
"name": "frames"
},
"property": {
"type": "Identifier",
"start": 268,
"end": 269,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 22
},
"identifierName": "i"
},
"name": "i"
},
"computed": true
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 277,
"end": 301,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 283,
"end": 300,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 283,
"end": 284,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 11
},
"identifierName": "b"
},
"name": "b"
},
"init": {
"type": "MemberExpression",
"start": 287,
"end": 300,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 287,
"end": 293,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 20
},
"identifierName": "frames"
},
"name": "frames"
},
"property": {
"type": "BinaryExpression",
"start": 294,
"end": 299,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 26
}
},
"left": {
"type": "Identifier",
"start": 294,
"end": 295,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 22
},
"identifierName": "i"
},
"name": "i"
},
"operator": "+",
"right": {
"type": "NumericLiteral",
"start": 298,
"end": 299,
"loc": {
"start": {
"line": 9,
"column": 25
},
"end": {
"line": 9,
"column": 26
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
},
"computed": true
}
}
],
"kind": "const"
},
{
"type": "IfStatement",
"start": 307,
"end": 469,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 18,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 311,
"end": 314,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 11
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "UnaryExpression",
"start": 312,
"end": 314,
"loc": {
"start": {
"line": 10,
"column": 9
},
"end": {
"line": 10,
"column": 11
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 313,
"end": 314,
"loc": {
"start": {
"line": 10,
"column": 10
},
"end": {
"line": 10,
"column": 11
},
"identifierName": "b"
},
"name": "b"
},
"extra": {
"parenthesizedArgument": false
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 316,
"end": 398,
"loc": {
"start": {
"line": 10,
"column": 13
},
"end": {
"line": 14,
"column": 5
}
},
"body": [
{
"type": "IfStatement",
"start": 325,
"end": 391,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 13,
"column": 7
}
},
"test": {
"type": "LogicalExpression",
"start": 329,
"end": 360,
"loc": {
"start": {
"line": 11,
"column": 10
},
"end": {
"line": 11,
"column": 41
}
},
"left": {
"type": "BinaryExpression",
"start": 329,
"end": 343,
"loc": {
"start": {
"line": 11,
"column": 10
},
"end": {
"line": 11,
"column": 24
}
},
"left": {
"type": "Identifier",
"start": 329,
"end": 333,
"loc": {
"start": {
"line": 11,
"column": 10
},
"end": {
"line": 11,
"column": 14
},
"identifierName": "time"
},
"name": "time"
},
"operator": ">=",
"right": {
"type": "MemberExpression",
"start": 337,
"end": 343,
"loc": {
"start": {
"line": 11,
"column": 18
},
"end": {
"line": 11,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 337,
"end": 338,
"loc": {
"start": {
"line": 11,
"column": 18
},
"end": {
"line": 11,
"column": 19
},
"identifierName": "a"
},
"name": "a"
},
"property": {
"type": "Identifier",
"start": 339,
"end": 343,
"loc": {
"start": {
"line": 11,
"column": 20
},
"end": {
"line": 11,
"column": 24
},
"identifierName": "time"
},
"name": "time"
},
"computed": false
}
},
"operator": "&&",
"right": {
"type": "BinaryExpression",
"start": 347,
"end": 360,
"loc": {
"start": {
"line": 11,
"column": 28
},
"end": {
"line": 11,
"column": 41
}
},
"left": {
"type": "Identifier",
"start": 347,
"end": 351,
"loc": {
"start": {
"line": 11,
"column": 28
},
"end": {
"line": 11,
"column": 32
},
"identifierName": "time"
},
"name": "time"
},
"operator": "<",
"right": {
"type": "MemberExpression",
"start": 354,
"end": 360,
"loc": {
"start": {
"line": 11,
"column": 35
},
"end": {
"line": 11,
"column": 41
}
},
"object": {
"type": "Identifier",
"start": 354,
"end": 355,
"loc": {
"start": {
"line": 11,
"column": 35
},
"end": {
"line": 11,
"column": 36
},
"identifierName": "b"
},
"name": "b"
},
"property": {
"type": "Identifier",
"start": 356,
"end": 360,
"loc": {
"start": {
"line": 11,
"column": 37
},
"end": {
"line": 11,
"column": 41
},
"identifierName": "time"
},
"name": "time"
},
"computed": false
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 362,
"end": 391,
"loc": {
"start": {
"line": 11,
"column": 43
},
"end": {
"line": 13,
"column": 7
}
},
"body": [
{
"type": "ReturnStatement",
"start": 373,
"end": 382,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 17
}
},
"argument": {
"type": "Identifier",
"start": 380,
"end": 381,
"loc": {
"start": {
"line": 12,
"column": 15
},
"end": {
"line": 12,
"column": 16
},
"identifierName": "a"
},
"name": "a"
}
}
],
"directives": []
},
"alternate": null
}
],
"directives": []
},
"alternate": {
"type": "BlockStatement",
"start": 404,
"end": 469,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 18,
"column": 5
}
},
"body": [
{
"type": "IfStatement",
"start": 413,
"end": 462,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 17,
"column": 7
}
},
"test": {
"type": "BinaryExpression",
"start": 417,
"end": 431,
"loc": {
"start": {
"line": 15,
"column": 10
},
"end": {
"line": 15,
"column": 24
}
},
"left": {
"type": "Identifier",
"start": 417,
"end": 421,
"loc": {
"start": {
"line": 15,
"column": 10
},
"end": {
"line": 15,
"column": 14
},
"identifierName": "time"
},
"name": "time"
},
"operator": ">=",
"right": {
"type": "MemberExpression",
"start": 425,
"end": 431,
"loc": {
"start": {
"line": 15,
"column": 18
},
"end": {
"line": 15,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 425,
"end": 426,
"loc": {
"start": {
"line": 15,
"column": 18
},
"end": {
"line": 15,
"column": 19
},
"identifierName": "a"
},
"name": "a"
},
"property": {
"type": "Identifier",
"start": 427,
"end": 431,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 24
},
"identifierName": "time"
},
"name": "time"
},
"computed": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 433,
"end": 462,
"loc": {
"start": {
"line": 15,
"column": 26
},
"end": {
"line": 17,
"column": 7
}
},
"body": [
{
"type": "ReturnStatement",
"start": 444,
"end": 453,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 17
}
},
"argument": {
"type": "Identifier",
"start": 451,
"end": 452,
"loc": {
"start": {
"line": 16,
"column": 15
},
"end": {
"line": 16,
"column": 16
},
"identifierName": "a"
},
"name": "a"
}
}
],
"directives": []
},
"alternate": null
}
],
"directives": []
}
}
],
"directives": []
}
},
{
"type": "ReturnStatement",
"start": 480,
"end": 492,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 14
}
},
"argument": {
"type": "NullLiteral",
"start": 487,
"end": 491,
"loc": {
"start": {
"line": 21,
"column": 9
},
"end": {
"line": 21,
"column": 13
}
}
}
}
],
"directives": []
}
},
{
"type": "FunctionDeclaration",
"start": 499,
"end": 907,
"loc": {
"start": {
"line": 24,
"column": 0
},
"end": {
"line": 43,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 508,
"end": 518,
"loc": {
"start": {
"line": 24,
"column": 9
},
"end": {
"line": 24,
"column": 19
},
"identifierName": "findFrames"
},
"name": "findFrames"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 519,
"end": 523,
"loc": {
"start": {
"line": 24,
"column": 20
},
"end": {
"line": 24,
"column": 24
},
"identifierName": "time"
},
"name": "time"
},
{
"type": "Identifier",
"start": 525,
"end": 531,
"loc": {
"start": {
"line": 24,
"column": 26
},
"end": {
"line": 24,
"column": 32
},
"identifierName": "frames"
},
"name": "frames"
}
],
"body": {
"type": "BlockStatement",
"start": 533,
"end": 907,
"loc": {
"start": {
"line": 24,
"column": 34
},
"end": {
"line": 43,