Compare commits
No commits in common. "de9b8d99e88ea9349bb24fd642b9ace9ddc2d926" and "e9a1580ce7cb5185965d65863fcbae43249d31a9" have entirely different histories.
de9b8d99e8
...
e9a1580ce7
26
src/actor.rs
26
src/actor.rs
|
@ -35,35 +35,29 @@ impl Plugin for ActorPlugin {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
FixedUpdate,
|
FixedUpdate,
|
||||||
(
|
(
|
||||||
update_physics_lifeforms.run_if(game_running),
|
update_physics_lifeforms,
|
||||||
update_power.run_if(game_running),
|
update_power,
|
||||||
handle_gravity.run_if(game_running),
|
handle_gravity,
|
||||||
handle_wants_maxrotation.run_if(game_running),
|
handle_wants_maxrotation,
|
||||||
handle_wants_maxvelocity
|
handle_wants_maxvelocity.run_if(any_with_component::<WantsMaxVelocity>),
|
||||||
.run_if(game_running)
|
handle_wants_lookat.run_if(alive),
|
||||||
.run_if(any_with_component::<WantsMaxVelocity>),
|
|
||||||
handle_wants_lookat.run_if(game_running).run_if(alive),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
handle_gforce
|
handle_gforce
|
||||||
.run_if(game_running)
|
|
||||||
.after(PhysicsSet::Sync)
|
.after(PhysicsSet::Sync)
|
||||||
.after(sync::position_to_transform),
|
.after(sync::position_to_transform),
|
||||||
);
|
);
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(
|
(
|
||||||
handle_input.run_if(in_control).run_if(game_running),
|
handle_input.run_if(in_control),
|
||||||
handle_collisions.run_if(game_running),
|
handle_collisions,
|
||||||
handle_damage.run_if(game_running),
|
handle_damage,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
app.add_systems(
|
app.add_systems(PostUpdate, (handle_vehicle_enter_exit,));
|
||||||
PostUpdate,
|
|
||||||
(handle_vehicle_enter_exit.run_if(game_running),),
|
|
||||||
);
|
|
||||||
app.add_event::<VehicleEnterExitEvent>();
|
app.add_event::<VehicleEnterExitEvent>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,23 +32,15 @@ pub struct CameraPlugin;
|
||||||
impl Plugin for CameraPlugin {
|
impl Plugin for CameraPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(Startup, setup_camera);
|
app.add_systems(Startup, setup_camera);
|
||||||
app.add_systems(Update, handle_input.run_if(in_control).run_if(game_running));
|
app.add_systems(Update, handle_input.run_if(in_control));
|
||||||
app.add_systems(
|
app.add_systems(Update, update_map_only_object_visibility.run_if(alive));
|
||||||
Update,
|
|
||||||
update_map_only_object_visibility
|
|
||||||
.run_if(alive)
|
|
||||||
.run_if(game_running),
|
|
||||||
);
|
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
manage_player_actor
|
manage_player_actor.in_set(sync::SyncSet::PositionToTransform),
|
||||||
.run_if(game_running)
|
|
||||||
.in_set(sync::SyncSet::PositionToTransform),
|
|
||||||
);
|
);
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
sync_camera_to_player
|
sync_camera_to_player
|
||||||
.run_if(game_running)
|
|
||||||
.after(PhysicsSet::Sync)
|
.after(PhysicsSet::Sync)
|
||||||
.after(apply_input_to_player)
|
.after(apply_input_to_player)
|
||||||
.before(TransformSystem::TransformPropagate),
|
.before(TransformSystem::TransformPropagate),
|
||||||
|
@ -56,16 +48,12 @@ impl Plugin for CameraPlugin {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
update_mapcam_center
|
update_mapcam_center
|
||||||
.run_if(game_running)
|
|
||||||
.before(sync::position_to_transform)
|
.before(sync::position_to_transform)
|
||||||
.in_set(sync::SyncSet::PositionToTransform),
|
.in_set(sync::SyncSet::PositionToTransform),
|
||||||
);
|
);
|
||||||
app.add_systems(
|
app.add_systems(Update, update_map_camera.run_if(in_control));
|
||||||
Update,
|
app.add_systems(Update, update_fov.run_if(alive));
|
||||||
update_map_camera.run_if(in_control).run_if(game_running),
|
app.add_systems(PreUpdate, apply_input_to_player);
|
||||||
);
|
|
||||||
app.add_systems(Update, update_fov.run_if(alive).run_if(game_running));
|
|
||||||
app.add_systems(PreUpdate, apply_input_to_player.run_if(game_running));
|
|
||||||
app.insert_resource(MapCam::default());
|
app.insert_resource(MapCam::default());
|
||||||
|
|
||||||
// To center the renderer origin on the player camera,
|
// To center the renderer origin on the player camera,
|
||||||
|
@ -78,7 +66,6 @@ impl Plugin for CameraPlugin {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
position_to_transform
|
position_to_transform
|
||||||
.run_if(game_running)
|
|
||||||
.after(sync::position_to_transform)
|
.after(sync::position_to_transform)
|
||||||
.in_set(sync::SyncSet::PositionToTransform),
|
.in_set(sync::SyncSet::PositionToTransform),
|
||||||
);
|
);
|
||||||
|
|
20
src/chat.rs
20
src/chat.rs
|
@ -75,20 +75,12 @@ impl Plugin for ChatPlugin {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(
|
(
|
||||||
handle_reply_keys
|
handle_reply_keys.before(handle_chat_timer),
|
||||||
.run_if(game_running)
|
handle_chat_timer.before(handle_chat_events),
|
||||||
.before(handle_chat_timer),
|
handle_new_conversations.before(handle_chat_events),
|
||||||
handle_chat_timer
|
handle_chat_events.before(handle_chat_scripts),
|
||||||
.run_if(game_running)
|
handle_chat_scripts,
|
||||||
.before(handle_chat_events),
|
update_chat_variables,
|
||||||
handle_new_conversations
|
|
||||||
.run_if(game_running)
|
|
||||||
.before(handle_chat_events),
|
|
||||||
handle_chat_events
|
|
||||||
.run_if(game_running)
|
|
||||||
.before(handle_chat_scripts),
|
|
||||||
handle_chat_scripts.run_if(game_running),
|
|
||||||
update_chat_variables.run_if(game_running),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
app.add_event::<StartConversationEvent>();
|
app.add_event::<StartConversationEvent>();
|
||||||
|
|
16
src/cmd.rs
16
src/cmd.rs
|
@ -29,21 +29,15 @@ impl Plugin for CmdPlugin {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
handle_spawn_events
|
handle_spawn_events
|
||||||
.run_if(game_running)
|
|
||||||
.before(spawn_entities)
|
.before(spawn_entities)
|
||||||
.before(spawn_scenes),
|
.before(spawn_scenes),
|
||||||
);
|
);
|
||||||
app.add_systems(Update, spawn_entities.run_if(game_running));
|
app.add_systems(Update, spawn_entities);
|
||||||
app.add_systems(
|
app.add_systems(Update, spawn_scenes.after(spawn_entities));
|
||||||
Update,
|
app.add_systems(Update, process_mesh);
|
||||||
spawn_scenes.run_if(game_running).after(spawn_entities),
|
|
||||||
);
|
|
||||||
app.add_systems(Update, process_mesh.run_if(game_running));
|
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PreUpdate,
|
PreUpdate,
|
||||||
hide_colliders
|
hide_colliders.run_if(any_with_component::<NeedsSceneColliderRemoved>),
|
||||||
.run_if(game_running)
|
|
||||||
.run_if(any_with_component::<NeedsSceneColliderRemoved>),
|
|
||||||
);
|
);
|
||||||
app.add_event::<SpawnEvent>();
|
app.add_event::<SpawnEvent>();
|
||||||
app.add_event::<SpawnActorEvent>();
|
app.add_event::<SpawnActorEvent>();
|
||||||
|
@ -1096,7 +1090,7 @@ fn spawn_entities(
|
||||||
actor.insert(actor::Identifier(state.id.clone()));
|
actor.insert(actor::Identifier(state.id.clone()));
|
||||||
id2pos.0.insert(state.id.clone(), absolute_pos);
|
id2pos.0.insert(state.id.clone(), absolute_pos);
|
||||||
}
|
}
|
||||||
if !state.chat.is_empty() {
|
if !state.chat.is_empty() {
|
||||||
actor.insert(chat::Talker {
|
actor.insert(chat::Talker {
|
||||||
actor_id: state.id.clone(),
|
actor_id: state.id.clone(),
|
||||||
chat_name: state.chat.clone(),
|
chat_name: state.chat.clone(),
|
||||||
|
|
|
@ -72,10 +72,6 @@ pub fn in_control(settings: Res<Settings>) -> bool {
|
||||||
return settings.in_control();
|
return settings.in_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn game_running(settings: Res<Settings>) -> bool {
|
|
||||||
return settings.is_game_running();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn in_shadow(
|
pub fn in_shadow(
|
||||||
light_source_pos: DVec3,
|
light_source_pos: DVec3,
|
||||||
light_source_r: f64,
|
light_source_r: f64,
|
||||||
|
|
36
src/game.rs
36
src/game.rs
|
@ -26,28 +26,20 @@ pub struct GamePlugin;
|
||||||
impl Plugin for GamePlugin {
|
impl Plugin for GamePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(Startup, setup);
|
app.add_systems(Startup, setup);
|
||||||
app.add_systems(
|
app.add_systems(Update, handle_cheats.run_if(in_control));
|
||||||
Update,
|
app.add_systems(Update, debug);
|
||||||
handle_cheats.run_if(game_running).run_if(in_control),
|
|
||||||
);
|
|
||||||
app.add_systems(Update, debug.run_if(game_running));
|
|
||||||
app.add_systems(PostUpdate, handle_game_event);
|
app.add_systems(PostUpdate, handle_game_event);
|
||||||
app.add_systems(Update, handle_window_focus);
|
app.add_systems(PreUpdate, handle_player_death);
|
||||||
app.add_systems(PreUpdate, handle_player_death.run_if(game_running));
|
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
update_id2pos
|
update_id2pos.in_set(bevy_xpbd_3d::plugins::sync::SyncSet::PositionToTransform),
|
||||||
.run_if(game_running)
|
|
||||||
.in_set(bevy_xpbd_3d::plugins::sync::SyncSet::PositionToTransform),
|
|
||||||
);
|
);
|
||||||
app.add_systems(PostUpdate, update_id2v);
|
app.add_systems(PostUpdate, update_id2v);
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
handle_achievement_event
|
handle_achievement_event.run_if(on_event::<AchievementEvent>()),
|
||||||
.run_if(game_running)
|
|
||||||
.run_if(on_event::<AchievementEvent>()),
|
|
||||||
);
|
);
|
||||||
app.add_systems(Update, check_achievements.run_if(game_running));
|
app.add_systems(Update, check_achievements);
|
||||||
app.insert_resource(Id2Pos(HashMap::new()));
|
app.insert_resource(Id2Pos(HashMap::new()));
|
||||||
app.insert_resource(Id2V(HashMap::new()));
|
app.insert_resource(Id2V(HashMap::new()));
|
||||||
app.insert_resource(JupiterPos(DVec3::ZERO));
|
app.insert_resource(JupiterPos(DVec3::ZERO));
|
||||||
|
@ -617,19 +609,3 @@ fn check_achievements(
|
||||||
ew_achievement.send(AchievementEvent::InJupitersShadow);
|
ew_achievement.send(AchievementEvent::InJupitersShadow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_window_focus(
|
|
||||||
mut settings: ResMut<Settings>,
|
|
||||||
mut er_focus: EventReader<bevy::window::WindowFocused>,
|
|
||||||
mut physicstime: ResMut<Time<Physics>>,
|
|
||||||
) {
|
|
||||||
for event in er_focus.read() {
|
|
||||||
settings.window_focused = event.focused;
|
|
||||||
}
|
|
||||||
|
|
||||||
if settings.is_game_running() {
|
|
||||||
physicstime.unpause();
|
|
||||||
} else {
|
|
||||||
physicstime.pause();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
21
src/hud.rs
21
src/hud.rs
|
@ -57,31 +57,26 @@ impl Plugin for HudPlugin {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(
|
(
|
||||||
update_hud.run_if(game_running),
|
update_hud,
|
||||||
update_dashboard.run_if(game_running),
|
update_dashboard,
|
||||||
update_speedometer.run_if(game_running),
|
update_speedometer,
|
||||||
update_gauges.run_if(game_running),
|
update_gauges,
|
||||||
handle_input.run_if(game_running).run_if(in_control),
|
handle_input.run_if(in_control),
|
||||||
handle_target_event.run_if(game_running),
|
handle_target_event,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
(
|
(
|
||||||
update_overlay_visibility.run_if(game_running),
|
update_overlay_visibility,
|
||||||
update_avatar
|
update_avatar.run_if(on_event::<UpdateAvatarEvent>()),
|
||||||
.run_if(game_running)
|
|
||||||
.run_if(on_event::<UpdateAvatarEvent>()),
|
|
||||||
update_ar_overlays
|
update_ar_overlays
|
||||||
.run_if(game_running)
|
|
||||||
.after(camera::position_to_transform)
|
.after(camera::position_to_transform)
|
||||||
.in_set(sync::SyncSet::PositionToTransform),
|
.in_set(sync::SyncSet::PositionToTransform),
|
||||||
update_poi_overlays
|
update_poi_overlays
|
||||||
.run_if(game_running)
|
|
||||||
.after(camera::position_to_transform)
|
.after(camera::position_to_transform)
|
||||||
.in_set(sync::SyncSet::PositionToTransform),
|
.in_set(sync::SyncSet::PositionToTransform),
|
||||||
update_target_selectagon
|
update_target_selectagon
|
||||||
.run_if(game_running)
|
|
||||||
.after(PhysicsSet::Sync)
|
.after(PhysicsSet::Sync)
|
||||||
.after(camera::apply_input_to_player)
|
.after(camera::apply_input_to_player)
|
||||||
.before(TransformSystem::TransformPropagate),
|
.before(TransformSystem::TransformPropagate),
|
||||||
|
|
|
@ -39,7 +39,6 @@ pub struct Settings {
|
||||||
pub god_mode: bool,
|
pub god_mode: bool,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
pub alive: bool,
|
pub alive: bool,
|
||||||
pub window_focused: bool,
|
|
||||||
pub mute_sfx: bool,
|
pub mute_sfx: bool,
|
||||||
pub noise_cancellation_mode: usize,
|
pub noise_cancellation_mode: usize,
|
||||||
pub noise_cancellation_modes: Vec<(String, f32)>,
|
pub noise_cancellation_modes: Vec<(String, f32)>,
|
||||||
|
@ -172,7 +171,6 @@ impl Default for Settings {
|
||||||
god_mode: false,
|
god_mode: false,
|
||||||
version,
|
version,
|
||||||
alive: true,
|
alive: true,
|
||||||
window_focused: true,
|
|
||||||
mute_sfx: false,
|
mute_sfx: false,
|
||||||
noise_cancellation_mode: 0,
|
noise_cancellation_mode: 0,
|
||||||
noise_cancellation_modes: vec![
|
noise_cancellation_modes: vec![
|
||||||
|
@ -310,10 +308,6 @@ impl Settings {
|
||||||
*self = Self::default();
|
*self = Self::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_game_running(&self) -> bool {
|
|
||||||
!self.menu_active && self.window_focused
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reset_player_settings(&mut self) {
|
pub fn reset_player_settings(&mut self) {
|
||||||
println!("Resetting player settings!");
|
println!("Resetting player settings!");
|
||||||
let default = Self::default();
|
let default = Self::default();
|
||||||
|
|
|
@ -22,17 +22,14 @@ impl Plugin for VisualPlugin {
|
||||||
app.add_systems(Startup, setup.after(menu::setup).after(hud::setup));
|
app.add_systems(Startup, setup.after(menu::setup).after(hud::setup));
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Startup,
|
Startup,
|
||||||
spawn_effects
|
spawn_effects.after(setup).after(camera::setup_camera),
|
||||||
.run_if(game_running)
|
|
||||||
.after(setup)
|
|
||||||
.after(camera::setup_camera),
|
|
||||||
);
|
);
|
||||||
app.add_systems(Update, spawn_effects.run_if(game_running));
|
app.add_systems(Update, spawn_effects);
|
||||||
app.add_systems(Update, update_fadein.run_if(game_running));
|
app.add_systems(Update, update_fadein);
|
||||||
app.add_systems(Update, update_fadeout.run_if(game_running));
|
app.add_systems(Update, update_fadeout);
|
||||||
app.add_systems(Update, update_fade_material.run_if(game_running));
|
app.add_systems(Update, update_fade_material);
|
||||||
app.add_systems(Update, update_grow.run_if(game_running));
|
app.add_systems(Update, update_grow);
|
||||||
app.add_systems(Update, play_animations.run_if(game_running));
|
app.add_systems(Update, play_animations);
|
||||||
// Blackout disabled for now
|
// Blackout disabled for now
|
||||||
//app.add_systems(Update, update_blackout);
|
//app.add_systems(Update, update_blackout);
|
||||||
app.add_event::<SpawnEffectEvent>();
|
app.add_event::<SpawnEffectEvent>();
|
||||||
|
|
15
src/world.rs
15
src/world.rs
|
@ -37,17 +37,10 @@ pub struct WorldPlugin;
|
||||||
impl Plugin for WorldPlugin {
|
impl Plugin for WorldPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(Startup, setup);
|
app.add_systems(Startup, setup);
|
||||||
|
app.add_systems(Update, handle_respawn.run_if(on_event::<RespawnEvent>()));
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
handle_respawn
|
handle_despawn_at.run_if(any_with_component::<DespawnAt>),
|
||||||
.run_if(game_running)
|
|
||||||
.run_if(on_event::<RespawnEvent>()),
|
|
||||||
);
|
|
||||||
app.add_systems(
|
|
||||||
Update,
|
|
||||||
handle_despawn_at
|
|
||||||
.run_if(game_running)
|
|
||||||
.run_if(any_with_component::<DespawnAt>),
|
|
||||||
);
|
);
|
||||||
app.add_plugins(PhysicsPlugins::default());
|
app.add_plugins(PhysicsPlugins::default());
|
||||||
//app.add_plugins(PhysicsDebugPlugin::default());
|
//app.add_plugins(PhysicsDebugPlugin::default());
|
||||||
|
@ -59,8 +52,8 @@ impl Plugin for WorldPlugin {
|
||||||
ASTEROID_UPDATE_INTERVAL,
|
ASTEROID_UPDATE_INTERVAL,
|
||||||
TimerMode::Repeating,
|
TimerMode::Repeating,
|
||||||
)));
|
)));
|
||||||
app.add_systems(Update, spawn_despawn_asteroids.run_if(game_running));
|
app.add_systems(Update, spawn_despawn_asteroids);
|
||||||
app.add_systems(PostUpdate, handle_despawn_asteroids.run_if(game_running));
|
app.add_systems(PostUpdate, handle_despawn_asteroids);
|
||||||
app.add_event::<DespawnAsteroidEvent>();
|
app.add_event::<DespawnAsteroidEvent>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue