Stop grab on buckle, remove redundant code

This commit is contained in:
mochi
2020-06-09 21:43:42 +02:00
parent a67d684b01
commit 89eedce967
2 changed files with 14 additions and 13 deletions
+8 -4
View File
@@ -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)