From 3cf652438919f0f7545271f2ec62a0336e9bd8dd Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 8 Apr 2020 18:28:35 +0300 Subject: [PATCH] Makes it nicer, removes check_cable_amount Putnam suggested this as well --- code/modules/power/cable.dm | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index f4a38b2fbc..71fe285180 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -556,27 +556,18 @@ By design, d1 is the smallest direction and d2 is the highest new_cable.update_icon() /obj/item/stack/cable_coil/attack_self(mob/user) - if(!check_cable_amount(user)) - return - to_chat(user, "You start making some cable restraints.") - if(!do_after(user, 30, TRUE, user, TRUE)) - to_chat(user, "You fail to make cable restraints, you need to stand still while doing so.") - return - if(!check_cable_amount()) - return - if(!use(15)) - to_chat(user, "You need at least 15 lengths of cable! - var/obj/item/restraints/handcuffs/cable/result = new(get_turf(user)) - user.put_in_hands(result) - result.color = color - to_chat(user, "You make some restraints out of cable") - + if(!use(15)) + to_chat(user, "You dont have enough cable coil to make restraints out of them") + to_chat(user, "You start making some cable restraints.") + if(!do_after(user, 30, TRUE, user, TRUE)) + to_chat(user, "You fail to make cable restraints, you need to stand still while doing so.") + give(15) + return + var/obj/item/restraints/handcuffs/cable/result = new(get_turf(user)) + user.put_in_hands(result) + result.color = color + to_chat(user, "You make some restraints out of cable") -/obj/item/stack/cable_coil/proc/check_cable_amount(user) - if(amount < 15) //We dont care about cyborgs here, so we dont use get_amount() - to_chat(user, "You dont have enough cable coil to make restraints out of them") - return FALSE - return TRUE //add cables to the stack /obj/item/stack/cable_coil/proc/give(extra)