generic device #115
Aliases: generic device, device
11 verbs · 42 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
fix repair | this any any | rxd | #115 | 13 |
turn switch turn1 | this any none | rxd | #115 | 21 |
take_damage | this none this | rxd | #115 | 18 |
_break | this none this | rxd | #115 | 4 |
turn_on | this none this | rxd | #115 | 1 |
turn_off | this none this | rxd | #115 | 1 |
description | this none this | rxd | #115 | 21 |
percent_functional | this none this | rxd | #115 | 2 |
recycle | this none this | rxd | #115 | 2 |
turn turn2 | none any this | rd | #115 | 1 |
entomb | this none this | rxd | #115 | 3 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
on | #115 | rc | #361 | 0 |
armor | #115 | rc | #361 | {} |
break_msg | #115 | rc | #361 | "Something important sputters and explodes inside %dt." |
on_msg | #115 | rc | #361 | "%N switches on %dt." |
off_msg | #115 | rc | #361 | "%N switches off %dt." |
repair_skill | #115 | rc | #361 | #332 |
damaged1_msg | #115 | rc | #361 | "It's awfully beat up, covered in dents and scratches." |
damaged2_msg | #115 | rc | #361 | "It looks seriously damaged; a few protruding bits are broken off entirely." |
damaged3_msg | #115 | rc | #361 | "It's been smashed; you question whether it works at all." |
is_on_msg | #115 | rc | #361 | "It's turned on." |
is_off_msg | #115 | rc | #361 | "It's turned off." |
fix_start_msg | #115 | rc | #361 | "%N pops off the back of %dt and starts screwing around inside it." |
handed | #5 | rc | #361 | <clear> |
wield_msg | #5 | rc | #361 | <clear> |
unwield_msg | #5 | rc | #361 | <clear> |
size | #5 | rc | #361 | <clear> |
look_place_msg | #5 | rc | #361 | <clear> |
value | #5 | rc | #361 | <clear> |
get_msg | #5 | rc | #361 | <clear> |
drop_msg | #5 | rc | #361 | <clear> |
get_fail_msg | #5 | rc | #361 | <clear> |
junk_ok | #5 | rc | #361 | <clear> |
floats | #5 | rc | #361 | <clear> |
long_name_msg | #5 | rc | #361 | <clear> |
article | #5 | rc | #361 | <clear> |
setup_list | #5 | rc | #361 | <clear> |
health | #5 | rc | #361 | <clear> |
health_max | #5 | rc | #361 | <clear> |
min_skill | #5 | rc | #361 | <clear> |
skill | #5 | rc | #361 | <clear> |
recipe_for | #5 | rc | #361 | <clear> |
carried_msg | #5 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"generic device", "device"} |
description | #1 | rc | #361 | "A curious metallic box studded with tiny recessed buttons and an indecipherable LCD display." |
object_size | #1 | r | #29 | {6745, 1298433815} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #5 generic thing → #1 root
Children: none
Call graph
Source
fix repair
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
Referenced by
- #115:turn line 1:
this:turn1
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
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
Referenced by
- #115:take_damage line 16:
this:_break
Source
1this.health = 0; 2this.on = 0; 3this:turn_off(); 4this.location:announce_all($su:ps(this.break_msg, player, this));
turn_on
Referenced by
- #115:turn line 9:
this:turn_on
Source
1"Do whatever is necessary when we turn on.";
turn_off
Referenced by
- #115:turn line 17:
this:turn_off - #115:_break line 3:
this:turn_off - #115:recycle line 1:
this:turn_off - #115:entomb line 2:
this:turn_off
Source
1"Do whatever is necessary when we turn off.";
description
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
Referenced by
- #115:description line 5:
this:percent_functional
Source
1fraction = tofloat(this.health) / tofloat(this.health_max); 2return toint(100.0 * fraction);
recycle
Referenced by
none
Source
1this:turn_off(); 2return pass(@args);
turn turn2
Referenced by
none
Source
1this:turn1();
entomb
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);