From d52d4e39af784ee060b49c4e29d2b279c387f924 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 4 Jan 2023 08:27:55 -0800 Subject: [PATCH] fixes beartraps not allowing unbuckle & nanoui runtime spam (#4934) Co-authored-by: silicons --- code/game/objects/items/weapons/traps.dm | 17 +++++++++++++---- code/modules/nano/interaction/default.dm | 5 ++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/code/game/objects/items/weapons/traps.dm b/code/game/objects/items/weapons/traps.dm index e3594902ca8..e2a51024eea 100644 --- a/code/game/objects/items/weapons/traps.dm +++ b/code/game/objects/items/weapons/traps.dm @@ -1,3 +1,4 @@ +// todo: rewrite this shitcode /obj/item/beartrap name = "mechanical trap" throw_speed = 2 @@ -10,6 +11,7 @@ w_class = ITEMSIZE_NORMAL origin_tech = list(TECH_MATERIAL = 1) matter = list(MAT_STEEL = 18750) + buckle_restrained_resist_time = 15 SECONDS var/deployed = 0 var/camo_net = FALSE var/stun_length = 0.25 SECONDS @@ -80,7 +82,10 @@ if(!has_buckled_mobs()) anchored = FALSE -/obj/item/beartrap/attack_hand(mob/user as mob) +/obj/item/beartrap/attack_hand(mob/user) + // check unbuckle first + if(click_unbuckle_interaction(user)) + return CLICKCHAIN_DO_NOT_PROPAGATE if(deployed) user.visible_message( "[user] starts to disarm \the [src].", @@ -94,8 +99,10 @@ "[user] has disarmed \the [src].", "You have disarmed \the [src]!" ) - deployed = 0 - anchored = 0 + deployed = FALSE + anchored = FALSE + // reset buckle allowed + buckle_allowed = FALSE update_icon() else return ..() @@ -123,10 +130,12 @@ //trap the victim in place setDir(L.dir) + // allow it so they can do buckle interactions at all + buckle_allowed = TRUE buckle_mob(L, BUCKLE_OP_FORCE) L.Stun(stun_length) to_chat(L, "The steel jaws of \the [src] bite into you, trapping you in place!") - deployed = 0 + deployed = FALSE /obj/item/beartrap/Crossed(atom/movable/AM as mob|obj) if(AM.is_incorporeal()) diff --git a/code/modules/nano/interaction/default.dm b/code/modules/nano/interaction/default.dm index 29f0f33455b..e1358fb5334 100644 --- a/code/modules/nano/interaction/default.dm +++ b/code/modules/nano/interaction/default.dm @@ -12,7 +12,10 @@ /mob/observer/dead/nano_default_can_use_topic(var/src_object) if(can_admin_interact()) return UI_INTERACTIVE // Admins are more equal - if(!client || get_dist(src_object, src) > client.view) // Preventing ghosts from having a million windows open by limiting to objects in range + if(!client) + return UI_CLOSE + // todo: in view range for zooming + if(get_dist(src, src_object) > min(CEILING(client.current_viewport_width / 2, 1), CEILING(client.current_viewport_height / 2, 1))) return UI_CLOSE return UI_UPDATE // Ghosts can view updates