migratetion to 0.18.0
This commit is contained in:
@@ -46,7 +46,7 @@ pub fn spawn_prefab(
|
||||
.get(&position.as_ivec3())
|
||||
.unwrap_or(&Vec::new())
|
||||
.clone();
|
||||
items.push(meat.index());
|
||||
items.push(meat.index_u32());
|
||||
tilemap
|
||||
.item_tiles
|
||||
.insert(position.as_ivec3(), items.clone());
|
||||
@@ -81,7 +81,7 @@ pub fn spawn_prefab(
|
||||
.get(&position.as_ivec3())
|
||||
.unwrap_or(&Vec::new())
|
||||
.clone();
|
||||
items.push(coin.index());
|
||||
items.push(coin.index_u32());
|
||||
tilemap
|
||||
.item_tiles
|
||||
.insert(position.as_ivec3(), items.clone());
|
||||
|
||||
@@ -130,9 +130,10 @@ pub fn item_tile_management_system(
|
||||
// Single item: ensure visible
|
||||
if items.len() <= 1 {
|
||||
if let Some(&entity_id) = items.first() {
|
||||
let entity = Entity::from_raw(entity_id);
|
||||
if let Ok(mut rotation_state) = item_query.get_mut(entity) {
|
||||
rotation_state.should_be_visible = true;
|
||||
if let Some(entity) = Entity::from_raw_u32(entity_id) {
|
||||
if let Ok(mut rotation_state) = item_query.get_mut(entity) {
|
||||
rotation_state.should_be_visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -146,17 +147,19 @@ pub fn item_tile_management_system(
|
||||
.unwrap_or(0);
|
||||
|
||||
for &entity_id in items {
|
||||
let entity = Entity::from_raw(entity_id);
|
||||
if let Ok(mut rotation_state) = item_query.get_mut(entity) {
|
||||
rotation_state.should_be_visible = false;
|
||||
if let Some(entity) = Entity::from_raw_u32(entity_id) {
|
||||
if let Ok(mut rotation_state) = item_query.get_mut(entity) {
|
||||
rotation_state.should_be_visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let next_index = (current_index + 1) % items.len();
|
||||
if let Some(&next_entity_id) = items.get(next_index) {
|
||||
let next_entity = Entity::from_raw(next_entity_id);
|
||||
if let Ok(mut rotation_state) = item_query.get_mut(next_entity) {
|
||||
rotation_state.should_be_visible = true;
|
||||
if let Some(next_entity) = Entity::from_raw_u32(next_entity_id) {
|
||||
if let Ok(mut rotation_state) = item_query.get_mut(next_entity) {
|
||||
rotation_state.should_be_visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user