[0.13-0.15] [Library]Factorio Standard Library Project 0.8.0
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.0
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.
Future releases after 0.5 will likely no longer be fully compatible with Factorio 0.12.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1
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
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1
Your standard library's logging tool saved my butt. Thank you.
I still haven't learned the rest of your library yet, but it will do for now.
I still haven't learned the rest of your library yet, but it will do for now.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1
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.htmlkiba wrote:Your standard library's logging tool saved my butt. Thank you.
I still haven't learned the rest of your library yet, but it will do for now.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1
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.
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.
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.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.5.1
Fascinating, an interesting result of the way the doc generator works. In the code, it looked correct: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.
toCode: 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.
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.
Code: Select all
--- Creates a new logger object
-- In debug mode, the logger writes immediately. Otherwise it buffers lines.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0
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
For the release, and the full changelog: https://github.com/Afforess/Factorio-St ... /tag/0.6.0
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0
Awesome!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.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0
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.
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.
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0
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?
Looking through the stdlib's source code, I am not clear on how the game check for events being pinged? Though Gui.Event.dispatch?
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)
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0
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.
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: [0.12-0.13] [Library]Factorio Standard Library Project 0.6.0
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.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.
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.
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...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?
Looking through the stdlib's source code, I am not clear on how the game check for events being pinged? Though Gui.Event.dispatch?Code: Select all
function test() print("test") end Gui.Event.register (defines.events.on_player_armor_inventory_changed, "top", test)
Code: Select all
Gui.on_click("my_cool_gui_element_name", function(event)
..
do something cool here
end)
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.6.0
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.
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.6.0
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.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.
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.6.0
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.Supercheese wrote: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.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.
[0.12-0.14] [Library]Factorio Standard Library Project 0.7.0
The Factorio Standard Library 0.7.0 is released, with a number of additions:
Version 0.7.0 (No Breaking Changes)
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.
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0
Cool!ssilk wrote:BTW: Alex Aulbach is me.
-
- Burner Inserter
- Posts: 11
- Joined: Wed Nov 02, 2016 2:57 pm
- Contact:
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0
Found a documentation bug on http://afforess.github.io/Factorio-Stdl ... rface.html. The example for find_all_entities says final_all_entities instead.
Re: [0.12-0.14] [Library]Factorio Standard Library Project 0.7.0
Nice find! I've updated the documentation and fixed the typo.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.