Switch to replicon (#80)
This commit is contained in:
@@ -2,6 +2,7 @@ use crate::{
|
||||
GameState,
|
||||
cash::{Cash, CashCollectEvent},
|
||||
character::HedzCharacter,
|
||||
protocol::PlayerId,
|
||||
};
|
||||
use avian3d::prelude::*;
|
||||
use bevy::{
|
||||
@@ -20,8 +21,22 @@ pub struct Player;
|
||||
#[require(Transform, Visibility)]
|
||||
pub struct PlayerBodyMesh;
|
||||
|
||||
/// Server-side only; inserted on each `client` (not the controller) to track player ids.
|
||||
#[derive(Component, Clone, Copy)]
|
||||
pub struct ClientPlayerId(pub PlayerId);
|
||||
|
||||
/// Client-side only; stores this client's id
|
||||
#[derive(Resource, Reflect)]
|
||||
#[reflect(Resource)]
|
||||
pub struct LocalPlayerId {
|
||||
pub id: PlayerId,
|
||||
}
|
||||
|
||||
pub fn plugin(app: &mut App) {
|
||||
app.add_systems(Startup, (toggle_cursor_system, cursor_recenter));
|
||||
app.add_systems(
|
||||
OnEnter(GameState::Playing),
|
||||
(toggle_cursor_system, cursor_recenter),
|
||||
);
|
||||
app.add_systems(
|
||||
Update,
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user