generic weapon mod #127
Aliases: generic weapon mod, mod
7 verbs · 45 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
add_to | this none this | rxd | #127 | 49 |
fits_on | this none this | rxd | #127 | 33 |
remove_from | this none this | rxd | #127 | 32 |
look_self | this none this | rxd | #127 | 4 |
install | this on top of/on/onto/upon any | rxd | #127 | 33 |
tree_tag | this none this | rxd | #127 | 1 |
add_to_old | this none this | rxd | #127 | 50 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
fits_on | #127 | rc | #361 | {#841} |
prop_mods | #127 | rc | #361 | {} |
damage_add | #127 | rc | #361 | {} |
look_weapon_msg | #127 | rc | #361 | "it's got a generic mod" |
install_difficulty | #127 | rc | #361 | -2 |
install_start_msg | #127 | rc | #361 | "%DN pulls out a few simple tools and starts working on %p %l." |
install_finish_msg | #127 | rc | #361 | "%DN finishes installing %it on %p %l." |
install_fail_msg | #127 | rc | #361 | "%DN curses in frustration and bangs %p %l against the ground." |
respawn_on_remove | #127 | rc | #361 | 1 |
install_time | #127 | rc | #361 | 5.0 |
install_skill | #127 | rc | #361 | #329 |
name_add | #127 | rc | #361 | "custom" |
incompatible_with | #127 | rc | #361 | {} |
prop_mods_max | #127 | rc | #361 | {{"handed", 2}} |
add_weight | #127 | rc | #361 | 0 |
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 | 150 |
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 weapon mod", "mod"} |
description | #1 | rc | #361 | <clear> |
object_size | #1 | r | #29 | {7813, 1298433815} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | list of 1{"It's a modification kit for a weapon. If you have sufficient craft skill, and it matches the weapon you want, you can install it on a weapon. Weapons can only have a few mods, and each mod is harder to install than the last."} |
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
add_to
Referenced by
none
Source
1":add_to(OBJ weapon) => Add me and recycle. 1 if we succeeded."; 2weapon = args[1]; 3if (!this:fits_on(weapon)) 4return 0; 5endif 6for x in (this.prop_mods) 7if ($ou:has_property(weapon, x[1])) 8if (typeof(x[2]) in {INT, FLOAT}) 9weapon.(x[1]) = weapon.(x[1]) + x[2]; 10else 11weapon.(x[1]) = x[2]; 12endif 13endif 14endfor 15if (this.damage_add) 16i = 0; 17for x in [1..length(weapon.damage)] 18if (weapon.damage[x][1] == this.damage_add[1]) 19i = x; 20endif 21endfor 22if (i) 23weapon.damage[i][2] = weapon.damage[i][2] + this.damage_add[2]; 24weapon.damage[i][3] = weapon.damage[i][3] + this.damage_add[3]; 25weapon.damage[i][4] = weapon.damage[i][4] + this.damage_add[4]; 26else 27weapon.damage = {@weapon.damage, this.damage_add}; 28endif 29endif 30if ((!weapon.mods) && this.name_add) 31if (weapon.long_name_msg) 32weapon.long_name_msg = (this.name_add + " ") + weapon.long_name_msg; 33else 34weapon.long_name_msg = (this.name_add + " ") + weapon.name; 35endif 36weapon.aliases = {@weapon.aliases, weapon.long_name_msg}; 37endif 38if (this.f) 39weapon.mods = {@weapon.mods, this}; 40else 41weapon.mods = {@weapon.mods, parent(this)}; 42endif 43weapon.value = weapon.value + toint(tofloat(this.value) * 1.2); 44if ((!this.f) && (!verbs(this))) 45fork (0) 46$recycler:_recycle(this); 47endfork 48endif 49return 1;
fits_on
Referenced by
- #127:add_to line 3:
this:fits_on - #127:install line 29:
this:fits_on - #127:add_to_old line 3:
this:fits_on
Source
1weapon = args[1]; 2if ((this in weapon.mods) || (parent(this) in weapon.mods)) 3return 0; 4endif 5for x in (weapon.mods) 6if ((x in this.incompatible_with) || (this in x.incompatible_with)) 7return 0; 8endif 9endfor 10for x in (weapon.incompatible_mods) 11if (is_a(this, x)) 12return 0; 13endif 14endfor 15sliced = $lu:slice(this.prop_mods_max, 1); 16for x in (this.prop_mods) 17if ($ou:has_property(weapon, x[1]) && (x[1] in sliced)) 18for y in (this.prop_mods_max) 19if (x[1] == y[1]) 20if (weapon.(x[1]) >= y[2]) 21return 0; 22endif 23break; 24endif 25endfor 26endif 27endfor 28for x in (this.fits_on) 29if (is_a(weapon, x)) 30return 1; 31endif 32endfor 33return 0;
remove_from
Referenced by
none
Source
1":remove_from(OBJ weapon) => Undo our modification."; 2weapon = args[1]; 3if (!(this in weapon.mods)) 4return 0; 5endif 6weapon.mods = setremove(weapon.mods, this); 7for x in (this.prop_mods) 8weapon.(x[1]) = weapon.(x[1]) - x[2]; 9endfor 10if (this.damage_add) 11i = 0; 12for x in [1..length(weapon.damage)] 13if (weapon.damage[x][1] == this.damage_add[1]) 14i = x; 15endif 16endfor 17if (i) 18weapon.damage[i][2] = weapon.damage[i][2] - this.damage_add[2]; 19weapon.damage[i][3] = weapon.damage[i][3] - this.damage_add[3]; 20weapon.damage[i][4] = weapon.damage[i][4] - this.damage_add[4]; 21if (weapon.damage[i][3] < 1) 22weapon.damage = listdelete(weapon.damage, i); 23endif 24endif 25endif 26if (!weapon.mods) 27weapon.junk_ok = 1; 28endif 29if (this.respawn_on_remove) 30mod = $rpg:spawn(this); 31mod:moveto(weapon.location); 32endif
look_self
Referenced by
none
Source
1pass(@args); 2dif = max(1, min(9, 5 - this.install_difficulty)); 3dif = {"trivial", "very easy", "easy", "fairly easy", "routine for a trained craftsman", "tricky", "difficult", "very difficult", "almost impossible"}[dif]; 4player:tell("It would be ", dif, " to install this on a weapon.");
install
Referenced by
none
Source
1iobj = $match_utils:match(iobjstr, player.contents); 2if (player.location == #3705) 3player:tell("Right here in the store? Take it outside."); 4return; 5endif 6if (!is_a(iobj, #1)) 7player:tell("You aren't carrying a '", iobjstr, "' to install it on."); 8return; 9endif 10if (!is_a(iobj, $weapon)) 11player:tell("You can't install ", this:iname(), " on ", iobj:dname(), "."); 12return; 13endif 14if (!iobj.max_mods) 15player:tell("You don't think you can install any mods on ", iobj:iname(), "."); 16return; 17elseif (length(iobj.mods) >= iobj.max_mods) 18player:tell(iobj:dnamec(), " is already fully modded -- you can't see any way to add more."); 19return; 20endif 21for x in (iobj.mods) 22for y in (this.incompatible_with) 23if (is_a(x, y)) 24player:tell("You can't install ", this:iname(), " on ", iobj:dname(), ", because it already has ", x:iname(), "."); 25return 0; 26endif 27endfor 28endfor 29if (!this:fits_on(iobj)) 30player:tell("You can't see a way to install ", this:iname(), " on ", iobj:dname(), "."); 31else 32player:queue_action($actions.install, {this, iobj}, 1, (("install " + this.name) + " on ") + iobj.name); 33endif
tree_tag
Referenced by
none
Source
1return (pass(@args) + " fits: ") + $su:names_of(this.fits_on);
add_to_old
Referenced by
none
Source
1":add_to(OBJ weapon) => Add me and recycle. 1 if we succeeded."; 2weapon = args[1]; 3if (!this:fits_on(weapon)) 4return 0; 5endif 6for x in (this.prop_mods) 7if ($ou:has_property(weapon, x[1])) 8if (typeof(x[2]) in {INT, FLOAT}) 9weapon.(x[1]) = weapon.(x[1]) + x[2]; 10else 11weapon.(x[1]) = x[2]; 12endif 13endif 14endfor 15if (this.damage_add) 16i = 0; 17for x in [1..length(weapon.damage)] 18if (weapon.damage[x][1] == this.damage_add[1]) 19i = x; 20endif 21endfor 22if (i) 23weapon.damage[i][2] = weapon.damage[i][2] + this.damage_add[2]; 24weapon.damage[i][3] = weapon.damage[i][3] + this.damage_add[3]; 25weapon.damage[i][4] = weapon.damage[i][4] + this.damage_add[4]; 26else 27weapon.damage = {@weapon.damage, this.damage_add}; 28endif 29endif 30if ((!weapon.mods) && this.name_add) 31if (weapon.long_name_msg) 32weapon.long_name_msg = (this.name_add + " ") + weapon.long_name_msg; 33else 34weapon.long_name_msg = (this.name_add + " ") + weapon.name; 35endif 36weapon.aliases = {@weapon.aliases, weapon.long_name_msg}; 37endif 38if (this.f) 39weapon.mods = {@weapon.mods, this}; 40else 41weapon.mods = {@weapon.mods, parent(this)}; 42endif 43weapon.junk_ok = 0; 44weapon.value = weapon.value + toint(tofloat(this.value) * 1.2); 45if ((!this.f) && (!verbs(this))) 46fork (0) 47$recycler:_recycle(this); 48endfork 49endif 50return 1;