Your browser lacks required capabilities. Please upgrade it or switch to another to continue.
Loading…
You are an mechanic on a spaceship, it is your job to keep everything running.
You are nearing the end of a year-long journey and are running dangerously low on supplies, but if you can keep everything running for a few more days you'll make it to your destination and be able to restock.
<<linkreplace "Next">>\
Suddenly, multiple warning lights turn on.
@@.monologue;It looks like there's a problem with the engine, the temperature control system, and the shield generator.@@
[[Next|intro_get_tools]]
<</linkreplace>>\<<script>>
class Item{
constructor(name, description, hidden = false){
this.name = name;
this.description = description;
this.hidden = hidden;
this._qty = 0;
}
get hasItem(){
return this.qty > 0;
}
get qty(){ return this._qty; }
set qty(v){
if(v >= 0) this._qty = v;
else throw new Error('You can\'t have less than 0 of an item.');
}
}
window.Item = Item;
<</script>>
<<set $itemWrench to new Item("wrench", "")>>
<<set $itemScrewdriver to new Item("screwdriver", "Can be used to tighten or loosen screws. @@.monologue;Can also be used to pry something open, but that might break it.@@")>>
<<set $itemDuctTape to new Item("duct tape", "")>>
<<set $itemWire to new Item("wire", "A 4 foot long piece of insulated copper wire.")>>
<<set $itemTime to new Item("time", "", true)>>
<<widget itemName>>\
<<set _ret to $args[0].name>>\
\
<<if $args[1] == "uppercase">>\
<<set _ret to _ret.toUpperFirst()>>\
<</if>>\
\
@@.itemName;_ret@@\
<</widget>>
<<widget giveItem>>\
<<run $args[0].qty++>>\
<<if !$args[0].hidden || settings.debug_info>>\
<<if $args[0].hidden>>DEBUG: hidden item <</if>>\
<<itemName $args[0] uppercase>> added to inventory.\
<<print $args[0].description>>\
<</if>>\
<</widget>>
<<widget takeItem>>\
<<run $args[0].qty-->>\
<<if !$args[0].hidden || settings.debug_info>>\
<<if $args[0].hidden>>DEBUG: <</if>>\
Removed <<if $args[0].hidden>>hidden item <</if>><<itemName $args[0]>> from inventory.\
<</if>>\
<</widget>>Inventory:
<<for _item range [$itemWrench, $itemScrewdriver, $itemDuctTape, $itemWire, $itemTime]>>\
<<if !_item.hidden || settings.debug>>\
<<itemName _item uppercase>> (x<<print _item.qty>>) - <<print _item.description>>
<</if>>\
<</for>>\
[[Return|$return]][[Inventory|display_inventory]]
<<if settings.debug_menus>>\
[[Debug: add/remove items|dev_inventory]]
<</if>>\/*thingFixed flags should be false/proper/macgyver*/
<<set $systemsAttempted to 0>>/*FIXME is this used?*/
<<set $engineState to new SystemRepairState()>>
<<set $tempControlState to new SystemRepairState()>>
<<set $shieldsState to new SystemRepairState()>><<for _item range [$itemWrench, $itemScrewdriver, $itemDuctTape, $itemWire, $itemTime]>><<capture _item>>\
<<itemName _item uppercase>> - \
(x<<print _item.qty>>) - \
[["add"|dev_inventory][_item.qty++]] \
[["remove"|dev_inventory][_item.qty--]]
<</capture>><</for>>\
[[Return|$return]]/*TODO colored text for systems like for items?*/
<<if !$engineState.hasAttempted>>\
[[Fix the engines next|fix_engines]]
<</if>>\
<<if !$tempControlState.hasAttempted>>\
[[Fix the temperature control system next|fix_tempControl]]
<</if>>\
<<if !$shieldsState.hasAttempted>>\
[[Fix the shield generator next|fix_shieldGenerator]]
<</if>>\
<<if (($shieldsState.hasAttempted) && $engineState.hasAttempted && $tempControlState.hasAttempted)>>\
[[Next|ending_switch]]/*TODO goto?*/
<</if>>\You grab your tools.
<<if visited(State.active.title)==1>>\
<<giveItem $itemWrench>>
<<giveItem $itemScrewdriver>>
<<giveItem $itemDuctTape>>
<<giveItem $itemWire>>
<<giveItem $itemTime>>
<<giveItem $itemTime>>
<</if>>\
//you can check your inventory at any time by clicking "Inventory" in that menu to the left//
//a few branches may be unreachable since I haven't fully tested this yet. If that is the case you can use the debug inventory page to add/remove the necessary items to reach that branch.//
[[Next|select_area_to_fix]]wanted to give player feeling of solving problems in a high stress situation, hurriedly triaging systems & needing to macgyver fixes if/when they don't have the right tools to fix things properly
explain why you don't have many supplies left
things that need fixing ideas:
air filter/purifier/generator/we
artificial gravity
transporters
engines
fuel leak
network/communicators
toilets
heat
radiation/heat shielding
need to go outside to repair?/*
fuel pipe leaking
replace properly (time)
macgyver (duct tape)
fail (neither)
*/\
<<set $engineState.hasAttempted to true>>\
\
<<set _replacePipeSolution to false>>\
<<set _tapePipeSolution to false>>\
You reach che engine room, and after looking around for a little while you realize what the problem is - the fuel pipe is leaking.
----
@@.monologue; It's only a small leak, but if I don't fix it we'll run out of fuel before we arrive.@@
\
<<if $itemTime.hasItem and $itemWrench.hasItem>>\
@@.monologue;I could use my <<itemName $itemWrench>> to replace the pipe, it will take more <<itemName $itemTime>> but it's a more permanent solution.@@
<<set _replacePipeSolution to true>>\
<<elseif $itemWrench.hasItem>>\
@@.monologue;I could use my <<itemName $itemWrench>> to replace the pipe, but there isn't enough <<itemName $itemTime>>.@@
<<else>>/*does not have wrench, may or may not have time*/\
@@.monologue;If only I still had my <<itemName $itemWrench>>, I could have used it to replace the pipe.@@
<</if>>\
\
<<if $itemDuctTape.hasItem>>\
<<set _tapePipeSolution to true>>\
@@.monologue;I could use my <<itemName $itemDuctTape>> to stop the leak, it's only temporary but it should hold until we arrive.@@
<<else>>\
@@.monologue;If I still had my <<itemName $itemDuctTape>>, I could have used it to patch the leak.@@
<</if>>\
----
<<if _replacePipeSolution>>\
[[Use your wrench to replace the pipe.|fix_engines_replacePipe]]
<</if>>\
<<if _tapePipeSolution>>\
[[Use your ductTape to replace the pipe.|fix_engines_tapePipe]]
<</if>>\
\
<<if !(_replacePipeSolution or _tapePipeSolution)>>\
[[Next|fix_engine_cantFix]]
<</if>>\<<takeItem $itemTime>>
<<run $engineState.isFixed = true>>\
<<run $engineState.isFixedWell = true>>\
@@.success;You fixed the engine!@@
[[Next|select_area_to_fix]]<<takeItem $itemDuctTape>>
<<run $engineState.isFixed = true>>\
<<run $engineState.isFixedWell = false>>\
@@.jankSuccess;You got the engine running.@@
[[Next|select_area_to_fix]]/*
replace properly (time, wire)
macgyver (wrench)
fail (neither)
*/\
<<set $tempControlState.hasAttempted to true>>\
\
<<set _wireSolution to false>>\
<<set _wrenchSolution to false>>\
\
----
@@.monologue;The temperature control system is offline. It's not too cold yet, but it won't stay that way.@@
@@.monologue;It looks like there's been a small fire. Somebody left their jacket on top of this vent, the heat built up and this wire melted.@@
<<if $itemTime.hasItem and $itemWire.hasItem>>\
@@.monologue;I could used my <<itemName $itemWire>> to replace the melted wire.@@
<<set _wireSolution to true>>\
<<elseif $itemWire.hasItem>>\
@@.monologue;I could have use my <<itemName $itemWire>> to replace the melted wire, but there isn't enough <<itemName $itemTime>>.@@
<<else>>\
@@.monologue;If only I still had my <<itemName $itemWire>>, I could have used it to replace the melted wire.@@
<</if>>\
\
<<if $itemWrench.hasItem>>\
@@.monologue;I could wedge my <<itemName $itemWrench>> in there to complete the circuit.@@
<<set _wrenchSolution to true>>\
<<else>>\
@@.monologue;I could also wedge something metal in there to complete the circuit, but nothing I have is the right size.@@
<</if>>\
\
----
<<if (_wireSolution || _wrenchSolution)>>\
<<if _wireSolution>>\
[[Use your wire to replace the melted wire|fix_tempControl_replaceWire]]
<</if>>\
<<if _wrenchSolution>>\
[[Use your wrench in place of the melted wire|fix_tempControl_wrenchBodge]]
<</if>>\
<<else>>\
[[Next|fix_tempControl_cantFix]]
<</if>>\<<run $tempControlState.isFixed = false>>\
<<run $tempControlState.isFixedWell = false>>\
@@.fail;You failed to fix the temperature control system.@@
[[Next|select_area_to_fix]]<<takeItem $itemTime>>
<<takeItem $itemWire>>
@@.success;You fixed the temperature control system!@@
<<run $tempControlState.isFixed = true>>\
<<run $tempControlState.isFixedWell = true>>\
[[Next|select_area_to_fix]]<<takeItem $itemWrench>>
@@.jankSuccess;You got the temperature control system running.@@
<<run $tempControlState.isFixed = true>>\
<<run $tempControlState.isFixedWell = false>>\
[[Next|select_area_to_fix]]<<if !$engineState.isFixed>>\
[[Next|ending_brokenEngine]]
<</if>>\
<<if !$shieldsState.isFixed>>\
[[Next|ending_brokenShields]]
<</if>>\
\
/*all systems fixed*/\
<<if ($engineState.isFixed && $tempControlState.isFixed && $shieldsState.isFixed)>>\
<<set _jankPoints to !$engineState.isFixedWell + !$tempControlState.isFixedWell + !$shieldsState.isFixedWell>>\
<<set _minJankPoints to 1>>\
<<set _maxJankPoints to 3>>\
<<if _jankPoints >= _maxJankPoints>>\
[[Next|ending_maximumJank]]
<<elseif _jankPoints <= _minJankPoints>>\
[[Next|ending_minimumJank]]
<<else>>\
[[Next|ending_someJank]] /*TODO: split into multiple endings?*/
<</if>>\
<</if>>\<<run $engineState.isFixed = false>>\
<<run $engineState.isFixedWell = false>>\
@@.fail;You failed to fix the engine.@@
[[Next|select_area_to_fix]]@@.monologue;It's a good thing the temperature control system held up, otherwise we would have been toast.@@
Even though the journey took longer than expected, you still made it back safely.
(@@.jankSuccess;Success.@@ - ending 1 of 7)You spend the remainder of the journey much like you spent today, frantically trying to keep the ship's systems online, but in the end you arrive at your destination on schedule.
(@@.jankSuccess;Success.@@ - ending 5 of 7)The last few days of the journey pass by uneventfully, and you arrive in a few days.
(@@.success;Success!@@ - ending 5 of 7)The last few days of the journey pass by mostly uneventfully, aside from a bit of maintenance here and there.
(@@.success;Success.@@ - ending 6 of 7)Because you failed to fix the engine, your journey will, instead of finishing in a few days, instead take several weeks longer.
/*add monologue here?*/\
<<linkreplace Next>>\
<<if $tempControlState.isFixedWell>>\
<<include ending_brokenEngine_goodHeat>>
<<elseif $tempControlState.isFixed>>\
<<include ending_brokenEngine_jankHeat>>
<<else>>\
<<error2200>>
<</if>>\
<</linkreplace>>/*https://qjzhvmqlzvoo5lqnrvuhmg-on.drv.tw/UInv/Sample_Code.html#Error%20Messages*/
<<widget error>>\
<<if ($args.length == 2) && (typeof $args[0] === "string") && (typeof $args[1] === "string")>>\
<<if ndef _errNo>>\
<<set _errNo = 1>>\
<<run $(document).one(":passagerender",
function (ev) {
$(ev.content).find(".errmsg").each(function (idx) {
throwError($(this), $(this).data("msg"), $(this).data("src"));
});
}
)>>\
<<else>>\
<<set _errNo += 1>>\
<</if>>\
<span class="errmsg" @data-msg="$args[0]" @data-src="$args[1]"></span>\
<<else>>\
<<error '<<error>> must have two string parameters.' 'Example: <<error "Main text." "Details.">>'>>\
<</if>>\
<</widget>>
<<widget error2200>>\
<<error "If you're seeing this, the code is in what I thought was an unreachable state." "https://xkcd.com/2200/">>
<</widget>>@@.monologue;It's a good thing the temperature control system is holding up, otherwise we would be toast.@@
<<linkreplace "1 week later">>
Unfortunately, your temporary fix for the temperature control system didn't last long enough. You freeze to death in the void of space.
(@@.fail;Game Over.@@ - ending 2 of 7)
<</linkreplace>>/*
proper solution(time, screwdriver)
take part from other less important system
jank solution(wire)
bypass voltage regulator
*/\
<<set $shieldsState.hasAttempted to true>>\
\
<<set _jankSolution to false>>\
<<set _properSolution to false>>\
\
After poking around inside the shield generator for a few minutes, you find the source of the problem - the voltage regulator is broken.
----
@@.monologue;We're a sitting duck without our shields.@@
\
<<if $itemTime.hasItem and $itemScrewdriver.hasItem>>\
@@.monologue;Those voltage regulators are pretty common. I coluld get a replacement one by taking apart something less important, but that would take a while.@@
<<set _properSolution to true>>\
<<elseif $itemScrewdriver.hasItem>>\
@@.monologue;placeholder: Those voltage regulators are pretty common. I coluld get a replacement one by taking apart something less important, but I don't have enough <<itemName $itemTime>>.@@
<<else>>\
@@.monologue;I won't be able to replace the voltage regulator without a <<itemName $itemScrewdriver>>.@@
<</if>>\
\
<<if $itemWire.hasItem>>\
<<set _jankSolution to true>>\
@@.monologue;This particular model of shield generator doesn't draw much power while it's not in active use. I could use this <<itemName $itemWire>> to bypass the broken voltage regulator. We could sustain a few minor hits that way, but anything more and the shield generator will fry itself.@@
<<else>>\
@@.monologue;If I still had my <<itemName $itemWire>> I might have been able to bypass the voltage regulator.@@
<</if>>\
----
<<if _properSolution>>\
[[Take a replacement voltage regulator out of something else.|fix_shieldGenerator_proper]]
<</if>>\
<<if _jankSolution>>\
[[Use wire to bypass the voltage regulator|fix_shieldGenerator_jank]]
<</if>>\
\
<<if !(_properSolution or _jankSolution)>>\
[[Next|fix_shieldGenerator_cantFix]]
<</if>>\/*
shield generator fail
get attacked by space pirates or some shit
if did good engine fix, can outrun them
otherwise, die & game over
*/\
Your ship gets attacked, and without any shields the only way you'll survive is by fleeing.
/*TODO linkreplace*/\
<<if $engineState.isFixedWell>>\
[[Next|ending_brokenShields_goodEngine]]
<<elseif $engineState.isFixed>>\
[[Next|ending_brokenShields_jankEngine]]
<<else>>\
<<error2200>>
<</if>>\The effort you put into fixing the engine pays off, and you manage to escape with the ship still functional.
It was a close call, but you made it out alive.
(@@.jankSuccess;Success.@@ - ending 4 of 7)Your temporary fix for the engine gives out at the worst possible moment. You're unable to escape, and without shields your ship is quickly destroyed.
(@@.fail;Game Over@@ - ending 3 of 7)<<takeItem $itemTime>>
/*placeholder: you take a voltage regulator out of some other thing (maybe a kitchen appliance?), and use that to replace the broken one.*/
@@.success;You fixed the shield generator!@@
<<run $shieldsState.isFixed = true>>\
<<run $shieldsState.isFixedWell = true>>\
[[Next|select_area_to_fix]]<<takeItem $itemWire>>
@@.jankSuccess;You got the shield generator running.@@
<<run $shieldsState.isFixed = true>>\
<<run $shieldsState.isFixedWell = false>>\
[[Next|select_area_to_fix]]@@.fail;You failed to fix the shield generator.@@
<<run $shieldsState.isFixed = false>>\
<<run $shieldsState.isFixedWell = false>>\
[[Next|select_area_to_fix]]