Files
Batrachophreno 5277251959 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.
2026-01-27 08:44:49 +00:00

59 lines
1.7 KiB
Plaintext

// Target stakes for the firing range.
/obj/structure/target_stake
name = "target stake"
desc = "A thin platform with negatively-magnetized wheels."
icon = 'icons/obj/target_stake.dmi'
icon_state = "target_stake"
density = TRUE
w_class = WEIGHT_CLASS_GIGANTIC
build_amt = 10
var/obj/item/target/pinned_target
/obj/structure/target_stake/Initialize(mapload)
. = ..()
material = SSmaterials.get_material_by_name(MATERIAL_STEEL)
/obj/structure/target_stake/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/target))
if(pinned_target)
to_chat(user, SPAN_WARNING("\The [src] already has a target."))
return
if(user.unEquip(attacking_item, FALSE, get_turf(src)))
to_chat(user, SPAN_NOTICE("You slide \the [attacking_item] into the stake."))
set_target(attacking_item)
return
if(attacking_item.tool_behaviour == TOOL_WRENCH)
if(pinned_target)
to_chat(user, SPAN_WARNING("You cannot dismantle \the [src] while it has a target attached."))
return
dismantle()
/obj/structure/target_stake/attack_hand(var/mob/user)
. = ..()
if(pinned_target && ishuman(user))
var/obj/item/target/T = pinned_target
to_chat(user, SPAN_NOTICE("You take \the [T] out of the stake."))
set_target(null)
user.put_in_hands(T)
/obj/structure/target_stake/proc/set_target(var/obj/item/target/T)
if(T)
density = FALSE
T.density = TRUE
T.pixel_x = 0
T.pixel_y = 0
T.layer = ABOVE_OBJ_LAYER
T.stake = src
pinned_target = T
else
density = TRUE
if(pinned_target)
pinned_target.density = FALSE
pinned_target.layer = OBJ_LAYER
pinned_target.stake = null
pinned_target = null
/obj/structure/target_stake/Destroy()
set_target(null)
return ..()