generic device #115

Parent #5Owner #361Flags read, fertileSource hellcore/hellcore.db

Aliases: generic device, device

11 verbs · 42 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
fix repairthis any anyrxd#11513
turn switch turn1this any nonerxd#11521
take_damagethis none thisrxd#11518
_breakthis none thisrxd#1154
turn_onthis none thisrxd#1151
turn_offthis none thisrxd#1151
descriptionthis none thisrxd#11521
percent_functionalthis none thisrxd#1152
recyclethis none thisrxd#1152
turn turn2none any thisrd#1151
entombthis none thisrxd#1153

Properties

PropertyDefinerFlagsOwnerValue
on#115rc#3610
armor#115rc#361{}
break_msg#115rc#361"Something important sputters and explodes inside %dt."
on_msg#115rc#361"%N switches on %dt."
off_msg#115rc#361"%N switches off %dt."
repair_skill#115rc#361#332
damaged1_msg#115rc#361"It's awfully beat up, covered in dents and scratches."
damaged2_msg#115rc#361"It looks seriously damaged; a few protruding bits are broken off entirely."
damaged3_msg#115rc#361"It's been smashed; you question whether it works at all."
is_on_msg#115rc#361"It's turned on."
is_off_msg#115rc#361"It's turned off."
fix_start_msg#115rc#361"%N pops off the back of %dt and starts screwing around inside it."
handed#5rc#361<clear>
wield_msg#5rc#361<clear>
unwield_msg#5rc#361<clear>
size#5rc#361<clear>
look_place_msg#5rc#361<clear>
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{"generic device", "device"}
description#1rc#361"A curious metallic box studded with tiny recessed buttons and an indecipherable LCD display."
object_size#1r#29{6745, 1298433815}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#361<clear>
weight#1rc#361<clear>
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 n115_0 #115:fix n107_43 #107:tell n115_0->n107_43 n1_66 #1:announce_action_text n115_0->n1_66 n20_34 #20:pronoun_sub n115_0->n20_34 n1_31 #1:dname n115_0->n1_31 n115_1 #115:turn n115_1->n107_43 n115_1->n1_66 n115_1->n20_34 n115_1->n1_31 n115_4 #115:turn_on n115_1->n115_4 n115_5 #115:turn_off n115_1->n115_5 n115_2 #115:take_damage n115_3 #115:_break n115_2->n115_3 n115_3->n20_34 n115_3->n115_5 n115_6 #115:description n115_6->n20_34 n5_4 #5:description n115_6->n5_4 n115_7 #115:percent_functional n115_6->n115_7 n115_8 #115:recycle n115_8->n115_5 n5_8 #5:recycle n115_8->n5_8 n115_9 #115:turn n115_9->n115_1 n115_10 #115:entomb n115_10->n115_5 n5_30 #5:entomb n115_10->n5_30

Source

fix repair

Spec this any anyFlags rxdOwner #361Definer #115

Referenced by

none

Source

1if (this.health >= this.health_max)
2player:tell("It doesn't seem to be broken.");
3else
4player:announce_action_text($su:ps(this.fix_start_msg, player, this));
5suspend(3);
6check = this.repair_skill:check(player, -(this.health_max - this.health));
7if (check > 0)
8this.health = this.health + random(this.health_max);
9player:tell("After a few minutes' work, you're fairly sure you have it functioning again.");
10else
11player:tell("You curse to yourself, realizing that fixing ", this:dname(), " might be beyond your ability.");
12endif
13endif

turn switch turn1

Spec this any noneFlags rxdOwner #361Definer #115

Referenced by

Source

1if (prepstr == "on")
2if (this.on)
3player:tell("It's already on.");
4elseif (!this.health)
5player:tell("It seems broken.  Turning it on isn't going to help.");
6else
7player:announce_action_text($su:ps(this.on_msg, player, this));
8this.on = 1;
9this:turn_on();
10endif
11elseif (prepstr == "off")
12if (!this.on)
13player:tell("It's already off.");
14else
15player:announce_action_text($su:ps(this.off_msg, player, this));
16this.on = 0;
17this:turn_off();
18endif
19else
20player:tell("You can turn ", this:dname(), " on or off.");
21endif

take_damage

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

none

Source

1type = args[1];
2amount = args[2];
3absorbed = 0;
4for x in (this.armor)
5if (x[1] == type)
6abx = x[2] + random(x[3] - x[2]);
7if (abx > 0)
8absorbed = absorbed + abx;
9endif
10endif
11endfor
12absorbed = min(absorbed, amount);
13amount = amount - absorbed;
14this.health = this.health - amount;
15if (this.health < 0)
16this:_break();
17endif
18return amount;

_break

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

Source

1this.health = 0;
2this.on = 0;
3this:turn_off();
4this.location:announce_all($su:ps(this.break_msg, player, this));

turn_on

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

Source

1"Do whatever is necessary when we turn on.";

turn_off

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

Source

1"Do whatever is necessary when we turn off.";

description

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

none

Source

1d = pass(@args);
2if (typeof(d) == STR)
3d = {d};
4endif
5pf = this:percent_functional();
6if (pf < 75)
7a = this.damaged1_msg;
8elseif (pf < 40)
9a = this.damaged2_msg;
10elseif (!this.health)
11a = this.damaged3_msg;
12else
13a = "";
14endif
15if (this.on)
16a = (this.is_on_msg + "  ") + a;
17else
18a = (this.is_off_msg + "  ") + a;
19endif
20d = {@d, $su:ps(a, this, this)};
21return d;

percent_functional

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

Source

1fraction = tofloat(this.health) / tofloat(this.health_max);
2return toint(100.0 * fraction);

recycle

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

none

Source

1this:turn_off();
2return pass(@args);

turn turn2

Spec none any thisFlags rdOwner #361Definer #115

Referenced by

none

Source

1this:turn1();

entomb

Spec this none thisFlags rxdOwner #361Definer #115

Referenced by

none

Source

1"Copied from generic device (#331):recycle by Gilmore (#98) Wed Jun  2 21:43:18 2010 CDT";
2this:turn_off();
3return pass(@args);