Table of Contents

Class SimUtil

Namespace
KSP.Networking.MP.Utils
Assembly
Assembly-CSharp.dll
public class SimUtil
Inheritance
SimUtil
Inherited Members
Extension Methods

Constructors

SimUtil()

public SimUtil()

Fields

ROTATE_FAST_DELTA_ANGLE

public const float ROTATE_FAST_DELTA_ANGLE = 90

Field Value

float

ROTATE_MEDIUM_DELTA_ANGLE

public const float ROTATE_MEDIUM_DELTA_ANGLE = 45

Field Value

float

ROTATE_NORMAL_DELTA_ANGLE

public const float ROTATE_NORMAL_DELTA_ANGLE = 5

Field Value

float

ROTATE_SLOW_DELTA_ANGLE

public const float ROTATE_SLOW_DELTA_ANGLE = 1.25

Field Value

float

TRANSLATE_FAST_SCALE_XY

public const float TRANSLATE_FAST_SCALE_XY = 200

Field Value

float

TRANSLATE_FAST_SCALE_Z

public const float TRANSLATE_FAST_SCALE_Z = 500

Field Value

float

TRANSLATE_MEDIUM_SCALE_XY

public const float TRANSLATE_MEDIUM_SCALE_XY = 20

Field Value

float

TRANSLATE_MEDIUM_SCALE_Z

public const float TRANSLATE_MEDIUM_SCALE_Z = 50

Field Value

float

TRANSLATE_NORMAL_SCALE_XY

public const float TRANSLATE_NORMAL_SCALE_XY = 2

Field Value

float

TRANSLATE_NORMAL_SCALE_Z

public const float TRANSLATE_NORMAL_SCALE_Z = 5

Field Value

float

TRANSLATE_SLOW_SCALE_XY

public const float TRANSLATE_SLOW_SCALE_XY = 0.5

Field Value

float

TRANSLATE_SLOW_SCALE_Z

public const float TRANSLATE_SLOW_SCALE_Z = 1.25

Field Value

float

Methods

ApplyPlayerIdForPlayerToSim(byte, string)

public static void ApplyPlayerIdForPlayerToSim(byte playerId, string playerGuidString)

Parameters

playerId byte
playerGuidString string

CanSelectFlightCameraModelNext(List<SimulationObjectModel>, SimulationObjectModel)

public static bool CanSelectFlightCameraModelNext(List<SimulationObjectModel> modelList, SimulationObjectModel model)

Parameters

modelList List<SimulationObjectModel>
model SimulationObjectModel

Returns

bool

CanSelectFlightCameraModelPrev(List<SimulationObjectModel>, SimulationObjectModel)

public static bool CanSelectFlightCameraModelPrev(List<SimulationObjectModel> modelList, SimulationObjectModel model)

Parameters

modelList List<SimulationObjectModel>
model SimulationObjectModel

Returns

bool

DeleteAllSimObjectModelsInList(List<SimulationObjectModel>)

public static void DeleteAllSimObjectModelsInList(List<SimulationObjectModel> simObjectModelList)

Parameters

simObjectModelList List<SimulationObjectModel>

DeletePlayerOwnedObjectsForAllPlayers(bool)

public static void DeletePlayerOwnedObjectsForAllPlayers(bool propagate = true)

Parameters

propagate bool

DeletePlayerOwnedObjectsForSpecificPlayer(string, bool)

public static void DeletePlayerOwnedObjectsForSpecificPlayer(string playerGuidString, bool propagate = true)

Parameters

playerGuidString string
propagate bool

FindAllCelestialBodiesOrNull()

public static List<SimulationObjectModel> FindAllCelestialBodiesOrNull()

Returns

List<SimulationObjectModel>

FindAllVesselsOrNull()

public static List<SimulationObjectModel> FindAllVesselsOrNull()

Returns

List<SimulationObjectModel>

FindModuleData(IGGuid, string, string)

public static ModuleData FindModuleData(IGGuid simObjectModelGlobalId, string pcmSystemTypeString, string moduleSystemTypeString)

Parameters

simObjectModelGlobalId IGGuid
pcmSystemTypeString string
moduleSystemTypeString string

Returns

ModuleData

FindModuleDataInPartComponent(PartComponent, string, string)

public static ModuleData FindModuleDataInPartComponent(PartComponent partComponent, string pcmSystemTypeString, string moduleSystemTypeString)

Parameters

partComponent PartComponent
pcmSystemTypeString string
moduleSystemTypeString string

