From 89eedce9671327d84c2abebc116fa627630623f8 Mon Sep 17 00:00:00 2001 From: mochi Date: Tue, 9 Jun 2020 21:43:42 +0200 Subject: [PATCH] Stop grab on buckle, remove redundant code --- code/game/objects/buckling.dm | 12 ++++++++---- code/modules/mob/mob_grab.dm | 15 ++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index bb1070f2cf1..2ca2968e176 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -11,7 +11,7 @@ /atom/movable/attack_hand(mob/living/user) . = ..() if(can_buckle && has_buckled_mobs()) - if(buckled_mobs.len > 1) + if(LAZYLEN(buckled_mobs) > 1) var/unbuckled = input(user, "Who do you wish to unbuckle?", "Unbuckle Who?") as null|mob in buckled_mobs if(user_unbuckle_mob(unbuckled,user)) return TRUE @@ -28,13 +28,13 @@ /atom/movable/proc/has_buckled_mobs() if(!buckled_mobs) return FALSE - if(buckled_mobs.len) + if(LAZYLEN(buckled_mobs)) return TRUE /atom/movable/attack_robot(mob/living/user) . = ..() if(can_buckle && has_buckled_mobs() && Adjacent(user)) // attack_robot is called on all ranges, so the Adjacent check is needed - if(buckled_mobs.len > 1) + if(LAZYLEN(buckled_mobs) > 1) var/unbuckled = input(user, "Who do you wish to unbuckle?", "Unbuckle Who?") as null|mob in buckled_mobs if(user_unbuckle_mob(unbuckled,user)) return TRUE @@ -54,7 +54,7 @@ if(check_loc && M.loc != loc) return FALSE - if((!can_buckle && !force) || M.buckled || (buckled_mobs.len >= max_buckled_mobs) || (buckle_requires_restraints && !M.restrained()) || M == src) + if((!can_buckle && !force) || M.buckled || (LAZYLEN(buckled_mobs) >= max_buckled_mobs) || (buckle_requires_restraints && !M.restrained()) || M == src) return FALSE M.buckling = src if(!M.can_buckle() && !force) @@ -69,6 +69,10 @@ if(buckle_prevents_pull) M.pulledby.stop_pulling() + if (LAZYLEN(M.grabbed_by)) + for(var/obj/item/grab/G in M.grabbed_by) + qdel(G) + if(!check_loc && M.loc != loc) M.forceMove(loc) diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index a49d7d116c1..ddb5db9094a 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -53,12 +53,11 @@ hud.master = src //check if assailant is grabbed by victim as well - if(assailant.grabbed_by) - for(var/obj/item/grab/G in assailant.grabbed_by) - if(G.assailant == affecting && G.affecting == assailant) - G.dancing = 1 - G.adjust_position() - dancing = 1 + for(var/obj/item/grab/G in assailant.grabbed_by) + if(G.assailant == affecting && G.affecting == assailant) + G.dancing = 1 + G.adjust_position() + dancing = 1 clean_grabbed_by(assailant, affecting) adjust_position() @@ -276,7 +275,7 @@ assailant.visible_message("[assailant] has reinforced [assailant.p_their()] grip on [affecting] (now neck)!") state = GRAB_NECK icon_state = "grabbed+1" - assailant.setDir(get_dir(assailant, affecting)) + add_attack_logs(assailant, affecting, "Neck grabbed", ATKLOG_ALL) if(!iscarbon(assailant)) affecting.LAssailant = null @@ -297,8 +296,6 @@ if(!affecting.get_organ_slot("breathing_tube")) affecting.AdjustLoseBreath(1) - if (!affecting.buckled) - affecting.setDir(WEST) adjust_position() //This is used to make sure the victim hasn't managed to yackety sax away before using the grab.