Add digging tasks and unit coordinate support

Introduce Tasks handling for units, store coordinates in MinerUnit,
expose getters/setters for unit tasks, add logging of marked cells,
and provide cell accessors for mutable unit options.
This commit is contained in:
2026-05-12 13:42:13 +02:00
parent a3bb9dc6f1
commit f554fa2efc
5 changed files with 70 additions and 7 deletions
+12 -2
View File
@@ -7,16 +7,18 @@ pub struct MinerUnit {
hp: u16,
can_dig: bool,
digging_power: f32,
pub tasks: VecDeque<Tasks>,
coords: (usize, usize),
tasks: VecDeque<Tasks>,
}
impl MinerUnit {
pub fn new(owner: Players) -> Self {
pub fn new(owner: Players, coords: (usize, usize)) -> Self {
Self {
owner,
hp: 100,
can_dig: true,
digging_power: 0.55,
coords,
tasks: VecDeque::new(),
}
}
@@ -50,4 +52,12 @@ impl Unit for MinerUnit {
fn get_digging_power(&self) -> f32 {
self.digging_power
}
fn get_coords(&self) -> (usize, usize) {
self.coords
}
fn set_task(&mut self, task: Tasks) {
self.tasks.push_back(task);
}
}