Add "run it back" command to continue a practice run after failing a demo.
This commit is contained in:
parent
6aaa3ea15f
commit
7925281ceb
3 changed files with 48 additions and 2 deletions
|
@ -92,7 +92,7 @@ class WadMap(Wad):
|
||||||
def name_string(self):
|
def name_string(self):
|
||||||
return "" if self._name is None else "_" + self._name
|
return "" if self._name is None else "_" + self._name
|
||||||
|
|
||||||
def dsda_preamble(self):
|
def dsda_preamble(self, warp=True):
|
||||||
args = ["-iwad", self.iwad_path]
|
args = ["-iwad", self.iwad_path]
|
||||||
|
|
||||||
wads = self.load_order()
|
wads = self.load_order()
|
||||||
|
@ -105,6 +105,7 @@ class WadMap(Wad):
|
||||||
|
|
||||||
args = args + ["-complevel", str(self.complevel())]
|
args = args + ["-complevel", str(self.complevel())]
|
||||||
args = args + ["-skill", "4"]
|
args = args + ["-skill", "4"]
|
||||||
|
if warp:
|
||||||
args = args + ["-warp", self.map]
|
args = args + ["-warp", self.map]
|
||||||
args = args + self.options()
|
args = args + self.options()
|
||||||
return args
|
return args
|
||||||
|
|
44
dcc/rib.py
Normal file
44
dcc/rib.py
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import dcc.doom_base
|
||||||
|
import pathlib
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
class RIB(dcc.doom_base.WadMap):
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super().get_parser(prog_name)
|
||||||
|
parser.add_argument("-s", "--secs_before", default=10)
|
||||||
|
return parser
|
||||||
|
|
||||||
|
# TODO: the root path should probably be configurable.
|
||||||
|
def take_action(self, parsed_args):
|
||||||
|
demo = ""
|
||||||
|
dt = 0
|
||||||
|
demodir = (
|
||||||
|
pathlib.Path.home() /
|
||||||
|
".dsda-doom" /
|
||||||
|
"dsda_doom_data" /
|
||||||
|
self.iwad_path.stem.lower()
|
||||||
|
)
|
||||||
|
for w in self.load_order():
|
||||||
|
demodir = demodir.joinpath(w.stem.lower())
|
||||||
|
demodir = demodir / "failed_demos"
|
||||||
|
|
||||||
|
for f in demodir.glob(f"*map{self.map}*", case_sensitive=False):
|
||||||
|
st = os.stat(f)
|
||||||
|
if st.st_mtime > dt:
|
||||||
|
demo = f
|
||||||
|
dt = st.st_mtime
|
||||||
|
|
||||||
|
if demo == "":
|
||||||
|
raise Exception(
|
||||||
|
f"no failed demos found for wad {parsed_args.wad} "
|
||||||
|
+ f"and map {parsed_args.map} (tried to look in {demodir})"
|
||||||
|
)
|
||||||
|
|
||||||
|
subprocess.run(
|
||||||
|
[self.dsda] + self.dsda_preamble(warp=False)
|
||||||
|
+ ["-playdemo", demo]
|
||||||
|
+ ["-skiptic", str(-35 * parsed_args.secs_before)]
|
||||||
|
)
|
1
setup.py
1
setup.py
|
@ -23,6 +23,7 @@ setup(
|
||||||
'dcc': [
|
'dcc': [
|
||||||
'play = dcc.play:Play',
|
'play = dcc.play:Play',
|
||||||
'record = dcc.record:Record',
|
'record = dcc.record:Record',
|
||||||
|
'rib = dcc.rib:RIB',
|
||||||
'fabricate = dcc.fabricate:Fabricate',
|
'fabricate = dcc.fabricate:Fabricate',
|
||||||
'put = dcc.put:Put',
|
'put = dcc.put:Put',
|
||||||
'pb = dcc.pb:PB',
|
'pb = dcc.pb:PB',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue