{"action":"opened","number":26679,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/26679","id":230686652,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNjg2NjUy","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/26679","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/26679.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/26679.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/26679","number":26679,"state":"open","locked":false,"title":"[WIP] Allow constructions to spawn byproduct items","user":{"login":"ralreegorganon","id":11464,"node_id":"MDQ6VXNlcjExNDY0","avatar_url":"https://avatars1.githubusercontent.com/u/11464?v=4","gravatar_id":"","url":"https://api.github.com/users/ralreegorganon","html_url":"https://github.com/ralreegorganon","followers_url":"https://api.github.com/users/ralreegorganon/followers","following_url":"https://api.github.com/users/ralreegorganon/following{/other_user}","gists_url":"https://api.github.com/users/ralreegorganon/gists{/gist_id}","starred_url":"https://api.github.com/users/ralreegorganon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralreegorganon/subscriptions","organizations_url":"https://api.github.com/users/ralreegorganon/orgs","repos_url":"https://api.github.com/users/ralreegorganon/repos","events_url":"https://api.github.com/users/ralreegorganon/events{/privacy}","received_events_url":"https://api.github.com/users/ralreegorganon/received_events","type":"User","site_admin":false},"body":"**this is WIP so I can do some more testing**\r\n\r\n#### Summary\r\nSUMMARY: Features \"Allow constructions to spawn byproduct items\"\r\n\r\n#### Purpose of change\r\nThis update allows constructions to specify in json any byproduct items that should be spawned as part of the construction. This functionality previously required C++ methods to be written and referenced in the `post_special` entry, but now can be done directly via json. \r\n\r\n#### Describe the solution\r\nAdds a new `byproducts` entry in the json which allows specification of an item group in the conventional manner. The items are spawned upon successful completion of the construction.\r\n\r\nThe existing clay and sand extraction constructions were updated to use this approach rather than the hardcoded values in the `done_extract_sand` and `done_extract_clay` C++ methods. The two `done_extract` methods were condensed into a `done_extract_maybe_revert_to_dirt` which retains the behavior of a chance for the terrain to revert to dirt after extraction, but drops the item spawning which is now handled by the byproducts.\r\n\r\n#### Additional context\r\nUpdated clay and sand extraction json is as follows:\r\n```json\r\n[\r\n  {\r\n    \"type\": \"construction\",\r\n    \"description\": \"Extract Sand\",\r\n    \"category\": \"OTHER\",\r\n    \"required_skills\": [ [ \"survival\", 0 ] ],\r\n    \"time\": 30,\r\n    \"qualities\": [ [ { \"id\": \"DIG\", \"level\": 1 } ] ],\r\n    \"byproducts\": { \"items\": [ { \"item\": \"material_sand\", \"charges\": [ 300, 600 ] } ] },\r\n    \"pre_terrain\": \"t_sand\",\r\n    \"post_special\": \"done_extract_maybe_revert_to_dirt\"\r\n  },\r\n  {\r\n    \"type\": \"construction\",\r\n    \"description\": \"Extract Clay\",\r\n    \"category\": \"OTHER\",\r\n    \"required_skills\": [ [ \"survival\", 0 ] ],\r\n    \"time\": 30,\r\n    \"qualities\": [ [ { \"id\": \"DIG\", \"level\": 1 } ] ],\r\n    \"byproducts\": { \"items\": [ { \"item\": \"clay_lump\", \"count\": [ 6, 12 ] } ] },\r\n    \"pre_terrain\": \"t_clay\",\r\n    \"post_special\": \"done_extract_maybe_revert_to_dirt\"\r\n  }\r\n]\r\n```\r\n\r\nCredit to #24110 for the basic approach.","created_at":"2018-11-14T02:05:14Z","updated_at":"2018-11-14T02:05:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/26679/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/26679/comments","review_comment_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/26679/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/6a1706235a4c9f24132e628964be9f2a4725bad0","head":{"label":"ralreegorganon:construction-byproducts","ref":"construction-byproducts","sha":"6a1706235a4c9f24132e628964be9f2a4725bad0","user":{"login":"ralreegorganon","id":11464,"node_id":"MDQ6VXNlcjExNDY0","avatar_url":"https://avatars1.githubusercontent.com/u/11464?v=4","gravatar_id":"","url":"https://api.github.com/users/ralreegorganon","html_url":"https://github.com/ralreegorganon","followers_url":"https://api.github.com/users/ralreegorganon/followers","following_url":"https://api.github.com/users/ralreegorganon/following{/other_user}","gists_url":"https://api.github.com/users/ralreegorganon/gists{/gist_id}","starred_url":"https://api.github.com/users/ralreegorganon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralreegorganon/subscriptions","organizations_url":"https://api.github.com/users/ralreegorganon/orgs","repos_url":"https://api.github.com/users/ralreegorganon/repos","events_url":"https://api.github.com/users/ralreegorganon/events{/privacy}","received_events_url":"https://api.github.com/users/ralreegorganon/received_events","type":"User","site_admin":false},"repo":{"id":127326662,"node_id":"MDEwOlJlcG9zaXRvcnkxMjczMjY2NjI=","name":"Cataclysm-DDA","full_name":"ralreegorganon/Cataclysm-DDA","private":false,"owner":{"login":"ralreegorganon","id":11464,"node_id":"MDQ6VXNlcjExNDY0","avatar_url":"https://avatars1.githubusercontent.com/u/11464?v=4","gravatar_id":"","url":"https://api.github.com/users/ralreegorganon","html_url":"https://github.com/ralreegorganon","followers_url":"https://api.github.com/users/ralreegorganon/followers","following_url":"https://api.github.com/users/ralreegorganon/following{/other_user}","gists_url":"https://api.github.com/users/ralreegorganon/gists{/gist_id}","starred_url":"https://api.github.com/users/ralreegorganon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralreegorganon/subscriptions","organizations_url":"https://api.github.com/users/ralreegorganon/orgs","repos_url":"https://api.github.com/users/ralreegorganon/repos","events_url":"https://api.github.com/users/ralreegorganon/events{/privacy}","received_events_url":"https://api.github.com/users/ralreegorganon/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ralreegorganon/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.","fork":true,"url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA","forks_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/releases{/id}","deployments_url":"https://api.github.com/repos/ralreegorganon/Cataclysm-DDA/deployments","created_at":"2018-03-29T17:43:30Z","updated_at":"2018-10-26T05:34:57Z","pushed_at":"2018-11-14T01:46:45Z","git_url":"git://github.com/ralreegorganon/Cataclysm-DDA.git","ssh_url":"git@github.com:ralreegorganon/Cataclysm-DDA.git","clone_url":"https://github.com/ralreegorganon/Cataclysm-DDA.git","svn_url":"https://github.com/ralreegorganon/Cataclysm-DDA","homepage":"http://cataclysmdda.org","size":1386525,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"CleverRaven:master","ref":"master","sha":"d84de378abe2bfd5a9f49d3eceeffbd3a43ecf0c","user":{"login":"CleverRaven","id":4367009,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzNjcwMDk=","avatar_url":"https://avatars0.githubusercontent.com/u/4367009?v=4","gravatar_id":"","url":"https://api.github.com/users/CleverRaven","html_url":"https://github.com/CleverRaven","followers_url":"https://api.github.com/users/CleverRaven/followers","following_url":"https://api.github.com/users/CleverRaven/following{/other_user}","gists_url":"https://api.github.com/users/CleverRaven/gists{/gist_id}","starred_url":"https://api.github.com/users/CleverRaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CleverRaven/subscriptions","organizations_url":"https://api.github.com/users/CleverRaven/orgs","repos_url":"https://api.github.com/users/CleverRaven/repos","events_url":"https://api.github.com/users/CleverRaven/events{/privacy}","received_events_url":"https://api.github.com/users/CleverRaven/received_events","type":"Organization","site_admin":false},"repo":{"id":5973855,"node_id":"MDEwOlJlcG9zaXRvcnk1OTczODU1","name":"Cataclysm-DDA","full_name":"CleverRaven/Cataclysm-DDA","private":false,"owner":{"login":"CleverRaven","id":4367009,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzNjcwMDk=","avatar_url":"https://avatars0.githubusercontent.com/u/4367009?v=4","gravatar_id":"","url":"https://api.github.com/users/CleverRaven","html_url":"https://github.com/CleverRaven","followers_url":"https://api.github.com/users/CleverRaven/followers","following_url":"https://api.github.com/users/CleverRaven/following{/other_user}","gists_url":"https://api.github.com/users/CleverRaven/gists{/gist_id}","starred_url":"https://api.github.com/users/CleverRaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CleverRaven/subscriptions","organizations_url":"https://api.github.com/users/CleverRaven/orgs","repos_url":"https://api.github.com/users/CleverRaven/repos","events_url":"https://api.github.com/users/CleverRaven/events{/privacy}","received_events_url":"https://api.github.com/users/CleverRaven/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CleverRaven/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.","fork":false,"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","forks_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/releases{/id}","deployments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/deployments","created_at":"2012-09-26T22:57:43Z","updated_at":"2018-11-13T15:46:05Z","pushed_at":"2018-11-13T20:00:54Z","git_url":"git://github.com/CleverRaven/Cataclysm-DDA.git","ssh_url":"git@github.com:CleverRaven/Cataclysm-DDA.git","clone_url":"https://github.com/CleverRaven/Cataclysm-DDA.git","svn_url":"https://github.com/CleverRaven/Cataclysm-DDA","homepage":"http://cataclysmdda.org","size":1386925,"stargazers_count":2244,"watchers_count":2244,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1499,"mirror_url":null,"archived":false,"open_issues_count":1047,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1499,"open_issues":1047,"watchers":2244,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/26679"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/26679"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/26679"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/26679/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/26679/comments"},"review_comment":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/26679/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/6a1706235a4c9f24132e628964be9f2a4725bad0"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":28,"deletions":16,"changed_files":3}}
{"actor":{"display_login":"ralreegorganon"}}