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>,
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 {
if input.keyboard_state.contains(key as u32) {
holding.0 = Some(block);

View file

@ -124,7 +124,7 @@ pub fn update_frustum(
mut cameras: ViewMut<Camera>,
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);
}
}

View file

@ -9,7 +9,7 @@ fn update_view_matrix(
mut vm_camera: ViewMut<Camera>,
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 direction = (rotation.normalize() * Vec3::NEG_Z).normalize();
camera.view_matrix = Mat4::look_to_rh(translation, direction, camera.up);
@ -21,7 +21,7 @@ fn update_perspective_matrix(
ren: UniqueView<Renderer>,
) {
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.fov,
sz.x / sz.y,

View file

@ -106,7 +106,7 @@ pub fn update_client_physics_late(
world: UniqueView<ChunkStorage>,
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 {
actor.forces = Vec3::ZERO;
continue;

View file

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

View file

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

View file

@ -1,11 +1,10 @@
use shipyard::{AllStoragesView, UniqueViewMut};
use std::{env, net::SocketAddr, fs::OpenOptions, path::Path};
use anyhow::Result;
use std::{env, net::SocketAddr, path::Path};
use crate::{
networking::{GameType, ServerAddress},
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(
all_storages: AllStoragesView,

View file

@ -11,7 +11,6 @@ use kubi_shared::networking::{
};
use crate::{
events::EventComponent,
control_flow::RequestExit,
world::tasks::ChunkTaskManager,
state::is_ingame_or_loading,
fixed_timestamp::FixedTimestamp

View file

@ -128,7 +128,7 @@ pub fn debug_switch_ctl_type(
mut actors: ViewMut<ClPhysicsActor>,
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) {
*controller = PlayerController::DEFAULT_FPS_CTL;
actor.disable = false;

View file

@ -2,7 +2,7 @@ use glam::UVec2;
use strum::IntoEnumIterator;
use rayon::prelude::*;
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 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 glam::Vec3;
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 kubi_shared::{entity::Entity, transform::Transform};
use crate::{
camera::Camera, prefabs::GpuPrefabs, settings::GameSettings
};
use shipyard::{AllStoragesView, Unique, UniqueView};
use crate::prefabs::GpuPrefabs;
use super::{camera_uniform::CameraUniformBuffer, depth::DepthTexture, RenderCtx};

View file

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

View file

@ -2,7 +2,7 @@ use std::sync::Arc;
use glam::IVec3;
use atomic::Atomic;
use kubi_shared::worldgen::AbortState;
use crate::rendering::{world::ChunkVertex, BufferPair};
use crate::rendering::BufferPair;
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 kubi_shared::block::{Block, RenderType, Transparency};
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()) {
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 direction = (rotation.normalize() * Vec3::NEG_Z).normalize();
*report = LookingAtBlock(world.raycast(position, direction, Some(30.)));