aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-04-08 13:47:18 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-04-08 15:23:13 +0200
commit1a559793251e80952bd3bdc668cfda46cbc38e73 (patch)
treea6b2649ac895a75ff48766e24c01202a1ca6a376 /src/shared
parentd39c819000569b468cfa68977f8a8b03062ac5d9 (diff)
feat: add player namesmain
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ability.rs7
-rw-r--r--src/shared/activation.rs6
-rw-r--r--src/shared/area_of_effect.rs5
-rw-r--r--src/shared/buffs.rs4
-rw-r--r--src/shared/champion.rs7
-rw-r--r--src/shared/cooldown.rs8
-rw-r--r--src/shared/damage.rs2
-rw-r--r--src/shared/faction.rs6
-rw-r--r--src/shared/health.rs4
-rw-r--r--src/shared/health_event.rs3
-rw-r--r--src/shared/immovable.rs2
-rw-r--r--src/shared/imperative.rs6
-rw-r--r--src/shared/minion.rs9
-rw-r--r--src/shared/name.rs6
-rw-r--r--src/shared/nexus.rs10
-rw-r--r--src/shared/player.rs14
-rw-r--r--src/shared/projectile.rs5
-rw-r--r--src/shared/shape.rs4
-rw-r--r--src/shared/stats.rs4
-rw-r--r--src/shared/tower.rs9
20 files changed, 90 insertions, 31 deletions
diff --git a/src/shared/ability.rs b/src/shared/ability.rs
index 66d236f..63780ff 100644
--- a/src/shared/ability.rs
+++ b/src/shared/ability.rs
@@ -2,12 +2,15 @@ use crate::server::entity_map::*;
use crate::shared::area_of_effect::*;
use crate::shared::buffs::*;
use crate::shared::damage::*;
+use crate::shared::health::*;
+use crate::shared::imperative::*;
use crate::shared::player::*;
use crate::shared::projectile::*;
use crate::shared::shape::*;
-use crate::shared::*;
use bevy::ecs::system::*;
-use bevy::utils::Duration;
+use bevy::prelude::*;
+use bevy::utils::*;
+use serde::*;
use std::ops::*;
#[derive(Copy, Clone, PartialEq, Debug, Deserialize, Serialize)]
diff --git a/src/shared/activation.rs b/src/shared/activation.rs
index 3ca6956..e2ff304 100644
--- a/src/shared/activation.rs
+++ b/src/shared/activation.rs
@@ -1,7 +1,7 @@
use crate::shared::ability::*;
-use crate::shared::*;
-use serde::Deserialize;
-use serde::Serialize;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Component, Message, Copy, Clone, PartialEq, Debug, Deserialize, Serialize)]
pub enum Activation {
diff --git a/src/shared/area_of_effect.rs b/src/shared/area_of_effect.rs
index dcdc86c..11608ad 100644
--- a/src/shared/area_of_effect.rs
+++ b/src/shared/area_of_effect.rs
@@ -1,8 +1,11 @@
+use crate::protocol::*;
use crate::server::entity_map::*;
use crate::shared::buffs::*;
use crate::shared::player::*;
-use crate::shared::*;
use bevy::ecs::system::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Bundle)]
pub struct AreaOfEffectBundle {
diff --git a/src/shared/buffs.rs b/src/shared/buffs.rs
index 868f3a3..be8ca33 100644
--- a/src/shared/buffs.rs
+++ b/src/shared/buffs.rs
@@ -1,4 +1,6 @@
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Clone, Message, Component, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Buffs {
diff --git a/src/shared/champion.rs b/src/shared/champion.rs
index c082ba3..9a1c7e2 100644
--- a/src/shared/champion.rs
+++ b/src/shared/champion.rs
@@ -1,10 +1,13 @@
use crate::shared::ability::*;
+use crate::shared::cooldown::*;
use crate::shared::damage::*;
use crate::shared::shape::*;
use crate::shared::stats::*;
-use crate::shared::*;
+use bevy::prelude::*;
use bevy::utils::*;
-use std::str::FromStr;
+use lightyear::prelude::*;
+use serde::*;
+use std::str::*;
#[derive(Component, Message, Clone, Copy, Serialize, Deserialize, PartialEq, Debug)]
pub enum Champion {
diff --git a/src/shared/cooldown.rs b/src/shared/cooldown.rs
index 6995941..e2c3318 100644
--- a/src/shared/cooldown.rs
+++ b/src/shared/cooldown.rs
@@ -1,8 +1,8 @@
-use crate::shared::*;
+use bevy::prelude::*;
use bevy::utils::Duration;
-use serde::Deserialize;
-use serde::Serialize;
-use std::default::Default;
+use lightyear::prelude::*;
+use serde::*;
+use std::default::*;
// TODO `AbilitySlot::A`'s cooldown is unused
//
diff --git a/src/shared/damage.rs b/src/shared/damage.rs
index c336d87..5d975cc 100644
--- a/src/shared/damage.rs
+++ b/src/shared/damage.rs
@@ -1,5 +1,5 @@
use crate::shared::stats::*;
-use crate::shared::*;
+use serde::*;
#[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize)]
pub enum Damage {
diff --git a/src/shared/faction.rs b/src/shared/faction.rs
index d3086d8..be9aafc 100644
--- a/src/shared/faction.rs
+++ b/src/shared/faction.rs
@@ -1,5 +1,7 @@
-use crate::shared::*;
-use std::str::FromStr;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
+use std::str::*;
#[derive(Message, Component, Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub enum Faction {
diff --git a/src/shared/health.rs b/src/shared/health.rs
index f9cc300..03c0822 100644
--- a/src/shared/health.rs
+++ b/src/shared/health.rs
@@ -1,4 +1,6 @@
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Component, Message, Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
pub struct Health {
diff --git a/src/shared/health_event.rs b/src/shared/health_event.rs
index 10af4ed..e41bb42 100644
--- a/src/shared/health_event.rs
+++ b/src/shared/health_event.rs
@@ -1,5 +1,6 @@
use crate::shared::player::*;
-use crate::shared::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Message, Serialize, Deserialize, PartialEq, Clone, Debug)]
pub struct HealthEvent {
diff --git a/src/shared/immovable.rs b/src/shared/immovable.rs
index ef4b3f0..bf3c7df 100644
--- a/src/shared/immovable.rs
+++ b/src/shared/immovable.rs
@@ -1,4 +1,4 @@
-use crate::shared::*;
+use bevy::prelude::*;
#[derive(Component)]
pub struct Immovable;
diff --git a/src/shared/imperative.rs b/src/shared/imperative.rs
index 4291368..d11f6ee 100644
--- a/src/shared/imperative.rs
+++ b/src/shared/imperative.rs
@@ -1,8 +1,8 @@
use crate::shared::ability::*;
use crate::shared::player::*;
-use crate::shared::*;
-use serde::Deserialize;
-use serde::Serialize;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Component, Message, Copy, Clone, PartialEq, Debug, Deserialize, Serialize)]
pub enum Imperative {
diff --git a/src/shared/minion.rs b/src/shared/minion.rs
index 4aa824e..3b58d37 100644
--- a/src/shared/minion.rs
+++ b/src/shared/minion.rs
@@ -1,10 +1,17 @@
+use crate::protocol::*;
use crate::shared::activation::*;
use crate::shared::buffs::*;
+use crate::shared::champion::*;
+use crate::shared::cooldown::*;
use crate::shared::faction::*;
+use crate::shared::health::*;
+use crate::shared::imperative::*;
use crate::shared::player::*;
use crate::shared::shape::*;
use crate::shared::stats::*;
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Bundle)]
pub struct MinionBundle {
diff --git a/src/shared/name.rs b/src/shared/name.rs
new file mode 100644
index 0000000..acf9db5
--- /dev/null
+++ b/src/shared/name.rs
@@ -0,0 +1,6 @@
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
+
+#[derive(Component, Message, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
+pub struct Name_(pub String);
diff --git a/src/shared/nexus.rs b/src/shared/nexus.rs
index df91db9..e1f846a 100644
--- a/src/shared/nexus.rs
+++ b/src/shared/nexus.rs
@@ -1,12 +1,18 @@
+use crate::protocol::*;
use crate::shared::activation::*;
use crate::shared::buffs::*;
+use crate::shared::champion::*;
+use crate::shared::cooldown::*;
use crate::shared::faction::*;
+use crate::shared::health::*;
use crate::shared::immovable::*;
+use crate::shared::imperative::*;
use crate::shared::player::*;
use crate::shared::shape::*;
use crate::shared::stats::*;
-use crate::shared::*;
-use bevy::utils::Duration;
+use bevy::prelude::*;
+use bevy::utils::*;
+use lightyear::prelude::*;
#[derive(Bundle)]
pub struct NexusBundle {
diff --git a/src/shared/player.rs b/src/shared/player.rs
index 606a3b2..f65851d 100644
--- a/src/shared/player.rs
+++ b/src/shared/player.rs
@@ -1,9 +1,17 @@
+use crate::protocol::*;
use crate::shared::activation::*;
use crate::shared::buffs::*;
+use crate::shared::champion::*;
+use crate::shared::cooldown::*;
use crate::shared::faction::*;
+use crate::shared::health::*;
+use crate::shared::imperative::*;
+use crate::shared::name::*;
use crate::shared::shape::*;
use crate::shared::stats::*;
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Bundle)]
pub struct PlayerBundle {
@@ -20,11 +28,12 @@ pub struct PlayerBundle {
shape: Shape,
faction: Faction,
player: Player,
+ name: Name_,
replicate: Replicate,
}
impl PlayerBundle {
- pub fn new(id: ClientId, position: Vec2, color: Color) -> Self {
+ pub fn new(id: ClientId, name: String, position: Vec2, color: Color) -> Self {
let mut replicate = Replicate {
replication_group: ReplicationGroup::default().set_priority(10.),
..Default::default()
@@ -53,6 +62,7 @@ impl PlayerBundle {
shape: Shape::player(),
faction: Faction::default(),
player: Player::default(),
+ name: Name_(name),
replicate,
}
}
diff --git a/src/shared/projectile.rs b/src/shared/projectile.rs
index 8fd0070..74dc260 100644
--- a/src/shared/projectile.rs
+++ b/src/shared/projectile.rs
@@ -1,6 +1,9 @@
+use crate::protocol::*;
use crate::shared::damage::*;
use crate::shared::player::*;
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Bundle)]
pub struct ProjectileBundle {
diff --git a/src/shared/shape.rs b/src/shared/shape.rs
index d77403d..6cbc901 100644
--- a/src/shared/shape.rs
+++ b/src/shared/shape.rs
@@ -1,4 +1,6 @@
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Component, Message, Clone, Copy, Serialize, Deserialize, Debug, PartialEq)]
pub struct Shape {
diff --git a/src/shared/stats.rs b/src/shared/stats.rs
index 98c26aa..45f3352 100644
--- a/src/shared/stats.rs
+++ b/src/shared/stats.rs
@@ -1,4 +1,6 @@
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Debug)]
pub struct Stats {
diff --git a/src/shared/tower.rs b/src/shared/tower.rs
index 28ccc13..d19f272 100644
--- a/src/shared/tower.rs
+++ b/src/shared/tower.rs
@@ -1,11 +1,18 @@
+use crate::protocol::*;
use crate::shared::activation::*;
use crate::shared::buffs::*;
+use crate::shared::champion::*;
+use crate::shared::cooldown::*;
use crate::shared::faction::*;
+use crate::shared::health::*;
use crate::shared::immovable::*;
+use crate::shared::imperative::*;
use crate::shared::player::*;
use crate::shared::shape::*;
use crate::shared::stats::*;
-use crate::shared::*;
+use bevy::prelude::*;
+use lightyear::prelude::*;
+use serde::*;
#[derive(Bundle)]
pub struct TowerBundle {