mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
## About The Pull Request Signals were initially only usable with component listeners, which while no longer the case has lead to outdated documentation, names, and a similar location in code. This pr pulls the two apart. Partially because mso thinks we should, but also because they really aren't directly linked anymore, and having them in this midstate just confuses people. [Renames comp_lookup to listen_lookup, since that's what it does](102b79694f) [Moves signal procs over to their own file](33d07d01fd) [Renames the PREQDELETING and QDELETING comsigs to drop the parent bit since they can hook to more then just comps now](335ea4ad08) [Does something similar to the attackby comsigs (PARENT -> ATOM)](210e57051d) [And finally passes over the examine signals](65917658fb) ## Why It's Good For The Game Code makes more sense, things are better teased apart, s just good imo ## Changelog 🆑 refactor: Pulled apart the last vestiges of names/docs directly linking signals to components /🆑
88 lines
2.6 KiB
Plaintext
88 lines
2.6 KiB
Plaintext
/// Minimum duration between pulses for the radioactive emitter component.
|
|
/// This is chosen arbitrarily. It can theoretically go down to 0.1 SECONDS but god please don't
|
|
#define MIN_PULSE_COOLDOWN 0.5 SECONDS
|
|
|
|
/**
|
|
* # Radioactive Emitter
|
|
*
|
|
* Simple component that you can attach to something to make it emit radiation pulses over time.
|
|
*/
|
|
/datum/component/radioactive_emitter
|
|
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
|
|
|
/// The actual cooldown between rad pulses
|
|
COOLDOWN_DECLARE(rad_pulse_cooldown)
|
|
|
|
/// The length of the cooldown between radiation pulses
|
|
var/cooldown_time = 5 SECONDS
|
|
/// How far the radiation pulses aggregate with other radiation pulses (see: [proc/radiation_pulse])
|
|
var/range = 1
|
|
/// How much radiation protection threshold is passed to the radiation pulse (see: [proc/radiation_pulse])
|
|
var/threshold = RAD_MEDIUM_INSULATION
|
|
/// Optional - What is shown on examine of the parent?
|
|
var/examine_text
|
|
|
|
/datum/component/radioactive_emitter/Initialize(
|
|
cooldown_time = 5 SECONDS,
|
|
range = 1,
|
|
threshold = RAD_MEDIUM_INSULATION,
|
|
examine_text,
|
|
)
|
|
|
|
if(!isturf(parent) && !ismovable(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
src.cooldown_time = max(cooldown_time, MIN_PULSE_COOLDOWN)
|
|
src.range = range
|
|
src.threshold = threshold
|
|
src.examine_text = examine_text
|
|
|
|
// We process on fastprocess even though we're on a cooldown based system.
|
|
// Easier to handle edits to the cooldown duration, prevents timer spam for short cooldown emitters
|
|
START_PROCESSING(SSfastprocess, src)
|
|
|
|
/datum/component/radioactive_emitter/Destroy(force, silent)
|
|
STOP_PROCESSING(SSfastprocess, src)
|
|
return ..()
|
|
|
|
/datum/component/radioactive_emitter/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
|
|
|
|
/datum/component/radioactive_emitter/UnregisterFromParent()
|
|
UnregisterSignal(parent, COMSIG_ATOM_EXAMINE)
|
|
|
|
/datum/component/radioactive_emitter/InheritComponent(
|
|
datum/component/new_comp,
|
|
i_am_original,
|
|
cooldown_time = 5 SECONDS,
|
|
range = 1,
|
|
threshold = RAD_NO_INSULATION,
|
|
examine_text,
|
|
)
|
|
|
|
if(!i_am_original)
|
|
return
|
|
|
|
// Only care about modifying our rad wave argument.
|
|
src.cooldown_time = cooldown_time
|
|
src.range = range
|
|
src.threshold = threshold
|
|
// Don't touch examine text or whatever else.
|
|
|
|
/datum/component/radioactive_emitter/process(seconds_per_tick)
|
|
if(!COOLDOWN_FINISHED(src, rad_pulse_cooldown))
|
|
return
|
|
|
|
COOLDOWN_START(src, rad_pulse_cooldown, cooldown_time)
|
|
radiation_pulse(parent, range, threshold)
|
|
|
|
/datum/component/radioactive_emitter/proc/on_examine(datum/source, mob/user, list/examine_list)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!examine_text)
|
|
return
|
|
|
|
examine_list += examine_text
|
|
|
|
#undef MIN_PULSE_COOLDOWN
|