mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 06:54:18 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user