spawn stats tracker #283

Parent #5Owner #361Flags readSource hellcore/hellcore.db

Aliases: spawn stats tracker, stats, tracker, sst, plasma, screen

4 verbs · 35 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
watch_tellthis none thisrxd#28315
look_selfthis none thisrxd#28326
resetthis none nonerxd#28330
turnthis any nonerxd#28332

Properties

PropertyDefinerFlagsOwnerValue
show_top#283rc#36150
last_reset#283rc#3611271750258
watching#283rc#3610
resetting#283rc#3610
recycle_tracker#283rc#361#412149
handed#5rc#361<clear>
wield_msg#5rc#361<clear>
unwield_msg#5rc#361<clear>
size#5rc#361<clear>
look_place_msg#5rc#361"A small plasma screen, tracking spawn counts, is attached to the ceiling on a mounting bracket."
value#5rc#361<clear>
get_msg#5rc#361<clear>
drop_msg#5rc#361<clear>
get_fail_msg#5rc#361<clear>
junk_ok#5rc#361<clear>
floats#5rc#361<clear>
long_name_msg#5rc#361<clear>
article#5rc#361<clear>
setup_list#5rc#361<clear>
health#5rc#361<clear>
health_max#5rc#361<clear>
min_skill#5rc#361<clear>
skill#5rc#361<clear>
recipe_for#5rc#361<clear>
carried_msg#5rc#361<clear>
aliases#1rc#361{"spawn stats tracker", "stats", "tracker", "sst", "plasma", "screen"}
description#1rc#361"A small grey plasma screen, on a mounting bracket attached to the ceiling. A small button is flush with the lower bezel, and a short lever protrudes from the right side."
object_size#1r#29{5265, 1298434637}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#361<clear>
weight#1rwc#361-1
owner_verbs#1rc#361<clear>
plural_name#1rc#361<clear>
client_image#1rc#361<clear>
listening#1rc#361<clear>

Ancestry

Ancestors (nearest first): #5 generic thing#1 root

Children: none

Call graph

calls n283_1 #283:look_self n1_9 #1:look_self n283_1->n1_9 n107_43 #107:tell n283_1->n107_43 n48_8 #48:suspend_if_needed n283_1->n48_8 n47_24 #47:sort_alist_suspended n283_1->n47_24 n47_11 #47:reverse n283_1->n47_11 n20_2 #20:right n283_1->n20_2 n20_1 #20:left n283_1->n20_1 n20_59 #20:name_and_number n283_1->n20_59 n283_2 #283:reset n283_2->n107_43 n283_2->n48_8 n20_34 #20:pronoun_sub n283_2->n20_34 n283_3 #283:turn n283_3->n107_43 n283_3->n20_34

Source

watch_tell

Spec this none thisFlags rxdOwner #361Definer #283

Referenced by

Source

1":watch_tell(STR plusorminus, STR name, OBJ parent, [OBJ location])";
2if (!this.watching)
3return;
4endif
5{plusorminus, name, parent, ?loc = ""} = args;
6if (parent in {#-1, $garbage, $fossil})
7return;
8endif
9propname = tostr("_", parent);
10tracker = (plusorminus == "-") ? this.recycle_tracker | this;
11if (!`oldval = tracker.(propname) ! E_PROPNF => 0')
12add_property(tracker, propname, 1, {#7195, "r"});
13else
14tracker.(propname) = oldval + 1;
15endif

look_self

Spec this none thisFlags rxdOwner #361Definer #283

Referenced by

none

Source

1pass(@args);
2player:tell("");
3player:tell("Counts since ", ctime(this.last_reset), ":");
4player:tell("");
5propvals = {};
6for p in (properties(this))
7if (p[1] == "_")
8propvals = {@propvals, {toobj(p[2..$]), this.(p)}};
9endif
10$cu:sin(1, ($ansi.cyan + " [... Calculating ...]") + $ansi.reset);
11endfor
12showtop = min(this.show_top, length(propvals));
13player:tell(($ansi.cyan + " [ ... sorting sst list ... ] ") + $ansi.reset);
14propvals = $lu:sort_alist_suspended(1, propvals, 2)[$ - (showtop - 1)..$];
15propvals = $lu:reverse(propvals);
16rank = 0;
17for pv in (propvals)
18{parent, count} = pv;
19rank = rank + 1;
20rcount = `this.recycle_tracker.(tostr("_", parent)) ! E_PROPNF => 0';
21delta = count - rcount;
22delta = (delta > 0) ? tostr("+", delta) | tostr(delta);
23player:tell(" ", $ansi.yellow, $su:right(tostr(rank, ". "), 5), $su:left($ansi.bold_on + $su:nn(parent), -33), $su:right($ansi.green + tostr("+", count), 8), $su:right($ansi.red + tostr("-", rcount), 8), $su:right($ansi.white + delta, 8), $ansi.reset);
24$cu:sin();
25endfor
26player:tell("---");

reset

Spec this none noneFlags rxdOwner #361Definer #283

Referenced by

none

Source

1if (!player.wizard)
2player:tell("The lever won't budge.");
3return;
4endif
5if (this.watching)
6player:tell("The lever won't budge while the tracker is on.");
7return;
8endif
9if (this.resetting)
10player:tell("The lever is already down.");
11return;
12endif
13this.resetting = 1;
14this.location:announce_all($su:ps("%N reaches up and pulls down the lever on the side of %dt. Numbers begin to whir on the display."));
15this.last_reset = time();
16for p in (properties(this))
17if (p[1] == "_")
18delete_property(this, p);
19endif
20$cu:sin();
21endfor
22rtracker = this.recycle_tracker;
23for p in (properties(rtracker))
24if (p[1] == "_")
25delete_property(rtracker, p);
26endif
27$cu:sin();
28endfor
29this.location:announce_all($su:ps("The entries on %dt wink out, and the lever protruding from its side returns to its normal position."));
30this.resetting = 0;

turn

Spec this any noneFlags rxdOwner #361Definer #283

Referenced by

none

Source

1player:tell("The button doesn't work right now.");
2return;
3turn_on = 0;
4if (prepstr == "on")
5turn_on = 1;
6elseif (prepstr != "off")
7player:tell("Try 'turn ", dobjstr, " on' or 'turn ", dobjstr, " off'.");
8return;
9endif
10if (turn_on)
11if (this.watching)
12player:tell("It's already on.");
13return;
14elseif (this.resetting)
15player:tell("It won't turn on while it's resetting itself.");
16return;
17else
18this.watching = 1;
19$recycler.watchers = setadd($recycler.watchers, this);
20this.location:announce_all($su:ps("%N presses the button on the front of %dt. The numbers begin to update."));
21return;
22endif
23else
24if (!this.watching)
25player:tell("It's already off.");
26return;
27else
28this.watching = 0;
29$recycler.watchers = setremove($recycler.watchers, this);
30this.location:announce_all($su:ps("%N presses the button on the front of %dt, freezing the numbers displayed."));
31endif
32endif