aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs
index 7f1220e..fc781cc 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -6,6 +6,7 @@ use crate::shared::area_of_effect::*;
use crate::shared::buffs::*;
use crate::shared::champion::*;
use crate::shared::cooldown::*;
+use crate::shared::faction::*;
use crate::shared::health::*;
use crate::shared::health_event::*;
use crate::shared::imperative::*;
@@ -29,6 +30,7 @@ pub fn main(
client_id: u64,
transport: TransportConfig,
champion: Champion,
+ faction: Faction,
) {
App::new()
.add_plugins(DefaultPlugins)
@@ -37,6 +39,7 @@ pub fn main(
client_id,
transport,
champion,
+ faction,
})
.run();
}
@@ -48,6 +51,9 @@ struct ClientId(pub u64);
struct MyChampion(pub Champion);
#[derive(Resource)]
+struct MyFaction(pub Faction);
+
+#[derive(Resource)]
struct Attack(Option<AbilitySlot>);
struct ClientPlugin {
@@ -55,12 +61,14 @@ struct ClientPlugin {
pub client_id: u64,
pub transport: TransportConfig,
pub champion: Champion,
+ pub faction: Faction,
}
impl Plugin for ClientPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(ClientId(self.client_id))
.insert_resource(MyChampion(self.champion))
+ .insert_resource(MyFaction(self.faction))
.insert_resource(Attack(None))
.add_plugins(NetworkPlugin {
server_addr: self.server_addr.clone(),
@@ -109,7 +117,12 @@ pub struct Hotbar(AbilitySlot);
#[derive(Component, PartialEq, Eq, Debug)]
pub struct HotbarCooldown(AbilitySlot);
-fn setup(mut client: ClientMut, mut commands: Commands, champion: Res<MyChampion>) {
+fn setup(
+ mut client: ClientMut,
+ mut commands: Commands,
+ champion: Res<MyChampion>,
+ faction: Res<MyFaction>,
+) {
commands.spawn(Camera2dBundle::default());
commands
.spawn(NodeBundle {
@@ -185,6 +198,9 @@ fn setup(mut client: ClientMut, mut commands: Commands, champion: Res<MyChampion
client
.send_message::<Channel1, SelectChampion>(SelectChampion(champion.0))
.unwrap();
+ client
+ .send_message::<Channel1, SelectFaction>(SelectFaction(faction.0))
+ .unwrap();
}
fn render_players(