Returns

ModuleData

FindMyCurrentFlightCameraModel()

public static SimulationObjectModel FindMyCurrentFlightCameraModel()

Returns

SimulationObjectModel

FindMyVesselsOrNull()

public static List<SimulationObjectModel> FindMyVesselsOrNull()

Returns

List<SimulationObjectModel>

FindObjectComponent(IGGuid, string)

public static ObjectComponent FindObjectComponent(IGGuid simObjectModelGlobalId, string objectComponentTypeString)

Parameters

simObjectModelGlobalId IGGuid
objectComponentTypeString string

Returns

ObjectComponent

FindOfflineOrNotReadyYetOnlinePlayerVesselsOrNull()

public static List<SimulationObjectModel> FindOfflineOrNotReadyYetOnlinePlayerVesselsOrNull()

Returns

List<SimulationObjectModel>

FindOfflinePlayersVesselsOrNull()

public static List<SimulationObjectModel> FindOfflinePlayersVesselsOrNull()

Returns

List<SimulationObjectModel>

FindOtherPlayersVesselsOrNull()

public static List<SimulationObjectModel> FindOtherPlayersVesselsOrNull()

Returns

List<SimulationObjectModel>

FindSimObjectsOrNull(SimObjectFindMode, string)

public static List<SimulationObjectModel> FindSimObjectsOrNull(SimUtil.SimObjectFindMode simObjectFindMode, string playerGuidString = "")

Parameters

simObjectFindMode SimUtil.SimObjectFindMode
playerGuidString string

Returns

List<SimulationObjectModel>

FindSimulationObjectModelByGlobalId(IGGuid)

public static SimulationObjectModel FindSimulationObjectModelByGlobalId(IGGuid globalId)

Parameters

globalId IGGuid

Returns

SimulationObjectModel

FindSpecificPlayersVesselsOrNull(string)

public static List<SimulationObjectModel> FindSpecificPlayersVesselsOrNull(string playerGuidString)

Parameters

playerGuidString string

Returns

List<SimulationObjectModel>

GetCoordinateSystemDebugString(ICoordinateSystem)

public static string GetCoordinateSystemDebugString(ICoordinateSystem coordinateSystem)

Parameters

coordinateSystem ICoordinateSystem

Returns

string

GetDebugVectorString(Vector)

public static string GetDebugVectorString(Vector vector)

Parameters

vector Vector

Returns

string

GetDebugVectorString(Vector3d)

public static string GetDebugVectorString(Vector3d vector3d)

Parameters

vector3d Vector3d

Returns

string

GetFlightCameraModelListInfo(List<SimulationObjectModel>, SimulationObjectModel, out int, out int)

public static void GetFlightCameraModelListInfo(List<SimulationObjectModel> modelList, SimulationObjectModel model, out int indexOut, out int numItemsOut)

Parameters

modelList List<SimulationObjectModel>
model SimulationObjectModel
indexOut int
numItemsOut int

GetMyCurrentSimulationObjectModel()

public static SimulationObjectModel GetMyCurrentSimulationObjectModel()

Returns

SimulationObjectModel

GetNumPlayerVesselsThatHaveGameObjects()

public static int GetNumPlayerVesselsThatHaveGameObjects()

Returns

int

GetOrientationInParent(SimulationObjectModel)

