Factorio Standard Library

by Nexela

The Factorio Standard Library is a project to bring Factorio modders high-quality, commonly-required utilities and tools.

Internal
1 year, 10 months ago
0.17 - 1.1
405K

i Update to Factorio 2.0

5 days ago
(updated 4 days ago)

Not sure if the mod author is still working on this, but for any of my mods that require this dependency, it should be safe to simply update it by unzipping the mod, editing info.json and updating the "factorio_version" to 2.0

I can't speak for any other mods that require this dependency, all of the functions my mods use did not need to be updated (or I modified them locally within my mod to not break anything)

4 days ago

not all features of stdlib end up working, sadly pickerdollie doesnt work with
"
stdlib/stdlib/event/event.lua:72: attempt to index field 'script' (a userdata value)
stack traceback:
stdlib/stdlib/event/event.lua:72: in main chunk
[C]: in function 'require'
PickerDollies/control.lua:4: in main chunk
"

if you just grab the old mod and change their json to load.

4 days ago

@Jey you must be using an older version of stdlib, line 72 in that file referenced is "end" which wouldn't throw that error.
Line 70 tries to index, so again, older version perhaps? It could totally still be broken, I hate LUA and all it stands for...

4 days ago
(updated 4 days ago)

I actually really like lua, but I also haven't programmed in any real languages, unless you count python (but even then, I haven't done that much in it). It's relatively simple to work with, aside from the lack of switch statements

4 days ago

i wouldnt be surprised, i used the version i had before dlc and i think it was updated like 20 months ago or so. i didnt mess around more than i had to, just opened the zip, changed the version in json and tried / got the error then gave up, i dont need picker dollies just yet :P. Im sure some similar mod will show up sooner than later.

Factorio modding community is just batshit insane lol.

@Jey you must be using an older version of stdlib, line 72 in that file referenced is "end" which wouldn't throw that error.
Line 70 tries to index, so again, older version perhaps? It could totally still be broken, I hate LUA and all it stands for...

he is on the correct line, I just debugged the thing (or at least I'm trying to, since I've never touched lua before)

for name in pairs(Event.script) do
        _G.script[name] = function()
            error('Detected attempt to register an event using script.' .. name .. ' while using the STDLIB event system ')
        end <- error in this line
    end

you can check out the code on gh -> https://github.com/Afforess/Factorio-Stdlib/blob/master/stdlib/event/event.lua

unfortunately I dont know how I could fix that, but I hope someone else does :D

2 days ago

I've actually begun making an attempt on updating this and the rest of the Picker mods to 2.0, and so far have actually been making some good progress. I fixed the error above by simply commenting out that entire for block (it doesn't appear to be critical for mod functionality, simply used for error checking and "script protection")

All of the other changes I've made so far are simply updating prototype references during control.lua to match the new format (from game.x_prototypes[object] to simply prototypes.x[object]), removing the "hidden" flags from all of the picker added tools, updating the picker tools to the new "select" format, and one check to ensure global variable exists before attempting to write to it.

So far, I've got Picker Extended working perfectly, except for the testing map (which I don't really know how to fix, but it doesn't crash unless you try to open it, so I'll probably just ignore it for now). Not sure if I should release them via OneDrive or Google Drive, or actually upload them to the mod portal as entirely new unofficial updates though. Don't know if I want the responsibility of all the other mods that depend on this one...

2 days ago
(updated 2 days ago)

Unofficial updates now available here (google drive link)

Folder includes stdlib, PickerAtheneum (required for PickerExtended), PickerExtended, and PickerDollies, and an updated version of Reverse Factory that works with the new stdlib (something I did broke my v9.0.0).

I have not extensively tested all functionality with these mods, but I know for sure the following features are working:

  • PickerExtended Screenshot tool, ore eraser, and tape measure
  • PickerExtended Ghost entity revival thing
  • PickerExtended Picker crafter
  • PickerExtended Quick swap between planners via hotkey
  • PickerDollies Moving of electric poles and circuit connected entities (and regular entities, from what I've tested)

I think that's a good enough start for now. If Nexela doesn't return by the end of the week, I'll just release a version of these directly to the mod portal and move all my dependencies to that instead.

a day ago

thanks for your work. ill give it a whirl.

a day ago
(updated a day ago)

not 100% sure if its the exact function that should be used, but was having problem pickerdollies not working once loading my save.

game.entity_prototypes[entity_name] no longer exists, replaced it with game.get_entity_by_tag(entity_name)

edit: seem to work as intended, trying to move a car does give the blacklist error.

also needed to add
"
if global then if global.blacklist_names then else create_global_blacklist() end else create_global_blacklist() end
"
to interface.lua line 68 (after interface["add_blacklist_name"] = function(entity_name)) to fix a crash on load.

a day ago

Thanks for the work, many of us need this

a day ago
(updated a day ago)

@Jey123456 Thanks for calling it out, it seems I missed a few references; I updated the game.entity_prototypes[entity_name] to prototypes.entity[entity_name] and it properly displays flying text "car does not support moving", which I assume is the intended result. I updated both PickerDollies and PickerAtheneum to swap out the instances of "_prototypes" that I didn't catch before.

Couple of things I have noticed while testing is that entities with multiple cables (for me it was a power switch with two copper connections and one red circuit connection) can be moved slightly farther than they should be allowed to (it might only be checking one of the connections for max distance, not checking all, but I'm not sure).

And oblong rotate function is also not currently working (that allows rotating pumps and combinators in more than 2 directions)

a day ago

Nice work, quite a few mods still depend on stdlib, ran into the same issue with PickerDollies.

I currently didnt dig any deeper, but is _G a global table? and it seems that the structure has somewhat changed in 2.0?

New response