@woosh/meep-engine 2.46.16 → 2.46.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"productName": "Meep",
|
|
5
5
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
6
6
|
"author": "Alexander Goldring",
|
|
7
|
-
"version": "2.46.
|
|
7
|
+
"version": "2.46.18",
|
|
8
8
|
"main": "build/meep.module.js",
|
|
9
9
|
"module": "build/meep.module.js",
|
|
10
10
|
"scripts": {
|
|
@@ -131,8 +131,7 @@ export class NodeGraph {
|
|
|
131
131
|
const previous_node_count = this.nodes.length;
|
|
132
132
|
const previous_connection_count = this.connections.length;
|
|
133
133
|
|
|
134
|
-
const
|
|
135
|
-
const additional_node_count = other_nodes.length;
|
|
134
|
+
const additional_node_count = nodes.length;
|
|
136
135
|
|
|
137
136
|
/**
|
|
138
137
|
* Mapping from original IDs to IDs in this graph
|
|
@@ -141,26 +140,25 @@ export class NodeGraph {
|
|
|
141
140
|
const this_nodes = {};
|
|
142
141
|
|
|
143
142
|
for (let i = 0; i < additional_node_count; i++) {
|
|
144
|
-
const other_node =
|
|
143
|
+
const other_node = nodes[i];
|
|
145
144
|
this_nodes[other_node.id] = this.createNode(other_node.description);
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
// create connections
|
|
149
|
-
const
|
|
150
|
-
const additional_connection_count = other_connections.length;
|
|
148
|
+
const additional_connection_count = connections.length;
|
|
151
149
|
|
|
152
150
|
for (let i = 0; i < additional_connection_count; i++) {
|
|
153
|
-
const other_connection =
|
|
151
|
+
const other_connection = connections[i];
|
|
154
152
|
|
|
155
153
|
const other_source = other_connection.source;
|
|
156
154
|
|
|
157
155
|
const this_source_node_id = this_nodes[other_source.instance.id];
|
|
158
|
-
const this_source_port_id =
|
|
156
|
+
const this_source_port_id = other_source.port.id;
|
|
159
157
|
|
|
160
158
|
const other_target = other_connection.target;
|
|
161
159
|
|
|
162
160
|
const this_target_node_id = this_nodes[other_target.instance.id];
|
|
163
|
-
const this_target_port_id =
|
|
161
|
+
const this_target_port_id = other_target.port.id;
|
|
164
162
|
|
|
165
163
|
this.createConnection(
|
|
166
164
|
this_source_node_id, this_source_port_id,
|
|
@@ -328,7 +326,7 @@ export class NodeGraph {
|
|
|
328
326
|
const n = connections.length;
|
|
329
327
|
|
|
330
328
|
for (let i = 0; i < n; i++) {
|
|
331
|
-
const connection = connections
|
|
329
|
+
const connection = connections.get(i);
|
|
332
330
|
|
|
333
331
|
if (connection.id === id) {
|
|
334
332
|
return connection;
|
|
@@ -572,6 +570,11 @@ export class NodeGraph {
|
|
|
572
570
|
* @returns {number} number of found connections
|
|
573
571
|
*/
|
|
574
572
|
getConnectionsAttachedToNode(id, result) {
|
|
573
|
+
assert.isNonNegativeInteger(id, 'id');
|
|
574
|
+
|
|
575
|
+
assert.defined(result, 'result');
|
|
576
|
+
assert.isArray(result, 'result');
|
|
577
|
+
|
|
575
578
|
let count = 0;
|
|
576
579
|
|
|
577
580
|
const connections = this.connections;
|
|
@@ -51,6 +51,29 @@ test("createConnection populates NodeInstance.connections", () => {
|
|
|
51
51
|
expect(g.getNode(i1).connections.length).toBe(1);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
test("getConnection", () => {
|
|
55
|
+
|
|
56
|
+
const g = new NodeGraph();
|
|
57
|
+
|
|
58
|
+
const node = new NodeDescription();
|
|
59
|
+
|
|
60
|
+
const dt = new DataType();
|
|
61
|
+
|
|
62
|
+
const pInt = node.createPort(dt, "in", PortDirection.In);
|
|
63
|
+
const pOut = node.createPort(dt, "out", PortDirection.Out);
|
|
64
|
+
|
|
65
|
+
const i0 = g.createNode(node);
|
|
66
|
+
const i1 = g.createNode(node);
|
|
67
|
+
|
|
68
|
+
const connectionId = g.createConnection(i0, pOut, i1, pInt);
|
|
69
|
+
|
|
70
|
+
const connection = g.getConnection(connectionId);
|
|
71
|
+
|
|
72
|
+
expect(connection).toBeDefined();
|
|
73
|
+
expect(connection.id).toBe(connectionId);
|
|
74
|
+
|
|
75
|
+
});
|
|
76
|
+
|
|
54
77
|
test('getNode produces correct result', () => {
|
|
55
78
|
const graph = new NodeGraph();
|
|
56
79
|
|