diff --git a/index.t b/index.t index dc94f0a..f555f9f 100644 --- a/index.t +++ b/index.t @@ -35,6 +35,7 @@ gameMain: GameMainDef #include "items/oldDoor.t" #include "items/brokenDoor.t" #include "items/potion.t" +#include "items/locker.t" #include "characters/pc.t" #include "characters/dude.t" diff --git a/items/locker.t b/items/locker.t new file mode 100644 index 0000000..03eac15 --- /dev/null +++ b/items/locker.t @@ -0,0 +1,57 @@ +locker: LockableContainer, Fixture + 'locker' + 'locker' + "A standard metal locker stands in the corner, slightly worn but sturdy. + Its surface is a matte, muted gray with faint scratches and small dents, + evidence of years of use. You could see an attached keypad.\n " + location = thirdRoom + isListed = true + initiallyLocked = true +; + ++ Wearable + 'pair/sock*socks' + 'pair of socks' + "A pair of white socks. " + dobjFor (Wear) { + verify () { + illogical('It turned out that the socks are the wrong size for you.'); + } + } +; + +/* */ + +modify VerbRule(SetTo) + ('press' | 'input') singleLiteral ('on' | 'with') singleDobj + : /* empty */ +; + +numpad: Dial, Component + 'electronic locking device/numpad/keyboard/keypad' + 'numpad keyboard' + "An electronic device with a numeric keypad and a small 4-digit display.\n + Apparently, you can type a passcode on this keyboard to open the locker. " + location = thirdRoom + + makeSetting(val) { + curSetting = val is in (secondRoom.wallCode) + ? val + : '0'; + } + + dobjFor (TypeLiteralOn) remapTo(SetTo, self, OtherObject) + + dobjFor (SetTo) { + action () { + inherited; + if (curSetting == secondRoom.wallCode) { + locker.makeLocked(nil); + locker.makeOpen(true); + "The locker opened with a click. "; + } else { + "You heard an annoying sound and a red light flashed on the keypad. "; + } + } + } +; diff --git a/locations/secondRoom.t b/locations/secondRoom.t index 3866529..8a57125 100644 --- a/locations/secondRoom.t +++ b/locations/secondRoom.t @@ -1,5 +1,6 @@ secondRoom: Room 'Second Room' "This is another boring room with a few balloons and a painting on the wall. " + wallCode = '3339' roomParts = (inherited() - [defaultEastWall] + [secondRoomEastWall]) north = startingRoom south = oldDoorOutside @@ -31,5 +32,6 @@ secondRoom: Room 'Second Room' 'painting/image/picture/drawing*drawings' 'picture on the wall' "Unframed reproduction of a famous painting glued to the wall.\n - In the corner, someone wrote four digits with a pink marker: 3339. " + In the corner, someone wrote four digits with a pink marker: + <>. " ;