/tg/ Station 13 - Modules - TypesVar Details - Proc Details

pellet_cloud

Vars

bodiesFor grenades, any /mob/living's the grenade is moved onto, see /datum/component/pellet_cloud/proc/handle_martyrs
hitshow many pellets impacted something
num_pelletsHow 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
pellet_deltaFor 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
pelletsThe list of pellets we're responsible for tracking, once these are all accounted for, we finalize.
projectile_typeWhat's the projectile path of the shrapnel we're shooting?
purple_heartsFor grenades, tracking people who die covering a grenade for achievement purposes, see /datum/component/pellet_cloud/proc/handle_martyrs
queued_deleteIf the parent tried deleting and we're not done yet, we send it to nullspace then delete it after
radiusFor 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
shooterfor if we're an ammo casing being fired
targets_hitAn associated list with the atom hit as the key and how many pellets they've eaten for the value, for printing aggregate messages
terminatedhow many pellets ranged out without hitting anything
wound_info_by_partAnother associated list for hit bodyparts on carbons so we can track how much wounding potential we have for each bodypart

Procs

create_blast_pelletscreate_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.
create_casing_pelletscreate_casing_pellets() is for directed pellet clouds for ammo casings that have multiple pellets (buckshot and scatter lasers for instance)
finalizeAll of our pellets are accounted for, time to go target by target and tell them how many things they got hit by.
grenade_armedLook alive, we're armed! Now we start watching to see if anyone's covering us
grenade_droppedSomeone dropped the grenade, so set them to the shooter in case they're on top of it when it goes off
grenade_movedOur grenade has moved, reset var/list/bodies so we're "on top" of any mobs currently on the tile
grenade_uncrossedSomeone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it
handle_martyrshandle_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
nullspace_parentOur grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here
on_target_qdelSomeone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it
pellet_hitOne of our pellets hit something, record what it was and check if we're done (terminated == num_pellets)
pellet_rangeOne 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)
pewMinor convenience function for creating each shrapnel piece with circle explosions, mostly stolen from the MIRV component

Var Details

bodies

For grenades, any /mob/living's the grenade is moved onto, see /datum/component/pellet_cloud/proc/handle_martyrs

hits

how many pellets impacted something

num_pellets

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

pellet_delta

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

pellets

The list of pellets we're responsible for tracking, once these are all accounted for, we finalize.

projectile_type

What's the projectile path of the shrapnel we're shooting?

purple_hearts

For grenades, tracking people who die covering a grenade for achievement purposes, see /datum/component/pellet_cloud/proc/handle_martyrs

queued_delete

If the parent tried deleting and we're not done yet, we send it to nullspace then delete it after

radius

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

shooter

for if we're an ammo casing being fired

targets_hit

An associated list with the atom hit as the key and how many pellets they've eaten for the value, for printing aggregate messages

terminated

how many pellets ranged out without hitting anything

wound_info_by_part

Another associated list for hit bodyparts on carbons so we can track how much wounding potential we have for each bodypart

Proc Details

create_blast_pellets

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.

Note that grenades have extra handling for someone throwing themselves/being thrown on top of it, see /datum/component/pellet_cloud/proc/handle_martyrs Landmines just have a small check for /obj/effect/mine/shrapnel/var/shred_triggerer, and spawn extra shrapnel for them if so

Arguments:

create_casing_pellets

create_casing_pellets() is for directed pellet clouds for ammo casings that have multiple pellets (buckshot and scatter lasers for instance)

Honestly this is mostly just a rehash of [/obj/item/ammo_casing/proc/fire_casing] for pellet counts > 1, except this lets us tamper with the pellets and hook onto them for tracking purposes. The arguments really don't matter, while this proc is triggered by COMSIG_FIRE_CASING, it's just a big mess of the state vars we need for doing the stuff over here.

finalize

All of our pellets are accounted for, time to go target by target and tell them how many things they got hit by.

grenade_armed

Look alive, we're armed! Now we start watching to see if anyone's covering us

grenade_dropped

Someone dropped the grenade, so set them to the shooter in case they're on top of it when it goes off

grenade_moved

Our grenade has moved, reset var/list/bodies so we're "on top" of any mobs currently on the tile

grenade_uncrossed

Someone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it

handle_martyrs

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

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 "under" 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

Note we track anyone who's alive and client'd when they get shredded in var/list/purple_hearts, for achievement checking later

nullspace_parent

Our grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here

on_target_qdel

Someone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it

pellet_hit

One of our pellets hit something, record what it was and check if we're done (terminated == num_pellets)

pellet_range

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)

pew

Minor convenience function for creating each shrapnel piece with circle explosions, mostly stolen from the MIRV component