pub(crate) fn on_remove_auto_tile(
	mut event: EventReader<RemoveAutoTileEvent>,
	// All tiles (used for the tilemap cache)
	all_tiles: Query<(Entity, &TilePos, &TileParent, &AutoTileId), With<Tile>>,
	mut working_tiles: Query<(
		Entity,
		&TilePos,
		&mut Tile,
		&TileParent,
		&AutoTileId,
		Option<&mut GPUAnimated>,
	)>,
	tilesets: Tilesets,
	map_query: MapQuery,
	mut commands: Commands,
) {
	let mut map_query_cell = RefCell::new(map_query);
	let mut cache = TilemapCache {
		tiles_query: &all_tiles,
		map_query: &map_query_cell,
	};
	let mut tiler = AutoTiler::new(&mut cache);

	for ref evt in event.iter() {
		let RemoveAutoTileEvent {
			entity,
			pos,
			parent,
			auto_id,
		} = evt;
		tiler.add_tile(TileInfo::new(*entity, pos, parent, auto_id), true);
	}

	let requests = tiler.finish();

	apply_requests(
		&requests,
		&tilesets,
		&mut working_tiles,
		&mut commands,
		map_query_cell.get_mut(),
	);
}
/// __\[SYSTEM\]__ Handles the removal of auto tiles
///
/// Specifically, notifies the surrounding auto tiles of the change
/// This method needs to be called after the removal but within the same frame, otherwise
/// the query will be empty
\[SYSTEM\]__ Handles the removal of auto tiles
Specifically, notifies the surrounding auto tiles of the change
This method needs to be called after the removal but within the same frame, otherwise
the query will be empty
\ [ SYSTEM \ ] __ Handles the removal of auto tiles Specifically notifies the surrounding auto tiles of the change This method needs to be called after the removal but within the same frame otherwise the query will be empty
pub(crate) fn on_remove_auto_tile(
	mut event: EventReader<RemoveAutoTileEvent>,
	// All tiles (used for the tilemap cache)
	all_tiles: Query<(Entity, &TilePos, &TileParent, &AutoTileId), With<Tile>>,
	mut working_tiles: Query<(
		Entity,
		&TilePos,
		&mut Tile,
		&TileParent,
		&AutoTileId,
		Option<&mut GPUAnimated>,
	)>,
	tilesets: Tilesets,
	map_query: MapQuery,
	mut commands: Commands,
) {
	let mut map_query_cell = RefCell::new(map_query);
	let mut cache = TilemapCache {
		tiles_query: &all_tiles,
		map_query: &map_query_cell,
	};
	let mut tiler = AutoTiler::new(&mut cache);
	for ref evt in event.iter() {
		let RemoveAutoTileEvent {
			entity,
			pos,
			parent,
			auto_id,
		} = evt;
		tiler.add_tile(TileInfo::new(*entity, pos, parent, auto_id), true);
	}
	let requests = tiler.finish();
	apply_requests(
		&requests,
		&tilesets,
		&mut working_tiles,
		&mut commands,
		map_query_cell.get_mut(),
	);
}
pub ( crate ) fn on_remove_auto_tile ( mut event : EventReader < RemoveAutoTileEvent > , // All tiles (used for the tilemap cache) all_tiles : Query < ( Entity , & TilePos , & TileParent , & AutoTileId ) , With < Tile > > , mut working_tiles : Query < ( Entity , & TilePos , & mut Tile , & TileParent , & AutoTileId , Option < & mut GPUAnimated > , ) > , tilesets : Tilesets , map_query : MapQuery , mut commands : Commands , ) { let mut map_query_cell = RefCell :: new ( map_query ) ; let mut cache = TilemapCache { tiles_query : & all_tiles , map_query : & map_query_cell , } ; let mut tiler = AutoTiler :: new ( & mut cache ) ; for ref evt in event . iter ( ) { let RemoveAutoTileEvent { entity , pos , parent , auto_id , } = evt ; tiler . add_tile ( TileInfo :: new ( * entity , pos , parent , auto_id ) , true ) ; } let requests = tiler . finish ( ) ; apply_requests ( & requests , & tilesets , & mut working_tiles , & mut commands , map_query_cell . get_mut ( ) , ) ; }
__\[SYSTEM\]__ Handles the removal of auto tiles
Specifically, notifies the surrounding auto tiles of the change
This method needs to be called after the removal but within the same frame, otherwise
the query will be empty
__ \ [ SYSTEM \ ] __ Handles the removal of auto tiles Specifically notifies the surrounding auto tiles of the change This method needs to be called after the removal but within the same frame otherwise the query will be empty
event
EventReader<RemoveAutoTileEvent>
all_tiles
Query<(Entity, &TilePos, &TileParent, &AutoTileId), With<Tile>>
working_tiles
Query<(
		Entity,
		&TilePos,
		&mut Tile,
		&TileParent,
		&AutoTileId,
		Option<&mut GPUAnimated>,
	)>
tilesets
Tilesets
map_query
MapQuery
commands
Commands
event
EventReader<RemoveAutoTileEvent>
all_tiles
Query<(Entity, &TilePos, &TileParent, &AutoTileId), With<Tile>>
working_tiles
Query<(
		Entity,
		&TilePos,
		&mut Tile,
		&TileParent,
		&AutoTileId,
		Option<&mut GPUAnimated>,
	)>
tilesets
Tilesets
map_query
MapQuery
commands
Commands