From 285c9923c1740a3ffa7591896cd521189fa2725b Mon Sep 17 00:00:00 2001 From: necrashter Date: Fri, 8 Dec 2023 21:51:32 +0300 Subject: [PATCH] Add no_outline field to Upgrade --- src/state/editor_screen/outline_panel.rs | 3 ++- src/upgrade.rs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/state/editor_screen/outline_panel.rs b/src/state/editor_screen/outline_panel.rs index b5bdc26..8674610 100644 --- a/src/state/editor_screen/outline_panel.rs +++ b/src/state/editor_screen/outline_panel.rs @@ -161,8 +161,9 @@ fn update_outline_container( let count = outline.0.entry(upgrade_kind).or_insert(0); *count += 1; + // Don't spawn if marked as no_outline // Don't spawn a new outline entry if it's a duplicate - if *count >= 2 { + if upgrade_list[upgrade_kind].no_outline || *count >= 2 { continue; } diff --git a/src/upgrade.rs b/src/upgrade.rs index 073e478..ead39a5 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -71,6 +71,9 @@ pub struct Upgrade { /// The multiplier to the cost of this upgrade per unit of technical debt. pub cost_scale_factor: f64, + /// If true, this upgrade won't be added to the outline and won't count as an upgrade. + pub no_outline: bool, + /// The minimum number of entities required for this upgrade to be offered. pub entity_min: f64, /// The maximum number of entities allowed for this upgrade to be offered. @@ -117,6 +120,8 @@ impl Default for Upgrade { base_cost: 0.0, cost_scale_factor: 1.0, + no_outline: false, + entity_min: 0.0, entity_max: f64::INFINITY, line_min: 0.0, @@ -175,11 +180,13 @@ fn process_new_installed_upgrades( for event in events.read() { let upgrade = &mut upgrade_list[event.0]; upgrade.remaining -= 1; - simulation.upgrades += 1; simulation.tech_debt += upgrade.tech_debt; simulation.presentation_score += upgrade.presentation_score; simulation.fun_score += upgrade.fun_score; - audio.play(audio_assets.random_upgrade()); + if !upgrade.no_outline { + simulation.upgrades += 1; + audio.play(audio_assets.random_upgrade()); + } } } @@ -379,6 +386,7 @@ generate_upgrade_list!( name: "Inspiration".to_string(), desc: "Allows new types of upgrades to unlock when you have enough entities.".to_string(), tech_debt: 0.0, + no_outline: true, ..default() }, @@ -817,6 +825,7 @@ generate_upgrade_list!( base_cost: 0.0, upgrade_min: 20, weight: 2.5, + no_outline: true, install: Some(world.register_system(|mut sequence: ResMut| { sequence.forced_list = Some(( vec![TenXDev, RockstarDev], @@ -896,6 +905,7 @@ generate_upgrade_list!( tech_debt: 0.0, base_cost: 1.0, remaining: usize::MAX, + no_outline: true, install: Some(world.register_system(|mut list: ResMut| { list[BrainstormAgain].base_cost *= 2.0; })),