generic recipe #145
Aliases: generic recipe, recipe
12 verbs · 46 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
tell_components | this none this | rxd | #145 | 16 |
look_self | this none this | rxd | #145 | 43 |
discovered_by | this none this | rxd | #145 | 4 |
tree_tag | this none this | rxd | #145 | 5 |
ingredient_value | this none this | rxd | #145 | 7 |
read | this none none | rxd | #145 | 1 |
find_ingredients | this none this | rxd | #145 | 42 |
xp_value | this none this | rxd | #145 | 14 |
validate | this none this | rxd | #145 | 20 |
recycle | this none this | rxd | #145 | 14 |
make_duration | this none this | rxd | #145 | 10 |
random_ingredient | this none this | rxd | #145 | 9 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
makes | #145 | rc | #29 | #-1 |
ingredients | #145 | rc | #29 | {} |
skill_required | #145 | rc | #29 | {} |
help_msg | #145 | rc | #29 | list of 13{"Instructions for making end-products out of component parts. Requires a $workbench to assemble or whatever.", "", "SEE ALSO: $workbench", "", "PROPERTIES", "$recipe.makes => OBJ product", "\t- The thing the recipe is for", "", "$recipe.ingredients => {{OBJ ingredient, INT quantity}, ...}", "\t- Constituent ingredients required for the $recipe", "", "$recipe.skill_required => {{STR skill, INT difficulty}, ...}", "\t-> Skills required to fulfill the $recipe."} |
researchable | #145 | rc | #29 | 1 |
discoverer | #145 | rc | #29 | #-1 |
reversible | #145 | rc | #29 | 1 |
player_owned | #145 | rc | #29 | 0 |
needs_bench | #145 | rc | #29 | #-1 |
make_msg | #145 | rc | #29 | "" |
makes_count | #145 | rc | #29 | 1 |
catalysts | #145 | rc | #29 | {} |
discoverers | #145 | rc | #29 | {} |
breakdown_ingredients | #145 | rc | #29 | {} |
continue_msg | #145 | rc | #29 | {"%DN works on %p %t.", "%DN attaches %il to %p %t.", "%DN adjusts %il on %dt."} |
time_mod | #145 | rc | #29 | 1.0 |
handed | #5 | rc | #29 | <clear> |
wield_msg | #5 | rc | #29 | <clear> |
unwield_msg | #5 | rc | #29 | <clear> |
size | #5 | rc | #29 | <clear> |
look_place_msg | #5 | rc | #29 | <clear> |
value | #5 | rc | #29 | <clear> |
get_msg | #5 | rc | #29 | <clear> |
drop_msg | #5 | rc | #29 | <clear> |
get_fail_msg | #5 | rc | #29 | <clear> |
junk_ok | #5 | rc | #29 | <clear> |
floats | #5 | rc | #29 | <clear> |
long_name_msg | #5 | rc | #29 | <clear> |
article | #5 | rc | #29 | <clear> |
setup_list | #5 | rc | #29 | <clear> |
health | #5 | rc | #29 | <clear> |
health_max | #5 | rc | #29 | <clear> |
min_skill | #5 | rc | #29 | <clear> |
skill | #5 | rc | #29 | #329 |
recipe_for | #5 | rc | #29 | <clear> |
carried_msg | #5 | rc | #29 | <clear> |
aliases | #1 | rc | #29 | {"generic recipe", "recipe"} |
description | #1 | rc | #29 | "A laminated sheet giving instructions and an ingredient list for making something." |
object_size | #1 | r | #29 | {9876, 1298433820} |
hidden_verbs | #1 | rc | #29 | <clear> |
phelp_msg | #1 | rc | #29 | {"This is a recipe for making a new item. However, it's not much use to you if you don't have the listed ingredients, plus an appropriate workbench."} |
weight | #1 | rc | #29 | 10 |
owner_verbs | #1 | rc | #29 | <clear> |
plural_name | #1 | rc | #29 | <clear> |
client_image | #1 | rc | #29 | <clear> |
listening | #1 | rc | #29 | <clear> |
Ancestry
Ancestors (nearest first): #5 generic thing → #1 root
Children: none
Call graph
Source
tell_components
Referenced by
- #145:look_self line 7:
this:tell_components - #145:look_self line 11:
this:tell_components
Source
1ing = ((args && (args[1] == "catalysts")) && this.catalysts) ? this.catalysts | this.ingredients; 2for ingredient in (ing) 3{ingredient, qty} = ingredient; 4n = (qty > 1) ? ingredient:plural_name() | ingredient:name(); 5if (index(n, "generic")) 6n = strsub(n, "generic ", ""); 7n = n + " (any kind)"; 8endif 9if (is_a(ingredient, $liquid)) 10player:tell($su:right(tostr(qty) + "u ", 5) + "of ", $su:left(ingredient:name(), 40)); 11elseif (qty > 1) 12player:tell($su:right(tostr(qty), 5), " - ", $su:left(n, 40)); 13else 14player:tell($su:right(tostr(qty), 5), " - ", $su:left(n, 40)); 15endif 16endfor
look_self
Referenced by
- #145:read line 1:
this:look_self
Source
1pass(@args); 2if (valid(this.makes)) 3m = (this.makes_count > 1) ? ($su:english_number(this.makes_count) + " ") + this.makes:plural_name() | this.makes:iname(); 4player:tell("It tells you how to make ", m, " with the following components:"); 5endif 6if (this.ingredients) 7this:tell_components(); 8endif 9if (this.catalysts) 10player:tell("You will also need the following catalysts: "); 11this:tell_components("catalysts"); 12endif 13ss = {}; 14for x in (this.skill_required) 15skill = (typeof(x[1]) == OBJ) ? x[1].name | x[1]; 16mod = x[2]; 17if (mod < -10) 18m = "a complete mastery of"; 19elseif (mod < -8) 20m = "massive expertise in"; 21elseif (mod < -6) 22m = "serious expertise in"; 23elseif (mod < -4) 24m = "expertise in"; 25elseif (mod < -2) 26m = "good familiarity with"; 27elseif (mod < 0) 28m = "decent familiarity with"; 29elseif (mod < 2) 30m = "some familiarity with"; 31else 32m = "a little knowledge of"; 33endif 34s = (m + " ") + skill; 35ss = {@ss, s}; 36endfor 37player:tell("Making this would take ", $su:english_list(ss), "."); 38if (valid(this.needs_bench)) 39player:tell("You realize you'd have to make this on ", this.needs_bench:iname(), "."); 40endif 41if (valid(this.discoverer)) 42player:tell((("In the upper right corner is a note: 'First discovered by " + this.doctor_msg) + this.discoverer.name) + ".'"); 43endif
discovered_by
Referenced by
none
Source
1who = args[1]; 2if (!is_a(this.discoverer, $creature)) 3this.discoverer = who; 4endif
tree_tag
Referenced by
none
Source
1r = pass(@args); 2if (this.researchable == 0) 3r = r + ((((" " + $ansi.red) + $ansi.bold_on) + "!research") + $ansi.reset); 4endif 5return r;
ingredient_value
Referenced by
none
Source
1v = 0; 2for x in (this.ingredients) 3if (is_a(x[1], $thing)) 4v = v + (x[1].value * x[2]); 5endif 6endfor 7return v;
read
Referenced by
none
Source
1this:look_self(player);
find_ingredients
Referenced by
none
Source
1"Return a list of items in 'where' this recipe will use to assemble."; 2"If a parent is not found, that parent is returned."; 3where = args[1]; 4cand = where.contents; 5ingredients = {}; 6for x in ({@this.ingredients, @this.catalysts}) 7c = (typeof(x) == LIST) ? x[2] | 1; 8parent = (typeof(x) == LIST) ? x[1] | x; 9if (is_a(parent, $liquid)) 10found = #-1; 11for y in (cand) 12yield; 13if (liq = y:occupants(parent)) 14if (liq[1].accumulation >= c) 15found = liq[1]; 16endif 17endif 18endfor 19if (!valid(found)) 20return parent; 21endif 22ingredients = setadd(ingredients, found); 23else 24for y in [1..c] 25yield; 26found = #-1; 27for z in (cand) 28if ((!valid(found)) && is_a(z, parent)) 29found = z; 30endif 31yield; 32endfor 33if (!valid(found)) 34return parent; 35endif 36cand = setremove(cand, found); 37ingredients = setadd(ingredients, found); 38endfor 39endif 40yield; 41endfor 42return ingredients;
xp_value
Referenced by
none
Source
1":xp_value(OBJ who) => value in XP when crafted by 'who'."; 2who = args[1]; 3if (!is_player(who)) 4return 0; 5endif 6base = this.xp_award; 7curve = $rpg.recipe_xp_curve; 8xp_total = who.xp_total - who:quest_xp(); 9xp_total = max(0, xp_total); 10if (xp_total > (xbase = base * curve)) 11extra = xp_total - xbase; 12base = base - (extra / $rpg.recipe_xp_drop); 13endif 14return max(0, base);
validate
Referenced by
none
Source
1ni = {}; 2for x in (this.ingredients) 3i = x[1]; 4if (!is_a(i, #1)) 5player:tell("FATAL: recycled ingredient"); 6return; 7elseif (!i.f) 8player:tell("FIXING: ", i:dname(), " not fertile -- changing to parent"); 9ni = {@ni, {parent(i), x[2]}}; 10else 11ni = {@ni, x}; 12endif 13endfor 14this.ingredients = ni; 15if (!valid(this.makes)) 16player:tell("You forgot to set .makes to something!"); 17elseif (!this.makes.f) 18player:tell(".makes is set to a non-fertile, you idiot."); 19endif 20player:tell("DONE");
recycle
Referenced by
none
Source
1if (this.f) 2for m in ($ou:leaves_suspended(#248098)) 3m.known_recipes = setremove(m.known_recipes, this); 4endfor 5for cookbook in ($ou:branches_suspended($cookbook)) 6if (is_a(this, cookbook.recipe_type)) 7for x in ($ou:leaves_suspended(cookbook)) 8x.pages = setremove(x.pages, this); 9yield; 10endfor 11endif 12endfor 13endif 14return pass(@args);
make_duration
Referenced by
none
Source
1parts = 0; 2for x in (this.ingredients) 3parts = parts + (x[2] * 3); 4endfor 5hard = 0; 6for x in (this.skill_required) 7hard = hard - (x[2] * 4); 8endfor 9d = (parts + hard) + 6; 10d = toint(tofloat(d) * this.time_mod);
random_ingredient
Referenced by
none
Source
1parts = this.ingredients; 2if (!parts) 3return #-1; 4endif 5part = parts[random($)][1]; 6while ((part.f && (index(part.name, "generic ") == 1)) && (c = children(part))) 7part = c[random($)]; 8endwhile 9return part;