Skip to main content

Commands

Struct Commands 

Source
pub struct Commands { /* private fields */ }
Expand description

The anvil-game.commands service, for this plugin.

Implementations§

Source§

impl Commands

Source

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.

Source

pub fn version(&self) -> u32

The service version found: 2 chooses event options, 3 also sets the game speed.

Source

pub fn c_api(&self) -> Table<AnvilGameCommandsService>

The C table, for what this crate does not wrap.

Source

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.

Source

pub fn merge(&self, units: &[UnitRef]) -> Result<Posted>

Two or more armies, or navies, in one province: merged into the first.

Source

pub fn split(&self, unit: &UnitRef) -> Result<Posted>

One army or navy: split in half, rounded up, as the button does.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn suppress_area(&self, armies: &[UnitRef], province: i32) -> Result<Posted>

Version 3: the same in the rebel-suppression map mode: the area joins the army’s rebel hunt, or leaves it.

Trait Implementations§

Source§

impl Clone for Commands

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Commands

Source§

impl Debug for Commands

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Send for Commands

Source§

impl Sync for Commands

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.