Files
CHOMPStation2/code/modules/projectiles/targeting/targeting_triggers.dm
CHOMPStation2 ab154b48b2 [MIRROR] refactors most spans (#9139)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
2024-10-04 15:00:17 +02:00

32 lines
1.0 KiB
Plaintext

//as core click exists at the mob level
/mob/proc/trigger_aiming(var/trigger_type)
return
/mob/living/trigger_aiming(var/trigger_type)
if(!aimed.len)
return
for(var/obj/aiming_overlay/AO in aimed)
if(AO.aiming_at == src)
AO.update_aiming()
if(AO.aiming_at == src)
AO.trigger(trigger_type)
AO.update_aiming_deferred()
/obj/aiming_overlay/proc/trigger(var/perm)
if(!owner || !aiming_with || !aiming_at || !locked)
return
if(perm && (target_permissions & perm))
return
if(!owner.checkClickCooldown())
return
owner.setClickCooldown(5) // Spam prevention, essentially.
if(owner.a_intent == I_HELP && owner.client?.prefs?.read_preference(/datum/preference/toggle/safefiring))
to_chat(owner, span_warning("You refrain from firing \the [aiming_with] as your intent is set to help."))
return
owner.visible_message(span_danger("\The [owner] pulls the trigger reflexively!"))
var/obj/item/gun/G = aiming_with
if(istype(G))
G.Fire(aiming_at, owner, reflex = 1)
locked = 0
lock_time = world.time+10