Need help automating Railcraft unloaders

  • Thread starter Thread starter TheCreepySheep
  • Start date Start date
  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord
T

TheCreepySheep

Guest
Hello,
I am looking for a way to interact with Railcraft Item Loaders (and Unloaders) via a CC Computer. The goal here being the ability to unload coal at will.

More specifically, I have a train that collects supplies from around the base and brings them to the main station to be transported to my underground storage facility. Since some of the "farms" around the base use machines that run on charcoal power, I want to able to decide whether to unload said coal from the train.
I am rather familiar with lua and coding in general so that should not an issue.

Some code:
Code:
chest = peripheral.wrap("top")

function getAmount()
    local amount = 0
    for i=1, chest.getInventorySize() do
        slotinfo = chest.getStackInSlot(i)
        if slotinfo then
            if slotinfo.name == "coal" then
                amount = amount + slotinfo.qty
            end
        end
    end
    return amount
end
print(getAmount)

-- Now the pseudo part

if getAmount < 64 then
    --Add (64 - getAmount) to Unloader filter and set mode to "Transfer"
end

Thanking in advance,
TheCreepySheep
 
I'm not sure why you'd want to, but it might be easier to filter the unloader for the coal and control a hopper unloading it via redstone instead.
IE, instead of that, set so that when the system detects less than 64 coal, it flips off a redstone signal for a length of time long enough to let the hopper unload a stack worth of coal.

Unless it's something that continually uses power, though I can't think of anything that would.
 
I'm not sure why you'd want to, but it might be easier to filter the unloader for the coal and control a hopper unloading it via redstone instead.
IE, instead of that, set so that when the system detects less than 64 coal, it flips off a redstone signal for a length of time long enough to let the hopper unload a stack worth of coal.

Unless it's something that continually uses power, though I can't think of anything that would.

The system I'm talking about is a Steve's Carts powered wood farming cart that runs on coal. And I don't want to fill up the Cargo Manager with coal in case the farming cart doesn't use up the 64 coal that has arrived with the previous train.

  • Train comes
  • 64 coal get unloaded
  • Wood farming cart only uses 43
  • Train comes again
  • Another 64 coal get unloaded
  • Now there's 85 coal in the manager
  • Farming cart uses 42 coal
  • Train arrives
  • Unloads 64 coal
  • Cargomanager contains 107 coal
    And so on...
 
Ah... You could still do the hopper thing, but you can also use the Cargo Distributor and partition the Manager so only one of the four sections gets coal in. Or, the simple solution, which is to add an advance Smelter onto the cart, and configure it to cook some of the wood it gets to charcoal and it'll be self-fueling.

Another option, if you have... open peripherals I believe, there should be an option to use the computer to actually move the coal from the loader to the manager. I'm not sure the exact command though.
 
That means I still need a buffer inventory. I'll give the smelter a go.
 
Buffer is unnecessary. The computer can move items directly from the unloader to the manager if they're connected via modems.