Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
L0laapk3 committed Jun 18, 2019
2 parents 84157cc + 18d25d7 commit 06efafb
Show file tree
Hide file tree
Showing 13 changed files with 805 additions and 722 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
__pycache__
L0laapk3_FactorioMaps_*.zip
autorun.lua
web/
web/lib/
4 changes: 3 additions & 1 deletion API_ExampleMod_0.0.1/factoriomaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

local function handle_factoriomaps()
if remote.interfaces.factoriomaps then
script.on_event(remote.call("factoriomaps", "get_start_event"), function()
script.on_event(remote.call("factoriomaps", "get_start_capture_event"), function()

-- note that this event only gets called when it starts capturing the world, so speed optimalisation of the code in this function is not important.


-- example parameters:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Live demo: https://factoriomaps.com/beta/user/L0laapk3/megabase/index.html
Mod portal link: https://mods.factorio.com/mod/L0laapk3_FactorioMaps

# How to Install
**Note that since version 3, this program now runs on python 3 instead of python 2.**
**Note that since version 3, this program now only runs on python version 3.6 or higher instead of python 2.**
1. Download FactorioMaps to `%appdata%\mods\`, either from the [mod portal](https://mods.factorio.com/mod/L0laapk3_FactorioMaps) (The mod does not need to be enabled to work) and then unzipping it, or [downloading the git repo](https://github.com/L0laapk3/FactorioMaps/releases).
1. Install the latest version of [python 3.7](https://www.python.org/downloads/). (Do not install python 2.)
1. Recommended: [Add python to your environment variables](https://stackoverflow.com/a/4855685/3185280).
Expand Down
2 changes: 1 addition & 1 deletion api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end


remote.add_interface("factoriomaps", {
get_start_event = function()
get_start_capture_event = function()
return fm.API.startEvent
end,
link_box_point = function(options)
Expand Down
16 changes: 9 additions & 7 deletions auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@ def kill(pid, onlyStall=False):
if not onlyStall and psutil.pid_exists(pid):

if os.name == 'nt':
cmd = ("taskkill", "/pid", str(pid))
subprocess.check_call(("taskkill", "/pid", str(pid)), stdout=subprocess.DEVNULL, shell=True)
else:
cmd = ("kill", str(pid))
subprocess.check_call(cmd, stdout=subprocess.DEVNULL, shell=True)
subprocess.check_call(("killall", "factorio"), stdout=subprocess.DEVNULL) # TODO: kill correct process instead of just killing all

while psutil.pid_exists(pid):
time.sleep(0.1)
Expand Down Expand Up @@ -289,7 +288,7 @@ def parseArg(arg):
sys.exit(1)(1)


except urllib.error.URLError as e:
except (urllib.error.URLError, urllib.socket.timeout) as e:
print("Failed to check for updates. %s: %s" % (type(e).__name__, e))


Expand Down Expand Up @@ -521,10 +520,11 @@ def waitKill(isKilled, pid):


def refZoom():
needsThumbnail = index + 1 == len(savenames)
#print("Crossreferencing %s images" % screenshot)
ref(outFolder, otherInputs[0], otherInputs[1], otherInputs[2], basepath, **kwargs)
#print("downsampling %s images" % screenshot)
zoom(outFolder, otherInputs[0], otherInputs[1], otherInputs[2], basepath, **kwargs)
zoom(outFolder, otherInputs[0], otherInputs[1], otherInputs[2], basepath, needsThumbnail, **kwargs)

if screenshot != latest[-1]:
refZoom()
Expand Down Expand Up @@ -653,12 +653,14 @@ def refZoom():


print("creating index.html")
copy("index.html.template", os.path.join(workfolder, "index.html"))
copy("web/index.html", os.path.join(workfolder, "index.html"))
copy("web/index.css", os.path.join(workfolder, "index.css"))
copy("web/index.js", os.path.join(workfolder, "index.js"))
try:
rmtree(os.path.join(workfolder, "lib"))
except (FileNotFoundError, NotADirectoryError):
pass
copytree("web", os.path.join(workfolder, "lib"))
copytree("web/lib", os.path.join(workfolder, "lib"))



Expand Down
Loading

0 comments on commit 06efafb

Please sign in to comment.