From c88ad114cbabe99dd9153f53b4630fb522860fbe Mon Sep 17 00:00:00 2001
From: AndroBetel <44546836+AndroBetel@users.noreply.github.com>
Date: Tue, 20 Feb 2024 10:59:19 +0300
Subject: [PATCH] 2
---
code/modules/cm_marines/smartgun_mount.dm | 12 ++++++++++++
code/modules/projectiles/guns/smartgun.dm | 4 ++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/code/modules/cm_marines/smartgun_mount.dm b/code/modules/cm_marines/smartgun_mount.dm
index 501cbfdd6e..32983f455c 100644
--- a/code/modules/cm_marines/smartgun_mount.dm
+++ b/code/modules/cm_marines/smartgun_mount.dm
@@ -512,6 +512,8 @@
burst_scatter_mult = SCATTER_AMOUNT_TIER_7
update_icon()
AddComponent(/datum/component/automatedfire/autofire, fire_delay, burst_fire_delay, burst_amount, gun_firemode, autofire_slow_mult, CALLBACK(src, PROC_REF(set_burst_firing)), CALLBACK(src, PROC_REF(reset_fire)), CALLBACK(src, PROC_REF(try_fire)), CALLBACK(src, PROC_REF(display_ammo)))
+ AddComponent(/datum/component/iff_fire_prevention)
+
/obj/structure/machinery/m56d_hmg/Destroy(force) //Make sure we pick up our trash.
operator?.unset_interaction()
@@ -723,6 +725,16 @@
final_angle += rand(-total_scatter_angle, total_scatter_angle)
target = get_angle_target_turf(T, final_angle, 30)
+ var/before_fire_cancel = SEND_SIGNAL(src, COMSIG_GUN_BEFORE_FIRE, in_chamber, target, operator)
+
+ if(before_fire_cancel)
+ if(before_fire_cancel & COMPONENT_CANCEL_GUN_BEFORE_FIRE)
+ return AUTOFIRE_CONTINUE
+
+ if(before_fire_cancel & COMPONENT_HARD_CANCEL_GUN_BEFORE_FIRE)
+ return
+
+
in_chamber.weapon_cause_data = create_cause_data(initial(name), operator)
in_chamber.setDir(dir)
in_chamber.def_zone = pick("chest","chest","chest","head")
diff --git a/code/modules/projectiles/guns/smartgun.dm b/code/modules/projectiles/guns/smartgun.dm
index 7a65705d48..7b444de0db 100644
--- a/code/modules/projectiles/guns/smartgun.dm
+++ b/code/modules/projectiles/guns/smartgun.dm
@@ -411,7 +411,7 @@
else
drain -= 50
recalculate_attachment_bonuses()
-
+/*
/obj/item/weapon/gun/smartgun/proc/toggle_auto_fire(mob/user)
if(!(flags_item & WIELDED))
to_chat(user, "[icon2html(src, usr)] You need to wield \the [src] to enable autofire.")
@@ -547,7 +547,7 @@
Fire(target,user)
target = null
-/*
+
/obj/item/weapon/gun/smartgun/proc/toggle_motion_detector(mob/user)
to_chat(user, "[icon2html(src, usr)] You [motion_detector? "disable" : "enable"] \the [src]'s motion detector.")
playsound(loc,'sound/machines/click.ogg', 25, 1)