Skip to content

IResourceRuntime

Interface · Namespace OMX.ModAPI · Assembly OMX.ModAPI.Shared.dll

public interface IResourceRuntime

What both halves of a resource share.

Threading: every member is safe to call from any thread. Reads return the state the engine published for the latest frame. Changes are checked when called (so invalid ones throw right there) and applied by the engine on its next frame. Subscribed handlers run on the resource’s own thread, never the engine’s, so a slow or failing resource cannot stall or crash the game.

Implemented or extended by: IClientRuntime, IServerRuntime

ResourceCapabilities Capabilities { get; }
IResourceLog Log { get; }
IPlayers Players { get; }
ResourceInfo Resource { get; }
IResourceBus Resources { get; }
IResourceScheduler Scheduler { get; }
SessionKind Session { get; }

Single player or multiplayer. On the client this changes when the player joins or leaves a server (IClientRuntime.SessionChanged); every player and vehicle then leaves and the new session’s ones join, with the new session’s ids.

ApiSide Side { get; }
IResourceStorage Storage { get; }
IEventSource<double> Tick { get; }

Once per engine frame on the client, once per loop iteration on a dedicated server, with the seconds since the previous tick this resource received. A resource that falls behind receives one tick covering the time it missed rather than a backlog.

void Post(Action action);

Runs action on this resource’s thread, after anything already queued there.

Parameters