<commit_before>#define PROCESS_COMPONENT "component"
#define PROCESS_MACHINE "machine"
#define PROCESS_OBJ "obj"

/// A component to leak gas over time from damaged objects with gas storage
/datum/component/gas_leaker
	/// Keeps track of what type we were attached to so we don't need to istype every process
	var/process_type

	/// The percent of max integrity that we start leaking. From 0 to 1
	var/integrity_leak_percent

	/// The rate at which gas leaks, you probably want this *very* low. From 0 to 1
	var/leak_rate

/datum/component/gas_leaker/Initialize(integrity_leak_percent=0.9, leak_rate=1)
	. = ..()
	if(istype(parent, /obj/machinery/atmospherics/components))
		process_type = PROCESS_COMPONENT
	else if(istype(parent, /obj/machinery))
		process_type = PROCESS_MACHINE
	else if(isobj(parent))
		process_type = PROCESS_OBJ
	else
		return COMPONENT_INCOMPATIBLE

	src.integrity_leak_percent = integrity_leak_percent
	src.leak_rate = leak_rate

/datum/component/gas_leaker/RegisterWithParent()
	. = ..()
	RegisterSignal(parent, COMSIG_OBJ_TAKE_DAMAGE, .proc/start_processing)

/datum/component/gas_leaker/UnregisterFromParent()
	. = ..()
	UnregisterSignal(parent, COMSIG_OBJ_TAKE_DAMAGE)

/datum/component/gas_leaker/proc/process_atmos()
	. = PROCESS_KILL
	switch(process_type)
		if(PROCESS_OBJ)
			. = process_obj(parent)
		if(PROCESS_MACHINE)
			. = process_machine(parent)
		if(PROCESS_COMPONENT)
			. = process_component(parent)

/datum/component/gas_leaker/proc/start_processing()
	SIGNAL_HANDLER
	// Hello fellow atmospherics machines, I too am definitely an atmos machine like you!
	// This component needs to tick at the same rate as the atmos system
	SSair.atmos_machinery += src
<commit_msg>Fixes an issue in how processing is done for gas leaks (#59322)<commit_after>#define PROCESS_COMPONENT "component"
#define PROCESS_MACHINE "machine"
#define PROCESS_OBJ "obj"

/// A component to leak gas over time from damaged objects with gas storage
/datum/component/gas_leaker
	/// Keeps track of what type we were attached to so we don't need to istype every process
	var/process_type

	/// The percent of max integrity that we start leaking. From 0 to 1
	var/integrity_leak_percent

	/// The rate at which gas leaks, you probably want this *very* low. From 0 to 1
	var/leak_rate

	/// Mirror of the machine var signifying whether this is live in the air subsystem
	var/atmos_processing = FALSE

/datum/component/gas_leaker/Initialize(integrity_leak_percent=0.9, leak_rate=1)
	. = ..()
	if(istype(parent, /obj/machinery/atmospherics/components))
		process_type = PROCESS_COMPONENT
	else if(istype(parent, /obj/machinery))
		process_type = PROCESS_MACHINE
	else if(isobj(parent))
		process_type = PROCESS_OBJ
	else
		return COMPONENT_INCOMPATIBLE

	src.integrity_leak_percent = integrity_leak_percent
	src.leak_rate = leak_rate

/datum/component/gas_leaker/Destroy(force, silent)
	SSair.stop_processing_machine(src)
	return ..()

/datum/component/gas_leaker/RegisterWithParent()
	. = ..()
	RegisterSignal(parent, COMSIG_OBJ_TAKE_DAMAGE, .proc/start_processing)

/datum/component/gas_leaker/UnregisterFromParent()
	. = ..()
	UnregisterSignal(parent, COMSIG_OBJ_TAKE_DAMAGE)

/datum/component/gas_leaker/proc/process_atmos()
	. = PROCESS_KILL
	switch(process_type)
		if(PROCESS_OBJ)
			. = process_obj(parent)
		if(PROCESS_MACHINE)
			. = process_machine(parent)
		if(PROCESS_COMPONENT)
			. = process_component(parent)

/datum/component/gas_leaker/proc/start_processing()
	SIGNAL_HANDLER
	// Hello fellow atmospherics machines, I too am definitely an atmos machine like you!
	// This component needs to tick at the same rate as the atmos system
	SSair.start_processing_machine(src)

{'fraction_non_alphanumeric': 0.09093369418132612, 'fraction_numerical': 0.005142083897158322, 'mean_word_length': 4.775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4874668', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1269, 'n_words': 310}