Coder Social home page Coder Social logo

factorio-railloader's Introduction

Bulk Rail Loaders

This mod adds dedicated train loaders and unloaders for granular bulk cargo, as often used in reality at mines, power stations, etc. A large hopper placed directly over the track drops granular solids into the top of a hopper car, and at the destination the bottom of the car is opened and the cargo pours out through metal grates and onto conveyors.

Loaders benefit from inserter stack size bonus. When fully researched they will fill or empty a cargo wagon in about 5 seconds.

Bulk Rail Loaders in action

The Bulk Rail Loader and Unloader items will show a preview of the loader and an image of a cargo wagon, to help position the loader correctly. The concrete pad of the Bulk Rail Unloader serves a similar purpose.

Note that rails are placed every other tile, but cargo wagons in stations stop every 7 tiles. Depending on the exact loader placement, it may appear with two or three rail segments underneath. You cannot place a BRL if it could not align with other rails.

BRLs are circuit-connectable chest entities that output their content. You can connect them to Logistic Train Network stops to manage automatic creation of transport orders. Sending a BRL the special "Disable rail loader" signal will stop the BRL from loading/unloading a cargo wagon. Due to their speed, you are likely to load or unload a few more items than expected.

Boosting Throughput with Interface Chests

Rail loaders and unloaders can fit 4 inserters or loaders on each side, for an inherent 8 belts of throughput. If this is insufficient, you can add up to 4 chests to the corners of the loaders, and they will automatically push or pull items into these chests. I recommend limiting these chests to just a few stacks to prevent them from getting too out of balance.

With vanilla 1x1 chests, this system allows up to 12 belts of throughput, 6 per side. However, chests can be of any size. Interface chests can also be logistics chests, if you wish to directly connect your bulk rail loaders to your logistics network.

Interface Chest Demo

What items are supported?

Anything that would tolerate a long drop onto the hard metal floor of a cargo wagon, then would fit through a metal grate, and would survive a trip up a screw conveyor.

By default, this does not include plates, but a setting is available to enable them if you wish to abandon realism. You can even enable Bulk Rail Loaders to handle any item at all.

From base:

  • Coal, stone, copper ore, iron ore, uranium ore
  • Landfill
  • Plastic (realistically these are likely pellets, not shaped bars)
  • Sulfur

From mods:

  • Items named "ore", "powder", "sand", "gravel", etc.

The following mods and mod sets have specific additional support:

  • Angel's Mods
  • Bob's Mods
  • Krastorio
  • MadClown's Extended AngelBob Minerals
  • Py's Mods (pycoalprocessing, pyrawores)
  • Xander-Mod

Mod authors can add their own items or classes of items to be handled by Bulk Rail Loaders using the remote interface:

