mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 16:28:42 -06:00
some big changes
This commit is contained in:
parent
51f113d162
commit
3103b3647d
|
@ -4,4 +4,5 @@ pub mod worldgen;
|
||||||
pub mod chunk;
|
pub mod chunk;
|
||||||
pub mod transform;
|
pub mod transform;
|
||||||
pub mod entity;
|
pub mod entity;
|
||||||
|
pub mod player;
|
||||||
pub mod queue;
|
pub mod queue;
|
||||||
|
|
4
kubi-shared/src/player.rs
Normal file
4
kubi-shared/src/player.rs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
use shipyard::Component;
|
||||||
|
|
||||||
|
#[derive(Component)]
|
||||||
|
pub struct Player;
|
|
@ -7,7 +7,8 @@
|
||||||
use shipyard::{
|
use shipyard::{
|
||||||
World, Workload, IntoWorkload,
|
World, Workload, IntoWorkload,
|
||||||
UniqueView, UniqueViewMut,
|
UniqueView, UniqueViewMut,
|
||||||
NonSendSync, WorkloadModificator, SystemModificator
|
NonSendSync, WorkloadModificator,
|
||||||
|
SystemModificator
|
||||||
};
|
};
|
||||||
use glium::{
|
use glium::{
|
||||||
glutin::{
|
glutin::{
|
||||||
|
@ -46,9 +47,9 @@ use world::{
|
||||||
loading::update_loaded_world_around_player,
|
loading::update_loaded_world_around_player,
|
||||||
raycast::update_raycasts,
|
raycast::update_raycasts,
|
||||||
queue::apply_queued_blocks,
|
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 prefabs::load_prefabs;
|
||||||
use settings::load_settings;
|
use settings::load_settings;
|
||||||
use camera::compute_cameras;
|
use camera::compute_cameras;
|
||||||
|
@ -96,8 +97,8 @@ fn startup() -> Workload {
|
||||||
lock_cursor_now,
|
lock_cursor_now,
|
||||||
init_input,
|
init_input,
|
||||||
init_gui,
|
init_gui,
|
||||||
init_game_world,
|
|
||||||
spawn_player,
|
|
||||||
insert_control_flow_unique,
|
insert_control_flow_unique,
|
||||||
init_delta_time,
|
init_delta_time,
|
||||||
).into_workload()
|
).into_workload()
|
||||||
|
@ -107,6 +108,10 @@ fn update() -> Workload {
|
||||||
update_window_size,
|
update_window_size,
|
||||||
update_cursor_lock_state,
|
update_cursor_lock_state,
|
||||||
process_inputs,
|
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,
|
update_networking,
|
||||||
inject_network_responses_into_manager_queue,
|
inject_network_responses_into_manager_queue,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use shipyard::{Component, AllStoragesViewMut};
|
use shipyard::{Component, AllStoragesViewMut, View, IntoIter};
|
||||||
use crate::{
|
use crate::{
|
||||||
transform::Transform,
|
transform::Transform,
|
||||||
camera::Camera,
|
camera::Camera,
|
||||||
|
@ -6,9 +6,7 @@ use crate::{
|
||||||
world::raycast::LookingAtBlock,
|
world::raycast::LookingAtBlock,
|
||||||
block_placement::PlayerHolding,
|
block_placement::PlayerHolding,
|
||||||
};
|
};
|
||||||
|
pub use kubi_shared::player::Player;
|
||||||
#[derive(Component)]
|
|
||||||
pub struct Player;
|
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct MainPlayer;
|
pub struct MainPlayer;
|
||||||
|
@ -17,7 +15,7 @@ pub fn spawn_player (
|
||||||
mut storages: AllStoragesViewMut
|
mut storages: AllStoragesViewMut
|
||||||
) {
|
) {
|
||||||
log::info!("spawning player");
|
log::info!("spawning player");
|
||||||
storages.add_entity((
|
let entity_id = storages.add_entity((
|
||||||
Player,
|
Player,
|
||||||
MainPlayer,
|
MainPlayer,
|
||||||
Transform::default(),
|
Transform::default(),
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl MeshBuilder {
|
||||||
let face_type = face_type as usize;
|
let face_type = face_type as usize;
|
||||||
let vertices = CROSS_FACES[face_type];
|
let vertices = CROSS_FACES[face_type];
|
||||||
let normal_front = CROSS_FACE_NORMALS[face_type].to_array();
|
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);
|
self.vertex_buffer.reserve(8);
|
||||||
for i in 0..4 { //push front vertices
|
for i in 0..4 { //push front vertices
|
||||||
self.vertex_buffer.push(ChunkVertex {
|
self.vertex_buffer.push(ChunkVertex {
|
||||||
|
|
Loading…
Reference in a new issue