From 63257376d6e51ffb86eac1cc977eed66cebec5e1 Mon Sep 17 00:00:00 2001 From: Ben Frankel Date: Sun, 10 Dec 2023 14:30:01 -0800 Subject: [PATCH] Add Initial Commit and UtilPlugin --- src/upgrade.rs | 52 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/src/upgrade.rs b/src/upgrade.rs index 8839496..5a51eaa 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -341,14 +341,15 @@ fn load_upgrade_sequence(mut commands: Commands) { String::new(), ), ( - vec![Inspiration], + vec![InitialCommit], "\"Much better. Now I can get started.\"".to_string(), ), ( vec![TouchOfLifePlugin], "\"I don't know what I'm making, but I should start spawning entities.\"".to_string(), ), - (vec![ImportLibrary], String::new()), + (vec![Inspiration], "Is 50 a lot of entities?".to_string()), + (vec![ImportLibrary, UtilPlugin], String::new()), ( vec![SkinPlugin], "\"I should make the game look nice for a higher Presentation score.\"".to_string(), @@ -397,6 +398,14 @@ generate_upgrade_list!( // Exposition + InitialCommit: Upgrade { + name: "Initial Commit".to_string(), + desc: "Hello world! The first step of your journey.".to_string(), + no_outline: true, + base_cost: 2.0, + ..default() + }, + Inspiration: Upgrade { name: "Inspiration".to_string(), desc: "Allows new types of upgrades to unlock when you have enough entities.".to_string(), @@ -405,6 +414,29 @@ generate_upgrade_list!( ..default() }, + UtilPlugin: Upgrade { + name: "UtilPlugin".to_string(), + desc: "Immediately quadruples lines and entities.".to_string(), + tech_debt: -1.0, + base_cost: 15.0, + entity_min: 50.0, + install: Some(world.register_system(| + mut simulation: ResMut, + upgrade_list: Res, + | { + let this = &upgrade_list[UtilPlugin]; + + // Restore the spent lines before quadrupling + simulation.tech_debt += this.tech_debt; + simulation.lines += this.cost(&simulation); + simulation.tech_debt -= this.tech_debt; + + simulation.lines *= 4.0; + simulation.entities *= 4.0; + })), + ..default() + }, + // Presentation score GfxSpecialization: Upgrade { @@ -615,11 +647,23 @@ generate_upgrade_list!( TouchOfLifePlugin: Upgrade { name: "TouchOfLifePlugin".to_string(), - desc: "Spawns 1 entity whenever you click inside the scene view.".to_string(), + desc: "\ + Spawns 1 entity whenever you click inside the scene view, \ + and one right now as a treat.\ + ".to_string(), tech_debt: 1.0, base_cost: 5.0, install: Some( - world.register_system(|mut scene_view_query: Query<&mut SceneView>| { + world.register_system(| + mut events: EventWriter, + bounds: Res, + mut scene_view_query: Query<&mut SceneView>, + | { + events.send(SpawnEvent { + position: (bounds.min.xy() + bounds.max.xy()) / 2.0, + count: 1.0, + }); + for mut scene_view in &mut scene_view_query { scene_view.spawns_per_click += 1.0; }