Big tooltype decargo-culting (continued) (#95814)

## About The Pull Request

Gets some instances that I caught missed by
https://github.com/tgstation/tgstation/pull/95408
This commit is contained in:
Bloop
2026-04-29 12:19:00 -05:00
committed by GitHub
parent 4fb7eaae43
commit 966d6547e8
23 changed files with 110 additions and 112 deletions
+33 -9
View File
@@ -2,23 +2,47 @@
/datum/element/tool_blocker
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// e.g. TOOL_SCREWDRIVER, TOOL_CROWBAR
var/tool_type
/// Bitflag representing which tool_acts to block
var/action_type
/datum/element/tool_blocker/Attach(datum/target, tool_type)
/datum/element/tool_blocker/Attach(datum/target, tool_type, action_type = TOOL_ACT_ALL)
. = ..()
if(isnull(tool_type) || !(action_type & TOOL_ACT_ALL))
return ELEMENT_INCOMPATIBLE
src.tool_type = tool_type
RegisterSignals(target, list(
COMSIG_ATOM_TOOL_ACT(tool_type),
COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type),
), PROC_REF(block_tool))
src.action_type = action_type
var/list/signals_to_register = list()
if(action_type & TOOL_ACT_PRIMARY)
signals_to_register += COMSIG_ATOM_TOOL_ACT(tool_type)
if(action_type & TOOL_ACT_SECONDARY)
signals_to_register += COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type)
if(isturf(target))
RegisterSignal(target, COMSIG_QDELETING, PROC_REF(on_turf_deleted), override = TRUE)
RegisterSignals(target, signals_to_register, PROC_REF(block_tool))
/datum/element/tool_blocker/Detach(datum/source, ...)
UnregisterSignal(source, list(
COMSIG_ATOM_TOOL_ACT(tool_type),
COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type),
))
var/list/signals_to_unregister = list()
if(action_type & TOOL_ACT_PRIMARY)
signals_to_unregister += COMSIG_ATOM_TOOL_ACT(tool_type)
if(action_type & TOOL_ACT_SECONDARY)
signals_to_unregister += COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type)
if(isturf(source))
signals_to_unregister += COMSIG_QDELETING
UnregisterSignal(source, signals_to_unregister)
return ..()
/datum/element/tool_blocker/proc/block_tool(...)
SIGNAL_HANDLER
return ITEM_INTERACT_SKIP_TO_ATTACK
/datum/element/tool_blocker/proc/on_turf_deleted(datum/source)
SIGNAL_HANDLER
Detach(source)