{"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":17,"created_at":"2016-01-22T16:29:00Z","updated_at":"2016-01-22T19:14:37Z","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/174015966","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/14949#issuecomment-174015966","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14949","id":174015966,"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},"created_at":"2016-01-22T19:14:36Z","updated_at":"2016-01-22T19:14:36Z","body":"@Coolthulhu The display could doubtlessly be improved but I'd hope it's sufficient for this PR?\r\n\r\n@DeadLeaves Ammo conversion mods are the major outstanding obstacles. What are the reasonable solutions?\r\n\r\n@kevingranade So if we make no breaking changes in this PR and then address item transmogrification in the next?\r\n"}}