{"action":"created","issue":{"url":"https://api.github.com/repos/factoriommo/factoriommoscenarios/issues/22","repository_url":"https://api.github.com/repos/factoriommo/factoriommoscenarios","labels_url":"https://api.github.com/repos/factoriommo/factoriommoscenarios/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/factoriommo/factoriommoscenarios/issues/22/comments","events_url":"https://api.github.com/repos/factoriommo/factoriommoscenarios/issues/22/events","html_url":"https://github.com/factoriommo/factoriommoscenarios/issues/22","id":299387564,"number":22,"title":"top_gui design idea: promote() and demote() methods","user":{"login":"Brickcaster","id":13324089,"avatar_url":"https://avatars1.githubusercontent.com/u/13324089?v=4","gravatar_id":"","url":"https://api.github.com/users/Brickcaster","html_url":"https://github.com/Brickcaster","followers_url":"https://api.github.com/users/Brickcaster/followers","following_url":"https://api.github.com/users/Brickcaster/following{/other_user}","gists_url":"https://api.github.com/users/Brickcaster/gists{/gist_id}","starred_url":"https://api.github.com/users/Brickcaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Brickcaster/subscriptions","organizations_url":"https://api.github.com/users/Brickcaster/orgs","repos_url":"https://api.github.com/users/Brickcaster/repos","events_url":"https://api.github.com/users/Brickcaster/events{/privacy}","received_events_url":"https://api.github.com/users/Brickcaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-22T15:04:52Z","updated_at":"2018-02-22T15:43:18Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Instead of using a top_gui method to create elements, add a promote() and demote() method which deepcopies gui elements and then recreates the entire gui from the read data.  This design style would be more modular and would not require other modules to use it's specific methods when adding to the gui. \r\n The method for deep copy is a Factorio utility script so it should be easy to utilize.\r\n\r\nAdditionally, you could add a \"insert_at_index\" method for modules which are aware of your top_gui script so they can take the most recently added item (The one at the end of the list) and move it to the specified index."},"comment":{"url":"https://api.github.com/repos/factoriommo/factoriommoscenarios/issues/comments/367721794","html_url":"https://github.com/factoriommo/factoriommoscenarios/issues/22#issuecomment-367721794","issue_url":"https://api.github.com/repos/factoriommo/factoriommoscenarios/issues/22","id":367721794,"user":{"login":"Brickcaster","id":13324089,"avatar_url":"https://avatars1.githubusercontent.com/u/13324089?v=4","gravatar_id":"","url":"https://api.github.com/users/Brickcaster","html_url":"https://github.com/Brickcaster","followers_url":"https://api.github.com/users/Brickcaster/followers","following_url":"https://api.github.com/users/Brickcaster/following{/other_user}","gists_url":"https://api.github.com/users/Brickcaster/gists{/gist_id}","starred_url":"https://api.github.com/users/Brickcaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Brickcaster/subscriptions","organizations_url":"https://api.github.com/users/Brickcaster/orgs","repos_url":"https://api.github.com/users/Brickcaster/repos","events_url":"https://api.github.com/users/Brickcaster/events{/privacy}","received_events_url":"https://api.github.com/users/Brickcaster/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T15:43:18Z","updated_at":"2018-02-22T15:43:18Z","author_association":"CONTRIBUTOR","body":"An example would be the Player List module I use. Rather than redesigning Player List to utilize the top_gui creation method, I could register an event on_player_created (after the player list event) to do top_gui.promote(\"player_list_button\") to move it up one step.\r\n\r\nLikewise, if anything were to add buttons later in the game, like say a rockets launched gui that only appears after rockets have been launched, then an event listener could be added for that as well such that it can be moved to the desired position.\r\n\r\nThis makes it easier to add additional modules and keep them up to date as the management becomes something external to the module and not an internal part that must be modified when updating."}}
{"actor":{"display_login":"Brickcaster"}}