pub fn add_to_layer<TId: Into<TileId>, Pos: Into<TilePos>>(
		&mut self,
		tile_id: TId,
		pos: Pos,
		layer_builder: &mut LayerBuilder<TileBundle>,
	) -> TilePlacementResult {
		let id = tile_id.into();
		let pos = pos.into();
		let tileset_id = self.get_tileset_id(&id)?;
		let tile_index = self.get_tile_index(&id)?;

		let entity = match tile_index {
			TileIndex::Standard(index) => {
				layer_builder
					.set_tile(
						pos,
						Tile {
							texture_index: index as u16,
							..Default::default()
						}
						.into(),
					)
					.map_err(|err| TilePlacementError::MapError(err))?;
				layer_builder
					.get_tile_entity(&mut self.commands, pos)
					.map_err(|err| TilePlacementError::MapError(err))?
			},
			TileIndex::Animated(start, end, speed) => {
				layer_builder
					.set_tile(
						pos,
						Tile {
							texture_index: start as u16,
							..Default::default()
						}
						.into(),
					)
					.map_err(|err| TilePlacementError::MapError(err))?;
				let entity = layer_builder
					.get_tile_entity(&mut self.commands, pos)
					.map_err(|err| TilePlacementError::MapError(err))?;
				self.commands.entity(entity).insert(GPUAnimated::new(
					start as u32,
					end as u32,
					speed,
				));
				entity
			},
		};

		self.commands
			.entity(entity)
			.insert(TilesetParent(tileset_id));

		#[cfg(feature = "auto-tile")]
		self.apply_auto_tile(&id, &tileset_id, entity);

		Ok(PlacedTile::Added {
			old_tile: None,
			new_tile: (entity, id),
		})
	}
/// Adds a tile to the given `LayerBuilder`
///
/// This is used to initialize the tilemap layer _before_ it becomes accessible via queries
///
/// # Arguments
///
/// * `tile_id`: The full ID of the tile to place
/// * `pos`: The tile position
/// * `layer_builder`: The layer builder
///
Adds a tile to the given `LayerBuilder`
This is used to initialize the tilemap layer _before_ it becomes accessible via queries
Adds a tile to the given ` LayerBuilder ` This is used to initialize the tilemap layer _before_ it becomes accessible via queries
pub fn add_to_layer<TId: Into<TileId>, Pos: Into<TilePos>>(
		&mut self,
		tile_id: TId,
		pos: Pos,
		layer_builder: &mut LayerBuilder<TileBundle>,
	) -> TilePlacementResult {
		let id = tile_id.into();
		let pos = pos.into();
		let tileset_id = self.get_tileset_id(&id)?;
		let tile_index = self.get_tile_index(&id)?;
		let entity = match tile_index {
			TileIndex::Standard(index) => {
				layer_builder
					.set_tile(
						pos,
						Tile {
							texture_index: index as u16,
							..Default::default()
						}
						.into(),
					)
					.map_err(|err| TilePlacementError::MapError(err))?;
				layer_builder
					.get_tile_entity(&mut self.commands, pos)
					.map_err(|err| TilePlacementError::MapError(err))?
			},
			TileIndex::Animated(start, end, speed) => {
				layer_builder
					.set_tile(
						pos,
						Tile {
							texture_index: start as u16,
							..Default::default()
						}
						.into(),
					)
					.map_err(|err| TilePlacementError::MapError(err))?;
				let entity = layer_builder
					.get_tile_entity(&mut self.commands, pos)
					.map_err(|err| TilePlacementError::MapError(err))?;
				self.commands.entity(entity).insert(GPUAnimated::new(
					start as u32,
					end as u32,
					speed,
				));
				entity
			},
		};
		self.commands
			.entity(entity)
			.insert(TilesetParent(tileset_id));
		#[cfg(feature = "auto-tile")]
		self.apply_auto_tile(&id, &tileset_id, entity);
		Ok(PlacedTile::Added {
			old_tile: None,
			new_tile: (entity, id),
		})
	}
pub fn add_to_layer < TId : Into < TileId > , Pos : Into < TilePos > > ( & mut self , tile_id : TId , pos : Pos , layer_builder : & mut LayerBuilder < TileBundle > , ) -> TilePlacementResult { let id = tile_id . into ( ) ; let pos = pos . into ( ) ; let tileset_id = self . get_tileset_id ( & id ) ? ; let tile_index = self . get_tile_index ( & id ) ? ; let entity = match tile_index { TileIndex :: Standard ( index ) => { layer_builder . set_tile ( pos , Tile { texture_index : index as u16 , .. Default :: default ( ) } . into ( ) , ) . map_err ( | err | TilePlacementError :: MapError ( err ) ) ? ; layer_builder . get_tile_entity ( & mut self . commands , pos ) . map_err ( | err | TilePlacementError :: MapError ( err ) ) ? } , TileIndex :: Animated ( start , end , speed ) => { layer_builder . set_tile ( pos , Tile { texture_index : start as u16 , .. Default :: default ( ) } . into ( ) , ) . map_err ( | err | TilePlacementError :: MapError ( err ) ) ? ; let entity = layer_builder . get_tile_entity ( & mut self . commands , pos ) . map_err ( | err | TilePlacementError :: MapError ( err ) ) ? ; self . commands . entity ( entity ) . insert ( GPUAnimated :: new ( start as u32 , end as u32 , speed , ) ) ; entity } , } ; self . commands . entity ( entity ) . insert ( TilesetParent ( tileset_id ) ) ; # [ cfg ( feature " " ) ] self . apply_auto_tile ( & id , & tileset_id , entity ) ; Ok ( PlacedTile :: Added { old_tile : None , new_tile : ( entity , id ) , } ) }
Adds a tile to the given `LayerBuilder`
This is used to initialize the tilemap layer _before_ it becomes accessible via queries
Adds a tile to the given ` LayerBuilder ` This is used to initialize the tilemap layer _before_ it becomes accessible via queries
&mut self
tile_id
TId
pos
Pos
layer_builder
&mut LayerBuilder<TileBundle>
&mut self
tile_id
TId
pos
Pos
layer_builder
&mut LayerBuilder<TileBundle>