[0.13-0.15] [Library]Factorio Standard Library Project 0.8.0

Enhance Your Overall Game-Play.
Mod-Database, Calculators, Cheatsheets, Multiplayer, Scripts, Libs and Other Useful Stuff.

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.0

Postby Afforess » Tue Jun 28, 2016 11:16 pm

For interested modders, The Factorio Standard Library is fully compatible with both Factorio 0.12 and 0.13 with no changes. All existing versions are fully compatible.

Future releases after 0.5 will likely no longer be fully compatible with Factorio 0.12.
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1

Postby Afforess » Mon Jul 04, 2016 9:27 pm

New Release, contains a single bug fix:
  • Version 0.5.1 (No Breaking Changes)
    • Fixed Event registry not notifying of an error in an event handler when the game was loaded, but no players were connected to the game
    • Note: Thanks to mojo2012 for the bug report
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1

Postby kiba » Thu Jul 21, 2016 9:50 am

Your standard library's logging tool saved my butt. Thank you. :D

I still haven't learned the rest of your library yet, but it will do for now.
kiba
Filter Inserter
Filter Inserter
 
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1

Postby Afforess » Fri Jul 22, 2016 2:49 am

kiba wrote:Your standard library's logging tool saved my butt. Thank you. :D

I still haven't learned the rest of your library yet, but it will do for now.


Glad you found it useful! Check out the index of the docs sometimes, it's very easy to use all of the modules: http://afforess.github.io/Factorio-Stdlib/index.html
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1

Postby Nexela » Fri Jul 22, 2016 4:13 am

Btw, a typo in the log.lua file is driving me nuts every time I see it. It really needs a period or some other form of punctuation after "Creates a new logger object". The way it reads now is you create the logger in debug mode.

Code: Select all
Creates a new logger object In debug mode, the logger writes immediately. Otherwise it buffers lines. Logger flushes after 60 seconds has elapsed since the last message.

to
Code: Select all
Creates a new logger object. In debug mode, the logger writes immediately. Otherwise it buffers lines. Logger flushes after 60 seconds has elapsed since the last message.
Nexela
Smart Inserter
Smart Inserter
 
Posts: 1765
Joined: Wed May 25, 2016 11:09 am

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1

Postby Afforess » Sat Jul 23, 2016 12:19 am

Nexela wrote:Btw, a typo in the log.lua file is driving me nuts every time I see it. It really needs a period or some other form of punctuation after "Creates a new logger object". The way it reads now is you create the logger in debug mode.

Code: Select all
Creates a new logger object In debug mode, the logger writes immediately. Otherwise it buffers lines. Logger flushes after 60 seconds has elapsed since the last message.

to
Code: Select all
Creates a new logger object. In debug mode, the logger writes immediately. Otherwise it buffers lines. Logger flushes after 60 seconds has elapsed since the last message.


Fascinating, an interesting result of the way the doc generator works. In the code, it looked correct:

Code: Select all
--- Creates a new logger object
-- In debug mode, the logger writes immediately. Otherwise it buffers lines.


At any rate, fixed. :)
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0

Postby Afforess » Sun Jul 31, 2016 5:54 pm

Factorio Standard Library 0.6.0 has been released, with a ton of changes and several new contributors! Special thanks to credomane on his work for the GUI event system!

For the release, and the full changelog: https://github.com/Afforess/Factorio-St ... /tag/0.6.0
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0

Postby Nexela » Sun Jul 31, 2016 8:48 pm

Added Tile.adjacent, given a tile, returns a list of adjacent tile positions (N, E, S, W) or (N, NE, E, SE, S, SW, W, NW), depending if diagonal tiles are specified.


Awesome!
Nexela
Smart Inserter
Smart Inserter
 
Posts: 1765
Joined: Wed May 25, 2016 11:09 am

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0

Postby safan » Fri Aug 05, 2016 1:50 pm

Hello, interesting initiative.
I have a suggestion, since i'm struggling with the gui to make my mod.
Can you make something for creating a button that can open and close a new window. I'm trying to do this without knowing any program skills and it just won't work. It could also be used to update the advanced logistic network mod and others.
safan
Fast Inserter
Fast Inserter
 
Posts: 117
Joined: Mon Dec 23, 2013 7:26 pm

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0

Postby kiba » Thu Aug 25, 2016 7:05 pm

Anybody making use of the GUI elements? I feel it's hard to figure out things if I don't have example codes to examine.

Here's some test code that seems to be not working?

