generic container #54
Aliases: generic container
29 verbs · 62 properties · 6 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
weight | this none this | rxd | #54 | 9 |
acceptable | this none this | rxd | #54 | 11 |
look_self | this none this | rxd | #54 | 7 |
open | this none none | rxd | #54 | 13 |
locked | this none this | rxd | #54 | 1 |
close | this none none | rxd | #54 | 13 |
tell_appraise | this none this | rxd | #54 | 22 |
description | this none this | rxd | #54 | 5 |
tell_contents_backup | this none this | rxd | #54 | 11 |
broadcast_noise broadcast_sound | this none this | rxd | #54 | 11 |
get_from | this none this | rxd | #54 | 7 |
put_into | this none this | rxd | #54 | 7 |
cant_get_from | this none this | rxd | #54 | 19 |
exitfunc | this none this | rxd | #54 | 11 |
enterfunc | this none this | rxd | #54 | 11 |
match_backup | this none this | rxd | #54 | 1 |
tell_contents | this none this | rxd | #54 | 32 |
tell_contents_sub | this none this | rxd | #54 | 62 |
contents_value | this none this | rxd | #54 | 8 |
can_glob | this none this | rxd | #54 | 4 |
cant_put_into | this none this | rxd | #54 | 11 |
clean | any out of/from inside/from this | rxd | #54 | 24 |
match_contents | this none this | rxd | #54 | 2 |
make_noise | this none this | rxd | #54 | 2 |
count | any in/inside/into this | rxd | #54 | 50 |
_break | this none this | rxd | #54 | 32 |
peek | this none none | rxd | #54 | 15 |
old_count this none this | this none this | rxd | #54 | 17 |
set_plural_name | this none this | rxd | #54 | 5 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
capacity | #54 | rc | #29 | 10000 |
weight_reduction | #54 | rc | #29 | 0.6 |
opaque | #54 | rc | #29 | 1 |
dark | #54 | rc | #29 | 0 |
close_msg | #54 | rc | #29 | "%DN closes %dl." |
open_msg | #54 | rc | #29 | "%N opens %dl." |
remove_msg | #54 | rc | #29 | "%DN gets %it from %dl." |
put_msg | #54 | rc | #29 | "" |
empty_msg | #54 | rc | #29 | "You don't find anything in %dt." |
contents_msg | #54 | rc | #29 | "In %dt you find:" |
open_fail_msg | #54 | rc | #29 | "%N struggles to pry open %tl, but it seems to be locked." |
put_fail_msg | #54 | rc | #29 | "%N tries to shove %t into %l, but it won't fit." |
closed_msg | #54 | rc | #29 | "It's closed." |
closable | #54 | rc | #29 | 1 |
open | #54 | rwc | #29 | 0 |
get_from_msg | #54 | rc | #29 | "" |
max_objects | #54 | rc | #29 | 100 |
spill_on_break | #54 | rc | #29 | 1 |
peek_msg | #54 | rc | #29 | "%DN opens %dt and peeks inside." |
clean_start_msg | #54 | rc | #29 | "You begin scrubbing %dt inside of %dl." |
oclean_start_msg | #54 | rc | #29 | "%DN starts scrubbing %dt inside of %dl." |
clean_finish_msg | #54 | rc | #29 | "You brush your hands off. You cleaned %dt out of %dl." |
oclean_finish_msg | #54 | rc | #29 | "%DN brushes off %p hands." |
break_msg | #255 | rc | #29 | "%DT breaks open, spilling %tp contents all over the ground." |
repair_difficulty | #255 | rc | #29 | <clear> |
junk_on_break | #255 | rc | #29 | 0 |
rename_on_break | #255 | rc | #29 | <clear> |
smashable | #255 | rc | #29 | 0 |
repairable | #255 | rc | #29 | <clear> |
armor | #255 | rc | #29 | <clear> |
held_break_msg | #255 | rc | #29 | "Your %t breaks open, spilling %tp contents all over the ground." |
oheld_break_msg | #255 | rc | #29 | "%DN's %t breaks open, spilling %tp contents all over the ground." |
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 | "" |
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 | list of 8{"weight,weight in grams (500g = 1 lb),100", "value,dollar value,0", "description,description", "weight_reduction,what factor to reduce an object's weight by when in the container,0.75", "capacity,how many grams will it hold,10000", "opaque,can we see what's inside when it's closed?,1", "dark,can we see what's inside when it's open?,0", "closable,can it be closed?,1"} |
health | #5 | rc | #29 | 20 |
health_max | #5 | rc | #29 | <clear> |
min_skill | #5 | rc | #29 | <clear> |
skill | #5 | rc | #29 | <clear> |
recipe_for | #5 | rc | #29 | <clear> |
carried_msg | #5 | rc | #29 | <clear> |
aliases | #1 | rc | #29 | {"generic container"} |
description | #1 | rc | #29 | "A container." |
object_size | #1 | r | #29 | {22295, 1298433816} |
hidden_verbs | #1 | rc | #29 | list of 12{"hold", "stow", "@setup", "throw", "give", "junk", "appraise", "stash", "feed", "breakdown", "count", "clean"} |
phelp_msg | #1 | rc | #29 | list of 1{"It's a container. You can 'open <container>', 'close <container>', 'look <container>', 'get <something> from <container>', or 'put <something> in <container>'."} |
weight | #1 | rc | #29 | <clear> |
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): #255 generic smashable thing → #5 generic thing → #1 root
Children: #105 pattern file, #147 generic workbench, #178 stashed items, #188 generic globbing container, #366 pattern file, #367 furnace
Call graph
Showing 48 of 60 verbs; 12 not shown.
Source
weight
Referenced by
- #54:acceptable line 11:
this:weight - #147:weight line 4:
pass(
Source
1if (this.weight < 0) 2return -1; 3endif 4weight = 0; 5for x in (this.contents) 6weight = weight + toint(`x:weight() ! ANY => 0 && $nets.prognet:announce(player, "broken :weight for " + $su:nn(x), 1)'); 7$cu:sin(0); 8endfor 9return toint(tofloat(weight) * this.weight_reduction) + this.weight;
acceptable
Referenced by
none
Source
1what = args[1]; 2if (is_a(what, $lock)) 3return 1; 4endif 5if ((is_a(what, $container) && (this.weight > 0)) && (this.weight < 50000)) 6return 0; 7endif 8if (length(this.contents) > 250) 9return 0; 10endif 11return ((this:weight() - this.weight) + what:weight()) < this.capacity;
look_self
Referenced by
- #54:peek line 7:
this:look_self - #146:look_self line 1:
pass( - #367:look_self line 1:
pass(
Source
1pass(@args); 2if (this.open || (!this.opaque)) 3if (this:tell_contents() == 0) 4" player:tell($su:ps(this.empty_msg));"; 5endif 6endif 7$lu:map_verb(occupants(this, $decal), "tell_person", this);
open
Referenced by
Source
1if (this:locked()) 2player:aat($su:ps(this.open_fail_msg, player, this, this)); 3elseif (this.open) 4player:tell(this:dnamec(), " is already open."); 5else 6this.open = 1; 7if (this.location == player) 8player:client_tell("#$#inventory"); 9player:client_tell("open #", toint(this)); 10player:client_tell("#$#/inventory"); 11endif 12player:aat($su:ps(this.open_msg, player, this, this)); 13endif
locked
Referenced by
Source
1return 0;
close
Referenced by
- #367:close line 1:
pass(
Source
1if (!this.closable) 2player:tell("You can't close ", this:dname(), "."); 3elseif (!this.open) 4player:tell(this:dnamec(), " is already closed."); 5else 6if (this.location == player) 7player:client_tell("#$#inventory"); 8player:client_tell("close #", toint(this)); 9player:client_tell("#$#/inventory"); 10endif 11this.open = 0; 12player:aat($su:ps(this.close_msg, player, this, this)); 13endif
tell_appraise
Referenced by
none
Source
1roll = args[1]; 2pass(@args); 3if (roll > 0) 4player:tell("It can hold about ", this.capacity / 1000, "kg."); 5wr = 1.0 - this.weight_reduction; 6wr = toint(wr * 10.0); 7player:tell("It seems ", {"barely", "somewhat", "quite", "very", "extremely"}[min(5, max(1, wr))], " efficient for carrying heavy loads."); 8endif 9if (roll > 1) 10val = this:contents_value(); 11if (val > 0) 12var = max(1, val / (3 + roll)); 13val = val + (random(var) - (var / 2)); 14val = max(1, val); 15if (val > 1000) 16val = (val / 100) * 100; 17elseif (val > 100) 18val = (val / 10) * 10; 19endif 20player:tell(("You think its contents might fetch about $" + tostr(val)) + " on the market."); 21endif 22endif
description
Referenced by
- #147:look_self line 1:
this:description
Source
1d = (typeof(d = pass(@args)) == LIST) ? d | {d}; 2if ((!this.open) && this.closed_msg) 3d[$] = (d[$] + " ") + $su:ps(this.closed_msg, this, this); 4endif 5return d;
tell_contents_backup
Referenced by
none
Source
1"Copied from generic container (#931):tell_contents by Gilmore (#98) Fri Apr 2 01:51:47 2004 PST"; 2if (this.open || (!this.opaque)) 3if (this.dark || (!this.contents)) 4if (m = this.empty_msg) 5player:tell($su:ps(this.empty_msg, player, this, this)); 6endif 7else 8contents = $su:english_list($lu:map_verb(this.contents, "iname")); 9player:tell($su:ps(strsub(this.contents_msg, "%t", contents), player, this, this)); 10endif 11endif
broadcast_noise broadcast_sound
Referenced by
none
Source
1":broadcast_noise(STR noise-message, INT volume[, INT noiseid, OBJ sourceexit])"; 2msg = args[1]; 3volume = args[2]; 4sourceexit = (length(args) > 3) ? args[4] | #-1; 5noiseid = (length(args) > 2) ? args[3] | random(9999999); 6volume = min(volume, 7); 7volume = max(volume, -4); 8sd = {"faint", "faint", "faint", "distant", "muffled", "muffled", "loud", "loud", "loud", "deafening", "deafening", "deafening"}[volume + 5]; 9if (is_a(this.location, $room)) 10this.location:broadcast_noise(msg, volume, noiseid, this); 11endif
get_from
Referenced by
none
Source
1who = args[1]; 2targets = (typeof(args[2]) == LIST) ? $lu:randomly_permute(args[2]) | {args[2]}; 3if (this.open) 4who:queue_action($actions.get, {targets, this, {}}, 1, "get from " + this.name); 5else 6return E_INVARG; 7endif
put_into
Referenced by
none
Source
1who = args[1]; 2targets = (typeof(args[2]) == LIST) ? $lu:randomly_permute(args[2]) | {args[2]}; 3if (this.open) 4who:queue_action($actions.put, {targets, this, {}}, 1, "put into " + this.name); 5else 6return E_INVARG; 7endif
cant_get_from
Referenced by
none
Source
1getter = args[1]; 2targets = args[2]; 3if (typeof(targets) != LIST) 4targets = {targets}; 5endif 6if (!this.contents) 7return this:dname() + " is empty"; 8elseif (!this.open) 9return this:dname() + " isn't open"; 10endif 11for x in (targets) 12if (!(x in this.contents)) 13targets = setremove(targets, x); 14endif 15endfor 16if (!targets) 17return "that's not in " + this:dname(); 18endif 19return 0;
exitfunc
Referenced by
- #178:exitfunc line 26:
pass(
Source
1what = args[1]; 2location = this; 3while (valid(location)) 4location = location.location; 5if (is_a(location, $player) && location.client) 6location:client_tell("#$#inventory"); 7$client:tell_inv_rm(location, what); 8location:client_tell("#$#/inventory"); 9break; 10endif 11endwhile
enterfunc
Referenced by
none
Source
1what = args[1]; 2location = this; 3while (valid(location)) 4location = location.location; 5if (is_a(location, $player) && location.client) 6location:client_tell("#$#inventory"); 7$client:tell_inv_add(location, what); 8location:client_tell("#$#/inventory"); 9break; 10endif 11endwhile
match_backup
Referenced by
none
Source
1return $match_utils:match(args[1], this:contents());
tell_contents
Referenced by
- #54:look_self line 3:
this:tell_contents - #54:peek line 11:
this:tell_contents - #147:look_self line 7:
this:tell_contents
Source
1{?c = this.contents} = args; 2names = {@$iu:pluralsc(), "Misc"}; 3show_nonthings = 0; 4if (is_a(player, $prog)) 5names = {@names, "Non-things"}; 6show_nonthings = 1; 7nonthings = {}; 8endif 9things = {}; 10count = 0; 11for x in (c) 12if (!is_a(x, $thing)) 13if (show_nonthings && (!is_a(x, $decal))) 14nonthings = {@nonthings, x}; 15count = count + 1; 16endif 17else 18things = {@things, x}; 19count = count + 1; 20endif 21endfor 22buckets = $iu:group_by_type(things); 23if (show_nonthings) 24buckets = {@buckets, nonthings}; 25endif 26for x in [1..length(buckets)] 27if (buckets[x]) 28player:tell($ansi.bold_on, names[x], ":", $ansi.reset); 29this:tell_contents_sub(buckets[x]); 30endif 31endfor 32return count;
tell_contents_sub
Referenced by
- #54:tell_contents line 29:
this:tell_contents_sub - #146:tell_contents line 40:
this:tell_contents_sub
Source
1"Copied from generic container (#931):tell_contents by Satan (#2) Sat Jul 22 18:45:06 2006 PDT"; 2"Copied from generic player (#6):tell_contents by Satan (#2) Sat Jul 22 18:39:37 2006 PDT"; 3msg_db = {}; 4names = {}; 5if (args) 6things = args[1]; 7else 8things = this:contents(); 9endif 10for x in (things) 11if (is_a(x, $decal)) 12things = setremove(things, x); 13endif 14endfor 15weights = player:check_pref("weights"); 16if (#594466 in $lu:slice(callers(), 1)) 17weights = 0; 18endif 19total_weight = 0; 20if (things) 21for x in (things) 22yield 1; 23added = 0; 24if (list_name = `x:list_name() ! ANY => 0') 25iname = list_name; 26else 27iname = x:iname(); 28endif 29if (weights) 30iname = ((((iname + $ansi.cyan) + " [") + $su:english_weight_short(weight = x:weight())) + "]") + $ansi.reset; 31total_weight = total_weight + weight; 32endif 33if (msg_db) 34for y in [1..length(msg_db)] 35if (msg_db[y][2] == iname) 36msg_db[y][3] = msg_db[y][3] + 1; 37msg_db[y][1] = setadd(msg_db[y][1], x); 38added = 1; 39endif 40endfor 41endif 42if (!added) 43msg_db = setadd(msg_db, {{x}, iname, 1}); 44endif 45endfor 46for x in (msg_db) 47if (x[3] > 1) 48name = ($string_utils:aggregate_number(x[3]) + " ") + x[1][1]:plural_name(); 49if (weights) 50wt = 0; 51for z in (x[1]) 52wt = wt + z:weight(); 53endfor 54name = ((((name + $ansi.cyan) + " [") + $su:english_weight_short(wt)) + "]") + $ansi.reset; 55endif 56else 57name = x[2]; 58endif 59names = {@names, name}; 60endfor 61player:tell_item_list(names); 62endif
contents_value
Referenced by
- #54:tell_appraise line 10:
this:contents_value
Source
1"Copied from generic container (#931):weight by Gilmore (#98) Sun Aug 13 21:08:11 2006 PDT"; 2val = 0; 3for x in (this.contents) 4if (is_a(x, $thing)) 5val = val + x:value(); 6endif 7endfor 8return val;
can_glob
Referenced by
none
Source
1if (this.contents) 2return 0; 3endif 4return pass(@args);
cant_put_into
Referenced by
none
Source
1what = args[1]; 2who = args[2]; 3if (!this.open) 4return "it's closed"; 5elseif (length(this.contents) >= this.max_objects) 6return "it's full"; 7elseif (this.health <= 0) 8return "it's far too broken"; 9elseif (what == this) 10return "that's just crazy"; 11endif
clean
Referenced by
none
Source
1"Clean dirt or grime from the container."; 2decals = args[1]; 3thing = $match_utils:match(decals, this.contents); 4if (!valid(thing)) 5player:tell("There isn't any of that in ", this:dname(), "."); 6return; 7elseif (!is_a(thing, $decal)) 8player:tell("The ", thing.name, " isn't dirt or grime. It's possible that the ", this.name, " is clean."); 9return; 10else 11player:tell($su:ps(this.clean_start_msg, player, thing, this)); 12player.location:announce($su:ps(this.oclean_start_msg, player, thing, this)); 13suspend(4); 14player:tell($su:ps(this.clean_finish_msg, player, thing, this)); 15player.location:announce($su:ps(this.oclean_finish_msg, player, thing, this)); 16r = random(4); 17if (r == 4) 18suspend(2); 19player:tell("Ugh. You got some ", thing.name, " on yourself!"); 20thing:moveto(player); 21else 22$rpg:junk(thing); 23endif 24endif
match_contents
Referenced by
none
Source
1s = args[1]; 2return $mu:match(s, this.contents);
make_noise
Referenced by
none
Source
1":broadcast_noise(OBJ noise, OBJ source[, LIST params, INT volume, INT noiseid, OBJ sourceexit])"; 2this:room():make_noise(@args);
count
Referenced by
none
Source
1"Copied from stuffzzzzzzz (#487387):count by Mada (#299353) Mon Mar 1 21:21:11 2010 CST"; 2if ((!this.open) && this.opaque) 3player:tell("It's not open."); 4return; 5endif 6matches = {}; 7for candidate in ({@this.contents}) 8if (((((valid(match = $mu:match(dobjstr, {candidate})) && match:name()) && (!`match:is_hidden(player) ! E_VERBNF => 0')) && (!is_a(match, $exit))) && (match != player)) && (!is_a(match, $decal))) 9matches = {@matches, match}; 10endif 11endfor 12cats = $lu:remove_duplicates($lu:map_verb(matches, "name")); 13can_glob = is_a(this, #216254); 14forstr = {}; 15for cat in (cats) 16howmany = 0; 17for candidate in (matches) 18if (candidate:name() == cat) 19globcheck = can_glob && is_a(candidate, $glob); 20if (!howmany) 21if (globcheck) 22generic = candidate.item; 23else 24parent = parent(candidate); 25generic = (parent:name() == candidate:name()) ? parent | candidate; 26endif 27endif 28howmany = howmany + (globcheck ? candidate.amount | 1); 29endif 30yield; 31endfor 32if ((howmany == 1) && `generic.long_name_msg ! E_PROPNF => ""') 33cat = generic.long_name_msg; 34endif 35if (is_a(generic, $player) || (!howmany)) 36pref = ""; 37else 38pref = $su:english_number(howmany) + " "; 39endif 40forstr = {@forstr, pref + ((howmany > 1) ? generic:plural_name() | cat)}; 41endfor 42locstr = (this.location == player) ? "your" | "the"; 43if (!forstr) 44player:tell("You don't see any '", dobjstr, "' in ", this:dname(), " to count."); 45return; 46elseif (length(forstr) > 1) 47forstr[$] = "and " + forstr[$]; 48endif 49thelist = (length(forstr) == 2) ? (forstr[1] + " ") + forstr[2] | $su:from_list(forstr, ", "); 50player:tell("Searching for \"", dobjstr, "\" in ", locstr, " ", this:name(), " you find ", thelist, ".");
_break
Referenced by
- #146:_break line 1:
pass(
Source
1if (this.spill_on_break) 2room_left = (`this.location.max_objects ! E_PROPNF => 100000' - length(this.location:occupants(#1))) + this.junk_on_break; 3occupants = this:occupants(#1); 4if (length(occupants) > room_left) 5excess = occupants[max(0, room_left) + 1..$]; 6else 7excess = {}; 8endif 9if (is_a(this.location, $creature)) 10dest = this:room(); 11else 12dest = this.location; 13endif 14if (room_left && occupants) 15for what in (occupants[1..min(room_left, length(occupants))]) 16what:moveto(dest); 17endfor 18endif 19if (this.junk_on_break) 20for what in (excess) 21what:moveto(dest); 22endfor 23fork (0) 24for what in (excess) 25if (is_a(what, #1)) 26$rpg:junk(what); 27endif 28endfor 29endfork 30endif 31endif 32pass(@args);
peek
Referenced by
none
Source
1"Peek inside without bothering to open it."; 2if (this:locked()) 3player:tell("It's locked, you can't just peek in!"); 4return; 5endif 6if (this.open) 7this:look_self(); 8return; 9else 10player.location:announce_all($su:ps(this.peek_msg, player, this)); 11this:tell_contents(); 12if (!this.contents) 13player:tell("Huh. It's empty."); 14endif 15endif
old_count this none this
Referenced by
none
Source
1"Copied from generic container (#931):count by MARViN (#241405) Mon Mar 1 21:20:43 2010 CST"; 2if (!this.open) 3player:tell("It's not open."); 4return; 5endif 6target = $match_utils:match(dobjstr, this.contents); 7if ((!$recycler:valid(target)) || is_a(target, $decal)) 8player:tell("You don't see any '", dobjstr, "' in ", this:dname(), " to count."); 9return; 10endif 11if (is_a(target, $glob)) 12parent = target.item; 13else 14parent = parent(target); 15endif 16howmany = length(this:occupants(parent)); 17player:tell("You count ", $su:english_number(howmany), " ", (howmany > 1) ? parent:plural_name() | parent.name, ".");
set_plural_name
Referenced by
none
Source
1"Copied from generic container (#931):set_name by Satan (#2) Tue May 25 14:41:49 2010 CDT"; 2"Copied from door (#170):set_name by Satan (#2) Sat Aug 19 12:00:14 2006 PDT"; 3"set_name(newname) attempts to change this.name to newname"; 4" => E_PERM if you don't own this or aren't its parent, or are a player trying to do an end-run around $player_db..."; 5return (typeof(e = `this.plural_name = args[1] ! ANY') != ERR) || e;