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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::world::tiles::tilemap;
|
||||
use crate::world::VisibleGameEntity;
|
||||
use bevy::prelude::*;
|
||||
use bevy_rand::prelude::*;
|
||||
use rand::Rng;
|
||||
use rand::RngExt;
|
||||
|
||||
#[derive(Bundle)]
|
||||
pub struct Pig {
|
||||
@@ -45,7 +45,7 @@ pub struct PigDropTimer(pub Timer);
|
||||
pub fn spawn_pigs(
|
||||
mut commands: Commands,
|
||||
asset_server: Res<AssetServer>,
|
||||
mut rng_q: Query<&mut Entropy<WyRand>, With<Global>>,
|
||||
mut rng_q: Query<&mut WyRand, With<GlobalRng>>,
|
||||
) {
|
||||
if let Ok(mut rng) = rng_q.single_mut() {
|
||||
for _ in 0..5 {
|
||||
@@ -70,7 +70,7 @@ pub fn pig_drop_system(
|
||||
time: Res<Time>,
|
||||
mut pigs: Query<(&mut PigDropTimer, &Transform)>,
|
||||
mut tilemap: ResMut<tilemap::TileMap>,
|
||||
mut rng_q: Query<&mut Entropy<WyRand>, With<Global>>,
|
||||
mut rng_q: Query<&mut WyRand, With<GlobalRng>>,
|
||||
) {
|
||||
for (mut timer, transform) in &mut pigs {
|
||||
timer.tick(time.delta());
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::entities::shared_components::Ambulatory;
|
||||
use crate::world::VisibleGameEntity;
|
||||
use bevy::prelude::*;
|
||||
use bevy_rand::prelude::*;
|
||||
use rand::Rng;
|
||||
use rand::RngExt;
|
||||
|
||||
#[derive(Bundle)]
|
||||
pub struct Rabbit {
|
||||
@@ -38,7 +38,7 @@ impl Rabbit {
|
||||
pub fn spawn_rabbits(
|
||||
mut commands: Commands,
|
||||
asset_server: Res<AssetServer>,
|
||||
mut rng_q: Query<&mut Entropy<WyRand>, With<Global>>,
|
||||
mut rng_q: Query<&mut WyRand, With<GlobalRng>>,
|
||||
) {
|
||||
if let Ok(mut rng) = rng_q.single_mut() {
|
||||
for _ in 0..15 {
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::entities::shared_components::Ambulatory;
|
||||
use crate::world::VisibleGameEntity;
|
||||
use bevy::prelude::*;
|
||||
use bevy_rand::prelude::*;
|
||||
use rand::Rng;
|
||||
use rand::RngExt;
|
||||
|
||||
#[derive(Bundle)]
|
||||
pub struct Dorf {
|
||||
@@ -38,7 +38,7 @@ impl Dorf {
|
||||
pub fn spawn_dorfs(
|
||||
mut commands: Commands,
|
||||
asset_server: Res<AssetServer>,
|
||||
mut rng_q: Query<&mut Entropy<WyRand>, With<Global>>,
|
||||
mut rng_q: Query<&mut WyRand, With<GlobalRng>>,
|
||||
) {
|
||||
if let Ok(mut rng) = rng_q.single_mut() {
|
||||
// Spawn a handful of dorfs
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::world::{chunks::ChunkMap, chunks::CHUNK_SIZE};
|
||||
use crate::{constants::*, entities::shared_components::Ambulatory};
|
||||
use bevy::{math::ivec3, prelude::*};
|
||||
use bevy_rand::prelude::*;
|
||||
use rand::Rng;
|
||||
use rand::RngExt;
|
||||
use std::{
|
||||
collections::{BinaryHeap, HashMap, HashSet},
|
||||
process::exit,
|
||||
@@ -41,7 +41,7 @@ pub fn update_wandering_targets(
|
||||
mut query: Query<(&mut Ambulatory, &Transform)>, // add a 'with' here when behaviours are implemented
|
||||
tilemap: Res<TileMap>,
|
||||
chunk_map: Res<ChunkMap>,
|
||||
mut rng_q: Query<&mut Entropy<WyRand>, With<Global>>,
|
||||
mut rng_q: Query<&mut WyRand, With<GlobalRng>>,
|
||||
) {
|
||||
if let Ok(mut rng) = rng_q.single_mut() {
|
||||
for (mut ambulatory, _) in query.iter_mut() {
|
||||
|
||||
Reference in New Issue
Block a user