explosion #247

Parent #1Owner #361Flags readSource hellcore/hellcore.db

Aliases: explosion

5 verbs · 15 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
atthis none thisrxd#24747
affect_creaturethis none thisrxd#24764
visit_roomthis none thisrxd#24735
affect_thingthis none thisrxd#24712
visit_flyerthis none thisrxd#2478

Properties

PropertyDefinerFlagsOwnerValue
damage#247rc#361{{#277, 5, 10}, {#280, 1, 8}, {#279, 1, 8}}
explode_msg#247rc#361"~1b[31m~1b[1m *** B O O M ***~1b[0m"
noise_msg#247rc#361"You hear a %vol explosion from %dir."
noise_volume#247rc#3618
blast_decal#247rc#361#3532
aliases#1rc#361{"explosion"}
description#1rc#361"Helper object to create explosions."
object_size#1r#29{7778, 1298434235}
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): #1 root

Children: none

Call graph

calls n247_0 #247:at n247_0->n247_0 n247_2 #247:visit_room n247_0->n247_2 n247_4 #247:visit_flyer n247_0->n247_4 n20_34 #20:pronoun_sub n247_0->n20_34 n247_2->n247_2 n247_1 #247:affect_creature n247_2->n247_1 n247_3 #247:affect_thing n247_2->n247_3 n48_8 #48:suspend_if_needed n247_2->n48_8 n47_17 #47:assoc n247_2->n47_17 n45_2 #45:has_verb n247_3->n45_2 n103_47 #103:valid n247_3->n103_47

Source

at

Spec this none thisFlags rxdOwner #361Definer #247

Referenced by

Source

