From d954588c9adf6d7ab85ad2ce757c2d7a4261031b Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Sun, 26 Jul 2020 16:30:50 -0700 Subject: [PATCH 1/2] Update portable_turret.dm --- .../machinery/porta_turret/portable_turret.dm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 1887ee46c0..6de8c71eba 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -1,4 +1,4 @@ -#define TURRET_STUN 0 +w#define TURRET_STUN 0 #define TURRET_LETHAL 1 #define POPUP_ANIM_TIME 5 @@ -17,6 +17,7 @@ active_power_usage = 300 //when active, this turret takes up constant 300 Equipment power req_access = list(ACCESS_SEC_DOORS) power_channel = EQUIP //drains power from the EQUIPMENT channel + speed_process = TRUE var/base_icon_state = "standard" var/scan_range = 7 @@ -53,7 +54,7 @@ var/last_fired = 0 //world.time the turret last fired var/shot_delay = 15 //ticks until next shot (1.5 ?) - + var/shot_stagger = 0 // sleep() shots to stagger attacks var/check_records = 1 //checks if it can use the security records var/criminals = 1 //checks if it can shoot people on arrest @@ -436,6 +437,9 @@ else if(!always_up) popDown() // no valid targets, close the cover +/obj/machinery/porta_turret/proc/randomize_shot_stagger() + shot_stagger = rand(0, min(2 SECONDS, round(shot_delay/3, world.tick_lag))) + /obj/machinery/porta_turret/proc/tryToShootAt(list/atom/movable/targets) while(targets.len > 0) var/atom/movable/M = pick(targets) @@ -443,7 +447,6 @@ if(target(M)) return 1 - /obj/machinery/porta_turret/proc/popUp() //pops the turret up if(!anchored) return @@ -525,11 +528,14 @@ if(target) popUp() //pop the turret up if it's not already up. setDir(get_dir(base, target))//even if you can't shoot, follow the target - shootAt(target) + INVOKE_ASYNC(src, .proc/shootAt, target) return 1 return -/obj/machinery/porta_turret/proc/shootAt(atom/movable/target) +/obj/machinery/porta_turret/proc/shootAt(atom/movable/target, stagger_enabled = FALSE) + if(stagger_enabled) + randomize_shot_stagger() + sleep(shot_stagger) if(!raised) //the turret has to be raised in order to fire - makes sense, right? return From d52892f000539efad804ae32e99c6cacaa68965d Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Sun, 26 Jul 2020 16:32:20 -0700 Subject: [PATCH 2/2] Update portable_turret.dm --- code/game/machinery/porta_turret/portable_turret.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 6de8c71eba..2a60711a81 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -1,4 +1,4 @@ -w#define TURRET_STUN 0 +#define TURRET_STUN 0 #define TURRET_LETHAL 1 #define POPUP_ANIM_TIME 5