From cfadb5e2bfaf59377acc8d0e08f1d619652edac0 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 1 May 2024 05:01:11 +0200 Subject: [PATCH] start dev mode only when run with cargo. remove "mute_music" feature --- Cargo.toml | 3 +-- HACKING.md | 2 +- src/var.rs | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b23cfc9..ce23a4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,9 +47,8 @@ embed-resource = "1.6.3" # embedding of .exe metadata [features] default = ["x11", "embed_assets"] -mute_music = [] dev_mode = [] -dev = ["dev_mode", "mute_music", "bevy/dynamic_linking", "bevy/file_watcher"] +dev = ["dev_mode", "bevy/dynamic_linking", "bevy/file_watcher"] release_linux = ["x11", "wayland", "embed_assets"] release_windows = ["embed_assets"] wasm = ["bevy/webgl2"] diff --git a/HACKING.md b/HACKING.md index 2dc86f6..56fbb09 100644 --- a/HACKING.md +++ b/HACKING.md @@ -6,7 +6,7 @@ For development, it's recommended to use `--features dev`: cargo [run|build] --features dev ``` -This enables the following: +This enables the following, but ONLY if you run it with `cargo run`: - Mutes music by default (you can still unmute it) - Enables "dev mode", which changes the game slightly: diff --git a/src/var.rs b/src/var.rs index 55fe531..6fb9898 100644 --- a/src/var.rs +++ b/src/var.rs @@ -128,9 +128,9 @@ pub struct Settings { impl Default for Settings { fn default() -> Self { - let dev_mode = cfg!(feature = "dev_mode"); + let dev_mode = cfg!(feature = "dev_mode") && env::var("CARGO").is_ok(); let default_mute_sfx = false; - let default_mute_music = cfg!(feature = "mute_music"); + let default_mute_music = dev_mode; let version = if let Some(version) = option_env!("CARGO_PKG_VERSION") { version.to_string() } else {