{"action":"created","comment":{"url":"https://api.github.com/repos/Ormannishe/idle-game/pulls/comments/232396641","pull_request_review_id":173594756,"id":232396641,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjM5NjY0MQ==","diff_hunk":"@@ -2,22 +2,55 @@ var firstBeat = true;\n var firstSample = true;\n var newLaptop = false;\n \n+// A trigger function usually does a check\n+// and performs an action if said check is true\n+// It will return true if action happened and false otherwise\n+// Example\n+/*\n+function exampleTrigger() {\n+  if (some conditions) {\n+    trigger actions\n+    return true;\n+  }\n+  return false;\n+}\n+ */\n+\n+var triggerFnSet = new Set([firstBeatTrigger, firstSampleTrigger, newLaptopTrigger]);\n+\n function checkTriggers() {\n-\t// TODO: Figure out more scalable way to add trigger events...\n-\tif (game.player.beats == 1 && firstBeat) {\n+  triggerFnSet.forEach(function(triggerFn) {\n+    if (triggerFn()) {\n+      triggerFnSet.delete(triggerFn);\n+    }\n+  });\n+}\n+\n+function firstBeatTrigger() {\n+  if (game.player.beats == 1 && firstBeat) {","path":"scripts/triggers.js","position":31,"original_position":31,"commit_id":"664f9404b50f958a248ea7316044c43a31e43fd5","original_commit_id":"664f9404b50f958a248ea7316044c43a31e43fd5","user":{"login":"Ormannishe","id":6829670,"node_id":"MDQ6VXNlcjY4Mjk2NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/6829670?v=4","gravatar_id":"","url":"https://api.github.com/users/Ormannishe","html_url":"https://github.com/Ormannishe","followers_url":"https://api.github.com/users/Ormannishe/followers","following_url":"https://api.github.com/users/Ormannishe/following{/other_user}","gists_url":"https://api.github.com/users/Ormannishe/gists{/gist_id}","starred_url":"https://api.github.com/users/Ormannishe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ormannishe/subscriptions","organizations_url":"https://api.github.com/users/Ormannishe/orgs","repos_url":"https://api.github.com/users/Ormannishe/repos","events_url":"https://api.github.com/users/Ormannishe/events{/privacy}","received_events_url":"https://api.github.com/users/Ormannishe/received_events","type":"User","site_admin":false},"body":"Same applies to the firstSample var below","created_at":"2018-11-09T21:18:35Z","updated_at":"2018-11-09T21:18:35Z","html_url":"https://github.com/Ormannishe/idle-game/pull/1#discussion_r232396641","pull_request_url":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Ormannishe/idle-game/pulls/comments/232396641"},"html":{"href":"https://github.com/Ormannishe/idle-game/pull/1#discussion_r232396641"},"pull_request":{"href":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1"}},"in_reply_to_id":232396491},"pull_request":{"url":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1","id":229820710,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5ODIwNzEw","html_url":"https://github.com/Ormannishe/idle-game/pull/1","diff_url":"https://github.com/Ormannishe/idle-game/pull/1.diff","patch_url":"https://github.com/Ormannishe/idle-game/pull/1.patch","issue_url":"https://api.github.com/repos/Ormannishe/idle-game/issues/1","number":1,"state":"open","locked":false,"title":"Make trigger system scalable","user":{"login":"Arter","id":3247200,"node_id":"MDQ6VXNlcjMyNDcyMDA=","avatar_url":"https://avatars3.githubusercontent.com/u/3247200?v=4","gravatar_id":"","url":"https://api.github.com/users/Arter","html_url":"https://github.com/Arter","followers_url":"https://api.github.com/users/Arter/followers","following_url":"https://api.github.com/users/Arter/following{/other_user}","gists_url":"https://api.github.com/users/Arter/gists{/gist_id}","starred_url":"https://api.github.com/users/Arter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arter/subscriptions","organizations_url":"https://api.github.com/users/Arter/orgs","repos_url":"https://api.github.com/users/Arter/repos","events_url":"https://api.github.com/users/Arter/events{/privacy}","received_events_url":"https://api.github.com/users/Arter/received_events","type":"User","site_admin":false},"body":"Move each trigger into separate functions.\r\ncheckTriggers is now the central logic to adding/deleting and firing off triggers","created_at":"2018-11-09T21:12:54Z","updated_at":"2018-11-09T21:18:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"05047c3f068a5c7e7a45859386f37966b76f6b16","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Ormannishe/idle-game/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ormannishe/idle-game/issues/1/comments","statuses_url":"https://api.github.com/repos/Ormannishe/idle-game/statuses/664f9404b50f958a248ea7316044c43a31e43fd5","head":{"label":"Ormannishe:max/Make-trigger-system-scalable","ref":"max/Make-trigger-system-scalable","sha":"664f9404b50f958a248ea7316044c43a31e43fd5","user":{"login":"Ormannishe","id":6829670,"node_id":"MDQ6VXNlcjY4Mjk2NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/6829670?v=4","gravatar_id":"","url":"https://api.github.com/users/Ormannishe","html_url":"https://github.com/Ormannishe","followers_url":"https://api.github.com/users/Ormannishe/followers","following_url":"https://api.github.com/users/Ormannishe/following{/other_user}","gists_url":"https://api.github.com/users/Ormannishe/gists{/gist_id}","starred_url":"https://api.github.com/users/Ormannishe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ormannishe/subscriptions","organizations_url":"https://api.github.com/users/Ormannishe/orgs","repos_url":"https://api.github.com/users/Ormannishe/repos","events_url":"https://api.github.com/users/Ormannishe/events{/privacy}","received_events_url":"https://api.github.com/users/Ormannishe/received_events","type":"User","site_admin":false},"repo":{"id":156885677,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY4ODU2Nzc=","name":"idle-game","full_name":"Ormannishe/idle-game","private":false,"owner":{"login":"Ormannishe","id":6829670,"node_id":"MDQ6VXNlcjY4Mjk2NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/6829670?v=4","gravatar_id":"","url":"https://api.github.com/users/Ormannishe","html_url":"https://github.com/Ormannishe","followers_url":"https://api.github.com/users/Ormannishe/followers","following_url":"https://api.github.com/users/Ormannishe/following{/other_user}","gists_url":"https://api.github.com/users/Ormannishe/gists{/gist_id}","starred_url":"https://api.github.com/users/Ormannishe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ormannishe/subscriptions","organizations_url":"https://api.github.com/users/Ormannishe/orgs","repos_url":"https://api.github.com/users/Ormannishe/repos","events_url":"https://api.github.com/users/Ormannishe/events{/privacy}","received_events_url":"https://api.github.com/users/Ormannishe/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ormannishe/idle-game","description":null,"fork":false,"url":"https://api.github.com/repos/Ormannishe/idle-game","forks_url":"https://api.github.com/repos/Ormannishe/idle-game/forks","keys_url":"https://api.github.com/repos/Ormannishe/idle-game/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ormannishe/idle-game/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ormannishe/idle-game/teams","hooks_url":"https://api.github.com/repos/Ormannishe/idle-game/hooks","issue_events_url":"https://api.github.com/repos/Ormannishe/idle-game/issues/events{/number}","events_url":"https://api.github.com/repos/Ormannishe/idle-game/events","assignees_url":"https://api.github.com/repos/Ormannishe/idle-game/assignees{/user}","branches_url":"https://api.github.com/repos/Ormannishe/idle-game/branches{/branch}","tags_url":"https://api.github.com/repos/Ormannishe/idle-game/tags","blobs_url":"https://api.github.com/repos/Ormannishe/idle-game/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ormannishe/idle-game/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ormannishe/idle-game/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ormannishe/idle-game/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ormannishe/idle-game/statuses/{sha}","languages_url":"https://api.github.com/repos/Ormannishe/idle-game/languages","stargazers_url":"https://api.github.com/repos/Ormannishe/idle-game/stargazers","contributors_url":"https://api.github.com/repos/Ormannishe/idle-game/contributors","subscribers_url":"https://api.github.com/repos/Ormannishe/idle-game/subscribers","subscription_url":"https://api.github.com/repos/Ormannishe/idle-game/subscription","commits_url":"https://api.github.com/repos/Ormannishe/idle-game/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ormannishe/idle-game/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ormannishe/idle-game/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ormannishe/idle-game/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ormannishe/idle-game/contents/{+path}","compare_url":"https://api.github.com/repos/Ormannishe/idle-game/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ormannishe/idle-game/merges","archive_url":"https://api.github.com/repos/Ormannishe/idle-game/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ormannishe/idle-game/downloads","issues_url":"https://api.github.com/repos/Ormannishe/idle-game/issues{/number}","pulls_url":"https://api.github.com/repos/Ormannishe/idle-game/pulls{/number}","milestones_url":"https://api.github.com/repos/Ormannishe/idle-game/milestones{/number}","notifications_url":"https://api.github.com/repos/Ormannishe/idle-game/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ormannishe/idle-game/labels{/name}","releases_url":"https://api.github.com/repos/Ormannishe/idle-game/releases{/id}","deployments_url":"https://api.github.com/repos/Ormannishe/idle-game/deployments","created_at":"2018-11-09T16:04:26Z","updated_at":"2018-11-09T20:30:12Z","pushed_at":"2018-11-09T21:12:55Z","git_url":"git://github.com/Ormannishe/idle-game.git","ssh_url":"git@github.com:Ormannishe/idle-game.git","clone_url":"https://github.com/Ormannishe/idle-game.git","svn_url":"https://github.com/Ormannishe/idle-game","homepage":null,"size":1234,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Ormannishe:master","ref":"master","sha":"a85be34e5968538b358fd963881f96cffbd709f4","user":{"login":"Ormannishe","id":6829670,"node_id":"MDQ6VXNlcjY4Mjk2NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/6829670?v=4","gravatar_id":"","url":"https://api.github.com/users/Ormannishe","html_url":"https://github.com/Ormannishe","followers_url":"https://api.github.com/users/Ormannishe/followers","following_url":"https://api.github.com/users/Ormannishe/following{/other_user}","gists_url":"https://api.github.com/users/Ormannishe/gists{/gist_id}","starred_url":"https://api.github.com/users/Ormannishe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ormannishe/subscriptions","organizations_url":"https://api.github.com/users/Ormannishe/orgs","repos_url":"https://api.github.com/users/Ormannishe/repos","events_url":"https://api.github.com/users/Ormannishe/events{/privacy}","received_events_url":"https://api.github.com/users/Ormannishe/received_events","type":"User","site_admin":false},"repo":{"id":156885677,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY4ODU2Nzc=","name":"idle-game","full_name":"Ormannishe/idle-game","private":false,"owner":{"login":"Ormannishe","id":6829670,"node_id":"MDQ6VXNlcjY4Mjk2NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/6829670?v=4","gravatar_id":"","url":"https://api.github.com/users/Ormannishe","html_url":"https://github.com/Ormannishe","followers_url":"https://api.github.com/users/Ormannishe/followers","following_url":"https://api.github.com/users/Ormannishe/following{/other_user}","gists_url":"https://api.github.com/users/Ormannishe/gists{/gist_id}","starred_url":"https://api.github.com/users/Ormannishe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ormannishe/subscriptions","organizations_url":"https://api.github.com/users/Ormannishe/orgs","repos_url":"https://api.github.com/users/Ormannishe/repos","events_url":"https://api.github.com/users/Ormannishe/events{/privacy}","received_events_url":"https://api.github.com/users/Ormannishe/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ormannishe/idle-game","description":null,"fork":false,"url":"https://api.github.com/repos/Ormannishe/idle-game","forks_url":"https://api.github.com/repos/Ormannishe/idle-game/forks","keys_url":"https://api.github.com/repos/Ormannishe/idle-game/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ormannishe/idle-game/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ormannishe/idle-game/teams","hooks_url":"https://api.github.com/repos/Ormannishe/idle-game/hooks","issue_events_url":"https://api.github.com/repos/Ormannishe/idle-game/issues/events{/number}","events_url":"https://api.github.com/repos/Ormannishe/idle-game/events","assignees_url":"https://api.github.com/repos/Ormannishe/idle-game/assignees{/user}","branches_url":"https://api.github.com/repos/Ormannishe/idle-game/branches{/branch}","tags_url":"https://api.github.com/repos/Ormannishe/idle-game/tags","blobs_url":"https://api.github.com/repos/Ormannishe/idle-game/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ormannishe/idle-game/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ormannishe/idle-game/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ormannishe/idle-game/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ormannishe/idle-game/statuses/{sha}","languages_url":"https://api.github.com/repos/Ormannishe/idle-game/languages","stargazers_url":"https://api.github.com/repos/Ormannishe/idle-game/stargazers","contributors_url":"https://api.github.com/repos/Ormannishe/idle-game/contributors","subscribers_url":"https://api.github.com/repos/Ormannishe/idle-game/subscribers","subscription_url":"https://api.github.com/repos/Ormannishe/idle-game/subscription","commits_url":"https://api.github.com/repos/Ormannishe/idle-game/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ormannishe/idle-game/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ormannishe/idle-game/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ormannishe/idle-game/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ormannishe/idle-game/contents/{+path}","compare_url":"https://api.github.com/repos/Ormannishe/idle-game/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ormannishe/idle-game/merges","archive_url":"https://api.github.com/repos/Ormannishe/idle-game/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ormannishe/idle-game/downloads","issues_url":"https://api.github.com/repos/Ormannishe/idle-game/issues{/number}","pulls_url":"https://api.github.com/repos/Ormannishe/idle-game/pulls{/number}","milestones_url":"https://api.github.com/repos/Ormannishe/idle-game/milestones{/number}","notifications_url":"https://api.github.com/repos/Ormannishe/idle-game/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ormannishe/idle-game/labels{/name}","releases_url":"https://api.github.com/repos/Ormannishe/idle-game/releases{/id}","deployments_url":"https://api.github.com/repos/Ormannishe/idle-game/deployments","created_at":"2018-11-09T16:04:26Z","updated_at":"2018-11-09T20:30:12Z","pushed_at":"2018-11-09T21:12:55Z","git_url":"git://github.com/Ormannishe/idle-game.git","ssh_url":"git@github.com:Ormannishe/idle-game.git","clone_url":"https://github.com/Ormannishe/idle-game.git","svn_url":"https://github.com/Ormannishe/idle-game","homepage":null,"size":1234,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1"},"html":{"href":"https://github.com/Ormannishe/idle-game/pull/1"},"issue":{"href":"https://api.github.com/repos/Ormannishe/idle-game/issues/1"},"comments":{"href":"https://api.github.com/repos/Ormannishe/idle-game/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Ormannishe/idle-game/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ormannishe/idle-game/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Ormannishe/idle-game/statuses/664f9404b50f958a248ea7316044c43a31e43fd5"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Ormannishe"}}