Incorporates Suggestions for code format

Redoes get_damaged_organs() to use defines and flags instead of strings.
This commit is contained in:
IK3I
2016-04-29 21:43:19 -05:00
parent b8d9108c9c
commit 8d18ce19df
3 changed files with 12 additions and 3 deletions
+6 -1
View File
@@ -106,4 +106,9 @@
#define SLOT_DENYPOCKET 4096 //this is to deny items with a w_class of 2 or 1 to fit in pockets.
#define SLOT_TWOEARS 8192
#define SLOT_PDA 16384
#define SLOT_TIE 32768
#define SLOT_TIE 32768
//ORGAN TYPE FLAGS
#define AFFECT_ROBOTIC_ORGAN 1
#define AFFECT_ORGANIC_ORGAN 2
#define AFFECT_ALL_ORGANS 3
@@ -40,7 +40,7 @@ Bonus
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
var/list/parts = H.get_damaged_organs(1,1) //1,1 because it needs inputs.
var/list/parts = H.get_damaged_organs(1,1, AFFECT_ORGANIC_ORGAN) //1,1 because it needs inputs.
if(!parts.len)
return
@@ -212,10 +212,14 @@
////////////////////////////////////////////
//Returns a list of damaged organs
/mob/living/carbon/human/proc/get_damaged_organs(var/brute, var/burn)
/mob/living/carbon/human/proc/get_damaged_organs(var/brute, var/burn, var/flags = AFFECT_ALL_ORGANS)
var/list/obj/item/organ/external/parts = list()
for(var/obj/item/organ/external/O in organs)
if((brute && O.brute_dam) || (burn && O.burn_dam))
if(!(flags & AFFECT_ROBOTIC_ORGAN) && O.status & ORGAN_ROBOT)
continue
if(!(flags & AFFECT_ORGANIC_ORGAN) && !(O.status & ORGAN_ROBOT))
continue
parts += O
return parts