generic light #127

Parent #108Owner #36Flags read, fertileSource RPG Core/rpgcore-patched.db

Aliases: generic light, light

6 verbs · 33 properties · 1 children

Verbs

VerbSpecFlagsDefinerLines
turn switchany any anyrd#12722
_ignitethis none thisrxd#12718
titlethis none thisrxd#12713
light ignite extinguish killthis none nonerxd#12718
init_for_corethis none thisrxd#1278
replicatethis none thisrxd#1275

Properties

PropertyDefinerFlagsOwnerValue
light_on#127rc#360
power_units#127rc#363
burn_task#127r#362095205351
rechargable#127rc#360
shows_units#127rc#361
turn_on_msg#127rc#36"%N %<ignites> %p light."
turn_off_msg#127rc#36"%N %<extinguishes> %p light."
returning#108rc#36<clear>
how_long#108rc#36<clear>
been_told#108rc#36<clear>
home#108rc#36<clear>
child_limit#108rc#368
recycle_at_death#108rc#36<clear>
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#361
y_loc#102r#360
ansi_title#102r#36<clear>
obvious#102r#36<clear>
build_help#102rc#36
list of 8{"@set these properties:", " .power_units => integer, one per 10-minute interval", " 1 = 10 min.; 2 = 20 mins.; 3 = 30 mins.; etc.", " .recycle_at_death => 0 or 1", " .shows_units => 0 or 1", "MESSAGES:", "@turn_on light is \"____\" (sets .turn_on_msg)", "@turn_off light is \"____\" (sets .turn_off_msg)"}
key#1c#360
aliases#1rc#36{"generic light", "light"}
description#1rc#36<clear>
object_size#1r#36{5561, -1090650497}
html#1rc#36<clear>

Ancestry

Ancestors (nearest first): #108 generic replicating & returning thing#5 generic thing#102 subthing#1 Root Class

Children: #156 a torch

Call graph

calls n127_0 #127:turn n6_18 #6:tell n127_0->n6_18 n1_4 #1:titlec n127_0->n1_4 n127_1 #127:_ignite n127_0->n127_1 n35_1 #35:say_action n127_0->n35_1 n99_4 #99:valid_task n127_0->n99_4 n127_1->n1_4 n127_1->n99_4 n99_17 #99:schedule n127_1->n99_17 n52_5 #52:isa n127_1->n52_5 n63_1 #63:_recycle n127_1->n63_1 n127_2 #127:title n102_4 #102:title n127_2->n102_4 n127_3 #127:light n127_3->n6_18 n127_3->n1_4 n127_3->n127_1 n127_3->n35_1 n127_3->n99_4 n127_4 #127:init_for_core n108_4 #108:init_for_core n127_4->n108_4 n127_5 #127:replicate n108_2 #108:replicate n127_5->n108_2

Source

turn switch

Spec any any anyFlags rdOwner #2Definer #127

Referenced by

none

Source

1if ((this in {iobj, dobj}) && (prepstr in {"on", "off"}))
2if (prepstr == "on")
3if (this.light_on)
4player:tell(this:titlec(), " is already shining.");
5else
6this:_ignite();
7$you:say_action(this.turn_on_msg);
8endif
9else
10if (!this.light_on)
11player:tell(this:titlec(), " is already off.");
12else
13if ($scheduler:valid_task(this.burn_task))
14$scheduler:kill_task(this.burn_task);
15endif
16this.light_on = 0;
17$you:say_action(this.turn_off_msg);
18endif
19endif
20else
21player:tell("That doesn't seem to work.");
22endif

_ignite

Spec this none thisFlags rxdOwner #2Definer #127

Referenced by

Source

1"Burns a power_unit every 15 minutes.";
2if ($scheduler:valid_task(this.burn_task))
3$scheduler:kill_task(this.burn_task);
4endif
5this.power_units = this.power_units - 1;
6if (this.power_units > -1)
7this.light_on = 1;
8return this.burn_task = $scheduler:schedule(600, this, "_ignite");
9elseif (is_player(this.location))
10this.location.location:announce_all(this:titlec(), " goes dark.");
11elseif ($object_utils:isa(this.location, $room))
12this.location:announce_all(this:titlec(), " goes dark.");
13endif
14this.light_on = 0;
15if (this.rechargable || this.f)
16return;
17endif
18$recycler:_recycle(this);

title

Spec this none thisFlags rxdOwner #36Definer #127

Referenced by

none

Source

1if (!this.shows_units)
2return pass(@args);
3else
4title = pass(@args);
5if (is_player(this.location) && this.shows_units)
6onoff = this.light_on ? "ON: " | "OFF: ";
7blurb = this.power_units ? tostr(onoff, "energy < ", this.power_units * 10, " min.") | "dead";
8else
9blurb = this.light_on ? "on" | "off";
10endif
11title = tostr(title, "(", blurb, ")");
12return title;
13endif

light ignite extinguish kill

Spec this none noneFlags rxdOwner #2Definer #127

Referenced by

none

Source

1if (verb in {"light", "ignite"})
2if (this.light_on)
3player:tell(this:titlec(), " is already shining.");
4else
5this:_ignite();
6$you:say_action(this.turn_on_msg);
7endif
8else
9if (!this.light_on)
10player:tell(this:titlec(), " is already off.");
11else
12if ($scheduler:valid_task(this.burn_task))
13$scheduler:kill_task(this.burn_task);
14endif
15this.light_on = 0;
16$you:say_action(this.turn_off_msg);
17endif
18endif

init_for_core

Spec this none thisFlags rxdOwner #2Definer #127

Referenced by

none

Source

1if (caller_perms().wizard)
2if (this == $subthing)
3this.burn_task = 0;
4this.rechargable = 0;
5this.power_units = 30;
6endif
7return pass(@args);
8endif

replicate

Spec this none thisFlags rxdOwner #2Definer #127

Referenced by

none

Source

1newone = pass(@args);
2if (valid(newone))
3newone.light_on = 0;
4endif
5return newone;