diff --git a/game/src/lib.rs b/game/src/lib.rs index 8d3089b..f543905 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -150,7 +150,7 @@ enum RoomName { Room1, /// Duplicate of starting room so I can change things around a little. _Room2, - SortingPuzzle, + SortingRoom, } impl Default for RoomName { @@ -166,6 +166,11 @@ struct StateRoom1 { read_note: bool, } +#[derive (Clone, Default)] +struct StateSortingRoom { + +} + /// Commands that the game will ask the runtime to execute. #[derive (PartialEq)] @@ -211,11 +216,12 @@ pub struct State { intro_state: IntroState, current_room: RoomName, room_1: StateRoom1, + room_sorting: StateSortingRoom, } impl State { pub fn cheat (&mut self) { - self.current_room = RoomName::SortingPuzzle; + self.current_room = RoomName::SortingRoom; } /// Send a line of player input (e.g. "look table") into the game and return @@ -268,11 +274,37 @@ impl State { ], PlayerAction::RoomSpecific (x) => match self.current_room { Room1 => self.room_1 (x), + SortingRoom => self.sorting_room (x), _ => just (line_response ("ERR: Invalid current room")), } } } + fn sorting_room (&mut self, action: PlayerActionRoomSpecific) -> Vec + { + use PlayerActionRoomSpecific::*; + + match action { + Hint => { + just (line_response ("The books are out of order")) + }, + Wait => { + just (line_response ("You wait. Nothing is moving. The room smells like 5 books.")) + }, + LookAround => { + vec! [ + line_response ("You see a small bookshelf with 5 books on it, and a MACHINE. It looks like the MACHINE is able to grab books and swap them around with a robotic arm. The bookshelf is behind a pane of reinforced glass, but a control panel near you has buttons labelled LEFT, RIGHT, and SWAP."), + ] + }, + Look (item_name) => { + just (undetected_item ()) + }, + Use (item_name) => { + just (undetected_item ()) + }, + } + } + fn room_1 (&mut self, action: PlayerActionRoomSpecific) -> Vec { use PlayerActionRoomSpecific::*;