Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 'start of act' parser #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 89 additions & 88 deletions narrative/main.csv
Original file line number Diff line number Diff line change
@@ -1,88 +1,89 @@
Sender,Body (Rough),Body (Polished),Elapsed Time,Cleared All Pickups?,Location change?,Send Texts?,Change Sanity?,Spawn Item?,Unlock area?,Spawn NPC
Dictator Dan,YOU HAVE TO STAY INSIDE FOREVER,,5,,,,-50,,,
[FRIEND APPEARS],,,10,,,,,,,Friend;10;10
Friend,"Holy shit, this is crazy!",,2,,,,,,,
Mum,Are you okay? We've just cancelled our caravan trip. Have you got enough food? I sent you a little care package.,,2,,,,,Care Package,,
Other Friend,All of my shifts just got cut for the next week. :-(,,,TRUE,,,,,,
Dad,She'll be right,,2,,,,,,,
Mum,Have you got enough toilet paper? We can send you a roll or two.,,2,,,,,,,
Dad,"Chin up, champ",,2,,,,,,,
VIC GOV,We're all in this together. Keeping apart keeps us safe.,,2,,,,,,,
Mum,I bought a year's worth of toilet paper last year (even though your father told me not to),,2,,,,,,,
Mum,"Don't tell him, please",,2,,,,,,,
Dad,Did your mother buy any toilet paper? I found a ton of it in the shed,,2,,,,,,,
Dad,Don't tell her I found it,,2,,,,,,,
Yourself,I think I'm starting to lose it,,10,,,,-10,,,
Yourself,I haven't seen the sun in a week,,2,,,,-10,,,
,,,,,,,,,,
SOME MORE TEXTS ABOUT LOCKDOWN HERE,,,,,,,,,,
,,,,,,,,,,
Dictator Dan,OKAY YOU CAN GO OUTSIDE BUT ONLY FOR A SINGLE HOUR,,15,,,,,,,
Friend,"Hey, we can go outside! Meet you in park?",,2,,,,,,Park,
Mum,"Hi sweetheart, I read on the news you go outside now!",,,,,,,,,
Mum,Make sure to keep away from people though - can get the COVIDs if you get too close to them,,5,,Park,,,,,
Dad,You mother's been watching the news all day. I told her she should spend a bit more time in the garden,,,,,,,,,
Yourself,"Huh, nobody here either",,5,,,,10,,,
Yourself,"Oh look, a bird!",,5,,,,10,,,
Friend,Good to see you! You don't look too bad,,5,,,,,,,
Friend,Hey apparently we're meant to be like 1.5 metres apart or whatever,,1,,,,,,,
Friend,Your COVID risk goes like way up if you get too close to people,,1,,,,,,,
Friend,So let's just text or whatever,,1,,,,,,,
Dictator Dan,TIME'S UP GO BACK INSIDE NOW,,10,,,,-10,,,
Yourself,Better go back to the sadness cave then,,2,,,,,,,
Yourself,I wonder when this'll be all over?,,2,,,,,,,
Dad,Have you heard from your Mother? She's been in the garden for three hours already,,2,,,,,,,
VIC GOV,You must return home after you have exceeded your maximum allowed time outside.,,5,,,,,,,
VIC GOV,You must stay inside,,5,,,,,,,
VIC GOV,Keeping apart helps us keep together,,5,,,,,,,
Yourself,Okay now I'm really starting to lose it,,,,Home,,-20,,,
Yourself,Maybe I should just watch some TV again?,,1,,,,,TV,,
Yourself,Or look at the fridge.. again?,,1,,,,,Fridge,,
Yourself,Okay that didn't actually help,,,TRUE,,,,,,
Yourself,Guess I'll just go to bed?,,,,,,,Pillow,,
Yourself,Another day. I wonder if this will be over by next week?,,,TRUE,,,,,,
Friend,It was nice seeing you yesterday - how are you holding up?,,,,,,,,,
Mum,Did you know that violets are able to grow faster when you fertilise them with duck eggs?,,2,,,,,,,
Dad,Your mother bought some ducks yesterday. Don't ask her about it.,,1,,,,,,,
Dad,Please don't ask her about the ducks,,1,,,,,,,
Mum,Hope you're doing okay darling xx,,1,,,,,,,
Dad,"Don't worry about your mother, she'll be fine",,1,,,,,,,
Friend,I think this whole lockdown thing is going to be good for me! I just cleaned my room for the third time!,,2,,,,,,,
Yourself,Maybe I should do some cleaning?,,,,,,,Soap,,
Yourself,"Or... watch all of Buffy The Vampire Slayer, Season Six. Again.",,,TRUE,,,,,,
Yourself,I can't believe Xander called off the wedding,,2,,,,,,,
Friend,Please tell me you're not like watching Buffy again,,1,,,,,,,
Friend,"Season two was the best one anyway, I don't know what's wrong with you",,1,,,,,,,
Yourself,I feel like I could survive this!,,5,,,,,,,
Yourself,No you can't,,1,,,,-2,,,
Yourself,What?,,1,,,,,,,
Dictator Dan,NO LEAVING THE HOUSE UNTIL I SAY SO,,,,,,,,,
Dictator Dan,COMRADES,,1,,,,,,,
Friend,I started crocheting!,,1,,,,,,,
Friend,"I made two triangles yesterday! YouTube is so amazing, isn't it?",,2,,,,,,,
Friend,How's Buffy?,,1,,,,,,,
Mum,"How are you doing, sweetheart? Have you been looking after yourself?",,2,,,,,,,
Mum,I ordered some bees,,2,,,,,,,
Mum,Don't tell your father,,2,,,,,,,
Dad,You know that '72 Datsun that Uncle Daryl's been hanging onto for the last couple of years?,,2,,,,,,,
Dad,I got him to part with it for only 20K,,2,,,,,,,
Dad,Absolute bargain,,2,,,,,,,
Dad,Don't tell your Mother,,2,,,,,,,
Dad,"I don't know where your Mother got all this toilet paper, I can't find anything up the shops",,2,,,,,,,
Dad,Don't tell Uncle Daryl,,1,,,,,,,
Mum,I dropped off some toilet paper at Uncle Daryl's a couple days ago and he's already texting me for more,,2,,,,,,,
VicGOV,Make sure to wash your hands before and after leaving the house,,10,,,,,,,
Dictator Dan,DON'T LEAVE THE HOUSE UNLESS I SAY SO,,5,,,,,,,
Yourself,I haven't showered in.. days,,2,,,,,Towel,,
Yourself,But I also haven't finished Animal Crossing yet,,1,,,,,Video Game,,
Yourself,Can you even finish Animal Crossing?,,,TRUE,,,,,,
Mum,I don't know what he's doing with it all,,,,,,,,,
Mum,Anyway I thought you might like to know that the petunias are coming along nicely,,,,,,,,,
Mum,The bees have really taken to the new hive I set up in the backyard,,,,,,,,,
Mum,Doctor Samuel says I'm NOT allergic to beestings!,,,,,,,,,
Mum,,,,,,,,,,
Dad?,I'm disappointed in you,,1,,,,,,,
,,,,,,,,,,
Dictator Dan,COMRADERIE,,1,,,,,,,
Dictator Dan,FUCKING AUTOCORRECT,,1,,,,,,,
Dictator Dan,COMRADES***,,1,,,,,,,
Sender,Body (Rough),Body (Polished),Elapsed Time,Cleared All Pickups?,Location change?,Send Texts?,Change Sanity?,Spawn Item?,Unlock area?,Lock area?,Spawn NPC,Start of act?
Dictator Dan,PEOPLE OF MELBOURNE. LOCKDOWN IS NOW IN PLACE. YOU HAVE TO STAY INSIDE. FOREVER,,10,,,,-50,,,Park;Shops,,Yes
Friend,"Holy shit, this is crazy!",,1,,,,,,,,,
Mum,Did you hear the news about the lockdown sweetheart? We've just cancelled our caravan trip!,,1,,,,,,,,,
Yourself,.. I'm totally going to lose my mind if I just stay inside like this,,5,,,,,,,,,
Dad,"Stay positive sweetheart, she'll be right",,5,,,,,,,,,
Mum,Have you got enough food? I sent you a little care package.,,10,,,,,Care Package,,,,
Yourself,"Ooft, right in the feels. That's better. Thanks, Mum",,,TRUE,,,,,,,,
Mum,Have you got enough toilet paper? We can send you a roll or two.,,10,,,,,,,,,
Mum,I bought lots of toilet paper when it was on special last year (even though your father told me not to),,5,,,,,,,,,
Mum,"Don't tell him, please",,2,,,,,,,,,
VIC GOV,We're all in this together. Keeping apart keeps us safe.,,10,,,,,,,,,
Dad,Did your mother buy any toilet paper? I found a ton of it in the shed,,5,,,,,,,,,
Dad,Don't tell her I found it,,2,,,,,,,,,
Yourself,I think I'm starting to lose it!,,30,,,,-10,,,,,
Yourself,I haven't seen the sun in a week,,2,,,,-10,,,,,
,,,,,,,,,,,,
SOME MORE TEXTS ABOUT LOCKDOWN HERE,,,,,,,,,,,,
,,,,,,,,,,,,
Dictator Dan,OKAY YOU CAN GO OUTSIDE BUT ONLY FOR A SINGLE HOUR,,15,,,,,,,,,
Friend,"Hey, we can go outside! Meet you in park?",,2,,,,,,Park,,,
Mum,"Hi sweetheart, I read on the news you go outside now!",,,,,,,,,,,
Mum,Make sure to keep away from people though - can get the COVIDs if you get too close to them,,5,,Park,,,,,,,
Dad,You mother's been watching the news all day. I told her she should spend a bit more time in the garden,,,,,,,,,,,
Yourself,"Huh, nobody here",,5,,,,,,,,,
Yourself,"Oh look, a bird!",,5,,,,10,,,,,
[FRIEND APPEARS],,,10,,,,,,,,Friend;10;10,
Friend,Good to see you! You don't look too bad,,5,,,,,,,,,
Friend,Hey apparently we're meant to be like 1.5 metres apart or whatever,,1,,,,,,,,,
Friend,Your COVID risk goes like way up if you get too close to people,,1,,,,,,,,,
Friend,So let's just text or whatever,,1,,,,,,,,,
Dictator Dan,TIME'S UP GO BACK INSIDE NOW,,10,,,,-10,,,,,
Yourself,Better go back to the sadness cave then,,2,,,,,,,,,
Yourself,I wonder when this'll be all over?,,2,,,,,,,,,
Dad,Have you heard from your Mother? She's been in the garden for three hours already,,2,,,,,,,,,
VIC GOV,You must return home after you have exceeded your maximum allowed time outside.,,5,,,,,,,,,
VIC GOV,You must stay inside,,5,,,,,,,,,
VIC GOV,Keeping apart helps us keep together,,5,,,,,,,,,
Yourself,Okay now I'm really starting to lose it,,,,Home,,-20,,,,,
Yourself,Maybe I should just watch some TV again?,,1,,,,,TV,,,,
Yourself,Or look at the fridge.. again?,,1,,,,,Fridge,,,,
Yourself,Okay that didn't actually help,,,TRUE,,,,,,,,
Yourself,Guess I'll just go to bed?,,,,,,,Pillow,,,,
Yourself,Another day. I wonder if this will be over by next week?,,,TRUE,,,,,,,,
Friend,It was nice seeing you yesterday - how are you holding up?,,,,,,,,,,,
Mum,Did you know that violets are able to grow faster when you fertilise them with duck eggs?,,2,,,,,,,,,
Dad,Your mother bought some ducks yesterday. Don't ask her about it.,,1,,,,,,,,,
Dad,Please don't ask her about the ducks,,1,,,,,,,,,
Mum,Hope you're doing okay darling xx,,1,,,,,,,,,
Dad,"Don't worry about your mother, she'll be fine",,1,,,,,,,,,
Friend,I think this whole lockdown thing is going to be good for me! I just cleaned my room for the third time!,,2,,,,,,,,,
Yourself,Maybe I should do some cleaning?,,,,,,,Soap,,,,
Yourself,"Or... watch all of Buffy The Vampire Slayer, Season Six. Again.",,,TRUE,,,,,,,,
Yourself,I can't believe Xander called off the wedding,,2,,,,,,,,,
Friend,Please tell me you're not like watching Buffy again,,1,,,,,,,,,
Friend,"Season two was the best one anyway, I don't know what's wrong with you",,1,,,,,,,,,
Yourself,I feel like I could survive this!,,5,,,,,,,,,
Yourself,No you can't,,1,,,,-2,,,,,
Yourself,What?,,1,,,,,,,,,
Dictator Dan,NO LEAVING THE HOUSE UNTIL I SAY SO,,,,,,,,,,,
Dictator Dan,COMRADES,,1,,,,,,,,,
Friend,I started crocheting!,,1,,,,,,,,,
Friend,"I made two triangles yesterday! YouTube is so amazing, isn't it?",,2,,,,,,,,,
Friend,How's Buffy?,,1,,,,,,,,,
Mum,"How are you doing, sweetheart? Have you been looking after yourself?",,2,,,,,,,,,
Mum,I ordered some bees,,2,,,,,,,,,
Mum,Don't tell your father,,2,,,,,,,,,
Dad,You know that '72 Datsun that Uncle Daryl's been hanging onto for the last couple of years?,,2,,,,,,,,,
Dad,I got him to part with it for only 20K,,2,,,,,,,,,
Dad,Absolute bargain,,2,,,,,,,,,
Dad,Don't tell your Mother,,2,,,,,,,,,
Dad,"I don't know where your Mother got all this toilet paper, I can't find anything up the shops",,2,,,,,,,,,
Dad,Don't tell Uncle Daryl,,1,,,,,,,,,
Mum,I dropped off some toilet paper at Uncle Daryl's a couple days ago and he's already texting me for more,,2,,,,,,,,,
VicGOV,Make sure to wash your hands before and after leaving the house,,10,,,,,,,,,
Dictator Dan,DON'T LEAVE THE HOUSE UNLESS I SAY SO,,5,,,,,,,,,
Yourself,I haven't showered in.. days,,2,,,,,Towel,,,,
Yourself,But I also haven't finished Animal Crossing yet,,1,,,,,Video Game,,,,
Yourself,Can you even finish Animal Crossing?,,,TRUE,,,,,,,,
Mum,I don't know what he's doing with it all,,,,,,,,,,,
Mum,Anyway I thought you might like to know that the petunias are coming along nicely,,,,,,,,,,,
Mum,The bees have really taken to the new hive I set up in the backyard,,,,,,,,,,,
Mum,Doctor Samuel says I'm NOT allergic to beestings!,,,,,,,,,,,
Mum,,,,,,,,,,,,
Dad?,I'm disappointed in you,,1,,,,,,,,,
,,,,,,,,,,,,
Dictator Dan,COMRADERIE,,1,,,,,,,,,
Dictator Dan,FUCKING AUTOCORRECT,,1,,,,,,,,,
Dictator Dan,COMRADES***,,1,,,,,,,,,
13 changes: 11 additions & 2 deletions src/narrative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn load_csv(file: &str) -> Vec<NarrativeEvent> {
let criterion = if non_empty(time) && non_time_condition.is_some() {
// Special case - if there is a time and other criteria, generate dummy criterion
rv.push(NarrativeEvent {
starts_act: false, // TODO
starts_act: false, // TODO -- can safely be left because of how the script works
criterion: non_time_condition.unwrap(),
action: action(),
});
Expand Down Expand Up @@ -162,7 +162,7 @@ pub fn load_csv(file: &str) -> Vec<NarrativeEvent> {
}

rv.push(NarrativeEvent {
starts_act: true, // TODO
starts_act: non_empty(get_default(&h, &x, "Start of act?", "")),
criterion: criterion,
action: a,
});
Expand Down Expand Up @@ -205,6 +205,15 @@ fn get<'a>(h: &'a HashMap<&str, usize>, r: &'a StringRecord, v: &'a str) -> &'a
return &r[*idx];
}

fn get_default<'a>(h: &'a HashMap<&str, usize>, r: &'a StringRecord, v: &'a str, default: &'a str) -> &'a str {
let idx = h.get(v);
if let Some(idx) = idx {
return &r[*idx];
} else {
return default;
}
}

fn csv_header(rec: &StringRecord) -> HashMap<&str, usize> {
let mut rv = HashMap::new();

Expand Down