Agent control: observe and act from the control socket

game/agent.rs adds commands an agent can play with: state, looking-at,
entities, block, blocks, find-block, inventory, screen and messages read the
game as JSON; move, jump, goto (A* over standable blocks), look-at, attack,
break, place, interact, use-item, select, drop, open-inventory, click-button,
click-at, command, respawn, pause, wait and stop act like a player. Actions
that take time run as a task advanced every frame and reply when done, with
what happened (break reports drops and pickups, place the block placed).

Buttons are clicked by label: the classic and Horizon button drawers record
what they draw each frame (widgets.rs), and a click is a synthesized pointer
move and press, so it behaves exactly like the mouse on every screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-13 21:57:09 +02:00
parent 2df60cd388
commit 7bb3347edd
8 changed files with 1866 additions and 0 deletions
+6
View File
@@ -845,6 +845,12 @@ impl<'a> Ui<'a> {
kind: Kind,
enabled: bool,
) -> f32 {
if self.real {
// The control socket's button list, in GUI pixels.
let k = self.density / self.scale;
let (ox, oy) = self.offset;
crate::widgets::record(label, [(x + ox) * k, (y + oy) * k, w * k, h * k], enabled);
}
let hover = self.interact(id, x, y, w, h, enabled);
let saved = self.opacity;
if !enabled {