VE Lua Documentation

Press F to search!

getHydraulicConsumer

Definition


-- @/lua/vehicle/powertrain.lua:966

local function getHydraulicConsumer(consumerName)
  local hydraulicPowerSources = getDevicesByCategory("hydraulicPowerSource")
  for _, powerSource in ipairs(hydraulicPowerSources) do
    if powerSource.connectedConsumers then
      for _, hydraulicConsumer in ipairs(powerSource.connectedConsumers) do
        if hydraulicConsumer.name == consumerName then
          return hydraulicConsumer
        end
      end
    end
  end

  return nil --couldn't find requested consumer
end

Callers

@/lua/vehicle/controller/hydraulics/closedLoopLinearControl.lua
  for _, cylinderName in ipairs(jbeamData.cylinders or {}) do
    local cylinder = powertrain.getHydraulicConsumer(cylinderName)
    if cylinder then
@/lua/vehicle/controller/hydraulics/hydraulicTrailerFeet.lua
  local cylinderName = jbeamData.powertrainHydroName
  feetCylinder = powertrain.getHydraulicConsumer(cylinderName)
  ramDirectionElectricsName = feetCylinder.directionElectricsName
@/lua/vehicle/controller/hydraulics/orbitrolSteering.lua
  for _, cylinderName in ipairs(jbeamData.steeringPositionCylinders or {}) do
    local cylinder = powertrain.getHydraulicConsumer(cylinderName)
    if cylinder then