forked from Crimso777/Factorio-Access
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redo the blueprint menu using a generalizable framework
See ui/menus/blueprint-menu.lua for an easy way to make menus. Squashed commit of the following: commit 26ee4b8 Author: Austin Hicks <[email protected]> Date: Mon Feb 17 18:59:40 2025 -0800 Bunch of small fixes commit ee79129 Author: Austin Hicks <[email protected]> Date: Sun Feb 9 19:36:33 2025 -0800 WIP commit 8008364 Author: Austin Hicks <[email protected]> Date: Sun Feb 9 17:30:48 2025 -0800 WIP commit bf5454d Author: Austin Hicks <[email protected]> Date: Fri Feb 7 20:25:32 2025 -0800 WIP commit 566fdeb Author: Austin Hicks <[email protected]> Date: Fri Feb 7 20:25:04 2025 -0800 WIP
- Loading branch information
Showing
11 changed files
with
778 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[fa] | ||
ui-blueprints-menu-title=Blueprint Configuration | ||
ui-blueprints-menu-limited=Empty Blueprint with Limited Options. Import a blueprint string or select an area for more. | ||
ui-blueprints-menu-basic=Blueprint __1__ | ||
ui-blueprints-menu-import=Import a blueprint string to this blueprint | ||
ui-blueprints-menu-description=Description: __1__ | ||
ui-blueprints-menu-no-icons=No Icons | ||
ui-blueprints-menu-icons=Icons: | ||
ui-blueprints-menu-count-and-dims=__1__ by __2__ with __3__ entities | ||
ui-blueprints-menu-no-components=No entities in this blueprint | ||
ui-blueprints-menu-components-intro=Contains the following: | ||
ui-blueprints-menu-rename=Rename this blueprint | ||
ui-blueprints-menu-edit-desc=Edit description | ||
ui-blueprints-menu-copy=Create a copy of this blueprint in your inventory | ||
ui-blueprints-menu-delete=Delete this blueprint | ||
ui-blueprints-menu-export=Export this blueprint as a string | ||
ui-blueprints-menu-reselect=Reselect the area for this blueprint | ||
|
||
|
||
ui-blueprints-import-txtbox=Paste a blueprint string in this textbox and press enter. Press escape to cancel. | ||
ui-blueprints-rename-txtbox=Enter new name and press Enter. Escape to cancel. | ||
ui-blueprints-description-txtbox=Enter description and press enter. Escape to cancel. | ||
ui-blueprints-export-txtbox=Press control plus a control plus c to copy, then escape to close. | ||
|
||
ui-blueprints-copy-success=Copied. | ||
ui-blueprints-copy-failed=Unable to copy. | ||
ui-blueprints-deleted=Deleted and menu closed. | ||
|
||
ui-blueprints-select-first-point=Select the first point now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[fa] | ||
ui-menu-empty=Empty menu. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
local mod = {} | ||
|
||
---@param key string | ||
---@param callback fun(fa.MenuCtx) | ||
---@return fa.MenuRender | ||
function mod.lazy_label(key, callback) | ||
return { | ||
key = key, | ||
label = callback, | ||
click = callback, | ||
} | ||
end | ||
|
||
---@param key string | ||
---@param text LocalisedString | ||
---@return fa.MenuRender | ||
function mod.simple_label(key, text) | ||
return mod.lazy_label(key, function(ctx) | ||
ctx.message:fragment(text) | ||
end) | ||
end | ||
|
||
--[[ | ||
A "button"-like label: the text is static but you can click it to do something. | ||
Remember though! This can change text on each render, so it's often useful for | ||
dynamic labels too (the next render gets a chance to recompute). | ||
]] | ||
---@param key string | ||
---@param label LocalisedString | ||
---@param click_handler fun(fa.MenuCtx) | ||
---@return fa.MenuItemRender | ||
function mod.clickable_label(key, label, click_handler) | ||
return { | ||
key = key, | ||
label = function(ctx) | ||
ctx.message:fragment(label) | ||
end, | ||
click = click_handler, | ||
} | ||
end | ||
return mod |
Oops, something went wrong.