From d10b4f9205001ca91f229867b3d1e84dd2fb30d3 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 29 Dec 2020 20:50:25 -0800 Subject: [PATCH] Enable updating the inquisitor source --- inquisitor/sources.py | 9 +++++++++ sources/triggerdemo.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/inquisitor/sources.py b/inquisitor/sources.py index 0b48f1c..dd45f7a 100644 --- a/inquisitor/sources.py +++ b/inquisitor/sources.py @@ -22,6 +22,12 @@ USE_NEWEST = ( ) +class InquisitorStubSource: + """A dummy source-like object for clearing out ad-hoc inquisitor items""" + def fetch_new(self, state): + return [] + + def ensure_cell(name): """ Creates a cell in the dungeon. Idempotent. @@ -74,6 +80,9 @@ def load_source(source_name): Attempts to load the source module with the given name. Raises an exception on failure. """ + if source_name == 'inquisitor': + return InquisitorStubSource() + cwd = os.getcwd() try: # Push the sources directory. diff --git a/sources/triggerdemo.py b/sources/triggerdemo.py index 17683e7..2aa8d5c 100644 --- a/sources/triggerdemo.py +++ b/sources/triggerdemo.py @@ -25,7 +25,7 @@ def on_create(state, item): with open('dungeon/inquisitor/triggerdemo_create.item', 'w') as f: json.dump({ 'source': 'inquisitor', - 'id': 'triggerdemo_create.item', + 'id': 'triggerdemo_create', 'title': 'Trigger demo on_create item', 'active': True, }, f) @@ -35,7 +35,7 @@ def on_delete(state, item): with open('dungeon/inquisitor/triggerdemo_delete.item', 'w') as f: json.dump({ 'source': 'inquisitor', - 'id': 'triggerdemo_delete.item', + 'id': 'triggerdemo_delete', 'title': 'Trigger demo on_delete item', 'active': True, }, f)