Recycling Center #63
Aliases: Recycling Center, Center
18 verbs · 25 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
_recreate | this none this | rxd | #63 | 15 |
_recycle | this none this | rxd | #63 | 19 |
_create | this none this | rxd | #63 | 7 |
addhist | this none this | rxd | #63 | 7 |
show*-history | this none none | rxd | #63 | 9 |
request | any out of/from inside/from this | rd | #63 | 28 |
setup_toad | this none this | rxd | #63 | 20 |
add_orphan | this none this | rxd | #63 | 3 |
remove_orphan | this none this | rxd | #63 | 3 |
valid | this none this | rxd | #63 | 3 |
init_for_core | this none this | rxd | #63 | 6 |
resurrect | this none this | rxd | #63 | 16 |
reclaim_lost_souls | this none this | rxd | #63 | 14 |
look_self | this none this | rxd | #63 | 13 |
check_quota_scam | this none this | rxd | #63 | 32 |
gc | this none this | rxd | #63 | 5 |
moveto | this none this | rxd | #63 | 1 |
kill_all_tasks | this none this | rxd | #63 | 15 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
orphans | #63 | r | #36 | {} |
announce_removal_msg | #63 | rc | #36 | "" |
nhist | #63 | | #36 | 50 |
history | #63 | | #36 | {} |
lost_souls | #63 | rc | #36 | {} |
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 | <clear> |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Recycling Center", "Center"} |
description | #1 | rc | #36 | "Object reuse. Call $recycler:_create() to create an object (semantics the same as create()), $recycler:_recycle() to recycle an object. Will create a new object if nothing available in its contents. Note underscores, to avoid builtin :recycle() verb called when objects are recycled. Uses $building_utils:recreate() to prepare objects." |
object_size | #1 | r | #36 | {12896, -1090650497} |
html | #1 | rc | #36 | <clear> |
Ancestry
Ancestors (nearest first): #5 generic thing → #102 subthing → #1 Root Class
Children: none
Call graph
Source
_recreate
Referenced by
- #63:_create line 5:
this:_recreate
Source
1"Return a toad (child of #1, owned by $hacker) from this.contents. Move it to #-1. Recreate as a child of args[1], or of #1 if no args are given. Chown to caller_perms() or args[2] if present."; 2{?what = #1, ?who = caller_perms()} = args; 3if (!(caller_perms().wizard || (who == caller_perms()))) 4return E_PERM; 5elseif (!(valid(what) && is_player(who))) 6return E_INVARG; 7elseif ((((who != what.owner) && (!what.f)) && (!who.wizard)) && (!caller_perms().wizard)) 8return E_PERM; 9endif 10for potential in (this.contents) 11if (((potential.owner == $hacker) && (parent(potential) == $garbage)) && (!children(potential))) 12return this:setup_toad(potential, who, what); 13endif 14endfor 15return E_NONE;
_recycle
Referenced by
- #32:test_benchmark line 35:
$recycler:_recycle - #54:do_burn line 3:
$recycler:_recycle - #62:@destroy-demo line 10:
$recycler:_recycle - #63:resurrect line 9:
$recycler:_recycle - #71:fix_all_exits line 7:
$recycler:_recycle - #91:dump_goodies line 11:
$recycler:_recycle - #98:collect_orphans line 11:
$recycler:_recycle - #98:collect_orphans line 13:
$recycler:_recycle - #98:collect_orphans line 18:
$recycler:_recycle - #98:collect_orphans line 23:
$recycler:_recycle - #100:do_reap line 38:
$recycler:_recycle - #108:recycle_at_death line 2:
$recycler:_recycle - #113:combine line 17:
$recycler:_recycle - #115:g*et line 13:
$recycler:_recycle - #127:_ignite line 18:
$recycler:_recycle - #131:eat line 8:
$recycler:_recycle - #132:eat line 8:
$recycler:_recycle - #134:_clean_inv line 9:
$recycler:_recycle - #136:rot_away line 19:
$recycler:_recycle - #166:dr*op line 13:
$recycler:_recycle
Source
1"Take the object in args[1], and turn it into a child of #1 owned by $hacker."; 2"If the object is a player, decline."; 3item = args[1]; 4if (!$perm_utils:controls(caller_perms(), item)) 5raise(E_PERM); 6elseif (is_player(item)) 7raise(E_INVARG); 8endif 9this:addhist(caller_perms(), item); 10"...recreate can fail (:recycle can crash)..."; 11this:add_orphan(item); 12this:kill_all_tasks(item); 13$quota_utils:preliminary_reimburse_quota(item.owner, item); 14$building_utils:recreate(item, $garbage); 15this:remove_orphan(item); 16"..."; 17$wiz_utils:set_owner(item, $hacker); 18item.name = tostr("Recyclable ", item); 19`move(item, this) ! ANY => 0';
_create
Referenced by
- #32:test_benchmark line 4:
$recycler:_create - #80:bi_create line 5:
$recycler:_create - #91:dump_goodies line 31:
$recycler:_create - #91:transfer_ammo line 17:
$recycler:_create - #107:dump_goodies line 27:
$recycler:_create - #108:replicate line 22:
$recycler:_create - #126:@setup line 17:
$recycler:_create - #134:sell_product line 41:
$recycler:_create - #138:breed line 9:
$recycler:_create - #164:pr*ess line 33:
$recycler:_create - #164:pr*ess line 50:
$recycler:_create - #164:pr*ess line 62:
$recycler:_create - #164:pr*ess line 123:
$recycler:_create - #164:make_generic_corner line 6:
$recycler:_create - #164:make_park_exits line 8:
$recycler:_create - #164:make_park_exits line 17:
$recycler:_create - #164:make_park_exits line 29:
$recycler:_create - #164:make_park_exits line 38:
$recycler:_create - #164:make_park_exits line 50:
$recycler:_create - #164:make_park_exits line 59:
$recycler:_create - #164:make_park_exits line 71:
$recycler:_create - #164:make_park_exits line 80:
$recycler:_create - #164:make_park_exits line 92:
$recycler:_create - #164:make_park_exits line 101:
$recycler:_create - #164:make_park_exits line 113:
$recycler:_create - #164:make_park_exits line 122:
$recycler:_create - #164:make_park_exits line 134:
$recycler:_create - #164:make_park_exits line 143:
$recycler:_create - #164:make_park_exits line 155:
$recycler:_create - #164:make_park_exits line 164:
$recycler:_create - #165:dr*op line 22:
$recycler:_create
Source
1e = `set_task_perms(caller_perms()) ! ANY'; 2if (typeof(e) == ERR) 3return e; 4else 5val = this:_recreate(@args); 6return (val == E_NONE) ? $quota_utils:bi_create(@args) | val; 7endif
addhist
Referenced by
- #63:_recycle line 9:
this:addhist
Source
1if (caller == this) 2h = this.history; 3if ((len = length(h)) > this.nhist) 4h = h[len - this.nhist..len]; 5endif 6this.history = {@h, args}; 7endif
show*-history
Referenced by
none
Source
1if ($perm_utils:controls(valid(caller_perms()) ? caller_perms() | player, this)) 2for x in (this.history) 3pname = valid(x[1]) ? x[1].name | "A recycled player"; 4oname = valid(x[2]) ? x[2].name | "recycled"; 5player:notify(tostr(pname, " (", x[1], ") recycled ", x[2], " (now ", oname, ")")); 6endfor 7else 8player:tell("Sorry."); 9endif
request
Referenced by
none
Source
1"added check that obj is already $garbage - Bits 12/16/5"; 2if (!(caller_perms() in {player, #-1})) 3raise(E_PERM); 4endif 5dobj = valid(dobj) ? dobj | $string_utils:match_object(dobjstr, player.location); 6if (!valid(dobj)) 7dobj = (n = toint(dobjstr)) ? toobj(n) | #-1; 8endif 9if (!valid(dobj)) 10player:tell("Couldn't parse ", dobjstr, " as a valid object number."); 11elseif (!(dobj in this.contents)) 12player:tell("Couldn't find ", dobj, " in ", this.name, "."); 13elseif (!$object_utils:isa(dobj, $garbage)) 14player:tell("Sorry, that isn't recyclable."); 15elseif ($object_utils:has_callable_verb(this, "request_refused") && (msg = this:request_refused(player, dobj))) 16player:tell("Sorry, can't do that: ", msg); 17else 18if (typeof(emsg = this:setup_toad(dobj, player, $root_class)) != ERR) 19dobj:moveto(player); 20dobj.aliases = {dobj.name = "Object " + tostr(dobj)}; 21player:tell("You now have ", dobj, " ready for @recreation."); 22if (this.announce_removal_msg) 23player.location:announce($string_utils:pronoun_sub(this.announce_removal_msg)); 24endif 25else 26player:tell(emsg); 27endif 28endif
setup_toad
Referenced by
- #63:_recreate line 12:
this:setup_toad - #63:request line 18:
this:setup_toad
Source
1"this:setup_toad(objnum,new_owner,parent)"; 2"Called by :_create and :request."; 3if (caller != this) 4return E_PERM; 5endif 6{potential, who, what} = args; 7if (!$quota_utils:creation_permitted(who)) 8return E_QUOTA; 9else 10$wiz_utils:set_owner(potential, who); 11move(potential, #-1); 12set_task_perms({@callers(), {#-1, "", player}}[2][3]); 13"... if :initialize crashes..."; 14this:add_orphan(potential); 15$building_utils:recreate(potential, what); 16this:remove_orphan(potential); 17"... if we don't get this far, the object stays on the orphan list..."; 18"... orphan list should be checked periodically..."; 19return potential; 20endif
add_orphan
Referenced by
- #63:_recycle line 11:
this:add_orphan - #63:setup_toad line 14:
this:add_orphan
Source
1if (caller == this) 2this.orphans = setadd(this.orphans, args[1]); 3endif
remove_orphan
Referenced by
- #63:_recycle line 15:
this:remove_orphan - #63:setup_toad line 16:
this:remove_orphan
Source
1if (caller == this) 2this.orphans = setremove(this.orphans, args[1]); 3endif
valid
Referenced by
- #6:my_huh line 16:
$recycler:valid - #6:gc_gaglist line 5:
recycler:valid - #21:object_audit_string line 4:
$recycler:valid - #21:do_audit line 33:
$recycler:valid - #50:match_object line 3:
$recycler:valid - #59:set_property_value line 9:
$recycler:valid - #71:replace line 8:
$recycler:valid - #71:replace line 8:
$recycler:valid - #90:ping_features line 6:
$recycler:valid - #99:add line 7:
$recycler:valid
Source
1"Usage: valid(object)"; 2"True if object is valid and not $garbage."; 3return valid(args[1]) && (parent(args[1]) != $garbage);
init_for_core
Referenced by
none
Source
1if (caller_perms().wizard) 2this.orphans = {}; 3this.history = {}; 4this.lost_souls = {}; 5pass(); 6endif
resurrect
Referenced by
none
Source
1who = caller_perms(); 2if (!valid(parent = {@args, $garbage}[1])) 3return E_INVARG; 4elseif (!who.wizard) 5return E_PERM; 6elseif (typeof(o = renumber($quota_utils:bi_create(parent, $hacker))) == ERR) 7"..death..."; 8elseif (parent == $garbage) 9$recycler:_recycle(o); 10else 11o.aliases = {o.name = tostr("Resurrectee ", o)}; 12$wiz_utils:set_owner(o, who); 13move(o, who); 14endif 15reset_max_object(); 16return o;
reclaim_lost_souls
Referenced by
none
Source
1if (!caller_perms().wizard) 2raise(E_PERM); 3endif 4fork (1800) 5this:(verb)(); 6endfork 7for x in (this.lost_souls) 8this.lost_souls = setremove(this.lost_souls, x); 9if ((valid(x) && (typeof(x.owner.owned_objects) == LIST)) && (!(x in x.owner.owned_objects))) 10x.owner.owned_objects = setadd(x.owner.owned_objects, x); 11$quota_utils:summarize_one_user(x.owner); 12endif 13(ticks_left() < 5000) && suspend(0); 14endfor
look_self
Referenced by
none
Source
1if (prepstr in {"in", "inside", "into"}) 2recycler = this; 3linelen = ((linelen = abs(player.linelen)) < 20) ? 78 | linelen; 4intercolumn_gap = 2; 5c_width = length(tostr(max_object())) + intercolumn_gap; 6n_columns = (linelen + (c_width - 1)) / c_width; 7things = $list_utils:sort_suspended(0, this.contents); 8header = tostr(this.name, " (", this, ") contains:"); 9player:tell_lines({header, @$string_utils:columnize_suspended(0, things, n_columns)}); 10else 11return pass(@args); 12endif 13"This code contributed by Mickey.";
check_quota_scam
Referenced by
- #80:creation_permitted line 10:
$recycler:check_quota_scam - #82:creation_permitted line 1:
$recycler:check_quota_scam
Source
1who = args[1]; 2if ($quota_utils.byte_based && (is_clear_property(who, "size_quota") || is_clear_property(who, "owned_objects"))) 3raise(E_QUOTA); 4endif 5cheater = 0; 6other_cheaters = {}; 7for x in (this.lost_souls) 8if (((valid(x) && ((owner = x.owner) != $hacker)) && (typeof(owner.owned_objects) == LIST)) && (!(x in owner.owned_objects))) 9if (owner == who) 10who.owned_objects = setadd(who.owned_objects, x); 11cheater = 1; 12else 13"it's someone else's quota scam we're detecting..."; 14other_cheaters = setadd(other_cheaters, owner); 15owner.owned_objects = setadd(owner.owned_objects, x); 16this.lost_souls = setremove(this.lost_souls, x); 17endif 18endif 19this.lost_souls = setremove(this.lost_souls, x); 20endfor 21if ($quota_utils.byte_based) 22if (cheater) 23$quota_utils:summarize_one_user(who); 24endif 25if (other_cheaters) 26fork (0) 27for x in (other_cheaters) 28$quota_utils:summarize_one_user(x); 29endfor 30endfork 31endif 32endif
gc
Referenced by
none
Source
1for x in (this.orphans) 2if ((!valid(x)) || ((x.owner != $hacker) && (x in x.owner.owned_objects))) 3this.orphans = setremove(this.orphans, x); 4endif 5endfor
moveto
Referenced by
none
Source
1pass(#-1);
kill_all_tasks
Referenced by
- #0:bf_recycle line 17:
$recycler:kill_all_tasks - #63:_recycle line 12:
this:kill_all_tasks
Source
1"kill_all_tasks ( object being recycled )"; 2" -- kill all tasks involving this now-recycled object"; 3((caller == this) || (caller == #0)) || raise(E_PERM); 4{object} = args; 5(typeof(object) == OBJ) || raise(E_INVARG); 6fork (0) 7for t in (queued_tasks()) 8for c in (`task_stack(t[1]) ! E_INVARG => {}') 9if (object in c) 10kill_task(t[1]); 11continue t; 12endif 13endfor 14endfor 15endfork