Code: Select all

function test()
  print("test")
end

Gui.Event.register (defines.events.on_player_armor_inventory_changed, "top", test)


Looking through the stdlib's source code, I am not clear on how the game check for events being pinged? Though Gui.Event.dispatch?
kiba
Filter Inserter
Filter Inserter
 
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0

Postby ssilk » Tue Sep 13, 2016 9:05 pm

I have looked into this code (great code, really well programmed!) and have a question about the epsilon, that is used to determine for example, if two float-number are zero. (for example Area/Position).

I thought (and it's my current opinion), that Factorio uses fixed floating point numbers (8 bits). Which means in general, one tile has up to 256 positions in X and Y direction. That is a much lesser accuracy than lua floating point.

Well, I haven't calculated anything through, it's just a thought. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
ssilk
Global Moderator
Global Moderator
 
Posts: 10393
Joined: Tue Apr 16, 2013 10:35 pm
Location: Würzburg, Germany

Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0

Postby Afforess » Thu Sep 22, 2016 9:22 pm

ssilk wrote:I have looked into this code (great code, really well programmed!) and have a question about the epsilon, that is used to determine for example, if two float-number are zero. (for example Area/Position).

I thought (and it's my current opinion), that Factorio uses fixed floating point numbers (8 bits). Which means in general, one tile has up to 256 positions in X and Y direction. That is a much lesser accuracy than lua floating point.

Well, I haven't calculated anything through, it's just a thought. :)


Fixed floating points may be used in the engine itself (I have no way of knowing myself), but I am fairly certain that when these "fixed" are shared with the lua environment, they become the standard IEEE floating point values. I distinctly remember encountering hairy positions, such as 0.4999999999999 in the wild.

I think its probably best to err in the side of caution in the epsilon, however it's a variable, so theoretically anyone can change it to whatever their favorite magic number is. :)

kiba wrote:Anybody making use of the GUI elements? I feel it's hard to figure out things if I don't have example codes to examine.

Here's some test code that seems to be not working?

Code: Select all

function test()
  print("test")
end

Gui.Event.register (defines.events.on_player_armor_inventory_changed, "top", test)


Looking through the stdlib's source code, I am not clear on how the game check for events being pinged? Though Gui.Event.dispatch?


Sorry about the slow response. Use of the specific handlers, like Gui.on_click, Gui.on_checked_state_changed, or Gui.on_text_changed. The first argument is a regular expression that will match the name(s) of elements, and the second argument is the handler. So...

Code: Select all
Gui.on_click("my_cool_gui_element_name", function(event)
   ..
  do something cool here
end)
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.6.0

Postby Afforess » Thu Sep 22, 2016 9:37 pm

As a belated followup notice, I can attest to there being no significant API changes in 0.14 that affect the Factorio Standard Library Project, and it remains compatible with all mods between 0.12.X and 0.14.X. Notice will be provided if the range of versions compatible changes in the future.
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.6.0

Postby Supercheese » Thu Sep 22, 2016 9:39 pm

Afforess wrote:As a belated followup notice, I can attest to there being no significant API changes in 0.14 that affect the Factorio Standard Library Project, and it remains compatible with all mods between 0.12.X and 0.14.X. Notice will be provided if the range of versions compatible changes in the future.

Well, with the exception that print-force, print-surface, and print-all are now integrated into the base game, so there's no longer a need for the StdLib versions. ;)
Supercheese
Filter Inserter
Filter Inserter
 
Posts: 822
Joined: Mon Sep 14, 2015 7:40 am
Location: Idaho, USA

Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.6.0

Postby Afforess » Thu Sep 22, 2016 9:56 pm

Supercheese wrote:
Afforess wrote:As a belated followup notice, I can attest to there being no significant API changes in 0.14 that affect the Factorio Standard Library Project, and it remains compatible with all mods between 0.12.X and 0.14.X. Notice will be provided if the range of versions compatible changes in the future.

Well, with the exception that print-force, print-surface, and print-all are now integrated into the base game, so there's no longer a need for the StdLib versions. ;)


Well, that's a good point. I'll add a deprecation notice there. That's the second API change that has obsoleted stdlib code, and the more the merrier.
User avatar
Afforess
Filter Inserter
Filter Inserter
 
Posts: 421
Joined: Tue May 05, 2015 6:07 pm

[0.12-0.14] [Library]Factorio Standard Library Project 0.7.0

Postby Afforess » Fri Sep 30, 2016 11:27 pm

The Factorio Standard Library 0.7.0 is released, with a number of additions:

Version 0.7.0 (No Breaking Changes)
  • Fixed documentation for Entity.to_collision_area
  • Fixed documentation for Area.to_table
  • Changed Game.print_all to print to offline players (fixes https://github.com/Afforess/Factorio-Stdlib/issues/49)
  • Deprecated Game.print_force (use force.print instead)
  • Deprecated Game.print_surface (use surface.print instead)
  • Deprecated Area.area, due to misleading name. (use Area.size instead)
  • Added Area.adjust, modifies area to ensure x,y coordinate values are normalized
  • Added Area.construct, creates an area from two pairs of x,y coordinates
  • Added Area.size, replaces the deprecated function, Area.area.
  • Added Position.copy, creates a copy of a position
  • Added Position.construct, creates a position from an x,y pair
  • Added table.find, searches a table for the first element that matches the function
  • Added table.any, searches a table and returns true if any elements matches the function
  • Added Trains module, providing train utility methods and events:
    • Added Trains.set_data, sets persistent mod data on a train
    • Added Trains.get_data, gets mod data on a train
    • Added Trains.on_train_id_changed event, contains the old and new id of the train, and fires when a train id changes (e.g. locomotives are added to an existing train)
    • Added Trains.find_filtered, searches and returns a table of trains on surface(s) for trains that match the area, name, or state criteria
    • Added Trains.get_train_id, returns the train id of a train
    • Added Trains.get_main_locomotive, finds and returns the main locomotive entity of any train
  • Added Time-based events, require 'stdlib/event/time' to enable them, then register the events to script them.
    • Event.Time.sunset, fires an event when sunset occurs for a surface
    • Event.Time.sunrise, fires an event when sunrise occurs for a surface
    • Event.Time.midday, fires an event noon occurs for a surface
    • Event.Time.midnight, fires an event when midnight occurs for a surface
    • Event.Time.minutely, fires an event when an in-game minute passes
    • Event.Time.hourly, fires an event when an in-game hour passes
    • Event.Time.daily, fires an event when an in-game day passes
  • Added Config system, for easier management of persistent mod configuration
    • Added Config.new, ex: Config.new(global.config) creates a new configuration, stored at global.config
    • Added config.set, allows setting a value at nested paths, ex: (Config.new(global.config).set("your.path.here", foo)
    • Added config.get, allows getting nested values, ex: (Config.new(global.config).get("your.path.here")
    • Added config.delete, deletes a value at a config path, ex: (Config.new(global.config).delete("your.path.here")
    • Added config.is_set, tests whether a config value is set or not, ex: (Config.new(global.config).is_set("your.path.here")
  • Added a GUI event handler system. Multiple handlers for each event can be registered, using regex patterns to match element names.
    Note: Thanks to Andy Hunt, Alex Aulbach, and credomane for their contributions to 0.7.0!
    User avatar
    Afforess
    Filter Inserter
    Filter Inserter
     
    Posts: 421
    Joined: Tue May 05, 2015 6:07 pm

    Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0

    Postby ssilk » Sat Oct 01, 2016 8:47 am

    BTW: Alex Aulbach is me. :)
    Cool suggestion: Eatable MOUSE-pointers.
    Have you used the Advanced Search today?
    Need help, question? FAQ - Wiki - Forum help
    I still like small signatures...
    User avatar
    ssilk
    Global Moderator
    Global Moderator
     
    Posts: 10393
    Joined: Tue Apr 16, 2013 10:35 pm
    Location: Würzburg, Germany


    Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0

    Postby lettherebelight » Thu Nov 03, 2016 5:18 pm

    Found a documentation bug on http://afforess.github.io/Factorio-Stdl ... rface.html. The example for find_all_entities says final_all_entities instead.
    lettherebelight
    Burner Inserter
    Burner Inserter
     
    Posts: 11
    Joined: Wed Nov 02, 2016 2:57 pm

    Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0

    Postby Afforess » Thu Nov 03, 2016 6:10 pm

    lettherebelight wrote:Found a documentation bug on http://afforess.github.io/Factorio-Stdl ... rface.html. The example for find_all_entities says final_all_entities instead.


    Nice find! I've updated the documentation and fixed the typo.
    User avatar
    Afforess
    Filter Inserter
    Filter Inserter
     
    Posts: 421
    Joined: Tue May 05, 2015 6:07 pm

    PreviousNext

    Return to Tools

    Who is online

    Users browsing this forum: No registered users and 1 guest