Switch to replicon (#80)

This commit is contained in:
PROMETHIA-27
2025-12-08 19:22:17 -05:00
committed by GitHub
parent 7a5d2e6914
commit ff52258ad2
55 changed files with 1212 additions and 2951 deletions

View File

@@ -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,
(