From aee6a27cd5304cc79f2ef1d2004827559deaf183 Mon Sep 17 00:00:00 2001 From: cuberound <122645057+cuberound@users.noreply.github.com> Date: Mon, 1 Jan 2024 09:50:48 +0100 Subject: [PATCH] Adds antispam check similar to what sentrygun has to m56d (#5246) # About the pull request (doing this on a bench so it will need some cleanup sorry for that) adds check to placing the m56d that checks if there is another m56d in surounding area to prevent mg spam, numbers and stuff are placeholder it will get cleaned up ( I will be happy if you help me with it) m56d spam has come to be an issue recently, I am part of it and do not want it to end up like omni sentryguns did (compleatly useless garbage) so I try to take better aproach to the balance then just AP or firerate nerf that would not solve the issue # Explain why it's good for the game prevents m56d massing and encorages m56d users to spread out and cover diferent chokes instead of hosing down on and obliterating anyone who comes in the way # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: balance: m56d can not be placed within five tiles of another one /:cl: --------- Co-authored-by: vincibrv Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- code/modules/cm_marines/smartgun_mount.dm | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/code/modules/cm_marines/smartgun_mount.dm b/code/modules/cm_marines/smartgun_mount.dm index 21c8a58e279b..ecb592f5f30b 100644 --- a/code/modules/cm_marines/smartgun_mount.dm +++ b/code/modules/cm_marines/smartgun_mount.dm @@ -42,8 +42,12 @@ flags_equip_slot = SLOT_BACK icon = 'icons/turf/whiskeyoutpost.dmi' icon_state = "M56D_gun_e" - var/rounds = 0 // How many rounds are in the weapon. This is useful if we break down our guns. - var/has_mount = FALSE // Indicates whether the M56D will come with its folding mount already attached + ///How many rounds are in the weapon. This is useful if we break down our guns. + var/rounds = 0 + ///Indicates whether the M56D will come with its folding mount already attached + var/has_mount = FALSE + ///The distance this has to be away from other m56d_hmg and m56d_post to be placed. + var/defense_check_range = 5 /obj/item/device/m56d_gun/Initialize(mapload, ...) . = ..() @@ -84,7 +88,10 @@ /obj/item/device/m56d_gun/attack_self(mob/user) ..() - + for(var/obj/structure/machinery/machine in urange(defense_check_range, loc)) + if(istype(machine, /obj/structure/machinery/m56d_hmg) || istype(machine, /obj/structure/machinery/m56d_post)) + to_chat(user, SPAN_WARNING("This is too close to [machine]!")) + return if(!ishuman(user)) return if(!has_mount) @@ -125,6 +132,10 @@ if(!do_after(user, 1 SECONDS, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) return + for(var/obj/structure/machinery/machine in urange(defense_check_range, loc)) + if(istype(machine, /obj/structure/machinery/m56d_hmg) || istype(machine, /obj/structure/machinery/m56d_post)) + to_chat(user, SPAN_WARNING("This is too close to [machine]!")) + return var/obj/structure/machinery/m56d_post/M = new /obj/structure/machinery/m56d_post(user.loc) M.setDir(user.dir) // Make sure we face the right direction @@ -307,6 +318,10 @@ if(istype(O,/obj/item/device/m56d_gun)) //lets mount the MG onto the mount. var/obj/item/device/m56d_gun/MG = O + for(var/obj/structure/machinery/machine in urange(MG.defense_check_range, loc, TRUE)) + if(istype(machine, /obj/structure/machinery/m56d_hmg) || istype(machine, /obj/structure/machinery/m56d_post)) + to_chat(user, SPAN_WARNING("This is too close to [machine]!")) + return if(!anchored) to_chat(user, SPAN_WARNING("[src] must be anchored! Use a screwdriver!")) return