pub struct PluginApi {
    pub shutdown: Option<fn()>,
    pub run_callbacks: Option<fn() -> bool>,
    pub event_enter_main_menu: Option<fn()>,
    pub event_enter_scenario_editor: Option<fn(map_width: u32, map_height: u32)>,
    pub event_enter_singleplayer: Option<fn(map_width: u32, map_height: u32)>,
    pub event_enter_multiplayer: Option<fn(map_width: u32, map_height: u32)>,
    pub event_joining_multiplayer: Option<fn()>,
}
Expand description

Pointers supplied by the plugin for OpenTTD to use.

Package to raw_api::OpenTTD_SocialIntegration_v1_PluginApi

Fields§

§shutdown: Option<fn()>

OpenTTD tells the plugin to shut down.

The plugin should free any resources it allocated, and must not call any of the callback functions after this call.

§run_callbacks: Option<fn() -> bool>

OpenTTD calls this function at regular intervals, to handle any callbacks the plugin might have.

It is also safe to call the OpenTTD_SocialIntegrationCallbacks functions here.

If the plugin wants to be called again, please return true. Return false if the plugin wants to be unloaded.

§event_enter_main_menu: Option<fn()>

The player has entered the main menu.

§event_enter_scenario_editor: Option<fn(map_width: u32, map_height: u32)>

The player has entered the Scenario Editor.

map_width is the width of the map in tiles. map_height is the height of the map in tiles.

§event_enter_singleplayer: Option<fn(map_width: u32, map_height: u32)>

The player has entered a singleplayer game.

map_width is the width of the map in tiles. map_height is the height of the map in tiles.

§event_enter_multiplayer: Option<fn(map_width: u32, map_height: u32)>

The player has entered a multiplayer game.

map_width is the width of the map in tiles. map_height is the height of the map in tiles.

§event_joining_multiplayer: Option<fn()>

The player is joining a multiplayer game.

This is followed by event_enter_multiplayer() if the join was successful.

Trait Implementations§

source§

impl Clone for PluginApi

source§

fn clone(&self) -> PluginApi

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for PluginApi

source§

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

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

impl Copy for PluginApi

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> 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,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.