From c4ff1cd322526b4a89d31e8ebd5925be64716f50 Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 7 Apr 2020 14:39:00 +0300 Subject: [PATCH 1/6] Coding is hard, mkay? --- code/modules/power/cable.dm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 93f82991fd..2f6eaee2a9 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -559,14 +559,19 @@ By design, d1 is the smallest direction and d2 is the highest if(!check_cable_amount(user)) return to_chat(user, "You start making some cable restraints.") - if(do_after(user, 30, TRUE, user) && check_cable_amount(user)) - amount -= 15 - 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(!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 - to_chat(user, "You fail to make cable restraints, you need to stand still while doing so.") + if(!check_cable_amount()) + return + amount -= 15 + if(amount == 0) + qdel(src) + 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() From c9ab705c80709f30a81de07c6198eb97bc3027a1 Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 7 Apr 2020 16:08:38 +0300 Subject: [PATCH 2/6] Ghommies suggestion --- code/modules/power/cable.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 2f6eaee2a9..fddc6d461c 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -564,9 +564,7 @@ By design, d1 is the smallest direction and d2 is the highest return if(!check_cable_amount()) return - amount -= 15 - if(amount == 0) - qdel(src) + use(15) var/obj/item/restraints/handcuffs/cable/result = new(get_turf(user)) user.put_in_hands(result) result.color = color From cdd2f55cac1ab1db8b504dc175690ee7ec6df793 Mon Sep 17 00:00:00 2001 From: Arturlang Date: Wed, 8 Apr 2020 18:24:14 +0300 Subject: [PATCH 3/6] Putnams suggestion Makes use() a if, as to use it as a further sanity check Co-Authored-By: Putnam3145 --- code/modules/power/cable.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index fddc6d461c..f4a38b2fbc 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -564,7 +564,8 @@ By design, d1 is the smallest direction and d2 is the highest return if(!check_cable_amount()) return - use(15) + 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 @@ -857,4 +858,4 @@ By design, d1 is the smallest direction and d2 is the highest . = ..() var/list/cable_colors = GLOB.cable_colors color = pick(cable_colors) - \ No newline at end of file + From 3cf652438919f0f7545271f2ec62a0336e9bd8dd Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 8 Apr 2020 18:28:35 +0300 Subject: [PATCH 4/6] 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) From 75a2dd6900085a8eccfc586234f1361f23f7d831 Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 8 Apr 2020 18:32:45 +0300 Subject: [PATCH 5/6] Finnishing touches, hopefully Tweaks some indendation --- code/modules/power/cable.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 71fe285180..ef6d11a82e 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -557,7 +557,8 @@ By design, d1 is the smallest direction and d2 is the highest /obj/item/stack/cable_coil/attack_self(mob/user) if(!use(15)) - to_chat(user, "You dont have enough cable coil to make restraints out of them") + to_chat(user, "You dont have enough cable coil to make restraints out of them") + 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.") @@ -568,7 +569,6 @@ By design, d1 is the smallest direction and d2 is the highest result.color = color to_chat(user, "You make some restraints out of cable") - //add cables to the stack /obj/item/stack/cable_coil/proc/give(extra) if(amount + extra > max_amount) From 0a234d561821824fe28a96eab9b785a622d1d4a6 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 9 Apr 2020 09:32:23 +0300 Subject: [PATCH 6/6] TABS NOT SPACES AAAAAAAA --- code/modules/power/cable.dm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index ef6d11a82e..49848824e4 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -556,18 +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(!use(15)) - to_chat(user, "You dont have enough cable coil to make restraints out of them") - 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.") - 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") + if(!use(15)) + to_chat(user, "You dont have enough cable coil to make restraints out of them") + 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.") + 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") //add cables to the stack /obj/item/stack/cable_coil/proc/give(extra)