Tool behaviors port (#21663)

For a robust crafting system, I need a new materials framework.
For a new materials framework, I need to clean up reagents.
To clean up reagents, I need to pare down foods from reagent holders.
To pare down foods from reagent holders, I need to port edibility
components.
To port edibility components, I need to port processing components.
To port processing components, I need to port tool behaviors.

This is all back-end code, no new features or functionality from this.
This commit is contained in:
Batrachophreno
2026-01-27 08:44:49 +00:00
committed by GitHub
parent ee31799d4a
commit 5277251959
362 changed files with 1480 additions and 1108 deletions
@@ -122,12 +122,12 @@
return ..()
/obj/machinery/ntnet_relay/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.isscrewdriver())
if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
attacking_item.play_tool_sound(get_turf(src), 50)
panel_open = !panel_open
to_chat(user, SPAN_NOTICE("You [panel_open ? "open" : "close"] the maintenance hatch."))
return
if(attacking_item.iscrowbar())
if(attacking_item.tool_behaviour == TOOL_CROWBAR)
if(!panel_open)
to_chat(user, SPAN_WARNING("Open the maintenance panel first."))
return
@@ -283,7 +283,7 @@
if(istype(attacking_item, /obj/item/device/paicard))
try_install_component(user, attacking_item)
return TRUE
if(attacking_item.iswrench())
if(attacking_item.tool_behaviour == TOOL_WRENCH)
var/list/components = get_all_components()
if(components.len)
to_chat(user, SPAN_WARNING("You have to remove all the components from \the [src] before disassembling it."))
@@ -294,7 +294,7 @@
user.visible_message(SPAN_NOTICE("\The [user] disassembles \the [src]."), SPAN_NOTICE("You disassemble \the [src]."), SPAN_NOTICE("You hear a ratcheting noise."))
qdel(src)
return TRUE
if(attacking_item.iswelder())
if(attacking_item.tool_behaviour == TOOL_WELDER)
var/obj/item/weldingtool/WT = attacking_item
if(!WT.isOn())
to_chat(user, SPAN_WARNING("\The [attacking_item] is off."))
@@ -312,7 +312,7 @@
update_icon()
return TRUE
if(attacking_item.isscrewdriver())
if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
var/list/all_components = get_all_components()
if(!all_components.len)
to_chat(user, SPAN_WARNING("This device doesn't have any components installed."))
@@ -19,7 +19,7 @@
is_holographic = TRUE
/obj/item/modular_computer/telescreen/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iscrowbar())
if(attacking_item.tool_behaviour == TOOL_CROWBAR)
if(anchored)
shutdown_computer()
anchored = FALSE
@@ -27,7 +27,7 @@
user.drop_from_inventory(attacking_item, src)
stored_card = attacking_item
update_power_usage()
if(attacking_item.isscrewdriver())
if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, SPAN_NOTICE("You manually remove \the [stored_card] from \the [src]."))
stored_card.forceMove(get_turf(src))
stored_card = null
@@ -44,7 +44,7 @@
/obj/item/computer_hardware/attackby(obj/item/attacking_item, mob/user)
/// Multitool. Runs diagnostics
if(attacking_item.ismultitool())
if(attacking_item.tool_behaviour == TOOL_MULTITOOL)
to_chat(user, SPAN_NOTICE("***** DIAGNOSTICS REPORT *****"))
diagnostics(user)
to_chat(user, SPAN_NOTICE("******************************"))
@@ -60,7 +60,7 @@
damage = 0
return TRUE
/// Cable coil. Works as repair method, but will probably require multiple applications and more cable.
if(S.iscoil())
if(S.tool_behaviour == TOOL_CABLECOIL)
if(!damage)
to_chat(user, SPAN_WARNING("\The [src] doesn't seem to require repairs."))
return TRUE
@@ -335,7 +335,7 @@
ui.set_auto_update(1)
/obj/machinery/lapvend/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iswrench())
if(attacking_item.tool_behaviour == TOOL_WRENCH)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(anchored)
user.visible_message("<b>[user]</b> begins unsecuring \the [src] from the floor.", \