Replicate Sounds (#68)
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
use avian3d::prelude::*;
|
||||
use bevy::{
|
||||
app::plugin_group,
|
||||
audio::Volume,
|
||||
core_pipeline::tonemapping::Tonemapping,
|
||||
log::{BoxedLayer, tracing_subscriber::Layer},
|
||||
prelude::*,
|
||||
};
|
||||
use bevy::{app::plugin_group, core_pipeline::tonemapping::Tonemapping, prelude::*};
|
||||
use bevy_common_assets::ron::RonAssetPlugin;
|
||||
use bevy_sprite3d::Sprite3dPlugin;
|
||||
use bevy_trenchbroom::prelude::*;
|
||||
@@ -14,10 +8,12 @@ use lightyear::prelude::server::ServerPlugins;
|
||||
use shared::{DebugVisuals, GameState, heads_database::HeadDatabaseAsset};
|
||||
use std::time::Duration;
|
||||
|
||||
mod backpack;
|
||||
mod config;
|
||||
mod player;
|
||||
mod server;
|
||||
mod tb_entities;
|
||||
mod utils;
|
||||
|
||||
plugin_group! {
|
||||
pub struct DefaultPlugins {
|
||||
@@ -44,7 +40,6 @@ plugin_group! {
|
||||
bevy::ui:::UiPlugin,
|
||||
bevy::pbr:::PbrPlugin,
|
||||
bevy::gltf:::GltfPlugin,
|
||||
bevy::audio:::AudioPlugin,
|
||||
bevy::gilrs:::GilrsPlugin,
|
||||
bevy::animation:::AnimationPlugin,
|
||||
bevy::gizmos:::GizmoPlugin,
|
||||
@@ -54,23 +49,6 @@ plugin_group! {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_to_file_layer(_app: &mut App) -> Option<BoxedLayer> {
|
||||
let file = std::fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.open("server.log")
|
||||
.ok()?;
|
||||
Some(
|
||||
bevy::log::tracing_subscriber::fmt::layer()
|
||||
.with_writer(std::sync::Mutex::new(file))
|
||||
.with_ansi(false)
|
||||
.with_file(true)
|
||||
.with_line_number(true)
|
||||
.boxed(),
|
||||
)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut app = App::new();
|
||||
|
||||
@@ -88,7 +66,7 @@ fn main() {
|
||||
filter: "info,lightyear_replication=off".into(),
|
||||
level: bevy::log::Level::INFO,
|
||||
// provide custom log layer to receive logging events
|
||||
custom_layer: log_to_file_layer,
|
||||
..default()
|
||||
}));
|
||||
|
||||
app.add_plugins(ServerPlugins {
|
||||
@@ -102,17 +80,6 @@ fn main() {
|
||||
app.add_plugins(UiGradientsPlugin);
|
||||
app.add_plugins(RonAssetPlugin::<HeadDatabaseAsset>::new(&["headsdb.ron"]));
|
||||
|
||||
#[cfg(feature = "dbg")]
|
||||
{
|
||||
app.add_plugins(PhysicsDebugPlugin::default());
|
||||
|
||||
// app.add_plugins(bevy::pbr::wireframe::WireframePlugin)
|
||||
// .insert_resource(bevy::pbr::wireframe::WireframeConfig {
|
||||
// global: true,
|
||||
// default_color: bevy::color::palettes::css::WHITE.into(),
|
||||
// });
|
||||
}
|
||||
|
||||
app.add_plugins(shared::abilities::plugin);
|
||||
app.add_plugins(shared::ai::plugin);
|
||||
app.add_plugins(shared::aim::plugin);
|
||||
@@ -127,7 +94,6 @@ fn main() {
|
||||
app.add_plugins(shared::gates::plugin);
|
||||
app.add_plugins(shared::head_drop::plugin);
|
||||
app.add_plugins(shared::heads::plugin);
|
||||
app.add_plugins(shared::heal_effect::plugin);
|
||||
app.add_plugins(shared::hitpoints::plugin);
|
||||
app.add_plugins(shared::keys::plugin);
|
||||
app.add_plugins(shared::loading_assets::LoadingPlugin);
|
||||
@@ -137,7 +103,6 @@ fn main() {
|
||||
app.add_plugins(shared::platforms::plugin);
|
||||
app.add_plugins(shared::player::plugin);
|
||||
app.add_plugins(shared::protocol::plugin);
|
||||
app.add_plugins(shared::sounds::plugin);
|
||||
app.add_plugins(shared::steam::plugin);
|
||||
app.add_plugins(shared::tb_entities::plugin);
|
||||
app.add_plugins(shared::utils::auto_rotate::plugin);
|
||||
@@ -149,20 +114,20 @@ fn main() {
|
||||
app.add_plugins(shared::utils::plugin);
|
||||
app.add_plugins(shared::water::plugin);
|
||||
|
||||
app.add_plugins(backpack::plugin);
|
||||
app.add_plugins(config::plugin);
|
||||
app.add_plugins(player::plugin);
|
||||
app.add_plugins(server::plugin);
|
||||
app.add_plugins(tb_entities::plugin);
|
||||
app.add_plugins(utils::plugin);
|
||||
|
||||
app.init_state::<GameState>();
|
||||
|
||||
app.insert_resource(AmbientLight {
|
||||
color: Color::WHITE,
|
||||
brightness: 400.,
|
||||
..Default::default()
|
||||
});
|
||||
app.insert_resource(ClearColor(Color::BLACK));
|
||||
//TODO: let user control this
|
||||
app.insert_resource(GlobalVolume::new(Volume::Linear(0.4)));
|
||||
app.add_systems(PostStartup, setup_panic_handler);
|
||||
|
||||
app.run();
|
||||
}
|
||||
|
||||
fn setup_panic_handler() {
|
||||
_ = std::panic::take_hook();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user