IResourceRuntime
Interface · Namespace OMX.ModAPI · Assembly OMX.ModAPI.Shared.dll
public interface IResourceRuntimeWhat 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
Properties
Section titled “Properties”Capabilities
Section titled “Capabilities”ResourceCapabilities Capabilities { get; }IResourceLog Log { get; }Players
Section titled “Players”IPlayers Players { get; }Resource
Section titled “Resource”ResourceInfo Resource { get; }Resources
Section titled “Resources”IResourceBus Resources { get; }Scheduler
Section titled “Scheduler”IResourceScheduler Scheduler { get; }Session
Section titled “Session”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; }Storage
Section titled “Storage”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.
Methods
Section titled “Methods”void Post(Action action);Runs action on this resource’s thread, after anything already queued there.
Parameters
actionAction
