From d32cdab880416c4d22e1c150bee6446345c18e6c Mon Sep 17 00:00:00 2001 From: necrashter Date: Sat, 9 Dec 2023 14:53:50 +0300 Subject: [PATCH] Add new upgrades for manual line generation --- src/upgrade.rs | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/upgrade.rs b/src/upgrade.rs index 30571ea..987a677 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -713,7 +713,45 @@ generate_upgrade_list!( desc: "Doubles the number of characters typed per key press.".to_string(), sound: Some(SoundEffectKind::Keyboard), base_cost: 50.0, - weight: 0.5, + weight: 2.0, + install: Some(world.register_system(|mut typer_query: Query<&mut CodeTyper>| { + for mut typer in &mut typer_query { + typer.chars_per_key *= 2; + } + })), + ..default() + }, + TouchTyping: Upgrade { + name: "Touch Typing".to_string(), + desc: "\ + Improves your typing skills. \ + Doubles the number of characters typed per key press. \ + ".to_string(), + sound: Some(SoundEffectKind::Keyboard), + installed_min: vec![(MechanicalKeyboard, 1)], + base_cost: 100.0, + weight: 1.0, + remaining: 4, + install: Some(world.register_system(| + mut typer_query: Query<&mut CodeTyper>, + mut upgrade_list: ResMut, + | { + let this = &mut upgrade_list[TouchTyping]; + // Cost scaling of this is independent of tech debt. + this.base_cost *= 4.0; + for mut typer in &mut typer_query { + typer.chars_per_key *= 2; + } + })), + ..default() + }, + DvorakLayout: Upgrade { + name: "Dvorak Layout".to_string(), + desc: "Doubles the number of characters typed per key press.".to_string(), + sound: Some(SoundEffectKind::Keyboard), + installed_min: vec![(TouchTyping, 4)], + base_cost: 200_000.0, + weight: 0.25, install: Some(world.register_system(|mut typer_query: Query<&mut CodeTyper>| { for mut typer in &mut typer_query { typer.chars_per_key *= 2;