Recycling Center #63

Parent #5Owner #36Flags readSource QuestCore.db

Aliases: Recycling Center, Center

18 verbs · 24 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
_recreatethis none thisrxd#6315
_recyclethis none thisrxd#6319
_createthis none thisrxd#637
addhistthis none thisrxd#637
show*-historythis none nonerxd#639
requestany out of/from inside/from thisrd#6328
setup_toadthis none thisrxd#6320
add_orphanthis none thisrxd#633
remove_orphanthis none thisrxd#633
validthis none thisrxd#633
init_for_corethis none thisrxd#636
resurrectthis none thisrxd#6316
reclaim_lost_soulsthis none thisrxd#6314
look_selfthis none thisrxd#6313
check_quota_scamthis none thisrxd#6332
gcthis none thisrxd#635
movetothis none thisrxd#631
kill_all_tasksthis none thisrxd#6315

Properties

PropertyDefinerFlagsOwnerValue
orphans#63r#36{}
announce_removal_msg#63rc#36""
nhist#63#3650
history#63#36
list of 52{{#2, #866}, {#2, #970}, {#2, #188}, {#2, #189}, {#2, #190}, {#2, #187}, {#2, #198}, {#2, #477}, {#2, #542}, {#2, #591}, {#2, #608}, {#2, #601}, {#2, #597}, {#2, #965}, {#2, #723}, {#2, #753}, {#2, #627}, {#2, #791}, {#2, #616}, {#2, #738}, {#2, #454}, {#2, #816}, {#2, #840}, {#2, #826}, {#2, #549}, {#2, #790}, {#2, #819}, {#2, #724}, {#2, #368}, {#2, #437}, {#2, #495}, {#2, #491}, {#2, #745}, {#2, #986}, {#2, #196}, {#2, #1028}, {#2, #660}, {#2, #557}, {#2, #564}, {#2, #564}, {#2, #615}, {#2, #652}, {#2, #653}, {#2, #654}, {#2, #659}, {#2, #272}, {#2, #393}, {#2, #365}, {#2, #467}, {#2, #757}, {#2, #234}, {#2, #578}}
lost_souls#63rc#36{}
drop_failed_msg#5rc#36<clear>
drop_succeeded_msg#5rc#36<clear>
odrop_failed_msg#5rc#36<clear>
odrop_succeeded_msg#5rc#36<clear>
otake_succeeded_msg#5rc#36<clear>
otake_failed_msg#5rc#36<clear>
take_succeeded_msg#5rc#36<clear>
take_failed_msg#5rc#36<clear>
value_base#102r#2<clear>
damage_base#102r#2<clear>
x_loc#102r#36<clear>
y_loc#102r#36<clear>
ansi_title#102r#36<clear>
obvious#102r#36<clear>
build_help#102rc#36<clear>
key#1c#36<clear>
aliases#1rc#36{"Recycling Center", "Center"}
description#1rc#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#1r#36{12896, -1090650497}

Ancestry

Ancestors (nearest first): #5 generic thing#102 subthing#1 Root Class

Children: none

Call graph

calls n63_0 #63:_recreate n63_6 #63:setup_toad n63_0->n63_6 n63_7 #63:add_orphan n63_6->n63_7 n21_2 #21:recreate n63_6->n21_2 n63_8 #63:remove_orphan n63_6->n63_8 n24_2 #24:set_owner n63_6->n24_2 n80_7 #80:creation_permitted n63_6->n80_7 n63_1 #63:_recycle n42_0 #42:controls n63_1->n42_0 n63_3 #63:addhist n63_1->n63_3 n63_1->n63_7 n63_17 #63:kill_all_tasks n63_1->n63_17 n80_17 #80:preliminary_reimburse_quota n63_1->n80_17 n63_1->n21_2 n63_1->n63_8 n63_1->n24_2 n63_2 #63:_create n63_2->n63_0 n80_3 #80:bi_create n63_2->n80_3 n63_4 #63:show*-history n63_4->n42_0 n6_10 #6:notify n63_4->n6_10 n6_18 #6:tell n63_4->n6_18 n63_5 #63:request n63_5->n63_6 n63_5->n6_18 n20_19 #20:match_object n63_5->n20_19 n52_5 #52:isa n63_5->n52_5 n52_3 #52:has_callable_verb n63_5->n52_3 n20_34 #20:pronoun_sub n63_5->n20_34 n63_10 #63:init_for_core n102_1 #102:init_for_core n63_10->n102_1 n63_11 #63:resurrect n63_11->n63_1 n63_11->n24_2 n63_11->n80_3 n63_12 #63:reclaim_lost_souls n80_21 #80:summarize_one_user n63_12->n80_21 n63_13 #63:look_self n55_15 #55:sort_suspended n63_13->n55_15 n6_79 #6:tell_lines n63_13->n6_79 n20_60 #20:columnize_suspended n63_13->n20_60 n1_10 #1:look_self n63_13->n1_10 n63_14 #63:check_quota_scam n63_14->n80_21 n63_16 #63:moveto n5_2 #5:moveto n63_16->n5_2

Source

_recreate

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none noneFlags rxdOwner #2Definer #63

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

Spec any out of/from inside/from thisFlags rdOwner #2Definer #63

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none thisFlags rxdOwner #36Definer #63

Referenced by

Source

1if (caller == this)
2this.orphans = setadd(this.orphans, args[1]);
3endif

remove_orphan

Spec this none thisFlags rxdOwner #36Definer #63

Referenced by

Source

1if (caller == this)
2this.orphans = setremove(this.orphans, args[1]);
3endif

valid

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

none

Source

1if (caller_perms().wizard)
2this.orphans = {};
3this.history = {};
4this.lost_souls = {};
5pass();
6endif

resurrect

Spec this none thisFlags rxdOwner #2Definer #63

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

Spec this none thisFlags rxdOwner #2Definer #63

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

Spec this none thisFlags rxdOwner #36Definer #63

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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

Spec this none thisFlags rxdOwner #36Definer #63

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

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

none

Source

1pass(#-1);

kill_all_tasks

Spec this none thisFlags rxdOwner #2Definer #63

Referenced by

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