[MOD 0.16] Bulk Rail Loaders

Topics and discussion about specific mods
mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

I think I screwed up my game. I've modified the rail loaders so that there is a lager version (railloader mk II) but I had a bug in the pattern matching to detect the new entities. Now I think one of the inserters are placed wrong. The effect I'm seeing is that something constantly takes something out of the unloader and puts it back in. Worse, if a train is present, it sometimes puts the items back in the train and then out again. So the train never gets 2s inactivity and never leaves.

I fixed the code but now I have to deconstruct every loader/unloader and place them again. And most have items in them making that a huge problem.

Is there a mod function I can trigger to remove and rebuild all the hidden entities of the railloader and unloader?

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by Therax »

mrvn wrote:
Tue Jun 11, 2019 11:18 am
Is there a mod function I can trigger to remove and rebuild all the hidden entities of the railloader and unloader?
Unfortunately there isn’t. The function that creates the inserters also creates the chest.

If you’re not going for mod achievements it’s probably possible to fix through the console, but it’s hard for me to tell from here exactly what went wrong.

You could script moving the contents of each railloader into a chest, then mining/rebuilding, then moving the chestcontents back into the new railloader.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

Therax wrote:
Tue Jun 11, 2019 4:03 pm
mrvn wrote:
Tue Jun 11, 2019 11:18 am
Is there a mod function I can trigger to remove and rebuild all the hidden entities of the railloader and unloader?
Unfortunately there isn’t. The function that creates the inserters also creates the chest.

If you’re not going for mod achievements it’s probably possible to fix through the console, but it’s hard for me to tell from here exactly what went wrong.

You could script moving the contents of each railloader into a chest, then mining/rebuilding, then moving the chestcontents back into the new railloader.
I was hoping you already have some function that would find all chests and for each recreate or update the hidden entities. But I'm sure I can script something and then have the mod call it once on the next load.

mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

In control.lua in the on_blueprint function you build an array of all the directions of bulk rail loader and unloader chests by looking at the direction of the rails below the chest. Then in a second loop you create placement proxies for each chest. Problem is that if the first loop doesn't find any rails then you don't add an entry in the directions array so the second loop will a) get out of sync and b) overflow the array dimensions. I fixed that by adding a dummy direction when no rail is found:

Code: Select all

diff --git a/railloader_0.6.1/control.lua b/railloader_0.6.1/control.lua
index c22ee5f..3e53fe0 100644
--- a/railloader_0.6.1/control.lua
+++ b/railloader_0.6.1/control.lua
@@ -309,6 +309,8 @@ local function on_blueprint(event)
       }[1]
       if rail then
         directions[#directions+1] = rail.direction
+      else
+        directions[#directions+1] = 0
       end
     end
   end

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by Therax »

mrvn wrote:
Sat Jun 15, 2019 3:06 pm
Problem is that if the first loop doesn't find any rails then you don't add an entry in the directions array so the second loop will a) get out of sync and b) overflow the array dimensions. I fixed that by adding a dummy direction when no rail is found:
You should never have a BRL without rails underneath it. When a BRL is built the rails are created automatically and made unminable. If something is breaking that setup that’s a bug in whatever is breaking it.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

Therax wrote:
Sat Jun 15, 2019 5:26 pm
mrvn wrote:
Sat Jun 15, 2019 3:06 pm
Problem is that if the first loop doesn't find any rails then you don't add an entry in the directions array so the second loop will a) get out of sync and b) overflow the array dimensions. I fixed that by adding a dummy direction when no rail is found:
You should never have a BRL without rails underneath it. When a BRL is built the rails are created automatically and made unminable. If something is breaking that setup that’s a bug in whatever is breaking it.
Sure, it shouldn't happen. But it can happen or you wouldn't check for it. I think it can happen with waterfill as that drowns even unminable entities.

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by Therax »

mrvn wrote:
Sun Jun 16, 2019 9:12 am
Sure, it shouldn't happen. But it can happen or you wouldn't check for it. I think it can happen with waterfill as that drowns even unminable entities.
Actually, I check for it because chests don't have a concept of direction, they always point "north." So I need to know the direction of the rails underneath to know what direction the BRL in the blueprint should be facing. I always expect a rail to be present. Anything like Waterfill that destroys the (unminable, undamageable) rail would almost certainly destroy the overlapping main chest entity as well.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

Therax wrote:
Mon Jun 17, 2019 4:56 am
mrvn wrote:
Sun Jun 16, 2019 9:12 am
Sure, it shouldn't happen. But it can happen or you wouldn't check for it. I think it can happen with waterfill as that drowns even unminable entities.
Actually, I check for it because chests don't have a concept of direction, they always point "north." So I need to know the direction of the rails underneath to know what direction the BRL in the blueprint should be facing. I always expect a rail to be present. Anything like Waterfill that destroys the (unminable, undamageable) rail would almost certainly destroy the overlapping main chest entity as well.
I know why you look for the rail. That's not what I'm talking about. It's the "if rail then" part. You expect that you might not find a rail. As long as there is an "if rail then" there must be an "else" for the code to be correct.

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by Therax »

