Skip to main content

ServerGameDll

Struct ServerGameDll 

Source
pub struct ServerGameDll<'s> { /* private fields */ }
Expand description

The game’s half of the engine interface (IServerGameDLL), implemented by the game’s CServerGameDLL.

See the module documentation for how each method is exposed.

Implementations§

Source§

impl<'s> ServerGameDll<'s>

Source

pub const VERSION: &'static CStr = sdk_raw::interfaces::server_game_dll::VERSION

The version string this interface is requested by.

Source

pub const fn as_ptr(self) -> *mut IServerGameDLL

Returns the interface pointer, for calls this crate does not wrap.

Source§

impl<'s> ServerGameDll<'s>

Source

pub fn async_prepare_level_resources( self, map: &CStr, ) -> Result<LevelPreparation, MapNameTooLong>

Starts or polls preparing a level’s resources without blocking.

The game starts from map and the file maps/<map>.bsp, as for Self::prepare_level_resources. Fails if either does not fit in the game’s buffers.

Source

pub fn can_provide_level( self, map: &CStr, ) -> Result<LevelProvision, MapNameTooLong>

What the game would do with a map name if asked to prepare it, without blocking. Fails if the name, or the file maps/<map>.bsp, does not fit in the game’s buffers, as for Self::prepare_level_resources.

Source

pub fn entity_net_prop( self, entity: Entity<'s>, name: &CStr, ) -> Result<NetProp<'s>, NetPropError>

Resolves a networked variable of an entity’s class by name, as Self::net_prop does.

Fails with NetPropError::NotNetworked for an entity without a server class.

Source

pub fn game_description(self) -> CString

A description of the game, such as Team Fortress, or empty if the game returns none.

Source

pub fn gc_lobby(self) -> Option<ServerGcLobby<'s>>

The game coordinator’s lobby for this server, if the game has one.

Source

pub fn invalidate_mdl_cache(self)

Makes the game drop its cached model data, as the engine does after flushing the model cache.

Source

pub fn is_manual_map_change_okay(self) -> Result<(), MapChangeRefused>

Whether the game allows the map or changelevel commands right now.

Source

pub fn is_restoring(self) -> bool

Whether a single-player save is being restored.

Source

pub fn net_prop( self, class: ServerClass<'s>, name: &CStr, ) -> Result<NetProp<'s>, NetPropError>

Resolves a networked variable of a class by name.

The first variable with the name is found, searching the class’s table and the tables nested within it depth first, which includes those of base classes and embedded structures such as m_Local.

Fails if the class has no send table, the game provides no standard send proxies, or the variable is missing or cannot be addressed.

Source

pub fn prepare_level_resources( self, map: &CStr, ) -> Result<LevelResources, MapNameTooLong>

Resolves a map name, and has the game prepare its resources, such as downloading a workshop map. This may block for a long time.

The game starts from map and the file maps/<map>.bsp, and may replace either. Fails if either does not fit in the game’s buffers.

Source

pub fn save_comment( self, minutes: f32, seconds: f32, include_time: bool, ) -> CString

The comment the game would give a save made after the given play time.

Source

pub fn server_browser_game_data(self) -> Option<CString>

The game data string sent to the master server, or None if the game returns none.

Source

pub fn server_browser_map_override(self) -> Option<CString>

What the server browser’s map column shows instead of the map name, or None if it shows the map name.

Source

pub fn server_class(self, name: &CStr) -> Option<ServerClass<'s>>

Finds a networked entity class by name, such as CTFPlayer, or None if the game has none with the name.

Source

pub fn server_classes(self) -> ServerClasses<'s> ⓘ

Every networked entity class, sorted by name.

Source

pub fn should_hide_server(self) -> bool

Whether the game asks not to list the server publicly.

Source

pub fn standard_send_proxies(self) -> Option<StandardSendProxies<'s>>

The game DLL’s standard send proxies, or None if the game returns none.

Source

pub fn status(self) -> CString

The lines the game adds to the status command’s output.

Each line is formatted as the game prints it, truncated to 1023 bytes.

Source

pub fn tick_interval(self) -> f32

Seconds per simulation tick.

Source

pub fn user_message(self, index: usize) -> Option<UserMessage>

The user message the game registered at an index, or None if there is none.

Source

pub fn user_messages(self) -> impl Iterator<Item = UserMessage> + use<'s>

Every user message the game registered, in index order, up to the first index without one.

Source

pub fn workshop_map(self, index: u32) -> Option<WorkshopMap>

The workshop map the game knows at an index, or None if the index is invalid.

Source

pub fn workshop_maps(self) -> impl Iterator<Item = WorkshopMap> + use<'s>

Every workshop map the game knows, in index order, up to the first invalid index.

Trait Implementations§

Source§

impl<'s> Clone for ServerGameDll<'s>

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<'s> Copy for ServerGameDll<'s>

Source§

impl<'s> Debug for ServerGameDll<'s>

Source§

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

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

impl<'s> Eq for ServerGameDll<'s>

Source§

impl<'s> Hash for ServerGameDll<'s>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'s> PartialEq for ServerGameDll<'s>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'s> StructuralPartialEq for ServerGameDll<'s>

Auto Trait Implementations§

§

impl<'s> !Send for ServerGameDll<'s>

§

impl<'s> !Sync for ServerGameDll<'s>

§

impl<'s> Freeze for ServerGameDll<'s>

§

impl<'s> RefUnwindSafe for ServerGameDll<'s>

§

impl<'s> Unpin for ServerGameDll<'s>

§

impl<'s> UnsafeUnpin for ServerGameDll<'s>

§

impl<'s> UnwindSafe for ServerGameDll<'s>

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.