code sharing for steam setup

+ strip server a bit more
This commit is contained in:
2025-07-05 17:53:54 +01:00
parent 132db8dbe8
commit f993c6f7de
6 changed files with 107 additions and 246 deletions

View File

@@ -25,6 +25,7 @@ pub mod physics_layers;
pub mod platforms;
pub mod player;
pub mod sounds;
pub mod steam;
pub mod tb_entities;
pub mod utils;
pub mod water;

View File

@@ -0,0 +1,25 @@
use bevy::prelude::*;
use bevy_steamworks::SteamworksPlugin;
pub fn plugin(app: &mut App) {
let app_id = 1603000;
// should only be done in production builds
#[cfg(not(debug_assertions))]
if steamworks::restart_app_if_necessary(app_id.into()) {
info!("Restarting app via steam");
return;
}
info!("steam app init: {app_id}");
match SteamworksPlugin::init_app(app_id) {
Ok(plugin) => {
info!("steam app init done");
app.add_plugins(plugin);
}
Err(e) => {
warn!("steam init error: {e:?}");
}
};
}