Skip to content

Commit

Permalink
Submit some forgotten updates
Browse files Browse the repository at this point in the history
Replace obsolete RequestResource calls
  • Loading branch information
MOARdV committed Dec 29, 2018
1 parent 0032e18 commit 5dffa1e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions RasterPropMonitor/Auxiliary modules/JSIActionGroupSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,8 @@ public override void OnUpdate()

if (consumingWhileActive && currentState && !forcedShutdown)
{
float requesting = (consumeWhileActiveAmount * TimeWarp.deltaTime);
float extracted = part.RequestResource(consumeWhileActiveName, requesting);
double requesting = (consumeWhileActiveAmount * TimeWarp.deltaTime);
double extracted = part.RequestResource(consumeWhileActiveName, requesting);
if (Math.Abs(extracted - requesting) > Math.Abs(requesting / 2))
{
// We don't have enough of the resource or can't produce more negative resource, so we should shut down...
Expand Down Expand Up @@ -893,7 +893,7 @@ public override void OnUpdate()
// If we're consuming resources on toggle, do that now.
if ((consumingOnToggleUp && newState) || (consumingOnToggleDown && !newState))
{
float extracted = part.RequestResource(consumeOnToggleName, consumeOnToggleAmount);
double extracted = part.RequestResource(consumeOnToggleName, (double)consumeOnToggleAmount);
if (Math.Abs(extracted - consumeOnToggleAmount) > Math.Abs(consumeOnToggleAmount / 2))
{
// We don't have enough of the resource, so we force a shutdown on the next loop.
Expand Down
6 changes: 3 additions & 3 deletions RasterPropMonitor/Auxiliary modules/JSIRadar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ public void FixedUpdate()
// Resources check
if (resourceAmount > 0.0f)
{
float requested = resourceAmount * TimeWarp.fixedDeltaTime;
float supplied = part.RequestResource(resourceId, requested);
if (supplied < requested * 0.5f)
double requested = resourceAmount * TimeWarp.fixedDeltaTime;
double supplied = part.RequestResource(resourceId, requested);
if (supplied < requested * 0.5)
{
powered = false;
}
Expand Down
8 changes: 4 additions & 4 deletions RasterPropMonitor/Auxiliary modules/JSIVariableAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,11 @@ private void TurnOn(double universalTime)

if (resourceAmount > 0.0f)
{
float requesting = (resourceAmount * TimeWarp.deltaTime);
if (requesting > 0.0f)
double requesting = (resourceAmount * TimeWarp.deltaTime);
if (requesting > 0.0)
{
float extracted = part.RequestResource(resourceName, requesting);
if (extracted < 0.5f * requesting)
double extracted = part.RequestResource(resourceName, requesting);
if (extracted < 0.5 * requesting)
{
// Insufficient power - shut down
TurnOff(universalTime, true);
Expand Down
2 changes: 1 addition & 1 deletion RasterPropMonitor/Handlers/JSISteerableCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private static Vector2 ClampToEdge(Vector2 position)
private Vector2 GetNormalizedScreenPosition(SteerableCameraParameters activeCamera, Vector3 directionVector, float cameraAspect)
{
// Transform direction using the active camera's rotation.
var targetTransformed = cameraObject.CameraRotation(activeCamera.currentYaw, -activeCamera.currentPitch).Inverse() * directionVector;
var targetTransformed = Quaternion.Inverse(cameraObject.CameraRotation(activeCamera.currentYaw, -activeCamera.currentPitch)) * directionVector;

// (x, y) provided the lateral displacement. (z) provides the "in front of / behind"
var targetDisp = new Vector2(targetTransformed.x, -targetTransformed.y);
Expand Down

0 comments on commit 5dffa1e

Please sign in to comment.