Skip to content

Commit

Permalink
Add better names for Turrets & Hexes
Browse files Browse the repository at this point in the history
Mostly useful for debugging
  • Loading branch information
regnarock committed Dec 21, 2023
1 parent 758cc88 commit 5961bcd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/grid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy::{

use hexx::{Hex, HexBounds, HexLayout, PlaneMeshBuilder, Vec2};

use crate::{GameState, MarkerGameStatePlaying};
use crate::GameState;

pub use self::hex::HexCell;
use self::hex::{on_click, HexClicked, HexMaterial, NonConstructible, SpawnHex};
Expand Down Expand Up @@ -93,6 +93,7 @@ fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
hex,
mesh: mesh.clone(),
})
.insert(Name::new(format!("Hex[{:?}]", hex)))
.id();
(hex, entity)
})
Expand Down
6 changes: 5 additions & 1 deletion src/turret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ impl EntityCommand for SpawnTurret {
});
let hex_grid = world.resource::<HexGrid>();
let hex_radius: f32 = hex_grid.layout.hex_size.length();
let name = format!(
"Turret[{:?}]",
hex_grid.layout.world_pos_to_hex(self.position)
);
let spawned_turret = world
.entity_mut(id)
.insert((
Expand All @@ -94,7 +98,7 @@ impl EntityCommand for SpawnTurret {
Turret {
parent_hex: self.at_hex,
},
Name::new("Turret"),
Name::new(name),
AutoGun::new(1.),
View::new(2. * hex_radius),
MarkerGameStatePlaying,
Expand Down

0 comments on commit 5961bcd

Please sign in to comment.