Can't aim at invisible things

This commit is contained in:
Anewbe
2017-10-23 12:11:11 -05:00
parent 1c605f5725
commit 4eb5e9b6d0

View File

@@ -74,7 +74,7 @@
owner << "<span class='[use_span]'>[aiming_at ? "\The [aiming_at] is" : "Your targets are"] [message].</span>"
if(aiming_at)
aiming_at << "<span class='[use_span]'>You are [message].</span>"
to_chat(aiming_at, "<span class='[use_span]'>You are [message].</span>")
/obj/aiming_overlay/process()
if(!owner)
@@ -109,25 +109,25 @@ obj/aiming_overlay/proc/update_aiming_deferred()
if(!locked && lock_time <= world.time)
locked = 1
owner << "<span class ='notice'>You are locked onto your target.</span>"
aiming_at << "<span class='danger'>The gun is trained on you!</span>"
to_chat(owner, "<span class ='notice'>You are locked onto your target.</span>")
to_chat(aiming_at, "<span class='danger'>The gun is trained on you!</span>")
update_icon()
var/cancel_aim = 1
var/mob/living/carbon/human/H = owner
if(!(aiming_with in owner) || (istype(H) && !H.item_is_in_hands(aiming_with)))
owner << "<span class='warning'>You must keep hold of your weapon!</span>"
to_chat(owner, "<span class='warning'>You must keep hold of your weapon!</span>")
else if(owner.eye_blind)
owner << "<span class='warning'>You are blind and cannot see your target!</span>"
to_chat(owner, "<span class='warning'>You are blind and cannot see your target!</span>")
else if(!aiming_at || !istype(aiming_at.loc, /turf))
owner << "<span class='warning'>You have lost sight of your target!</span>"
to_chat(owner, "<span class='warning'>You have lost sight of your target!</span>")
else if(owner.incapacitated() || owner.lying || owner.restrained())
owner << "<span class='warning'>You must be conscious and standing to keep track of your target!</span>"
else if(aiming_at.alpha == 0 || (aiming_at.invisibility > owner.see_invisible))
owner << "<span class='warning'>Your target has become invisible!</span>"
to_chat(owner, "<span class='warning'>You must be conscious and standing to keep track of your target!</span>")
else if(aiming_at.alpha <= 50 || (aiming_at.invisibility > owner.see_invisible))
to_chat(owner, "<span class='warning'>Your target has become invisible!</span>")
else if(get_dist(get_turf(owner), get_turf(aiming_at)) > 7) // !(owner in viewers(aiming_at, 7))
owner << "<span class='warning'>Your target is too far away to track!</span>"
to_chat(owner, "<span class='warning'>Your target is too far away to track!</span>")
else
cancel_aim = 0
@@ -147,13 +147,16 @@ obj/aiming_overlay/proc/update_aiming_deferred()
return
if(owner.incapacitated())
owner << "<span class='warning'>You cannot aim a gun in your current state.</span>"
to_chat(owner, "<span class='warning'>You cannot aim a gun in your current state.</span>")
return
if(owner.lying)
owner << "<span class='warning'>You cannot aim a gun while prone.</span>"
to_chat(owner, "<span class='warning'>You cannot aim a gun while prone.</span>")
return
if(owner.restrained())
owner << "<span class='warning'>You cannot aim a gun while handcuffed.</span>"
to_chat(owner, "<span class='warning'>You cannot aim a gun while handcuffed.</span>")
return
if(target.alpha <= 50)
to_chat(owner, "<span class='warning'>You cannot aim at something you cannot see.</span>")
return
if(aiming_at)
@@ -167,7 +170,7 @@ obj/aiming_overlay/proc/update_aiming_deferred()
if(owner.client)
owner.client.add_gun_icons()
target << "<span class='danger'>You now have a gun pointed at you. No sudden moves!</span>"
to_chat(target, "<span class='danger'>You now have a gun pointed at you. No sudden moves!</span>")
aiming_with = thing
aiming_at = target
if(istype(aiming_with, /obj/item/weapon/gun))
@@ -200,10 +203,10 @@ obj/aiming_overlay/proc/update_aiming_deferred()
if(owner.client)
if(active)
owner << "<span class='notice'>You will now aim rather than fire.</span>"
to_chat(owner, "<span class='notice'>You will now aim rather than fire.</span>")
owner.client.add_gun_icons()
else
owner << "<span class='notice'>You will no longer aim rather than fire.</span>"
to_chat(owner, "<span class='notice'>You will no longer aim rather than fire.</span>")
owner.client.remove_gun_icons()
owner.gun_setting_icon.icon_state = "gun[active]"