File tree Expand file tree Collapse file tree 6 files changed +17
-5
lines changed Expand file tree Collapse file tree 6 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ pub fn receive_message_system(
7
7
mut player_sync_events : ResMut < Events < remote_player_events:: RemotePlayerSyncEvent > > ,
8
8
mut block_update_events : ResMut < Events < terrain_events:: BlockUpdateEvent > > ,
9
9
mut chunk_manager : ResMut < terrain_resources:: ChunkManager > ,
10
+ mut chunk_mesh_events : ResMut < Events < terrain_events:: ChunkMeshUpdateEvent > > ,
10
11
) {
11
12
while let Some ( message) = client. receive_message ( DefaultChannel :: ReliableOrdered ) {
12
13
let message = bincode:: deserialize ( & message) . unwrap ( ) ;
@@ -48,11 +49,15 @@ pub fn receive_message_system(
48
49
debug ! ( "Received message: {:?}" , message) ;
49
50
match message {
50
51
lib:: NetworkingMessage :: ChunkResponse ( chunk) => {
51
- debug ! (
52
+ info ! (
52
53
"Client received chunk response message for: {:?}" ,
53
54
chunk. position
54
55
) ;
56
+ let chunk_position = chunk. position ;
55
57
chunk_manager. insert_chunk ( chunk) ;
58
+ chunk_mesh_events. send ( terrain_events:: ChunkMeshUpdateEvent {
59
+ position : chunk_position,
60
+ } ) ;
56
61
}
57
62
lib:: NetworkingMessage :: PlayerSync ( event) => {
58
63
player_sync_events
Original file line number Diff line number Diff line change @@ -9,11 +9,13 @@ pub struct PlayerPlugin;
9
9
10
10
impl Plugin for PlayerPlugin {
11
11
fn build ( & self , app : & mut App ) {
12
+ debug ! ( "Building PlayerPlugin" ) ;
13
+ info ! ( "Building PlayerPlugin" ) ;
12
14
app. add_plugins ( FpsControllerPlugin ) ;
13
15
app. add_plugins ( RapierPhysicsPlugin :: < NoUserData > :: default ( ) ) ;
14
16
app. add_plugins ( RapierDebugRenderPlugin :: default ( ) ) ;
15
17
app. insert_resource ( RapierConfiguration {
16
- gravity : Vec3 :: new ( 0. , - 1.6 , 0. ) ,
18
+ gravity : Vec3 :: new ( 0. , 0.0 , 0. ) ,
17
19
physics_pipeline_active : true ,
18
20
force_update_from_transform_changes : false ,
19
21
scaled_shape_subdivision : 1 ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ pub struct TerrainPlugin;
10
10
11
11
impl Plugin for TerrainPlugin {
12
12
fn build ( & self , app : & mut App ) {
13
+ info ! ( "Building TerrainPlugin" ) ;
13
14
app. insert_resource ( terrain_resources:: ChunkManager :: new ( ) ) ;
14
15
app. insert_resource ( util:: TextureManager :: new ( ) ) ;
15
16
app. add_event :: < terrain_events:: BlockUpdateEvent > ( ) ;
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ impl ChunkManager {
103
103
) )
104
104
}
105
105
None => {
106
- println ! ( "No chunk found for block at {:?}" , position) ;
106
+ // println!("No chunk found for block at {:?}", position);
107
107
None
108
108
}
109
109
}
Original file line number Diff line number Diff line change @@ -3,12 +3,15 @@ use crate::prelude::*;
3
3
pub fn setup_world_system ( mut client : ResMut < RenetClient > ) {
4
4
let render_distance = 16 ;
5
5
6
+ info ! ( "Sending chunk requests for chunks" ) ;
7
+
6
8
let mut chunks = terrain_resources:: ChunkManager :: instantiate_chunks (
7
9
Vec3 :: new ( 0.0 , 0.0 , 0.0 ) ,
8
10
render_distance,
9
11
) ;
10
12
11
13
for chunk in & mut chunks {
14
+ debug ! ( "Sending chunk request for chunk {:?}" , chunk. position) ;
12
15
client. send_message (
13
16
DefaultChannel :: ReliableUnordered ,
14
17
bincode:: serialize ( & NetworkingMessage :: ChunkRequest {
@@ -31,6 +34,7 @@ pub fn handle_chunk_mesh_update_events(
31
34
texture_manager : ResMut < terrain_util:: TextureManager > ,
32
35
) {
33
36
for event in chunk_mesh_update_events. read ( ) {
37
+ info ! ( "Received chunk mesh update event for chunk {:?}" , event. position) ;
34
38
let chunk_option = chunk_manager. get_chunk ( event. position ) ;
35
39
match chunk_option {
36
40
Some ( chunk) => {
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ impl ChunkManager {
100
100
) ;
101
101
}
102
102
None => {
103
- println ! ( "No chunk found" ) ;
103
+ // println!("No chunk found");
104
104
}
105
105
}
106
106
}
@@ -121,7 +121,7 @@ impl ChunkManager {
121
121
) )
122
122
}
123
123
None => {
124
- println ! ( "No chunk found for block at {:?}" , position) ;
124
+ // println!("No chunk found for block at {:?}", position);
125
125
None
126
126
}
127
127
}
You can’t perform that action at this time.
0 commit comments