Skip to content

Commit

Permalink
Progressively smaller bite sizes when fuller, max calorie cap
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
caligari87 committed Jun 29, 2018
1 parent 10f2a9c commit 591ee4f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hdscav_zscript/hunger/messkit.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,15 @@ class HDScav_MessKit : HDWoundFixer {

//Takes a random-sized "bite" of the food
action void HDScav_TakeScoop() {
invoker.tracker = HDScav_HungerTracker(FindInventory("HDScav_HungerTracker", false));
if(invoker.tracker.calories >= 2500) {
if(getcvar("hd_helptext")) { A_WeaponMessage("You're full.\nCouldn't eat another bite.", 175); }
return;
}
double difference = clamp(2500 - invoker.tracker.calories, 0, 500);
A_PlaySound("HDScav/FoodScoop", CHAN_AUTO, frandom(0.3, 0.6));
invoker.biteSize = min(invoker.mealsize, 75) * frandom(0.75,1.0);
invoker.biteSize *= frandom(0.75,1.0);
invoker.biteSize = min(invoker.mealsize, 75) * frandom(0.75,1.0);;
invoker.biteSize *= (difference / 500.0);
invoker.biteSize = clamp(invoker.biteSize, 1, 75);
}

Expand Down

0 comments on commit 591ee4f

Please sign in to comment.