-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Structure spawns and other components
This splits up the spawning components quite a bit so that it's in multiple modules instead of 1, which means it's a bit easier to read. In addition to that I'm shuffling some other code around and adding a new spawnable for structures, which are _slightly_ different from the tdlg ones, which I might want to fix up at some point in time.
- Loading branch information
Showing
26 changed files
with
217 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use bevy::prelude::Component; | ||
|
||
use crate::components::characters::CreatureType; | ||
|
||
use super::SpawnCoordinate; | ||
|
||
#[derive(Component)] | ||
pub struct CharacterSpawns { | ||
pub spawnables: Vec<CharacterSpawnable>, | ||
} | ||
|
||
impl CharacterSpawns { | ||
pub fn clear(&mut self) { | ||
self.spawnables.clear(); | ||
} | ||
} | ||
|
||
pub struct CharacterSpawnable { | ||
pub spawn_type: CreatureType, | ||
pub coordinate: SpawnCoordinate, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use bevy::prelude::Component; | ||
|
||
use super::{TdlgSpawnable, ZoneSpawnable}; | ||
|
||
#[derive(Component)] | ||
pub struct MapSpawns { | ||
pub tdlg_spawnables: Vec<TdlgSpawnable>, | ||
pub zone_spawnables: Vec<ZoneSpawnable>, | ||
} | ||
|
||
impl MapSpawns { | ||
pub fn clear(&mut self) { | ||
self.tdlg_spawnables.clear(); | ||
self.zone_spawnables.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mod character_spawns; | ||
mod map_spawns; | ||
mod spawn_coordinate; | ||
mod structure_spawns; | ||
mod tdlg_spawnable; | ||
mod zone_spawnable; | ||
|
||
pub use character_spawns::{CharacterSpawnable, CharacterSpawns}; | ||
pub use map_spawns::MapSpawns; | ||
pub use spawn_coordinate::SpawnCoordinate; | ||
pub use structure_spawns::{StructureSpawnType, StructureSpawnable, StructureSpawns}; | ||
pub use tdlg_spawnable::TdlgSpawnable; | ||
pub use zone_spawnable::ZoneSpawnable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use tdlg::map::cells::Coordinate; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct SpawnCoordinate { | ||
pub coordinate: Coordinate, | ||
pub z_level: f32, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use bevy::prelude::{Component, Visibility}; | ||
|
||
use super::SpawnCoordinate; | ||
|
||
#[derive(Component, Debug, Clone)] | ||
pub struct StructureSpawns { | ||
pub spawnables: Vec<StructureSpawnable>, | ||
} | ||
|
||
impl StructureSpawns { | ||
pub fn clear(&mut self) { | ||
self.spawnables.clear(); | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct StructureSpawnable { | ||
pub spawn_type: StructureSpawnType, | ||
pub spawn_coordinate: SpawnCoordinate, | ||
pub visibility: Visibility, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug)] | ||
pub enum StructureSpawnType { | ||
StorageArea, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use bevy::prelude::Visibility; | ||
use tdlg::map::layers::LayerType; | ||
|
||
use super::SpawnCoordinate; | ||
|
||
pub struct TdlgSpawnable { | ||
pub layer_type: LayerType, | ||
pub spawn_coordinate: SpawnCoordinate, | ||
pub visibility: Visibility, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use crate::components::zones::ZoneType; | ||
|
||
use super::SpawnCoordinate; | ||
|
||
pub struct ZoneSpawnable { | ||
pub spawn_coordinate: SpawnCoordinate, | ||
pub zone_type: ZoneType, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
mod body; | ||
mod mineable; | ||
mod mining_target; | ||
mod setup_storage_area; | ||
mod storage_area; | ||
mod structure; | ||
|
||
pub use body::GridBody; | ||
pub use mineable::Mineable; | ||
pub use mining_target::MiningTarget; | ||
pub use setup_storage_area::SetupStorageArea; | ||
pub use storage_area::StorageArea; | ||
pub use structure::Structure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
use bevy::prelude::Component; | ||
|
||
#[derive(Clone, Component, Debug)] | ||
pub struct StorageArea {} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
mod mining_target; | ||
mod setup_storage_area; | ||
mod task; | ||
mod todo; | ||
|
||
pub use mining_target::MiningTarget; | ||
pub use setup_storage_area::SetupStorageArea; | ||
pub use task::Task; | ||
pub use todo::Todo; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ use bevy::prelude::Component; | |
pub enum ZoneType { | ||
Exploration, | ||
SetupStorageArea, | ||
StorageArea, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
use bevy::prelude::Query; | ||
|
||
use crate::components::{CharacterSpawns, MapSpawns}; | ||
use crate::components::{CharacterSpawns, MapSpawns, StructureSpawns}; | ||
|
||
pub fn clear( | ||
mut character_spawns_query: Query<&mut CharacterSpawns>, | ||
mut map_spawns_query: Query<&mut MapSpawns>, | ||
mut structure_spawns_query: Query<&mut StructureSpawns>, | ||
) { | ||
if let Ok(mut character_spawns) = character_spawns_query.get_single_mut() { | ||
character_spawns.spawnables.clear(); | ||
character_spawns.clear(); | ||
} | ||
|
||
if let Ok(mut map_spawns) = map_spawns_query.get_single_mut() { | ||
map_spawns.clear(); | ||
} | ||
|
||
if let Ok(mut structure_spawns) = structure_spawns_query.get_single_mut() { | ||
structure_spawns.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
mod characters; | ||
mod clear; | ||
mod map; | ||
mod structures; | ||
|
||
pub use characters::characters; | ||
pub use clear::clear; | ||
pub use map::map; | ||
pub use structures::structures; |
Oops, something went wrong.