Skip to content

Commit

Permalink
Move should_have_organ up and add should_have_limb
Browse files Browse the repository at this point in the history
  • Loading branch information
out-of-phaze committed Oct 7, 2023
1 parent 5a2ce8c commit f62822f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion code/modules/aspects/aspects_prosthetic_limbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
if(. && apply_to_limb)
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(holder, apply_to_limb)
if(!istype(E))
var/list/organ_data = holder.get_bodytype().has_limbs[apply_to_limb]
var/list/organ_data = holder.should_have_limb(apply_to_limb)
var/limb_path = organ_data["path"]
if("path" in organ_data)
E = new limb_path(holder, null, model || get_base_model(holder.get_species_name()))
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@

// Update our target dolly.
if(user.zone_sel)
var/decl/bodytype/target_bodytype = get_bodytype()
if(target_bodytype && (BP_TAIL in target_bodytype.has_limbs))
if(should_have_limb(BP_TAIL))
user.zone_sel.icon_state = "zone_sel_tail"
else
user.zone_sel.icon_state = "zone_sel"
4 changes: 0 additions & 4 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,6 @@
if(stomach)
victim.forceMove(stomach)

/mob/living/carbon/human/should_have_organ(var/organ_check)
var/decl/bodytype/root_bodytype = get_bodytype()
return root_bodytype?.has_organ[organ_check]

/mob/living/carbon/human/get_adjusted_metabolism(metabolism)
return ..() * (species ? species.metabolism_mod : 1)

Expand Down
11 changes: 9 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,15 @@ default behaviour is:
/mob/living/proc/get_ingested_reagents()
return reagents

/mob/living/proc/should_have_organ(var/organ_check)
return FALSE
/mob/living/proc/should_have_organ(organ_to_check)
var/decl/bodytype/root_bodytype = get_bodytype()
return root_bodytype?.has_organ[organ_to_check]

/// Returns null if the mob's bodytype doesn't have a limb tag by default.
/// Otherwise, returns the data of the limb instead.
/mob/living/proc/should_have_limb(limb_to_check)
var/decl/bodytype/root_bodytype = get_bodytype()
return root_bodytype?.has_limbs[limb_to_check]

/mob/living/proc/get_contact_reagents()
return reagents
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,7 @@
var/obj/item/head = get_equipped_item(slot_head_str)
if((mask?.flags_inv & HIDEFACE) || (head?.flags_inv & HIDEFACE))
return FALSE
var/decl/bodytype/our_bodytype = get_bodytype()
if(our_bodytype?.has_limbs[BP_HEAD])
if(should_have_limb(BP_HEAD))
var/obj/item/organ/external/skull = GET_EXTERNAL_ORGAN(src, BP_HEAD)
if(!skull || (skull.status & ORGAN_DISFIGURED)) //Face is unrecognizeable
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/limb_reattach.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
if(affected)
return affected
var/list/organ_data = target.get_bodytype()?.has_limbs?["[target_zone]"]
var/list/organ_data = target.should_have_limb(target_zone)
return !isnull(organ_data)

//////////////////////////////////////////////////////////////////
Expand Down
3 changes: 1 addition & 2 deletions code/modules/surgery/organs_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@
CRASH("Target ([target]) of surgery [type] has no bodytype!")
else
var/decl/pronouns/G = O.get_pronouns()
var/decl/bodytype/root_bodytype = target.get_bodytype()
if(O.organ_tag == BP_POSIBRAIN && !root_bodytype.has_organ[BP_POSIBRAIN])
if(O.organ_tag == BP_POSIBRAIN && !target.should_have_organ(BP_POSIBRAIN))
to_chat(user, SPAN_WARNING("There's no place in [target] to fit \the [O.organ_tag]."))
else if(O.damage > (O.max_damage * 0.75))
to_chat(user, SPAN_WARNING("\The [O.name] [G.is] in no state to be transplanted."))
Expand Down

0 comments on commit f62822f

Please sign in to comment.