-- call either of these during your mod's on_init and on_load event handlers
-- takes the exact name of an item
remote.call("railloader", "add_bulk_item", item_name)
-- takes a Lua pattern (https://www.lua.org/manual/5.2/manual.html#6.4.1)
remote.call("railloader", "add_bulk_item_pattern", lua_pattern)

If you feel something that meets the above generic description is not included, let me know. You can also edit bulk.lua if you would like to change the set of supported items for your own use, or change the mod setting to allow any item.

Acknowledgements

  • Arch666Angel for the loader graphics.

factorio-railloader's People

Contributors

brevven avatar eldrinn-elantey avatar factorio-mods-helper avatar generaltanker avatar glebtv avatar jarg-compilatron avatar koziolek avatar masterlogick avatar mspielberg avatar skofisk avatar twentyeighty avatar unoxxis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

factorio-railloader's Issues

[0.16.26-0.3.5] duplicate bug in energy grid

Hello Devs
first off love the mod and i want it to be the best as it can be so here is a little bug for u
first of it needs power to work dont know why but oke i can leave with it
so i made 1 of the unloaders and loaders in a test world (cheating)
put it on a track and powered it
when to the power grid UI (Click on power pole) and it showing 2 of the items instad of one
think this is a bug that needs to be fixed

Circuit connections

When building blueprints, circuit connections aren't recreated properly - only those to already existing entities, which means you can never blueprint-connect multiple loaders/unloaders together. I gather that you already know about this, and it isn't immediately fixable due to missing API that the devs don't seem too interested in adding, unfortunately.

However, this issue can be worked around (kind of) by simply removing the placement proxy. It is already effectively non-functional for the unloader, as the proxy looks exactly the same as the placed entity, and of limited help for the loader. For help about placement, you could provide for example this image:

railloader-placement

... which can be recreated ingame with this blueprint string:

0eNqVlstupDAQRX9lVGscYfNqWM5mPmI0imi6klgCg2z3TFCLf4/pjhJaIcNlxct1rutxkS90bM88WG08VRfSTW8cVb8v5PSzqdv5nR8Hpoq0544iMnU3P9latzRFpM2JX6mS05+I2HjtNd/irw/jozl3R7ZhwUekD6FGON8PgTb0LoT0ZtYJGCHjiMZwVQF90pab28c8Iufr2z39sjy63vz4aflfQE/RFzF1t822r09sxdDWDXdhpRhs/zp+FX+Xlg/ZvXi6opDcKZwNqlHs0Eg/NNxcs+cXL65V/7Zq8T1TrTAzmHlAkTmMzFFkASNTFHmAkQpFligS7s7cRwwJb1JKFAmXUioUCTdcJigSHksJ2wd3j/y0T8cnfe4Et2G91Y0Y+pZXnfmQXemz49eI+V5isgFceoe5Fc0LO7825gtORMd6jl3jfRrnqXZeaOPY+vBlJdd3okJ+brKEuWoPV8UoN96FlfB293EV1i6wWypBt7mvqCmK3TUDKsOST8Hk93ppw0qqQLNOF1mvgWAP5Rsg2DTZ/0EJ7JLDBgj2RbEBAo1QYrOQJDtnYetHncAWKJeJhlPx9dxcLY7ZEf1l627n2kOhpEpzFZfT9Abp48ga

(Note that this string probably won't work anymore should you decide to remove the proxy entities.)

Additionally, for other entities, you can place down a blueprint on top of already built entites, and it will recreate all circuit connections both to other existing entities as well as ghosts. This behaviour is broken for the railloaders, as the blueprint contains a different entity from the actually placed one.

As I'm personally pretty much blueprinting down every train stop (they don't change all that much after all), and only adjusting the combinators for LTN, it makes this issue really annoying - even when everything seems to have worked, I have to manually inspect every circuit connection to make sure that nothing is broken.

Anyway, these are my two cents about this - if it weren't for this bug, I'd definitely like the idea.

Realistic Usage of Stacked/Bulk Ore

I use Deadlock's Stacking Beltboxes for better belt throughput and can easily use it with BRL by allowing 'any' mats, but it occurred to me that the more realistic thing to do would be to have the loader automatically unstack the ores as they enter. Does that sound reasonable/doable?

Crash when i place the items

i get the same error when i try to place down the 2 items the mod adds

Error while running event railloader::on_built_entity (ID 6)
railloader/control.lua:33: attempt to index local 'event' (a nil value)`

version: 3.2

Loader not filling wagons

I'm not sure if I'm just being slow. I set the 'Allowed Items' setting to any and I have loaders putting iron plate into a bulk rail loader but the bulk rail loader doesn't fill the wagon under it. Am I missing something?

screenshot from 2018-02-18 18-35-41

.18.1 support

seems to be as simple as bumping the version. it works here.

Add BZ ores and chunks support

Many of the mods by brevven have ores that don't have ore in the name, like "Flake Graphite" but not "Graphite". Would you/someone please add support for these items?

Offering help as a maintainer/graphic designer

Hi !

I've been working on various mods lately, improving graphics mainly, but also mod pages, code bits, fixing bugs, sorting mod page threads...

And since I noticed you don't seem to be active anymore, I wanted to offer my help as a maintainer / contributor.
Here's some of my contribution in factorio:
https://mods.factorio.com/mod/MbrTestMod
https://github.com/snouz

If you're up for it, invite me as a contributor on the mod portal and on github !
You can also contact me on discord snouz#0489

[5.1] Unloader texture is shifted.

image

The rail texture for the unloader is shifted left 1 block when placed vertically and 1 one block when placed horizontally. It still functions as normal but obviously appears the trains are not on the rails when at the station.

Add possibility to connect the loader / deloader to the logistic network

Hello,

First, I'm a big fan of the mod, you did a great job.

But I have a little suggestion, can you add the possibility to connect the loader / deloader to the logistic network?

That would allow us to do a lot of things, like filtering items, adding activation conditions, activating the loader under certain conditions only,... well you see.

That's one of the things I think is missing in this mod.

Thanks a lot, hopefully a positive answer.

Feature Request - Logic interface for enable / disable loading

When using bulk loaders & un-loaders it is useful to disable loading via circuit logic. When using bulk handlers with LTN it is expected that trains can fulfill partial loads but without enable/disable logic you have to kludge a power switch re:
bulk loaders

Would it be possible to kludge in the standard inserter/belt enable/disable logic?

Rail Loader _always_ invalidates blueprint mapping

Currently, the function on_blueprint at the end, always calls set_blueprint_entities(), even when there are no rail (un)loaders in the blueprint. This will always invalidate the mapping of the blueprint for all other mods after itself being called.

A simple flag added would fix this issue
update_bp flag:

local function on_blueprint(event)
  local bp = get_blueprint_to_setup(event.player_index)
  if not bp then return end
  local player = game.players[event.player_index]
  local entities = bp.get_blueprint_entities()

  local railloader_chests = find_railloaders_in_area(player.surface, event.area)
  if not next(railloader_chests) then return end

  local chest_index = 1
  local update_bp = false
  for _, bp_entity in pairs(entities) do
    if bp_entity.name == "railloader-chest" or bp_entity.name == "railunloader-chest" then
      local chest_entity = railloader_chests[chest_index]
      chest_index = chest_index + 1

      local rail = player.surface.find_entities_filtered{
        type = "straight-rail",
        area = chest_entity.bounding_box,
      }[1]
      if rail then
        bp_entity.name = (bp_entity.name == "railloader-chest")
          and "railloader-placement-proxy"
          or "railunloader-placement-proxy"
        -- base direction on direction of rail
        bp_entity.direction = rail.direction
        -- preserve chest limit
        bp_entity.tags = { bar = chest_entity.get_inventory(defines.inventory.chest).get_bar() }
	update_bp = true
      end
    end
  end

  if update_bp then bp.set_blueprint_entities(entities) end
end

Edit: formatting

LuaItemStack API call when LuaItemStack was invalid for read.

When creating a BP in editor with time paused. Doesn't always happen on the first blueprint but will error during the second if the first didn't. May be the reverse of #25 i.e. another mod is invalidating the item before BRL reads it.

  97.280 Error MainLoop.cpp:1284: Exception at tick 2666776: The mod Bulk Rail Loader (1.1.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event railloader::on_player_setup_blueprint (ID 70)
LuaItemStack API call when LuaItemStack was invalid for read.
stack traceback:
	[C]: in function 'get_blueprint_entities'
	__railloader__/control.lua:350: in function <__railloader__/control.lua:346>

factorio-current.log.txt

Py graded ores are not supported

Hi, firstly many thanks for sharing your mod, it is great!

One minor issue that I am having is that the "graded" ores in pyrawores are not classified as ores, and only work if the mod settings are changed to allow any item.

This seems to be due to a bad pattern "^(low%-|high%-)grade%-" in bulk.lua. Unfortunately lua string.find does not support alternatives with this pipe syntax, and there are some graded ores that do not have a "high-" or "low-" prefix that I think should also be matched.

Changing this to match on the prefixes grade-, low-grade- and high-grade- individually seems to fix the issue for me locally and I think would be useful for other Py players, so I'll raise this fix as a PR for your consideration. Thanks!

[request/idear] Bot network connect

dont know if its in already but will be nice if bots can load/unload the bulk loader/unloader
maby make it a new item lets say a T2 where u need to research it and that can be done after the logistic chests or somthing

will love it if my bots can interect with it

when we have that the inventory need to change a little as well for the unloader it can stay the same
but for the loader it will be nice if we can set a request for it so we can let it full up till 1 wagon is full so the bots dont fill 1 and forget all the others sins i like to run my trains as 2-8-2

Non recoverable error

Game crashed while dragging pointer to select a rectangle for a new blueprint, not involving any BRL related thing, while using the editor to design new blueprints. I was using Pyanodon full modpack, among some other minor mods, just in case that matters.
image

Increase Size

Hey,

it would be nice if you increase the Size from 4 to 6 and make it so its perfectly within the Cargo Wagon Size. Because without it just looks ugly.

Destroyed rails cannot be replaced

If rails underneath a bulk (un)loader get destroyed (by an alien attack or a randomly exploding grenade cough), but the loader entity itself is still intact, the rails cannot be rebuilt by hand nor by bots. The rail ghosts are however present and bots will fly there. The only way to get out of this deadlock is by manually removing the loader, rebuilding the rails, and replacing it.

railloader-destroyed-rail

Factorio 0.16.25
Railloader 0.3.3
Only other active mod is: creative-mode-fix 0.0.23

Remote interface enhancement request

Can you add a remote interface to list the current set of items allowed?

get_bulk_item
get_bulk_item_pattern

I look after some of the deadlock stacking mods and would like to use your new interfaces to add the stacked version of the items, but in a programmatic way. EG .. get the current bulk item list ... see if there is a stacked version defined then add it to your white list.

Max stak transfer cargo

Hello, I can not find the code fragment responsible for the maximum transfer of items in the stack so that it corresponds to the size of the mod that increases its capacity. all you need is the line responsible for it to be able to manually change it.

bz mod: Does not load iron ore

Loader does nothing with iron ore. Workaround is to allow "any" items in mod settings. I'm on v1.1.6 which presumably supports bz mods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.