pub fn add_player(world: &mut World) -> Player {
    let player = add_player_without_holder(world);

    let mut chunk_holders = world.fetch_mut::<ChunkHolders>();

    let view_distance = i32::from(world.fetch::<Arc<Config>>().server.view_distance);

    for x in -view_distance..=view_distance {
        for z in -view_distance..=view_distance {
            chunk_holders.insert_holder(ChunkPosition::new(x, z), player.entity);
        }
    }

    let mut chunk_entities = world.fetch_mut::<ChunkEntities>();
    chunk_entities.add_to_chunk(ChunkPosition::new(0, 0), player.entity);

    player
}
/// Adds a player to the world, inserting
/// all the necessary components. Returns
/// a number of useful channels.
///
/// # Notes
/// * A `ChunkHolders` and `ChunkEntities` entry
/// is created for the player. If this behavior is not
/// desired, use `add_player_without_holder`.
Adds a player to the world, inserting
all the necessary components. Returns
a number of useful channels.
Adds a player to the world inserting all the necessary components . Returns a number of useful channels .
pub fn add_player(world: &mut World) -> Player {
    let player = add_player_without_holder(world);
    let mut chunk_holders = world.fetch_mut::<ChunkHolders>();
    let view_distance = i32::from(world.fetch::<Arc<Config>>().server.view_distance);
    for x in -view_distance..=view_distance {
        for z in -view_distance..=view_distance {
            chunk_holders.insert_holder(ChunkPosition::new(x, z), player.entity);
        }
    }
    let mut chunk_entities = world.fetch_mut::<ChunkEntities>();
    chunk_entities.add_to_chunk(ChunkPosition::new(0, 0), player.entity);
    player
}
pub fn add_player ( world : & mut World ) -> Player { let player = add_player_without_holder ( world ) ; let mut chunk_holders = world . fetch_mut :: < ChunkHolders > ( ) ; let view_distance = i32 :: from ( world . fetch :: < Arc < Config > > ( ) . server . view_distance ) ; for x in - view_distance ..= view_distance { for z in - view_distance ..= view_distance { chunk_holders . insert_holder ( ChunkPosition :: new ( x , z ) , player . entity ) ; } } let mut chunk_entities = world . fetch_mut :: < ChunkEntities > ( ) ; chunk_entities . add_to_chunk ( ChunkPosition :: new ( 0 , 0 ) , player . entity ) ; player }
Adds a player to the world, inserting
all the necessary components.
Adds a player to the world inserting all the necessary components .
world
&mut World
world
&mut World
notes
A `ChunkHolders` and `ChunkEntities` entry
is created for the player. If this behavior is not
desired, use `add_player_without_holder`.
A ` ChunkHolders ` and ` ChunkEntities ` entry is created for the player . If this behavior is not desired use ` add_player_without_holder ` .