{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13902","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13902/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13902/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13902/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13902","id":115294131,"number":13902,"title":"[WiP][CR]Make monsters and NPCs regen outside bubble","user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-11-05T14:26:18Z","updated_at":"2015-11-08T01:17:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13902","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13902","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13902.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13902.patch"},"body":"`monster` and `npc` classes get following new members:\r\n* `last_updated`\r\n* `on_unload` - currently only resets the above. Later on it may cache some extra info, for example NPC could cache that there's a nearby bed\r\n* `on_load` - updates the critter according to difference between `last_updated` and `calendar::turn`\r\n\r\nCurrently only makes monsters regenerate when loaded. This regeneration first checks quick regeneration (shoggoth), then revival, finally critter's material (flesh and veggy heals). The best of those is selected.\r\nRegeneration works at full speed offscreen, zeds regen ~1 hp per hour, fleshy and veggy stuff ~1 hp per 4 hours.\r\n\r\n[CR] because healing rates for non-regenerating stuff may need adjustments and because zombies may also want to heal lost speed.\r\n\r\n[WiP] because I'd like to add sleeping NPC regen (including tiredness removal) here too."},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/154768948","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13902#issuecomment-154768948","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13902","id":154768948,"user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"created_at":"2015-11-08T01:17:44Z","updated_at":"2015-11-08T01:17:44Z","body":"Thanks for the review.\r\n\r\nAdded a test to compare retroactive vs. turn-by-turn. Currently looks like retroactive isn't perfect, but I'd say it's good enough of an approximation for NPC-only stuff.\r\n\r\nHacked around retroactively updated sleeping NPCs. This is a minor hack, which very weakly affects the player: a sleeping player who gets the \"you feel well rested\" will wake up a tiny bit sooner after that than expected (after 2 minutes from \"well rested\" rather than 3-5 minutes).\r\n\r\nActivating debug mode before loading critters will say how long were they \"away\" and in case of monsters how much did they regen.\r\n\r\nNPC retroactive update is capped at 2 days and processed in 30 minute intervals, then 5 minute ones (with the last 30 minute one being divided into 6*5 minutes), the single turns.\r\n\r\nEffect decay (for stuff like asking NPCs for equipment and for sleep) postponed because too huge PR."}}