public static QuaternionD GetOrientationInParent(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

QuaternionD

GetPosInParent(SimulationObjectModel)

public static Vector3d GetPosInParent(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

Vector3d

GetScreenCoordinateOfSimulationObjectModel(SimulationObjectModel, out Vector3)

public static bool GetScreenCoordinateOfSimulationObjectModel(SimulationObjectModel simObject, out Vector3 screenPoint)

Parameters

simObject SimulationObjectModel
screenPoint Vector3

Returns

bool

GetSimObjectModelComponentsCount(SimulationObjectModel)

public static int GetSimObjectModelComponentsCount(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

int

GetSimObjectModelCount(SimObjectModelLoopMode, string)

public static int GetSimObjectModelCount(SimUtil.SimObjectModelLoopMode simObjectModelLoopMode, string matchFilterString)

Parameters

simObjectModelLoopMode SimUtil.SimObjectModelLoopMode
matchFilterString string

Returns

int

GetSimObjectModelPartsCount(SimulationObjectModel)

public static int GetSimObjectModelPartsCount(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

int

GetSimulationObjectModelTypeString(SimulationObjectModel)

public static string GetSimulationObjectModelTypeString(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

string

GetTranslateDirectionEnumVector(SimulationObjectModel, TranslateDirectionEnum, double)

public static Vector3d GetTranslateDirectionEnumVector(SimulationObjectModel simulationObjectModel, SimUtil.TranslateDirectionEnum translateDirectionEnum, double scale = 1)

Parameters

simulationObjectModel SimulationObjectModel
translateDirectionEnum SimUtil.TranslateDirectionEnum
scale double

Returns

Vector3d

HaveAuthorityOverThisVesselForMP(SimulationObjectModel)

public static bool HaveAuthorityOverThisVesselForMP(SimulationObjectModel simObject)

Parameters

simObject SimulationObjectModel

Returns

bool

InvalidatePlayerId(byte)

public static void InvalidatePlayerId(byte playerId)

Parameters

playerId byte

LoopThroughAllMiscSimulationObjectModels(string, SimObjectModelLoopThroughCallback)

public static void LoopThroughAllMiscSimulationObjectModels(string matchFilterString, SimUtil.SimObjectModelLoopThroughCallback callback)

Parameters

matchFilterString string
callback SimUtil.SimObjectModelLoopThroughCallback

LoopThroughAllPartsSimulationObjectModels(string, SimObjectModelLoopThroughCallback)

public static void LoopThroughAllPartsSimulationObjectModels(string matchFilterString, SimUtil.SimObjectModelLoopThroughCallback callback)

Parameters

matchFilterString string
callback SimUtil.SimObjectModelLoopThroughCallback

LoopThroughAllSimulationObjectModels(SimObjectModelLoopMode, string, SimObjectModelLoopThroughCallback)

public static void LoopThroughAllSimulationObjectModels(SimUtil.SimObjectModelLoopMode simObjectModelLoopMode, string matchFilterString, SimUtil.SimObjectModelLoopThroughCallback callback)

Parameters

simObjectModelLoopMode SimUtil.SimObjectModelLoopMode
matchFilterString string
callback SimUtil.SimObjectModelLoopThroughCallback

LoopThroughAllVesselSimulationObjectModels(string, SimObjectModelLoopThroughCallback)

public static void LoopThroughAllVesselSimulationObjectModels(string matchFilterString, SimUtil.SimObjectModelLoopThroughCallback callback)

Parameters

matchFilterString string
callback SimUtil.SimObjectModelLoopThroughCallback

LoopThroughAllVesselsAndPartsSimulationObjectModels(string, SimObjectModelLoopThroughCallback)

public static void LoopThroughAllVesselsAndPartsSimulationObjectModels(string matchFilterString, SimUtil.SimObjectModelLoopThroughCallback callback)

Parameters

matchFilterString string
callback SimUtil.SimObjectModelLoopThroughCallback

LoopThroughSimulationObjectModelParts(SimulationObjectModel, Action<SimulationObjectModel, PartComponent>)

public static void LoopThroughSimulationObjectModelParts(SimulationObjectModel simulationObjectModel, Action<SimulationObjectModel, PartComponent> callback)

Parameters

simulationObjectModel SimulationObjectModel
callback Action<SimulationObjectModel, PartComponent>

LoopThroughTopLevelChildrenPartModels(SimulationObjectModel, LoopThroughTopLevelChildrenPartModelsCallback)

public static void LoopThroughTopLevelChildrenPartModels(SimulationObjectModel simulationObjectModel, SimUtil.LoopThroughTopLevelChildrenPartModelsCallback cb)

Parameters

simulationObjectModel SimulationObjectModel
cb SimUtil.LoopThroughTopLevelChildrenPartModelsCallback

ModelRotate(SimulationObjectModel, RotateDirectionEnum, float)

public static void ModelRotate(SimulationObjectModel simulationObjectModel, SimUtil.RotateDirectionEnum rotateDirectionEnum, float deltaAngle)

Parameters

simulationObjectModel SimulationObjectModel
rotateDirectionEnum SimUtil.RotateDirectionEnum
deltaAngle float

ModelTranslate(SimulationObjectModel, TranslateDirectionEnum, float)

public static void ModelTranslate(SimulationObjectModel simulationObjectModel, SimUtil.TranslateDirectionEnum translateDirectionEnum, float scale)

Parameters

simulationObjectModel SimulationObjectModel
translateDirectionEnum SimUtil.TranslateDirectionEnum
scale float

ModelTranslate(SimulationObjectModel, Vector3d)

public static void ModelTranslate(SimulationObjectModel simulationObjectModel, Vector3d delta)

Parameters

simulationObjectModel SimulationObjectModel
delta Vector3d

ModelZeroOutAngularVelocity(SimulationObjectModel)

public static bool ModelZeroOutAngularVelocity(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

bool

ModelZeroOutVelocity(SimulationObjectModel)

public static bool ModelZeroOutVelocity(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

bool

ModelZeroOutVelocityAndAngularVelocity(SimulationObjectModel)

public static bool ModelZeroOutVelocityAndAngularVelocity(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

bool

PotentiallyApplyPlayerIdForPlayerToSimulationObjectModel(byte, string, SimulationObjectModel)

public static void PotentiallyApplyPlayerIdForPlayerToSimulationObjectModel(byte playerId, string playerGuidString, SimulationObjectModel simulationObjectModel)

Parameters

playerId byte
playerGuidString string
simulationObjectModel SimulationObjectModel

PotentiallyInvalidatePlayerIdForSimObjectModel(SimulationObjectModel, byte)

public static void PotentiallyInvalidatePlayerIdForSimObjectModel(SimulationObjectModel simulationObjectModel, byte playerId)

Parameters

simulationObjectModel SimulationObjectModel
playerId byte

RemoveOurVesselMaybe(SimulationObjectModel)

public static bool RemoveOurVesselMaybe(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

bool

RotateQuat(ref QuaternionD, RotateDirectionEnum, float)

public static void RotateQuat(ref QuaternionD quatRef, SimUtil.RotateDirectionEnum rotateDirectionEnum, float deltaAngle)

Parameters

quatRef QuaternionD
rotateDirectionEnum SimUtil.RotateDirectionEnum
deltaAngle float

SelectFlightCameraModel(SimulationObjectModel)

public static bool SelectFlightCameraModel(SimulationObjectModel simulationObjectModel)

Parameters

simulationObjectModel SimulationObjectModel

Returns

bool

SelectFlightCameraModelNext(List<SimulationObjectModel>, SimulationObjectModel)

public static bool SelectFlightCameraModelNext(List<SimulationObjectModel> modelList, SimulationObjectModel model)

Parameters

modelList List<SimulationObjectModel>
model SimulationObjectModel

Returns

bool

SelectFlightCameraModelPrev(List<SimulationObjectModel>, SimulationObjectModel)

public static bool SelectFlightCameraModelPrev(List<SimulationObjectModel> modelList, SimulationObjectModel model)

Parameters

modelList List<SimulationObjectModel>
model SimulationObjectModel

Returns

bool

SetOrientationInParent(SimulationObjectModel, QuaternionD)

public static void SetOrientationInParent(SimulationObjectModel simulationObjectModel, QuaternionD quat)

Parameters

simulationObjectModel SimulationObjectModel
quat QuaternionD

SetPosInParent(SimulationObjectModel, Vector3d)

public static void SetPosInParent(SimulationObjectModel simulationObjectModel, Vector3d pos)

Parameters

simulationObjectModel SimulationObjectModel
pos Vector3d

TeleportVessel(TeleportVesselMethod, SimulationObjectModel, SimulationObjectModel, float, float)

public static bool TeleportVessel(TeleportVesselMethod teleportVesselMethod, SimulationObjectModel simObjectModelSrc, SimulationObjectModel simObjectModelDest, float distance, float angle)

Parameters

teleportVesselMethod TeleportVesselMethod
simObjectModelSrc SimulationObjectModel
simObjectModelDest SimulationObjectModel
distance float
angle float

Returns

bool

TryGetSpawnNearOffset(Vector3, Quaternion, float, float, out Vector3)

public static bool TryGetSpawnNearOffset(Vector3 position, Quaternion rotation, float distance, float angle, out Vector3 offsetOut)

Parameters

position Vector3
rotation Quaternion
distance float
angle float
offsetOut Vector3

Returns

bool

TryGetVesselIndexAndCountForPlayer(string, SimulationObjectModel, out int, out int)

public static bool TryGetVesselIndexAndCountForPlayer(string ownerPlayerGuidString, SimulationObjectModel selectedVesselOrNull, out int selectedIndexOut, out int numVesselsForThisPlayerOut)

Parameters

ownerPlayerGuidString string
selectedVesselOrNull SimulationObjectModel
selectedIndexOut int
numVesselsForThisPlayerOut int

Returns

bool