Skip to content

Instantly share code, notes, and snippets.

@alexanderson1993
Last active June 2, 2025 22:52
Show Gist options
  • Save alexanderson1993/0d946801668d321e765a3b12ebe3cbef to your computer and use it in GitHub Desktop.
Save alexanderson1993/0d946801668d321e765a3b12ebe3cbef to your computer and use it in GitHub Desktop.
Thorium Nova timeline example
addTimeline({
name: "Shakedown",
steps: [
{
name: "Reactor",
execute(ctx) {
const shipName = getPlayerShipName();
ctx.doAction("sendMessage", {
message: `${shipName}, be sure to activate your reactor before detaching docking clamps`,
});
// Automatically goes to the next step
ctx.addCheck(() => isReactorActivated(), {
// The label is for the Flight Director's benefit so they know what checks are currently active
label: "Reactor Activated",
});
ctx.addCheck(() => isClampsDetached(), {
label: "Docking Clamps Detached",
async onChecked() {
// If this function is defined, stay on this step unless it does an action to advance.
await wait(3000); // Wait for 3 seconds to let them reattach
if (isClampsDetached()) {
// If still detached, jump to the fiasco step
// Navigating to a new step automatically deactivates the checks from this step
ctx.doAction("goToStep", "Clamps Fiasco");
}
},
});
},
},
{
name: "Clamps",
execute(ctx) {
const shipName = getPlayerShipName();
ctx.doAction("sendMessage", {
message: `${shipName}, now that your reactor is online, you can detach your clamps.`,
});
ctx.addCheck(() => isClampsDetached(), {
label: "Clamps Detached",
onChecked() {
// Skip over the fiasco step
ctx.doAction("goToStep", "Thrusters");
},
});
},
},
{
name: "Clamps Fiasco",
execute(ctx) {
const shipName = getPlayerShipName();
// Set a variable so we remember that this fiasco happened
ctx.doAction("setVariable", { name: "clampsThenReactor", value: true });
ctx.doAction("sendMessage", {
message: `${shipName}, what are you doing? Get your reactor activated before you run out of reserve power!`,
});
ctx.addCheck(() => isReactorActivated(), {
label: "Reactor Activated",
});
},
},
{
name: "Thrusters",
execute(ctx) {
const shipName = getPlayerShipName();
const didFiascoHappen = getVariable("clampsThenReactor");
ctx.doAction("sendMessage", {
message: `${shipName}, ${didFiascoHappen ? "that was a close one. Now" : "now"} that you're clamps are detached, use forward thrusters until you're clear of the docking bay.`,
});
},
},
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment