minor
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 295 B |
@@ -70,19 +70,33 @@ 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>>,
|
||||
) {
|
||||
for (mut timer, transform) in &mut pigs {
|
||||
timer.tick(time.delta());
|
||||
|
||||
if timer.just_finished() {
|
||||
// Example: pig drops raw meat
|
||||
spawn_prefab(
|
||||
&mut commands,
|
||||
&asset_server,
|
||||
MiscPrefab::RawMeat,
|
||||
transform.translation,
|
||||
&mut tilemap,
|
||||
);
|
||||
if let Ok(mut rng) = rng_q.single_mut() {
|
||||
if rng.random_range(0..10) <= 5 {
|
||||
// Example: pig drops raw meat
|
||||
spawn_prefab(
|
||||
&mut commands,
|
||||
&asset_server,
|
||||
MiscPrefab::RawMeat,
|
||||
transform.translation,
|
||||
&mut tilemap,
|
||||
);
|
||||
} else {
|
||||
//example: pig drops a coin
|
||||
spawn_prefab(
|
||||
&mut commands,
|
||||
&asset_server,
|
||||
MiscPrefab::Coin,
|
||||
transform.translation,
|
||||
&mut tilemap,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{entities::item::Item, game};
|
||||
#[derive(Resource, Default, Clone)]
|
||||
pub struct TileMap {
|
||||
pub floor_tiles: HashMap<IVec3, (i32, bool, bool, bool, i32, [u32; 8])>, //id, canStandIn, canStandOn, visiblyTransparent, astar_weight, visible_range
|
||||
pub fixture_tiles: HashMap<IVec3, (i32, bool, bool, [u32; 8])>, // id, canStandIn, canStandOn, visible_range
|
||||
pub fixture_tiles: HashMap<IVec3, (i32, bool, bool, [u32; 8])>, // id, canStandIn, canStandOn, visible_range //TODO - consider moving alot of this into the fixtures components
|
||||
pub item_tiles: HashMap<IVec3, Vec<u32>>, // Entity.id's of items on this tile
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ impl Default for ItemRotationTimer {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - broken, doesnt work with the visibleGameEntity system
|
||||
pub fn item_tile_management_system(
|
||||
time: Res<Time>,
|
||||
mut tilemap: ResMut<TileMap>,
|
||||
@@ -32,11 +33,6 @@ pub fn item_tile_management_system(
|
||||
z_index: Res<game::ZIndex>,
|
||||
mut visibility_query: Query<&mut Visibility, With<Item>>,
|
||||
) {
|
||||
println!(
|
||||
"{} items accross {} tiles",
|
||||
visibility_query.iter().count(),
|
||||
tilemap.item_tiles.len()
|
||||
);
|
||||
rotation_timer.timer.tick(time.delta());
|
||||
|
||||
let mut tiles_to_remove = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user