Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 54 lines (41 sloc) 1.5 KB
#!/usr/bin/python3
# Decription
# ----------
# Script to run gzdoom with various configurations/wads. Selectable via dmenu
# Author: [Dmitry](http://dmi3.net) [Source](https://github.com/dmi3/bin)
# Requirements
# ------------
# 1. [Get latest Gzdoom](http://debian.drdteam.org/)
# 2. `sudo apt-get install gzdoom dmenu python3 python3-setuptools
# 3. `sudo easy_install3 sh`
# Usage
# -----
# doom
MAP_DIR = "/media/archive/games/doom/wads/maps/"
MOD_DIR = "/media/archive/games/doom/wads/mods/"
DOOM_BIN = "/usr/bin/gzdoom"
MODS = {
"vanilla":"",
"russian_overkill":"hires.pk3 bdlitev13gzdoomV2.pk3 RO_pb_2.1b.pk3 Moldova_pb_v1.1.pk3 regeneration2.wad",
"brutal_doom":"hires.pk3 brutalv20b.pk3 BrutalBloodPatch20b.pk3 regeneration2.wad Cannon_Shotgun_v4.wad",
}
PARAMS = "+set sv_jump 2 +set sv_crouch 2 +set sv_cheats 1" # need sv_cheats to `give cannonshotgun`
TIMELIMIT_MIN=15 #set 0 to play infinitely!
from sh import ls,dmenu,echo,touch,kill,notify_send,Command
from time import sleep
from os import path
doom = Command(DOOM_BIN)
mod=dmenu(echo("\n".join(MODS.keys())))
mods=MOD_DIR+MODS[str(mod).strip()].replace(" "," "+MOD_DIR)
wad=MAP_DIR+str(dmenu(ls(MAP_DIR,"-1","-t"))).strip()
cmd=PARAMS+" -file "+mods+" "+wad
touch(wad) #because we sort by last modified = first in menu
args = cmd.split(" ")
print(args)
pid=doom(*args, _bg=True).pid
if TIMELIMIT_MIN>0:
sleep(TIMELIMIT_MIN*60)
if path.isdir("/proc/"+str(pid)):
notify_send("You have 10 seconds to save!")
sleep(10)
kill(pid)