mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 16:28:42 -06:00
soft updates
This commit is contained in:
parent
4a84fec041
commit
de4938ee6a
|
@ -118,7 +118,9 @@ pub fn generate_world(chunk_position: IVec3, seed: u64) -> (BlockData, Vec<Queue
|
|||
let tree_pos = ivec3(x as i32, y as i32, z as i32);
|
||||
let tree_height = 4 + (rng_map_b[x][z] * 3.).round() as i32;
|
||||
for tree_y in 0..tree_height {
|
||||
smart_place(&mut blocks, tree_pos + IVec3::Y * tree_y, Block::Wood);
|
||||
if let Some(y) = local_y_position(offset.y + tree_y, chunk_position) {
|
||||
blocks[x][y][z] = Block::Wood;
|
||||
}
|
||||
}
|
||||
// Part that wraps around the tree
|
||||
{
|
||||
|
|
|
@ -69,6 +69,7 @@ fn block_placement_system(
|
|||
block_event_queue.push(BlockUpdateEvent {
|
||||
position: place_position,
|
||||
value: place_block,
|
||||
soft: place_block != Block::Air,
|
||||
});
|
||||
//send event
|
||||
entities.add_entity(
|
||||
|
|
|
@ -142,7 +142,7 @@ pub fn draw_current_chunk_border(
|
|||
Quat::default(),
|
||||
world_position
|
||||
).to_cols_array_2d(),
|
||||
color: [0.25f32; 4],
|
||||
color: [0.15f32; 4],
|
||||
view: view,
|
||||
perspective: perspective,
|
||||
},
|
||||
|
|
|
@ -203,6 +203,7 @@ fn process_completed_tasks(
|
|||
queue.push(BlockUpdateEvent {
|
||||
position: event.position,
|
||||
value: event.block_type,
|
||||
soft: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@ use super::ChunkStorage;
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct BlockUpdateEvent {
|
||||
pub position: IVec3,
|
||||
pub value: Block
|
||||
pub value: Block,
|
||||
//Only replace air blocks
|
||||
pub soft: bool,
|
||||
}
|
||||
|
||||
#[derive(Unique, Default, Clone)]
|
||||
|
|
Loading…
Reference in a new issue