Initial split of nukage tools into own repo
This commit is contained in:
35
edit.py
Normal file
35
edit.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
BUILDER = "Builder"
|
||||
GAME_CFG = "GZDoom_DoomUDMF.cfg"
|
||||
IPK3 = "nukage.ipk3"
|
||||
RESOURCES = [".", "graphics"]
|
||||
|
||||
def edit(map, resources=[]):
|
||||
command = [BUILDER, os.path.join(f"maps", f"{map}.wad"), "-map", map, "-cfg", GAME_CFG]
|
||||
for resource in resources:
|
||||
command.append("-resource")
|
||||
extension = os.path.splitext(resource)[1]
|
||||
if os.path.isdir(resource):
|
||||
command.append("dir")
|
||||
elif extension == ".pk3" or extension == ".ipk3":
|
||||
command.append("pk3")
|
||||
command.append(resource)
|
||||
|
||||
print(command)
|
||||
subprocess.call(command)
|
||||
|
||||
if __name__ == "__main__":
|
||||
MAP = sys.argv[1]
|
||||
resources = list(RESOURCES)
|
||||
|
||||
if os.path.isfile(IPK3):
|
||||
resources.insert(0, os.path.abspath(IPK3))
|
||||
|
||||
if os.path.isfile(MAP):
|
||||
MAP = os.path.splitext(os.path.basename(MAP))[0]
|
||||
|
||||
edit(MAP, resources)
|
||||
Reference in New Issue
Block a user