-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfactoratio.js
More file actions
64 lines (48 loc) · 1.26 KB
/
factoratio.js
File metadata and controls
64 lines (48 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Created by synopia on 03/07/14.
*/
function Factory(type, obj, count) {
this.type = type;
this.obj = obj;
this.count = count || 0;
switch (type) {
case "factory": this.collection = factories; break;
case "inserter": this.collection = inserters; break;
default : this.collection = {}; break;
}
if( obj ) {
this.factory = this.collection[obj];
} else {
this.factory = null;
}
}
Factory.prototype = {
};
function ProductionLine(id, item) {
this.id = id;
this.item = item;
this.recipe = recipes[item];
this.name = this.recipe.name;
this.factory = new Factory("factory", null);
this.inputInserters = new Factory("inserter", null);
this.outputInserters = new Factory("inserter", null);
this.dirty = true;
this.locked = [];
}
ProductionLine.prototype = {
update : function() {
if( !this.dirty ) {
return;
}
this.dirty = false;
}
};
function Factoratio() {
this.tree = $$("recipe_tree");
this.store = this.tree.data;
}
Factoratio.prototype = {
addRecipe : function( recipe ) {
this.store.add( new ProductionLine("1", recipe));
}
};