{"action":"created","issue":{"url":"https://api.github.com/repos/KoffeinFlummi/AGM/issues/1544","labels_url":"https://api.github.com/repos/KoffeinFlummi/AGM/issues/1544/labels{/name}","comments_url":"https://api.github.com/repos/KoffeinFlummi/AGM/issues/1544/comments","events_url":"https://api.github.com/repos/KoffeinFlummi/AGM/issues/1544/events","html_url":"https://github.com/KoffeinFlummi/AGM/issues/1544","id":48808216,"number":1544,"title":"Revamp grenade select","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},"labels":[{"url":"https://api.github.com/repos/KoffeinFlummi/AGM/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/KoffeinFlummi/AGM/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/KoffeinFlummi/AGM/milestones/2","labels_url":"https://api.github.com/repos/KoffeinFlummi/AGM/milestones/2/labels","id":614608,"number":2,"title":"Version 1.0","description":"","creator":{"login":"KoffeinFlummi","id":2438809,"avatar_url":"https://avatars.githubusercontent.com/u/2438809?v=3","gravatar_id":"","url":"https://api.github.com/users/KoffeinFlummi","html_url":"https://github.com/KoffeinFlummi","followers_url":"https://api.github.com/users/KoffeinFlummi/followers","following_url":"https://api.github.com/users/KoffeinFlummi/following{/other_user}","gists_url":"https://api.github.com/users/KoffeinFlummi/gists{/gist_id}","starred_url":"https://api.github.com/users/KoffeinFlummi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KoffeinFlummi/subscriptions","organizations_url":"https://api.github.com/users/KoffeinFlummi/orgs","repos_url":"https://api.github.com/users/KoffeinFlummi/repos","events_url":"https://api.github.com/users/KoffeinFlummi/events{/privacy}","received_events_url":"https://api.github.com/users/KoffeinFlummi/received_events","type":"User","site_admin":false},"open_issues":61,"closed_issues":131,"state":"open","created_at":"2014-03-30T20:47:21Z","updated_at":"2015-01-09T00:56:02Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2014-11-14T16:21:54Z","updated_at":"2015-01-09T00:56:02Z","closed_at":"2015-01-09T00:56:02Z","body":"I did some more testing with this and I think this can be further improved.\r\n\r\nAny grenade can be thrown, regardless wheter the muzzle is selected or not using:\r\n```\r\n_player = call AGM_Core_fnc_player;\r\n_id = ...;\r\n\r\n_logic = createGroup sideLogic createUnit [\"Logic\", [0,0,0], [], 0, \"NONE\"];\r\n_logic action [\"useWeapon\", _player, _player, _id];\r\n```\r\n\r\nThe ids can be found by mapping using a loop:\r\n```\r\n_player = call AGM_Core_fnc_player;\r\n_muzzleIDs = [];\r\n\r\n_statePrev = [\"\",\"\",\"\",\"\",0];\r\n\r\n_index = -1;\r\nwhile {_index < 100} do {\r\n  _index = _index + 1;\r\n  _player action [\"SwitchWeapon\", _player, _player, _index];\r\n\r\n  _state = weaponState _player;\r\n  _stateToAdd = + _state;\r\n\r\n  if (_state isEqualTo _statePrev) then {\r\n    _stateToAdd = [\"@todo assumed missing muzzle\"];\r\n  };\r\n\r\n  if (_stateToAdd isEqualTo [\"\",\"\",\"\",\"\",0]) exitWith {};\r\n  _muzzleIDs pushBack _stateToAdd;\r\n  _statePrev = _state;\r\n};\r\n_muzzleIDs\r\n```\r\n\r\nThe IDs change everytime a weapon or grenade is picked up. Some grenades might be skipped using this method, as for some reason, the weaponState falls back to the previous index if a grenade of this type was picked up once before. Because the order of these ids doesn't change and is config based, the holes can be assumed.\r\n\r\nQuickly check if a mag is present:\r\n`player ammo \"HandGrenadeMuzzle\" > 0`\r\nMight need some expanding for those muzzles with more than one magazine.\r\n\r\nThe real currently selected grenade can be read by getText'ing the weapons info huds rsc element.\r\n`ctrlText ((uiNamespace getVariable \"AGM_dlgSoldier\") displayCtrl 152)`\r\n"},"comment":{"url":"https://api.github.com/repos/KoffeinFlummi/AGM/issues/comments/69277786","html_url":"https://github.com/KoffeinFlummi/AGM/issues/1544#issuecomment-69277786","issue_url":"https://api.github.com/repos/KoffeinFlummi/AGM/issues/1544","id":69277786,"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},"created_at":"2015-01-09T00:56:02Z","updated_at":"2015-01-09T00:56:02Z","body":"Engine limitaion. If someone has another idea, open another issue."}}