oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,653 lines • 3.74 MB
JSON
{
"type": "File",
"start": 0,
"end": 23468,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 969,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 23468,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 969,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"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": 35,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 35
}
},
"extra": {
"rawValue": "./Component",
"raw": "'./Component'"
},
"value": "./Component"
}
},
{
"type": "ImportDeclaration",
"start": 38,
"end": 67,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 29
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 45,
"end": 57,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 19
}
},
"local": {
"type": "Identifier",
"start": 45,
"end": 57,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 19
},
"identifierName": "EntitySystem"
},
"name": "EntitySystem"
}
}
],
"source": {
"type": "StringLiteral",
"start": 63,
"end": 66,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 28
}
},
"extra": {
"rawValue": ".",
"raw": "'.'"
},
"value": "."
}
},
{
"type": "ImportDeclaration",
"start": 69,
"end": 126,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 57
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 78,
"end": 82,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 13
}
},
"imported": {
"type": "Identifier",
"start": 78,
"end": 82,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 13
},
"identifierName": "mat4"
},
"name": "mat4"
},
"local": {
"type": "Identifier",
"start": 78,
"end": 82,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 13
},
"identifierName": "mat4"
},
"name": "mat4"
}
},
{
"type": "ImportSpecifier",
"start": 84,
"end": 88,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 3,
"column": 19
}
},
"imported": {
"type": "Identifier",
"start": 84,
"end": 88,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 3,
"column": 19
},
"identifierName": "quat"
},
"name": "quat"
},
"local": {
"type": "Identifier",
"start": 84,
"end": 88,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 3,
"column": 19
},
"identifierName": "quat"
},
"name": "quat"
}
},
{
"type": "ImportSpecifier",
"start": 90,
"end": 94,
"loc": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 25
}
},
"imported": {
"type": "Identifier",
"start": 90,
"end": 94,
"loc": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 25
},
"identifierName": "vec3"
},
"name": "vec3"
},
"local": {
"type": "Identifier",
"start": 90,
"end": 94,
"loc": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 25
},
"identifierName": "vec3"
},
"name": "vec3"
}
}
],
"source": {
"type": "StringLiteral",
"start": 102,
"end": 125,
"loc": {
"start": {
"line": 3,
"column": 33
},
"end": {
"line": 3,
"column": 56
}
},
"extra": {
"rawValue": "../../utils/gl-matrix",
"raw": "'../../utils/gl-matrix'"
},
"value": "../../utils/gl-matrix"
}
},
{
"type": "ImportDeclaration",
"start": 128,
"end": 176,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 48
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 137,
"end": 154,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 26
}
},
"imported": {
"type": "Identifier",
"start": 137,
"end": 154,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 26
},
"identifierName": "findMapKeyOfValue"
},
"name": "findMapKeyOfValue"
},
"local": {
"type": "Identifier",
"start": 137,
"end": 154,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 26
},
"identifierName": "findMapKeyOfValue"
},
"name": "findMapKeyOfValue"
}
}
],
"source": {
"type": "StringLiteral",
"start": 162,
"end": 175,
"loc": {
"start": {
"line": 4,
"column": 34
},
"end": {
"line": 4,
"column": 47
}
},
"extra": {
"rawValue": "../../utils",
"raw": "'../../utils'"
},
"value": "../../utils"
}
},
{
"type": "VariableDeclaration",
"start": 180,
"end": 221,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 41
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 186,
"end": 220,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 40
}
},
"id": {
"type": "Identifier",
"start": 186,
"end": 193,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 13
},
"identifierName": "zVector"
},
"name": "zVector"
},
"init": {
"type": "CallExpression",
"start": 196,
"end": 220,
"loc": {
"start": {
"line": 6,
"column": 16
},
"end": {
"line": 6,
"column": 40
}
},
"callee": {
"type": "MemberExpression",
"start": 196,
"end": 211,
"loc": {
"start": {
"line": 6,
"column": 16
},
"end": {
"line": 6,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 196,
"end": 200,
"loc": {
"start": {
"line": 6,
"column": 16
},
"end": {
"line": 6,
"column": 20
},
"identifierName": "vec3"
},
"name": "vec3"
},
"property": {
"type": "Identifier",
"start": 201,
"end": 211,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 31
},
"identifierName": "fromValues"
},
"name": "fromValues"
},
"computed": false
},
"arguments": [
{
"type": "NumericLiteral",
"start": 212,
"end": 213,
"loc": {
"start": {
"line": 6,
"column": 32
},
"end": {
"line": 6,
"column": 33
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
{
"type": "NumericLiteral",
"start": 215,
"end": 216,
"loc": {
"start": {
"line": 6,
"column": 35
},
"end": {
"line": 6,
"column": 36
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
{
"type": "NumericLiteral",
"start": 218,
"end": 219,
"loc": {
"start": {
"line": 6,
"column": 38
},
"end": {
"line": 6,
"column": 39
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 223,
"end": 260,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 229,
"end": 259,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 229,
"end": 243,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 20
},
"identifierName": "cachedTempVec3"
},
"name": "cachedTempVec3"
},
"init": {
"type": "CallExpression",
"start": 246,
"end": 259,
"loc": {
"start": {
"line": 7,
"column": 23
},
"end": {
"line": 7,
"column": 36
}
},
"callee": {
"type": "MemberExpression",
"start": 246,
"end": 257,
"loc": {
"start": {
"line": 7,
"column": 23
},
"end": {
"line": 7,
"column": 34
}
},
"object": {
"type": "Identifier",
"start": 246,
"end": 250,
"loc": {
"start": {
"line": 7,
"column": 23
},
"end": {
"line": 7,
"column": 27
},
"identifierName": "vec3"
},
"name": "vec3"
},
"property": {
"type": "Identifier",
"start": 251,
"end": 257,
"loc": {
"start": {
"line": 7,
"column": 28
},
"end": {
"line": 7,
"column": 34
},
"identifierName": "create"
},
"name": "create"
},
"computed": false
},
"arguments": []
}
}
],
"kind": "const",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Entity - actor of the scene, container for behaviour components.\r\n *\r\n * @example\r\n * const entity = new Entity();\r\n * entity.deserialize({ name: 'hey', components: { Hello: { hello: 'world' } } });\r\n * const hello = entity.getComponent('Hello');\r\n * console.log(hello.hello);\r\n ",
"start": 264,
"end": 553,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 17,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 555,
"end": 23466,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 968,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 570,
"end": 23466,
"loc": {
"start": {
"line": 18,
"column": 15
},
"end": {
"line": 968,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 576,
"end": 582,
"loc": {
"start": {
"line": 18,
"column": 21
},
"end": {
"line": 18,
"column": 27
},
"identifierName": "Entity"
},
"name": "Entity",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 583,
"end": 23466,
"loc": {
"start": {
"line": 18,
"column": 28
},
"end": {
"line": 968,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 624,
"end": 665,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 628,
"end": 633,
"loc": {
"start": {
"line": 21,
"column": 6
},
"end": {
"line": 21,
"column": 11
},
"identifierName": "owner"
},
"name": "owner"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 636,
"end": 665,
"loc": {
"start": {
"line": 21,
"column": 14
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 642,
"end": 661,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 23
}
},
"argument": {
"type": "MemberExpression",
"start": 649,
"end": 660,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 649,
"end": 653,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 654,
"end": 660,
"loc": {
"start": {
"line": 22,
"column": 16
},
"end": {
"line": 22,
"column": 22
},
"identifierName": "_owner"
},
"name": "_owner"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {EntitySystem|null} ",
"start": 589,
"end": 621,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 34
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {string|null} ",
"start": 669,
"end": 695,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 28
}
}
}
]
},
{
"type": "ClassMethod",
"start": 698,
"end": 737,
"loc": {
"start": {
"line": 26,
"column": 2
},
"end": {
"line": 28,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 702,
"end": 706,
"loc": {
"start": {
"line": 26,
"column": 6
},
"end": {
"line": 26,
"column": 10
},
"identifierName": "name"
},
"name": "name"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 709,
"end": 737,
"loc": {
"start": {
"line": 26,
"column": 13
},
"end": {
"line": 28,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 715,
"end": 733,
"loc": {
"start": {
"line": 27,
"column": 4
},
"end": {
"line": 27,
"column": 22
}
},
"argument": {
"type": "MemberExpression",
"start": 722,
"end": 732,
"loc": {
"start": {
"line": 27,
"column": 11
},
"end": {
"line": 27,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 722,
"end": 726,
"loc": {
"start": {
"line": 27,
"column": 11
},
"end": {
"line": 27,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 727,
"end": 732,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 21
},
"identifierName": "_name"
},
"name": "_name"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {string|null} ",
"start": 669,
"end": 695,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 28
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {string|null} ",
"start": 741,
"end": 767,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 30,
"column": 28
}
}
}
]
},
{
"type": "ClassMethod",
"start": 770,
"end": 932,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 37,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 774,
"end": 778,
"loc": {
"start": {
"line": 31,
"column": 6
},
"end": {
"line": 31,
"column": 10
},
"identifierName": "name"
},
"name": "name"
},
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 779,
"end": 784,
"loc": {
"start": {
"line": 31,
"column": 11
},
"end": {
"line": 31,
"column": 16
},
"identifierName": "value"
},
"name": "value"
}
],
"body": {
"type": "BlockStatement",
"start": 786,
"end": 932,
"loc": {
"start": {
"line": 31,
"column": 18
},
"end": {
"line": 37,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 792,
"end": 897,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 34,
"column": 5
}
},
"test": {
"type": "LogicalExpression",
"start": 796,
"end": 831,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 43
}
},
"left": {
"type": "UnaryExpression",
"start": 796,
"end": 803,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 15
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "UnaryExpression",
"start": 797,
"end": 803,
"loc": {
"start": {
"line": 32,
"column": 9
},
"end": {
"line": 32,
"column": 15
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 798,
"end": 803,
"loc": {
"start": {
"line": 32,
"column": 10
},
"end": {
"line": 32,
"column": 15
},
"identifierName": "value"
},
"name": "value"
},
"extra": {
"parenthesizedArgument": false
}
},
"extra": {
"parenthesizedArgument": false
}
},
"operator": "&&",
"right": {
"type": "BinaryExpression",
"start": 807,
"end": 831,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 43
}
},
"left": {
"type": "UnaryExpression",
"start": 807,
"end": 819,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 31
}
},
"operator": "typeof",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 814,
"end": 819,
"loc": {
"start": {
"line": 32,
"column": 26
},
"end": {
"line": 32,
"column": 31
},
"identifierName": "value"
},
"name": "value"
},
"extra": {
"parenthesizedArgument": false
}
},
"operator": "!=",
"right": {
"type": "StringLiteral",
"start": 823,
"end": 831,
"loc": {
"start": {
"line": 32,
"column": 35
},
"end": {
"line": 32,
"column": 43
}
},
"extra": {
"rawValue": "string",
"raw": "'string'"
},
"value": "string"
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 833,
"end": 897,
"loc": {
"start": {
"line": 32,
"column": 45
},
"end": {
"line": 34,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 841,
"end": 891,
"loc": {
"start": {
"line": 33,
"column": 6
},
"end": {
"line": 33,
"column": 56
}
},
"argument": {
"type": "NewExpression",
"start": 847,
"end": 890,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 55
}
},
"callee": {
"type": "Identifier",
"start": 851,
"end": 856,
"loc": {
"start": {
"line": 33,
"column": 16
},
"end": {
"line": 33,
"column": 21
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 857,
"end": 889,
"loc": {
"start": {
"line": 33,
"column": 22
},
"end": {
"line": 33,
"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": 903,
"end": 928,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 903,
"end": 927,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 903,
"end": 913,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 903,
"end": 907,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 908,
"end": 913,
"loc": {
"start": {
"line": 36,
"column": 9
},
"end": {
"line": 36,
"column": 14
},
"identifierName": "_name"
},
"name": "_name"
},
"computed": false
},
"right": {
"type": "LogicalExpression",
"start": 916,
"end": 927,
"loc": {
"start": {
"line": 36,
"column": 17
},
"end": {
"line": 36,
"column": 28
}
},
"left": {
"type": "Identifier",
"start": 916,
"end": 921,
"loc": {
"start": {
"line": 36,
"column": 17
},
"end": {
"line": 36,
"column": 22
},
"identifierName": "value"
},
"name": "value"
},
"operator": "||",
"right": {
"type": "StringLiteral",
"start": 925,
"end": 927,
"loc": {
"start": {
"line": 36,
"column": 26
},
"end": {
"line": 36,
"column": 28
}
},
"extra": {
"rawValue": "",
"raw": "''"
},
"value": ""
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {string|null} ",
"start": 741,
"end": 767,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 30,
"column": 28
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {string|null} ",
"start": 936,
"end": 962,
"loc": {
"start": {
"line": 39,
"column": 2
},
"end": {
"line": 39,
"column": 28
}
}
}
]
},
{
"type": "ClassMethod",
"start": 965,
"end": 1002,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 42,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 969,
"end": 972,
"loc": {
"start": {
"line": 40,
"column": 6
},
"end": {
"line": 40,
"column": 9
},
"identifierName": "tag"
},
"name":