From db1bfd18fc3eb5d542b6e6e4929bd9d524128146 Mon Sep 17 00:00:00 2001 From: mochi Date: Mon, 8 Jun 2020 01:08:04 +0200 Subject: [PATCH 01/12] Fix Cleanbots not showing on PDA app, touch up UI --- code/modules/pda/cart_apps.dm | 27 ++++------- nano/templates/pda_janitor.tmpl | 84 ++++++++++++++++++++------------- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/code/modules/pda/cart_apps.dm b/code/modules/pda/cart_apps.dm index 6c03241a096..dff77f27aed 100644 --- a/code/modules/pda/cart_apps.dm +++ b/code/modules/pda/cart_apps.dm @@ -366,6 +366,7 @@ JaniData["user_loc"] = list("x" = cl.x, "y" = cl.y) else JaniData["user_loc"] = list("x" = 0, "y" = 0) + var/MopData[0] for(var/obj/item/mop/M in GLOB.janitorial_equipment) var/turf/ml = get_turf(M) @@ -375,10 +376,6 @@ var/direction = get_dir(pda, M) MopData[++MopData.len] = list ("x" = ml.x, "y" = ml.y, "dir" = uppertext(dir2text(direction)), "status" = M.reagents.total_volume ? "Wet" : "Dry") - if(!MopData.len) - MopData[++MopData.len] = list("x" = 0, "y" = 0, dir=null, status = null) - - var/BucketData[0] for(var/obj/structure/mopbucket/B in GLOB.janitorial_equipment) var/turf/bl = get_turf(B) @@ -386,13 +383,10 @@ if(bl.z != cl.z) continue var/direction = get_dir(pda,B) - BucketData[++BucketData.len] = list ("x" = bl.x, "y" = bl.y, "dir" = uppertext(dir2text(direction)), "status" = B.reagents.total_volume/100) - - if(!BucketData.len) - BucketData[++BucketData.len] = list("x" = 0, "y" = 0, dir=null, status = null) + BucketData[++BucketData.len] = list ("x" = bl.x, "y" = bl.y, "dir" = uppertext(dir2text(direction)), "volume" = B.reagents.total_volume, "max_volume" = B.reagents.maximum_volume) var/CbotData[0] - for(var/mob/living/simple_animal/bot/cleanbot/B in GLOB.simple_animals) + for(var/mob/living/simple_animal/bot/cleanbot/B in GLOB.simple_animals[AI_ON]) var/turf/bl = get_turf(B) if(bl) if(bl.z != cl.z) @@ -400,9 +394,6 @@ var/direction = get_dir(pda,B) CbotData[++CbotData.len] = list("x" = bl.x, "y" = bl.y, "dir" = uppertext(dir2text(direction)), "status" = B.on ? "Online" : "Offline") - - if(!CbotData.len) - CbotData[++CbotData.len] = list("x" = 0, "y" = 0, dir=null, status = null) var/CartData[0] for(var/obj/structure/janitorialcart/B in GLOB.janitorial_equipment) var/turf/bl = get_turf(B) @@ -410,12 +401,10 @@ if(bl.z != cl.z) continue var/direction = get_dir(pda,B) - CartData[++CartData.len] = list("x" = bl.x, "y" = bl.y, "dir" = uppertext(dir2text(direction)), "status" = B.reagents.total_volume/100) - if(!CartData.len) - CartData[++CartData.len] = list("x" = 0, "y" = 0, dir=null, status = null) + CartData[++CartData.len] = list("x" = bl.x, "y" = bl.y, "dir" = uppertext(dir2text(direction)), "volume" = B.reagents.total_volume, "max_volume" = B.reagents.maximum_volume) - JaniData["mops"] = MopData - JaniData["buckets"] = BucketData - JaniData["cleanbots"] = CbotData - JaniData["carts"] = CartData + JaniData["mops"] = MopData.len ? MopData : null + JaniData["buckets"] = BucketData.len ? BucketData : null + JaniData["cleanbots"] = CbotData.len ? CbotData : null + JaniData["carts"] = CartData.len ? CartData : null data["janitor"] = JaniData diff --git a/nano/templates/pda_janitor.tmpl b/nano/templates/pda_janitor.tmpl index a2fd282ad3f..864692d8a04 100644 --- a/nano/templates/pda_janitor.tmpl +++ b/nano/templates/pda_janitor.tmpl @@ -8,43 +8,59 @@ {{/if}}
- {{for data.janitor.mops}} - {{if value.x==0}} - Unable to locate Mop - {{else}} - Mop Location: - ({{:value.x}} / {{:value.y}}) - {{:value.dir}} - Status: {{:value.status}}
- {{/if}} - {{/for}} + {{if data.janitor.mops}} + Mop Locations: + + {{else}} + Unable to locate Mops + {{/if}}
- {{for data.janitor.buckets}} - {{if value.x==0}} - Unable to locate Water Buckets - {{else}} - Water Buckets Location: - ({{:value.x}} / {{:value.y}}) - {{:value.dir}} - Water Level: {{:value.status}}
- {{/if}} - {{/for}} + {{if data.janitor.buckets}} + Mop Bucket Locations: + + {{else}} + Unable to locate Mop Buckets + {{/if}}
- {{for data.janitor.cleanbots}} - {{if value.x==0}} - Unable to locate Clean Bots - {{else}} - Clean Bots Location: - ({{:value.x}} / {{:value.y}}) - {{:value.dir}} - Status: {{:value.status}}
- {{/if}} - {{/for}} + {{if data.janitor.cleanbots}} + Cleanbot Locations: + + {{else}} + Unable to locate Cleanbots + {{/if}}
-
- {{for data.janitor.carts}} - {{if value.x==0}} - Unable to locate Janitorial Cart - {{else}} - Janitorial cart Location: - ({{:value.x}} / {{:value.y}}) - {{:value.dir}} - Status: {{:value.status}}
- {{/if}} - {{/for}} +
+ {{if data.janitor.carts}} + Janitorial Cart Locations: +
    + {{for data.janitor.carts}} +
  • + ({{:value.x}} / {{:value.y}}) - {{:value.dir}} - Water Level: {{:value.volume}}/{{:value.max_volume}} +
  • + {{/for}} +
