fix some warnings

This commit is contained in:
griffi-gh 2024-09-11 14:22:21 +02:00
parent 1251d07c60
commit eda6a46875
16 changed files with 23 additions and 28 deletions

View file

@ -34,7 +34,7 @@ fn pick_block_with_number_keys(
mut holding: ViewMut<PlayerHolding>, mut holding: ViewMut<PlayerHolding>,
input: UniqueView<RawKbmInputState>, input: UniqueView<RawKbmInputState>,
) { ) {
let Some((_, mut holding)) = (&main_player, &mut holding).iter().next() else { return }; let Some((_, holding)) = (&main_player, &mut holding).iter().next() else { return };
for &(key, block) in BLOCK_KEY_MAP { for &(key, block) in BLOCK_KEY_MAP {
if input.keyboard_state.contains(key as u32) { if input.keyboard_state.contains(key as u32) {
holding.0 = Some(block); holding.0 = Some(block);

View file

@ -124,7 +124,7 @@ pub fn update_frustum(
mut cameras: ViewMut<Camera>, mut cameras: ViewMut<Camera>,
transforms: View<Transform, track::All> transforms: View<Transform, track::All>
) { ) {
for (mut camera, _) in (&mut cameras, transforms.inserted_or_modified()).iter() { for (camera, _) in (&mut cameras, transforms.inserted_or_modified()).iter() {
camera.frustum = Frustum::compute(&camera); camera.frustum = Frustum::compute(&camera);
} }
} }

View file

@ -9,7 +9,7 @@ fn update_view_matrix(
mut vm_camera: ViewMut<Camera>, mut vm_camera: ViewMut<Camera>,
v_transform: View<Transform, track::All> v_transform: View<Transform, track::All>
) { ) {
for (mut camera, transform) in (&mut vm_camera, v_transform.inserted_or_modified()).iter() { for (camera, transform) in (&mut vm_camera, v_transform.inserted_or_modified()).iter() {
let (_, rotation, translation) = transform.0.to_scale_rotation_translation(); let (_, rotation, translation) = transform.0.to_scale_rotation_translation();
let direction = (rotation.normalize() * Vec3::NEG_Z).normalize(); let direction = (rotation.normalize() * Vec3::NEG_Z).normalize();
camera.view_matrix = Mat4::look_to_rh(translation, direction, camera.up); camera.view_matrix = Mat4::look_to_rh(translation, direction, camera.up);
@ -21,7 +21,7 @@ fn update_perspective_matrix(
ren: UniqueView<Renderer>, ren: UniqueView<Renderer>,
) { ) {
let sz = ren.size_vec2(); let sz = ren.size_vec2();
for mut camera in (&mut vm_camera).iter() { for camera in (&mut vm_camera).iter() {
camera.perspective_matrix = Mat4::perspective_rh( camera.perspective_matrix = Mat4::perspective_rh(
camera.fov, camera.fov,
sz.x / sz.y, sz.x / sz.y,

View file

@ -106,7 +106,7 @@ pub fn update_client_physics_late(
world: UniqueView<ChunkStorage>, world: UniqueView<ChunkStorage>,
dt: UniqueView<DeltaTime>, dt: UniqueView<DeltaTime>,
) { ) {
for (mut actor, mut transform) in (&mut actors, &mut transforms).iter() { for (actor, mut transform) in (&mut actors, &mut transforms).iter() {
if actor.disable { if actor.disable {
actor.forces = Vec3::ZERO; actor.forces = Vec3::ZERO;
continue; continue;

View file

@ -1,5 +1,5 @@
use shipyard::{UniqueView, UniqueViewMut, Unique, AllStoragesView}; use shipyard::{UniqueView, UniqueViewMut, Unique, AllStoragesView};
use winit::{keyboard::KeyCode, event_loop::ControlFlow}; use winit::keyboard::KeyCode;
use crate::input::RawKbmInputState; use crate::input::RawKbmInputState;
#[derive(Unique)] #[derive(Unique)]

View file

@ -1,6 +1,6 @@
use std::{fs::File, path::Path, io::{Read, Seek}}; use std::{fs::File, path::Path, io::{Read, Seek}};
use anyhow::Result; use anyhow::Result;
use shipyard::{Unique, AllStoragesView}; use shipyard::Unique;
pub trait ReadOnly: Read + Seek {} pub trait ReadOnly: Read + Seek {}
impl<T: Read + Seek> ReadOnly for T {} impl<T: Read + Seek> ReadOnly for T {}

View file

@ -1,11 +1,10 @@
use shipyard::{AllStoragesView, UniqueViewMut}; use shipyard::{AllStoragesView, UniqueViewMut};
use std::{env, net::SocketAddr, fs::OpenOptions, path::Path}; use std::{env, net::SocketAddr, path::Path};
use anyhow::Result;
use crate::{ use crate::{
networking::{GameType, ServerAddress}, networking::{GameType, ServerAddress},
state::{GameState, NextState} state::{GameState, NextState}
}; };
use kubi_shared::data::{io_thread::IOThreadManager, WorldSaveFile, open_local_save_file}; use kubi_shared::data::{io_thread::IOThreadManager, open_local_save_file};
pub fn initialize_from_args( pub fn initialize_from_args(
all_storages: AllStoragesView, all_storages: AllStoragesView,

View file

@ -1,19 +1,18 @@
use shipyard::{Unique, AllStoragesView, UniqueView, UniqueViewMut, Workload, IntoWorkload, EntitiesViewMut, Component, ViewMut, SystemModificator, View, IntoIter, WorkloadModificator}; use shipyard::{Unique, AllStoragesView, UniqueView, UniqueViewMut, Workload, IntoWorkload, EntitiesViewMut, Component, ViewMut, SystemModificator, View, IntoIter, WorkloadModificator};
use std::net::SocketAddr; use std::net::SocketAddr;
use uflow::{ use uflow::{
client::{Client, Config as ClientConfig, Event as ClientEvent}, client::{Client, Config as ClientConfig, Event as ClientEvent},
EndpointConfig EndpointConfig
}; };
use kubi_shared::networking::{ use kubi_shared::networking::{
messages::ServerToClientMessage, messages::ServerToClientMessage,
state::ClientJoinState, state::ClientJoinState,
client::ClientIdMap, client::ClientIdMap,
}; };
use crate::{ use crate::{
events::EventComponent, events::EventComponent,
control_flow::RequestExit, world::tasks::ChunkTaskManager,
world::tasks::ChunkTaskManager, state::is_ingame_or_loading,
state::is_ingame_or_loading,
fixed_timestamp::FixedTimestamp fixed_timestamp::FixedTimestamp
}; };

View file

@ -128,7 +128,7 @@ pub fn debug_switch_ctl_type(
mut actors: ViewMut<ClPhysicsActor>, mut actors: ViewMut<ClPhysicsActor>,
kbm_state: UniqueView<RawKbmInputState>, kbm_state: UniqueView<RawKbmInputState>,
) { ) {
for (mut controller, mut actor) in (&mut controllers, &mut actors).iter() { for (controller, actor) in (&mut controllers, &mut actors).iter() {
if kbm_state.keyboard_state.contains(KeyCode::F4 as u32) { if kbm_state.keyboard_state.contains(KeyCode::F4 as u32) {
*controller = PlayerController::DEFAULT_FPS_CTL; *controller = PlayerController::DEFAULT_FPS_CTL;
actor.disable = false; actor.disable = false;

View file

@ -2,7 +2,7 @@ use glam::UVec2;
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use rayon::prelude::*; use rayon::prelude::*;
use wgpu::util::{DeviceExt, TextureDataOrder}; use wgpu::util::{DeviceExt, TextureDataOrder};
use std::{io::{BufReader, Read}, path::{Path, PathBuf}}; use std::{io::BufReader, path::{Path, PathBuf}};
use crate::{filesystem::AssetManager, prefabs::ModelVertex, rendering::{BufferPair, Renderer}}; use crate::{filesystem::AssetManager, prefabs::ModelVertex, rendering::{BufferPair, Renderer}};
use super::AssetPaths; use super::AssetPaths;

View file

@ -1,4 +1,4 @@
use shipyard::{AllStoragesViewMut, IntoIter, IntoWorkload, SystemModificator, Unique, UniqueView, UniqueViewMut, View, Workload, WorkloadModificator}; use shipyard::{AllStoragesViewMut, IntoIter, IntoWorkload, Unique, UniqueView, UniqueViewMut, View, Workload, WorkloadModificator};
use winit::dpi::PhysicalSize; use winit::dpi::PhysicalSize;
use glam::Vec3; use glam::Vec3;
use crate::{events::WindowResizedEvent, hui_integration::kubi_ui_draw, state::is_ingame}; use crate::{events::WindowResizedEvent, hui_integration::kubi_ui_draw, state::is_ingame};

View file

@ -1,8 +1,5 @@
use shipyard::{AllStoragesView, IntoIter, IntoWithId, Unique, UniqueView, View}; use shipyard::{AllStoragesView, Unique, UniqueView};
use kubi_shared::{entity::Entity, transform::Transform}; use crate::prefabs::GpuPrefabs;
use crate::{
camera::Camera, prefabs::GpuPrefabs, settings::GameSettings
};
use super::{camera_uniform::CameraUniformBuffer, depth::DepthTexture, RenderCtx}; use super::{camera_uniform::CameraUniformBuffer, depth::DepthTexture, RenderCtx};

View file

@ -1,5 +1,5 @@
use shipyard::{AllStoragesView, Unique, UniqueView}; use shipyard::{AllStoragesView, Unique, UniqueView};
use super::{primitives::FstriPrimitive, RenderCtx, Renderer}; use super::{primitives::FstriPrimitive, RenderCtx};
mod uniform; mod uniform;
mod pipeline; mod pipeline;

View file

@ -2,7 +2,7 @@ use std::sync::Arc;
use glam::IVec3; use glam::IVec3;
use atomic::Atomic; use atomic::Atomic;
use kubi_shared::worldgen::AbortState; use kubi_shared::worldgen::AbortState;
use crate::rendering::{world::ChunkVertex, BufferPair}; use crate::rendering::BufferPair;
pub use kubi_shared::chunk::{CHUNK_SIZE, BlockData}; pub use kubi_shared::chunk::{CHUNK_SIZE, BlockData};

View file

@ -1,4 +1,4 @@
use glam::{ivec3, IVec3, Vec3}; use glam::{ivec3, IVec3};
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use kubi_shared::block::{Block, RenderType, Transparency}; use kubi_shared::block::{Block, RenderType, Transparency};
use crate::world::chunk::CHUNK_SIZE; use crate::world::chunk::CHUNK_SIZE;

View file

@ -57,7 +57,7 @@ pub fn update_raycasts(
if !(world.is_inserted_or_modified() || (transform.inserted_or_modified(), &raycast).iter().next().is_some()) { if !(world.is_inserted_or_modified() || (transform.inserted_or_modified(), &raycast).iter().next().is_some()) {
return return
} }
for (transform, mut report) in (&transform, &mut raycast).iter() { for (transform, report) in (&transform, &mut raycast).iter() {
let (_, rotation, position) = transform.0.to_scale_rotation_translation(); let (_, rotation, position) = transform.0.to_scale_rotation_translation();
let direction = (rotation.normalize() * Vec3::NEG_Z).normalize(); let direction = (rotation.normalize() * Vec3::NEG_Z).normalize();
*report = LookingAtBlock(world.raycast(position, direction, Some(30.))); *report = LookingAtBlock(world.raycast(position, direction, Some(30.)));