mrvn wrote:
Mon Jun 17, 2019 9:44 am
I know why you look for the rail. That's not what I'm talking about. It's the "if rail then" part. You expect that you might not find a rail. As long as there is an "if rail then" there must be an "else" for the code to be correct.
Sorry, you are correct. I misunderstood what you were saying. How did you discover the bug? Did you have a situation where you blueprinted a BRL which had no rails? How did that come about?
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

Therax wrote:
Mon Jun 17, 2019 6:44 pm
mrvn wrote:
Mon Jun 17, 2019 9:44 am
I know why you look for the rail. That's not what I'm talking about. It's the "if rail then" part. You expect that you might not find a rail. As long as there is an "if rail then" there must be an "else" for the code to be correct.
Sorry, you are correct. I misunderstood what you were saying. How did you discover the bug? Did you have a situation where you blueprinted a BRL which had no rails? How did that come about?
As mentioned I expanded the mod to have a loader mkII with bigger chest. I broke lots of things while adding that. I think I discovered it there.

MoiAimeBien
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Jan 16, 2018 4:51 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by MoiAimeBien »

Hi,
When BRL is used with other mod :
Bio-Industries
Bob's Functions Library
Bob's Logistics

The standard recipe for rail is removed.
Instead it's replace with "Wooden straight rail".
So the BRL beacame uncraftable due to that.

I'dont really know who is reponsible for the disapearance of the vanilla rail...

Thanks for reading.

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by Therax »

MoiAimeBien wrote:
Sun Jun 30, 2019 10:50 am
Hi,
When BRL is used with other mod :
Bio-Industries
Bob's Functions Library
Bob's Logistics

The standard recipe for rail is removed.
Instead it's replace with "Wooden straight rail".
So the BRL beacame uncraftable due to that.

I'dont really know who is reponsible for the disapearance of the vanilla rail...

Thanks for reading.
Bio-Industries doesn't remove the vanilla rail, but it is the advanced version of rails. You can upgrade wooden straight rails to regular rails by crafting them with stone bricks.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

mrvn
Smart Inserter
Smart Inserter
Posts: 5684
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by mrvn »

Therax wrote:
Sun Jun 30, 2019 5:20 pm
MoiAimeBien wrote:
Sun Jun 30, 2019 10:50 am
Hi,
When BRL is used with other mod :
Bio-Industries
Bob's Functions Library
Bob's Logistics

The standard recipe for rail is removed.
Instead it's replace with "Wooden straight rail".
So the BRL beacame uncraftable due to that.

I'dont really know who is reponsible for the disapearance of the vanilla rail...

Thanks for reading.
Bio-Industries doesn't remove the vanilla rail, but it is the advanced version of rails. You can upgrade wooden straight rails to regular rails by crafting them with stone bricks.
It also adds a new tech for the advanced rails so you need to do some more research before you can build BRLs.

Personally I've edited the BRLs to have a wooden rail recipe. I should really polish the changes and send them as patch. Currently the new recipes are unconditional which needs to change. Here is what I made:

1) BRLs mk I: needs wooden rails, smaller inventory
2) BRLs mk II: needs rails (mk II), normal inventory
3) BRLs mk III: needs BRL mk II + warehouse, extra large inventory

jakeyjkp
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Mar 12, 2016 11:23 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by jakeyjkp »

Unloader.png
Unloader.png (3.88 MiB) Viewed 4516 times
I'm probably a bit thick here but I can't get the unloaders to move the unloaded stuff. Here there's some stone in the unloader but how does it get from there?

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2632
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by steinio »

jakeyjkp wrote:
Sat Apr 25, 2020 10:08 am
Unloader.png

I'm probably a bit thick here but I can't get the unloaders to move the unloaded stuff. Here there's some stone in the unloader but how does it get from there?
Inserters like from every container?
The mod miniloaders can fill the belts with full throughput.
Image

Transport Belt Repair Man

View unread Posts

jakeyjkp
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Mar 12, 2016 11:23 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by jakeyjkp »

Ah yes - I'll go with them. Thanks for the pointer Steinio. Just noticed we joined these forms same day. :roll: But I ain't added much...

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2632
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by steinio »

jakeyjkp wrote:
Sat Apr 25, 2020 8:30 pm
Ah yes - I'll go with them. Thanks for the pointer Steinio. Just noticed we joined these forms same day. :roll: But I ain't added much...
Ha, better few but quality content then a lot nonsense like the most of my posts :)
Image

Transport Belt Repair Man

View unread Posts

ProMix
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Dec 27, 2019 12:31 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by ProMix »

BLR don't load to rail wagon with filters
I think that the reason for this icreased inserter stack size. My theory - internal inserter have items but can't put in inventory.
Save: https://yadi.sk/d/els-xQlmtyiPpw
P.S. Sorry for english

greenskye
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Jun 08, 2018 1:49 am
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by greenskye »

Is it possible for BRLs to respect slot limiting when blueprinting? Trying to limit the massive inventories to a single rail car worth, but it doesn't seem to save in blueprints

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [MOD 0.16] Bulk Rail Loaders

Post by Therax »

greenskye wrote:
Thu May 14, 2020 9:16 pm
Is it possible for BRLs to respect slot limiting when blueprinting? Trying to limit the massive inventories to a single rail car worth, but it doesn't seem to save in blueprints
Yes, it’s possible. It’s even been on my todo list for a while, but just haven’t gotten around to it. I’ll have another look and see how much work it will take.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

Post Reply

Return to “Mods”