Files
GS13NG/datum/component/pellet_cloud.html
2025-02-05 06:19:18 +00:00

8 lines
22 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../../"><link rel="stylesheet" href="dmdoc.css"><title>/datum/component/pellet_cloud - /tg/ Station 13</title></head><body><header><a href="index.html">/tg/ Station 13</a> - <a href="index.html#modules">Modules</a> - <a href="index.html#types">Types</a><a href="datum/component/pellet_cloud.html#var">Var Details</a> - <a href="datum/component/pellet_cloud.html#proc">Proc Details</a></header><main><h1>pellet_cloud <aside>/<a href="datum.html">datum</a>/<a href="datum/component.html">component</a>/<a href="datum/component/pellet_cloud.html">pellet_cloud</a></aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L24"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 24"></a></h1><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Vars</h2></td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/bodies">bodies</a></th><td>For grenades, any /mob/living's the grenade is moved onto, see <a href="datum/component/pellet_cloud.html#proc/handle_martyrs" title="/datum/component/pellet_cloud">/datum/component/pellet_cloud/proc/handle_martyrs</a></td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/hits">hits</a></th><td>how many pellets impacted something</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/num_pellets">num_pellets</a></th><td>How many shrapnel projectiles are we responsible for tracking? May be reduced for grenades if someone dives on top of it. Defined by ammo casing for casings, derived from magnitude otherwise</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/pellet_delta">pellet_delta</a></th><td>For grenades, tracking how many pellets are removed due to martyrs and how many pellets are added due to the last person to touch it being on top of it</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/pellets">pellets</a></th><td>The list of pellets we're responsible for tracking, once these are all accounted for, we finalize.</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/projectile_type">projectile_type</a></th><td>What's the projectile path of the shrapnel we're shooting?</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/purple_hearts">purple_hearts</a></th><td>For grenades, tracking people who die covering a grenade for achievement purposes, see [/datum/component/pellet_cloud/proc/handle_martyrs()]</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/queued_delete">queued_delete</a></th><td>If the parent tried deleting and we're not done yet, we send it to nullspace then delete it after</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/radius">radius</a></th><td>For grenades/landmines, how big is the radius of turfs we're targeting? Note this does not effect the projectiles range, only how many we generate</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/shooter">shooter</a></th><td>for if we're an ammo casing being fired</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/targets_hit">targets_hit</a></th><td>An associated list with the atom hit as the key and how many pellets they've eaten for the value, for printing aggregate messages</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/terminated">terminated</a></th><td>how many pellets ranged out without hitting anything</td></tr><tr><th><a href="datum/component/pellet_cloud.html#var/wound_info_by_part">wound_info_by_part</a></th><td>Another associated list for hit bodyparts on carbons so we can track how much wounding potential we have for each bodypart</td></tr><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/create_blast_pellets">create_blast_pellets</a></th><td>create_blast_pellets() is for when we have a central point we want to shred the surroundings of with a ring of shrapnel, namely frag grenades and landmines.</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/create_casing_pellets">create_casing_pellets</a></th><td>create_casing_pellets() is for directed pellet clouds for ammo casings that have multiple pellets (buckshot and scatter lasers for instance)</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/finalize">finalize</a></th><td>All of our pellets are accounted for, time to go target by target and tell them how many things they got hit by.</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/grenade_armed">grenade_armed</a></th><td>Look alive, we're armed! Now we start watching to see if anyone's covering us</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/grenade_dropped">grenade_dropped</a></th><td>Someone dropped the grenade, so set them to the shooter in case they're on top of it when it goes off</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/grenade_moved">grenade_moved</a></th><td>Our grenade has moved, reset var/list/bodies so we're &quot;on top&quot; of any mobs currently on the tile</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/grenade_uncrossed">grenade_uncrossed</a></th><td>Someone who was originally &quot;under&quot; the grenade has moved off the tile and is now eligible for being a martyr and &quot;covering&quot; it</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/handle_martyrs">handle_martyrs</a></th><td>handle_martyrs() is used for grenades that shoot shrapnel to check if anyone threw themselves/were thrown on top of the grenade, thus absorbing a good chunk of the shrapnel</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/nullspace_parent">nullspace_parent</a></th><td>Our grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/on_target_qdel">on_target_qdel</a></th><td>Someone who was originally &quot;under&quot; the grenade has moved off the tile and is now eligible for being a martyr and &quot;covering&quot; it</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/pellet_hit">pellet_hit</a></th><td>One of our pellets hit something, record what it was and check if we're done (terminated == num_pellets)</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/pellet_range">pellet_range</a></th><td>One of our pellets disappeared due to hitting their max range (or just somehow got qdel'd), remove it from our list and check if we're done (terminated == num_pellets)</td></tr><tr><th><a href="datum/component/pellet_cloud.html#proc/pew">pew</a></th><td>Minor convenience function for creating each shrapnel piece with circle explosions, mostly stolen from the MIRV component</td></tr></table><h2 id="var">Var Details</h2><h3 id="var/bodies"><aside class="declaration">var </aside>bodies <aside> /list</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L41"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 41"></a></h3><p>For grenades, any /mob/living's the grenade is moved onto, see <a href="datum/component/pellet_cloud.html#proc/handle_martyrs" title="/datum/component/pellet_cloud">/datum/component/pellet_cloud/proc/handle_martyrs</a></p><h3 id="var/hits"><aside class="declaration">var </aside>hits <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L50"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 50"></a></h3><p>how many pellets impacted something</p><h3 id="var/num_pellets"><aside class="declaration">var </aside>num_pellets <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L29"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 29"></a></h3><p>How many shrapnel projectiles are we responsible for tracking? May be reduced for grenades if someone dives on top of it. Defined by ammo casing for casings, derived from magnitude otherwise</p><h3 id="var/pellet_delta"><aside class="declaration">var </aside>pellet_delta <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L46"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 46"></a></h3><p>For grenades, tracking how many pellets are removed due to martyrs and how many pellets are added due to the last person to touch it being on top of it</p><h3 id="var/pellets"><aside class="declaration">var </aside>pellets <aside> /list</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L34"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 34"></a></h3><p>The list of pellets we're responsible for tracking, once these are all accounted for, we finalize.</p><h3 id="var/projectile_type"><aside class="declaration">var </aside>projectile_type <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L26"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 26"></a></h3><p>What's the projectile path of the shrapnel we're shooting?</p><h3 id="var/purple_hearts"><aside class="declaration">var </aside>purple_hearts <aside> /list</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L43"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 43"></a></h3><p>For grenades, tracking people who die covering a grenade for achievement purposes, see [/datum/component/pellet_cloud/proc/handle_martyrs()]</p><h3 id="var/queued_delete"><aside class="declaration">var </aside>queued_delete <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L52"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 52"></a></h3><p>If the parent tried deleting and we're not done yet, we send it to nullspace then delete it after</p><h3 id="var/radius"><aside class="declaration">var </aside>radius <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L31"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 31"></a></h3><p>For grenades/landmines, how big is the radius of turfs we're targeting? Note this does not effect the projectiles range, only how many we generate</p><h3 id="var/shooter"><aside class="declaration">var </aside>shooter <aside> /<a href="mob.html">mob</a>/<a href="mob/living.html">living</a></aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L57"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 57"></a></h3><p>for if we're an ammo casing being fired</p><h3 id="var/targets_hit"><aside class="declaration">var </aside>targets_hit <aside> /list</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L36"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 36"></a></h3><p>An associated list with the atom hit as the key and how many pellets they've eaten for the value, for printing aggregate messages</p><h3 id="var/terminated"><aside class="declaration">var </aside>terminated <aside> </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L48"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 48"></a></h3><p>how many pellets ranged out without hitting anything</p><h3 id="var/wound_info_by_part"><aside class="declaration">var </aside>wound_info_by_part <aside> /list</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L39"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 39"></a></h3><p>Another associated list for hit bodyparts on carbons so we can track how much wounding potential we have for each bodypart</p><h2 id="proc">Proc Details</h2><h3 id="proc/create_blast_pellets"><aside class="declaration">proc </aside>create_blast_pellets<aside>(/<a href="obj.html">obj</a>/O, /<a href="mob.html">mob</a>/<a href="mob/living.html">living</a>/lanced_by) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L128"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 128"></a></aside></h3><p>create_blast_pellets() is for when we have a central point we want to shred the surroundings of with a ring of shrapnel, namely frag grenades and landmines.</p>
<p>Note that grenades have extra handling for someone throwing themselves/being thrown on top of it, while landmines do not (obviously, it's a landmine!). See [/datum/component/pellet_cloud/proc/handle_martyrs()]</p><h3 id="proc/create_casing_pellets"><aside class="declaration">proc </aside>create_casing_pellets<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/ammo_casing.html">ammo_casing</a>/shell, /<a href="atom.html">atom</a>/target, /<a href="mob.html">mob</a>/<a href="mob/living.html">living</a>/user, fired_from, randomspread, spread, zone_override, params, distro) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L101"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 101"></a></aside></h3><p>create_casing_pellets() is for directed pellet clouds for ammo casings that have multiple pellets (buckshot and scatter lasers for instance)</p>
<p>Honestly this is mostly just a rehash of [/obj/item/ammo_casing/proc/fire_casing()] for pellet counts &gt; 1, except this lets us tamper with the pellets and hook onto them for tracking purposes.
The arguments really don't matter, this proc is triggered by COMSIG_PELLET_CLOUD_INIT which is only for this really, it's just a big mess of the state vars we need for doing the stuff over here.</p><h3 id="proc/finalize"><aside class="declaration">proc </aside>finalize<aside>() <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L254"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 254"></a></aside></h3><p>All of our pellets are accounted for, time to go target by target and tell them how many things they got hit by.</p><h3 id="proc/grenade_armed"><aside class="declaration">proc </aside>grenade_armed<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/nade) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L289"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 289"></a></aside></h3><p>Look alive, we're armed! Now we start watching to see if anyone's covering us</p><h3 id="proc/grenade_dropped"><aside class="declaration">proc </aside>grenade_dropped<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/nade, /<a href="mob.html">mob</a>/<a href="mob/living.html">living</a>/slick_willy) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L298"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 298"></a></aside></h3><p>Someone dropped the grenade, so set them to the shooter in case they're on top of it when it goes off</p><h3 id="proc/grenade_moved"><aside class="declaration">proc </aside>grenade_moved<aside>() <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L303"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 303"></a></aside></h3><p>Our grenade has moved, reset var/list/bodies so we're &quot;on top&quot; of any mobs currently on the tile</p><h3 id="proc/grenade_uncrossed"><aside class="declaration">proc </aside>grenade_uncrossed<aside>(/<a href="datum.html">datum</a>/source, /<a href="atom.html">atom</a>/<a href="atom/movable.html">movable</a>/AM) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L310"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 310"></a></aside></h3><p>Someone who was originally &quot;under&quot; the grenade has moved off the tile and is now eligible for being a martyr and &quot;covering&quot; it</p><h3 id="proc/handle_martyrs"><aside class="declaration">proc </aside>handle_martyrs<aside>(/<a href="mob.html">mob</a>/<a href="mob/living.html">living</a>/lanced_by) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L153"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 153"></a></aside></h3><p>handle_martyrs() is used for grenades that shoot shrapnel to check if anyone threw themselves/were thrown on top of the grenade, thus absorbing a good chunk of the shrapnel</p>
<p>Between the time the grenade is armed and the actual detonation, we set var/list/bodies to the list of mobs currently on the new tile, as if the grenade landed on top of them, tracking if any of them move off the tile and removing them from the &quot;under&quot; list
Once the grenade detonates, handle_martyrs() is called and gets all the new mobs on the tile, and add the ones not in var/list/bodies to var/list/martyrs
We then iterate through the martyrs and reduce the shrapnel magnitude for each mob on top of it, shredding each of them with some of the shrapnel they helped absorb. This can snuff out all of the shrapnel if there's enough bodies</p>
<p>Note we track anyone who's alive and client'd when they get shredded in var/list/purple_hearts, for achievement checking later</p><h3 id="proc/nullspace_parent"><aside class="declaration">proc </aside>nullspace_parent<aside>() <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L314"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 314"></a></aside></h3><p>Our grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here</p><h3 id="proc/on_target_qdel"><aside class="declaration">proc </aside>on_target_qdel<aside>(/<a href="atom.html">atom</a>/target) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L321"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 321"></a></aside></h3><p>Someone who was originally &quot;under&quot; the grenade has moved off the tile and is now eligible for being a martyr and &quot;covering&quot; it</p><h3 id="proc/pellet_hit"><aside class="declaration">proc </aside>pellet_hit<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/projectile.html">projectile</a>/P, /<a href="atom.html">atom</a>/<a href="atom/movable.html">movable</a>/firer, /<a href="atom.html">atom</a>/target, Angle, hit_zone, blocked) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L201"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 201"></a></aside></h3><p>One of our pellets hit something, record what it was and check if we're done (terminated == num_pellets)</p><h3 id="proc/pellet_range"><aside class="declaration">proc </aside>pellet_range<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/projectile.html">projectile</a>/P) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L229"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 229"></a></aside></h3><p>One of our pellets disappeared due to hitting their max range (or just somehow got qdel'd), remove it from our list and check if we're done (terminated == num_pellets)</p><h3 id="proc/pew"><aside class="declaration">proc </aside>pew<aside>(/<a href="atom.html">atom</a>/target, spread) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/datums/components/pellet_cloud.dm#L237"><img src="git.png" width="16" height="16" title="code/datums/components/pellet_cloud.dm 237"></a></aside></h3><p>Minor convenience function for creating each shrapnel piece with circle explosions, mostly stolen from the MIRV component</p></main><footer>tgstation.dme <a href="https://github.com/evilew/GS13-Citadel/tree/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e">e8e0068</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.9.0</a></footer></body></html>