Files
Bubberstation/code/datums/elements/tool_flash.dm
T
Hatterhat 439323050f tool_flash doesn't flash if strength is 0 (alien welders no longer need flash protection) (#93981)
## About The Pull Request

Makes the `tool_flash` element only flash people if the flash strength
is greater than 0. Last PR I could dig up that touched this was
tgstation/tgstation#83703, which didn't account for tools that had flash
strength 0 (e.g. the alien welder). So now the alien welder no longer
burns your eyeballs out if you don't have protection.

## Why It's Good For The Game

<img width="68" height="135" alt="image"
src="https://github.com/user-attachments/assets/dc77a0d9-4fdb-4206-8c3d-514ca2432d86"
/>

Gives the alien welder the ability to be used without flash protection,
as it was oh-so-long-ago.

## Changelog

🆑
fix: Alien welders, as befitting their nature of being Wacky Advanced
Tools, no longer sear your eyeballs if you don't have eye protection.
/🆑

---------

Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
2025-11-17 23:20:37 -07:00

38 lines
988 B
Plaintext

/**
* Tool flash bespoke element
*
* Flashes the user when using this tool
*/
/datum/element/tool_flash
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// Strength of the flash
var/flash_strength
/datum/element/tool_flash/Attach(datum/target, flash_strength)
. = ..()
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
src.flash_strength = flash_strength
RegisterSignal(target, COMSIG_TOOL_IN_USE, PROC_REF(prob_flash))
RegisterSignal(target, COMSIG_TOOL_START_USE, PROC_REF(flash))
/datum/element/tool_flash/Detach(datum/source)
. = ..()
UnregisterSignal(source, list(COMSIG_TOOL_IN_USE, COMSIG_TOOL_START_USE))
/datum/element/tool_flash/proc/prob_flash(datum/source, mob/living/user)
SIGNAL_HANDLER
if(prob(90))
return
flash(source, user)
/datum/element/tool_flash/proc/flash(datum/source, mob/living/user)
SIGNAL_HANDLER
if(user && flash_strength > 0 && get_dist(get_turf(source), get_turf(user)) <= 1)
user.flash_act(max(flash_strength,1))