+ {{else}} + Unable to locate Janitorial Carts + {{/if}}
-
\ No newline at end of file + From 4055d58ff4a514501e3b2598e592456d6a88ff33 Mon Sep 17 00:00:00 2001 From: mochi Date: Mon, 8 Jun 2020 09:25:13 +0200 Subject: [PATCH 02/12] Fix esword children (cutlass) not using right icon --- code/game/objects/items/weapons/melee/energy.dm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 006de63af17..f6fb213b353 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -6,7 +6,7 @@ var/list/nemesis_factions //Any mob with a faction that exists in this list will take bonus damage/effects w_class = WEIGHT_CLASS_SMALL var/w_class_on = WEIGHT_CLASS_BULKY - var/icon_state_on = "axe1" + var/icon_state_on var/list/attack_verb_on = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") hitsound = 'sound/weapons/blade1.ogg' // Probably more appropriate than the previous hitsound. -- Dave usesound = 'sound/weapons/blade1.ogg' @@ -48,9 +48,9 @@ throw_speed = 4 if(attack_verb_on.len) attack_verb = attack_verb_on - if(!item_color) + if(icon_state_on) icon_state = icon_state_on - set_light(brightness_on) + set_light(brightness_on, l_color = item_color ? colormap[item_color] : null) else icon_state = "sword[item_color]" set_light(brightness_on, l_color=colormap[item_color]) @@ -80,6 +80,7 @@ name = "energy axe" desc = "An energised battle axe." icon_state = "axe0" + icon_state_on = "axe1" force = 40 force_on = 150 throwforce = 25 @@ -301,9 +302,9 @@ throw_speed = 4 if(attack_verb_on.len) attack_verb = attack_verb_on - if(!item_color) + if(icon_state_on) icon_state = icon_state_on - set_light(brightness_on) + set_light(brightness_on, l_color = item_color ? colormap[item_color] : null) else icon_state = "sword[item_color]" set_light(brightness_on, l_color=colormap[item_color]) From f8b76f0a6474611b9881f078ebd666e58e2572ca Mon Sep 17 00:00:00 2001 From: mochi Date: Tue, 9 Jun 2020 14:00:55 +0200 Subject: [PATCH 03/12] Allow grab on buckled people, fix visuals The code previously printed a message saying the user can't grab a buckled mob, but still allowed them to. This commit removes that message and fixes the visual bugs that come with grabbing (or ungrabbing) buckled mobs --- code/modules/mob/living/living_defense.dm | 2 -- code/modules/mob/mob_grab.dm | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 604fd47de16..053c7fa7986 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -260,8 +260,6 @@ add_attack_logs(user, src, "Grabbed passively", ATKLOG_ALL) var/obj/item/grab/G = new /obj/item/grab(user, src) - if(buckled) - to_chat(user, "You cannot grab [src]; [p_they()] [p_are()] buckled in!") if(!G) //the grab will delete itself in New if src is anchored return 0 user.put_in_active_hand(G) diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index f595f6b4839..a49d7d116c1 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -296,7 +296,9 @@ assailant.next_move = world.time + 10 if(!affecting.get_organ_slot("breathing_tube")) affecting.AdjustLoseBreath(1) - affecting.setDir(WEST) + + 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. @@ -433,9 +435,10 @@ /obj/item/grab/Destroy() if(affecting) - affecting.pixel_x = 0 - affecting.pixel_y = 0 //used to be an animate, not quick enough for del'ing - affecting.layer = initial(affecting.layer) + if (!affecting.buckled) + affecting.pixel_x = 0 + affecting.pixel_y = 0 //used to be an animate, not quick enough for del'ing + affecting.layer = initial(affecting.layer) affecting.grabbed_by -= src affecting = null if(assailant) From d39d9909367e470336b87583ccd2a2ed517d187c Mon Sep 17 00:00:00 2001 From: mochi Date: Tue, 9 Jun 2020 14:06:24 +0200 Subject: [PATCH 04/12] Fix upside down glitch with meat spike This commit fixes a glitch where leaving a meatspike unexpectedly can leave the mob upside down until hooked again --- code/game/objects/structures/kitchen_spike.dm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm index 21af7f6e615..1f0d4b8b473 100644 --- a/code/game/objects/structures/kitchen_spike.dm +++ b/code/game/objects/structures/kitchen_spike.dm @@ -130,16 +130,18 @@ release_mob(M) /obj/structure/kitchenspike/proc/release_mob(mob/living/M) - var/matrix/m180 = matrix(M.transform) - m180.Turn(180) - animate(M, transform = m180, time = 3) - M.pixel_y = M.get_standard_pixel_y_offset(180) M.adjustBruteLoss(30) src.visible_message(text("[M] falls free of [src]!")) unbuckle_mob(M, force = TRUE) M.emote("scream") M.AdjustWeakened(10) +/obj/structure/kitchenspike/post_unbuckle_mob(mob/living/M) + M.pixel_y = M.get_standard_pixel_y_offset(0) + var/matrix/m180 = matrix(M.transform) + m180.Turn(180) + animate(M, transform = m180, time = 3) + /obj/structure/kitchenspike/Destroy() if(has_buckled_mobs()) for(var/mob/living/L in buckled_mobs) From a67d684b010ca2f1d8f0da01be98c19d84762069 Mon Sep 17 00:00:00 2001 From: mochi Date: Tue, 9 Jun 2020 14:07:41 +0200 Subject: [PATCH 05/12] Fix entering pods and stuff while buckled You already can't drag and drop buckled people onto pods and stuff but they can still enter them by themselves. This commit fixes that --- code/game/dna/dna_modifier.dm | 2 +- code/game/machinery/Sleeper.dm | 2 +- code/game/machinery/cryo.dm | 2 +- code/game/machinery/cryopod.dm | 3 +++ code/game/machinery/suit_storage_unit.dm | 2 ++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index a6ec98e8866..eae6edd3bd4 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -144,7 +144,7 @@ set category = null set name = "Enter DNA Scanner" - if(usr.incapacitated()) //are you cuffed, dying, lying, stunned or other + if(usr.incapacitated() || usr.buckled) //are you cuffed, dying, lying, stunned or other return if(!ishuman(usr)) //Make sure they're a mob that has dna to_chat(usr, "Try as you might, you can not climb up into the [src].") diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 70d88e92b71..e4d0befa61e 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -526,7 +526,7 @@ if(panel_open) to_chat(usr, "Close the maintenance panel first.") return - if(usr.incapacitated()) //are you cuffed, dying, lying, stunned or other + if(usr.incapacitated() || usr.buckled) //are you cuffed, dying, lying, stunned or other return if(usr.has_buckled_mobs()) //mob attached to us to_chat(usr, "[usr] will not fit into [src] because [usr.p_they()] [usr.p_have()] a slime latched onto [usr.p_their()] head.") diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index c7dc139446a..ea0104e75bf 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -516,7 +516,7 @@ if(stat & (NOPOWER|BROKEN)) return - if(usr.incapacitated()) //are you cuffed, dying, lying, stunned or other + if(usr.incapacitated() || usr.buckled) //are you cuffed, dying, lying, stunned or other return put_mob(usr) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 49b75588468..36196ea4eca 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -671,6 +671,9 @@ to_chat(usr, "[usr] will not fit into [src] because [usr.p_they()] [usr.p_have()] a slime latched onto [usr.p_their()] head.") return + if(usr.incapacitated() || usr.buckled) //are you cuffed, dying, lying, stunned or other + return + visible_message("[usr] starts climbing into [src].") if(do_after(usr, 20, target = usr)) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 3a6f3011747..da4df4f8382 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -772,6 +772,8 @@ if(usr.stat != 0) return + if(usr.incapacitated() || usr.buckled) //are you cuffed, dying, lying, stunned or other + return if(!state_open) to_chat(usr, "The unit's doors are shut.") return From 89eedce9671327d84c2abebc116fa627630623f8 Mon Sep 17 00:00:00 2001 From: mochi Date: Tue, 9 Jun 2020 21:43:42 +0200 Subject: [PATCH 06/12] 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. From 657e78b7e0b9ba1aecdd6d0e6f02a1702326c229 Mon Sep 17 00:00:00 2001 From: mochi Date: Wed, 10 Jun 2020 00:00:05 +0200 Subject: [PATCH 07/12] Remove space between if and ( --- code/game/objects/buckling.dm | 2 +- code/modules/mob/mob_grab.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 2ca2968e176..d9ff28b465b 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -69,7 +69,7 @@ if(buckle_prevents_pull) M.pulledby.stop_pulling() - if (LAZYLEN(M.grabbed_by)) + if(LAZYLEN(M.grabbed_by)) for(var/obj/item/grab/G in M.grabbed_by) qdel(G) diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index ddb5db9094a..640ffb09d4f 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -432,7 +432,7 @@ /obj/item/grab/Destroy() if(affecting) - if (!affecting.buckled) + if(!affecting.buckled) affecting.pixel_x = 0 affecting.pixel_y = 0 //used to be an animate, not quick enough for del'ing affecting.layer = initial(affecting.layer) From 7aba081bc678162ac0a1f6e1b133c4b46a097e16 Mon Sep 17 00:00:00 2001 From: mochi Date: Wed, 10 Jun 2020 09:16:38 +0200 Subject: [PATCH 08/12] Use bots_list instead of simple_animals[AI_ON] --- code/modules/pda/cart_apps.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/pda/cart_apps.dm b/code/modules/pda/cart_apps.dm index dff77f27aed..d47f4184daf 100644 --- a/code/modules/pda/cart_apps.dm +++ b/code/modules/pda/cart_apps.dm @@ -386,7 +386,7 @@ BucketData[++BucketData.len] = list ("x" = bl.x, "y" = bl.y, "dir" = uppertext(dir2text(direction)), "volume" = B.reagents.total_volume, "max_volume" = B.reagents.maximum_volume) var/CbotData[0] - for(var/mob/living/simple_animal/bot/cleanbot/B in GLOB.simple_animals[AI_ON]) + for(var/mob/living/simple_animal/bot/cleanbot/B in GLOB.bots_list) var/turf/bl = get_turf(B) if(bl) if(bl.z != cl.z) From 88e57b30b344cc95e94e80f465bd442a75afa922 Mon Sep 17 00:00:00 2001 From: mochi Date: Sat, 20 Jun 2020 00:43:33 +0200 Subject: [PATCH 09/12] LAZYLEN begone --- code/game/objects/buckling.dm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index d9ff28b465b..4f42a69f005 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(LAZYLEN(buckled_mobs) > 1) + if(buckled_mobs && length(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 @@ -26,15 +26,12 @@ return TRUE /atom/movable/proc/has_buckled_mobs() - if(!buckled_mobs) - return FALSE - if(LAZYLEN(buckled_mobs)) - return TRUE + return buckled_mobs && length(buckled_mobs) /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(LAZYLEN(buckled_mobs) > 1) + if(buckled_mobs && length(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 +51,7 @@ if(check_loc && M.loc != loc) return FALSE - if((!can_buckle && !force) || M.buckled || (LAZYLEN(buckled_mobs) >= max_buckled_mobs) || (buckle_requires_restraints && !M.restrained()) || M == src) + if((!can_buckle && !force) || M.buckled || (length(buckled_mobs) >= max_buckled_mobs) || (buckle_requires_restraints && !M.restrained()) || M == src) return FALSE M.buckling = src if(!M.can_buckle() && !force) @@ -69,7 +66,7 @@ if(buckle_prevents_pull) M.pulledby.stop_pulling() - if(LAZYLEN(M.grabbed_by)) + if(length(M.grabbed_by)) for(var/obj/item/grab/G in M.grabbed_by) qdel(G) From f33ed5c5bc7085416f9429535fa30bf891883163 Mon Sep 17 00:00:00 2001 From: mochi Date: Sun, 21 Jun 2020 15:19:18 +0200 Subject: [PATCH 10/12] Remove redundant null check --- code/game/objects/buckling.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 4f42a69f005..13035bdb35e 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 && length(buckled_mobs) > 1) + if(length(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 @@ -26,12 +26,12 @@ return TRUE /atom/movable/proc/has_buckled_mobs() - return buckled_mobs && length(buckled_mobs) + return length(buckled_mobs) /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 && length(buckled_mobs) > 1) + if(length(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 From 230bde11c345e35be71c3731f1c63c374d4fadb7 Mon Sep 17 00:00:00 2001 From: mochi Date: Wed, 24 Jun 2020 11:16:52 +0200 Subject: [PATCH 11/12] Remove pointless length() --- code/game/objects/buckling.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 13035bdb35e..544c3a2605d 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -66,7 +66,7 @@ if(buckle_prevents_pull) M.pulledby.stop_pulling() - if(length(M.grabbed_by)) + if(M.grabbed_by) for(var/obj/item/grab/G in M.grabbed_by) qdel(G) From fa1eb254cdc1e55fd5d99cca7671c56dd4ec2d79 Mon Sep 17 00:00:00 2001 From: mochi Date: Fri, 26 Jun 2020 13:38:46 +0200 Subject: [PATCH 12/12] Remove if on grabbed_by (never null) --- code/game/objects/buckling.dm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 544c3a2605d..e3c14ff459c 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -66,9 +66,8 @@ if(buckle_prevents_pull) M.pulledby.stop_pulling() - if(M.grabbed_by) - for(var/obj/item/grab/G in M.grabbed_by) - qdel(G) + for(var/obj/item/grab/G in M.grabbed_by) + qdel(G) if(!check_loc && M.loc != loc) M.forceMove(loc)