From 66fd09ae02d2ca44f0845413d975d0e430fb8822 Mon Sep 17 00:00:00 2001 From: bearrrrrrrrr Date: Tue, 16 Jan 2024 03:14:03 -0500 Subject: [PATCH] catches autowiki --- code/modules/projectiles/gun_attachables.dm | 17 +++++++++-------- code/modules/projectiles/guns/rifles.dm | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/modules/projectiles/gun_attachables.dm b/code/modules/projectiles/gun_attachables.dm index a0c5248bd6..5c81a69b71 100644 --- a/code/modules/projectiles/gun_attachables.dm +++ b/code/modules/projectiles/gun_attachables.dm @@ -165,7 +165,7 @@ Defined in conflicts.dm of the #defines folder. // Apply bullet traits from attachment to gun's current projectile G.in_chamber.apply_bullet_trait(L) -/obj/item/attachable/proc/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/proc/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) if(!istype(detaching_gub)) return //Guns only if(user) @@ -183,7 +183,8 @@ Defined in conflicts.dm of the #defines folder. qdel(X) break - forceMove(get_turf(detaching_gub)) + if(drop_attachment) + forceMove(get_turf(detaching_gub)) if(sharp) detaching_gub.sharp = 0 @@ -557,7 +558,7 @@ Defined in conflicts.dm of the #defines folder. ..() G.attachable_offset["muzzle_x"] = 27 -/obj/item/attachable/mateba/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/mateba/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) ..() detaching_gub.attachable_offset["muzzle_x"] = 20 @@ -848,7 +849,7 @@ Defined in conflicts.dm of the #defines folder. . = ..() G.AddElement(/datum/element/drop_retrieval/gun, retrieval_slot) -/obj/item/attachable/magnetic_harness/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/magnetic_harness/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) . = ..() detaching_gub.RemoveElement(/datum/element/drop_retrieval/gun, retrieval_slot) @@ -872,7 +873,7 @@ Defined in conflicts.dm of the #defines folder. G.attachable_offset["under_y"] = 12 -/obj/item/attachable/magnetic_harness/lever_sling/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/magnetic_harness/lever_sling/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) . = ..() detaching_gub.attachable_offset["under_x"] = 24 detaching_gub.attachable_offset["under_y"] = 16 @@ -924,7 +925,7 @@ Defined in conflicts.dm of the #defines folder. . = ..() RegisterSignal(gun, COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES, PROC_REF(handle_attachment_recalc)) -/obj/item/attachable/scope/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/scope/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) . = ..() UnregisterSignal(detaching_gub, COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES) @@ -2545,7 +2546,7 @@ Defined in conflicts.dm of the #defines folder. R.flags_equip_slot &= ~SLOT_WAIST //Can't wear it on the belt slot with stock on when we attach it first time. // When taking it off we want to undo everything not statwise -/obj/item/attachable/stock/revolver/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/stock/revolver/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) ..() var/obj/item/weapon/gun/revolver/m44/R = detaching_gub if(!istype(R)) @@ -3272,7 +3273,7 @@ Defined in conflicts.dm of the #defines folder. RegisterSignal(G, COMSIG_ITEM_DROPPED, PROC_REF(handle_drop)) -/obj/item/attachable/bipod/Detach(mob/user, obj/item/weapon/gun/detaching_gub) +/obj/item/attachable/bipod/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE) UnregisterSignal(detaching_gub, COMSIG_ITEM_DROPPED) if(bipod_deployed) diff --git a/code/modules/projectiles/guns/rifles.dm b/code/modules/projectiles/guns/rifles.dm index a5e98b7d51..fb6627faec 100644 --- a/code/modules/projectiles/guns/rifles.dm +++ b/code/modules/projectiles/guns/rifles.dm @@ -1642,7 +1642,7 @@ integrated.flags_attach_features &= ~ATTACH_REMOVABLE var/obj/item/attachable/old_barrel = attachments[integrated.slot] if(old_barrel) - old_barrel.Detach(detaching_gub = src) + old_barrel.Detach(detaching_gub = src, drop_attachment = FALSE) qdel(old_barrel) integrated.Attach(src) update_attachable(integrated.slot)