From 4cf08ab516759c8c43c8d0ba6a76700ac6412ada Mon Sep 17 00:00:00 2001 From: TheDanseMacabre <57339900+TheDanseMacabre@users.noreply.github.com> Date: Fri, 22 May 2020 15:39:32 -0400 Subject: [PATCH] Ports fully automatic drag-to-fire functionality from Bay. (#8917) Watch the video until the end. The gatling gun is slow to shoot, for some reason, but the rest are all full-auto. --- code/modules/projectiles/gun.dm | 16 ++++++++ .../projectiles/guns/projectile/automatic.dm | 13 +++--- .../projectiles/guns/projectile/minigun.dm | 7 ++-- html/changelogs/dansemacabre-master.yml | 41 +++++++++++++++++++ 4 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 html/changelogs/dansemacabre-master.yml diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index a09a198077e..f0a1fb274f7 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -49,6 +49,7 @@ zoomdevicename = "scope" var/burst = 1 + var/can_autofire = FALSE var/fire_delay = 6 //delay after shooting before the gun can be used again var/burst_delay = 1 //delay between shots, if firing in bursts var/move_delay = 0 @@ -819,3 +820,18 @@ qdel(pin) pin = null return ..() + +//Autofire + +/obj/item/gun/proc/can_autofire() + return (can_autofire && world.time >= next_fire_time) + +/client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params) + . = ..() + if(over_object) + var/mob/living/M = mob + if(istype(M) && !M.incapacitated()) + var/obj/item/gun/gun = mob.get_active_hand() + if(istype(gun) && gun.can_autofire()) + M.set_dir(get_dir(M, over_object)) + gun.Fire(get_turf(over_object), mob, params, (get_dist(over_object, mob) <= 1), FALSE) diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 0b74922cc21..6f7112fe824 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -17,9 +17,10 @@ sel_mode = 1 firemodes = list( - list(mode_name="semiauto", burst=1, fire_delay=null, move_delay=null, burst_accuracy=null, dispersion=null), - list(mode_name="3-round bursts", burst=3, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,0), dispersion=list(0, 10, 15)), - list(mode_name="short bursts", burst=5, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,,-1,-1), dispersion=list(5, 10, 15, 20)) + list(mode_name="semiauto", can_autofire=0, burst=1, fire_delay=null, move_delay=null, burst_accuracy=null, dispersion=null), + list(mode_name="3-round bursts", can_autofire=0, burst=3, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,0), dispersion=list(0, 10, 15)), + list(mode_name="short bursts", can_autofire=0, burst=5, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,,-1,-1), dispersion=list(5, 10, 15, 20)), + list(mode_name="full auto", can_autofire=1, burst=1, fire_delay=1, one_hand_penalty=12, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(1.0, 1.0, 1.0, 1.0, 1.2)) ) //Submachine guns and personal defence weapons, go. @@ -119,7 +120,8 @@ firemodes = list( list(mode_name="semiauto", burst=1, fire_delay=10, move_delay=null, burst_accuracy=null, dispersion=null), list(mode_name="3-round bursts", burst=3, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,0), dispersion=list(0, 5, 10)), - list(mode_name="short bursts", burst=5, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,0,-1,-1), dispersion=list(5, 5, 15)) + list(mode_name="short bursts", burst=5, fire_delay=null, move_delay=null, burst_accuracy=list(1,0,0,-1,-1), dispersion=list(5, 5, 15)), + list(mode_name="full auto", can_autofire=1, burst=1, fire_delay=1, one_hand_penalty=12, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(1.0, 1.0, 1.0, 1.0, 1.2)), ) //slower to regain aim, more inaccurate if not wielding @@ -273,7 +275,8 @@ firemodes = list( list(mode_name="short bursts", burst=5, move_delay=null, burst_accuracy = list(1,0,0,-1,-1), dispersion = list(3, 6, 9)), - list(mode_name="long bursts", burst=8, move_delay=null, burst_accuracy = list(1,0,0,-1,-1,-1,-2,-2), dispersion = list(8)) + list(mode_name="long bursts", burst=8, move_delay=null, burst_accuracy = list(1,0,0,-1,-1,-1,-2,-2), dispersion = list(8)), + list(mode_name="full auto", can_autofire=1, burst=1, fire_delay=1, one_hand_penalty=12, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(1.0, 1.0, 1.0, 1.0, 1.2)) ) var/cover_open = 0 diff --git a/code/modules/projectiles/guns/projectile/minigun.dm b/code/modules/projectiles/guns/projectile/minigun.dm index a9f75b46c17..c9e078a557e 100644 --- a/code/modules/projectiles/guns/projectile/minigun.dm +++ b/code/modules/projectiles/guns/projectile/minigun.dm @@ -127,8 +127,9 @@ origin_tech = null firemodes = list( - list(mode_name="short bursts", burst=6, move_delay=8, burst_accuracy = list(0,-1,-1,-2,-2), dispersion = list(3, 6, 9)), - list(mode_name="long bursts", burst=12, move_delay=9, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(8)) + list(mode_name="short bursts", can_autofire=0, burst=6, move_delay=8, burst_accuracy = list(0,-1,-1,-2,-2), dispersion = list(3, 6, 9)), + list(mode_name="long bursts", can_autofire=0, burst=12, move_delay=9, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(8)), + list(mode_name="full auto", can_autofire=1, burst=1, fire_delay=1, one_hand_penalty=12, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(1.0, 1.0, 1.0, 1.0, 1.2)) ) @@ -162,4 +163,4 @@ /obj/item/gun/projectile/automatic/rifle/minigun/Move() ..() if(loc != source.loc) - INVOKE_ASYNC(source, /obj/item/minigunpack/.proc/remove_gun) \ No newline at end of file + INVOKE_ASYNC(source, /obj/item/minigunpack/.proc/remove_gun) diff --git a/html/changelogs/dansemacabre-master.yml b/html/changelogs/dansemacabre-master.yml new file mode 100644 index 00000000000..69336376e87 --- /dev/null +++ b/html/changelogs/dansemacabre-master.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: DanseMacabre + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Fully automatic drag-to-fire for a number of burst-capable weapons. Including, but not limited to: SMGs, the STS-35, ZI-550, gatling gun, and the SAW."