generic weapon mod #127

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

Aliases: generic weapon mod, mod

7 verbs · 45 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
add_tothis none thisrxd#12749
fits_onthis none thisrxd#12733
remove_fromthis none thisrxd#12732
look_selfthis none thisrxd#1274
installthis on top of/on/onto/upon anyrxd#12733
tree_tagthis none thisrxd#1271
add_to_oldthis none thisrxd#12750

Properties

PropertyDefinerFlagsOwnerValue
fits_on#127rc#361{#841}
prop_mods#127rc#361{}
damage_add#127rc#361{}
look_weapon_msg#127rc#361"it's got a generic mod"
install_difficulty#127rc#361-2
install_start_msg#127rc#361"%DN pulls out a few simple tools and starts working on %p %l."
install_finish_msg#127rc#361"%DN finishes installing %it on %p %l."
install_fail_msg#127rc#361"%DN curses in frustration and bangs %p %l against the ground."
respawn_on_remove#127rc#3611
install_time#127rc#3615.0
install_skill#127rc#361#329
name_add#127rc#361"custom"
incompatible_with#127rc#361{}
prop_mods_max#127rc#361{{"handed", 2}}
add_weight#127rc#3610
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#361150
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 weapon mod", "mod"}
description#1rc#361<clear>
object_size#1r#29{7813, 1298433815}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#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#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 n127_0 #127:add_to n127_1 #127:fits_on n127_0->n127_1 n45_0 #45:has_property n127_0->n45_0 n57_1 #57:_recycle n127_0->n57_1 n127_1->n45_0 n47_16 #47:slice n127_1->n47_16 n127_2 #127:remove_from n103_1 #103:spawn n127_2->n103_1 n127_3 #127:look_self n1_9 #1:look_self n127_3->n1_9 n107_43 #107:tell n127_3->n107_43 n127_4 #127:install n127_4->n127_1 n127_4->n107_43 n44_0 #44:match n127_4->n44_0 n5_9 #5:iname n127_4->n5_9 n92_2 #92:queue_action n127_4->n92_2 n127_5 #127:tree_tag n20_7 #20:names_of n127_5->n20_7 n5_18 #5:tree_tag n127_5->n5_18 n127_6 #127:add_to_old n127_6->n127_1 n127_6->n45_0 n127_6->n57_1

Source

add_to

Spec this none thisFlags rxdOwner #361Definer #127

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

Spec this none thisFlags rxdOwner #361Definer #127

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #127

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

Spec this none thisFlags rxdOwner #361Definer #127

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

Spec this on top of/on/onto/upon anyFlags rxdOwner #361Definer #127

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

Spec this none thisFlags rxdOwner #361Definer #127

Referenced by

none

Source

1return (pass(@args) + " fits: ") + $su:names_of(this.fits_on);

add_to_old

Spec this none thisFlags rxdOwner #361Definer #127

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;