Skip to content

Commit

Permalink
Adds antispam check similar to what sentrygun has to m56d (#5246)
Browse files Browse the repository at this point in the history
# 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
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
balance: m56d can not be placed within five tiles of another one
/:cl:

---------

Co-authored-by: vincibrv <[email protected]>
Co-authored-by: Drathek <[email protected]>
  • Loading branch information
3 people committed Jan 1, 2024
1 parent d103891 commit aee6a27
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions code/modules/cm_marines/smartgun_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...)
. = ..()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aee6a27

Please sign in to comment.