-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interface to show/hide gui. Returns previous state #20
Conversation
Okay, I like it, but two things come to mind:
Neither of these are blockers -- I'm okay with the patch as it is -- but I think I'd prefer if you matched the existing interface call, e.g.: function interface.close_expando(player_name_or_index)
local player = game.get_player(player_name_or_index)
if global.player_data[player.index].expandoed then
-- ...stuff... I know, it feels wasteful to do a Alternatively, have it take a player object directly, as in |
Didn't know that hiding doesn't work on low fields. I just got annoyed at the FARL GUI being in the middle of the screen while testing FARL (meaning jumping in and out of it a lot). I'll go with matching the existing interface, player_index is really the only thing that's needed i guess. game.get_player might be wasteful, but it's gui code so that's ok for me. I'll add support for hiding YARM into my other mods too and probably to FAT Controller also (though in my current save it always opens at the leftmost side). |
Remote interface to toggle the expando. Returns previous state
Looks good to me, thank you. |
I think this will need a change: if more than 1 other mod attempts to hide YARM you can run into a issue. Imagine YARM is maximized, no other mod gui is opened:
A solution might be:
This should fix the (theoretical) problem (I don't think there are any mods out there that make use of the new api yet) |
It's gonna be fragile pretty much regardless of how you do it -- the biggest problem being that you're relying on the mods to always call "unhide YARM" when they're done. How about we don't do any refcounting shenanigans and just rely on the player to unhide YARM whenever they feel like it? Another mod can request YARM to go into a specific state, but there's no compulsion to return it to the previous state -- something that the player might mess with regardless. |
This allows other mods that add a (temporary) gui on the left to minimize YARM when their gui gets shown, when it gets closed they can restore YARMs previous state.
http://i.imgur.com/6sDjIOk.gif
Really only saves the player a few clicks, but i find it quite convenient.