diff --git a/code/_onclick/hud/alien.dm b/code/_onclick/hud/alien.dm index 8c1104effd7..31341d1403e 100644 --- a/code/_onclick/hud/alien.dm +++ b/code/_onclick/hud/alien.dm @@ -6,7 +6,7 @@ icon_state = "leap_off" /obj/screen/alien/leap/Click() - if(istype(usr, /mob/living/carbon/alien/humanoid)) + if(istype(usr, /mob/living/carbon/alien/humanoid/hunter)) var/mob/living/carbon/alien/humanoid/hunter/AH = usr AH.toggle_leap() diff --git a/code/_onclick/hud/devil.dm b/code/_onclick/hud/devil.dm index 0752181ec71..167251e7a07 100644 --- a/code/_onclick/hud/devil.dm +++ b/code/_onclick/hud/devil.dm @@ -50,7 +50,7 @@ using.screen_loc = ui_swaphand2 static_inventory += using - zone_select = new /obj/screen/zone_sel/human(null, src, ui_style) + zone_select = new /obj/screen/zone_sel(null, src, ui_style) lingchemdisplay = new /obj/screen/ling/chems() devilsouldisplay = new /obj/screen/devil/soul_counter diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index e8dcb6e3b75..7346856f861 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -234,3 +234,12 @@ /datum/hud/proc/update_locked_slots() return + + +/mob/proc/remake_hud() //used for preference changes mid-round; can't change hud icons without remaking the hud. + QDEL_NULL(hud_used) + create_mob_hud() + update_action_buttons_icon() + if(hud_used) + hud_used.show_hud(hud_used.hud_version) + diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 505bfa8fd7d..cefddd70881 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -75,13 +75,6 @@ invisibility = INVISIBILITY_ABSTRACT -/mob/living/carbon/human/proc/remake_hud() //used for preference changes mid-round; can't change hud icons without remaking the hud. - QDEL_NULL(hud_used) - create_mob_hud() - update_action_buttons_icon() - if(hud_used) - hud_used.show_hud(hud_used.hud_version) - /mob/living/carbon/human/create_mob_hud() if(client && !hud_used) hud_used = new /datum/hud/human(src, ui_style2icon(client.prefs.UI_style), client.prefs.UI_style_color, client.prefs.UI_style_alpha) @@ -393,7 +386,7 @@ devilsouldisplay = new /obj/screen/devil/soul_counter infodisplay += devilsouldisplay - zone_select = new /obj/screen/zone_sel/human(null, src, ui_style, ui_alpha, ui_color) + zone_select = new /obj/screen/zone_sel(null, src, ui_style, ui_alpha, ui_color) static_inventory += zone_select inventory_shown = FALSE diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 73311421a4a..248ea88aa78 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -242,21 +242,32 @@ screen_loc = ui_zonesel var/overlay_file = 'icons/mob/zone_sel.dmi' var/selecting = BODY_ZONE_CHEST - var/static/list/hover_overlays_cache = list() + var/list/hover_overlays_cache + var/list/selecting_overlays_cache var/hovering -/obj/screen/zone_sel/Initialize(mapload, _hud, _icon, _alpha, _color) + +/obj/screen/zone_sel/Initialize(mapload, hud, icon, alpha, color) . = ..() - hud = _hud // Don't forget to always put here the created HUD '/datum/hud/'. - if(_icon) - icon = _icon - if(_alpha) - alpha = _alpha - if(_color) - color = _color - hud.mymob.zone_selected = selecting + src.hud = hud // Don't forget to always put here the created HUD '/datum/hud/'. + hover_overlays_cache = list() + selecting_overlays_cache = list() + if(icon) + src.icon = icon + if(alpha) + src.alpha = alpha + if(color) + src.color = color + src.hud.mymob.zone_selected = selecting update_icon(UPDATE_OVERLAYS) + +/obj/screen/zone_sel/Destroy() + QDEL_LIST_ASSOC_VAL(hover_overlays_cache) + QDEL_LIST_ASSOC_VAL(selecting_overlays_cache) + return ..() + + /obj/screen/zone_sel/Click(location, control, params) if(isobserver(usr)) return FALSE @@ -270,44 +281,43 @@ return set_selected_zone(choice) + /obj/screen/zone_sel/MouseEntered(location, control, params) MouseMove(location, control, params) + /obj/screen/zone_sel/MouseMove(location, control, params) if(isobserver(usr)) return var/list/PL = params2list(params) - var/icon_x = text2num(PL["icon-x"]) - var/icon_y = text2num(PL["icon-y"]) - var/choice = get_zone_at(icon_x, icon_y) + var/choice = get_zone_at(text2num(PL["icon-x"]), text2num(PL["icon-y"])) + + if(!choice) + cut_overlay(hover_overlays_cache[hovering]) + hovering = null + return - if(hovering == choice) + if(choice == hovering) return + cut_overlay(hover_overlays_cache[hovering]) hovering = choice - var/obj/effect/overlay/zone_sel/overlay_object = hover_overlays_cache[choice] - if(!overlay_object) - overlay_object = new - overlay_object.icon_state = "[choice]" - hover_overlays_cache[choice] = overlay_object - add_overlay(overlay_object) + var/mutable_appearance/hovering_olay = hover_overlays_cache[hovering] + if(!hovering_olay) + hovering_olay = mutable_appearance(overlay_file, "[hovering]", alpha = 128, appearance_flags = RESET_COLOR) + hover_overlays_cache[hovering] = hovering_olay + add_overlay(hovering_olay) -/obj/effect/overlay/zone_sel - icon = 'icons/mob/zone_sel.dmi' - mouse_opacity = MOUSE_OPACITY_TRANSPARENT - alpha = 128 - anchored = TRUE - layer = ABOVE_HUD_LAYER - plane = ABOVE_HUD_PLANE /obj/screen/zone_sel/MouseExited(location, control, params) if(!isobserver(usr) && hovering) cut_overlay(hover_overlays_cache[hovering]) hovering = null + /obj/screen/zone_sel/proc/get_zone_at(icon_x, icon_y) switch(icon_y) if(1 to 3) //Feet @@ -322,7 +332,7 @@ return BODY_ZONE_R_LEG if(17 to 22) return BODY_ZONE_L_LEG - if(24 to 29) + if(23 to 29) return BODY_ZONE_TAIL if(10 to 13) //Hands,groin and wings switch(icon_x) @@ -338,7 +348,7 @@ return BODY_ZONE_WING if(14 to 22) //Chest and arms to shoulders and wings switch(icon_x) - if (3 to 7) + if(3 to 7) return BODY_ZONE_WING if(8 to 11) return BODY_ZONE_R_ARM @@ -346,21 +356,26 @@ return BODY_ZONE_CHEST if(21 to 24) return BODY_ZONE_L_ARM - if(24 to 28) + if(25 to 28) + return BODY_ZONE_WING + if(23 to 30) + switch(icon_x) + if(4 to 10) + return BODY_ZONE_WING + if(12 to 20) //Head, but we need to check for eye or mouth + switch(icon_y) + if(23 to 24) + if(icon_x in 15 to 17) + return BODY_ZONE_PRECISE_MOUTH + if(26) //Eyeline, eyes are on 15 and 17 + if(icon_x in 14 to 18) + return BODY_ZONE_PRECISE_EYES + if(25 to 27) + if(icon_x in 15 to 17) + return BODY_ZONE_PRECISE_EYES + return BODY_ZONE_HEAD + if(22 to 28) return BODY_ZONE_WING - if(23 to 30) //Head, but we need to check for eye or mouth - if(icon_x in 12 to 20) - switch(icon_y) - if(23 to 24) - if(icon_x in 15 to 17) - return BODY_ZONE_PRECISE_MOUTH - if(26) //Eyeline, eyes are on 15 and 17 - if(icon_x in 14 to 18) - return BODY_ZONE_PRECISE_EYES - if(25 to 27) - if(icon_x in 15 to 17) - return BODY_ZONE_PRECISE_EYES - return BODY_ZONE_HEAD /obj/screen/zone_sel/proc/set_selected_zone(choice) @@ -379,15 +394,12 @@ /obj/screen/zone_sel/update_overlays() . = ..() - var/image/sel = image(overlay_file, "[selecting]") - sel.appearance_flags = RESET_COLOR - . += sel + var/mutable_appearance/selecting_olay = selecting_overlays_cache[selecting] + if(!selecting_olay) + selecting_olay = mutable_appearance(overlay_file, "[selecting]", appearance_flags = RESET_COLOR) + selecting_overlays_cache[selecting] = selecting_olay + . += selecting_olay -/obj/screen/zone_sel/human/update_overlays() - var/image/human = image('icons/mob/zone_sel.dmi', "human") - human.appearance_flags = RESET_COLOR - . = list(human) - . += ..() /obj/screen/zone_sel/alien icon = 'icons/mob/screen_alien.dmi' @@ -397,6 +409,7 @@ /obj/screen/zone_sel/robot icon = 'icons/mob/screen_robot.dmi' + /obj/screen/craft name = "crafting menu" icon = 'icons/mob/screen_midnight.dmi' @@ -542,11 +555,11 @@ /obj/screen/inventory/hand/update_overlays() + . = ..() + if(!hud || !hud.mymob) return - . = ..() - if(!active_overlay) active_overlay = image("icon" = icon, "icon_state" = "hand_active") diff --git a/icons/mob/screen_alien.dmi b/icons/mob/screen_alien.dmi index 7573a28c772..430808794dc 100644 Binary files a/icons/mob/screen_alien.dmi and b/icons/mob/screen_alien.dmi differ diff --git a/icons/mob/screen_white.dmi b/icons/mob/screen_white.dmi index 06dd66f6907..af72b06b0d8 100644 Binary files a/icons/mob/screen_white.dmi and b/icons/mob/screen_white.dmi differ