some big changes

This commit is contained in:
griffi-gh 2023-03-08 22:34:41 +01:00
parent 51f113d162
commit 3103b3647d
5 changed files with 19 additions and 11 deletions

View file

@ -4,4 +4,5 @@ pub mod worldgen;
pub mod chunk;
pub mod transform;
pub mod entity;
pub mod player;
pub mod queue;

View file

@ -0,0 +1,4 @@
use shipyard::Component;
#[derive(Component)]
pub struct Player;

View file

@ -7,7 +7,8 @@
use shipyard::{
World, Workload, IntoWorkload,
UniqueView, UniqueViewMut,
NonSendSync, WorkloadModificator, SystemModificator
NonSendSync, WorkloadModificator,
SystemModificator
};
use glium::{
glutin::{
@ -46,9 +47,9 @@ use world::{
loading::update_loaded_world_around_player,
raycast::update_raycasts,
queue::apply_queued_blocks,
tasks::inject_network_responses_into_manager_queue
tasks::inject_network_responses_into_manager_queue, ChunkStorage
};
use player::spawn_player;
use player::{spawn_player, MainPlayer};
use prefabs::load_prefabs;
use settings::load_settings;
use camera::compute_cameras;
@ -96,8 +97,8 @@ fn startup() -> Workload {
lock_cursor_now,
init_input,
init_gui,
init_game_world,
spawn_player,
insert_control_flow_unique,
init_delta_time,
).into_workload()
@ -107,6 +108,10 @@ fn update() -> Workload {
update_window_size,
update_cursor_lock_state,
process_inputs,
(
init_game_world.run_if_missing_unique::<ChunkStorage>(),
spawn_player.run_if_storage_empty::<MainPlayer>(),
).into_workload().run_if(is_ingame_or_loading),
(
update_networking,
inject_network_responses_into_manager_queue,

View file

@ -1,4 +1,4 @@
use shipyard::{Component, AllStoragesViewMut};
use shipyard::{Component, AllStoragesViewMut, View, IntoIter};
use crate::{
transform::Transform,
camera::Camera,
@ -6,9 +6,7 @@ use crate::{
world::raycast::LookingAtBlock,
block_placement::PlayerHolding,
};
#[derive(Component)]
pub struct Player;
pub use kubi_shared::player::Player;
#[derive(Component)]
pub struct MainPlayer;
@ -17,7 +15,7 @@ pub fn spawn_player (
mut storages: AllStoragesViewMut
) {
log::info!("spawning player");
storages.add_entity((
let entity_id = storages.add_entity((
Player,
MainPlayer,
Transform::default(),

View file

@ -126,7 +126,7 @@ impl MeshBuilder {
let face_type = face_type as usize;
let vertices = CROSS_FACES[face_type];
let normal_front = CROSS_FACE_NORMALS[face_type].to_array();
let normal_back = CROSS_FACE_NORMALS[face_type].to_array();
let normal_back = CROSS_FACE_NORMALS_BACK[face_type].to_array();
self.vertex_buffer.reserve(8);
for i in 0..4 { //push front vertices
self.vertex_buffer.push(ChunkVertex {