{"action":"created","comment":{"url":"https://api.github.com/repos/tgstation/-tg-station/pulls/comments/53830940","id":53830940,"diff_hunk":"@@ -0,0 +1,357 @@\n+#define AB_CHECK_RESTRAINED 1\n+#define AB_CHECK_STUNNED 2\n+#define AB_CHECK_LYING 4\n+#define AB_CHECK_CONSCIOUS 8\n+\n+\n+/datum/action\n+\tvar/name = \"Generic Action\"\n+\tvar/obj/target = null\n+\tvar/check_flags = 0\n+\tvar/processing = 0\n+\tvar/obj/screen/movable/action_button/button = null\n+\tvar/button_icon = 'icons/mob/actions.dmi'\n+\tvar/button_icon_state = \"default\"\n+\tvar/background_icon_state = \"bg_default\"\n+\tvar/mob/living/owner\n+\n+/datum/action/New(Target)\n+\ttarget = Target\n+\tbutton = new\n+\tbutton.linked_action = src\n+\tbutton.name = name\n+\n+/datum/action/Destroy()\n+\tif(owner)\n+\t\tRemove(owner)\n+\ttarget = null\n+\tqdel(button)\n+\tbutton = null\n+\treturn ..()\n+\n+/datum/action/proc/Grant(mob/living/L)\n+\tif(owner)\n+\t\tif(owner == L)\n+\t\t\treturn\n+\t\tRemove(owner)\n+\towner = L\n+\tL.actions += src\n+\tif(L.client)\n+\t\tL.client.screen += button\n+\tL.update_action_buttons()\n+\n+/datum/action/proc/Remove(mob/living/L)\n+\tif(L.client)\n+\t\tL.client.screen -= button\n+\tbutton.moved = FALSE //so the button appears in its normal position when given to another owner.\n+\tL.actions -= src\n+\tL.update_action_buttons()\n+\towner = null\n+\n+/datum/action/proc/Trigger()\n+\tif(!IsAvailable())\n+\t\treturn 0\n+\treturn 1\n+\n+/datum/action/proc/Process()\n+\treturn\n+\n+/datum/action/proc/IsAvailable()\n+\tif(!owner)\n+\t\treturn 0\n+\tif(check_flags & AB_CHECK_RESTRAINED)\n+\t\tif(owner.restrained())\n+\t\t\treturn 0\n+\tif(check_flags & AB_CHECK_STUNNED)\n+\t\tif(owner.stunned || owner.weakened)\n+\t\t\treturn 0\n+\tif(check_flags & AB_CHECK_LYING)\n+\t\tif(owner.lying)\n+\t\t\treturn 0\n+\tif(check_flags & AB_CHECK_CONSCIOUS)\n+\t\tif(owner.stat)\n+\t\t\treturn 0\n+\treturn 1\n+\n+/datum/action/proc/UpdateButtonIcon()\n+\tif(button)\n+\t\tbutton.icon = button_icon\n+\t\tbutton.icon_state = background_icon_state\n+\n+\t\tApplyIcon(button)\n+\n+\t\tif(!IsAvailable())\n+\t\t\tbutton.color = rgb(128,0,0,128)\n+\t\telse\n+\t\t\tbutton.color = rgb(255,255,255,255)\n+\t\t\treturn 1\n+\n+/datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button)\n+\tcurrent_button.overlays.Cut()\n+\tif(button_icon && button_icon_state)\n+\t\tvar/image/img\n+\t\timg = image(button_icon, current_button, button_icon_state)\n+\t\timg.pixel_x = 0\n+\t\timg.pixel_y = 0\n+\t\tcurrent_button.overlays += img\n+\n+\n+\n+//Presets for item actions\n+/datum/action/item_action\n+\tcheck_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_CONSCIOUS\n+\n+/datum/action/item_action/New(Target)\n+\t..()\n+\tvar/obj/item/I = target\n+\tI.actions += src\n+\n+/datum/action/item_action/Destroy()\n+\tvar/obj/item/I = target\n+\tI.actions -= src\n+\treturn ..()\n+\n+/datum/action/item_action/Trigger()\n+\tif(!..())\n+\t\treturn 0\n+\tif(target)\n+\t\tvar/obj/item/I = target\n+\t\tI.ui_action_click(owner, src.type)\n+\treturn 1\n+\n+/datum/action/item_action/ApplyIcon(obj/screen/movable/action_button/current_button)\n+\tcurrent_button.overlays.Cut()\n+\tif(target)\n+\t\tvar/obj/item/I = target\n+\t\tvar/old = I.layer\n+\t\tI.layer = FLOAT_LAYER //AAAH\n+\t\tcurrent_button.overlays += I\n+\t\tI.layer = old\n+\n+/datum/action/item_action/toggle_light\n+\tname = \"Toggle Light\"\n+\n+/datum/action/item_action/toggle_hood\n+\tname = \"Toggle Hood\"\n+\n+/datum/action/item_action/toggle_firemode\n+\tname = \"Toggle Firemode\"\n+\n+/datum/action/item_action/startchainsaw\n+\tname = \"Pull The Starting Cord\"\n+\n+/datum/action/item_action/toggle_gunlight\n+\tname = \"Toggle Gunlight\"\n+\n+/datum/action/item_action/toggle_mode\n+\tname = \"Toggle Mode\"\n+\n+/datum/action/item_action/toggle_barrier_spread\n+\tname = \"Toggle Barrier Spread\"\n+\n+/datum/action/item_action/equip_unequip_TED_Gun\n+\tname = \"Equip/Unequip TED Gun\"\n+\n+/datum/action/item_action/toggle_paddles\n+\tname = \"Toggle Paddles\"\n+\n+/datum/action/item_action/set_internals\n+\tname = \"Set Internals\"\n+\n+/datum/action/item_action/set_internals/UpdateButtonIcon()\n+\tif(..()) //button available\n+\t\tif(iscarbon(owner))\n+\t\t\tvar/mob/living/carbon/C = owner\n+\t\t\tif(target == C.internal)\n+\t\t\t\tbutton.icon_state = \"bg_internals_on\"","path":"code/datums/action.dm","position":166,"original_position":166,"commit_id":"aa30a8d9e576f100de96a6fb9212720298c6f0a0","original_commit_id":"aa30a8d9e576f100de96a6fb9212720298c6f0a0","user":{"login":"phil235","id":3476142,"avatar_url":"https://avatars.githubusercontent.com/u/3476142?v=3","gravatar_id":"","url":"https://api.github.com/users/phil235","html_url":"https://github.com/phil235","followers_url":"https://api.github.com/users/phil235/followers","following_url":"https://api.github.com/users/phil235/following{/other_user}","gists_url":"https://api.github.com/users/phil235/gists{/gist_id}","starred_url":"https://api.github.com/users/phil235/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil235/subscriptions","organizations_url":"https://api.github.com/users/phil235/orgs","repos_url":"https://api.github.com/users/phil235/repos","events_url":"https://api.github.com/users/phil235/events{/privacy}","received_events_url":"https://api.github.com/users/phil235/received_events","type":"User","site_admin":false},"body":"background turns green when tank is used as internals.","created_at":"2016-02-23T19:03:36Z","updated_at":"2016-02-23T19:03:36Z","html_url":"https://github.com/tgstation/-tg-station/pull/15673#discussion_r53830940","pull_request_url":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673","_links":{"self":{"href":"https://api.github.com/repos/tgstation/-tg-station/pulls/comments/53830940"},"html":{"href":"https://github.com/tgstation/-tg-station/pull/15673#discussion_r53830940"},"pull_request":{"href":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673"}}},"pull_request":{"url":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673","id":60109897,"html_url":"https://github.com/tgstation/-tg-station/pull/15673","diff_url":"https://github.com/tgstation/-tg-station/pull/15673.diff","patch_url":"https://github.com/tgstation/-tg-station/pull/15673.patch","issue_url":"https://api.github.com/repos/tgstation/-tg-station/issues/15673","number":15673,"state":"open","locked":false,"title":"Action buttons will now only update when needed instead of every Life().","user":{"login":"phil235","id":3476142,"avatar_url":"https://avatars.githubusercontent.com/u/3476142?v=3","gravatar_id":"","url":"https://api.github.com/users/phil235","html_url":"https://github.com/phil235","followers_url":"https://api.github.com/users/phil235/followers","following_url":"https://api.github.com/users/phil235/following{/other_user}","gists_url":"https://api.github.com/users/phil235/gists{/gist_id}","starred_url":"https://api.github.com/users/phil235/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil235/subscriptions","organizations_url":"https://api.github.com/users/phil235/orgs","repos_url":"https://api.github.com/users/phil235/repos","events_url":"https://api.github.com/users/phil235/events{/privacy}","received_events_url":"https://api.github.com/users/phil235/received_events","type":"User","site_admin":false},"body":"* The action buttons now update their icon instantly.\r\n* Fixes versions of pickup(),equipped() and dropped not calling the parent.\r\n* Fixes drone not being able to remove a defib from their storage.\r\n* You can now cycle the mime mask by clicking it in your hand.\r\n* The action buttons for hardsuit and hooded suits now only appears when you're wearing the suit.\r\n* Created two mob helper procs getBeltSlot() and getBackSlot().\r\n* Created /datum/species/proc/on_species_loss() to handle stuff when our race change, currently only used by jelly and slime race to remove their exotic blood from our reagents and to remove slime people's action buttons.\r\n\r\n* <b>Inserting items into a mob's chest no longer gives that item's action button to that mob (it was a bug).</b>\r\n\r\n* Refactored the item's action system. Items can now hold multiple actions.\r\n* The \"set internals\" button of tank items now turn green when it's used as internals.\r\n* Removed research scanner from drones (since cyborgs don't have it, it's more consistent)\r\n* Removed the ignore_madkadjust mask var.\r\n* The sechailer mask now has an adjust mask action button, so I removed the adjust verb that it was using.\r\n* The item's action are now created on item/New() instead of trying to create it every time someone picks the item up.\r\n* I split hud/action.dm, the datum/action stuff is now in the datum folder (/datum/action.dm), whereas the code for action buttons is kept in the hud folder under action_button.dm. Also I moved some /datum/action code that was in some files back into datum/action.dm where it belongs.","created_at":"2016-02-21T23:37:30Z","updated_at":"2016-02-23T19:03:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6da3dad33f2a0c003520a8fc23107d55d01dcc9f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673/commits","review_comments_url":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673/comments","review_comment_url":"https://api.github.com/repos/tgstation/-tg-station/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tgstation/-tg-station/issues/15673/comments","statuses_url":"https://api.github.com/repos/tgstation/-tg-station/statuses/aa30a8d9e576f100de96a6fb9212720298c6f0a0","head":{"label":"phil235:ActionButtonUpdateRefactor","ref":"ActionButtonUpdateRefactor","sha":"aa30a8d9e576f100de96a6fb9212720298c6f0a0","user":{"login":"phil235","id":3476142,"avatar_url":"https://avatars.githubusercontent.com/u/3476142?v=3","gravatar_id":"","url":"https://api.github.com/users/phil235","html_url":"https://github.com/phil235","followers_url":"https://api.github.com/users/phil235/followers","following_url":"https://api.github.com/users/phil235/following{/other_user}","gists_url":"https://api.github.com/users/phil235/gists{/gist_id}","starred_url":"https://api.github.com/users/phil235/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil235/subscriptions","organizations_url":"https://api.github.com/users/phil235/orgs","repos_url":"https://api.github.com/users/phil235/repos","events_url":"https://api.github.com/users/phil235/events{/privacy}","received_events_url":"https://api.github.com/users/phil235/received_events","type":"User","site_admin":false},"repo":{"id":23807273,"name":"-tg-station","full_name":"phil235/-tg-station","owner":{"login":"phil235","id":3476142,"avatar_url":"https://avatars.githubusercontent.com/u/3476142?v=3","gravatar_id":"","url":"https://api.github.com/users/phil235","html_url":"https://github.com/phil235","followers_url":"https://api.github.com/users/phil235/followers","following_url":"https://api.github.com/users/phil235/following{/other_user}","gists_url":"https://api.github.com/users/phil235/gists{/gist_id}","starred_url":"https://api.github.com/users/phil235/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil235/subscriptions","organizations_url":"https://api.github.com/users/phil235/orgs","repos_url":"https://api.github.com/users/phil235/repos","events_url":"https://api.github.com/users/phil235/events{/privacy}","received_events_url":"https://api.github.com/users/phil235/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phil235/-tg-station","description":"/tg/'s SS13 branch","fork":true,"url":"https://api.github.com/repos/phil235/-tg-station","forks_url":"https://api.github.com/repos/phil235/-tg-station/forks","keys_url":"https://api.github.com/repos/phil235/-tg-station/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phil235/-tg-station/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phil235/-tg-station/teams","hooks_url":"https://api.github.com/repos/phil235/-tg-station/hooks","issue_events_url":"https://api.github.com/repos/phil235/-tg-station/issues/events{/number}","events_url":"https://api.github.com/repos/phil235/-tg-station/events","assignees_url":"https://api.github.com/repos/phil235/-tg-station/assignees{/user}","branches_url":"https://api.github.com/repos/phil235/-tg-station/branches{/branch}","tags_url":"https://api.github.com/repos/phil235/-tg-station/tags","blobs_url":"https://api.github.com/repos/phil235/-tg-station/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phil235/-tg-station/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phil235/-tg-station/git/refs{/sha}","trees_url":"https://api.github.com/repos/phil235/-tg-station/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phil235/-tg-station/statuses/{sha}","languages_url":"https://api.github.com/repos/phil235/-tg-station/languages","stargazers_url":"https://api.github.com/repos/phil235/-tg-station/stargazers","contributors_url":"https://api.github.com/repos/phil235/-tg-station/contributors","subscribers_url":"https://api.github.com/repos/phil235/-tg-station/subscribers","subscription_url":"https://api.github.com/repos/phil235/-tg-station/subscription","commits_url":"https://api.github.com/repos/phil235/-tg-station/commits{/sha}","git_commits_url":"https://api.github.com/repos/phil235/-tg-station/git/commits{/sha}","comments_url":"https://api.github.com/repos/phil235/-tg-station/comments{/number}","issue_comment_url":"https://api.github.com/repos/phil235/-tg-station/issues/comments{/number}","contents_url":"https://api.github.com/repos/phil235/-tg-station/contents/{+path}","compare_url":"https://api.github.com/repos/phil235/-tg-station/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phil235/-tg-station/merges","archive_url":"https://api.github.com/repos/phil235/-tg-station/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phil235/-tg-station/downloads","issues_url":"https://api.github.com/repos/phil235/-tg-station/issues{/number}","pulls_url":"https://api.github.com/repos/phil235/-tg-station/pulls{/number}","milestones_url":"https://api.github.com/repos/phil235/-tg-station/milestones{/number}","notifications_url":"https://api.github.com/repos/phil235/-tg-station/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phil235/-tg-station/labels{/name}","releases_url":"https://api.github.com/repos/phil235/-tg-station/releases{/id}","deployments_url":"https://api.github.com/repos/phil235/-tg-station/deployments","created_at":"2014-09-08T20:34:40Z","updated_at":"2014-12-31T18:17:09Z","pushed_at":"2016-02-23T18:59:28Z","git_url":"git://github.com/phil235/-tg-station.git","ssh_url":"git@github.com:phil235/-tg-station.git","clone_url":"https://github.com/phil235/-tg-station.git","svn_url":"https://github.com/phil235/-tg-station","homepage":"http://www.tgstation13.org/","size":619665,"stargazers_count":0,"watchers_count":0,"language":"DM","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tgstation:master","ref":"master","sha":"837e674bffa7ced89f9e29fc75358ec452bb5554","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":"-tg-station","full_name":"tgstation/-tg-station","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/-tg-station","description":"the /tg/station branch of SS13","fork":false,"url":"https://api.github.com/repos/tgstation/-tg-station","forks_url":"https://api.github.com/repos/tgstation/-tg-station/forks","keys_url":"https://api.github.com/repos/tgstation/-tg-station/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tgstation/-tg-station/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tgstation/-tg-station/teams","hooks_url":"https://api.github.com/repos/tgstation/-tg-station/hooks","issue_events_url":"https://api.github.com/repos/tgstation/-tg-station/issues/events{/number}","events_url":"https://api.github.com/repos/tgstation/-tg-station/events","assignees_url":"https://api.github.com/repos/tgstation/-tg-station/assignees{/user}","branches_url":"https://api.github.com/repos/tgstation/-tg-station/branches{/branch}","tags_url":"https://api.github.com/repos/tgstation/-tg-station/tags","blobs_url":"https://api.github.com/repos/tgstation/-tg-station/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tgstation/-tg-station/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tgstation/-tg-station/git/refs{/sha}","trees_url":"https://api.github.com/repos/tgstation/-tg-station/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tgstation/-tg-station/statuses/{sha}","languages_url":"https://api.github.com/repos/tgstation/-tg-station/languages","stargazers_url":"https://api.github.com/repos/tgstation/-tg-station/stargazers","contributors_url":"https://api.github.com/repos/tgstation/-tg-station/contributors","subscribers_url":"https://api.github.com/repos/tgstation/-tg-station/subscribers","subscription_url":"https://api.github.com/repos/tgstation/-tg-station/subscription","commits_url":"https://api.github.com/repos/tgstation/-tg-station/commits{/sha}","git_commits_url":"https://api.github.com/repos/tgstation/-tg-station/git/commits{/sha}","comments_url":"https://api.github.com/repos/tgstation/-tg-station/comments{/number}","issue_comment_url":"https://api.github.com/repos/tgstation/-tg-station/issues/comments{/number}","contents_url":"https://api.github.com/repos/tgstation/-tg-station/contents/{+path}","compare_url":"https://api.github.com/repos/tgstation/-tg-station/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tgstation/-tg-station/merges","archive_url":"https://api.github.com/repos/tgstation/-tg-station/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tgstation/-tg-station/downloads","issues_url":"https://api.github.com/repos/tgstation/-tg-station/issues{/number}","pulls_url":"https://api.github.com/repos/tgstation/-tg-station/pulls{/number}","milestones_url":"https://api.github.com/repos/tgstation/-tg-station/milestones{/number}","notifications_url":"https://api.github.com/repos/tgstation/-tg-station/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tgstation/-tg-station/labels{/name}","releases_url":"https://api.github.com/repos/tgstation/-tg-station/releases{/id}","deployments_url":"https://api.github.com/repos/tgstation/-tg-station/deployments","created_at":"2012-01-21T17:32:47Z","updated_at":"2016-02-22T23:20:35Z","pushed_at":"2016-02-23T18:59:30Z","git_url":"git://github.com/tgstation/-tg-station.git","ssh_url":"git@github.com:tgstation/-tg-station.git","clone_url":"https://github.com/tgstation/-tg-station.git","svn_url":"https://github.com/tgstation/-tg-station","homepage":"http://www.tgstation13.org/","size":773475,"stargazers_count":274,"watchers_count":274,"language":"DM","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":958,"mirror_url":null,"open_issues_count":783,"forks":958,"open_issues":783,"watchers":274,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673"},"html":{"href":"https://github.com/tgstation/-tg-station/pull/15673"},"issue":{"href":"https://api.github.com/repos/tgstation/-tg-station/issues/15673"},"comments":{"href":"https://api.github.com/repos/tgstation/-tg-station/issues/15673/comments"},"review_comments":{"href":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673/comments"},"review_comment":{"href":"https://api.github.com/repos/tgstation/-tg-station/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tgstation/-tg-station/pulls/15673/commits"},"statuses":{"href":"https://api.github.com/repos/tgstation/-tg-station/statuses/aa30a8d9e576f100de96a6fb9212720298c6f0a0"}}}}