Orders: attack (fighting creatures nearby go for an enemy or enemy tower) and guard (up to three creatures hold a room for two minutes); right click with an order tool cancels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-04 07:52:03 +01:00
1 parent b3583f5e7e
commit 0606c1f994
9 files changed
+230 -6

No files matched your search

+9
View File
@@ -14,6 +14,7 @@ mod map;
mod menu;
mod personality;
mod platform;
mod orders;
mod particles;
mod props;
mod research;
@@ -123,6 +124,11 @@ fn world_action(app: &mut App, ui: &mut Ui, r3d: &R3d, inp: &mut Input, mx: f32,
(Tool::Tower(k), Some((x, z))) => app.game.build_tower(k, x, z),
(Tool::Trap(k), Some((x, z))) => app.game.place_trap(k, x, z),
(Tool::Spell(sp), _) => app.game.cast(sp, wx, wy),
(Tool::Order(0), _) => {
let j = r3d.pick_ent(&app.game, &app.cam, mx, my, false);
app.game.order_attack(j, wx, wy);
}
(Tool::Order(_), Some((x, z))) => app.game.order_guard(x, z),
_ => {}
}
}
@@ -720,6 +726,8 @@ async fn main() {
if !inp.rdrag && !over_ui && app.game.state == 0 {
if inp.ldown.is_some() {
inp.ldown = None;
} else if app.game.hand.is_empty() && matches!(ui.tool, Tool::Order(_)) {
app.game.cancel_orders();
} else {
app.game.drop(wx, wy);
}
@@ -1055,6 +1063,7 @@ fn draw_frame(app: &mut App, gfx: &Gfx, r3d: &mut R3d, ui: &mut Ui, menu: &mut M
Tool::Tower(_) => (Color::new(1.0, 0.6, 0.25, 1.0), None),
Tool::Trap(_) => (Color::new(1.0, 0.4, 0.3, 1.0), None),
Tool::Spell(sp) => (Color::new(0.8, 0.55, 1.0, 1.0), Some((ground.x, ground.y, sp.radius().max(0.6)))),
Tool::Order(_) => (Color::new(1.0, 0.3, 0.3, 1.0), None),
};
let ov = Overlay {
hover: if over_ui { None } else { hover_tile.filter(|&(x, z)| inb(x, z)) },