{"action":"created","comment":{"url":"https://api.github.com/repos/tgstation/tgstation/pulls/comments/75986114","id":75986114,"diff_hunk":"@@ -0,0 +1,68 @@\n+//Status effects are used to apply temporary or permanent effects to mobs. Mobs are aware of their status effects at all times.\n+//This file contains their code, plus code for applying and removing them.\n+//When making a new status effect, add a define to status_effects.dm in __DEFINES for ease of use!\n+var/list/status_effects = list() //All status effects affecting literally anyone\n+/datum/status_effect\n+\tvar/name = \"Curse of Mundanity\"\n+\tvar/desc = \"You don't feel any different...\"\n+\tvar/id = \"effect\" //Used for screen alerts.\n+\tvar/icon_state //Used for displaying the status effect.\n+\tvar/duration = -1 //How long the status effect lasts in SECONDS. Enter -1 for an effect that never ends unless removed through some means.\n+\tvar/tick_interval = 1 //How many seconds between ticks. Leave at 1 for every second.\n+\tvar/mob/living/owner //The mob affected by the status effect.\n+\tvar/cosmetic = FALSE //If the status effect only exists for flavor.\n+\tvar/unique = TRUE //If there can be multiple status effects of this type on one mob.\n+\n+/datum/status_effect/New()\n+\t..()\n+\tspawn(1) //Give us time to set any variables\n+\t\tstart_ticking()\n+\t\tstatus_effects += src\n+\n+/datum/status_effect/Destroy()\n+\tstatus_effects -= src\n+\t..()\n+\n+/datum/status_effect/proc/start_ticking()\n+\tif(!src)\n+\t\treturn\n+\ton_apply()\n+\towner.throw_alert(id, /obj/screen/alert, effect = src)\n+\tSTART_PROCESSING(SSprocessing, src)\n+\n+/datum/status_effect/process()\n+\tif(duration != -1)\n+\t\tduration--\n+\ttick_interval--\n+\tif(!tick_interval)\n+\t\ttick()\n+\t\ttick_interval = initial(tick_interval)\n+\tif(!duration && duration != -1)\n+\t\tcancel_effect()\n+\n+/datum/status_effect/proc/cancel_effect()\n+\tSTOP_PROCESSING(SSprocessing, src)\n+\towner.clear_alert(id)\n+\ton_remove()\n+\tqdel(src)\n+\n+/datum/status_effect/proc/on_apply() //Called whenever the buff is applied.\n+/datum/status_effect/proc/tick() //Called every tick.\n+/datum/status_effect/proc/on_remove() //Called whenever the buff expires or is removed.\n+\n+//////////////////\n+// HELPER PROCS //\n+//////////////////\n+\n+/mob/living/proc/apply_status_effect(effect)\n+\tvar/datum/status_effect/S = new effect\n+\tfor(var/datum/status_effect/S2 in status_effects)","path":"code/datums/status_effects/status_effect.dm","position":59,"original_position":59,"commit_id":"7b152627fa134e5f70edd1aa1ddcb8a058b54254","original_commit_id":"7b152627fa134e5f70edd1aa1ddcb8a058b54254","user":{"login":"Xhuis","id":15898043,"avatar_url":"https://avatars.githubusercontent.com/u/15898043?v=3","gravatar_id":"","url":"https://api.github.com/users/Xhuis","html_url":"https://github.com/Xhuis","followers_url":"https://api.github.com/users/Xhuis/followers","following_url":"https://api.github.com/users/Xhuis/following{/other_user}","gists_url":"https://api.github.com/users/Xhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/Xhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xhuis/subscriptions","organizations_url":"https://api.github.com/users/Xhuis/orgs","repos_url":"https://api.github.com/users/Xhuis/repos","events_url":"https://api.github.com/users/Xhuis/events{/privacy}","received_events_url":"https://api.github.com/users/Xhuis/received_events","type":"User","site_admin":false},"body":"So the syntax would be:\r\n`status_effects[\\ref[owner][id]]`?","created_at":"2016-08-24T02:32:29Z","updated_at":"2016-08-24T02:32:29Z","html_url":"https://github.com/tgstation/tgstation/pull/19939#discussion_r75986114","pull_request_url":"https://api.github.com/repos/tgstation/tgstation/pulls/19939","_links":{"self":{"href":"https://api.github.com/repos/tgstation/tgstation/pulls/comments/75986114"},"html":{"href":"https://github.com/tgstation/tgstation/pull/19939#discussion_r75986114"},"pull_request":{"href":"https://api.github.com/repos/tgstation/tgstation/pulls/19939"}}},"pull_request":{"url":"https://api.github.com/repos/tgstation/tgstation/pulls/19939","id":81732453,"html_url":"https://github.com/tgstation/tgstation/pull/19939","diff_url":"https://github.com/tgstation/tgstation/pull/19939.diff","patch_url":"https://github.com/tgstation/tgstation/pull/19939.patch","issue_url":"https://api.github.com/repos/tgstation/tgstation/issues/19939","number":19939,"state":"open","locked":false,"title":"Adds framework for status effects","user":{"login":"Xhuis","id":15898043,"avatar_url":"https://avatars.githubusercontent.com/u/15898043?v=3","gravatar_id":"","url":"https://api.github.com/users/Xhuis","html_url":"https://github.com/Xhuis","followers_url":"https://api.github.com/users/Xhuis/followers","following_url":"https://api.github.com/users/Xhuis/following{/other_user}","gists_url":"https://api.github.com/users/Xhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/Xhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xhuis/subscriptions","organizations_url":"https://api.github.com/users/Xhuis/orgs","repos_url":"https://api.github.com/users/Xhuis/repos","events_url":"https://api.github.com/users/Xhuis/events{/privacy}","received_events_url":"https://api.github.com/users/Xhuis/received_events","type":"User","site_admin":false},"body":"Added framework for status effects with lots of customization, including duration, effects, and pretty much everything else. Files are located in `__DEFINES/status_effects.dm`, and `datum/status_effects`. There are two procs for adding and removing them, both at the mob level - `apply_status_effect` and `remove_status_effect`, both of which take each effect's path or define.\r\n\r\nThis allows for making timed or constant effects without having random loops all over the place. For instance, if you want to have a creature mark its target to die after one minute, you can make a status effect that lasts one minute and calls `death()` on the owner once it expires.\r\n\r\nCode suggestions and criticisms are appreciated and encouraged.","created_at":"2016-08-17T23:06:21Z","updated_at":"2016-08-24T02:32:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c71518512187bcdd8f88e0b2467f4090f40f4b1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tgstation/tgstation/pulls/19939/commits","review_comments_url":"https://api.github.com/repos/tgstation/tgstation/pulls/19939/comments","review_comment_url":"https://api.github.com/repos/tgstation/tgstation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tgstation/tgstation/issues/19939/comments","statuses_url":"https://api.github.com/repos/tgstation/tgstation/statuses/7b152627fa134e5f70edd1aa1ddcb8a058b54254","head":{"label":"Xhuis:buffs_and_debuffs","ref":"buffs_and_debuffs","sha":"7b152627fa134e5f70edd1aa1ddcb8a058b54254","user":{"login":"Xhuis","id":15898043,"avatar_url":"https://avatars.githubusercontent.com/u/15898043?v=3","gravatar_id":"","url":"https://api.github.com/users/Xhuis","html_url":"https://github.com/Xhuis","followers_url":"https://api.github.com/users/Xhuis/followers","following_url":"https://api.github.com/users/Xhuis/following{/other_user}","gists_url":"https://api.github.com/users/Xhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/Xhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xhuis/subscriptions","organizations_url":"https://api.github.com/users/Xhuis/orgs","repos_url":"https://api.github.com/users/Xhuis/repos","events_url":"https://api.github.com/users/Xhuis/events{/privacy}","received_events_url":"https://api.github.com/users/Xhuis/received_events","type":"User","site_admin":false},"repo":{"id":46378360,"name":"-tg-station","full_name":"Xhuis/-tg-station","owner":{"login":"Xhuis","id":15898043,"avatar_url":"https://avatars.githubusercontent.com/u/15898043?v=3","gravatar_id":"","url":"https://api.github.com/users/Xhuis","html_url":"https://github.com/Xhuis","followers_url":"https://api.github.com/users/Xhuis/followers","following_url":"https://api.github.com/users/Xhuis/following{/other_user}","gists_url":"https://api.github.com/users/Xhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/Xhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xhuis/subscriptions","organizations_url":"https://api.github.com/users/Xhuis/orgs","repos_url":"https://api.github.com/users/Xhuis/repos","events_url":"https://api.github.com/users/Xhuis/events{/privacy}","received_events_url":"https://api.github.com/users/Xhuis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Xhuis/-tg-station","description":"the /tg/station branch of SS13","fork":true,"url":"https://api.github.com/repos/Xhuis/-tg-station","forks_url":"https://api.github.com/repos/Xhuis/-tg-station/forks","keys_url":"https://api.github.com/repos/Xhuis/-tg-station/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Xhuis/-tg-station/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Xhuis/-tg-station/teams","hooks_url":"https://api.github.com/repos/Xhuis/-tg-station/hooks","issue_events_url":"https://api.github.com/repos/Xhuis/-tg-station/issues/events{/number}","events_url":"https://api.github.com/repos/Xhuis/-tg-station/events","assignees_url":"https://api.github.com/repos/Xhuis/-tg-station/assignees{/user}","branches_url":"https://api.github.com/repos/Xhuis/-tg-station/branches{/branch}","tags_url":"https://api.github.com/repos/Xhuis/-tg-station/tags","blobs_url":"https://api.github.com/repos/Xhuis/-tg-station/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Xhuis/-tg-station/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Xhuis/-tg-station/git/refs{/sha}","trees_url":"https://api.github.com/repos/Xhuis/-tg-station/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Xhuis/-tg-station/statuses/{sha}","languages_url":"https://api.github.com/repos/Xhuis/-tg-station/languages","stargazers_url":"https://api.github.com/repos/Xhuis/-tg-station/stargazers","contributors_url":"https://api.github.com/repos/Xhuis/-tg-station/contributors","subscribers_url":"https://api.github.com/repos/Xhuis/-tg-station/subscribers","subscription_url":"https://api.github.com/repos/Xhuis/-tg-station/subscription","commits_url":"https://api.github.com/repos/Xhuis/-tg-station/commits{/sha}","git_commits_url":"https://api.github.com/repos/Xhuis/-tg-station/git/commits{/sha}","comments_url":"https://api.github.com/repos/Xhuis/-tg-station/comments{/number}","issue_comment_url":"https://api.github.com/repos/Xhuis/-tg-station/issues/comments{/number}","contents_url":"https://api.github.com/repos/Xhuis/-tg-station/contents/{+path}","compare_url":"https://api.github.com/repos/Xhuis/-tg-station/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Xhuis/-tg-station/merges","archive_url":"https://api.github.com/repos/Xhuis/-tg-station/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Xhuis/-tg-station/downloads","issues_url":"https://api.github.com/repos/Xhuis/-tg-station/issues{/number}","pulls_url":"https://api.github.com/repos/Xhuis/-tg-station/pulls{/number}","milestones_url":"https://api.github.com/repos/Xhuis/-tg-station/milestones{/number}","notifications_url":"https://api.github.com/repos/Xhuis/-tg-station/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Xhuis/-tg-station/labels{/name}","releases_url":"https://api.github.com/repos/Xhuis/-tg-station/releases{/id}","deployments_url":"https://api.github.com/repos/Xhuis/-tg-station/deployments","created_at":"2015-11-17T22:04:37Z","updated_at":"2016-03-10T22:19:11Z","pushed_at":"2016-08-19T00:02:10Z","git_url":"git://github.com/Xhuis/-tg-station.git","ssh_url":"git@github.com:Xhuis/-tg-station.git","clone_url":"https://github.com/Xhuis/-tg-station.git","svn_url":"https://github.com/Xhuis/-tg-station","homepage":"http://www.tgstation13.org/","size":643254,"stargazers_count":0,"watchers_count":0,"language":"DM","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"tgstation:master","ref":"master","sha":"d2c9876c47db2bad877a77b707c0236f76b3d818","user":{"login":"tgstation","id":1363778,"avatar_url":"https://avatars.githubusercontent.com/u/1363778?v=3","gravatar_id":"","url":"https://api.github.com/users/tgstation","html_url":"https://github.com/tgstation","followers_url":"https://api.github.com/users/tgstation/followers","following_url":"https://api.github.com/users/tgstation/following{/other_user}","gists_url":"https://api.github.com/users/tgstation/gists{/gist_id}","starred_url":"https://api.github.com/users/tgstation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgstation/subscriptions","organizations_url":"https://api.github.com/users/tgstation/orgs","repos_url":"https://api.github.com/users/tgstation/repos","events_url":"https://api.github.com/users/tgstation/events{/privacy}","received_events_url":"https://api.github.com/users/tgstation/received_events","type":"Organization","site_admin":false},"repo":{"id":3234987,"name":"tgstation","full_name":"tgstation/tgstation","owner":{"login":"tgstation","id":1363778,"avatar_url":"https://avatars.githubusercontent.com/u/1363778?v=3","gravatar_id":"","url":"https://api.github.com/users/tgstation","html_url":"https://github.com/tgstation","followers_url":"https://api.github.com/users/tgstation/followers","following_url":"https://api.github.com/users/tgstation/following{/other_user}","gists_url":"https://api.github.com/users/tgstation/gists{/gist_id}","starred_url":"https://api.github.com/users/tgstation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgstation/subscriptions","organizations_url":"https://api.github.com/users/tgstation/orgs","repos_url":"https://api.github.com/users/tgstation/repos","events_url":"https://api.github.com/users/tgstation/events{/privacy}","received_events_url":"https://api.github.com/users/tgstation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tgstation/tgstation","description":"the /tg/station branch of SS13","fork":false,"url":"https://api.github.com/repos/tgstation/tgstation","forks_url":"https://api.github.com/repos/tgstation/tgstation/forks","keys_url":"https://api.github.com/repos/tgstation/tgstation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tgstation/tgstation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tgstation/tgstation/teams","hooks_url":"https://api.github.com/repos/tgstation/tgstation/hooks","issue_events_url":"https://api.github.com/repos/tgstation/tgstation/issues/events{/number}","events_url":"https://api.github.com/repos/tgstation/tgstation/events","assignees_url":"https://api.github.com/repos/tgstation/tgstation/assignees{/user}","branches_url":"https://api.github.com/repos/tgstation/tgstation/branches{/branch}","tags_url":"https://api.github.com/repos/tgstation/tgstation/tags","blobs_url":"https://api.github.com/repos/tgstation/tgstation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tgstation/tgstation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tgstation/tgstation/git/refs{/sha}","trees_url":"https://api.github.com/repos/tgstation/tgstation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tgstation/tgstation/statuses/{sha}","languages_url":"https://api.github.com/repos/tgstation/tgstation/languages","stargazers_url":"https://api.github.com/repos/tgstation/tgstation/stargazers","contributors_url":"https://api.github.com/repos/tgstation/tgstation/contributors","subscribers_url":"https://api.github.com/repos/tgstation/tgstation/subscribers","subscription_url":"https://api.github.com/repos/tgstation/tgstation/subscription","commits_url":"https://api.github.com/repos/tgstation/tgstation/commits{/sha}","git_commits_url":"https://api.github.com/repos/tgstation/tgstation/git/commits{/sha}","comments_url":"https://api.github.com/repos/tgstation/tgstation/comments{/number}","issue_comment_url":"https://api.github.com/repos/tgstation/tgstation/issues/comments{/number}","contents_url":"https://api.github.com/repos/tgstation/tgstation/contents/{+path}","compare_url":"https://api.github.com/repos/tgstation/tgstation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tgstation/tgstation/merges","archive_url":"https://api.github.com/repos/tgstation/tgstation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tgstation/tgstation/downloads","issues_url":"https://api.github.com/repos/tgstation/tgstation/issues{/number}","pulls_url":"https://api.github.com/repos/tgstation/tgstation/pulls{/number}","milestones_url":"https://api.github.com/repos/tgstation/tgstation/milestones{/number}","notifications_url":"https://api.github.com/repos/tgstation/tgstation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tgstation/tgstation/labels{/name}","releases_url":"https://api.github.com/repos/tgstation/tgstation/releases{/id}","deployments_url":"https://api.github.com/repos/tgstation/tgstation/deployments","created_at":"2012-01-21T17:32:47Z","updated_at":"2016-08-20T21:09:10Z","pushed_at":"2016-08-24T02:11:42Z","git_url":"git://github.com/tgstation/tgstation.git","ssh_url":"git@github.com:tgstation/tgstation.git","clone_url":"https://github.com/tgstation/tgstation.git","svn_url":"https://github.com/tgstation/tgstation","homepage":"http://www.tgstation13.org/","size":1537130,"stargazers_count":310,"watchers_count":310,"language":"DM","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1122,"mirror_url":null,"open_issues_count":853,"forks":1122,"open_issues":853,"watchers":310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tgstation/tgstation/pulls/19939"},"html":{"href":"https://github.com/tgstation/tgstation/pull/19939"},"issue":{"href":"https://api.github.com/repos/tgstation/tgstation/issues/19939"},"comments":{"href":"https://api.github.com/repos/tgstation/tgstation/issues/19939/comments"},"review_comments":{"href":"https://api.github.com/repos/tgstation/tgstation/pulls/19939/comments"},"review_comment":{"href":"https://api.github.com/repos/tgstation/tgstation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tgstation/tgstation/pulls/19939/commits"},"statuses":{"href":"https://api.github.com/repos/tgstation/tgstation/statuses/7b152627fa134e5f70edd1aa1ddcb8a058b54254"}}}}
{"actor":{"display_login":"Xhuis"}}