New GUI root for temporary GUI elements
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: New GUI root for temporary GUI elements
Delicous!
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: New GUI root for temporary GUI elements
Incredible, thanks for the hard work!
Re: New GUI root for temporary GUI elements
am i dreaming?
i'll believe it when i see it o.o
i think this is my most-wished feature.
can we read the location of the player's crafting gui?
i'll believe it when i see it o.o
i think this is my most-wished feature.
can we read the location of the player's crafting gui?
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
Re: New GUI root for temporary GUI elements
I kinda doubt this includes any interaction with base game UIs.
Re: New GUI root for temporary GUI elements
You can't read the location of game GUIs and I don't think that will happen anytime soon (if ever).
player.screen is useuful really only in 1 scenario: you want a GUI that acts and functions identically to the normal game GUIs. Z-ordering is never preserved so don't think you're going to be able to put your GUIs over base game ones to "hide" them. You also won't be able to position your GUIs relative to game GUIs to make them act like additions/panels on the game GUIs.
I have a different idea for something like player.relative.add() which would position elements you give relative to some game GUI.
Something like:
And then it would put your button to the left of the quickbar when the quickbar is visible.
It's just an idea at this point. I still need to figure out if it can be done in some reasonable way that it doesn't constantly get broken as people work on GUIs.
player.screen is useuful really only in 1 scenario: you want a GUI that acts and functions identically to the normal game GUIs. Z-ordering is never preserved so don't think you're going to be able to put your GUIs over base game ones to "hide" them. You also won't be able to position your GUIs relative to game GUIs to make them act like additions/panels on the game GUIs.
I have a different idea for something like player.relative.add() which would position elements you give relative to some game GUI.
Something like:
Code: Select all
game.player.gui.relative.add({type="button", caption="Click me", relative_to={type="quickbar", position="left"}})
It's just an idea at this point. I still need to figure out if it can be done in some reasonable way that it doesn't constantly get broken as people work on GUIs.
If you want to get ahold of me I'm almost always on Discord.
Re: New GUI root for temporary GUI elements
This sounds interesting...Rseding91 wrote: ↑Tue Jul 23, 2019 11:30 am You can't read the location of game GUIs and I don't think that will happen anytime soon (if ever).
player.screen is useuful really only in 1 scenario: you want a GUI that acts and functions identically to the normal game GUIs. Z-ordering is never preserved so don't think you're going to be able to put your GUIs over base game ones to "hide" them. You also won't be able to position your GUIs relative to game GUIs to make them act like additions/panels on the game GUIs.
I have a different idea for something like player.relative.add() which would position elements you give relative to some game GUI.
Something like:
And then it would put your button to the left of the quickbar when the quickbar is visible.Code: Select all
game.player.gui.relative.add({type="button", caption="Click me", relative_to={type="quickbar", position="left"}})
It's just an idea at this point. I still need to figure out if it can be done in some reasonable way that it doesn't constantly get broken as people work on GUIs.
Maybe i should provide more information what i'm planning to do:
- Adding buttons /informational labels / progressbars to existing guis, for example:
- custom equipment adding the scripted stats to the equipment summary
- money label and selling /buying toggle to the player's crafting gui
- toggling an overlay for buying which spawns a frame that looks exactly like, but covers the crafting menu
- Adding the bonus cells progress bar, efficiency, temperature, output, etc to the realistic reactors entity gui
I was actually willing to accept that my gui elements wouldnt move with it's "parent", but its obviously critical that they are displayed above the game guis.
This buying/selling mod is the next one on my todo list, and the only idea i have right now, so i was really looking forward to this
(gonna be great, already have the price calculation perfectly figured out and an alpha version of the buying gui (as seen in my "DotA" mod), just gotta add some supply/demand mechanics and integrate the gui in some nice way)
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
Re: New GUI root for temporary GUI elements
it works!Rseding91 wrote: ↑Tue Jul 23, 2019 11:30 am You can't read the location of game GUIs and I don't think that will happen anytime soon (if ever).
player.screen is useuful really only in 1 scenario: you want a GUI that acts and functions identically to the normal game GUIs. Z-ordering is never preserved so don't think you're going to be able to put your GUIs over base game ones to "hide" them. You also won't be able to position your GUIs relative to game GUIs to make them act like additions/panels on the game GUIs.
I have a different idea for something like player.relative.add() which would position elements you give relative to some game GUI.
Something like:
And then it would put your button to the left of the quickbar when the quickbar is visible.Code: Select all
game.player.gui.relative.add({type="button", caption="Click me", relative_to={type="quickbar", position="left"}})
It's just an idea at this point. I still need to figure out if it can be done in some reasonable way that it doesn't constantly get broken as people work on GUIs.
i can draw elements on top of the crafting gui
but i'd still appreciate your idea with the relative adding, would really polish the whole experience.
i'll start making my gui now, thank you very much for the latest patch
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
Re: New GUI root for temporary GUI elements
Right up until you save/load and then it's under it. Or just close the GUI and open it again and it's now under it.
If you want to get ahold of me I'm almost always on Discord.
Re: New GUI root for temporary GUI elements
Thats no problem, since it's only created when the crafting gui is opened.
If you want the opposite effect, you could probably use the hiding feature and never destroy the gui.
When a savegame is loaded, we can just re-create our guis.
Imo we have all the tools to control the z-ordering on our end
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: New GUI root for temporary GUI elements
How so?
That is kinda sad. Will probably also cause problems when multiple mods try to draw to the same region of the screen (even if it's just partial overlap). How difficult would it be to have actual runtime-controllable z-order on guis?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: New GUI root for temporary GUI elements
Never going to happen. That's completely outside of what player.screen is supposed to do: you as a modder should never be using player.screen as "draw on the screen". You use it as "Show a GUI on the screen" and the order is what ever the player wants it to be by clicking on given GUIs.eradicator wrote: ↑Fri Jul 26, 2019 4:19 amHow so?
That is kinda sad. Will probably also cause problems when multiple mods try to draw to the same region of the screen (even if it's just partial overlap). How difficult would it be to have actual runtime-controllable z-order on guis?
If you want to get ahold of me I'm almost always on Discord.
Re: New GUI root for temporary GUI elements
damn, good point..
in multiplayer, you can use on_player_joined_game, which also fires for the host, but currently i have no idea what to do in singleplayer... (except constantly recreating the guis)
edit: on savegame loading, the crafting gui appeared behind my custom frame, maybe this isnt such a big issue?
i personally don't have such a big problem with it since my screen elements are either conditionally created and destroyed (usually very soon) or use (hopefully) free space
I just read your new FFF where you used the wording
again, which made me concerned that the new way would only allow placing of elements *outside* of the game guis, but there are quite some free spots in the game guis (and definitively a lot of cases where the modder would want to place an element on top of the game guis)relative to the character GUI on the left side"
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
Re: New GUI root for temporary GUI elements
There will be no system for placing GUIs "on top of" game GUIs. that's an unsupported thing that if you do in a mod you get zero support for.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: New GUI root for temporary GUI elements
Just another hack on the long list of "not supported" things (i don't have a personal usecase for it yet though).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: New GUI root for temporary GUI elements
lol why?
thats the only thing the system would be useful for
i'm not even asking for any support, i just want to be able to shift my labels, buttons, etc to a position inside the gui^^ you can leave everything else to the modders
demo:
(equipment is a kinda tricky case where it's hard to calculate the position since you sometimes have mod texts (added by mod xyz) or item descriptions but otherwise it works perfectly)
it's done
https://mods.factorio.com/mod/assemblin ... _equipment
Only the first mod i'll be using the new feature in
thats the only thing the system would be useful for
i'm not even asking for any support, i just want to be able to shift my labels, buttons, etc to a position inside the gui^^ you can leave everything else to the modders
demo:
(equipment is a kinda tricky case where it's hard to calculate the position since you sometimes have mod texts (added by mod xyz) or item descriptions but otherwise it works perfectly)
Code: Select all
function equipment_text_position(player)
local x = player.display_resolution.width*0.5
local item_width = 404 * player.display_scale
local stats_width = 168+15
if player.opened.width >= 10 then
stats_width = stats_width + 7
end
if player.opened.height >= 10 then
stats_width = stats_width + 7
end
stats_width = stats_width * player.display_scale
local grid_width = 33*player.opened.width*player.display_scale
local equipment_width = math.max(304*player.display_scale, stats_width + grid_width)
if player.opened.prototype.name == "radiation-suit-grid" then
equipment_width = 402*player.display_scale
end
x=x+(item_width - equipment_width)/2
x=x+15*player.display_scale+grid_width
return {x , player.display_resolution.height*0.48}
end
https://mods.factorio.com/mod/assemblin ... _equipment
Only the first mod i'll be using the new feature in
- Attachments
-
- Screenshot_4.jpg (81.95 KiB) Viewed 3782 times
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance