Page 1 of 2

[MOD 0.12.x][0.14.x] SmartLoader_0.3.5 (12.10.16)

Posted: Fri Aug 14, 2015 7:31 pm
by Adil
Type: Mod
Name: SmartLoader
Description: Adds a couple of buildings to simplify setting up supply trains.
License: CC BY 3.0
Version: 0.3.6
Tested-With-Factorio-Version: 0.12.30, 0.14.13
Category: Item
Tags: Inserter, Rail transportation
Download: Attached.
Long description
Images
Version history
Updating
Bugs and problems

Re: [0.12.x] SmartLoader_0.1.0

Posted: Sat Aug 15, 2015 8:46 am
by Zuzak
Brilliant!
A supply load station that can truly work with a single pair of requester chest and inserter!
Far better than my old way of single item type per pair.

Thank you.

Re: [0.12.x] SmartLoader_0.1.0

Posted: Sat Aug 15, 2015 10:32 am
by Adil
You're very welcome. :)

Re: [0.12.x] SmartLoader_0.1.0

Posted: Tue Aug 18, 2015 5:29 pm
by Urbs
Excellent mod!

Will try it out tonight!

Re: [MOD 0.12.x] SmartLoader_0.2.0

Posted: Mon Sep 14, 2015 9:59 pm
by Adil
Found a bug when smart unloaders were enabling all the filters after the first unmet one. Either download the latest version or simply comment no longer needed line 120. (The game bug making this needed was fixed.)

Re: [MOD 0.12.x] SmartLoader_0.2.1

Posted: Thu Sep 17, 2015 8:48 pm
by Adil
Version 0.2.2 fixed error after robots deconstructing the unloader module.

Re: [MOD 0.12.x] SmartLoader_0.2.2

Posted: Fri Sep 18, 2015 3:47 am
by StoneLegion
Very interesting. I like the idea a lot not sure if I quite like the models in fact I do but they clash a lot with the current ones to me. But really nice mod.

Re: [MOD 0.12.x] SmartLoader_0.3.0 (17.10.15)

Posted: Fri Oct 16, 2015 9:40 pm
by Adil
Updated mod to new coding standards.

Re: [MOD 0.12.x] SmartLoader_0.3.0 (17.10.15)

Posted: Wed Oct 28, 2015 5:16 pm
by MNorman
Version 0.3.0 seems to have reintroduced the bug described on Sep 14 (enabling all filters after the first unmet one). The workaround still works.

Re: [MOD 0.12.x] SmartLoader_0.3.0 (17.10.15)

Posted: Wed Oct 28, 2015 10:15 pm
by Adil
Welp, I'll upload the new version.
Sorry, I've got no idea how that got back.

Re: [MOD 0.12.x] SmartLoader_0.3.1 (29.10.15)

Posted: Fri Oct 30, 2015 11:40 pm
by Zeeth_Kyrah
I've been enjoying this mod lately. I have noticed, the smart filter thing that keeps inventories loaded with specific amounts (dang I forget the name the instant I want to talk about it) -- I've been using it to keep a cargo wagon in my ore train loaded with a small amount of coal and repair packs for my mining outposts, but the smart inserter that's being controlled always loads 2-3 items when the train pulls up before stopping, even if the wagon already has more than the amount I said to keep. I think it's because it takes a second to recognize that yes, the inserter has something to load again. I'd like to suggest that the filters be cleared when an inventory goes away, to prevent this. Then later if an inventory is placed next to the inserter, a normal update check would see if anything needs to be loaded.

Re: [MOD 0.12.x] SmartLoader_0.3.1 (29.10.15)

Posted: Sun Nov 01, 2015 8:53 pm
by Darkestnoir

Code: Select all

__SmartLoader__/control.lua:76: LuaEntity API call when LuaEntity was invalid..
Getting this sometimes in mp with my friends.

Re: [MOD 0.12.x] SmartLoader_0.3.1 (29.10.15)

Posted: Sat Apr 16, 2016 8:56 am
by JasonC
SmartLoader 0.3.1, Factorio 0.12.29, I consistently get this error after deleting Smart Unloader Controllers with construction robots:

