Refactors snipping cuffs into a bespoke cuffsnapping element (#75432)

Refactors snipping cuffs into a bespoke cuffsnapping element, adding
support for delayed cuffsnipping. Adds this element to box cutters!
Effectively speaking everything is the same as usual.

It's cool, it's based and elementized and modularized and not
hardcodeized on the jaws of life anymore. Plus it could be used in the
future for things (it won't)
This commit is contained in:
carlarctg
2023-05-25 17:57:50 +00:00
committed by GitHub
parent 9ecce38f23
commit 285c7acf24
6 changed files with 142 additions and 18 deletions
+8 -8
View File
@@ -102,6 +102,10 @@
w_class = WEIGHT_CLASS_NORMAL
toolspeed = 0.7
force_opens = TRUE
/// Used on Initialize, how much time to cut cable restraints and zipties.
var/snap_time_weak_handcuffs = 0 SECONDS
/// Used on Initialize, how much time to cut real handcuffs. Null means it can't.
var/snap_time_strong_handcuffs = 0 SECONDS
/obj/item/crowbar/power/Initialize(mapload)
. = ..()
@@ -126,6 +130,10 @@
tool_behaviour = (active ? TOOL_WIRECUTTER : TOOL_CROWBAR)
balloon_alert(user, "attached [active ? "cutting" : "prying"]")
playsound(user ? user : src, 'sound/items/change_jaws.ogg', 50, TRUE)
if(tool_behaviour == TOOL_CROWBAR)
RemoveElement(/datum/element/cuffsnapping, snap_time_weak_handcuffs, snap_time_strong_handcuffs)
else
AddElement(/datum/element/cuffsnapping, snap_time_weak_handcuffs, snap_time_strong_handcuffs)
return COMPONENT_NO_DEFAULT_MESSAGE
/obj/item/crowbar/power/syndicate
@@ -155,14 +163,6 @@
playsound(loc, SFX_DESECRATION, 50, TRUE, -1)
return BRUTELOSS
/obj/item/crowbar/power/attack(mob/living/carbon/attacked_carbon, mob/user)
if(istype(attacked_carbon) && attacked_carbon.handcuffed && tool_behaviour == TOOL_WIRECUTTER)
user.visible_message(span_notice("[user] cuts [attacked_carbon]'s restraints with [src]!"))
qdel(attacked_carbon.handcuffed)
return
return ..()
/obj/item/crowbar/cyborg
name = "hydraulic crowbar"
desc = "A hydraulic prying tool, simple but powerful."
+6 -9
View File
@@ -41,6 +41,10 @@
COLOR_TOOL_CYAN,
COLOR_TOOL_YELLOW,
)
/// Used on Initialize, how much time to cut cable restraints and zipties.
var/snap_time_weak_handcuffs = 0 SECONDS
/// Used on Initialize, how much time to cut real handcuffs. Null means it can't.
var/snap_time_strong_handcuffs = null
/datum/armor/item_wirecutters
fire = 50
@@ -51,15 +55,7 @@
set_greyscale(colors = list(pick(wirecutter_colors)))
AddElement(/datum/element/falling_hazard, damage = force, wound_bonus = wound_bonus, hardhat_safety = TRUE, crushes = FALSE, impact_sound = hitsound)
return ..()
/obj/item/wirecutters/attack(mob/living/carbon/attacked_carbon, mob/user)
if(istype(attacked_carbon) && attacked_carbon.handcuffed && istype(attacked_carbon.handcuffed, /obj/item/restraints/handcuffs/cable))
user.visible_message(span_notice("[user] cuts [attacked_carbon]'s restraints with [src]!"))
qdel(attacked_carbon.handcuffed)
return
AddElement(/datum/element/cuffsnapping, snap_time_weak_handcuffs, snap_time_strong_handcuffs)
return ..()
/obj/item/wirecutters/suicide_act(mob/living/user)
@@ -75,6 +71,7 @@
icon_state = "cutters"
toolspeed = 0.1
random_color = FALSE
snap_time_strong_handcuffs = 1 SECONDS
/obj/item/wirecutters/cyborg
name = "powered wirecutters"