Skip to main content

TickConfig

Struct TickConfig 

Source
pub struct TickConfig {
    pub sa_mp: bool,
    pub omp: bool,
    pub omp_interval: Duration,
}
Expand description

Tells the SDK how often SampPlugin::on_tick should fire on each server.

The two servers schedule periodic callbacks differently:

  • SA-MP exports ProcessTick. The server’s main loop invokes it on every iteration — the cadence is whatever the server is configured for. The SDK has no say over the interval; the sa_mp flag only decides whether the export is advertised at all.
  • native Open Multiplayer has no built-in ProcessTick equivalent. The SDK installs a repeating timer on the server’s ITimersComponent in on_ready and dispatches the timeout into on_tick. The interval is the omp_interval field.

Fields§

§sa_mp: bool

Enable the tick on SA-MP. When false, the plugin does not advertise Supports::PROCESS_TICK and the export becomes inert.

§omp: bool

Enable the tick on native Open Multiplayer. When false, the SDK does not create the ITimersComponent timer in on_ready.

§omp_interval: Duration

Interval the SDK uses when creating the Open Multiplayer timer. Ignored when omp is false. Ignored entirely on SA-MP (the server controls the cadence).

Implementations§

Source§

impl TickConfig

Source

pub fn new() -> Self

Equivalent to TickConfig::default().

Source

pub fn sa_mp(self, enabled: bool) -> Self

Builder: sets sa_mp.

Source

pub fn omp(self, enabled: bool) -> Self

Builder: sets omp.

Source

pub fn omp_interval(self, interval: Duration) -> Self

Builder: sets omp_interval.

Source

pub fn sa_mp_only() -> Self

Shortcut: tick only on SA-MP. Equivalent to TickConfig::new().omp(false).

Use when the plugin has no meaningful work to do on the Open Multiplayer tick — for example, a pure SA-MP plugin running in legacy mode under Open Multiplayer.

Source

pub fn omp_only(interval: Duration) -> Self

Shortcut: tick only on native Open Multiplayer, at the supplied interval. Equivalent to TickConfig::new().sa_mp(false).omp_interval(interval).

Use when the plugin needs a controlled cadence specifically on Open Multiplayer and should stay silent on SA-MP — for example, a component that drives a long-poll loop only meaningful when the component API is reachable.

Trait Implementations§

Source§

impl Clone for TickConfig

Source§

fn clone(&self) -> TickConfig

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 TickConfig

Source§

impl Debug for TickConfig

Source§

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

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

impl Default for TickConfig

Source§

fn default() -> Self

Default: enabled on both servers, 5 ms timer on Open Multiplayer.

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> Same for T

Source§

type Output = T

Should always be Self
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, <T as TryFrom<U>>::Error>

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.