generic dispenser #129
Aliases: generic dispenser
12 verbs · 42 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
get | any out of/from inside/from this | rxd | #129 | 15 |
do_get | this none this | rxd | #129 | 14 |
put | any in/inside/into this | rxd | #129 | 27 |
do_put | this none this | rxd | #129 | 11 |
look_self | this none this | rxd | #129 | 6 |
weight | this none this | rxd | #129 | 4 |
set_remaining | this none this | rxd | #129 | 1 |
set_heartbeat_task | this none this | rxd | #129 | 1 |
value | this none this | rxd | #129 | 5 |
can_glob | this none this | rxd | #129 | 1 |
make_spawn | this none this | rxd | #129 | 2 |
reduce_by | this none this | rxd | #129 | 5 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
spawn | #129 | rc | #361 | #-1 |
remaining | #129 | rc | #361 | 24 |
holds | #129 | rc | #361 | 24 |
empty_msg | #129 | rc | #361 | "%DT appears to be empty." |
oget_from_msg | #129 | rc | #361 | "%N gets %id from %p %t." |
full_msg | #129 | rc | #361 | "%DT is already full." |
put_msg | #129 | rc | #361 | "You put %dd into %dt." |
oput_to_msg | #129 | rc | #361 | "%N puts %id into %p %t." |
get_from_msg | #129 | rc | #361 | "You get %id from %dt." |
put_to_msg | #129 | rc | #361 | "You put %id in %dt." |
help_msg | #129 | rc | #361 | list of 7{"$dispenser is an object that can be used as a container for like-typed objects. For example, a pack of cigarettes which contains twenty identical cigarettes. Instead of populating your pack with 20 objects ahead of time, this device will allow you to create them on the fly as players remove them from the container.", "It also allows you to put an object of that type back into the container, at which time the object is junked, but the number of things the container contains is incremented.", "", "Important properties:", "spawn -- the object this dispenser will create or junk", "holds -- how many of .spawn this dispenser can hold", "remaining -- host many of .spawn are left in the dispenser"} |
get_only | #129 | rc | #361 | 0 |
handed | #5 | rc | #361 | <clear> |
wield_msg | #5 | rc | #361 | <clear> |
unwield_msg | #5 | rc | #361 | <clear> |
size | #5 | rc | #361 | <clear> |
look_place_msg | #5 | rc | #361 | <clear> |
value | #5 | rc | #361 | <clear> |
get_msg | #5 | rc | #361 | <clear> |
drop_msg | #5 | rc | #361 | <clear> |
get_fail_msg | #5 | rc | #361 | <clear> |
junk_ok | #5 | rc | #361 | <clear> |
floats | #5 | rc | #361 | <clear> |
long_name_msg | #5 | rc | #361 | <clear> |
article | #5 | rc | #361 | <clear> |
setup_list | #5 | rc | #361 | <clear> |
health | #5 | rc | #361 | <clear> |
health_max | #5 | rc | #361 | <clear> |
min_skill | #5 | rc | #361 | <clear> |
skill | #5 | rc | #361 | <clear> |
recipe_for | #5 | rc | #361 | <clear> |
carried_msg | #5 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"generic dispenser"} |
description | #1 | rc | #361 | <clear> |
object_size | #1 | r | #29 | {8105, 1298433815} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #5 generic thing → #1 root
Children: none
Call graph
Source
get
Referenced by
none
Source
1if (!this.remaining) 2player:tell($su:ps(this.empty_msg)); 3return; 4elseif ((this.location != player) && (this.location != player.location)) 5player:tell("You can't get anything from ", this:dname(), " if you can't reach it!"); 6return; 7elseif (!valid(this.spawn)) 8player:tell(this:dnamec(), " doesn't seem to dispense anything."); 9return; 10endif 11if ($su:match(dobjstr, {this.spawn}, "name", {this.spawn}, "aliases") != this.spawn) 12player:tell(this:dnamec(), " doesn't have any \"", dobjstr, "\" in it."); 13return; 14endif 15this:do_get(player, this);
do_get
Referenced by
- #129:get line 15:
this:do_get
Source
1who = args[1]; 2if (this.remaining < 1) 3if (this.weight > 0) 4$rpg:junk(this); 5endif 6return 0; 7elseif ((this.location != who) && (this.location != who.location)) 8return 0; 9endif 10this.remaining = this.remaining - 1; 11spawn = this:make_spawn(); 12who:get_gift(spawn, this); 13who:tell($su:ps(this.get_from_msg, who, this, who.location, spawn, this)); 14who.location:announce_all_but({who}, $su:ps(this.oget_from_msg, who, this, who.location, spawn, this));
put
Referenced by
none
Source
1if (this.get_only) 2player:tell("What are you going to do, tape it back onto ", this:dname(), "?"); 3return; 4elseif (this.remaining == this.holds) 5player:tell($su:ps(this.full_msg, player, this, player.location)); 6return; 7elseif (!(this.location in {player, player.location})) 8player:tell("You can't put anything in ", this:dname(), " if you don't have it!"); 9return; 10elseif (!valid(this.spawn)) 11player:tell("It looks like ", this:dname(), " can't hold anything."); 12return; 13endif 14if (!valid(dobj)) 15dobj = $match_utils:match(dobjstr, {@player.contents}); 16endif 17if (!valid(dobj)) 18player:tell("You don't seem to have a \"", dobjstr, "\"."); 19return; 20elseif (dobj.location != player) 21player:tell("You don't have ", dobj:dname(), "."); 22return; 23elseif (!$ou:isa(dobj, this.spawn)) 24player:tell(this:dnamec(), " really wasn't made to hold ", dobj:dname(), "."); 25return; 26endif 27this:do_put(player, dobj);
do_put
Referenced by
- #129:put line 27:
this:do_put
Source
1who = args[1]; 2what = args[2]; 3if (!$ou:isa(what, this.spawn)) 4return 0; 5elseif (what.location != who) 6return 0; 7endif 8this.remaining = this.remaining + 1; 9who:tell($su:ps(this.put_to_msg, who, this, who.location, what, this)); 10who.location:announce_all_but({who}, $su:ps(this.oput_to_msg, who, this, who.location, what, this)); 11$rpg:junk(what);
look_self
Referenced by
none
Source
1pass(@args); 2if (this.remaining > 0) 3player:tell(this:dnamec(), " has ", $su:aggregate_number(this.remaining), " ", (this.remaining > 1) ? this.spawn:pname() | this.spawn:name(), " left."); 4else 5player:tell("It's empty."); 6endif
weight
Referenced by
none
Source
1if (this.weight == -1) 2return -1; 3endif 4return pass(@args) + (this.remaining * this.spawn:weight());
set_remaining
Referenced by
none
Source
1this.remaining = args[1];
set_heartbeat_task
Referenced by
none
Source
1return this.heartbeat_task = args[1];
value
Referenced by
none
Source
1if (this == this.spawn) 2return this.value; 3endif 4value = this.value + (this.remaining * this.spawn:value()); 5return value;
can_glob
Referenced by
none
Source
1return 0;
make_spawn
Referenced by
- #129:do_get line 11:
this:make_spawn
Source
1spawn = $rpg:spawn(this.spawn); 2return spawn;
reduce_by
Referenced by
none
Source
1amt = args[1]; 2this.remaining = this.remaining - amt; 3if ((this.remaining <= 0) && (this.weight > 0)) 4$rpg:junk(this); 5endif