{"action":"created","comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/175992711","pull_request_review_id":105615886,"id":175992711,"diff_hunk":"@@ -3,9 +3,90 @@\n #define CATALUA_H\n \n #include \"int_id.h\"\n+#include \"enums.h\"\n+#include \"item.h\"\n \n #include <string>\n #include <sstream>\n+#include <vector>\n+#include <list>\n+\n+/**\n+ * Class that contains callback argument name and argument value (in different types).\n+ */\n+class CallbackArgument\n+{\n+    private:\n+        std::string name;\n+        std::string type;","path":"src/catalua.h","position":19,"original_position":19,"commit_id":"061b8038bb91b7615ca35e8e10d626956c49a0df","original_commit_id":"061b8038bb91b7615ca35e8e10d626956c49a0df","user":{"login":"BevapDin","id":5095435,"avatar_url":"https://avatars3.githubusercontent.com/u/5095435?v=4","gravatar_id":"","url":"https://api.github.com/users/BevapDin","html_url":"https://github.com/BevapDin","followers_url":"https://api.github.com/users/BevapDin/followers","following_url":"https://api.github.com/users/BevapDin/following{/other_user}","gists_url":"https://api.github.com/users/BevapDin/gists{/gist_id}","starred_url":"https://api.github.com/users/BevapDin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BevapDin/subscriptions","organizations_url":"https://api.github.com/users/BevapDin/orgs","repos_url":"https://api.github.com/users/BevapDin/repos","events_url":"https://api.github.com/users/BevapDin/events{/privacy}","received_events_url":"https://api.github.com/users/BevapDin/received_events","type":"User","site_admin":false},"body":"This should be an enumeration, not a string.","created_at":"2018-03-21T06:35:44Z","updated_at":"2018-03-21T06:35:44Z","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/21744#discussion_r175992711","pull_request_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/175992711"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/21744#discussion_r175992711"},"pull_request":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744"}}},"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744","id":138153889,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/21744","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/21744.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/21744.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/21744","number":21744,"state":"open","locked":false,"title":"New callbacks for LUA","user":{"login":"ZhilkinSerg","id":16213433,"avatar_url":"https://avatars0.githubusercontent.com/u/16213433?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhilkinSerg","html_url":"https://github.com/ZhilkinSerg","followers_url":"https://api.github.com/users/ZhilkinSerg/followers","following_url":"https://api.github.com/users/ZhilkinSerg/following{/other_user}","gists_url":"https://api.github.com/users/ZhilkinSerg/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhilkinSerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhilkinSerg/subscriptions","organizations_url":"https://api.github.com/users/ZhilkinSerg/orgs","repos_url":"https://api.github.com/users/ZhilkinSerg/repos","events_url":"https://api.github.com/users/ZhilkinSerg/events{/privacy}","received_events_url":"https://api.github.com/users/ZhilkinSerg/received_events","type":"User","site_admin":false},"body":" # Added\r\n\r\nFollowing callbacks to LUA:\r\n\r\n*game-related*:\r\n\r\n- `on_savegame_loaded` runs when saved game is loaded;\r\n- `on_weather_changed` runs when weather is changed.\r\n\r\n*calendar-related*:\r\n\r\n- `on_turn_passed` runs once each turn (once per 6 seconds or 10 times per minute);\r\n- `on_hour_passed` runs once per hour (at the beginning of the hour);\r\n- `on_year_passed` runs once per year (on first day of the year at midnight).\r\n\r\n*player-related*:\r\n\r\n- `on_mutation_gain` runs whenever player gains mutation;\r\n- `on_mutation_loss` runs whenever player loses mutation;\r\n- `on_stat_change` runs whenever player stats are changed;\r\n- `on_effect_int_changes` runs whenever intensity of effect on player has changed;\r\n- `on_item_wear` runs whenever player wears some clothes on;\r\n- `on_item_takeoff` runs whenever player takes some clothes off;\r\n- `on_mission_assignment` runs whenever player is assigned to mission;\r\n- `on_mission_finished` runs whenever player finishes the mission.\r\n\r\n*mapgen-related*:\r\n\r\n- `on_mapgen_finished` runs whenever `builtin`, `json` or `lua` mapgen is finished generating.\r\n\r\nSome callbacks store arguments in `_G` variables with useful info (see example mod).\r\n\r\n# Usage examples\r\n\r\nI want to utilize this in in my [`dda-lua` mod](https://discourse.cataclysmdda.org/t/cataclysm-dda-lua-updated-on-2017-11-29/14117):\r\n\r\n- more granular processing of time-based events (when something is happening around the player each turn);\r\n- count how many missions player has started/finished/failed (for achievements);\r\n- chance to rip apart clothes when player with high `STR` or low `DEX`/`INT` tries to take off or wear some clothes (for fun);\r\n- simplify post-processing of mapgen terrain (like I did in [`Degrade Buildings` mod](https://discourse.cataclysmdda.org/t/lua-degrade-buildings-last-updated-on-2017-10-20/14081), but without need to add `lua` node to mapgen json).","created_at":"2017-08-29T11:27:12Z","updated_at":"2018-03-21T06:35:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eda3d3a6c9c653cd2a3da8bd983d47320b2371cb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744/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/21744/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/061b8038bb91b7615ca35e8e10d626956c49a0df","head":{"label":"ZhilkinSerg:lua-callbacks","ref":"lua-callbacks","sha":"061b8038bb91b7615ca35e8e10d626956c49a0df","user":{"login":"ZhilkinSerg","id":16213433,"avatar_url":"https://avatars0.githubusercontent.com/u/16213433?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhilkinSerg","html_url":"https://github.com/ZhilkinSerg","followers_url":"https://api.github.com/users/ZhilkinSerg/followers","following_url":"https://api.github.com/users/ZhilkinSerg/following{/other_user}","gists_url":"https://api.github.com/users/ZhilkinSerg/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhilkinSerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhilkinSerg/subscriptions","organizations_url":"https://api.github.com/users/ZhilkinSerg/orgs","repos_url":"https://api.github.com/users/ZhilkinSerg/repos","events_url":"https://api.github.com/users/ZhilkinSerg/events{/privacy}","received_events_url":"https://api.github.com/users/ZhilkinSerg/received_events","type":"User","site_admin":false},"repo":{"id":81851736,"name":"Cataclysm-DDA","full_name":"ZhilkinSerg/Cataclysm-DDA","owner":{"login":"ZhilkinSerg","id":16213433,"avatar_url":"https://avatars0.githubusercontent.com/u/16213433?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhilkinSerg","html_url":"https://github.com/ZhilkinSerg","followers_url":"https://api.github.com/users/ZhilkinSerg/followers","following_url":"https://api.github.com/users/ZhilkinSerg/following{/other_user}","gists_url":"https://api.github.com/users/ZhilkinSerg/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhilkinSerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhilkinSerg/subscriptions","organizations_url":"https://api.github.com/users/ZhilkinSerg/orgs","repos_url":"https://api.github.com/users/ZhilkinSerg/repos","events_url":"https://api.github.com/users/ZhilkinSerg/events{/privacy}","received_events_url":"https://api.github.com/users/ZhilkinSerg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZhilkinSerg/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":true,"url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA","forks_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/releases{/id}","deployments_url":"https://api.github.com/repos/ZhilkinSerg/Cataclysm-DDA/deployments","created_at":"2017-02-13T17:27:56Z","updated_at":"2018-03-20T08:29:52Z","pushed_at":"2018-03-20T14:24:57Z","git_url":"git://github.com/ZhilkinSerg/Cataclysm-DDA.git","ssh_url":"git@github.com:ZhilkinSerg/Cataclysm-DDA.git","clone_url":"https://github.com/ZhilkinSerg/Cataclysm-DDA.git","svn_url":"https://github.com/ZhilkinSerg/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":1071348,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"CleverRaven:master","ref":"master","sha":"e85269de44d5c5bcc084f89fd343d9573f915bef","user":{"login":"CleverRaven","id":4367009,"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,"name":"Cataclysm-DDA","full_name":"CleverRaven/Cataclysm-DDA","owner":{"login":"CleverRaven","id":4367009,"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},"private":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-03-21T05:24:44Z","pushed_at":"2018-03-21T06:07:17Z","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":1066040,"stargazers_count":1748,"watchers_count":1748,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1249,"mirror_url":null,"archived":false,"open_issues_count":734,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1249,"open_issues":734,"watchers":1748,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/21744"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/21744"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/21744/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/21744/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/21744/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/061b8038bb91b7615ca35e8e10d626956c49a0df"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"BevapDin"}}