working on sorting machine room

main
_ 2021-10-29 11:41:14 -05:00
parent 42567278d3
commit cfc5785995
1 changed files with 34 additions and 2 deletions

View File

@ -150,7 +150,7 @@ enum RoomName {
Room1, Room1,
/// Duplicate of starting room so I can change things around a little. /// Duplicate of starting room so I can change things around a little.
_Room2, _Room2,
SortingPuzzle, SortingRoom,
} }
impl Default for RoomName { impl Default for RoomName {
@ -166,6 +166,11 @@ struct StateRoom1 {
read_note: bool, read_note: bool,
} }
#[derive (Clone, Default)]
struct StateSortingRoom {
}
/// Commands that the game will ask the runtime to execute. /// Commands that the game will ask the runtime to execute.
#[derive (PartialEq)] #[derive (PartialEq)]
@ -211,11 +216,12 @@ pub struct State {
intro_state: IntroState, intro_state: IntroState,
current_room: RoomName, current_room: RoomName,
room_1: StateRoom1, room_1: StateRoom1,
room_sorting: StateSortingRoom,
} }
impl State { impl State {
pub fn cheat (&mut self) { 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 /// 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 { PlayerAction::RoomSpecific (x) => match self.current_room {
Room1 => self.room_1 (x), Room1 => self.room_1 (x),
SortingRoom => self.sorting_room (x),
_ => just (line_response ("ERR: Invalid current room")), _ => just (line_response ("ERR: Invalid current room")),
} }
} }
} }
fn sorting_room (&mut self, action: PlayerActionRoomSpecific) -> Vec <Response>
{
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 <Response> { fn room_1 (&mut self, action: PlayerActionRoomSpecific) -> Vec <Response> {
use PlayerActionRoomSpecific::*; use PlayerActionRoomSpecific::*;