Client/Server Feature Split (#63)
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
use crate::utils::{auto_rotate, explosions};
|
||||
use avian3d::prelude::*;
|
||||
use bevy::{audio::Volume, core_pipeline::tonemapping::Tonemapping, prelude::*};
|
||||
use bevy::{
|
||||
app::plugin_group,
|
||||
audio::Volume,
|
||||
core_pipeline::tonemapping::Tonemapping,
|
||||
log::{BoxedLayer, tracing_subscriber::Layer},
|
||||
prelude::*,
|
||||
};
|
||||
use bevy_common_assets::ron::RonAssetPlugin;
|
||||
use bevy_sprite3d::Sprite3dPlugin;
|
||||
use bevy_trenchbroom::prelude::*;
|
||||
@@ -11,8 +17,61 @@ use shared::*;
|
||||
use std::time::Duration;
|
||||
use utils::{billboards, sprite_3d_animation, squish_animation, trail};
|
||||
|
||||
mod config;
|
||||
mod server;
|
||||
|
||||
plugin_group! {
|
||||
pub struct DefaultPlugins {
|
||||
bevy::app:::PanicHandlerPlugin,
|
||||
bevy::log:::LogPlugin,
|
||||
bevy::app:::TaskPoolPlugin,
|
||||
bevy::diagnostic:::FrameCountPlugin,
|
||||
bevy::time:::TimePlugin,
|
||||
bevy::transform:::TransformPlugin,
|
||||
bevy::diagnostic:::DiagnosticsPlugin,
|
||||
bevy::input:::InputPlugin,
|
||||
bevy::app:::ScheduleRunnerPlugin,
|
||||
bevy::window:::WindowPlugin,
|
||||
bevy::a11y:::AccessibilityPlugin,
|
||||
bevy::app:::TerminalCtrlCHandlerPlugin,
|
||||
bevy::asset:::AssetPlugin,
|
||||
bevy::scene:::ScenePlugin,
|
||||
bevy::render:::RenderPlugin,
|
||||
bevy::render::texture:::ImagePlugin,
|
||||
bevy::render::pipelined_rendering:::PipelinedRenderingPlugin,
|
||||
bevy::core_pipeline:::CorePipelinePlugin,
|
||||
bevy::sprite:::SpritePlugin,
|
||||
bevy::text:::TextPlugin,
|
||||
bevy::ui:::UiPlugin,
|
||||
bevy::pbr:::PbrPlugin,
|
||||
bevy::gltf:::GltfPlugin,
|
||||
bevy::audio:::AudioPlugin,
|
||||
bevy::gilrs:::GilrsPlugin,
|
||||
bevy::animation:::AnimationPlugin,
|
||||
bevy::gizmos:::GizmoPlugin,
|
||||
bevy::state::app:::StatesPlugin,
|
||||
#[plugin_group]
|
||||
bevy::picking:::DefaultPickingPlugins,
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -26,28 +85,13 @@ fn main() {
|
||||
cam_follow: true,
|
||||
});
|
||||
|
||||
app.add_plugins(
|
||||
DefaultPlugins
|
||||
.set(WindowPlugin {
|
||||
primary_window: Some(Window {
|
||||
title: "HEDZ Reloaded".into(),
|
||||
// resolution: (1024., 768.).into(),
|
||||
..default()
|
||||
}),
|
||||
..default()
|
||||
})
|
||||
.set(bevy::log::LogPlugin {
|
||||
filter: "info".into(),
|
||||
level: bevy::log::Level::INFO,
|
||||
// provide custom log layer to receive logging events
|
||||
custom_layer: bevy_debug_log::log_capture_layer,
|
||||
}),
|
||||
);
|
||||
app.add_plugins(DefaultPlugins.set(bevy::log::LogPlugin {
|
||||
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,
|
||||
}));
|
||||
|
||||
app.add_plugins(
|
||||
bevy_debug_log::LogViewerPlugin::default()
|
||||
.auto_open_threshold(bevy::log::tracing::level_filters::LevelFilter::OFF),
|
||||
);
|
||||
app.add_plugins(ServerPlugins {
|
||||
tick_duration: Duration::from_secs_f32(1.0 / 60.0),
|
||||
});
|
||||
@@ -78,6 +122,7 @@ fn main() {
|
||||
app.add_plugins(animation::plugin);
|
||||
app.add_plugins(character::plugin);
|
||||
app.add_plugins(cash::plugin);
|
||||
app.add_plugins(config::plugin);
|
||||
app.add_plugins(player::plugin);
|
||||
app.add_plugins(gates::plugin);
|
||||
app.add_plugins(platforms::plugin);
|
||||
|
||||
Reference in New Issue
Block a user