Skip to content

Commit

Permalink
heavy wip overlay limbs
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Aug 30, 2023
1 parent f743718 commit ea92ff9
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 18 deletions.
15 changes: 8 additions & 7 deletions code/__DEFINES/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,15 @@
#define ORDER_FOCUS_MAX_LEVEL 50

//Human Overlays Indexes used in update_icons/////////
#define UNDERWEAR_LAYER 41
#define UNDERSHIRT_LAYER 40
#define MUTANTRACE_LAYER 39
#define BODYPARTS_LAYER 42
#define DAMAGE_LAYER 41

/// For use by Hunter Flay
#define FLAY_LAYER 38
#define UNDERWEAR_LAYER 40
#define UNDERSHIRT_LAYER 39
#define MUTANTRACE_LAYER 38

#define DAMAGE_LAYER 37
/// For use by Hunter Flay
#define FLAY_LAYER 37
#define UNIFORM_LAYER 36

/// bs12 specific. this hack is probably gonna come back to haunt me
Expand Down Expand Up @@ -176,7 +177,7 @@
/// If you're hit by an acid DoT
#define EFFECTS_LAYER 1

#define TOTAL_LAYERS 41
#define TOTAL_LAYERS 42
//////////////////////////////////

//Synthetic Defines
Expand Down
29 changes: 20 additions & 9 deletions code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ There are several things that need to be remembered:


/mob/living/carbon/human/apply_overlay(cache_index)
var/image/I = overlays_standing[cache_index]
if(I)
I.appearance_flags |= RESET_COLOR
SEND_SIGNAL(src, COMSIG_HUMAN_OVERLAY_APPLIED, cache_index, I)
overlays += I
var/list/images = overlays_standing[cache_index]

if(!islist(images))
images = list(images)

if(length(images))
for(var/image/current_image as anything in images)
current_image.appearance_flags |= RESET_COLOR
SEND_SIGNAL(src, COMSIG_HUMAN_OVERLAY_APPLIED, cache_index, images)
overlays += images

/mob/living/carbon/human/remove_overlay(cache_index)
if(overlays_standing[cache_index])
Expand Down Expand Up @@ -132,10 +137,17 @@ There are several things that need to be remembered:
//BASE MOB SPRITE
/mob/living/carbon/human/proc/update_body()
appearance_flags |= KEEP_TOGETHER // sanity
vis_contents.Cut()
var/list/new_limbs = list()
for(var/obj/limb/part in limbs)
vis_contents += part
part.update_icon(TRUE)
var/bodypart_icon = part.get_limb_icon()
new_limbs += bodypart_icon

remove_overlay(BODYPARTS_LAYER)

if(length(new_limbs))
overlays_standing[BODYPARTS_LAYER] = new_limbs

apply_overlay(BODYPARTS_LAYER)

if(species.flags & HAS_UNDERWEAR)
//Underwear
Expand Down Expand Up @@ -739,7 +751,6 @@ Applied by gun suicide and high impact bullet executions, removed by rejuvenate,

//Human Overlays Indexes/////////
#undef MUTANTRACE_LAYER
#undef DAMAGE_LAYER
#undef UNIFORM_LAYER
#undef TAIL_LAYER
#undef ID_LAYER
Expand Down
83 changes: 81 additions & 2 deletions code/modules/organs/limbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@
if(mob_owner)
owner = mob_owner

wound_overlay = image('icons/mob/humans/dam_human.dmi', "grayscale_0")
wound_overlay = image('icons/mob/humans/dam_human.dmi', "grayscale_0", -DAMAGE_LAYER)
wound_overlay.blend_mode = BLEND_INSET_OVERLAY
wound_overlay.color = owner?.species.blood_color

burn_overlay = image('icons/mob/humans/dam_human.dmi', "burn_0")
burn_overlay = image('icons/mob/humans/dam_human.dmi', "burn_0", -DAMAGE_LAYER)
burn_overlay.blend_mode = BLEND_INSET_OVERLAY

if(owner)
Expand Down Expand Up @@ -739,6 +739,74 @@ This function completely restores a damaged organ to perfect condition.
burn_overlay.icon_state = "burn_[burnstate]"
overlays += burn_overlay

/obj/limb/proc/get_limb_icon(dropped)
SHOULD_CALL_PARENT(TRUE)
RETURN_TYPE(/list)

icon_state = ""

. = list()

if(parent?.status & LIMB_DESTROYED)
return

var/image_dir = dropped ? SOUTH : NONE

if(status & LIMB_DESTROYED)
if(has_stump_icon && !(status & LIMB_AMPUTATED))
. += image('icons/mob/humans/dam_human.dmi', "stump_[icon_name]_blood", -DAMAGE_LAYER, image_dir)
return

damage_state = damage_state_text()
var/brutestate = copytext(damage_state, 1, 2)
if(brutestate != "0")
wound_overlay.dir = image_dir
wound_overlay.icon_state = "grayscale_[brutestate]"
. += wound_overlay

var/burnstate = copytext(damage_state, 2)
if(burnstate != "0")
burn_overlay.dir = image_dir
burn_overlay.icon_state = "burn_[burnstate]"
. += burn_overlay

var/image/limb = image(layer = -BODYPARTS_LAYER, dir = image_dir)

var/race_icon = owner.species.icobase

if ((status & LIMB_ROBOT) && !(owner.species && owner.species.flags & IS_SYNTHETIC))
limb.icon = 'icons/mob/robotic.dmi'
limb.icon_state = "[icon_name]"
. += limb
return

var/datum/ethnicity/E = GLOB.ethnicities_list[owner.ethnicity]
var/datum/body_type/B = GLOB.body_types_list[owner.body_type]

var/e_icon
var/b_icon

if (!E)
e_icon = "western"
else
e_icon = E.icon_name

if (!B)
b_icon = "mesomorphic"
else
b_icon = B.icon_name

if(isspeciesyautja(owner))
e_icon = owner.ethnicity
b_icon = owner.body_type

limb.icon = race_icon
limb.icon_state = "[get_limb_icon_name(owner.species, b_icon, owner.gender, icon_name, e_icon)]"

. += limb

return

// new damage icon system
// returns just the brute/burn damage code
/obj/limb/proc/damage_state_text()
Expand Down Expand Up @@ -1401,6 +1469,17 @@ treat_grafted var tells it to apply to grafted but unsalved wounds, for burn kit
var/icon/lips = new /icon('icons/mob/humans/onmob/human_face.dmi', "paint_[owner.lip_style]")
overlays += lips

/obj/limb/head/get_limb_icon(dropped)
. = ..()

var/image/eyes = image('icons/mob/humans/onmob/human_face.dmi', owner.species.eyes, layer = -BODYPARTS_LAYER)
eyes.color = list(null, null, null, null, rgb(owner.r_eyes, owner.g_eyes, owner.b_eyes))
. += eyes

if(owner.lip_style && (owner.species && owner.species.flags & HAS_LIPS))
var/image/lips = image('icons/mob/humans/onmob/human_face.dmi', "paint_[owner.lip_style]", layer = -BODYPARTS_LAYER)
. += lips

/obj/limb/head/take_damage(brute, burn, sharp, edge, used_weapon = null,\
list/forbidden_limbs = list(), no_limb_loss,\
mob/attack_source = null,\
Expand Down

0 comments on commit ea92ff9

Please sign in to comment.