Changes IPC eyes to optics, generalizes vision organs

Now any organ can cause vision loss if damaged, not just ones that
inherit from organ/internal/eye.
This commit is contained in:
mwerezak
2015-05-27 02:18:11 -04:00
parent 7423f2ecfd
commit af8a173e30
4 changed files with 32 additions and 22 deletions

View File

@@ -1030,24 +1030,36 @@
blinded = 1
// Check everything else.
if(!species.has_organ["eyes"]) // Presumably if a species has no eyes, they see via something else.
//Vision
var/obj/item/organ/vision
if(species.vision_organ)
vision = internal_organs_by_name[species.vision_organ]
if(!vision) // Presumably if a species has no vision organs, they see via some other means.
eye_blind = 0
blinded = 0
eye_blurry = 0
else if(!has_eyes()) // Eyes cut out? Permablind.
else if(vision.is_broken()) // Vision organs cut out or broken? Permablind.
eye_blind = 1
blinded = 1
eye_blurry = 1
else if(sdisabilities & BLIND) // Disabled-blind, doesn't get better on its own
blinded = 1
else if(eye_blind) // Blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
blinded = 1
else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster
eye_blurry = max(eye_blurry-3, 0)
blinded = 1
else if(eye_blurry) // Blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
else
//blindness
if(sdisabilities & BLIND) // Disabled-blind, doesn't get better on its own
blinded = 1
else if(eye_blind) // Blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
blinded = 1
else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster
eye_blurry = max(eye_blurry-3, 0)
blinded = 1
//blurry sight
if(vision.is_bruised()) // Vision organs impaired? Permablurry.
eye_blurry = 1
if(eye_blurry) // Blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own

View File

@@ -117,6 +117,7 @@
"appendix" = /obj/item/organ/appendix,
"eyes" = /obj/item/organ/eyes
)
var/vision_organ // If set, this organ is required for vision. Defaults to "eyes" if the species has them.
var/list/has_limbs = list(
"chest" = list("path" = /obj/item/organ/external/chest),
@@ -143,6 +144,10 @@
else
hud = new()
//If the species has eyes, they are the default vision organ
if(!vision_organ && has_organ["eyes"])
vision_organ = "eyes"
unarmed_attacks = list()
for(var/u_type in unarmed_types)
unarmed_attacks += new u_type()

View File

@@ -277,9 +277,11 @@
has_organ = list(
"brain" = /obj/item/organ/mmi_holder/posibrain,
"cell" = /obj/item/organ/cell,
"eyes" = /obj/item/organ/optical_sensor
"optics" = /obj/item/organ/optical_sensor
)
vision_organ = "optics"
has_limbs = list(
"chest" = list("path" = /obj/item/organ/external/chest/ipc),
"groin" = list("path" = /obj/item/organ/external/groin/ipc),

View File

@@ -79,15 +79,6 @@
owner.b_eyes ? owner.b_eyes : 0
)
/obj/item/organ/eyes/process() //Eye damage replaces the old eye_stat var.
..()
if(!owner)
return
if(is_bruised())
owner.eye_blurry = 20
if(is_broken())
owner.eye_blind = 20
/obj/item/organ/liver
name = "liver"
icon_state = "liver"