Files
Bubberstation/code/datums/components/combustible_flooder.dm
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

109 lines
4.6 KiB
Plaintext

/// Component that floods gas when ignited by fire.
/datum/component/combustible_flooder
// Gas type, molar count, and temperature. All self explanatory.
var/gas_id
var/gas_amount
var/temp_amount
/datum/component/combustible_flooder/Initialize(initialize_gas_id, initialize_gas_amount, initialize_temp_amount)
src.gas_id = initialize_gas_id
src.gas_amount = initialize_gas_amount
src.temp_amount = initialize_temp_amount
// Any item made of plasma is going to have this component, making it extremely difficult to blacklist fire hazards during create_and_destroy.
// So let's just completely neuter them during unit tests so we don't burn down the testing area and cause spurious runtimes.
#ifndef UNIT_TESTS
RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, PROC_REF(attackby_react))
RegisterSignal(parent, COMSIG_ATOM_FIRE_ACT, PROC_REF(flame_react))
RegisterSignal(parent, COMSIG_ATOM_TOUCHED_SPARKS, PROC_REF(sparks_react))
RegisterSignal(parent, COMSIG_ATOM_BULLET_ACT, PROC_REF(projectile_react))
RegisterSignal(parent, COMSIG_ATOM_TOOL_ACT(TOOL_WELDER), PROC_REF(welder_react))
if(isturf(parent))
RegisterSignal(parent, COMSIG_TURF_EXPOSE, PROC_REF(hotspots_react))
#endif
/datum/component/combustible_flooder/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_ATOM_ATTACKBY)
UnregisterSignal(parent, COMSIG_ATOM_FIRE_ACT)
UnregisterSignal(parent, COMSIG_ATOM_BULLET_ACT)
UnregisterSignal(parent, COMSIG_ATOM_TOOL_ACT(TOOL_WELDER))
if(isturf(parent))
UnregisterSignal(parent, COMSIG_TURF_EXPOSE)
/// Do the flooding. Trigger temperature is the temperature we will flood at if we dont have a temp set at the start. Trigger referring to whatever triggered it.
/datum/component/combustible_flooder/proc/flood(mob/user, trigger_temperature)
var/delete_parent = TRUE
var/turf/open/flooded_turf = get_turf(parent)
// We do this check early so closed turfs are still be able to flood.
if(isturf(parent)) // Walls and floors.
var/turf/parent_turf = parent
flooded_turf = parent_turf.ScrapeAway(1, CHANGETURF_INHERIT_AIR | CHANGETURF_FORCEOP) // Ensure that we always forcefully replace the turf, even if the baseturf has the same type
delete_parent = FALSE
flooded_turf.atmos_spawn_air("[gas_id]=[gas_amount];[TURF_TEMPERATURE((temp_amount || trigger_temperature))]")
// Logging-related
var/admin_message = "[flooded_turf] ignited in [ADMIN_VERBOSEJMP(flooded_turf)]"
var/log_message = "ignited [flooded_turf] at [AREACOORD(flooded_turf)]"
if(user)
admin_message += " by [ADMIN_LOOKUPFLW(user)] at [ADMIN_COORDJMP(flooded_turf)]"
user.log_message(log_message, LOG_ATTACK, log_globally = FALSE)//only individual log
else
log_message = "[key_name(user)] " + log_message + " by fire at [AREACOORD(flooded_turf)]"
admin_message += " by fire at [ADMIN_COORDJMP(flooded_turf)]"
log_attack(log_message)
message_admins(admin_message)
if(delete_parent && !QDELETED(parent))
if(isobj(parent))
var/obj/obj_parent = parent
obj_parent.deconstruct(disassembled = FALSE)
else
qdel(parent) // For things with the explodable component like plasma mats this isn't necessary, but there's no harm.
qdel(src)
/// fire_act reaction.
/datum/component/combustible_flooder/proc/flame_react(datum/source, exposed_temperature, exposed_volume)
SIGNAL_HANDLER
if(exposed_temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
flood(null, exposed_temperature)
/// sparks_touched reaction.
/datum/component/combustible_flooder/proc/sparks_react(datum/source, obj/effect/particle_effect/sparks/sparks)
SIGNAL_HANDLER
if(sparks) // this shouldn't ever be false but existence is mysterious
flood(null, FIRE_MINIMUM_TEMPERATURE_TO_SPREAD)
/// Hotspot reaction.
/datum/component/combustible_flooder/proc/hotspots_react(datum/source, air, exposed_temperature)
SIGNAL_HANDLER
if(exposed_temperature >= FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
flood(null, exposed_temperature)
/// Being attacked by something
/datum/component/combustible_flooder/proc/attackby_react(datum/source, obj/item/thing, mob/user, params)
SIGNAL_HANDLER
if(thing.get_temperature() >= FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
flood(user, thing.get_temperature())
/// Shot by something
/datum/component/combustible_flooder/proc/projectile_react(datum/source, obj/projectile/shot)
SIGNAL_HANDLER
if(shot.damage_type == BURN && shot.damage > 0)
flood(shot.firer, 2500)
/// Welder check. Here because tool_act is higher priority than attackby.
/datum/component/combustible_flooder/proc/welder_react(datum/source, mob/user, obj/item/tool)
SIGNAL_HANDLER
if(tool.get_temperature() >= FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
flood(user, tool.get_temperature())
return ITEM_INTERACT_BLOCKING