Fixed changeling augmented eyesight ability (#30592)

* Fix changeling augmented eyesight

Fix not being able to toggle changeling augmented eyesight off again.

* Fix augmented eyesight

Fix changeling's augmented eyesight ability.

* Fix changeling augmented vision

Fix changeling augmented vision, for real this time. Makes it properly grant night vision on purchase, remove granted effects on refund, and properly toggle on and off. Note, this changes it to x-ray vision, to replicate the way it has been working for well over a year.
This commit is contained in:
msgerbs
2017-09-11 18:37:19 -05:00
committed by CitadelStationBot
parent 6cc0ea6af0
commit d9abc21a9a
@@ -1,4 +1,4 @@
//Augmented Eyesight: Gives you thermal and night vision - bye bye, flashlights. Also, high DNA cost because of how powerful it is.
//Augmented Eyesight: Gives you x-ray vision or protection from flashes. Also, high DNA cost because of how powerful it is.
//Possible todo: make a custom message for directing a penlight/flashlight at the eyes - not sure what would display though.
/obj/effect/proc_holder/changeling/augmented_eyesight
@@ -7,21 +7,31 @@
helptext = "Grants us thermal vision or flash protection. We will become a lot more vulnerable to flash-based devices while thermal vision is active."
chemical_cost = 0
dna_cost = 2 //Would be 1 without thermal vision
active = 0 //Whether or not vision is enhanced
active = FALSE
/obj/effect/proc_holder/changeling/augmented_eyesight/on_purchase(mob/user) //The ability starts inactive, so we should be protected from flashes.
var/obj/item/organ/eyes/E = user.getorganslot("eye_sight")
if (E)
E.flash_protect = 2 //Adjust the user's eyes' flash protection
to_chat(user, "We adjust our eyes to protect them from bright lights.")
else
to_chat(user, "We can't adjust our eyes if we don't have any!")
/obj/effect/proc_holder/changeling/augmented_eyesight/sting_action(mob/living/carbon/human/user)
if(!istype(user))
return
var/obj/item/organ/eyes/E = user.getorganslot("eye_sight")
if(E)
if(E.flash_protect)
E.sight_flags |= SEE_MOBS
E.flash_protect = -1
if(!active)
E.sight_flags |= SEE_MOBS | SEE_OBJS | SEE_TURFS //Add sight flags to the user's eyes
E.flash_protect = -1 //Adjust the user's eyes' flash protection
to_chat(user, "We adjust our eyes to sense prey through walls.")
active = TRUE //Defined in code/modules/spells/spell.dm
else
E.sight_flags -= SEE_MOBS
E.flash_protect = 2
E.sight_flags ^= SEE_MOBS | SEE_OBJS | SEE_TURFS //Remove sight flags from the user's eyes
E.flash_protect = 2 //Adjust the user's eyes' flash protection
to_chat(user, "We adjust our eyes to protect them from bright lights.")
active = FALSE
user.update_sight()
else
to_chat(user, "We can't adjust our eyes if we don't have any!")
@@ -31,7 +41,11 @@
return 1
/obj/effect/proc_holder/changeling/augmented_eyesight/on_refund(mob/user)
/obj/effect/proc_holder/changeling/augmented_eyesight/on_refund(mob/user) //Get rid of x-ray vision and flash protection when the user refunds this ability
var/obj/item/organ/eyes/E = user.getorganslot("eye_sight")
if(E)
E.sight_flags -= SEE_MOBS
if (active)
E.sight_flags ^= SEE_MOBS | SEE_OBJS | SEE_TURFS
else
E.flash_protect = 0
user.update_sight()