Input replication (#62)
This commit is contained in:
@@ -2,9 +2,12 @@ use bevy::prelude::*;
|
||||
use lightyear::{
|
||||
connection::client::ClientState,
|
||||
netcode::Key,
|
||||
prelude::{client::NetcodeConfig, *},
|
||||
prelude::{client::NetcodeConfig, input::native::InputMarker, *},
|
||||
};
|
||||
use shared::{
|
||||
GameState, control::ControlState, global_observer, heads_database::HeadsDatabase,
|
||||
player::Player, tb_entities::SpawnPoint,
|
||||
};
|
||||
use shared::{GameState, heads_database::HeadsDatabase, tb_entities::SpawnPoint};
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
|
||||
pub fn plugin(app: &mut App) {
|
||||
@@ -13,6 +16,8 @@ pub fn plugin(app: &mut App) {
|
||||
FixedUpdate,
|
||||
spawn_disconnected_player.run_if(in_state(GameState::Playing)),
|
||||
);
|
||||
|
||||
global_observer!(app, temp_give_player_marker);
|
||||
}
|
||||
|
||||
fn temp_connect_on_startup(mut commands: Commands) -> Result {
|
||||
@@ -68,3 +73,9 @@ fn spawn_disconnected_player(
|
||||
shared::player::spawn(commands, Entity::PLACEHOLDER, query, asset_server, heads_db)
|
||||
}
|
||||
}
|
||||
|
||||
fn temp_give_player_marker(trigger: Trigger<OnAdd, Player>, mut commands: Commands) {
|
||||
commands
|
||||
.entity(trigger.target())
|
||||
.insert(InputMarker::<ControlState>::default());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user