pub struct Commands { /* private fields */ }Expand description
The anvil-game.commands service, for this plugin.
Implementations§
Source§impl Commands
impl Commands
Sourcepub fn get(host: &Host) -> Option<Self>
pub fn get(host: &Host) -> Option<Self>
The service, posting for this plugin: the newest version anvil-game
has (3, 2, then 1); None without anvil-game 1.17.0 or on a game build
whose symbols for it are declared absent.
Sourcepub fn version(&self) -> u32
pub fn version(&self) -> u32
The service version found: 2 chooses event options, 3 also sets the game speed.
Sourcepub fn c_api(&self) -> Table<AnvilGameCommandsService>
pub fn c_api(&self) -> Table<AnvilGameCommandsService>
The C table, for what this crate does not wrap.
Sourcepub fn drill(&self, armies: &[UnitRef], start: bool) -> Result<Posted>
pub fn drill(&self, armies: &[UnitRef], start: bool) -> Result<Posted>
Armies: start drilling (start) or stop. Only the armies not yet in
that state get a command; the others count as skipped.
Sourcepub fn merge(&self, units: &[UnitRef]) -> Result<Posted>
pub fn merge(&self, units: &[UnitRef]) -> Result<Posted>
Two or more armies, or navies, in one province: merged into the first.
Sourcepub fn split(&self, unit: &UnitRef) -> Result<Posted>
pub fn split(&self, unit: &UnitRef) -> Result<Posted>
One army or navy: split in half, rounded up, as the button does.
Sourcepub fn choose_event_option(
&self,
pending_event_id: i32,
option: i32,
) -> Result<Posted>
pub fn choose_event_option( &self, pending_event_id: i32, option: i32, ) -> Result<Posted>
Version 2: chooses option (the event file’s order, from 0) of the
local player’s pending event pending_event_id, as its button does.
NotFound without its event window, InvalidArgument for an option
without a button, WrongPhase while the button is disabled (the half
second after the window opens: try a frame later); skipped when the
window is already chosen, refused when the session would not take it.
Unsupported on version 1.
Sourcepub fn set_speed(&self, speed: i32) -> Result<Posted>
pub fn set_speed(&self, speed: i32) -> Result<Posted>
Version 3: sets the game speed to speed (1 the slowest .. 5), as that
many clicks on the speed bar’s + or - would: one command a step.
skipped 1 at that speed already; refused 1 when the bar’s buttons
would do nothing (the in-game menu is shown, or a multiplayer client
without admin rights); InvalidArgument outside 1..5. Unsupported
before version 3.
Sourcepub fn explore(&self, units: &[UnitRef], how: Explore) -> Result<Posted>
pub fn explore(&self, units: &[UnitRef], how: Explore) -> Result<Posted>
Version 3: armies (Explore::Land) or fleets (Explore::Circumnavigate)
start exploring, as the unit panel’s button and the exploration dialog
do; Explore::Stop stops the units that explore. Units already in the
asked state count as skipped. The game checks each command when it
runs it. Unsupported before version 3.
Sourcepub fn move_to(
&self,
units: &[UnitRef],
province: i32,
queue: bool,
) -> Result<Posted>
pub fn move_to( &self, units: &[UnitRef], province: i32, queue: bool, ) -> Result<Posted>
Version 3: armies or fleets move to province, as a right-click on the
map does for a plain move: the path is replaced, or added to with
queue (as Shift). A move the game does not allow now counts as
refused. Unsupported before version 3.
Sourcepub fn siege_area(&self, armies: &[UnitRef], province: i32) -> Result<Posted>
pub fn siege_area(&self, armies: &[UnitRef], province: i32) -> Result<Posted>
Version 3: each army’s click on the map area of province in the siege
map mode: the area joins the army’s autonomous siege, or leaves it when
it is in it already. The game checks the area for each army and posts
the command itself; an army it says no for counts as refused.
NotFound for a province without a map area.