Closed x62275 closed 7 years ago
var min = thruster.GetMininum<float>("Override");
var max = thruster.GetMaximum<float>("Override");
var factor = 0.5f;
thruster.SetValueFloat("Override", min + (max - min) * factor);
Note Mininum.
@lord-devious GetMininum fix is already in (for some months already), so you can use GetMinimum ... i left GetMininum to not break existing scripts tho'.
@mexmer I thought it was - but I was lazy and couldn't be bothered to double check. This is merely copy-paste from an earlier post of mine, so I knew it'd work :wink:
Team,
For reference please see line 166 of: /Sources/Sandbox.Game/Game/EntityComponents/MyThrusterBlockThrustComponent.cs
thrust.CurrentStrength = forceMultiplier * thrust.ThrustOverride * ResourceSink(thrustEntity).SuppliedRatioByType(thrust.FuelDefinition.Id) / thrust.ThrustForce.Length();
It is not currently possible to set the thruster's overridden output to any value. This is preventing me from completing a PID controller using the in-game scripting. The PID requires precise changes in the thruster's outputs and the increments are currently too large (a multiple of forceMultipler?) for the PID to work correctly.