{"action":"created","issue":{"url":"https://api.github.com/repos/minetest/minetest_game/issues/855","repository_url":"https://api.github.com/repos/minetest/minetest_game","labels_url":"https://api.github.com/repos/minetest/minetest_game/issues/855/labels{/name}","comments_url":"https://api.github.com/repos/minetest/minetest_game/issues/855/comments","events_url":"https://api.github.com/repos/minetest/minetest_game/issues/855/events","html_url":"https://github.com/minetest/minetest_game/pull/855","id":133905594,"number":855,"title":"Hunger.","user":{"login":"sofar","id":1880041,"avatar_url":"https://avatars.githubusercontent.com/u/1880041?v=3","gravatar_id":"","url":"https://api.github.com/users/sofar","html_url":"https://github.com/sofar","followers_url":"https://api.github.com/users/sofar/followers","following_url":"https://api.github.com/users/sofar/following{/other_user}","gists_url":"https://api.github.com/users/sofar/gists{/gist_id}","starred_url":"https://api.github.com/users/sofar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofar/subscriptions","organizations_url":"https://api.github.com/users/sofar/orgs","repos_url":"https://api.github.com/users/sofar/repos","events_url":"https://api.github.com/users/sofar/events{/privacy}","received_events_url":"https://api.github.com/users/sofar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-16T07:25:58Z","updated_at":"2016-02-16T16:49:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/minetest/minetest_game/pulls/855","html_url":"https://github.com/minetest/minetest_game/pull/855","diff_url":"https://github.com/minetest/minetest_game/pull/855.diff","patch_url":"https://github.com/minetest/minetest_game/pull/855.patch"},"body":"This code adds hunger to minetest_game.\r\n\r\nThis code is entirely derived from Blockmen's hunger+hud mod.  Credits\r\nand copyright are preserved as they are compatible with minetest_game.\r\n\r\ngameplay:\r\n\r\nThe player stat 'hunger' is added. The higher the value, the better. A\r\nvalue of 5 or higher causes the player to slowly get healed over time,\r\nat the cost of hunger. One can only be healed if the hunger value is\r\nhigher than, or equal to the health value.\r\n\r\nEating food causes 'hunger' to increase. The visual range of hunger\r\nis 0-20, but one can eat up to 30 hunger. If the hunger is at max,\r\nitems are not eaten anymore.\r\n\r\nAt hunger 2 or lower, the player is damaged periodically, and will\r\ndie if the hunger value isn't increased due to eating.\r\n\r\nIf eating a food that has a negative hp_change value, such as red\r\nmushrooms, the player takes periodical damage to the amount of the\r\nhp_change value. During this time, the player is \"poisoned\". This\r\npoison damage can not kill the player.\r\n\r\ncode:\r\n\r\nThis mod started as BlockMen's hunger+hud mod. I trimmed the entire\r\nhud mod away and placed the hunger bar on top of the hp hud element,\r\nwhich will make the relation between hunger and hp a bit more clear,\r\nand doesn't require moving the air hud element.\r\n\r\nThe hunger mod was reduced to fit a single file. I trimmed some\r\nlegacy code, revised all local/global usage. Renamed most internal\r\nvariables, and generally did a lot of removals of needlessly complex\r\ncode favoring simplicity.\r\n\r\nThe food registration code is entirely removed. Instead we assume food\r\njust adds hunger or ticks damage as poison. Food eating callbacks are\r\nstill called. Subsequently, this mod will likely not properly work\r\nwith BlockMen's hud code anymore, nor is that intended to work. Food\r\nmods just have to call item_eat().\r\n\r\nI've moved and credited authors for the used textures. I replaced\r\nthe food sound of this mod with 3 different sounds.\r\n\r\nThe code points out several issues with core: There's no decent\r\nplace to store player stats. This mod solves it by creating a per\r\nplayer inventory purely for storing an integer value. Intercepting\r\ncore.do_item_eat() also isn't the nicest way to make this work."},"comment":{"url":"https://api.github.com/repos/minetest/minetest_game/issues/comments/184764773","html_url":"https://github.com/minetest/minetest_game/pull/855#issuecomment-184764773","issue_url":"https://api.github.com/repos/minetest/minetest_game/issues/855","id":184764773,"user":{"login":"PilzAdam","id":2159710,"avatar_url":"https://avatars.githubusercontent.com/u/2159710?v=3","gravatar_id":"","url":"https://api.github.com/users/PilzAdam","html_url":"https://github.com/PilzAdam","followers_url":"https://api.github.com/users/PilzAdam/followers","following_url":"https://api.github.com/users/PilzAdam/following{/other_user}","gists_url":"https://api.github.com/users/PilzAdam/gists{/gist_id}","starred_url":"https://api.github.com/users/PilzAdam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PilzAdam/subscriptions","organizations_url":"https://api.github.com/users/PilzAdam/orgs","repos_url":"https://api.github.com/users/PilzAdam/repos","events_url":"https://api.github.com/users/PilzAdam/events{/privacy}","received_events_url":"https://api.github.com/users/PilzAdam/received_events","type":"User","site_admin":false},"created_at":"2016-02-16T16:49:16Z","updated_at":"2016-02-16T16:49:16Z","body":"> Eating food causes 'hunger' to increase.\r\n\r\nThis doesn't sound right-\r\n\r\n> The visual range of hunger is 0-20, but one can eat up to 30 hunger. If the hunger is at max,\r\nitems are not eaten anymore.\r\n\r\nWhy? Whats the benefit from hiding this?"}}