Skip to content

Commit

Permalink
Added support for mozjpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
L0laapk3 committed Oct 30, 2018
1 parent b04226d commit 8f26740
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 160 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -29,7 +29,8 @@ Mod portal link: https://mods.factorio.com/mod/L0laapk3_FactorioMaps
1. An `index.html` will be created in `%appdata%\Factorio\script-output\FactorioMaps\mapName`. Enjoy!

# Configuration
You can change a few settings, such as the max range from buildings where pictures are generated, can be changed in `autorun.template.lua`.
You can change a few settings, such as the max range from buildings where pictures are generated, and HD mode, can be changed in `autorun.template.lua`.
Image quality settings can be changed in the top of `zoom.py`.

# Hosting this on a server
If you wish to host your map for other people to a server, you need to take into account the following considerations: (You can change these once in `index.html.template` and they will be used for all future snapshots.)
Expand Down
2 changes: 2 additions & 0 deletions autorun.template.lua
Expand Up @@ -4,6 +4,8 @@ fm.autorun = {
around_smaller_range = 1.2, -- same as above, but smaller range for the following entity types:
smaller_types = {"lamp", "electric-pole", "radar", "straight-rail", "curved-rail", "rail-signal", "rail-chain-signal", "locomotive", "cargo-wagon", "fluid-wagon", "car"},
date = "%%DATE%%",


name = "%%NAME%%", -- changing this is currently not supported
day = true, -- changing this is currently not supported
night = true, -- changing this is currently not supported
Expand Down
Binary file added cjpeg.exe
Binary file not shown.
43 changes: 25 additions & 18 deletions index.html.template
Expand Up @@ -301,24 +301,26 @@

layers[i] = {};
["day", "night"].forEach(function(daytime) {
var LLayer = L.tileLayer(undefined, {
id: layer.path,
attribution: '<a href="https://github.com/L0laapk3/FactorioMods_FactorioMaps">FactorioMaps</a>',
minNativeZoom: layer.zoom.min,
maxNativeZoom: layer.zoom.max,
minZoom: layer.zoom.min >= 3 ? layer.zoom.min - 3 : 1,
maxZoom: layer.zoom.max + 2,
noWrap: true,
tileSize: 512 / window.devicePixelRatio,
keepBuffer: 3
});
LLayer.surface = surface;
LLayer.daytime = daytime;
LLayer.path = map.path;
LLayer.tileIndex = daytime == "day" ? tileIndex : tileNightIndex;


layers[i][daytime] = LLayer;
if (layer[daytime] == "true") {
var LLayer = L.tileLayer(undefined, {
id: layer.path,
attribution: '<a href="https://github.com/L0laapk3/FactorioMods_FactorioMaps">FactorioMaps</a>',
minNativeZoom: layer.zoom.min,
maxNativeZoom: layer.zoom.max,
minZoom: layer.zoom.min >= 3 ? layer.zoom.min - 3 : 1,
maxZoom: 23, //layer.zoom.max + 2,
noWrap: true,
tileSize: 512 / window.devicePixelRatio,
keepBuffer: 3
});
LLayer.surface = surface;
LLayer.daytime = daytime;
LLayer.path = map.path;
LLayer.tileIndex = daytime == "day" ? tileIndex : tileNightIndex;


layers[i][daytime] = LLayer;
}
});


Expand Down Expand Up @@ -435,6 +437,7 @@


var opacitySlider, timeSlider;
var mapLoadedBySlider = false;
if (layers.some(function(layer) { return layer.day; }) && layers.some(function(layer) { return layer.night; })) {
//L.control.layers({Day: layers.Day}, {Night: layers.Night}, { collapsed: m.meta.map.options.collapseLayerList }).addTo(map).setPosition('bottomright');
opacitySlider = new L.Control.opacitySlider({
Expand All @@ -450,6 +453,7 @@
}
});
map.addControl(opacitySlider);
mapLoadedBySlider = true;
}
if (layers.length > 1 && true) {
var min = Math.min.apply(undefined, mapInfo.maps.map(l => parseInt(l.path)));
Expand Down Expand Up @@ -507,7 +511,10 @@
}
});
map.addControl(timeSlider);
mapLoadedBySlider = true;
}
if (!mapLoadedBySlider)
map.addLayer(layers[0].day || layers[0].night);
map.addControl(new L.Control.FullScreen().setPosition('bottomright'));
map.zoomControl.setPosition('bottomleft')
/*if (m.meta.map.markers !== null && m.meta.map.markers !== undefined) {
Expand Down

0 comments on commit 8f26740

Please sign in to comment.