{"action":"created","comment":{"url":"https://api.github.com/repos/acemod/ACE3/pulls/comments/39223889","id":39223889,"diff_hunk":"@@ -0,0 +1,49 @@\n+/*\n+ * Author: BaerMitUmlaut\n+ * Pass spare magazine for the specified weapon.\n+ *\n+ * Arguments:\n+ * 0: Unit that passes the magazine <OBJECT>\n+ * 1: Unit to pass the magazine to <OBJECT>\n+ * 2: Weapon classname <STRING>\n+ * \n+ * Return Value:\n+ * None\n+ *\n+ * Example:\n+ * [_player, _target, \"arifle_MX_F\"] call ace_interaction_fnc_magToPassazine\n+ *\n+ * Public: No\n+ */\n+\n+#include \"script_component.hpp\"\n+params [\"_player\", \"_target\", \"_weapon\"];\n+private [\"_compatibleMags\", \"_filterFunc\", \"_filteredMags\", \"_magToPass\", \"_magToPassIndex\"];\n+\n+_compatibleMags = getArray (configfile >> \"CfgWeapons\" >> _weapon >> \"magazines\");\n+_filterFunc = compile format [\"((_this select 0) in %1) && !(_this select 2)\", _compatibleMags];\n+\n+_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter);\n+\n+//select magazine with most ammo\n+_magToPass = _filteredMags select 0;\n+_magToPassIndex = 0;\n+{\n+    if (((_x select 1) > (_magToPass select 1)) && ((_target canAddItemToUniform (_x select 0)) || (_target canAddItemToVest (_x select 0)) || (_target canAddItemToBackpack (_x select 0)))) then {\n+        _magToPass = _x;\n+        _magToPassIndex = _forEachIndex;\n+    };\n+} foreach _filteredMags;\n+\n+//remove all magazines and add them again, except the one to be passed\n+//needed because of missing commands, see http://feedback.arma3.com/view.php?id=12782\n+_player removeMagazines (_magToPass select 0);\n+{\n+    if ((_x select 0) == (_magToPass select 0) && (_forEachIndex != _magToPassIndex)) then {\n+        _player addMagazine [_x select 0, _x select 1];\n+    };\n+} foreach _filteredMags;\n+\n+_player playActionNow \"PutDown\";\n+\n+[[_player, _target, _magToPass select 0, _magToPass select 1], QUOTE(FUNC(passMagazineLocal)), _target] call EFUNC(common,execRemoteFnc);","path":"addons/interaction/functions/fnc_passMagazine.sqf","position":49,"original_position":49,"commit_id":"45bfa3eaf51f52dc954b16dd7e1003a7df42437c","original_commit_id":"45bfa3eaf51f52dc954b16dd7e1003a7df42437c","user":{"login":"commy2","id":6576312,"avatar_url":"https://avatars.githubusercontent.com/u/6576312?v=3","gravatar_id":"","url":"https://api.github.com/users/commy2","html_url":"https://github.com/commy2","followers_url":"https://api.github.com/users/commy2/followers","following_url":"https://api.github.com/users/commy2/following{/other_user}","gists_url":"https://api.github.com/users/commy2/gists{/gist_id}","starred_url":"https://api.github.com/users/commy2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commy2/subscriptions","organizations_url":"https://api.github.com/users/commy2/orgs","repos_url":"https://api.github.com/users/commy2/repos","events_url":"https://api.github.com/users/commy2/events{/privacy}","received_events_url":"https://api.github.com/users/commy2/received_events","type":"User","site_admin":false},"body":"`EFUNC(common,execRemoteFnc)` is deprecated. Define an event in postInit and call it with `EFUNC(common,targetEvent)`","created_at":"2015-09-10T22:46:36Z","updated_at":"2015-09-10T22:46:36Z","html_url":"https://github.com/acemod/ACE3/pull/2390#discussion_r39223889","pull_request_url":"https://api.github.com/repos/acemod/ACE3/pulls/2390","_links":{"self":{"href":"https://api.github.com/repos/acemod/ACE3/pulls/comments/39223889"},"html":{"href":"https://github.com/acemod/ACE3/pull/2390#discussion_r39223889"},"pull_request":{"href":"https://api.github.com/repos/acemod/ACE3/pulls/2390"}}},"pull_request":{"url":"https://api.github.com/repos/acemod/ACE3/pulls/2390","id":44715552,"html_url":"https://github.com/acemod/ACE3/pull/2390","diff_url":"https://github.com/acemod/ACE3/pull/2390.diff","patch_url":"https://github.com/acemod/ACE3/pull/2390.patch","issue_url":"https://api.github.com/repos/acemod/ACE3/issues/2390","number":2390,"state":"open","locked":false,"title":"Added interaction to quickly pass a magazine","user":{"login":"BaerMitUmlaut","id":9693842,"avatar_url":"https://avatars.githubusercontent.com/u/9693842?v=3","gravatar_id":"","url":"https://api.github.com/users/BaerMitUmlaut","html_url":"https://github.com/BaerMitUmlaut","followers_url":"https://api.github.com/users/BaerMitUmlaut/followers","following_url":"https://api.github.com/users/BaerMitUmlaut/following{/other_user}","gists_url":"https://api.github.com/users/BaerMitUmlaut/gists{/gist_id}","starred_url":"https://api.github.com/users/BaerMitUmlaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaerMitUmlaut/subscriptions","organizations_url":"https://api.github.com/users/BaerMitUmlaut/orgs","repos_url":"https://api.github.com/users/BaerMitUmlaut/repos","events_url":"https://api.github.com/users/BaerMitUmlaut/events{/privacy}","received_events_url":"https://api.github.com/users/BaerMitUmlaut/received_events","type":"User","site_admin":false},"body":"This adds an interaction that lets you quickly pass a magazine to another player (or AI unit). It automatically chooses the magazine that still has the most ammo, fits into the other units weapon and also still fits into his inventory.\r\n\r\nI have not added the possibility to pass on ammunition for launchers, since this is more for when somebody runs out of ammo in combat, and I don't think you can't really quickly pass on a rocket. It would be easy to add though if so desired.","created_at":"2015-09-10T20:31:54Z","updated_at":"2015-09-10T22:46:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdf72ac9edbe8243576e62750a9567e8a397ad0c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/acemod/ACE3/pulls/2390/commits","review_comments_url":"https://api.github.com/repos/acemod/ACE3/pulls/2390/comments","review_comment_url":"https://api.github.com/repos/acemod/ACE3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/acemod/ACE3/issues/2390/comments","statuses_url":"https://api.github.com/repos/acemod/ACE3/statuses/45bfa3eaf51f52dc954b16dd7e1003a7df42437c","head":{"label":"BaerMitUmlaut:pass-magazine","ref":"pass-magazine","sha":"45bfa3eaf51f52dc954b16dd7e1003a7df42437c","user":{"login":"BaerMitUmlaut","id":9693842,"avatar_url":"https://avatars.githubusercontent.com/u/9693842?v=3","gravatar_id":"","url":"https://api.github.com/users/BaerMitUmlaut","html_url":"https://github.com/BaerMitUmlaut","followers_url":"https://api.github.com/users/BaerMitUmlaut/followers","following_url":"https://api.github.com/users/BaerMitUmlaut/following{/other_user}","gists_url":"https://api.github.com/users/BaerMitUmlaut/gists{/gist_id}","starred_url":"https://api.github.com/users/BaerMitUmlaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaerMitUmlaut/subscriptions","organizations_url":"https://api.github.com/users/BaerMitUmlaut/orgs","repos_url":"https://api.github.com/users/BaerMitUmlaut/repos","events_url":"https://api.github.com/users/BaerMitUmlaut/events{/privacy}","received_events_url":"https://api.github.com/users/BaerMitUmlaut/received_events","type":"User","site_admin":false},"repo":{"id":35157833,"name":"ACE3","full_name":"BaerMitUmlaut/ACE3","owner":{"login":"BaerMitUmlaut","id":9693842,"avatar_url":"https://avatars.githubusercontent.com/u/9693842?v=3","gravatar_id":"","url":"https://api.github.com/users/BaerMitUmlaut","html_url":"https://github.com/BaerMitUmlaut","followers_url":"https://api.github.com/users/BaerMitUmlaut/followers","following_url":"https://api.github.com/users/BaerMitUmlaut/following{/other_user}","gists_url":"https://api.github.com/users/BaerMitUmlaut/gists{/gist_id}","starred_url":"https://api.github.com/users/BaerMitUmlaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaerMitUmlaut/subscriptions","organizations_url":"https://api.github.com/users/BaerMitUmlaut/orgs","repos_url":"https://api.github.com/users/BaerMitUmlaut/repos","events_url":"https://api.github.com/users/BaerMitUmlaut/events{/privacy}","received_events_url":"https://api.github.com/users/BaerMitUmlaut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BaerMitUmlaut/ACE3","description":"Open-source realism mod for Arma 3","fork":true,"url":"https://api.github.com/repos/BaerMitUmlaut/ACE3","forks_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/forks","keys_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/teams","hooks_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/hooks","issue_events_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/issues/events{/number}","events_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/events","assignees_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/assignees{/user}","branches_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/branches{/branch}","tags_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/tags","blobs_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/git/refs{/sha}","trees_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/statuses/{sha}","languages_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/languages","stargazers_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/stargazers","contributors_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/contributors","subscribers_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/subscribers","subscription_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/subscription","commits_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/commits{/sha}","git_commits_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/git/commits{/sha}","comments_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/comments{/number}","issue_comment_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/issues/comments{/number}","contents_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/contents/{+path}","compare_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/merges","archive_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/downloads","issues_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/issues{/number}","pulls_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/pulls{/number}","milestones_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/milestones{/number}","notifications_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/labels{/name}","releases_url":"https://api.github.com/repos/BaerMitUmlaut/ACE3/releases{/id}","created_at":"2015-05-06T12:44:32Z","updated_at":"2015-07-07T16:52:49Z","pushed_at":"2015-09-10T20:24:05Z","git_url":"git://github.com/BaerMitUmlaut/ACE3.git","ssh_url":"git@github.com:BaerMitUmlaut/ACE3.git","clone_url":"https://github.com/BaerMitUmlaut/ACE3.git","svn_url":"https://github.com/BaerMitUmlaut/ACE3","homepage":"http://ace3mod.com/","size":231664,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"acemod:master","ref":"master","sha":"b96718dfa1a97b70db937c62a08bc88d72a35c29","user":{"login":"acemod","id":11369030,"avatar_url":"https://avatars.githubusercontent.com/u/11369030?v=3","gravatar_id":"","url":"https://api.github.com/users/acemod","html_url":"https://github.com/acemod","followers_url":"https://api.github.com/users/acemod/followers","following_url":"https://api.github.com/users/acemod/following{/other_user}","gists_url":"https://api.github.com/users/acemod/gists{/gist_id}","starred_url":"https://api.github.com/users/acemod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acemod/subscriptions","organizations_url":"https://api.github.com/users/acemod/orgs","repos_url":"https://api.github.com/users/acemod/repos","events_url":"https://api.github.com/users/acemod/events{/privacy}","received_events_url":"https://api.github.com/users/acemod/received_events","type":"Organization","site_admin":false},"repo":{"id":29069174,"name":"ACE3","full_name":"acemod/ACE3","owner":{"login":"acemod","id":11369030,"avatar_url":"https://avatars.githubusercontent.com/u/11369030?v=3","gravatar_id":"","url":"https://api.github.com/users/acemod","html_url":"https://github.com/acemod","followers_url":"https://api.github.com/users/acemod/followers","following_url":"https://api.github.com/users/acemod/following{/other_user}","gists_url":"https://api.github.com/users/acemod/gists{/gist_id}","starred_url":"https://api.github.com/users/acemod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acemod/subscriptions","organizations_url":"https://api.github.com/users/acemod/orgs","repos_url":"https://api.github.com/users/acemod/repos","events_url":"https://api.github.com/users/acemod/events{/privacy}","received_events_url":"https://api.github.com/users/acemod/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acemod/ACE3","description":"Open-source realism mod for Arma 3","fork":false,"url":"https://api.github.com/repos/acemod/ACE3","forks_url":"https://api.github.com/repos/acemod/ACE3/forks","keys_url":"https://api.github.com/repos/acemod/ACE3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acemod/ACE3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acemod/ACE3/teams","hooks_url":"https://api.github.com/repos/acemod/ACE3/hooks","issue_events_url":"https://api.github.com/repos/acemod/ACE3/issues/events{/number}","events_url":"https://api.github.com/repos/acemod/ACE3/events","assignees_url":"https://api.github.com/repos/acemod/ACE3/assignees{/user}","branches_url":"https://api.github.com/repos/acemod/ACE3/branches{/branch}","tags_url":"https://api.github.com/repos/acemod/ACE3/tags","blobs_url":"https://api.github.com/repos/acemod/ACE3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acemod/ACE3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acemod/ACE3/git/refs{/sha}","trees_url":"https://api.github.com/repos/acemod/ACE3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acemod/ACE3/statuses/{sha}","languages_url":"https://api.github.com/repos/acemod/ACE3/languages","stargazers_url":"https://api.github.com/repos/acemod/ACE3/stargazers","contributors_url":"https://api.github.com/repos/acemod/ACE3/contributors","subscribers_url":"https://api.github.com/repos/acemod/ACE3/subscribers","subscription_url":"https://api.github.com/repos/acemod/ACE3/subscription","commits_url":"https://api.github.com/repos/acemod/ACE3/commits{/sha}","git_commits_url":"https://api.github.com/repos/acemod/ACE3/git/commits{/sha}","comments_url":"https://api.github.com/repos/acemod/ACE3/comments{/number}","issue_comment_url":"https://api.github.com/repos/acemod/ACE3/issues/comments{/number}","contents_url":"https://api.github.com/repos/acemod/ACE3/contents/{+path}","compare_url":"https://api.github.com/repos/acemod/ACE3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acemod/ACE3/merges","archive_url":"https://api.github.com/repos/acemod/ACE3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acemod/ACE3/downloads","issues_url":"https://api.github.com/repos/acemod/ACE3/issues{/number}","pulls_url":"https://api.github.com/repos/acemod/ACE3/pulls{/number}","milestones_url":"https://api.github.com/repos/acemod/ACE3/milestones{/number}","notifications_url":"https://api.github.com/repos/acemod/ACE3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acemod/ACE3/labels{/name}","releases_url":"https://api.github.com/repos/acemod/ACE3/releases{/id}","created_at":"2015-01-10T19:59:12Z","updated_at":"2015-09-09T00:44:50Z","pushed_at":"2015-09-10T20:31:54Z","git_url":"git://github.com/acemod/ACE3.git","ssh_url":"git@github.com:acemod/ACE3.git","clone_url":"https://github.com/acemod/ACE3.git","svn_url":"https://github.com/acemod/ACE3","homepage":"http://ace3mod.com/","size":372896,"stargazers_count":291,"watchers_count":291,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":230,"mirror_url":null,"open_issues_count":233,"forks":230,"open_issues":233,"watchers":291,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/acemod/ACE3/pulls/2390"},"html":{"href":"https://github.com/acemod/ACE3/pull/2390"},"issue":{"href":"https://api.github.com/repos/acemod/ACE3/issues/2390"},"comments":{"href":"https://api.github.com/repos/acemod/ACE3/issues/2390/comments"},"review_comments":{"href":"https://api.github.com/repos/acemod/ACE3/pulls/2390/comments"},"review_comment":{"href":"https://api.github.com/repos/acemod/ACE3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/acemod/ACE3/pulls/2390/commits"},"statuses":{"href":"https://api.github.com/repos/acemod/ACE3/statuses/45bfa3eaf51f52dc954b16dd7e1003a7df42437c"}}}}