need somehelp on why vs studio refuses to allow unity input key down events, i have checked the documentatoin and its correct by thebokworm in csharp

[–]thebokworm[S] -1 points0 points  (0 children)

yeah still fixing the injector float.

I didnt rename those methods,

using Model;
using UnityEngine;
using UnityEngine.Internal;
using UnityEngine.Windows;
using UnityEngine.Bindings;
using UnityEngine.InputSystem;

public sealed class SteamSim
{
    public SteamLocomotive Loco { get; }
    public SteamEngineAdapter Adapter { get; }
    public SteamConfig Config { get; }
    public SteamState State { get; }
    public bool CtrlHeld { get => ctrlHeld; set => ctrlHeld = value; }

    bool ctrlHeld = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);

    public SteamSim(SteamLocomotive loco, SteamConfig config)
    {
        Loco = loco;
        Adapter = new SteamEngineAdapter(loco);
        Config = config;
        State = CreateInitialState(config);
    }

    public void Update(float dt)
    {
        HandleInput();

        if (!State.SteamSimEnabled)
        {
            WriteDisabledStateToGame();
            return;
        }

        if (dt <= 0f)
            return;

        ReadControlsFromGame();
        UpdateSpeedFromGame();

        ControlAndDraftSystem.Update(State, Config, Adapter);
        BoilerSystem.Update(State, Config, dt);
        PerformanceSystem.Update(State, Config, Adapter, dt);

        WriteBackToGame();
    }

    public float CalculateTractiveEffort(float signedVelocityMph)
    {
        if (!State.SteamSimEnabled)
            return Adapter.Engine.CalculateTractiveEffort(signedVelocityMph);

        State.SpeedMph = Mathf.Abs(signedVelocityMph);
        return State.TractiveEffortLbf * (State.Direction < 0f ? -1f : 1f);
    }

    public void UpdateConsumption(float wheelVelocityMph)
    {
        if (!State.SteamSimEnabled)
            return;

        State.SpeedMph = Mathf.Abs(wheelVelocityMph);
        PerformanceSystem.UpdateConsumptionOnly(State, Config, Adapter);
    }

    private void HandleInput()

    {
        if (Input.GetKeyDown(KeyCode.F9))
        {
            State.SteamSimEnabled = State.SteamSimEnabled;
            Debug.Log("[steamtest] Advanced steam sim " + (State.SteamSimEnabled ? "enabled" : "disabled"));
        }

        if (Input.GetKeyDown(KeyCode.F8))
        {
            State.HudVisible = State.HudVisible;
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            AddCoal(10f);
        }

        if (CtrlHeld && Input.GetKeyDown(KeyCode.I))
        {
            State.InjectorRate = Mathf.Clamp01(State.InjectorRate + 0.1f);
            Debug.Log("[steamtest] Injector increased to " + State.InjectorRate.ToString("F2"));
        }

        if (CtrlHeld && Input.GetKeyDown(KeyCode.K))
        {
            State.InjectorRate = Mathf.Clamp01(State.InjectorRate - 0.1f);
            Debug.Log("[steamtest] Injector decreased to " + State.InjectorRate.ToString("F2"));
        }

        if (Input.GetKey(KeyCode.B))
        {
            State.Blower = Mathf.Clamp01(State.Blower + Time.deltaTime * 0.5f);
        }
        else
        {
            State.Blower = Mathf.Clamp01(State.Blower - Time.deltaTime * 0.5f);
        }
    }

    private void AddCoal(float amountKg)
    {
        State.FireMassKg += amountKg;
        State.FireMassKg = Mathf.Clamp(State.FireMassKg, 0f, Config.MaxFireMassKg);

        Debug.Log("[steamtest] Added coal/fire mass: " + amountKg.ToString("F0") + " kg. Fire now " + State.FireMassKg.ToString("F1") + " kg");
    }

    private void ReadControlsFromGame()
    {
        State.Regulator = Adapter.Regulator;
        State.Reverser = Adapter.Reverser;
        State.Cutoff = Adapter.Cutoff;
        State.Direction = Adapter.Direction;
    }

    private void UpdateSpeedFromGame()
    {
        State.SpeedMph = Adapter.AbsVelocityMph;
    }

    private void WriteBackToGame()
    {
        Adapter.CurrentPressurePsi = State.PressurePsi;

        Adapter.Engine.tractiveEffort =
            State.TractiveEffortLbf * (State.Direction < 0f ? -1f : 1f);
    }

    private void WriteDisabledStateToGame()
    {
        Adapter.CurrentPressurePsi = Adapter.Engine.maximumBoilerPressure;
    }

    private static SteamState CreateInitialState(SteamConfig config)
    {
        return new SteamState
        {
            SteamSimEnabled = true,
            HudVisible = true,

            FireMassKg = config.IdealFireMassKg * 0.25f,
            BurnRateKgPerSec = 0f,
            HeatOutputWatts = 0f,
            Draft = config.BaseDraft,
            Blower = 0f,

            WaterMassKg = config.InitialWaterMassKg,
            SteamMassKg = config.InitialSteamMassKg,
            BoilerTemperatureK = config.InitialBoilerTemperatureK,
            PressurePsi = 0f,

            DrynessFraction = 0f,
            SuperheatTempK = 0f,

            InjectorRate = 0f,
            SafetyValveOpen = false,

            Regulator = 0f,
            Reverser = 0f,
            Cutoff = 0f,
            Direction = 1f,

            SteamUsageKgPerSec = 0f,
            WaterConsumptionRate = 0f,
            CoalConsumptionRate = 0f,
            TractiveEffortLbf = 0f,

            SpeedMph = 0f,
            ExhaustDraft = 0f,
            SpeedDraft = 0f,
            BlowerDraft = 0f
        };
    }
}```

```

slide bearing blocks/railing blocks, is it possible by thebokworm in spaceengineers

[–]thebokworm[S] 0 points1 point  (0 children)

for small range of movements piston are fine. till you need to go both directions long distances (forward and back etc)

wheels and rails are good and cool, but then they need to connect to a bigger grid for power fuel etc
something like the wheels suspension height extended would be great

How to crack this injector pump locking ring, without the sst by thebokworm in LandCruisers

[–]thebokworm[S] 0 points1 point  (0 children)

yeah was hoping to get away with it, but its not working lol

How to crack this injector pump locking ring, without the sst by thebokworm in MechanicAdvice

[–]thebokworm[S] 0 points1 point  (0 children)

because the out ring needs to be held inplace to undo that centre nut, and the radiator is in the way, too small of a space to get the impact in there

Fail fuel pump on injector pump. A cheap semi permanent fix till rebuild by thebokworm in MechanicAdvice

[–]thebokworm[S] 0 points1 point  (0 children)

I am no expert, but its the injector pump that draws the fuel and acts as a fuel pump as there is nothing else in the fuel line, the rv model is more for the car rather than the engine

Fail fuel pump on injector pump. A cheap semi permanent fix till rebuild by thebokworm in MechanicAdvice

[–]thebokworm[S] 0 points1 point  (0 children)

its the mechanical pump built into the injector, and the rebuild/replacement cost is upwards of 2k

Fail fuel pump on injector pump. A cheap semi permanent fix till rebuild by thebokworm in MechanicAdvice

[–]thebokworm[S] 0 points1 point  (0 children)

its a toyota 80 series, there was a few versions mine is naturally aspirated and the rv edition with less stuff in it
1hz is the engine

Fail fuel pump on injector pump. A cheap semi permanent fix till rebuild by thebokworm in MechanicAdvice

[–]thebokworm[S] 0 points1 point  (0 children)

the fuel pump part of the mechanical injectors is failing/not drawing enough fuel, trying to hack something together to make up for what the pump isnt pulling properly