Files
benilla-octo/crates/benilla-ui/src/script/screenshot.rs
T
SamandClaude Fable 5 a8a7d85ca2 six lanes stop paying for the idle crowd, and Print Screen lands
- Print Screen takes a screenshot to `benilla-config/Screenshots/` (F13 on macOS), shows the reference's "Screen Captured" line, and the line never appears in the file — the capture defers one frame so the hidden confirmation's quads rebuild first; and the rule it surfaced is now hard law: benilla never writes anything into the WoW install
- six per-frame taxes now skip when their inputs are settled: water foam asks a spatial index (a dry unit is one hash miss, was a ~2.2k-surface scan per unit), an idle remote stops its capsule sweeps at the fixed point, hover picks stop allocating ahead of the ray-sphere reject, an unchanged unit's loadout is not re-derived, and the ground-shade walk stops re-asserting the world — settled inputs produce bitwise-identical outputs, each lane fenced by its own test; ms pricing still waits on a quiet machine
- overhead names take the V-plates' 20-yard cap, read at the bytes (this one is wrong and reverts in the next snapshot — the law belongs to the other nameplate system)
- the calendar lifts out of the `date()` global into its own module

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 18:04:55 +07:00

42 lines
1.8 KiB
Rust

//! **`Screenshot()`** — the engine verb behind the print-screen key (decision 1487).
//!
//! One global and one counter. The reference's binding is `SCREENSHOT` → `TakeScreenshot()`
//! (FrameXML `Bindings.xml`), whose body hides the status text and then calls this engine
//! function; the engine answers later with `SCREENSHOT_SUCCEEDED` or `SCREENSHOT_FAILED`, which
//! is what puts "Screen Captured" on screen. **The answer is an EVENT, never a return value** —
//! and that is the whole mechanism that keeps the message out of the file it announces: the
//! capture is already taken by the time anything can say so.
//!
//! A **count**, like [`super::client`]'s `RequestTimePlayed` and `ConfirmBinder`: the request
//! carries no payload (the app owns the window, the folder and the clock), so two calls in a frame
//! are two captures rather than one collapsed intent. The app drains it in
//! [`crate::script::UiScript::take_screenshot_asks`].
use mlua::Lua;
use super::Model;
pub(super) fn install(lua: &Lua) -> mlua::Result<()> {
// `Screenshot()` — take one. Returns nothing: the reference's does not either, because the
// capture completes after the frame that asked for it and the outcome arrives as
// SCREENSHOT_SUCCEEDED / SCREENSHOT_FAILED.
lua.globals().set(
"Screenshot",
lua.create_function(|lua, ()| {
lua.app_data_mut::<Model>()
.expect("model app_data")
.screenshot_asks += 1;
Ok(())
})?,
)?;
Ok(())
}
impl super::UiScript {
/// Drain the `Screenshot()` calls queued since the last call — each one is one capture.
/// [`super::UiScript::take_played_time_asks`]'s shape, for the same reason.
pub fn take_screenshot_asks(&mut self) -> u32 {
std::mem::take(&mut self.model_mut().screenshot_asks)
}
}