From ed0e9f2d329cb5da448ccf62a6710314c10b11cd Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 5 Jul 2024 17:08:07 -0400 Subject: [PATCH] Makes it easier to place tiles on multi-z holes (#2536) * Makes it easier to place tiles on multi-z holes (#77935) Adds the "open space click handler" to tile stacks, which makes it so you don't have to pixel hunt for a turf on the BELOW z level in order to fix a hole. This exists on rods and rpds since they're often used to fix holes. But wasn't added to tiles when they were made to be able to fix holes directly, without rods. Additionally, closes #77540 by having the open space click handler loop up z levels so that it works if you're clicking on items from multiple z levels away. The current behavior can be very frustrating to work around, and appears to not be intended. :cl: fix: Made it easier to place tiles on multi z level holes /:cl: * Fix RCDing multi-z openspace --------- Co-authored-by: FlufflesTheDog --- code/game/objects/items/rcd/RCD.dm | 6 ++++++ code/game/objects/items/stacks/tiles/tile_types.dm | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/code/game/objects/items/rcd/RCD.dm b/code/game/objects/items/rcd/RCD.dm index 83207ff7a070..7e8ba630cf47 100644 --- a/code/game/objects/items/rcd/RCD.dm +++ b/code/game/objects/items/rcd/RCD.dm @@ -434,6 +434,7 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) airlock_electronics.name = "Access Control" airlock_electronics.holder = src GLOB.rcd_list += src + AddElement(/datum/element/openspace_item_click_handler) /obj/item/construction/rcd/Destroy() QDEL_NULL(airlock_electronics) @@ -611,6 +612,11 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN +/obj/item/construction/rcd/handle_openspace_click(turf/target, mob/user, proximity_flag, click_parameters) + if((!proximity_flag && !ranged) || (ranged && !range_check(target, user))) + return + afterattack(target, user, TRUE, click_parameters) + /obj/item/construction/rcd/proc/detonate_pulse() audible_message("[src] begins to vibrate and \ buzz loudly!","[src] begins \ diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index f029858f4ef3..e47cbd0ebdda 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -33,6 +33,7 @@ . = ..() pixel_x = rand(-3, 3) pixel_y = rand(-3, 3) //randomize a little + AddElement(/datum/element/openspace_item_click_handler) if(tile_reskin_types) tile_reskin_types = tile_reskin_list(tile_reskin_types) if(tile_rotate_dirs) @@ -100,6 +101,10 @@ playsound(target_plating, 'sound/weapons/genhit.ogg', 50, TRUE) return target_plating +/obj/item/stack/tile/handle_openspace_click(turf/target, mob/user, proximity_flag, click_parameters) + if(proximity_flag) + target.attackby(src, user, click_parameters) + //Grass /obj/item/stack/tile/grass name = "grass tile"