Skip to content

RvRepairVanApi

public static class RvRepairVanApi

Namespace RVRepairVan.Api

The RV’s state for other mods: whether Marco repaired it, which upgrades it has, and where it is while someone drives it. Read it after the world has loaded; before that every value is the empty state.

Co-op: the host owns the state and syncs it, so a client reads the host’s values. The events fire on every machine where the value changes, the host and each client. A save that loads already repaired raises no event; read IsRepaired once the world is up. A client that joins a host with a repaired RV gets the events when the host’s state arrives.

public const int ApiVersion = 1

Raised by additions to this API. 1: state, events, vehicle, send home.

public static bool IsRepaired { get; }

Marco has repaired the RV in this save.

public static bool HasEngine { get; }

The engine upgrade is bought: the RV can be driven.

public static int EnginePrice { get; }

What Marco asks for the engine upgrade, from this player’s settings.

public static bool IsEnabled { get; }

The mod is switched on in its settings.

public static LandVehicle Vehicle { get; }

The vehicle the RV rides on while it is off its spot or someone drives it, or null while it stands at home. Its transform is the RV’s position on the road.

public static bool IsDriving { get; }

True while someone sits at the RV’s wheel.

public static bool IsHome { get; }

The RV stands on its spot at the RV property.

public static event Action Repaired

Raised when the RV becomes repaired during play.

public static event Action EngineBought

Raised when the engine upgrade is bought during play.

public static bool TryGetPosition(out Vector3 position)

The RV’s position: on the road while it is out, else its spot. False before the world has loaded.

public static bool Contains(Vector3 world, float margin = 0.3f)

A world point lies in the RV’s body, or within margin metres of its sides, while the RV is on the road. Use it to tell who rides along. Always false while the RV stands at home.

public static bool SendHome(string reason)

Host: put the RV back on its spot at the RV property now, wherever it is. A driver at the wheel is taken out first. False on a co-op client. reason goes into the log.