mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 08:18:43 -06:00
randomize usernames
This commit is contained in:
parent
740da98cbd
commit
907a5845fa
76
Cargo.lock
generated
76
Cargo.lock
generated
|
@ -43,7 +43,7 @@ dependencies = [
|
|||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
"zerocopy 0.7.32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -245,7 +245,7 @@ dependencies = [
|
|||
"getrandom",
|
||||
"js-sys",
|
||||
"lazy_static",
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
"rand_xorshift",
|
||||
"regex",
|
||||
"wasm-bindgen",
|
||||
|
@ -1173,6 +1173,7 @@ dependencies = [
|
|||
"ndk",
|
||||
"nohash-hasher",
|
||||
"postcard",
|
||||
"rand 0.9.0-alpha.1",
|
||||
"raw-window-handle 0.5.2",
|
||||
"rayon",
|
||||
"serde_json",
|
||||
|
@ -1212,7 +1213,7 @@ dependencies = [
|
|||
"lz4_flex",
|
||||
"nohash-hasher",
|
||||
"postcard",
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
"rayon",
|
||||
"serde",
|
||||
"shipyard",
|
||||
|
@ -1233,7 +1234,7 @@ dependencies = [
|
|||
"num_enum",
|
||||
"nz",
|
||||
"postcard",
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
"rand_xoshiro",
|
||||
"serde",
|
||||
"serde_with",
|
||||
|
@ -1645,8 +1646,19 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"packed_simd_2",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.0-alpha.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d31e63ea85be51c423e52ba8f2e68a3efd53eed30203ee029dd09947333693e"
|
||||
dependencies = [
|
||||
"rand_chacha 0.9.0-alpha.1",
|
||||
"rand_core 0.9.0-alpha.1",
|
||||
"zerocopy 0.8.0-alpha.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1656,7 +1668,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0-alpha.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78674ef918c19451dbd250f8201f8619b494f64c9aa6f3adb28fd8a0f1f6da46"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.9.0-alpha.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1668,13 +1690,23 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.0-alpha.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc89dffba8377c5ec847d12bb41492bda235dba31a25e8b695cd0fe6589eb8c9"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"zerocopy 0.8.0-alpha.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1683,7 +1715,7 @@ version = "0.6.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2190,7 +2222,7 @@ version = "0.4.15"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2417e47ddd3809ad40222777ac754ee881b3a6401e38cbeeeb3ee1ca5f30aa0"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2266,7 +2298,7 @@ version = "0.7.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3be4d71c1c106a57b0333ac2c28bd4521e0b16a2b98fe84405cdf7f544be46b6"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2884,7 +2916,16 @@ version = "0.7.32"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
"zerocopy-derive 0.7.32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.0-alpha.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db678a6ee512bd06adf35c35be471cae2f9c82a5aed2b5d15e03628c98bddd57"
|
||||
dependencies = [
|
||||
"zerocopy-derive 0.8.0-alpha.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2897,3 +2938,14 @@ dependencies = [
|
|||
"quote",
|
||||
"syn 2.0.49",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.0-alpha.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201585ea96d37ee69f2ac769925ca57160cef31acb137c16f38b02b76f4c1e62"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.49",
|
||||
]
|
||||
|
|
|
@ -35,6 +35,7 @@ lz4_flex = { version = "0.11", default-features = false, features = ["std"] }
|
|||
static_assertions = "1.1"
|
||||
tinyset = "0.4"
|
||||
serde_json = { version = "1.0", optional = true } #only used for `generate_visualizer_data`
|
||||
rand = { version = "0.9.0-alpha.0", features = ["alloc", "small_rng"]}
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
android-activity = "^0.5.2"
|
||||
|
@ -49,7 +50,7 @@ raw-evt = [] #required for mouse input, but breaks keyboard on android
|
|||
generate_visualizer_data = ["dep:serde_json", "shipyard/serde1"]
|
||||
safe_lz4 = ["lz4_flex/safe-encode", "lz4_flex/safe-decode"]
|
||||
parallel = ["shipyard/parallel"] # causes some serious issues!
|
||||
nightly = ["hashbrown/nightly", "glam/core-simd", "static_assertions/nightly", "lz4_flex/nightly", "kubi-shared/nightly"]
|
||||
nightly = ["hashbrown/nightly", "glam/core-simd", "static_assertions/nightly", "lz4_flex/nightly", "kubi-shared/nightly", "rand/nightly"]
|
||||
|
||||
#part of wip android support
|
||||
[package.metadata.android]
|
||||
|
|
|
@ -5,9 +5,21 @@ use kubi_shared::networking::{
|
|||
state::ClientJoinState,
|
||||
channels::Channel,
|
||||
};
|
||||
use crate::player::{spawn_local_player_multiplayer, spawn_remote_player_multiplayer};
|
||||
use rand::prelude::*;
|
||||
use crate::{chat::ChatManager, player::{spawn_local_player_multiplayer, spawn_remote_player_multiplayer}};
|
||||
use super::{UdpClient, NetworkEvent};
|
||||
|
||||
const USERNAME_BANK: &[&str] = &[
|
||||
"XxX-FishFucker-69420",
|
||||
"Sbeve34",
|
||||
"ShadowBladeX",
|
||||
"CyberNinja92",
|
||||
"sputnik1",
|
||||
"dumbpotato",
|
||||
"FortNiteNinja",
|
||||
"MinecraftMiner",
|
||||
];
|
||||
|
||||
#[derive(Unique)]
|
||||
pub struct ConnectionRejectionReason {
|
||||
pub reason: String,
|
||||
|
@ -23,7 +35,8 @@ pub fn set_client_join_state_to_connected(
|
|||
pub fn say_hello(
|
||||
mut client: UniqueViewMut<UdpClient>,
|
||||
) {
|
||||
let username = "XxX-FishFucker-69420-XxX".into();
|
||||
let mut rng = thread_rng();
|
||||
let username = (*USERNAME_BANK.choose(&mut rng).unwrap()).to_owned();
|
||||
let password = None;
|
||||
log::info!("Authenticating");
|
||||
client.0.send(
|
||||
|
@ -64,7 +77,10 @@ pub fn check_server_hello_response(
|
|||
// direction: Quat,
|
||||
// health: Health,
|
||||
// }
|
||||
|
||||
|
||||
let client_id = init.user.client_id;
|
||||
let username = init.user.username.clone();
|
||||
|
||||
//Add components to main player
|
||||
spawn_local_player_multiplayer(&mut storages, init.user);
|
||||
|
||||
|
@ -78,6 +94,10 @@ pub fn check_server_hello_response(
|
|||
*join_state = ClientJoinState::Joined;
|
||||
|
||||
log::info!("Joined the server!");
|
||||
|
||||
// Send chat message
|
||||
let mut chat = storages.borrow::<UniqueViewMut<ChatManager>>().unwrap();
|
||||
chat.add_player_join(client_id, username);
|
||||
}
|
||||
|
||||
pub fn check_server_fuck_off_response(
|
||||
|
|
Loading…
Reference in a new issue