From af8a173e30ec1cdc2242c5fd1bafee6e159fcebc Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 27 May 2015 02:18:11 -0400 Subject: [PATCH] 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. --- code/modules/mob/living/carbon/human/life.dm | 36 ++++++++++++------- .../living/carbon/human/species/species.dm | 5 +++ .../carbon/human/species/station/station.dm | 4 ++- code/modules/organs/organ_internal.dm | 9 ----- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 896f57878cd..d902fa557c6 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 1d81e88c8db..4f0511ab4a6 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -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() diff --git a/code/modules/mob/living/carbon/human/species/station/station.dm b/code/modules/mob/living/carbon/human/species/station/station.dm index 1c7887d2768..c49e92aedba 100644 --- a/code/modules/mob/living/carbon/human/species/station/station.dm +++ b/code/modules/mob/living/carbon/human/species/station/station.dm @@ -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), diff --git a/code/modules/organs/organ_internal.dm b/code/modules/organs/organ_internal.dm index 3b094f1fdd4..a67e74c8f97 100644 --- a/code/modules/organs/organ_internal.dm +++ b/code/modules/organs/organ_internal.dm @@ -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"