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