1":at(where, damage, source, explode_msg, noise_msg, noise_volume, blast_decal, max_depth, blast_info_callback) => Make a big boom.";
2{where, ?damage = this.damage, ?source = #-1, ?explode_msg = this.explode_msg, ?noise_msg = this.noise_msg, ?noise_volume = this.noise_volume, ?blast_decal = this.blast_decal, ?max_depth = 0, ?blast_info_callback = {}} = args;
3from_flyer = is_a(where:area(), #20103);
4if (is_a(where, $room) || is_a(where, $creature))
5room = where:room();
6if (explode_msg)
7room:announce_all("");
8room:announce_all(explode_msg);
9room:announce_all("");
10endif
11room:broadcast_noise(noise_msg, noise_volume + max_depth);
12this:visit_room(room, damage, source, blast_decal, max_depth, blast_info_callback, {});
13if (from_flyer)
14if (valid(plane = where:area().flyer))
15this:visit_flyer(plane, damage);
16endif
17endif
18elseif (is_a(where, $container))
19for d in (damage)
20x = 2 + (!where.open);
21amount = (d[2] * x) + random((d[3] * x) - (d[2] * x));
22where:take_damage(d[1], amount);
23endfor
24for what in (where.contents)
25for d in (damage)
26`what:take_damage(d[1], d[2] + random(d[3] - d[2])) ! E_VERBNF => 0';
27endfor
28endfor
29if (where.health < 1)
30where.location:announce_all($su:ps("%DN ruptures from an internal explosion!", where));
31this:at(where.location, damage, source, explode_msg, noise_msg, noise_volume, blast_decal, max_depth, blast_info_callback);
32elseif (where.open)
33where.location:announce_all($su:ps("An explosion escapes the open %n.", where));
34reduced_damage = {};
35for d in (damage)
36reduced_damage = {{d[1], d[2] / 2, d[3] / 2}, @reduced_damage};
37endfor
38this:at(where.location, reduced_damage, source, explode_msg, noise_msg, noise_volume, blast_decal, max_depth, blast_info_callback);
39else
40if (is_a(where.location, $creature))
41where.location:tell($su:ps("A muffled explosion can be heard from your %t.", where.location, where));
42where:room():announce_all_but({where.location}, $su:ps("A muffled explosion can be heard from %dn's %t.", where.location, where));
43else
44where.location:announce_all($su:ps("A muffled explosion can be heard from %dn.", where));
45endif
46endif
47endif

affect_creature

Spec this none thisFlags rxdOwner #361Definer #247

Referenced by

Source

1"Copied from grenade (#1573):affect_creature by Gilmore (#98) Sun Jan 11 07:49:57 2009 CST";
2{who, where, damage, source, blast_info_callback} = args;
3{callback_obj, callback_verb, @callback_data} = blast_info_callback || {#-1, 0, 0};
4if (!who:grenade_can_affect(source, where))
5return;
6endif
7if (is_a(source, $player))
8if (is_a(source, $player) && is_a(who, $player))
9who:_pvp_record({source}, this.name);
10endif
11if (((!is_a(who, $player)) && (who.location != source.location)) && (source.location == #44969.location))
12#44969:add_win(source);
13endif
14endif
15{mod, amount_multiplier} = valid(callback_obj) ? callback_obj:(callback_verb)(who, @callback_data) | {-3, 1.0};
16if (is_a(where, $outdoor_room))
17mod = mod + 3;
18endif
19if (is_a(where, $room) && (who in where.covering))
20mod = mod + 3;
21endif
22mod = max($skills.dodge:check(who, mod), 0);
23if (mod > 0)
24who:tell("You manage to shield yourself from some of the blast...");
25endif
26blown = 0;
27oldlocation = who.location;
28for d in (damage)
29amount = d[2] + (((d[3] - d[2]) > 0) ? random(d[3] - d[2]) | 0);
30amount = toint(tofloat(amount) * amount_multiplier);
31if ((mod > 0) && (!(d[1] in {#308, #1326})))
32amount = amount - min(amount / 2, random(max(1, mod)));
33endif
34oldhealth = who.health;
35who:take_damage(d[1], amount, $bodypart, source);
36if ((((oldhealth || is_a(who, $corpse)) && (!blown)) && (random(100) <= (toint((tofloat(amount) / tofloat(who.health_max)) * 100.0) - (who.health_max / 5)))) && (d[1] in {$damages.explode, $damages.laser, $damages.bullets}))
37check = #113:check(who, -5, 1);
38if ((check <= 0) && (who.movable_by_explosion == 1))
39if (is_a(who.location, $room) && who.location.exits)
40direction = who.location.exits[random($)];
41location = direction.otherside.location;
42if (is_a(direction, $door) && (direction.open == 0))
43return;
44elseif (is_a(direction, #18385))
45return;
46elseif (direction.passable == 0)
47return;
48elseif (!valid(location))
49return;
50endif
51blown = 1;
52fork (0)
53if (who.location == oldlocation)
54who:tell("You are blown ", direction.name, " by the explosion!");
55who.location:announce_all_but({who}, who:name(), " is blown ", direction.name, " by the explosion!");
56location:announce_all(who:name(), " comes sailing in.");
57who:moveto(location);
58location:fall_into(who, who.location, max(3, amount / 5));
59endif
60endfork
61endif
62endif
63endif
64endfor

visit_room

Spec this none thisFlags rxdOwner #361Definer #247

Referenced by

Source

1":visit_room(room, damage, source, blast_decal, max_depth, blast_info_callback, already_visited) => Make a big boom.";
2{room, damage, source, blast_decal, max_depth, blast_info_callback, already_visited} = args;
3if (valid(source))
4room:broadcast_event(1, this, source, {$citizen});
5endif
6if (valid(blast_decal))
7blast_decal:add_to(room);
8endif
9for x in ({@room:occupants($creature), @room:occupants($thing)})
10if (is_a(x, $living))
11this:affect_creature(x, room, damage, source, blast_info_callback);
12else
13this:affect_thing(x, room, damage, source, blast_info_callback);
14endif
15$cu:sin(0);
16endfor
17if ((!already_visited) && is_a(room, #1047))
18max_depth = max_depth + 1;
19if (d = $lu:assoc($damages.explode, damage))
20damage = {d};
21else
22"Just make up some ad hoc damage... we don't have a general notion of 'strength' wrt explosives.";
23damage = {{$damages.explode, 5, 15}};
24endif
25endif
26already_visited = setadd(already_visited, room);
27if (max_depth)
28for exit in (room:occupants($exit))
29if ((((((!is_a(exit, $door)) || exit.open) && exit.next_hop_ok) && valid(exit.otherside)) && is_a(exit.otherside.location, $room)) && (!(exit.otherside.location in already_visited)))
30exit.otherside.location:announce_all(((($ansi.red + "OH HOLY FUCK, a sudden explosive surge hits you from ") + exit.otherside:dname()) + "!") + $ansi.reset);
31already_visited = this:visit_room(exit.otherside.location, damage, source, blast_decal, max_depth - 1, blast_info_callback, already_visited);
32endif
33endfor
34endif
35return already_visited;

affect_thing

Spec this none thisFlags rxdOwner #361Definer #247

Referenced by

Source

1"Copied from grenade (#1573):affect_creature by Gilmore (#98) Sun Jan 11 07:49:57 2009 CST";
2{what, where, damage, source, blast_info_callback} = args;
3if ($ou:has_verb(what, "take_damage"))
4amount_multiplier = 0.4;
5for d in (damage)
6if ($rpg:valid(what))
7amount = d[2] + (((d[3] - d[2]) > 0) ? random(d[3] - d[2]) | 0);
8amount = toint(tofloat(amount) * amount_multiplier);
9what:take_damage(d[1], amount, $bodypart, source);
10endif
11endfor
12endif

visit_flyer

Spec this none thisFlags rxdOwner #361Definer #247

Referenced by

Source

1{flyer, damage, ?source = #-1} = args;
2for d in (damage)
3x = tofloat(flyer.size) / tofloat($flyer.size);
4x = max(1.0, x);
5dm = {tofloat(d[2]), tofloat(d[3])};
6amount = toint(dm[1] / x) + `random(toint(dm[2] / x)) - toint(dm[1] / x) ! E_INVARG => 0';
7flyer:take_damage(d[1], amount, source);
8endfor