Skip to content

Commit

Permalink
Merge + clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ReCore-sys committed Nov 27, 2024
1 parent 9da8487 commit bcbcfeb
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ maplit = "1.0.2"
macro_rules_attribute = "0.2.0"

# Magic ("life-before-main" initialization, __attribute__((constructor)))
ctor = "0.2.8"
ctor = "0.2.9"

# Compression/Decompression
libflate = "2.1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() {
let cli_args = CLIArgs::parse();
ferrumc_logging::init_logging(cli_args.log.clone());

println!("good day to ya. enjoy your time with ferrumc!");
info!("Starting server...");

if let Err(e) = entry(cli_args).await {
error!("Server exited with the following error: {}", e.to_string());
Expand Down
1 change: 0 additions & 1 deletion src/bin/src/packet_handlers/login_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use tracing::{debug, trace};
use ferrumc_core::transform::grounded::OnGround;
use ferrumc_core::transform::position::Position;
use ferrumc_core::transform::rotation::Rotation;
use ferrumc_net::packets::outgoing::finish_configuration::FinishConfigurationPacket;

#[event_handler]
async fn handle_login_start(
Expand Down
2 changes: 1 addition & 1 deletion src/bin/src/systems/chunk_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl System for ChunkSenderSystem {
while !self.stop.load(Ordering::Relaxed) {
let players = state.universe.query::<(&PlayerIdentity, &Position, &mut StreamWriter)>();
// TODO: This is so ass. Please fix this.
for (player, position, mut conn) in players {
for (_entity, (player, position, mut conn)) in players {
debug!("Sending chunks to player: {player:?} @ {position:?}");
for z in ((position.z.floor() as i32) / 16) - 5..(position.z.ceil() as i32 / 16) + 5 {
for x in (position.x.floor() as i32 / 16) - 5..(position.x.ceil() as i32 / 16) + 5 {
Expand Down
2 changes: 0 additions & 2 deletions src/bin/src/systems/keep_alive_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use ferrumc_net::utils::state::terminate_connection;
use ferrumc_net::GlobalState;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::time::Duration;
use tracing::{error, info, trace, warn};

pub struct KeepAliveSystem {
Expand All @@ -34,7 +33,6 @@ impl System for KeepAliveSystem {
}

// Get the times before the queries, since it's possible a query takes more than a millisecond with a lot of entities.
let packet = KeepAlivePacket::default();

let current_time = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
Expand Down
4 changes: 0 additions & 4 deletions src/lib/events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ edition = "2021"
[dependencies]

tokio = { workspace = true, features = ["rt-multi-thread", "macros"]}
crossbeam = { workspace = true }
ctor = { workspace = true}
parking_lot = { workspace = true }
hashbrown = { workspace = true }
tinyvec = { workspace = true }
thiserror = { workspace = true }
futures = { workspace = true }
dashmap = { workspace = true }
4 changes: 2 additions & 2 deletions src/lib/net/src/utils/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub async fn terminate_connection(
conn_id: usize,
reason: String,
) -> NetResult<()> {
let mut writer = match conn_id.get_mut::<StreamWriter>(state.clone()) {
let mut writer = match conn_id.get_mut::<StreamWriter>(&state.clone()) {
Ok(writer) => writer,
Err(e) => {
warn!("Failed to get stream writer for entity {}: {}", conn_id, e);
Expand All @@ -45,7 +45,7 @@ pub async fn terminate_connection(
return Err(e);
}

match conn_id.get_mut::<ConnectionControl>(state.clone()) {
match conn_id.get_mut::<ConnectionControl>(&state.clone()) {
Ok(mut control) => {
control.should_disconnect = true;

Expand Down
3 changes: 0 additions & 3 deletions src/lib/utils/logging/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ pub fn init_logging(log_level: Option<String>) {
/*let trace_level = std::env::args()
.find(|arg| arg.starts_with("--log="))
.map(|arg| arg.replace("--log=", ""));*/
let trace_level = std::env::var("FERRUMC_LOG").ok();

// let trace_level = trace_level.unwrap_or_else(|| LOG_LEVEL.to_string());
let trace_level = log_level.unwrap_or_else(|| {
println!("No log level provided, using default log level: {}", LOG_LEVEL);
LOG_LEVEL.to_string()
Expand Down

0 comments on commit bcbcfeb

Please sign in to comment.