{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14293","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14293/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14293/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14293/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/issues/14293","id":120273076,"number":14293,"title":"JSON Mapgen Suggestion","user":{"login":"vache","id":5648885,"avatar_url":"https://avatars.githubusercontent.com/u/5648885?v=3","gravatar_id":"","url":"https://api.github.com/users/vache","html_url":"https://github.com/vache","followers_url":"https://api.github.com/users/vache/followers","following_url":"https://api.github.com/users/vache/following{/other_user}","gists_url":"https://api.github.com/users/vache/gists{/gist_id}","starred_url":"https://api.github.com/users/vache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vache/subscriptions","organizations_url":"https://api.github.com/users/vache/orgs","repos_url":"https://api.github.com/users/vache/repos","events_url":"https://api.github.com/users/vache/events{/privacy}","received_events_url":"https://api.github.com/users/vache/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-03T21:23:50Z","updated_at":"2015-12-04T07:17:50Z","closed_at":null,"body":"It would be interesting if we could wrap some probability checks in JSON mapgen and group features together based on some random chance, something like:\r\n````\r\n\"chance\": {\r\n    \"one_in\": 4,\r\n    \"place_items\": [\r\n        { \"item\": \"tons_of_guns\", \"x\":3, \"y\":3, \"chance\":100 }\r\n    ],\r\n    \"place_furniture\": [\r\n        { \"furniture\": \"gun_safe_locked\", \"x\":3, \"y\":3 }\r\n    ]\r\n}\r\n````\r\nor\r\n````\r\n\"chance\" : {\r\n    \"x_in_y\": [ 3, 20],\r\n    \"place_monsters\": [\r\n         { \"monsters\": \"big_dog\", \"x\":10, \"y\":11 }\r\n    ],\r\n    \"place_furniture\": [\r\n        { \"furniture\" : \"dog_house\", \"x\":12, \"y\":9 }\r\n    ],\r\n    \"place_signage\": [\r\n        { \"signage\": \"Beware of Dog!\", \"x\":14, \"y\":14 }\r\n    ]\r\n}\r\n````\r\nThis way, we could let JSON mappers specify alternate features without having to create entirely new mapgens."},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/161896419","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/issues/14293#issuecomment-161896419","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/14293","id":161896419,"user":{"login":"sparr","id":121299,"avatar_url":"https://avatars.githubusercontent.com/u/121299?v=3","gravatar_id":"","url":"https://api.github.com/users/sparr","html_url":"https://github.com/sparr","followers_url":"https://api.github.com/users/sparr/followers","following_url":"https://api.github.com/users/sparr/following{/other_user}","gists_url":"https://api.github.com/users/sparr/gists{/gist_id}","starred_url":"https://api.github.com/users/sparr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparr/subscriptions","organizations_url":"https://api.github.com/users/sparr/orgs","repos_url":"https://api.github.com/users/sparr/repos","events_url":"https://api.github.com/users/sparr/events{/privacy}","received_events_url":"https://api.github.com/users/sparr/received_events","type":"User","site_admin":false},"created_at":"2015-12-04T07:17:50Z","updated_at":"2015-12-04T07:17:50Z","body":"There have been a few other discussions about this previously. The general approach to making this work would be to add functionality to the core Json data types (JsonObject, JsonArray, etc) that would perform the random weighting as soon as they are instanciated, so the randomness would be transparent to the functions reading the contents."}}