diff --git a/common/assets/src/paths.rs b/common/assets/src/paths.rs index 135287ea..523b794a 100644 --- a/common/assets/src/paths.rs +++ b/common/assets/src/paths.rs @@ -79,6 +79,7 @@ pub mod portraits { pub const BOLT: &str = "characters/portraits/bolt1.png"; pub const CAPY: &str = "characters/portraits/capy1.png"; pub const CAT: &str = "characters/portraits/cat1.png"; + pub const GINGER_CAT: &str = "characters/portraits/gingercat1.png"; pub const EMIL: &str = "characters/portraits/emil1.png"; pub const MASTER: &str = "characters/portraits/master1.png"; pub const POOPER: &str = "characters/portraits/pooper1.png"; diff --git a/common/story/src/dialog.rs b/common/story/src/dialog.rs index eaccbc66..f358004d 100644 --- a/common/story/src/dialog.rs +++ b/common/story/src/dialog.rs @@ -469,10 +469,10 @@ impl Dialog { cmd, store, if self.current_node == NodeName::Root { - error!("NextNodes::None in the root"); + error!("Branching::None in the root"); NodeName::EndDialog } else { - warn!("NextNodes::None, emerging"); + warn!("Branching::None, emerging"); NodeName::Root }, ); @@ -519,7 +519,7 @@ impl Dialog { AdvanceOutcome::AwaitingPlayerChoice } } else { - warn!("NextNodes::Choice stopped all branches, emerging"); + warn!("Branching::Choice stopped all branches, emerging"); self.transition_to(cmd, store, NodeName::Root); AdvanceOutcome::Transition } diff --git a/common/story/src/dialog/guard.rs b/common/story/src/dialog/guard.rs index c02a4aad..37cbf786 100644 --- a/common/story/src/dialog/guard.rs +++ b/common/story/src/dialog/guard.rs @@ -30,11 +30,11 @@ pub(crate) enum GuardCmd { /// this command might not result in transition. TryTransition(NodeName), /// We want to show player choices in dialog. - /// This command says: in the [`Dialog::next_nodes`] array, at the - /// specified index, give us string that we should show to the player - /// as a choice. + /// This command says: in the [`Dialog::branching`]'s [`Branching::Choice`] + /// vector, at the specified index, give us string that we should show + /// to the player as a choice. /// It's possible that the guard will decide to stop the current branch - /// with [`NextNode::Stop`]. + /// with [`BranchStatus::Stop`]. PlayerChoice { node_name: NodeName, next_branch_index: usize, diff --git a/common/story/src/dialog/list.rs b/common/story/src/dialog/list.rs index 25614030..3374d461 100644 --- a/common/story/src/dialog/list.rs +++ b/common/story/src/dialog/list.rs @@ -36,6 +36,7 @@ pub struct Namespace { pub enum TypedNamespace { BoltIsMean, MarieBlabbering, + MrGoodWater, // -------------------------------------------------------------- // @@ -53,6 +54,7 @@ impl AsRef for TypedNamespace { fn as_ref(&self) -> &str { use TypedNamespace::*; match self { + MrGoodWater => "mr_good_water", BoltIsMean => "bolt_is_mean", MarieBlabbering => "marie_blabbering", InElevator => "in_elevator", diff --git a/common/story/src/lib.rs b/common/story/src/lib.rs index 73f6d62c..6d1aaa9f 100644 --- a/common/story/src/lib.rs +++ b/common/story/src/lib.rs @@ -61,6 +61,8 @@ pub enum Character { /// A character. Cat, /// A character. + GingerCat, + /// A character. Emil, /// A character. Pooper, @@ -136,6 +138,7 @@ impl Character { Character::Bolt => "Bolt", Character::Capy => "Capy", Character::Cat => "Cat", + Character::GingerCat => "Rolo", Character::Emil => "Emil", Character::Pooper => "Pooper", Character::Samizdat => "Samizdat", @@ -185,6 +188,7 @@ impl Character { Character::Bolt => BOLT, Character::Capy => CAPY, Character::Cat => CAT, + Character::GingerCat => GINGER_CAT, Character::Emil => EMIL, Character::Master => MASTER, Character::Pooper => POOPER, diff --git a/common/visuals/src/types.rs b/common/visuals/src/types.rs index ab16d0ed..0ef4c5d8 100644 --- a/common/visuals/src/types.rs +++ b/common/visuals/src/types.rs @@ -78,7 +78,7 @@ pub enum AtlasAnimationEnd { pub struct AtlasAnimationTimer { pub(crate) inner: Timer, /// 0 => means current is [`AtlasAnimation::play`]. - /// 1 => extra_steps[0] + /// 1 => `extra_steps[0]` /// and so on... pub(crate) current_step: usize, } diff --git a/dev/check b/dev/check index c0f91a88..aa7aca7d 100755 --- a/dev/check +++ b/dev/check @@ -8,4 +8,4 @@ cargo clippy -- -D warnings cargo test -RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --offline +RUSTDOCFLAGS="-D warnings" cargo doc --document-private-items --no-deps --offline diff --git a/dev/visualize_dialog.py b/dev/visualize_dialog.py index df4b92d3..d50bd90d 100644 --- a/dev/visualize_dialog.py +++ b/dev/visualize_dialog.py @@ -85,6 +85,8 @@ def visualize_dialog(dialog_toml): image_path += "marie1.png" case "Bolt": image_path += "bolt1.png" + case "GingerCat": + image_path += "gingercat1.png" case _: exit(f"Character {node['who']} not ready for visualization.") diff --git a/main_game/assets/dialogs/mr_good_water.toml b/main_game/assets/dialogs/mr_good_water.toml new file mode 100644 index 00000000..63e25956 --- /dev/null +++ b/main_game/assets/dialogs/mr_good_water.toml @@ -0,0 +1,69 @@ +[root] +who = "GingerCat" +en = """*With what you percieved as a substantial effort the cat's eyes meet yours. +This cat is clearly out of it.*""" +[[node]] +en = "Good Water." +[[node]] +en = "You buy some?" +next = ["taste_test", "yes_water", "no_water"] + +[[node]] +name = "yes_water" +who = "Winnie" +en = "Sure, let me have some. How much is it?" +next = "cost" + +[[node]] +name = "taste_test" +who = "Winnie" +en = "Isn't this a taste test stand?" +# TODO: here's where we can add a roll +[[node]] +who = "GingerCat" +en = "No, it's a water stand." +next = "cost" + +[[node]] +who = "GingerCat" +name = "cost" +en = "A bag of peas, please." +[[node]] +who = "Winnie" +en = "Peas? Do you not accept cash?" +[[node]] +who = "GingerCat" +en = "No peas no cash, please." +[[node]] +who = "Winnie" +en = "What? Anyway, I don't have no peas." +# TODO: We can add a note to the player's quest log here, and if they come with +# peas that can be obtained in the cult's garden, they can go to the next dialog +# with the cat. +[[node]] +who = "GingerCat" +en = "Then no water, please." +next = "get_ignored" + +[[node]] +name = "no_water" +who = "Winnie" +en = "I'm good, thanks." +next = "get_ignored" + +[[node]] +name = "get_ignored" +who = "GingerCat" +en = "*proceeds to stare past you as if you weren't even there*" +next = ["aggressive_leave", "leave"] + +[[node]] +name = "aggressive_leave" +who = "Winnie" +en = "One rude little kitty" +next = "_end_dialog" + +[[node]] +name = "leave" +en = "*leave*" +next = "_end_dialog" diff --git a/main_game/assets/maps/mall.ron b/main_game/assets/maps/mall.ron index 616760f8..ba921d29 100644 --- a/main_game/assets/maps/mall.ron +++ b/main_game/assets/maps/mall.ron @@ -71,72 +71,289 @@ (x: -91, y: 27): [Wall], (x: -91, y: 28): [Wall], (x: -90, y: -39): [Wall], + (x: -90, y: -22): [Wall], + (x: -90, y: 23): [Wall], + (x: -90, y: 24): [Wall], (x: -90, y: 28): [Wall], (x: -89, y: -39): [Wall], + (x: -89, y: -22): [Wall], + (x: -89, y: 5): [Wall], + (x: -89, y: 6): [Wall], + (x: -89, y: 23): [Wall], + (x: -89, y: 24): [Wall], (x: -89, y: 28): [Wall], (x: -88, y: -39): [Wall], + (x: -88, y: -22): [Wall], + (x: -88, y: 5): [Wall], + (x: -88, y: 6): [Wall], + (x: -88, y: 23): [Wall], + (x: -88, y: 24): [Wall], (x: -88, y: 28): [Wall], (x: -87, y: -39): [Wall], + (x: -87, y: -22): [Wall], + (x: -87, y: 5): [Wall], + (x: -87, y: 6): [Wall], + (x: -87, y: 23): [Wall], + (x: -87, y: 24): [Wall], (x: -87, y: 28): [Wall], (x: -86, y: -39): [Wall], + (x: -86, y: -23): [Wall], + (x: -86, y: -22): [Wall], + (x: -86, y: 5): [Wall], + (x: -86, y: 6): [Wall], + (x: -86, y: 23): [Wall], + (x: -86, y: 24): [Wall], (x: -86, y: 28): [Wall], (x: -85, y: -39): [Wall], + (x: -85, y: -24): [Wall], + (x: -85, y: -23): [Wall], + (x: -85, y: -22): [Wall], + (x: -85, y: 5): [Wall], + (x: -85, y: 6): [Wall], + (x: -85, y: 23): [Wall], + (x: -85, y: 24): [Wall], (x: -85, y: 28): [Wall], (x: -84, y: -39): [Wall], + (x: -84, y: -25): [Wall], + (x: -84, y: -24): [Wall], + (x: -84, y: -23): [Wall], + (x: -84, y: 5): [Wall], + (x: -84, y: 6): [Wall], + (x: -84, y: 23): [Wall], + (x: -84, y: 24): [Wall], (x: -84, y: 28): [Wall], (x: -83, y: -39): [Wall], + (x: -83, y: -25): [Wall], + (x: -83, y: -24): [Wall], + (x: -83, y: -22): [Wall], + (x: -83, y: 5): [Wall], + (x: -83, y: 6): [Wall], + (x: -83, y: 23): [Wall], + (x: -83, y: 24): [Wall], + (x: -83, y: 25): [Wall], + (x: -83, y: 26): [Wall], + (x: -83, y: 27): [Wall], (x: -83, y: 28): [Wall], (x: -82, y: -39): [Wall], + (x: -82, y: -38): [Wall], + (x: -82, y: -37): [Wall], + (x: -82, y: -36): [Wall], + (x: -82, y: -35): [Wall], + (x: -82, y: -34): [Wall], + (x: -82, y: -33): [Wall], + (x: -82, y: -32): [Wall], + (x: -82, y: -31): [Wall], + (x: -82, y: -30): [Wall], + (x: -82, y: -29): [Wall], + (x: -82, y: -28): [Wall], + (x: -82, y: -27): [Wall], + (x: -82, y: -26): [Wall], + (x: -82, y: -25): [Wall], + (x: -82, y: -23): [Wall], + (x: -82, y: -22): [Wall], + (x: -82, y: -21): [Wall], + (x: -82, y: 5): [Wall], + (x: -82, y: 6): [Wall], (x: -82, y: 28): [Wall], (x: -81, y: -39): [Wall], + (x: -81, y: -23): [Wall], + (x: -81, y: -22): [Wall], + (x: -81, y: -21): [Wall], + (x: -81, y: 5): [Wall], + (x: -81, y: 6): [Wall], + (x: -81, y: 17): [Wall], + (x: -81, y: 18): [Wall], + (x: -81, y: 19): [Wall], + (x: -81, y: 20): [Wall], (x: -81, y: 28): [Wall], (x: -80, y: -39): [Wall], + (x: -80, y: -23): [Wall], + (x: -80, y: -22): [Wall], + (x: -80, y: -21): [Wall], + (x: -80, y: 5): [Wall], + (x: -80, y: 6): [Wall], + (x: -80, y: 17): [Wall], + (x: -80, y: 18): [Wall], + (x: -80, y: 19): [Wall], + (x: -80, y: 20): [Wall], (x: -80, y: 28): [Wall], (x: -79, y: -39): [Wall], + (x: -79, y: -23): [Wall], + (x: -79, y: -22): [Wall], + (x: -79, y: -21): [Wall], + (x: -79, y: 17): [Wall], + (x: -79, y: 18): [Wall], + (x: -79, y: 19): [Wall], + (x: -79, y: 20): [Wall], (x: -79, y: 28): [Wall], (x: -78, y: -39): [Wall], + (x: -78, y: -23): [Wall], + (x: -78, y: -22): [Wall], + (x: -78, y: -21): [Wall], + (x: -78, y: 17): [Wall], + (x: -78, y: 18): [Wall], + (x: -78, y: 19): [Wall], + (x: -78, y: 20): [Wall], (x: -78, y: 28): [Wall], (x: -77, y: -39): [Wall], + (x: -77, y: -23): [Wall], + (x: -77, y: -22): [Wall], + (x: -77, y: -21): [Wall], + (x: -77, y: 17): [Wall], + (x: -77, y: 18): [Wall], + (x: -77, y: 19): [Wall], + (x: -77, y: 20): [Wall], (x: -77, y: 28): [Wall], (x: -76, y: -39): [Wall], + (x: -76, y: 17): [Wall], + (x: -76, y: 18): [Wall], + (x: -76, y: 19): [Wall], + (x: -76, y: 20): [Wall], (x: -76, y: 28): [Wall], (x: -75, y: -39): [Wall], + (x: -75, y: -23): [Wall], + (x: -75, y: -22): [Wall], + (x: -75, y: -21): [Wall], + (x: -75, y: 17): [Wall], + (x: -75, y: 18): [Wall], + (x: -75, y: 19): [Wall], + (x: -75, y: 20): [Wall], (x: -75, y: 28): [Wall], (x: -74, y: -39): [Wall], + (x: -74, y: -24): [Wall], + (x: -74, y: -23): [Wall], + (x: -74, y: -22): [Wall], + (x: -74, y: -21): [Wall], + (x: -74, y: 17): [Wall], + (x: -74, y: 18): [Wall], + (x: -74, y: 19): [Wall], + (x: -74, y: 20): [Wall], (x: -74, y: 28): [Wall], (x: -73, y: -39): [Wall], + (x: -73, y: -24): [Wall], + (x: -73, y: -23): [Wall], + (x: -73, y: -22): [Wall], + (x: -73, y: -21): [Wall], + (x: -73, y: 17): [Wall], + (x: -73, y: 18): [Wall], + (x: -73, y: 19): [Wall], + (x: -73, y: 20): [Wall], (x: -73, y: 28): [Wall], (x: -72, y: -39): [Wall], + (x: -72, y: -22): [Wall], + (x: -72, y: -21): [Wall], + (x: -72, y: 17): [Wall], + (x: -72, y: 18): [Wall], + (x: -72, y: 19): [Wall], + (x: -72, y: 20): [Wall], (x: -72, y: 28): [Wall], (x: -71, y: -39): [Wall], + (x: -71, y: 17): [Wall], + (x: -71, y: 18): [Wall], + (x: -71, y: 19): [Wall], + (x: -71, y: 20): [Wall], (x: -71, y: 28): [Wall], (x: -70, y: -39): [Wall], + (x: -70, y: 17): [Wall], + (x: -70, y: 18): [Wall], + (x: -70, y: 19): [Wall], + (x: -70, y: 20): [Wall], (x: -70, y: 28): [Wall], (x: -69, y: -39): [Wall], + (x: -69, y: -23): [Wall], + (x: -69, y: -22): [Wall], + (x: -69, y: -21): [Wall], + (x: -69, y: 17): [Wall], + (x: -69, y: 18): [Wall], + (x: -69, y: 19): [Wall], + (x: -69, y: 20): [Wall], (x: -69, y: 28): [Wall], (x: -68, y: -39): [Wall], + (x: -68, y: -23): [Wall], + (x: -68, y: -22): [Wall], + (x: -68, y: -21): [Wall], + (x: -68, y: 17): [Wall], + (x: -68, y: 18): [Wall], + (x: -68, y: 19): [Wall], + (x: -68, y: 20): [Wall], (x: -68, y: 28): [Wall], (x: -67, y: -39): [Wall], + (x: -67, y: -23): [Wall], + (x: -67, y: -22): [Wall], + (x: -67, y: -21): [Wall], + (x: -67, y: 17): [Wall], + (x: -67, y: 18): [Wall], + (x: -67, y: 19): [Wall], + (x: -67, y: 20): [Wall], (x: -67, y: 28): [Wall], (x: -66, y: -39): [Wall], + (x: -66, y: -23): [Wall], + (x: -66, y: -22): [Wall], + (x: -66, y: -21): [Wall], + (x: -66, y: 17): [Wall], + (x: -66, y: 18): [Wall], + (x: -66, y: 19): [Wall], + (x: -66, y: 20): [Wall], (x: -66, y: 28): [Wall], (x: -65, y: -39): [Wall], + (x: -65, y: -23): [Wall], + (x: -65, y: -22): [Wall], + (x: -65, y: -21): [Wall], + (x: -65, y: 17): [Wall], + (x: -65, y: 18): [Wall], + (x: -65, y: 19): [Wall], + (x: -65, y: 20): [Wall], (x: -65, y: 28): [Wall], (x: -64, y: -39): [Wall], + (x: -64, y: -23): [Wall], + (x: -64, y: -22): [Wall], + (x: -64, y: -21): [Wall], + (x: -64, y: 17): [Wall], + (x: -64, y: 18): [Wall], + (x: -64, y: 19): [Wall], + (x: -64, y: 20): [Wall], (x: -64, y: 28): [Wall], (x: -63, y: -39): [Wall], + (x: -63, y: 17): [Wall], + (x: -63, y: 18): [Wall], + (x: -63, y: 19): [Wall], + (x: -63, y: 20): [Wall], (x: -63, y: 28): [Wall], (x: -62, y: -39): [Wall], + (x: -62, y: 17): [Wall], + (x: -62, y: 18): [Wall], + (x: -62, y: 19): [Wall], + (x: -62, y: 20): [Wall], (x: -62, y: 28): [Wall], (x: -61, y: -39): [Wall], + (x: -61, y: 17): [Wall], + (x: -61, y: 18): [Wall], + (x: -61, y: 19): [Wall], + (x: -61, y: 20): [Wall], (x: -61, y: 28): [Wall], (x: -60, y: -39): [Wall], + (x: -60, y: 17): [Wall], + (x: -60, y: 18): [Wall], + (x: -60, y: 19): [Wall], + (x: -60, y: 20): [Wall], (x: -60, y: 28): [Wall], (x: -59, y: -39): [Wall], + (x: -59, y: 17): [Wall], + (x: -59, y: 18): [Wall], + (x: -59, y: 19): [Wall], + (x: -59, y: 20): [Wall], (x: -59, y: 28): [Wall], (x: -58, y: -39): [Wall], + (x: -58, y: 17): [Wall], + (x: -58, y: 18): [Wall], + (x: -58, y: 19): [Wall], + (x: -58, y: 20): [Wall], (x: -58, y: 28): [Wall], (x: -57, y: -39): [Wall], + (x: -57, y: 17): [Wall], + (x: -57, y: 18): [Wall], + (x: -57, y: 19): [Wall], + (x: -57, y: 20): [Wall], (x: -57, y: 28): [Wall], (x: -56, y: -39): [Wall], (x: -56, y: 28): [Wall], @@ -390,6 +607,7 @@ (x: -40, y: 25): [Wall], (x: -39, y: -40): [Wall], (x: -39, y: -39): [Wall], + (x: -39, y: -29): [Wall], (x: -39, y: -28): [Wall], (x: -39, y: -27): [Wall], (x: -39, y: -26): [Wall], @@ -403,6 +621,7 @@ (x: -39, y: 25): [Wall], (x: -38, y: -40): [Wall], (x: -38, y: -39): [Wall], + (x: -38, y: -29): [Wall], (x: -38, y: -27): [Wall], (x: -38, y: -26): [Wall], (x: -38, y: -25): [Wall], @@ -414,6 +633,8 @@ (x: -38, y: 25): [Wall], (x: -37, y: -40): [Wall], (x: -37, y: -39): [Wall], + (x: -37, y: -29): [Wall], + (x: -37, y: -25): [Wall], (x: -37, y: -16): [Wall], (x: -37, y: -15): [Wall], (x: -37, y: -14): [Wall], @@ -422,6 +643,8 @@ (x: -37, y: 25): [Wall], (x: -36, y: -40): [Wall], (x: -36, y: -39): [Wall], + (x: -36, y: -29): [Wall], + (x: -36, y: -25): [Wall], (x: -36, y: -16): [Wall], (x: -36, y: -15): [Wall], (x: -36, y: -14): [Wall], @@ -430,6 +653,8 @@ (x: -36, y: 25): [Wall], (x: -35, y: -40): [Wall], (x: -35, y: -39): [Wall], + (x: -35, y: -29): [Wall], + (x: -35, y: -25): [Wall], (x: -35, y: -16): [Wall], (x: -35, y: -15): [Wall], (x: -35, y: -14): [Wall], @@ -438,6 +663,8 @@ (x: -35, y: 25): [Wall], (x: -34, y: -40): [Wall], (x: -34, y: -39): [Wall], + (x: -34, y: -29): [Wall], + (x: -34, y: -25): [Wall], (x: -34, y: -16): [Wall], (x: -34, y: -15): [Wall], (x: -34, y: -14): [Wall], @@ -446,6 +673,8 @@ (x: -34, y: 25): [Wall], (x: -33, y: -40): [Wall], (x: -33, y: -39): [Wall], + (x: -33, y: -29): [Wall], + (x: -33, y: -25): [Wall], (x: -33, y: -16): [Wall], (x: -33, y: -15): [Wall], (x: -33, y: -14): [Wall], @@ -454,8 +683,11 @@ (x: -33, y: 25): [Wall], (x: -32, y: -40): [Wall], (x: -32, y: -39): [Wall], + (x: -32, y: -29): [Wall], (x: -32, y: -28): [Wall], (x: -32, y: -27): [Wall], + (x: -32, y: -26): [Wall], + (x: -32, y: -25): [Wall], (x: -32, y: -16): [Wall], (x: -32, y: -15): [Wall], (x: -32, y: -14): [Wall], @@ -548,6 +780,10 @@ (x: -27, y: 14): [Wall], (x: -27, y: 15): [Wall], (x: -27, y: 16): [Wall], + (x: -27, y: 21): [Local(GoodWater)], + (x: -27, y: 22): [Local(GoodWater)], + (x: -27, y: 23): [Local(GoodWater)], + (x: -27, y: 24): [Local(GoodWater)], (x: -27, y: 25): [Wall], (x: -26, y: -40): [Wall], (x: -26, y: -39): [Wall], @@ -585,6 +821,10 @@ (x: -26, y: 13): [Wall], (x: -26, y: 14): [Wall], (x: -26, y: 15): [Wall], + (x: -26, y: 21): [Local(GoodWater)], + (x: -26, y: 22): [Local(GoodWater)], + (x: -26, y: 23): [Local(GoodWater)], + (x: -26, y: 24): [Local(GoodWater)], (x: -26, y: 25): [Wall], (x: -25, y: -40): [Wall], (x: -25, y: -39): [Wall], @@ -592,6 +832,10 @@ (x: -25, y: -28): [Wall], (x: -25, y: -27): [Wall], (x: -25, y: -26): [Wall], + (x: -25, y: 21): [Local(GoodWater)], + (x: -25, y: 22): [Local(GoodWater)], + (x: -25, y: 23): [Local(GoodWater)], + (x: -25, y: 24): [Local(GoodWater)], (x: -25, y: 25): [Wall], (x: -24, y: -40): [Wall], (x: -24, y: -39): [Wall], @@ -599,6 +843,10 @@ (x: -24, y: -28): [Wall], (x: -24, y: -27): [Wall], (x: -24, y: -26): [Wall], + (x: -24, y: 21): [Local(GoodWater)], + (x: -24, y: 22): [Local(GoodWater)], + (x: -24, y: 23): [Local(GoodWater)], + (x: -24, y: 24): [Local(GoodWater)], (x: -24, y: 25): [Wall], (x: -23, y: -40): [Wall], (x: -23, y: -39): [Wall], @@ -606,6 +854,10 @@ (x: -23, y: -28): [Wall], (x: -23, y: -27): [Wall], (x: -23, y: -26): [Wall], + (x: -23, y: 21): [Local(GoodWater)], + (x: -23, y: 22): [Local(GoodWater)], + (x: -23, y: 23): [Local(GoodWater)], + (x: -23, y: 24): [Local(GoodWater)], (x: -23, y: 25): [Wall], (x: -22, y: -40): [Wall], (x: -22, y: -39): [Wall], @@ -613,6 +865,10 @@ (x: -22, y: -28): [Wall], (x: -22, y: -27): [Wall], (x: -22, y: -26): [Wall], + (x: -22, y: 21): [Local(GoodWater)], + (x: -22, y: 22): [Local(GoodWater)], + (x: -22, y: 23): [Local(GoodWater)], + (x: -22, y: 24): [Local(GoodWater)], (x: -22, y: 25): [Wall], (x: -21, y: -40): [Wall], (x: -21, y: -39): [Wall], @@ -620,6 +876,10 @@ (x: -21, y: -28): [Wall], (x: -21, y: -27): [Wall], (x: -21, y: -26): [Wall], + (x: -21, y: 21): [Local(GoodWater)], + (x: -21, y: 22): [Local(GoodWater)], + (x: -21, y: 23): [Local(GoodWater)], + (x: -21, y: 24): [Local(GoodWater)], (x: -21, y: 25): [Wall], (x: -20, y: -40): [Wall], (x: -20, y: -39): [Wall], @@ -627,6 +887,10 @@ (x: -20, y: -28): [Wall], (x: -20, y: -27): [Wall], (x: -20, y: -26): [Wall], + (x: -20, y: 21): [Local(GoodWater)], + (x: -20, y: 22): [Local(GoodWater)], + (x: -20, y: 23): [Local(GoodWater)], + (x: -20, y: 24): [Local(GoodWater)], (x: -20, y: 25): [Wall], (x: -19, y: -40): [Wall], (x: -19, y: -39): [Wall], @@ -634,6 +898,10 @@ (x: -19, y: -28): [Wall], (x: -19, y: -27): [Wall], (x: -19, y: -26): [Wall], + (x: -19, y: 21): [Local(GoodWater)], + (x: -19, y: 22): [Local(GoodWater)], + (x: -19, y: 23): [Local(GoodWater)], + (x: -19, y: 24): [Local(GoodWater)], (x: -19, y: 25): [Wall], (x: -18, y: -40): [Wall], (x: -18, y: -39): [Wall], @@ -641,6 +909,10 @@ (x: -18, y: -28): [Wall], (x: -18, y: -27): [Wall], (x: -18, y: -26): [Wall], + (x: -18, y: 21): [Local(GoodWater)], + (x: -18, y: 22): [Local(GoodWater)], + (x: -18, y: 23): [Local(GoodWater)], + (x: -18, y: 24): [Local(GoodWater)], (x: -18, y: 25): [Wall], (x: -17, y: -40): [Wall], (x: -17, y: -39): [Wall], diff --git a/main_game/assets/scenes/mall.tscn b/main_game/assets/scenes/mall.tscn index 32d6497a..e1214fbb 100644 --- a/main_game/assets/scenes/mall.tscn +++ b/main_game/assets/scenes/mall.tscn @@ -1,26 +1,26 @@ [gd_scene load_steps=35 format=3 uid="uid://drnrtwjeis0wl"] -[ext_resource type="Texture2D" uid="uid://cgvnw3xu0g55c" path="res://assets/mall/mall.png" id="1_py6kn"] -[ext_resource type="Texture2D" uid="uid://cucclesngt72y" path="res://assets/environment/vending_machine_atlas.png" id="2_83cf2"] -[ext_resource type="Texture2D" uid="uid://ckr3s6a6pkgh8" path="res://assets/mall/mallisles.png" id="3_7qiwu"] -[ext_resource type="Texture2D" uid="uid://ctx6632qwroaa" path="res://assets/mall/salebox.png" id="4_uvq87"] -[ext_resource type="Texture2D" uid="uid://kk1gkcrurjt8" path="res://assets/mall/selfcheckout.png" id="5_g377o"] -[ext_resource type="Texture2D" uid="uid://b8xjoqkbaiqyp" path="res://assets/mall/storage.png" id="6_egw2s"] -[ext_resource type="Texture2D" uid="uid://b3kynf8hs73" path="res://assets/mall/mall_gate.png" id="7_34v1c"] -[ext_resource type="Texture2D" uid="uid://cn1n1shruw5xn" path="res://assets/environment/snack_machine_atlas.png" id="8_epuyy"] -[ext_resource type="Texture2D" uid="uid://brapyya5pqurk" path="res://assets/downtown/potted_bush.png" id="10_2mfkd"] -[ext_resource type="Texture2D" uid="uid://od7278drijk8" path="res://assets/downtown/water_dispenser.png" id="11_fqe1k"] -[ext_resource type="Texture2D" uid="uid://bnjtrujdg2l5p" path="res://assets/downtown/no_smoking_sign.png" id="12_sgjlf"] -[ext_resource type="Texture2D" uid="uid://bcs5gw33o4yel" path="res://assets/residential/indoors/utility_door_atlas.png" id="13_qlspq"] -[ext_resource type="Texture2D" uid="uid://b0pfippwkkdhi" path="res://assets/residential/indoors/garland.png" id="14_vhnj1"] -[ext_resource type="Texture2D" uid="uid://cf4vsx36spow3" path="res://assets/environment/box_cardboard_sideways.png" id="16_2asfm"] -[ext_resource type="Texture2D" uid="uid://cnmyw04hi2g0s" path="res://assets/environment/box_cardboard.png" id="16_6wj3s"] -[ext_resource type="Texture2D" uid="uid://cdjms83eablk0" path="res://assets/residential/indoors/chair_orange.png" id="16_ohokb"] -[ext_resource type="Texture2D" uid="uid://b5b8jfmoq2513" path="res://assets/residential/indoors/counter_wide.png" id="17_8tma2"] -[ext_resource type="Texture2D" uid="uid://4xex1q0625dd" path="res://assets/residential/indoors/sofa_yellow_vertical.png" id="18_5n63i"] -[ext_resource type="Texture2D" uid="uid://bsle4hh6l11lu" path="res://assets/residential/indoors/kasa.png" id="19_kni5m"] -[ext_resource type="Texture2D" uid="uid://ddlopdfvnk2le" path="res://assets/residential/indoors/bonsai1.png" id="20_lrmvj"] -[ext_resource type="Texture2D" uid="uid://bhm8ysatxb48c" path="res://assets/environment/bike.png" id="21_fl3xv"] +[ext_resource type="Texture2D" uid="uid://butuw555fooa1" path="res://assets/mall/mall.png" id="1_py6kn"] +[ext_resource type="Texture2D" uid="uid://cqsdb5tp644w6" path="res://assets/environment/vending_machine_atlas.png" id="2_83cf2"] +[ext_resource type="Texture2D" uid="uid://bit4syffi4073" path="res://assets/mall/mallisles.png" id="3_7qiwu"] +[ext_resource type="Texture2D" uid="uid://ctql8gvld5oyf" path="res://assets/mall/salebox.png" id="4_uvq87"] +[ext_resource type="Texture2D" uid="uid://qs3pmngv2da2" path="res://assets/mall/selfcheckout.png" id="5_g377o"] +[ext_resource type="Texture2D" uid="uid://bqc21ow6lrmh" path="res://assets/mall/storage.png" id="6_egw2s"] +[ext_resource type="Texture2D" uid="uid://b8qjuqrx7mxvg" path="res://assets/mall/mall_gate.png" id="7_34v1c"] +[ext_resource type="Texture2D" uid="uid://c2hwtbuu2eaot" path="res://assets/environment/snack_machine_atlas.png" id="8_epuyy"] +[ext_resource type="Texture2D" uid="uid://cmpcrhxx5t7as" path="res://assets/downtown/potted_bush.png" id="10_2mfkd"] +[ext_resource type="Texture2D" uid="uid://fvsk7527x314" path="res://assets/downtown/water_dispenser.png" id="11_fqe1k"] +[ext_resource type="Texture2D" uid="uid://dimsxaiqpbmcc" path="res://assets/downtown/no_smoking_sign.png" id="12_sgjlf"] +[ext_resource type="Texture2D" uid="uid://dnj0hlb6fb6yh" path="res://assets/residential/indoors/utility_door_atlas.png" id="13_qlspq"] +[ext_resource type="Texture2D" uid="uid://b8tq8n0tjyh1g" path="res://assets/residential/indoors/garland.png" id="14_vhnj1"] +[ext_resource type="Texture2D" uid="uid://d12k76fyavn8r" path="res://assets/environment/box_cardboard_sideways.png" id="16_2asfm"] +[ext_resource type="Texture2D" uid="uid://civvvomhubmvi" path="res://assets/environment/box_cardboard.png" id="16_6wj3s"] +[ext_resource type="Texture2D" uid="uid://d1yew3ulfd387" path="res://assets/residential/indoors/chair_orange.png" id="16_ohokb"] +[ext_resource type="Texture2D" uid="uid://bkhrbsy2krgi3" path="res://assets/residential/indoors/counter_wide.png" id="17_8tma2"] +[ext_resource type="Texture2D" uid="uid://rfn41l0gfwls" path="res://assets/residential/indoors/sofa_yellow_vertical.png" id="18_5n63i"] +[ext_resource type="Texture2D" uid="uid://dhaf0k2asaokq" path="res://assets/residential/indoors/kasa.png" id="19_kni5m"] +[ext_resource type="Texture2D" uid="uid://b4a3whtmf6xdw" path="res://assets/residential/indoors/bonsai1.png" id="20_lrmvj"] +[ext_resource type="Texture2D" uid="uid://dafyw1xcbd0da" path="res://assets/environment/bike.png" id="21_fl3xv"] [sub_resource type="AtlasTexture" id="AtlasTexture_wx86m"] atlas = ExtResource("2_83cf2") @@ -179,10 +179,12 @@ texture = ExtResource("10_2mfkd") position = Vector2(0, 12) [node name="WaterDispenser" type="Sprite2D" parent="."] -z_index = -1 position = Vector2(-257.5, 67.5) texture = ExtResource("11_fqe1k") +[node name="YSort" type="Node2D" parent="WaterDispenser"] +position = Vector2(0.5, 20.5) + [node name="NoSmokingSign" type="Sprite2D" parent="."] z_index = -1 position = Vector2(-102, -153) @@ -209,44 +211,68 @@ texture = ExtResource("16_2asfm") [node name="YSort" type="Node2D" parent="BoxCardboardSideways"] position = Vector2(0, 9) -[node name="Points" type="Node2D" parent="."] - -[node name="Entrance" type="Node2D" parent="Points"] -position = Vector2(249, 133) - -[node name="Point" type="Node" parent="Points/Entrance"] +[node name="ChairOrange2" type="Sprite2D" parent="."] +position = Vector2(-231.5, 74.5) +texture = ExtResource("16_ohokb") -[node name="InspectLabel" type="Node" parent="Points/Entrance"] -metadata/zone = "ExitZone" -metadata/action = "ExitScene" -metadata/label = "Exit" -metadata/category = "Default" +[node name="YSort" type="Node2D" parent="ChairOrange2"] +position = Vector2(0.5, 12.5) [node name="ChairOrange" type="Sprite2D" parent="."] position = Vector2(-282.5, 74.5) texture = ExtResource("16_ohokb") -[node name="CounterWide" type="Sprite2D" parent="."] -position = Vector2(-241, -91) -texture = ExtResource("17_8tma2") - -[node name="ChairOrange2" type="Sprite2D" parent="."] -position = Vector2(-231.5, 74.5) -texture = ExtResource("16_ohokb") +[node name="YSort" type="Node2D" parent="ChairOrange"] +position = Vector2(0.5, 12.5) [node name="SofaYellowVertical" type="Sprite2D" parent="."] +z_index = -1 position = Vector2(-312, 116) texture = ExtResource("18_5n63i") flip_h = true -[node name="Kasa" type="Sprite2D" parent="."] -position = Vector2(-268, -110) -texture = ExtResource("19_kni5m") +[node name="CounterWide" type="Sprite2D" parent="."] +position = Vector2(-241, -91) +texture = ExtResource("17_8tma2") -[node name="Bonsai1" type="Sprite2D" parent="."] -position = Vector2(-209, -113) +[node name="Bonsai1" type="Sprite2D" parent="CounterWide"] +position = Vector2(32, -22) texture = ExtResource("20_lrmvj") +[node name="Kasa" type="Sprite2D" parent="CounterWide"] +position = Vector2(-27, -19) +texture = ExtResource("19_kni5m") + +[node name="YSort" type="Node2D" parent="CounterWide"] +position = Vector2(1, 16) + [node name="Bike" type="Sprite2D" parent="."] position = Vector2(-303, -40) texture = ExtResource("21_fl3xv") + +[node name="YSort" type="Node2D" parent="Bike"] +position = Vector2(0.5, 12.5) + +[node name="Points" type="Node2D" parent="."] + +[node name="Entrance" type="Node2D" parent="Points"] +position = Vector2(249, 133) + +[node name="Point" type="Node" parent="Points/Entrance"] + +[node name="InspectLabel" type="Node" parent="Points/Entrance"] +metadata/zone = "ExitZone" +metadata/action = "ExitScene" +metadata/label = "Exit" +metadata/category = "Default" + +[node name="GingerCatDialog" type="Node2D" parent="Points"] +position = Vector2(-65, -141) + +[node name="Point" type="Node" parent="Points/GingerCatDialog"] + +[node name="InspectLabel" type="Node" parent="Points/GingerCatDialog"] +metadata/zone = "GoodWater" +metadata/action = "StartGingerCatDialog" +metadata/label = "Good Water stand" +metadata/category = "Npc" diff --git a/main_game/src/new_game.rs b/main_game/src/new_game.rs index f8865cc7..fef43020 100644 --- a/main_game/src/new_game.rs +++ b/main_game/src/new_game.rs @@ -16,6 +16,10 @@ pub(crate) fn on_enter( ); store .add_dialog_to_npc(Character::Bolt, dialog::TypedNamespace::BoltIsMean); + store.add_dialog_to_npc( + Character::GingerCat, + dialog::TypedNamespace::MrGoodWater, + ); next_state.set(GlobalGameState::LoadingBuilding1PlayerFloor); } diff --git a/main_game_lib/src/hud/daybar.rs b/main_game_lib/src/hud/daybar.rs index 60f9e582..8c5007fb 100644 --- a/main_game_lib/src/hud/daybar.rs +++ b/main_game_lib/src/hud/daybar.rs @@ -22,7 +22,7 @@ pub struct Beats(pub isize); #[derive(Resource, Reflect)] #[reflect(Resource)] pub struct DayBar { - /// The current progress through the day, from 0 to [`DAY_LENGTH`]. + /// The current progress through the day, from 0 to [`Beats::DAY`]. pub(crate) progress: Beats, /// If the tooltip is shown, it's some with the entity that can then be /// despawned to hide it again. diff --git a/main_game_lib/src/rscn/token.rs b/main_game_lib/src/rscn/token.rs index f85c4b26..ec39e1c9 100644 --- a/main_game_lib/src/rscn/token.rs +++ b/main_game_lib/src/rscn/token.rs @@ -50,7 +50,7 @@ enum TscnToken { #[regex(r#"-?\d+(\.\d+)?"#, priority = 3)] Number, - #[regex(r#"[A-Za-z0-9_/]+|"[A-Za-z0-9_/ ]+""#, priority = 2)] + #[regex(r#"[A-Za-z0-9_/]+|"[A-Za-z0-9_/? ]+""#, priority = 2)] String, #[token("true")] True, diff --git a/main_game_lib/src/top_down/actor.rs b/main_game_lib/src/top_down/actor.rs index c3bc742b..6096de47 100644 --- a/main_game_lib/src/top_down/actor.rs +++ b/main_game_lib/src/top_down/actor.rs @@ -151,8 +151,19 @@ pub struct CharacterBundleBuilder { } /// Event that's emitted when the player clicks interaction near an NPC. +/// +/// The entity must be an [`Actor`] but not the player. #[derive(Event, Reflect, Clone)] -pub(crate) struct BeginDialogEvent(Entity); +pub struct BeginDialogEvent(pub ActorOrCharacter); + +/// Identify an NPC by entity or character. +#[derive(Reflect, Clone)] +pub enum ActorOrCharacter { + /// Identify by entity. + Actor(Entity), + /// Identify by character. + Character(Character), +} /// Sends events when an actor does something interesting. /// This system is registered on call to @@ -566,7 +577,7 @@ impl CharacterBundleBuilder { NpcInTheMap::default(), InspectLabelCategory::Npc .into_label(character.name()) - .with_emit_event_on_interacted(BeginDialogEvent(id)), + .with_emit_event_on_interacted(BeginDialogEvent(id.into())), )); } @@ -1044,3 +1055,15 @@ mod tests { } } } + +impl From for ActorOrCharacter { + fn from(entity: Entity) -> Self { + Self::Actor(entity) + } +} + +impl From for ActorOrCharacter { + fn from(character: Character) -> Self { + Self::Character(character) + } +} diff --git a/main_game_lib/src/top_down/actor/npc.rs b/main_game_lib/src/top_down/actor/npc.rs index 386b28ff..803e3a41 100644 --- a/main_game_lib/src/top_down/actor/npc.rs +++ b/main_game_lib/src/top_down/actor/npc.rs @@ -15,7 +15,7 @@ use common_ext::QueryExt; use common_store::{DialogStore, GlobalStore}; use common_story::dialog::{self, StartDialogWhenLoaded}; -use super::BeginDialogEvent; +use super::{ActorOrCharacter, BeginDialogEvent}; use crate::top_down::{ inspect_and_interact::ReadyForInteraction, layout::ZoneTile, Actor, ActorTarget, Player, TileMap, TopDownScene, @@ -310,51 +310,68 @@ pub(crate) fn begin_dialog( mut player: Query<&mut Actor, With>, mut actors: Query<&mut Actor, Without>, ) { - let Some(BeginDialogEvent(entity)) = events.read().last() else { - return; - }; - let entity = *entity; - - let Ok(mut actor) = actors.get_mut(entity) else { - // might've just despawned - e.g. walked away - return; - }; - let Some(mut player) = player.get_single_mut_or_none() else { warn!("Cannot begin dialog without a player"); return; }; - let character = actor.character; + match events.read().last() { + Some(BeginDialogEvent(ActorOrCharacter::Actor(entity))) => { + let entity = *entity; - let dialogs = store.list_dialogs_for_npc::(character); + let Ok(mut actor) = actors.get_mut(entity) else { + // might've just despawned - e.g. walked away + return; + }; - if dialogs.is_empty() { - return; - } + let character = actor.character; - let start_dialog = StartDialogWhenLoaded::portrait() - .on_finished(Box::new(move |cmd: &mut Commands| { - trace!("Removing BehaviorPaused from {character}"); - cmd.entity(entity).remove::(); - })) - .add_namespaces(dialogs); - cmd.insert_resource(start_dialog); + let dialogs = + store.list_dialogs_for_npc::(character); - { - // stops the NPC from moving + if dialogs.is_empty() { + return; + } - cmd.entity(entity).insert(BehaviorPaused); + let start_dialog = StartDialogWhenLoaded::portrait() + .on_finished(Box::new(move |cmd: &mut Commands| { + trace!("Removing BehaviorPaused from {character}"); + cmd.entity(entity).remove::(); + })) + .add_namespaces(dialogs); + cmd.insert_resource(start_dialog); - actor.remove_planned_step(); - actor.direction = actor - .current_square() - .direction_to(player.current_square()) - .unwrap_or(actor.direction); + { + // stops the NPC from moving - player.remove_planned_step(); - player.direction = actor.direction.opposite(); - } + cmd.entity(entity).insert(BehaviorPaused); + + actor.remove_planned_step(); + actor.direction = actor + .current_square() + .direction_to(player.current_square()) + .unwrap_or(actor.direction); + + player.remove_planned_step(); + player.direction = actor.direction.opposite(); + } + } + Some(BeginDialogEvent(ActorOrCharacter::Character(character))) => { + let dialogs = + store.list_dialogs_for_npc::(character); + + if dialogs.is_empty() { + return; + } + + let start_dialog = + StartDialogWhenLoaded::portrait().add_namespaces(dialogs); + cmd.insert_resource(start_dialog); + + player.remove_planned_step(); + } + None => (), + }; } impl BehaviorLeaf { diff --git a/main_game_lib/src/top_down/inspect_and_interact.rs b/main_game_lib/src/top_down/inspect_and_interact.rs index 5dda7b02..59921687 100644 --- a/main_game_lib/src/top_down/inspect_and_interact.rs +++ b/main_game_lib/src/top_down/inspect_and_interact.rs @@ -134,6 +134,9 @@ pub(crate) struct InspectLabelBg; /// /// When entities are mapped this way, they are assigned the /// [`ReadyForInteraction`] component when the player enters the given zone. +/// +/// In godot, this is done by using InspectLabel node with specific metadata. +/// See the wiki for more information. #[derive(Resource, Reflect, Default)] pub struct ZoneToInspectLabelEntity { /// The key is the local tile kind, the value is some entity that has diff --git a/scenes/building1_player_floor/src/layout.rs b/scenes/building1_player_floor/src/layout.rs index 34cde687..da47125a 100644 --- a/scenes/building1_player_floor/src/layout.rs +++ b/scenes/building1_player_floor/src/layout.rs @@ -92,7 +92,7 @@ struct Spawner<'a> { } /// The names are stored in the scene file. -/// See the [`Building1PlayerFloor`] implementation of [`SpriteScene`]. +/// See Godot scene file for details. fn spawn( mut cmd: Commands, transition: Res, diff --git a/scenes/downtown/src/layout.rs b/scenes/downtown/src/layout.rs index 95be1c0a..33e8e2ee 100644 --- a/scenes/downtown/src/layout.rs +++ b/scenes/downtown/src/layout.rs @@ -75,7 +75,7 @@ struct Spawner<'a> { } /// The names are stored in the scene file. -/// See the [`Downtown`] implementation of [`SpriteScene`]. +/// See Godot scene file for details. fn spawn( mut cmd: Commands, asset_server: Res, diff --git a/scenes/mall/docs/tile-graph.svg b/scenes/mall/docs/tile-graph.svg index 6778c128..8234f4aa 100644 --- a/scenes/mall/docs/tile-graph.svg +++ b/scenes/mall/docs/tile-graph.svg @@ -4,16 +4,22 @@ - + graph_mall - + exitzone exitzone + + +goodwater + +goodwater + diff --git a/scenes/mall/src/autogen/zone_tile_impl.rs b/scenes/mall/src/autogen/zone_tile_impl.rs index e95fd35a..c398825a 100644 --- a/scenes/mall/src/autogen/zone_tile_impl.rs +++ b/scenes/mall/src/autogen/zone_tile_impl.rs @@ -7,11 +7,13 @@ Option use main_game_lib::top_down::layout::ZoneGroup; #[allow(clippy::match_single_binding)] match self { Self::ExitZone => Some(ZoneGroup(0)), +Self::GoodWater => Some(ZoneGroup(1)), #[allow(unreachable_patterns)] _ => None, } } #[inline] fn zone_size(&self) -> Option { #[allow(clippy::match_single_binding)] match self { Self::ExitZone => Some(153), +Self::GoodWater => Some(40), #[allow(unreachable_patterns)] _ => None, } } type Successors = Self; #[inline] fn zone_successors(&self) -> Option<&'static [Self::Successors]> diff --git a/scenes/mall/src/layout.rs b/scenes/mall/src/layout.rs index 629e6d0f..a1aeb11b 100644 --- a/scenes/mall/src/layout.rs +++ b/scenes/mall/src/layout.rs @@ -1,7 +1,8 @@ use bevy::render::view::RenderLayers; use common_loading_screen::{LoadingScreenSettings, LoadingScreenState}; +use common_story::Character; use common_visuals::camera::render_layer; -use main_game_lib::cutscene::in_cutscene; +use main_game_lib::{cutscene::in_cutscene, top_down::actor::BeginDialogEvent}; use rscn::{NodeName, TscnSpawner, TscnTree, TscnTreeHandle}; use strum::IntoEnumIterator; use top_down::{ @@ -30,7 +31,8 @@ impl bevy::app::Plugin for Plugin { .add_systems(OnExit(Mall::quitting()), despawn) .add_systems( Update, - exit.run_if(on_event::()) + (exit, talk_to_ginger_cat) + .run_if(on_event::()) .run_if(Mall::in_running_state()) .run_if(not(in_cutscene())), ); @@ -150,7 +152,7 @@ impl top_down::layout::Tile for MallTileKind { #[inline] fn is_zone(&self) -> bool { match self { - Self::ExitZone => true, + Self::GoodWater | Self::ExitZone => true, } } @@ -184,3 +186,16 @@ fn exit( next_state.set(Mall::quitting()); } } + +fn talk_to_ginger_cat( + mut action_events: EventReader, + mut begin_dialog_event: EventWriter, +) { + let is_triggered = action_events + .read() + .any(|action| matches!(action, MallAction::StartGingerCatDialog)); + + if is_triggered { + begin_dialog_event.send(BeginDialogEvent(Character::GingerCat.into())); + } +} diff --git a/scenes/mall/src/lib.rs b/scenes/mall/src/lib.rs index 8c6b3043..8e4a7bac 100644 --- a/scenes/mall/src/lib.rs +++ b/scenes/mall/src/lib.rs @@ -16,7 +16,7 @@ use crate::layout::LayoutEntity; /// Important scene struct. /// We use it as identifiable generic in common logic. -#[derive(TypePath, Default)] +#[derive(TypePath, Default, Debug)] pub struct Mall; impl TopDownScene for Mall { @@ -69,15 +69,17 @@ impl WithStandardStateSemantics for Mall { pub enum MallTileKind { #[default] ExitZone, + GoodWater, } #[derive(Event, Reflect, Clone, strum::EnumString)] pub enum MallAction { ExitScene, + StartGingerCatDialog, } pub fn add(app: &mut App) { - info!("Adding Mall to app"); + info!("Adding {Mall:?} to app"); app.add_event::(); @@ -122,7 +124,7 @@ pub fn add(app: &mut App) { .run_if(Mall::in_quitting_state()), ); - info!("Added Mall to app"); + info!("Added {Mall:?} to app"); } fn finish_when_everything_loaded( @@ -139,7 +141,7 @@ fn finish_when_everything_loaded( } fn enter_the_scene(mut next_state: ResMut>) { - info!("Entering Mall"); + info!("Entering {Mall:?}"); next_state.set(Mall::running()); } @@ -148,7 +150,7 @@ fn exit( mut next_state: ResMut>, mut controls: ResMut>, ) { - info!("Leaving Mall"); + info!("Leaving {Mall:?}"); // be a good guy and don't invade other game loops with "Enter" controls.consume(&GlobalAction::Interact); @@ -159,7 +161,7 @@ fn exit( next_state.set(GlobalGameState::LoadingDowntown); } _ => { - unreachable!("Invalid Mall transition {transition:?}"); + unreachable!("Invalid {Mall:?} transition {transition:?}"); } } } diff --git a/scenes/meditation/src/cameras.rs b/scenes/meditation/src/cameras.rs index 1b8435be..0e29b2b7 100644 --- a/scenes/meditation/src/cameras.rs +++ b/scenes/meditation/src/cameras.rs @@ -95,7 +95,8 @@ fn spawn_cameras(mut cmd: Commands) { } /// This camera does not render into a window, but into a quad that's then -/// rendered by whichever camera renders the layer [`LightScene::render_layer`]. +/// rendered by whichever camera renders the layer +/// [`LightScene::render_layer_index`]. fn spawn_bg_render_camera( mut cmd: Commands, bg_camera_targets: Res>, diff --git a/scenes/meditation/src/climate.rs b/scenes/meditation/src/climate.rs index d4f50cc6..b1edbc7f 100644 --- a/scenes/meditation/src/climate.rs +++ b/scenes/meditation/src/climate.rs @@ -23,20 +23,25 @@ const OCCLUDER_SIZE: f32 = 18.0; /// Determines the ray slope. const OCCLUDER_DISTANCE: f32 = 40.0; /// Occluders are evenly distributed around the climate. -/// We calculate the distribution around for the occluder[1] (0th starts at 0). +/// We calculate the distribution around for the `occluder[1]` (0th starts at +/// 0). const INITIAL_ROTATION: f32 = 2.0 * PI / OCCLUDER_COUNT as f32; const INITIAL_HALF_ROTATION: f32 = INITIAL_ROTATION / 2.0; -/// When the mode is [`LightMode::Hot`], we deduct this much from the score. +/// When the mode is [`ClimateLightMode::Hot`], we deduct this much from the +/// score. const HOT_DEDUCTION: usize = 80; -/// How often do we deduct from the score when the mode is [`LightMode::Hot`]. +/// How often do we deduct from the score when the mode is +/// [`ClimateLightMode::Hot`]. const HOT_DEDUCTION_INTERVAL: Duration = from_millis(5_000); /// Burns Polpos, so should reflect that. const LIGHT_COLOR_HOT: Color = Color::rgb(0.6, 0.3, 0.1); /// Purply cold color. const LIGHT_COLOR_COLD: Color = crate::background::COLOR; -/// When the mode is [`LightMode::Cold`], we deduct this much from the score. +/// When the mode is [`ClimateLightMode::Cold`], we deduct this much from the +/// score. const COLD_DEDUCTION: usize = 100; -/// How often do we deduct from the score when the mode is [`LightMode::Cold`]. +/// How often do we deduct from the score when the mode is +/// [`ClimateLightMode::Cold`]. const COLD_DEDUCTION_INTERVAL: Duration = from_millis(10_000); /// How long does it take for the light to change color when changing mode. const LIGHT_COLOR_TRANSITION: Duration = from_millis(2500); diff --git a/scenes/meditation/src/hoshi/mode.rs b/scenes/meditation/src/hoshi/mode.rs index 933fbd8a..e4ce63cd 100644 --- a/scenes/meditation/src/hoshi/mode.rs +++ b/scenes/meditation/src/hoshi/mode.rs @@ -9,7 +9,7 @@ use crate::prelude::{stopwatch_at, Radians}; #[derive(Component)] pub(super) struct Normal { /// Hoshi has a limited number of jumps before it must reset - /// via the [`Climate`] + /// via the [`crate::climate::Climate`] pub(super) jumps: usize, /// there's a minimum delay between jumps pub(super) last_jump: Stopwatch, @@ -24,7 +24,7 @@ pub(super) struct Normal { #[derive(Component, Default)] pub(crate) struct LoadingSpecial { /// Angle is given by the combination of keys pressed. - /// See [`unit_circle_angle`]. + /// See `super::controls::unit_circle_angle`. pub(super) angle: Radians, /// special mode has a set duration after which it fires pub(super) activated: Stopwatch,