claudemetz / untitledguiguide Goto Github PK
View Code? Open in Web Editor NEWA Factorio GUI tutorial
License: The Unlicense
A Factorio GUI tutorial
License: The Unlicense
As per Title, in Chapter 6, the new local function build_interface()
should set the enabled
tag for the slider and textfield to the current player_global.controls_active
, since otherwise the default might be changed, and the controls should be deactivated but are still enabled in the GUI by default.
First, thank you so much for writing up this tutorial. I went from zero to being able to mitigate an issue I had with how I ended up progressing through the tutorial!
So long about say chapter 5 I ended up making a save. This save had the GUI open. By the time I'd worked through the updates in Chapter 8 to reference the GUI with the player_global.elements table there wasn't any way to close because the GUI wasn't made with the changes from Chapter 7 so that E and Escape wouldn't even try either. Basically the GUI was lost out there.
So I updated the info.json version number to get .on_configuration_changed to run and added a bit of code there to hunt down the old GUI and get it to close it.
Here is the code if you want to make a supplemental note about really messing up your state/migration.
script.on_configuration_changed(function(config_changed_data)
if config_changed_data.mod_changes["GUITutorial"] then
for _, player in pairs(game.players) do
local player_global = global.players[player.index]
if not player_global.elements then
player_global.elements = {}
player_global.elements.main_frame = player.gui.screen.ugg_main_frame
end
local main_frame = player_global.elements.main_frame
if main_frame ~= nil then toggle_interface(player) end
end
end
end)
Looking great so far. It's very consitent and i would think also easy to follow.
For me personally, even when leanring something new, i feel like it's too verbose, but too verbose is most likely better than the opposite, increasing the chance of misunderstandings. (I could go into detail why i think it's better to be "too verbose" imo because i have lots of reasons, but i don't feel like it's necessary. Just know that it's not a bad thing.)
There are just a few ideas i had. Not sure how to share them, so i pushed them to a separate branch in my fork.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.