{"action":"created","comment":{"url":"https://api.github.com/repos/Baystation12/Baystation12/pulls/comments/31006267","id":31006267,"diff_hunk":"@@ -5,17 +30,98 @@\n \tvar/list/required_reagents = list()\r\n \tvar/list/catalysts = list()\r\n \tvar/list/inhibitors = list()\r\n-\r\n \tvar/result_amount = 0\r\n+\r\n+\tvar/reaction_rate = REACTION_RATE(100)\t//how far the reaction proceeds each time it is processed\r\n+\tvar/min_reaction = 5\t\t\t\t\t//the min amount to react, in units\r\n+\tvar/yield = 1.0\t\t\t\t\t\t\t//if less than 1, the reaction will be inhibited if the ratio of products/reagents is too high\r\n+\r\n \tvar/mix_message = \"The solution begins to bubble.\"\r\n+\tvar/reaction_sound = 'sound/effects/bubbles.ogg'\r\n \r\n /datum/chemical_reaction/proc/can_happen(var/datum/reagents/holder)\r\n+\t//check that all the required reagents are present\r\n+\tfor(var/reagent in required_reagents)\r\n+\t\tif(!holder.has_reagent(reagent))\r\n+\t\t\treturn 0\r\n+\r\n+\t//check that all the required catalysts are present in the required amount\r\n+\tfor(var/reagent in catalysts)\r\n+\t\tvar/min_req_amt = catalysts[reagent]\r\n+\t\tif(!holder.has_reagent(reagent, min_req_amt))\r\n+\t\t\treturn 0\r\n+\r\n+\t//check that none of the inhibitors are present in the required amount\r\n+\tfor(var/reagent in inhibitors)\r","path":"code/modules/reagents/Chemistry-Recipes.dm","position":56,"original_position":56,"commit_id":"d29b928e0a0a6a2f184ab72725cdc7975a8865ad","original_commit_id":"d29b928e0a0a6a2f184ab72725cdc7975a8865ad","user":{"login":"comma","id":1300258,"avatar_url":"https://avatars.githubusercontent.com/u/1300258?v=3","gravatar_id":"","url":"https://api.github.com/users/comma","html_url":"https://github.com/comma","followers_url":"https://api.github.com/users/comma/followers","following_url":"https://api.github.com/users/comma/following{/other_user}","gists_url":"https://api.github.com/users/comma/gists{/gist_id}","starred_url":"https://api.github.com/users/comma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/comma/subscriptions","organizations_url":"https://api.github.com/users/comma/orgs","repos_url":"https://api.github.com/users/comma/repos","events_url":"https://api.github.com/users/comma/events{/privacy}","received_events_url":"https://api.github.com/users/comma/received_events","type":"User","site_admin":false},"body":"This loop might actually be faster other way around, since has_reagent loops over all reagents and compares their ids to argument.\r\n```\r\n\tfor(var/datum/reagent/current in reagent_list)\r\n\t\tif(current.id in inhbitors)\r\n\t\t\treturn 0\r\n```\r\nsame could be done for previous two, but it;s going to be pain in the ass for required reagent check (though arguably the one that needs this the most since more times has_reagent full loop is done).","created_at":"2015-05-26T06:02:08Z","updated_at":"2015-05-26T06:02:08Z","html_url":"https://github.com/Baystation12/Baystation12/pull/9417#discussion_r31006267","pull_request_url":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417","_links":{"self":{"href":"https://api.github.com/repos/Baystation12/Baystation12/pulls/comments/31006267"},"html":{"href":"https://github.com/Baystation12/Baystation12/pull/9417#discussion_r31006267"},"pull_request":{"href":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417"}}},"pull_request":{"url":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417","id":35999095,"html_url":"https://github.com/Baystation12/Baystation12/pull/9417","diff_url":"https://github.com/Baystation12/Baystation12/pull/9417.diff","patch_url":"https://github.com/Baystation12/Baystation12/pull/9417.patch","issue_url":"https://api.github.com/repos/Baystation12/Baystation12/issues/9417","number":9417,"state":"open","locked":false,"title":"[DNM] Chemistry reaction cleanup, Implements reaction-over-time and yield","user":{"login":"mwerezak","id":242428,"avatar_url":"https://avatars.githubusercontent.com/u/242428?v=3","gravatar_id":"","url":"https://api.github.com/users/mwerezak","html_url":"https://github.com/mwerezak","followers_url":"https://api.github.com/users/mwerezak/followers","following_url":"https://api.github.com/users/mwerezak/following{/other_user}","gists_url":"https://api.github.com/users/mwerezak/gists{/gist_id}","starred_url":"https://api.github.com/users/mwerezak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwerezak/subscriptions","organizations_url":"https://api.github.com/users/mwerezak/orgs","repos_url":"https://api.github.com/users/mwerezak/repos","events_url":"https://api.github.com/users/mwerezak/events{/privacy}","received_events_url":"https://api.github.com/users/mwerezak/received_events","type":"User","site_admin":false},"body":"* Reorganizes handle_reactions() in preparation for implementing reactions-over-time.\r\n* Moves chemistry initializations into global_init.\r\n\r\nPlanned things to do:\r\n- [x] Implement basic reaction-over-time.\r\n- [x] Move reaction handling into a scheduled process.\r\n- [x] Ensure chemical grenades work.\r\n- [ ] Test stuff.","created_at":"2015-05-22T04:08:23Z","updated_at":"2015-05-26T06:02:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32279f5a2c20c2d64c62533c1f80b86dd716e31a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417/commits","review_comments_url":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417/comments","review_comment_url":"https://api.github.com/repos/Baystation12/Baystation12/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Baystation12/Baystation12/issues/9417/comments","statuses_url":"https://api.github.com/repos/Baystation12/Baystation12/statuses/d29b928e0a0a6a2f184ab72725cdc7975a8865ad","head":{"label":"mwerezak:chem-kinetics","ref":"chem-kinetics","sha":"d29b928e0a0a6a2f184ab72725cdc7975a8865ad","user":{"login":"mwerezak","id":242428,"avatar_url":"https://avatars.githubusercontent.com/u/242428?v=3","gravatar_id":"","url":"https://api.github.com/users/mwerezak","html_url":"https://github.com/mwerezak","followers_url":"https://api.github.com/users/mwerezak/followers","following_url":"https://api.github.com/users/mwerezak/following{/other_user}","gists_url":"https://api.github.com/users/mwerezak/gists{/gist_id}","starred_url":"https://api.github.com/users/mwerezak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwerezak/subscriptions","organizations_url":"https://api.github.com/users/mwerezak/orgs","repos_url":"https://api.github.com/users/mwerezak/repos","events_url":"https://api.github.com/users/mwerezak/events{/privacy}","received_events_url":"https://api.github.com/users/mwerezak/received_events","type":"User","site_admin":false},"repo":{"id":18691192,"name":"Baystation12","full_name":"mwerezak/Baystation12","owner":{"login":"mwerezak","id":242428,"avatar_url":"https://avatars.githubusercontent.com/u/242428?v=3","gravatar_id":"","url":"https://api.github.com/users/mwerezak","html_url":"https://github.com/mwerezak","followers_url":"https://api.github.com/users/mwerezak/followers","following_url":"https://api.github.com/users/mwerezak/following{/other_user}","gists_url":"https://api.github.com/users/mwerezak/gists{/gist_id}","starred_url":"https://api.github.com/users/mwerezak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwerezak/subscriptions","organizations_url":"https://api.github.com/users/mwerezak/orgs","repos_url":"https://api.github.com/users/mwerezak/repos","events_url":"https://api.github.com/users/mwerezak/events{/privacy}","received_events_url":"https://api.github.com/users/mwerezak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mwerezak/Baystation12","description":"The code for Baystation12's branch of SS13. Developers: please don't forget to update the changelog. Thanks!","fork":true,"url":"https://api.github.com/repos/mwerezak/Baystation12","forks_url":"https://api.github.com/repos/mwerezak/Baystation12/forks","keys_url":"https://api.github.com/repos/mwerezak/Baystation12/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mwerezak/Baystation12/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mwerezak/Baystation12/teams","hooks_url":"https://api.github.com/repos/mwerezak/Baystation12/hooks","issue_events_url":"https://api.github.com/repos/mwerezak/Baystation12/issues/events{/number}","events_url":"https://api.github.com/repos/mwerezak/Baystation12/events","assignees_url":"https://api.github.com/repos/mwerezak/Baystation12/assignees{/user}","branches_url":"https://api.github.com/repos/mwerezak/Baystation12/branches{/branch}","tags_url":"https://api.github.com/repos/mwerezak/Baystation12/tags","blobs_url":"https://api.github.com/repos/mwerezak/Baystation12/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mwerezak/Baystation12/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mwerezak/Baystation12/git/refs{/sha}","trees_url":"https://api.github.com/repos/mwerezak/Baystation12/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mwerezak/Baystation12/statuses/{sha}","languages_url":"https://api.github.com/repos/mwerezak/Baystation12/languages","stargazers_url":"https://api.github.com/repos/mwerezak/Baystation12/stargazers","contributors_url":"https://api.github.com/repos/mwerezak/Baystation12/contributors","subscribers_url":"https://api.github.com/repos/mwerezak/Baystation12/subscribers","subscription_url":"https://api.github.com/repos/mwerezak/Baystation12/subscription","commits_url":"https://api.github.com/repos/mwerezak/Baystation12/commits{/sha}","git_commits_url":"https://api.github.com/repos/mwerezak/Baystation12/git/commits{/sha}","comments_url":"https://api.github.com/repos/mwerezak/Baystation12/comments{/number}","issue_comment_url":"https://api.github.com/repos/mwerezak/Baystation12/issues/comments{/number}","contents_url":"https://api.github.com/repos/mwerezak/Baystation12/contents/{+path}","compare_url":"https://api.github.com/repos/mwerezak/Baystation12/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mwerezak/Baystation12/merges","archive_url":"https://api.github.com/repos/mwerezak/Baystation12/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mwerezak/Baystation12/downloads","issues_url":"https://api.github.com/repos/mwerezak/Baystation12/issues{/number}","pulls_url":"https://api.github.com/repos/mwerezak/Baystation12/pulls{/number}","milestones_url":"https://api.github.com/repos/mwerezak/Baystation12/milestones{/number}","notifications_url":"https://api.github.com/repos/mwerezak/Baystation12/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mwerezak/Baystation12/labels{/name}","releases_url":"https://api.github.com/repos/mwerezak/Baystation12/releases{/id}","created_at":"2014-04-11T23:01:36Z","updated_at":"2015-02-14T18:42:16Z","pushed_at":"2015-05-25T04:05:31Z","git_url":"git://github.com/mwerezak/Baystation12.git","ssh_url":"git@github.com:mwerezak/Baystation12.git","clone_url":"https://github.com/mwerezak/Baystation12.git","svn_url":"https://github.com/mwerezak/Baystation12","homepage":"http://baystation12.net/","size":785894,"stargazers_count":0,"watchers_count":0,"language":"DM","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Baystation12:dev","ref":"dev","sha":"be2480330997b5dba8d45abec11a7614ff6ed44c","user":{"login":"Baystation12","id":1174322,"avatar_url":"https://avatars.githubusercontent.com/u/1174322?v=3","gravatar_id":"","url":"https://api.github.com/users/Baystation12","html_url":"https://github.com/Baystation12","followers_url":"https://api.github.com/users/Baystation12/followers","following_url":"https://api.github.com/users/Baystation12/following{/other_user}","gists_url":"https://api.github.com/users/Baystation12/gists{/gist_id}","starred_url":"https://api.github.com/users/Baystation12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Baystation12/subscriptions","organizations_url":"https://api.github.com/users/Baystation12/orgs","repos_url":"https://api.github.com/users/Baystation12/repos","events_url":"https://api.github.com/users/Baystation12/events{/privacy}","received_events_url":"https://api.github.com/users/Baystation12/received_events","type":"Organization","site_admin":false},"repo":{"id":2715933,"name":"Baystation12","full_name":"Baystation12/Baystation12","owner":{"login":"Baystation12","id":1174322,"avatar_url":"https://avatars.githubusercontent.com/u/1174322?v=3","gravatar_id":"","url":"https://api.github.com/users/Baystation12","html_url":"https://github.com/Baystation12","followers_url":"https://api.github.com/users/Baystation12/followers","following_url":"https://api.github.com/users/Baystation12/following{/other_user}","gists_url":"https://api.github.com/users/Baystation12/gists{/gist_id}","starred_url":"https://api.github.com/users/Baystation12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Baystation12/subscriptions","organizations_url":"https://api.github.com/users/Baystation12/orgs","repos_url":"https://api.github.com/users/Baystation12/repos","events_url":"https://api.github.com/users/Baystation12/events{/privacy}","received_events_url":"https://api.github.com/users/Baystation12/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Baystation12/Baystation12","description":"The code for Baystation12's branch of SS13","fork":false,"url":"https://api.github.com/repos/Baystation12/Baystation12","forks_url":"https://api.github.com/repos/Baystation12/Baystation12/forks","keys_url":"https://api.github.com/repos/Baystation12/Baystation12/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Baystation12/Baystation12/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Baystation12/Baystation12/teams","hooks_url":"https://api.github.com/repos/Baystation12/Baystation12/hooks","issue_events_url":"https://api.github.com/repos/Baystation12/Baystation12/issues/events{/number}","events_url":"https://api.github.com/repos/Baystation12/Baystation12/events","assignees_url":"https://api.github.com/repos/Baystation12/Baystation12/assignees{/user}","branches_url":"https://api.github.com/repos/Baystation12/Baystation12/branches{/branch}","tags_url":"https://api.github.com/repos/Baystation12/Baystation12/tags","blobs_url":"https://api.github.com/repos/Baystation12/Baystation12/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Baystation12/Baystation12/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Baystation12/Baystation12/git/refs{/sha}","trees_url":"https://api.github.com/repos/Baystation12/Baystation12/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Baystation12/Baystation12/statuses/{sha}","languages_url":"https://api.github.com/repos/Baystation12/Baystation12/languages","stargazers_url":"https://api.github.com/repos/Baystation12/Baystation12/stargazers","contributors_url":"https://api.github.com/repos/Baystation12/Baystation12/contributors","subscribers_url":"https://api.github.com/repos/Baystation12/Baystation12/subscribers","subscription_url":"https://api.github.com/repos/Baystation12/Baystation12/subscription","commits_url":"https://api.github.com/repos/Baystation12/Baystation12/commits{/sha}","git_commits_url":"https://api.github.com/repos/Baystation12/Baystation12/git/commits{/sha}","comments_url":"https://api.github.com/repos/Baystation12/Baystation12/comments{/number}","issue_comment_url":"https://api.github.com/repos/Baystation12/Baystation12/issues/comments{/number}","contents_url":"https://api.github.com/repos/Baystation12/Baystation12/contents/{+path}","compare_url":"https://api.github.com/repos/Baystation12/Baystation12/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Baystation12/Baystation12/merges","archive_url":"https://api.github.com/repos/Baystation12/Baystation12/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Baystation12/Baystation12/downloads","issues_url":"https://api.github.com/repos/Baystation12/Baystation12/issues{/number}","pulls_url":"https://api.github.com/repos/Baystation12/Baystation12/pulls{/number}","milestones_url":"https://api.github.com/repos/Baystation12/Baystation12/milestones{/number}","notifications_url":"https://api.github.com/repos/Baystation12/Baystation12/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Baystation12/Baystation12/labels{/name}","releases_url":"https://api.github.com/repos/Baystation12/Baystation12/releases{/id}","created_at":"2011-11-05T16:12:41Z","updated_at":"2015-05-25T22:12:03Z","pushed_at":"2015-05-26T05:50:24Z","git_url":"git://github.com/Baystation12/Baystation12.git","ssh_url":"git@github.com:Baystation12/Baystation12.git","clone_url":"https://github.com/Baystation12/Baystation12.git","svn_url":"https://github.com/Baystation12/Baystation12","homepage":"http://baystation12.net/","size":1458743,"stargazers_count":191,"watchers_count":191,"language":"DM","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":745,"mirror_url":null,"open_issues_count":261,"forks":745,"open_issues":261,"watchers":191,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417"},"html":{"href":"https://github.com/Baystation12/Baystation12/pull/9417"},"issue":{"href":"https://api.github.com/repos/Baystation12/Baystation12/issues/9417"},"comments":{"href":"https://api.github.com/repos/Baystation12/Baystation12/issues/9417/comments"},"review_comments":{"href":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417/comments"},"review_comment":{"href":"https://api.github.com/repos/Baystation12/Baystation12/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Baystation12/Baystation12/pulls/9417/commits"},"statuses":{"href":"https://api.github.com/repos/Baystation12/Baystation12/statuses/d29b928e0a0a6a2f184ab72725cdc7975a8865ad"}}}}