From 60b8688674415fad0b6f6c478f092a3bf7285e62 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 28 Nov 2019 07:10:00 +0100 Subject: [PATCH] Ports "Fixes transit tube barricade spam" --- .../transit_tubes/transit_tube_construction.dm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm index fb5988f72a..08f16554bc 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm @@ -15,6 +15,15 @@ var/flipped_build_type var/base_icon +/obj/structure/c_transit_tube/proc/can_wrench_in_loc(mob/user) + var/turf/source_turf = get_turf(loc) + var/existing_tubes = 0 + for(var/obj/structure/transit_tube/tube in source_turf) + existing_tubes++ + if(existing_tubes >= 2) + to_chat(user, "You cannot wrench any more transit tubes!") + return FALSE + return TRUE /obj/structure/c_transit_tube/ComponentInitialize() . = ..() @@ -32,9 +41,11 @@ icon_state = "[base_icon][flipped]" /obj/structure/c_transit_tube/wrench_act(mob/living/user, obj/item/I) + if(!can_wrench_in_loc(user)) + return to_chat(user, "You start attaching the [name]...") add_fingerprint(user) - if(I.use_tool(src, user, time_to_unwrench, volume=50)) + if(I.use_tool(src, user, time_to_unwrench, volume=50, extra_checks=CALLBACK(src, .proc/can_wrench_in_loc, user))) to_chat(user, "You attach the [name].") var/obj/structure/transit_tube/R = new build_type(loc, dir) transfer_fingerprints_to(R)