public override void ProcessAction(ulong currentTick, ClientProcessorContext context) { Player?simulationOwner = context.Client.SimulationManager.GetSimulationOwner(); if (simulationOwner == null || simulationOwner.Value != context.Client.LocalPlayer) { return; } Planetbase.EnvironmentManager environmentManager = Planetbase.EnvironmentManager.getInstance(); Type environmentManagerType = environmentManager.GetType(); FieldInfo mTimeIndicator = Reflection.GetPrivateFieldOrThrow(environmentManagerType, "mTimeIndicator", true); FieldInfo mWindIndicator = Reflection.GetPrivateFieldOrThrow(environmentManagerType, "mWindIndicator", true); FieldInfo mWindDirection = Reflection.GetPrivateFieldOrThrow(environmentManagerType, "mWindDirection", true); Indicator timeIndicator = (Indicator)Reflection.GetInstanceFieldValue(environmentManager, mTimeIndicator); Indicator windIndicator = (Indicator)Reflection.GetInstanceFieldValue(environmentManager, mWindIndicator); float time = timeIndicator.getValue(); float windLevel = windIndicator.getValue(); Vector3 windDirection = (Vector3)Reflection.GetInstanceFieldValue(environmentManager, mWindDirection); context.Client.EnvironmentManager.UpdateEnvironmentData(time, windLevel, windDirection); }
public void OnUpdateEnvironmentData(float time, float windLevel, Vector3D windDirection) { this.time = time; this.windLevel = windLevel; this.windDirection = windDirection; Planetbase.EnvironmentManager environmentManager = Planetbase.EnvironmentManager.getInstance(); Type environmentManagerType = environmentManager.GetType(); FieldInfo mTimeIndicator = Reflection.GetPrivateFieldOrThrow(environmentManagerType, "mTimeIndicator", true); FieldInfo mWindIndicator = Reflection.GetPrivateFieldOrThrow(environmentManagerType, "mWindIndicator", true); FieldInfo mWindDirection = Reflection.GetPrivateFieldOrThrow(environmentManagerType, "mWindDirection", true); Indicator timeIndicator = (Indicator)Reflection.GetInstanceFieldValue(environmentManager, mTimeIndicator); Indicator windIndicator = (Indicator)Reflection.GetInstanceFieldValue(environmentManager, mWindIndicator); timeIndicator.setValue(time); windIndicator.setValue(windLevel); Reflection.SetInstanceFieldValue(environmentManager, mWindDirection, (Vector3)windDirection); }