{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14949","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14949/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14949/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14949/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/14949","id":128192156,"number":14949,"title":"Reload using magazines","user":{"login":"mugling","id":12238606,"avatar_url":"https://avatars.githubusercontent.com/u/12238606?v=3","gravatar_id":"","url":"https://api.github.com/users/mugling","html_url":"https://github.com/mugling","followers_url":"https://api.github.com/users/mugling/followers","following_url":"https://api.github.com/users/mugling/following{/other_user}","gists_url":"https://api.github.com/users/mugling/gists{/gist_id}","starred_url":"https://api.github.com/users/mugling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mugling/subscriptions","organizations_url":"https://api.github.com/users/mugling/orgs","repos_url":"https://api.github.com/users/mugling/repos","events_url":"https://api.github.com/users/mugling/events{/privacy}","received_events_url":"https://api.github.com/users/mugling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":32,"created_at":"2016-01-22T16:29:00Z","updated_at":"2016-01-22T21:42:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/14949","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/14949","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/14949.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/14949.patch"},"body":"This PR replaces #14799 and provides a working implementation of magazines. The AR-15 is used as the demonstration item and is reloaded using STANAG magazines. The same code is shared between guns and tools which should hopefully aid the implementation of  #14797 and similar.\r\n\r\nIt cannot be excluded that some bugs remain within this PR so I'd like to focus on ensuring the implementation is sound rather than adding features so the forum could be a better place for discussion as to the latter.\r\n\r\nImplementation details:\r\n\r\n* Adds a magazine itype (identical to that from #14799) specifying ammo type and capacity.\r\n\r\n* Magazines store their ammunition in `item::contents`\r\n\r\n* Non-rigid magazines increase in volume proportional to loaded ammo (similar to non-rigid containers)\r\n\r\n* Tools and gunmods can also be reloaded using magazines\r\n\r\n* Reloadable items do **not** inherit flags from loaded magazines (similar to how auxiliary gunmods work)\r\n\r\n* Compatible magazines (if any) are loaded from the JSON field `magazines` and stored in  `std::set<itype_id> magazines`\r\n\r\n* Items without any compatible magazines are assumed to have an integral magazine (`item::magazine_integral() == true`) and their load/unload mechanics are unchanged\r\n\r\n* Items accepting detachable magazines store them in `item::contents`\r\n\r\n* By design the implementation supports inserting empty magazines into compatible tools/guns\r\n\r\n* The `spare_mag` gunmod remains functional but is intended for deprecation\r\n\r\n* Vehicle turret code remains functional for items with integral magazines but will require extension **if** we want this to work with detachable magazines (questionable necessity, separate PR in any case).\r\n\r\nOutstanding questions:\r\n\r\n* ~~Should specifying compatible magazines be restricted to tools/guns or allowed for all items?~~\r\n\r\n* ~~Can we aim to deprecate the `magazines` gunmod location entirely and concentrate on expanding this implementation?~~\r\n\r\n* How to handle ammo conversion mods"},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/174059803","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/14949#issuecomment-174059803","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14949","id":174059803,"user":{"login":"DeadLeaves","id":614677,"avatar_url":"https://avatars.githubusercontent.com/u/614677?v=3","gravatar_id":"","url":"https://api.github.com/users/DeadLeaves","html_url":"https://github.com/DeadLeaves","followers_url":"https://api.github.com/users/DeadLeaves/followers","following_url":"https://api.github.com/users/DeadLeaves/following{/other_user}","gists_url":"https://api.github.com/users/DeadLeaves/gists{/gist_id}","starred_url":"https://api.github.com/users/DeadLeaves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DeadLeaves/subscriptions","organizations_url":"https://api.github.com/users/DeadLeaves/orgs","repos_url":"https://api.github.com/users/DeadLeaves/repos","events_url":"https://api.github.com/users/DeadLeaves/events{/privacy}","received_events_url":"https://api.github.com/users/DeadLeaves/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T21:42:05Z","updated_at":"2016-01-22T21:42:05Z","body":"> This implementation provides enough variety to be interesting (integral magazines, detachable magazines, ammo belts etc) without being overly complex. \r\n\r\nExcept that it won't be as interesting if there is only 1 magazine type per weapon, then this turns into just another step you have to perform to use a gun. All it would do it turn ``reload gun -> shoot`` into ``reload magazine -> reload gun -> shoot``. Whereas having multiple different magazines with different weight/bullet ratios, different sizes, durability, reload times etc would allow for interesting decision making\r\n\r\n> Time is unfortunately always finite so whilst I can't implement everything everyone wants hopefully this will be a marked improvement over what we have now.\r\n\r\nWhile I totally respect the time you put into this and the decision you end up doing. Time is however also finite for anyone who wishes to expand upon this, and I feel it would be extremely discouraging for anyone to find out you might have to go through a massive amount of weapons just to make their new magazine work (17 different .223 weapons in mainline, 14 different 9mm etc.) when it could simply be a single line in the magazine json.\r\n\r\nRegardless of what you end up doing, I want you to know I'm a massive supporter of this change. \r\n"}}