Adds a cooldown to aiming after shooting, also makes shooting while aiming drop the aim (#3271)

The cooldown is currently 3 seconds as suggested by this thread

also adds a nifty proc to Aiming to set said cool-down, it's variable.
The proc is "aim_cooldown(x)" with x being the time you want them unable to aim.
This commit is contained in:
Pacmandevil
2017-08-29 23:18:59 +03:00
committed by Erki
parent 419ee9e41c
commit ff3b59f67f
5 changed files with 59 additions and 11 deletions
@@ -1,12 +1,12 @@
//These are called by the on-screen buttons, adjusting what the victim can and cannot do.
/client/proc/add_gun_icons()
if(!usr) return 1 // This can runtime if someone manages to throw a gun out of their hand before the proc is called.
screen |= usr.item_use_icon
screen |= usr.gun_move_icon
screen |= usr.radio_use_icon
if(!mob) return 1 // This can runtime if someone manages to throw a gun out of their hand before the proc is called.
screen |= mob.item_use_icon
screen |= mob.gun_move_icon
screen |= mob.radio_use_icon
/client/proc/remove_gun_icons()
if(!usr) return 1 // Runtime prevention on N00k agents spawning with SMG
screen -= usr.item_use_icon
screen -= usr.gun_move_icon
screen -= usr.radio_use_icon
if(!mob) return 1 // Runtime prevention on N00k agents spawning with SMG
screen -= mob.item_use_icon
screen -= mob.gun_move_icon
screen -= mob.radio_use_icon
@@ -5,7 +5,6 @@
set name = "Toggle Gun Mode"
set desc = "Begin or stop aiming."
set category = "IC"
if(isliving(src))
var/mob/living/M = src
if(!M.aiming)
@@ -17,7 +17,7 @@
var/lock_time = 0 // When -will- we lock on?
var/active = 0 // Is our owner intending to take hostages?
var/target_permissions = 0 // Permission bitflags.
var/aimcooldown // How long untill we can re-aim?
/obj/aiming_overlay/New(var/newowner)
..()
owner = newowner
@@ -133,6 +133,8 @@ obj/aiming_overlay/proc/update_aiming_deferred()
owner.set_dir(get_dir(get_turf(owner), get_turf(src)))
/obj/aiming_overlay/proc/aim_at(var/mob/target, var/obj/thing)
if (aimcooldown > world.time)
return
if(!owner)
return
@@ -175,6 +177,9 @@ obj/aiming_overlay/proc/update_aiming_deferred()
moved_event.register(aiming_at, src, /obj/aiming_overlay/proc/target_moved)
destroyed_event.register(aiming_at, src, /obj/aiming_overlay/proc/cancel_aiming)
/obj/aiming_overlay/proc/aim_cooldown(var/seconds)
aimcooldown = world.time + seconds SECONDS
/obj/aiming_overlay/update_icon()
if(locked)
icon_state = "locked"
@@ -222,3 +227,4 @@ obj/aiming_overlay/proc/update_aiming_deferred()
/obj/aiming_overlay/proc/target_moved()
update_aiming()
trigger(TARGET_CAN_MOVE)
@@ -20,7 +20,12 @@
var/obj/item/weapon/gun/G = aiming_with
if(istype(G))
G.Fire(aiming_at, owner)
cancel_aiming()//if you can't remove it, nerf it
aim_cooldown(3)
toggle_active()
if (owner.client)
owner.client.remove_gun_icons()
/mob/living/ClickOn(var/atom/A, var/params)
. = ..()
trigger_aiming(TARGET_CAN_CLICK)
+38
View File
@@ -0,0 +1,38 @@
################################
# 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
#################################
# Your name.
author: Pacmandevil
# 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:
- balance: "Whenever you shoot someone while aiming at them, the aim is Dropped"
- balance: "There is now a cooldown to re-aiming after you shoot, this is currently 3 seconds."