generic food and drink #131
Aliases: generic food and drink, gfad
3 verbs · 26 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
eat drink swallow consume | this none none | rd | #131 | 18 |
init_for_core | this none this | rxd | #131 | 16 |
title short_title | this none this | rxd | #131 | 15 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
units | #131 | rc | #36 | 1 |
solid | #131 | rc | #36 | 1 |
healing | #131 | rc | #36 | 0.1 |
heal_msg | #131 | rc | #36 | "" |
script | #131 | rc | #36 | {} |
help_msg | #113 | rc | #36 | "Edible items restore lost health eating or drinking them." |
been_told | #113 | r | #2 | <clear> |
drop_failed_msg | #5 | rc | #36 | <clear> |
drop_succeeded_msg | #5 | rc | #36 | <clear> |
odrop_failed_msg | #5 | rc | #36 | <clear> |
odrop_succeeded_msg | #5 | rc | #36 | <clear> |
otake_succeeded_msg | #5 | rc | #36 | <clear> |
otake_failed_msg | #5 | rc | #36 | <clear> |
take_succeeded_msg | #5 | rc | #36 | <clear> |
take_failed_msg | #5 | rc | #36 | <clear> |
value_base | #102 | r | #2 | <clear> |
damage_base | #102 | r | #2 | <clear> |
x_loc | #102 | r | #36 | <clear> |
y_loc | #102 | r | #36 | <clear> |
ansi_title | #102 | r | #36 | <clear> |
obvious | #102 | r | #36 | <clear> |
build_help | #102 | rc | #36 | list of 6{"This version of food will recombine with others of its type (ie. 6 fries + 6 fries = 12 fries).", "@set these properties:", "units => How many are available in the collective mass?", "solid => 1 (0 is liquid)", "healing => 0.1 is default.", "heal_msg => What is told to the player if noticible healing occurs."} |
key | #1 | c | #36 | 0 |
aliases | #1 | rc | #36 | {"generic food and drink", "gfad"} |
description | #1 | rc | #36 | <clear> |
object_size | #1 | r | #36 | {3974, -1090650497} |
Ancestry
Ancestors (nearest first): #113 generic collective thing → #5 generic thing → #102 subthing → #1 Root Class
Children: none
Call graph
Source
eat drink swallow consume
Referenced by
none
Source
1if (this.solid && (verb == "drink")) 2return player:tell("You can't drink a solid!"); 3elseif ((!this.solid) && (verb == "eat")) 4return player:tell("It is a liquid; you can drink it."); 5elseif (!this.units) 6player:tell("There is none left!"); 7if (!this.f) 8return $recycler:_recycle(this); 9endif 10endif 11$you:say_action(tostr("%N %<", verb, "s> ", this:short_title(), ".")); 12this.units = this.units - 1; 13if (player.stats_current[2][4] < player.stats[2][4]) 14player:take_health(this.healing); 15if (this.healing > 0.05) 16player:tell(this.heal_msg || "The nourishment makes you feel a bit better."); 17endif 18endif
init_for_core
Referenced by
none
Source
1if (caller_perms().wizard) 2if (this == $food1) 3this.build_help = {"This version of food will recombine with others of its type (ie. 6 fries + 6 fries = 12 fries).", "@set these properties:", "units => How many are available in the collective mass?", "solid => 1 (0 is liquid)", "healing => 0.1 is default.", "heal_msg => What is told to the player if noticible healing occurs."}; 4this.units = 1; 5this.solid = 1; 6this.healing = 0.1; 7this.heal_msg = ""; 8else 9for p in (properties($food1)) 10if ((!p) in {"build_help", "help_msg"}) 11clear_property(this, p); 12endif 13endfor 14endif 15return pass(@args); 16endif
title short_title
Referenced by
- #131:eat line 11:
this:short_title
Source
1name = this.name; 2if (verb == "short_title") 3if (`name[1..2] == "a " ! E_RANGE => 0') 4name = name[3..$]; 5elseif (`name[1..3] == "an " ! E_RANGE => 0') 6name = name[4..$]; 7endif 8endif 9title = valid(au = $ansi_utils) ? au:ansi_title(this, name) | name; 10if (this.solid) 11blurb = ""; 12blurb = this.units ? tostr(this.units) | "empty"; 13title = blurb ? tostr(name, "(", blurb, ")") | title; 14endif 15return title;