From 9b9de07daec2b6f91c9cf5375f418cd536dd1774 Mon Sep 17 00:00:00 2001 From: He4eT Date: Thu, 19 Mar 2020 23:16:10 +0500 Subject: [PATCH] Lockers with keypad --- experiment.t | 14 +++++--- src/actor/surgeryAssistant.t | 2 +- src/item/lockers.t | 66 ++++++++++++++++++++++++++++++++++++ test/gotoPinkRoom | 9 +++++ 4 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 src/item/lockers.t create mode 100644 test/gotoPinkRoom diff --git a/experiment.t b/experiment.t index c019de4..daccff2 100644 --- a/experiment.t +++ b/experiment.t @@ -41,8 +41,16 @@ gameMain: GameMainDef ";} ; +/* */ + +#include "src/actor/pc.t" +#include "src/action/repair.t" + +#include "src/item/_bandage.t" #include "src/item/whitePanels.t" +/* rooms */ + #include "src/room/orangeRoom.t" #include "src/room/orangeBathroom.t" #include "src/item/dentalFloss.t" @@ -55,12 +63,8 @@ gameMain: GameMainDef #include "src/room/pinkRoom.t" #include "src/item/labCoat.t" +#include "src/item/lockers.t" #include "src/room/redRoom.t" #include "src/item/dataCable.t" #include "src/actor/surgeryAssistant.t" - -#include "src/action/repair.t" -#include "src/item/_bandage.t" - -#include "src/actor/pc.t" diff --git a/src/actor/surgeryAssistant.t b/src/actor/surgeryAssistant.t index 26284a7..8be7799 100644 --- a/src/actor/surgeryAssistant.t +++ b/src/actor/surgeryAssistant.t @@ -82,7 +82,7 @@ surgeryAssistant: Person tCrew: Topic 'crew/team'; ++ AskTopic [tCrew] " The team on this floor consists of three people.\b - The first is Dr. O'neill, the surgeon. + The first is Dr. O'Neill, the surgeon.
The second is Alice Dash, the technician is responsible for all the equipment on this floor.
The third is Mark Hopper, the orderly and janitor.
" diff --git a/src/item/lockers.t b/src/item/lockers.t new file mode 100644 index 0000000..d3f9ab5 --- /dev/null +++ b/src/item/lockers.t @@ -0,0 +1,66 @@ +lockers: Fixture + 'lockers' + 'lockers' + @pinkRoom + " A row of service lockers with a numpad keyboard on the side. +
This row, according to the signs, + includes (from left to right) the lockers of + Dr. O'Neill, Alice, and Mark. " +; + +modify VerbRule(SetTo) + ('press' | 'input') singleLiteral ('on' | 'with') singleDobj + : /* empty */ +; + ++ numpad: Dial, Component + 'numpad/keyboard/keypad' + 'numpad keyboard' + " An electronic device with a numeric keypad + and a small 4-digit display. +
Apparently, you can type passcode + on this keyboard to open any locker. " + + makeSetting(val) { + curSetting = val is in (aliceLocker.code) + ? val + : '0'; + } + + dobjFor(TypeLiteralOn) + remapTo(SetTo, self, OtherObject) + + dobjFor(SetTo) { + action () { + inherited; + if (curSetting == aliceLocker.code) { + aliceLocker.makeLocked(nil); + aliceLocker.makeOpen(true); + "The middle drawer opened with a click. "; + } else { + " You heard an annoying sound and + a red light flashed on the keypad. "; + } + } + } +; + ++ drLocker: IndirectLockable, LockableContainer, Component + 'left locker' + 'left locker' + "The sign reads Dr. O'Neill.\b" +; + ++ markLocker: IndirectLockable, LockableContainer, Component + 'right locker' + 'right locker' + " The sign reads Mark Hopper. +
There's a huge dent in the side.\b" +; + ++ aliceLocker: IndirectLockable, LockableContainer, Component + 'middle central locker' + 'middle locker' + "The sign reads Alice Dash.\b" + code = '1984' +; diff --git a/test/gotoPinkRoom b/test/gotoPinkRoom new file mode 100644 index 0000000..e85bbcc --- /dev/null +++ b/test/gotoPinkRoom @@ -0,0 +1,9 @@ +>turn on the light +>w +>open locker +>take floss +>e +>s +>s +>take tape +>w