21 lines
597 B
Plaintext
21 lines
597 B
Plaintext
// Generic food: nutrition and healing come from the item's `props` in items.rsn.
|
|
pub fn eat(ctx) {
|
|
if ctx.nutrition() >= 100 {
|
|
ctx.message("You are too full to eat.");
|
|
return false;
|
|
}
|
|
ctx.feed(ctx.item_prop("nutrition"));
|
|
let heal = ctx.item_prop("heal");
|
|
if heal > 0 {
|
|
ctx.heal(heal);
|
|
}
|
|
ctx.message("Delicious.");
|
|
}
|
|
|
|
pub fn sandwich_crafted(ctx) {
|
|
if ctx.skill_level("cooking") >= 3 && ctx.random(4) == 0 {
|
|
ctx.give_item("sandwich", 1);
|
|
ctx.message("Your cooking experience pays off: you made an extra sandwich!");
|
|
}
|
|
}
|