Skip to content

Commit 0172f36

Browse files
committed
smaller fixes
1 parent 388cdb0 commit 0172f36

File tree

6 files changed

+47
-18
lines changed

6 files changed

+47
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ I love the game Factorio and I really like the look of factories after growing f
77

88
All factorio buildings and tiles with their bounding boxes and belt, pipe, rail, inserter, wire and electricity connections can be visualized. Everything is drawn in vector graphics (SVG) to be able to view it in any resolution.
99

10-
Use the [online demo](https://piebro.github.io/factorio-blueprint-visualizer/) to visualize your own blueprints. With the latest update, Blueprints from Factorio before version 2.0 might not work correctly.
10+
Use the [online demo](https://piebro.github.io/factorio-blueprint-visualizer/) to visualize your own blueprints. With the latest update, Blueprints from Factorio before version 2.0 might not work correctly. You can import older blueprints to factorio and export them again to update them.
1111

1212
## Examples
1313

blueprintVisualizer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ function getCurrentBlueprintEntityCount(currentBlueprint){
155155
for (const entity of currentBlueprint.entities) {
156156
entityCount[entity.name] = (entityCount[entity.name] || 0) + 1;
157157
}
158+
for (const tile of currentBlueprint.tiles || []) {
159+
entityCount[tile.name] = (entityCount[tile.name] || 0) + 1;
160+
}
158161
return Object.entries(entityCount).sort((a, b) => b[1] - a[1]);
159162
}
160163

drawingSettings.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
const EXAMPLE_SETTINGS = [
22
["how to use: https://github.com/piebro/factorio-blueprint-visualizer/blob/master/draw_setting_documentation.md"],
33
["default settings", {'background': '#a2aebb', 'fill': 'none', 'fill-opacity': 1, 'stroke': 'none', 'stroke-linecap': 'round', 'stroke-width': 0.3, 'stroke-opacity': 1, 'scale': 0.85, 'rx': 0.1, 'ry': 0.1}],
4-
["tiles", {'fill': '#420217', 'stroke': '#f3ffbd', 'stroke-width': 0.15, 'deny': [], 'scale': 0.7}],
4+
["tiles", {'fill': '#420217', 'stroke': '#f3ffbd', 'stroke-width': 0.15, 'deny': [], 'scale': 0.65}],
55

66
["pipes", {'stroke': '#c84c09'}],
77
["underground-pipes", {'stroke': '#c84c09'}],
88
["belts", {'stroke': '#f3ffbd'}],
99
["underground-belts", {'stroke': '#f3ffbd'}],
1010
["inserters", {'stroke': '#f3ffbd'}],
1111

12-
["bbox", {'fill': '#247ba0', 'deny': ["pipe", "pipe-to-ground", "belts", "inserters", "solar-panel", "accumulator", "asteroid-collector", "cargo-bay", "space-platform-hub", "thruster"]}],
12+
["bbox", {'fill': '#247ba0', 'deny': ["pipe", "pipe-to-ground", "belts", "inserters", "solar-panel", "accumulator", "asteroid-collector", "cargo-bay", "space-platform-hub", "thruster", "rails"]}],
1313
["bbox", {'fill': '#ff1654', 'allow': ["solar-panel"]}],
1414
["bbox", {'fill': '#436436', 'allow': ["accumulator"]}],
1515
["bbox", {'fill': '#70c1b3', 'allow': ["cargo-bay"]}],
16-
["bbox", {'fill': '#b2dbbf', 'allow': ["asteroid-collector", "thruster", "space-platform-hub"]}],
16+
["bbox", {'fill': '#b2dbbf', 'allow': ["asteroid-collector", "thruster"]}],
17+
["bbox", {'fill': '#b2dbbf', 'allow': ["space-platform-hub"], "scale": 0.95}],
18+
19+
["rails", {'stroke': '#c84c09'}],
20+
["heat-pipes", {'stroke': '#c84c09'}],
21+
["power-lines", {'stroke': '#f3ffbd'}],
1722

18-
["heat-pipes", {'stroke': '#b2dbbf'}],
19-
["power-lines", {'stroke': '#70c1b3'}],
20-
["rails", {'stroke': '#faa275'}],
2123
]
2224

2325
const PREDEFINED_COLOR_PALETTES = [

entityProperties.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ const buildingGenericTerms = {
167167
"power-generation": ["boiler", "steam-engine", "solar-panel", "nuclear-reactor", "fusion-generator", "fusion-reactor", "steam-turbine"],
168168
"production": ["accumulator", "agricultural-tower", "assembling-machine-1", "assembling-machine-2", "assembling-machine-3", "beacon", "big-mining-drill", "biochamber", "biolab", "boiler", "burner-mining-drill", "captive-biter-spawner", "centrifuge", "chemical-plant", "cryogenic-plant", "electric-furnace", "electric-mining-drill", "electromagnetic-plant", "foundry", "fusion-generator", "fusion-reactor", "heat-exchanger", "heat-pipe", "heating-tower", "lab", "lightning-collector", "lightning-rod", "nuclear-reactor", "offshore-pump", "oil-refinery", "pumpjack", "recycler", "solar-panel", "steam-engine", "steam-turbine", "steel-furnace", "stone-furnace"],
169169
"production-machine": ["assembling-machine-1", "assembling-machine-2", "assembling-machine-3", "biolab", "centrifuge", "chemical-plant", "cryogenic-plant", "electromagnetic-plant", "lab", "oil-refinery"],
170+
"rails": ["curved-rail-a", "curved-rail-b", "elevated-curved-rail-a", "elevated-curved-rail-b", "elevated-half-diagonal-rail", "elevated-straight-rail", "half-diagonal-rail", "rail-chain-signal", "rail-ramp", "rail-signal", "rail-support", "straight-rail", "train-stop"],
170171
"robotic-logistics": ["roboport", "active-provider-chest", "buffer-chest", "passive-provider-chest", "requester-chest", "storage-chest"],
171172
"smelting-machine": ["electric-furnace", "foundry", "recycler", "steel-furnace", "stone-furnace"],
172173
"space": ["asteroid-collector", "cargo-bay", "cargo-landing-pad", "crusher", "rocket-silo", "space-platform-hub", "thruster"],
173174
"space-interactors": ["cargo-landing-pad", "rocket-silo"],
174175
"space-platform": ["asteroid-collector", "cargo-bay", "crusher", "thruster"],
175176
"space-related": ["space-platform-hub"],
176177
"storage": ["iron-chest", "steel-chest", "storage-tank", "wooden-chest"],
177-
"train-transport": ["curved-rail-a", "curved-rail-b", "elevated-curved-rail-a", "elevated-curved-rail-b", "elevated-half-diagonal-rail", "elevated-straight-rail", "half-diagonal-rail", "rail-chain-signal", "rail-ramp", "rail-signal", "rail-support", "straight-rail", "train-stop"],
178178
"turret": ["artillery-turret", "flamethrower-turret", "gun-turret", "laser-turret", "railgun-turret", "rocket-turret", "tesla-turret"],
179179
}
180180

@@ -323,10 +323,21 @@ const artificialTilesSortedByLayer = [
323323
"foundation",
324324
"stone-path",
325325
"concrete",
326+
"frozen-concrete",
326327
"hazard-concrete-left",
327328
"hazard-concrete-right",
328329
"space-platform-foundation",
330+
"frozen-hazard-concrete-left",
331+
"frozen-hazard-concrete-right",
329332
"refined-concrete",
333+
"frozen-refined-concrete",
330334
"refined-hazard-concrete-left",
331335
"refined-hazard-concrete-right",
336+
"frozen-refined-hazard-concrete-left",
337+
"frozen-refined-hazard-concrete-right",
338+
"ice-platform",
339+
"artificial-yumako-soil",
340+
"artificial-jellynut-soil",
341+
"overgrowth-yumako-soil",
342+
"overgrowth-jellynut-soil",
332343
]

index.html

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,27 @@
5454
const isInCodeMirror = event.target.closest('.CodeMirror');
5555
if (isInCodeMirror) return;
5656

57-
if (event.key === 'ArrowLeft') {
58-
previousSetting();
59-
} else if (event.key === 'ArrowRight') {
60-
nextSetting();
57+
switch(event.key) {
58+
case 'ArrowLeft':
59+
previousSetting();
60+
break;
61+
case 'ArrowRight':
62+
nextSetting();
63+
break;
64+
case 'ArrowUp':
65+
const selectUp = document.getElementById('blueprintSelection');
66+
if (selectUp.selectedIndex > 0) {
67+
selectUp.selectedIndex--;
68+
blueprintSelectionOnChange(selectUp);
69+
}
70+
break;
71+
case 'ArrowDown':
72+
const selectDown = document.getElementById('blueprintSelection');
73+
if (selectDown.selectedIndex < selectDown.options.length - 1) {
74+
selectDown.selectedIndex++;
75+
blueprintSelectionOnChange(selectDown);
76+
}
77+
break;
6178
}
6279
});
6380

scripts/get_items.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
CUSTOM_RENAME_GENERIC_TERMS = {
3737
"inserter": "inserters", # because inserter is also already an item name
3838
"belt": "belts",
39+
"train-transport": "rails"
3940
}
4041

4142

@@ -170,18 +171,13 @@ def get_tile_layers(factorio_json):
170171
for tile_name, tile_data in factorio_json["tile"].items():
171172
if tile_name == "landfill":
172173
tiles.append((tile_name, -1))
173-
elif (
174-
"subgroup" in tile_data
175-
and tile_data["subgroup"] == "artificial-tiles"
176-
and "layer" in tile_data
177-
):
174+
elif "minable" in tile_data:
178175
tiles.append((tile_name, tile_data["layer"]))
179176

180177
# Sort by layer number ascending
181178
tiles.sort(key=lambda x: x[1])
182179
return [name for name, _ in tiles]
183180

184-
185181
def generate_js_output(sorted_items, pipe_positions, heat_positions, fluid_recipes, tile_layers):
186182
"""Generate JavaScript output strings."""
187183
js_output = ["// This file is generated by get_items.py\n"]

0 commit comments

Comments
 (0)