explosion #247
Aliases: explosion
5 verbs · 15 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
at | this none this | rxd | #247 | 47 |
affect_creature | this none this | rxd | #247 | 64 |
visit_room | this none this | rxd | #247 | 35 |
affect_thing | this none this | rxd | #247 | 12 |
visit_flyer | this none this | rxd | #247 | 8 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
damage | #247 | rc | #361 | {{#277, 5, 10}, {#280, 1, 8}, {#279, 1, 8}} |
explode_msg | #247 | rc | #361 | "~1b[31m~1b[1m *** B O O M ***~1b[0m" |
noise_msg | #247 | rc | #361 | "You hear a %vol explosion from %dir." |
noise_volume | #247 | rc | #361 | 8 |
blast_decal | #247 | rc | #361 | #3532 |
aliases | #1 | rc | #361 | {"explosion"} |
description | #1 | rc | #361 | "Helper object to create explosions." |
object_size | #1 | r | #29 | {7778, 1298434235} |
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): #1 root
Children: none
Call graph
Source
at
Referenced by
- #135:explode_at line 2:
$explosion:at - #247:at line 31:
this:at - #247:at line 38:
this:at
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
Referenced by
- #247:visit_room line 11:
this:affect_creature
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
Referenced by
- #247:at line 12:
this:visit_room - #247:visit_room line 31:
this:visit_room
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
Referenced by
- #247:visit_room line 13:
this:affect_thing
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
Referenced by
- #247:at line 15:
this:visit_flyer
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