Skip to content

Commit

Permalink
✨ [S/C/Thorax] Load custom setup scripts by JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
alicerunsonfedora committed Feb 13, 2021
1 parent fd44faf commit 88f3be3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions game/System/CoreServices/Thorax.aoscservice/Thorax.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ init python:
return results

def launch(self, steps=None):
procedure = steps if steps is not None else self.default_steps
clog.debug(steps)
if steps and type(steps) is str:
procedure = self.__create_steps(steps)
elif steps and type(steps) is list:
procedure = steps
else:
procedure = self.default_steps

for step in procedure:
result = renpy.call_screen(
Expand All @@ -74,6 +78,12 @@ init python:
clog.debug("Setup complete.")


def add_setup_callback(self, name, fn):
if name in self.__step_callbacks:
clog.error("The callback with name %s is already defined.", name)
return
self.__step_callbacks[name] = fn


# Initialize the service outside of the class.
setup = Thorax()

0 comments on commit 88f3be3

Please sign in to comment.