Image

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Sat Apr 16, 2016 11:02 am
by Adil
Released new version, that should deal with all kinds of such errors.
Also, now smart unloaders will only unload to containers. This is needed to prevent them from repeatedly snatching a few items above the treshold.

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Sat Apr 16, 2016 3:27 pm
by JasonC
Adil wrote:Released new version, that should deal with all kinds of such errors.
Also, now smart unloaders will only unload to containers. This is needed to prevent them from repeatedly snatching a few items above the treshold.
Aw man! The smart unloader was a smarter loader than the smart loader :lol:

Let's say, with the latest version, that I want a train car to be loaded to always contain a specific number of items, say 1000 circuits, 1000 advanced circuits, and 1000 processing units (like using the smart unloader to load into the car but if the smart unloader never went over the threshold). Can I do that with these inserters? I'm having trouble making the smart loader work for me.

Cool concept by the way. Thanks for the work.

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Sat Apr 16, 2016 3:53 pm
by Adil
I guess?
You do know you can set allowed items in vagons by clicking middle mouse onto the slot, right? (And your proposed numbers are multiples of the stack sizes for items concerned?)

Smart loader is designed to not have the flaw of vanilla inserters which can get stuck with items, that cannot be placed in the container. Say if you had a wagon with 999 circuits in it with all other slots reserved for other items, vanilla inserter with stack bonus would grab 5 circuits from chest, insert one and stand still holding 4 remaining in hand. Smart loader will put the excess stuff back in the box and grab next type of item that can be inserted, so it's just unjammable inserter.

Also, this:
Adil wrote:Also, now smart unloaders will only unload to containers.
only means they won't unload to ground or transport belts, which was meaningless usecase of them anyway.

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Sat Apr 16, 2016 5:27 pm
by JasonC
Adil wrote:You do know you can set allowed items in vagons by clicking middle mouse onto the slot, right?
WAIT. REALLY???

OMG. No I honestly had no idea. I never knew what "Set Filter" / "Clear Filter" was in the control menu (always assumed it was just some inserter filter shortcut that I didn't need) and my laptop doesn't have a middle mouse button, so I ran out of mouse buttons and never tried it.

This changes everything.

Also the Smart Loader makes way more sense now. It's brilliant, the vanilla inserters really ought to behave that way.

:D Thanks, now I'm off to plug in a real mouse and redesign my entire rail system. I was literally just about to start learning Lua just to write a mod that did this to train cars... :lol:

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Fri Apr 22, 2016 9:17 pm
by nightingale
I can't believe I didn't know about this mod until now. Really, really, really need this for my Bob's mod campaing where I've shipping everything including most intermediate items with trains to a central warehouse. Will be trying this out tonight, and a massive THANK YOU in advance to you, Adil.

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Sun Apr 24, 2016 4:52 am
by nightingale
I found a bug - SmartLoaders stop being smart if you put more than 120 of them down. The following statement in the on_tick handler is what's causing the problem:

Code: Select all

        if #global.ents<interval then
            global.next_check=global.next_check+math.floor(interval/(#global.ents))
        else
            global.next_check=1
        end
Once you have more than interval (120) smartloaders down, next_check will get set to 1, which causes the following check to never be able to pass:

Code: Select all

        if event.tick~=global.next_check then return end
I fixed it by changing the above from a ~= to a < (which is a much safer check), although setting next_check to next_check+1 is probably what was intended.

I also, made a change to loader_check, changing this:

Code: Select all

    if loader.drop_target and loader.held_stack.valid_for_read and not loader.drop_target.can_insert(loader.held_stack) then
to this:

Code: Select all

    if loader.held_stack.valid_for_read and (not loader.drop_target or not loader.drop_target.can_insert(loader.held_stack)) then
That way the loader doesn't sit with something hanging in its hand if the train goes away. For my particular use case, the odds are that the next train would want something different, but it was more for aesthetics (and so I know the mod is working). It might break a smart loader putting something on the ground for another inserter to pick up... but that seems like a silly use case for this particular entity.

Re: [MOD 0.12.x] SmartLoader_0.3.2 (16.04.16)

Posted: Sun Apr 24, 2016 11:45 am
by Adil
I see you really indulged in this mod :)
Did they rotate correctly by the way? I've looked over the code and now don't think the simultaneous rotation was done correctly as well.
I've been using that ~= because it seemed to me that it should be faster. This day I know there are other things that in that code that don't make it fastest much more than that arithmetic.
I'll release the updated version now, thanks for the help. Since you've probably got a sizable base with those, could you note the old and the new update times of the mod?