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

Topics and discussion about specific mods
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post 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
Attachments
SmartLoader_0.3.6.zip
(12.84 KiB) Downloaded 211 times
SmartLoader_0.3.5.zip
0.14.13
(12.77 KiB) Downloaded 190 times
SmartLoader_0.3.4.zip
0.12.30
(12.71 KiB) Downloaded 233 times
SmartLoader_0.3.3.zip
0.12.30
(12.71 KiB) Downloaded 218 times
SmartLoader_0.3.2.zip
0.12.30
(12.69 KiB) Downloaded 199 times
SmartLoader_0.3.1.zip
(12.71 KiB) Downloaded 462 times
SmartLoader_0.3.0.zip
(12.67 KiB) Downloaded 325 times
SmartLoader_0.2.2.zip
(12.7 KiB) Downloaded 357 times
SmartLoader_0.2.0.zip
(12.66 KiB) Downloaded 324 times
SmartLoader_0.1.0.zip
(5.39 KiB) Downloaded 354 times
Last edited by Adil on Sat Jan 28, 2017 2:36 pm, edited 16 times in total.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Zuzak
Inserter
Inserter
Posts: 33
Joined: Sat Oct 04, 2014 6:09 pm
Contact:

Re: [0.12.x] SmartLoader_0.1.0

Post 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.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [0.12.x] SmartLoader_0.1.0

Post by Adil »

You're very welcome. :)
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Urbs
Inserter
Inserter
Posts: 34
Joined: Sat Nov 01, 2014 1:10 pm
Contact:

Re: [0.12.x] SmartLoader_0.1.0

Post by Urbs »

Excellent mod!

Will try it out tonight!
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [MOD 0.12.x] SmartLoader_0.2.0

Post 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.)
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [MOD 0.12.x] SmartLoader_0.2.1

Post by Adil »

Version 0.2.2 fixed error after robots deconstructing the unloader module.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
StoneLegion
Filter Inserter
Filter Inserter
Posts: 687
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [MOD 0.12.x] SmartLoader_0.2.2

Post 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.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post by Adil »

Updated mod to new coding standards.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
MNorman
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Jan 31, 2015 12:06 am
Contact:

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

Post 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.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post by Adil »

Welp, I'll upload the new version.
Sorry, I've got no idea how that got back.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Zeeth_Kyrah
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Tue Jan 21, 2014 10:05 pm
Contact:

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

Post 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.
Planned projects: Energy Crystals Plus, Minor Fluid Handling, Small electric furnaces
(high-energy materials and assembler, fluid void burner and small tank, tiny and slow furnaces with charcoal)
User avatar
Darkestnoir
Inserter
Inserter
Posts: 30
Joined: Sun Nov 23, 2014 8:57 pm
Contact:

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

Post by Darkestnoir »

Code: Select all

__SmartLoader__/control.lua:76: LuaEntity API call when LuaEntity was invalid..
Getting this sometimes in mp with my friends.
JasonC
Filter Inserter
Filter Inserter
Posts: 449
Joined: Tue Mar 22, 2016 3:05 am
Contact:

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

Post by JasonC »

SmartLoader 0.3.1, Factorio 0.12.29, I consistently get this error after deleting Smart Unloader Controllers with construction robots:

Image
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post 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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
JasonC
Filter Inserter
Filter Inserter
Posts: 449
Joined: Tue Mar 22, 2016 3:05 am
Contact:

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

Post 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.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post 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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
JasonC
Filter Inserter
Filter Inserter
Posts: 449
Joined: Tue Mar 22, 2016 3:05 am
Contact:

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

Post 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:
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.
User avatar
nightingale
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jan 13, 2016 3:25 pm
Contact:

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

Post 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.
User avatar
nightingale
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jan 13, 2016 3:25 pm
Contact:

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

Post 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.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post 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?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Post Reply

Return to “Mods”