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; thesa_mpflag only decides whether the export is advertised at all. - native Open Multiplayer has no built-in
ProcessTickequivalent. The SDK installs a repeating timer on the server’sITimersComponentinon_readyand dispatches the timeout intoon_tick. The interval is theomp_intervalfield.
Fields§
§sa_mp: boolEnable the tick on SA-MP. When false, the plugin does not advertise
Supports::PROCESS_TICK and the export becomes inert.
omp: boolEnable the tick on native Open Multiplayer. When false, the SDK
does not create the ITimersComponent timer in on_ready.
omp_interval: DurationInterval 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
impl TickConfig
Sourcepub fn omp_interval(self, interval: Duration) -> Self
pub fn omp_interval(self, interval: Duration) -> Self
Builder: sets omp_interval.
Sourcepub fn sa_mp_only() -> Self
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.
Sourcepub fn omp_only(interval: Duration) -> Self
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
impl Clone for TickConfig
Source§fn clone(&self) -> TickConfig
fn clone(&self) -> TickConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more