Skip to content

Commit

Permalink
bugfix: Overlays Fixes (#5218)
Browse files Browse the repository at this point in the history
* Dispenser Overlays Fix

* Overlays Fixes

* Ninja Gloves Fix

* Belt Layer Fix

* Nian Wings Fix
  • Loading branch information
Gottfrei authored Jun 16, 2024
1 parent 61ba6dc commit f3b983c
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 57 deletions.
10 changes: 5 additions & 5 deletions code/__DEFINES/overlays.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
*/


// Layer offsets for closets
#define CLOSET_OLAY_OFFSET_CONTENTS 0.01
#define CLOSET_OLAY_OFFSET_DOOR 0.02
#define CLOSET_OLAY_OFFSET_LOCK 0.03
#define CLOSET_OLAY_OFFSET_WELDED 0.04
// Float layers for closets
#define CLOSET_OLAY_LAYER_CONTENTS -4
#define CLOSET_OLAY_LAYER_DOOR -3
#define CLOSET_OLAY_LAYER_LOCK -2
#define CLOSET_OLAY_LAYER_WELDED -1

3 changes: 0 additions & 3 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
/// Whether a moth's wings are burnt
#define STATUS_EFFECT_BURNT_WINGS /datum/status_effect/burnt_wings

/// If a moth is in a cocoon
#define STATUS_EFFECT_COCOONED /datum/status_effect/cocooned

//human status effects
// incapacitating
#define STATUS_EFFECT_STUN /datum/status_effect/incapacitating/stun
Expand Down
42 changes: 21 additions & 21 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BUTTON_LAYER_OFFSET_ICON (HUD_LAYER + 0.1)
#define BUTTON_LAYER_OFFSET_UNAVAILABLE (HUD_LAYER + 0.2)
#define BUTTON_LAYER_OFFSET_MAPTEXT (HUD_LAYER + 0.3)
#define BUTTON_LAYER_OFFSET_SELECTOR (HUD_LAYER + 0.4)
#define BUTTON_LAYER_ICON -4
#define BUTTON_LAYER_UNAVAILABLE -3
#define BUTTON_LAYER_MAPTEXT -2
#define BUTTON_LAYER_SELECTOR -1

/datum/action
var/name = "Generic Action"
Expand Down Expand Up @@ -178,15 +178,15 @@


/datum/action/proc/apply_unavailable_effect()
var/static/mutable_appearance/unavailable_effect = mutable_appearance('icons/mob/screen_white.dmi', "template", BUTTON_LAYER_OFFSET_UNAVAILABLE, alpha = 200, appearance_flags = RESET_COLOR|RESET_ALPHA, color = "#000000")
var/static/mutable_appearance/unavailable_effect = mutable_appearance('icons/mob/screen_white.dmi', "template", BUTTON_LAYER_UNAVAILABLE, alpha = 200, appearance_flags = RESET_COLOR|RESET_ALPHA, color = "#000000")
button.add_overlay(unavailable_effect)


/datum/action/proc/ApplyIcon()
button.cut_overlays()
if(!icon_icon || !button_icon_state)
return
var/mutable_appearance/new_icon = mutable_appearance(icon_icon, button_icon_state, BUTTON_LAYER_OFFSET_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/mutable_appearance/new_icon = mutable_appearance(icon_icon, button_icon_state, BUTTON_LAYER_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
button.add_overlay(new_icon)


Expand Down Expand Up @@ -231,7 +231,7 @@
return ..()
if(!target)
return
var/mutable_appearance/new_icon = mutable_appearance(target.icon, target.icon_state, BUTTON_LAYER_OFFSET_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/mutable_appearance/new_icon = mutable_appearance(target.icon, target.icon_state, BUTTON_LAYER_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
new_icon.copy_overlays(target)
button.add_overlay(new_icon)

Expand Down Expand Up @@ -522,7 +522,7 @@

/datum/action/item_action/toggle_research_scanner/ApplyIcon()
button.cut_overlays()
var/static/mutable_appearance/new_icon = mutable_appearance('icons/mob/actions/actions.dmi', "scan_mode", BUTTON_LAYER_OFFSET_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/static/mutable_appearance/new_icon = mutable_appearance('icons/mob/actions/actions.dmi', "scan_mode", BUTTON_LAYER_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
button.add_overlay(new_icon)


Expand Down Expand Up @@ -684,7 +684,7 @@
var/obj/effect/proc_holder/spell/spell = target
if(!istype(spell) || !spell.need_active_overlay)
return
var/static/mutable_appearance/selector = mutable_appearance('icons/mob/screen_gen.dmi', "selector", BUTTON_LAYER_OFFSET_SELECTOR, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/static/mutable_appearance/selector = mutable_appearance('icons/mob/screen_gen.dmi', "selector", BUTTON_LAYER_SELECTOR, appearance_flags = RESET_COLOR|RESET_ALPHA)
if(spell.active)
button.add_overlay(selector)
else
Expand All @@ -695,19 +695,19 @@
button.cut_overlays()
if(!button_icon || !button_icon_state)
return
var/mutable_appearance/new_icon = mutable_appearance(button_icon, button_icon_state, BUTTON_LAYER_OFFSET_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/mutable_appearance/new_icon = mutable_appearance(button_icon, button_icon_state, BUTTON_LAYER_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
button.add_overlay(new_icon)


/datum/action/spell_action/apply_unavailable_effect()
var/obj/effect/proc_holder/spell/spell = target
if(!istype(spell))
return ..()
var/mutable_appearance/unavailable_effect = mutable_appearance('icons/mob/screen_white.dmi', "template", BUTTON_LAYER_OFFSET_UNAVAILABLE, appearance_flags = RESET_COLOR|RESET_ALPHA, color = "#000000")
var/mutable_appearance/unavailable_effect = mutable_appearance('icons/mob/screen_white.dmi', "template", BUTTON_LAYER_UNAVAILABLE, appearance_flags = RESET_COLOR|RESET_ALPHA, color = "#000000")
unavailable_effect.alpha = spell.cooldown_handler.get_cooldown_alpha()
button.add_overlay(unavailable_effect)
// Make a holder for the charge text
var/static/mutable_appearance/maptext_holder = mutable_appearance('icons/effects/effects.dmi', "nothing", BUTTON_LAYER_OFFSET_MAPTEXT, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/static/mutable_appearance/maptext_holder = mutable_appearance('icons/effects/effects.dmi', "nothing", BUTTON_LAYER_MAPTEXT, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/text = spell.cooldown_handler.statpanel_info()
maptext_holder.maptext = "<div style=\"font-size:6pt;color:[recharge_text_color];font:'Small Fonts';text-align:center;\" valign=\"bottom\">[text]</div>"
button.add_overlay(maptext_holder)
Expand Down Expand Up @@ -750,7 +750,7 @@

/datum/action/innate/research_scanner/ApplyIcon()
button.cut_overlays()
var/static/mutable_appearance/new_icon = mutable_appearance('icons/mob/actions/actions.dmi', "scan_mode", BUTTON_LAYER_OFFSET_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/static/mutable_appearance/new_icon = mutable_appearance('icons/mob/actions/actions.dmi', "scan_mode", BUTTON_LAYER_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
button.add_overlay(new_icon)


Expand Down Expand Up @@ -788,7 +788,7 @@
button.cut_overlays()
if(!mmi)
return
var/mutable_appearance/new_icon = mutable_appearance(mmi.icon, mmi.icon_state, BUTTON_LAYER_OFFSET_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/mutable_appearance/new_icon = mutable_appearance(mmi.icon, mmi.icon_state, BUTTON_LAYER_ICON, appearance_flags = RESET_COLOR|RESET_ALPHA)
new_icon.copy_overlays(mmi)
button.add_overlay(new_icon)

Expand Down Expand Up @@ -928,7 +928,7 @@
var/progress = get_availability_percentage()
if(progress == 1)
no_count = TRUE
var/mutable_appearance/unavailable_effect = mutable_appearance(coold_overlay_icon, coold_overlay_icon_state, BUTTON_LAYER_OFFSET_UNAVAILABLE, appearance_flags = RESET_COLOR|RESET_ALPHA, color = "#000000")
var/mutable_appearance/unavailable_effect = mutable_appearance(coold_overlay_icon, coold_overlay_icon_state, BUTTON_LAYER_UNAVAILABLE, appearance_flags = RESET_COLOR|RESET_ALPHA, color = "#000000")
unavailable_effect.alpha = no_count ? 80 : 220 - 140 * progress
button.add_overlay(unavailable_effect)
if(!no_count && charge_type != ADV_ACTION_TYPE_CHARGES)
Expand All @@ -940,14 +940,14 @@

/datum/action/item_action/advanced/proc/add_percentage_overlay(progress)
// Make a holder for the charge text
var/static/mutable_appearance/count_down_holder = mutable_appearance('icons/effects/effects.dmi', "nothing", BUTTON_LAYER_OFFSET_MAPTEXT, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/static/mutable_appearance/count_down_holder = mutable_appearance('icons/effects/effects.dmi', "nothing", BUTTON_LAYER_MAPTEXT, appearance_flags = RESET_COLOR|RESET_ALPHA)
count_down_holder.maptext = "<div style=\"font-size:6pt;color:[recharge_text_color];font:'Small Fonts';text-align:center;\" valign=\"bottom\">[round_down(progress * 100)]%</div>"
button.add_overlay(count_down_holder)


/datum/action/item_action/advanced/proc/add_charges_overlay()
// Make a holder for the charge text
var/static/mutable_appearance/charges_holder = mutable_appearance('icons/effects/effects.dmi', "nothing", BUTTON_LAYER_OFFSET_MAPTEXT, appearance_flags = RESET_COLOR|RESET_ALPHA)
var/static/mutable_appearance/charges_holder = mutable_appearance('icons/effects/effects.dmi', "nothing", BUTTON_LAYER_MAPTEXT, appearance_flags = RESET_COLOR|RESET_ALPHA)
charges_holder.maptext = "<div style=\"font-size:6pt;color:#ffffff;font:'Small Fonts';text-align:center;\" valign=\"bottom\">[charge_counter]/[charge_max]</div>"
button.add_overlay(charges_holder)

Expand Down Expand Up @@ -994,8 +994,8 @@
UpdateButtonIcon()


#undef BUTTON_LAYER_OFFSET_ICON
#undef BUTTON_LAYER_OFFSET_UNAVAILABLE
#undef BUTTON_LAYER_OFFSET_MAPTEXT
#undef BUTTON_LAYER_OFFSET_SELECTOR
#undef BUTTON_LAYER_ICON
#undef BUTTON_LAYER_UNAVAILABLE
#undef BUTTON_LAYER_MAPTEXT
#undef BUTTON_LAYER_SELECTOR

20 changes: 10 additions & 10 deletions code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,18 @@ GLOBAL_LIST_EMPTY(closets)
. = ..()
if(opened)
if(custom_open_overlay)
. += mutable_appearance(icon, "[custom_open_overlay]_open", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[custom_open_overlay]_open", CLOSET_OLAY_LAYER_DOOR)
else
. += mutable_appearance(icon, "[icon_state]_open", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[icon_state]_open", CLOSET_OLAY_LAYER_DOOR)
else
for(var/olay in apply_contents_overlays())
. += olay
if(custom_door_overlay)
. += mutable_appearance(icon, "[custom_door_overlay]_door", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[custom_door_overlay]_door", CLOSET_OLAY_LAYER_DOOR)
else
. += mutable_appearance(icon, "[icon_state]_door", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[icon_state]_door", CLOSET_OLAY_LAYER_DOOR)
if(welded)
. += mutable_appearance(icon, "welded", src.layer + CLOSET_OLAY_OFFSET_WELDED)
. += mutable_appearance(icon, "welded", CLOSET_OLAY_LAYER_WELDED)


/**
Expand Down Expand Up @@ -486,16 +486,16 @@ GLOBAL_LIST_EMPTY(closets)
. = list()
if(!opened)
if(transparent)
. += mutable_appearance(icon, "[initial(icon_state)]_door_trans", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[initial(icon_state)]_door_trans", CLOSET_OLAY_LAYER_DOOR)
else
. += mutable_appearance(icon, "[initial(icon_state)]_door", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[initial(icon_state)]_door", CLOSET_OLAY_LAYER_DOOR)
if(welded)
. += mutable_appearance(icon, "welded", src.layer + CLOSET_OLAY_OFFSET_WELDED)
. += mutable_appearance(icon, "welded", CLOSET_OLAY_LAYER_WELDED)
else
if(transparent)
. += mutable_appearance(icon, "[initial(icon_state)]_open_trans", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[initial(icon_state)]_open_trans", CLOSET_OLAY_LAYER_DOOR)
else
. += mutable_appearance(icon, "[initial(icon_state)]_open", src.layer + CLOSET_OLAY_OFFSET_DOOR)
. += mutable_appearance(icon, "[initial(icon_state)]_open", CLOSET_OLAY_LAYER_DOOR)


/obj/structure/closet/bluespace/Crossed(atom/movable/AM, oldloc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
shottas--
choise = "projectile"
if(choise)
var/mutable_appearance/gun_olay = mutable_appearance(icon, choise, src.layer + CLOSET_OLAY_OFFSET_CONTENTS)
gun_olay.pixel_x = i * 4
var/mutable_appearance/gun_olay = mutable_appearance(icon, choise, CLOSET_OLAY_LAYER_CONTENTS)
gun_olay.pixel_w = i * 4
. += gun_olay

Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@
. = ..()
if(!opened && !broken)
if(locked)
. += mutable_appearance(icon, overlay_locked, src.layer + CLOSET_OLAY_OFFSET_LOCK)
. += mutable_appearance(icon, overlay_locked, CLOSET_OLAY_LAYER_LOCK)
else
. += mutable_appearance(icon, overlay_unlocked, src.layer + CLOSET_OLAY_OFFSET_LOCK)
. += mutable_appearance(icon, overlay_unlocked, CLOSET_OLAY_LAYER_LOCK)


/obj/structure/closet/secure_closet/update_desc(updates = ALL)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/space_ninja/suit/suit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
armor = list("melee" = 40, "bullet" = 30, "laser" = 20,"energy" = 30, "bomb" = 30, "bio" = 100, "rad" = 30, "fire" = 100, "acid" = 100)
strip_delay = 12
min_cold_protection_temperature = SPACE_SUIT_MIN_TEMP_PROTECT
flags_inv = HIDEGLOVES|HIDEJUMPSUIT|HIDETAIL
flags_inv = HIDEJUMPSUIT|HIDETAIL
actions = list()
action_icon = list()
action_icon_state = list()
Expand Down
9 changes: 3 additions & 6 deletions code/modules/mob/living/carbon/human/species/moth.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@
icon_state = pick("cocoon1", "cocoon2", "cocoon3")

/obj/structure/moth/cocoon/Destroy()
if(!preparing_to_emerge)
visible_message("<span class='danger'>[src] splits open from within!</span>")
else
if(preparing_to_emerge)
visible_message("<span class='danger'>[src] is smashed open, harming the Nian within!</span>")
for(var/mob/living/carbon/human/H in contents)
H.forceMove(loc)
Expand All @@ -225,9 +223,11 @@
H.AdjustWeakened(10 SECONDS)
return ..()

visible_message("<span class='danger'>[src] splits open from within!</span>")
for(var/mob/living/carbon/human/H in contents)
H.forceMove(loc)
H.adjust_nutrition(COCOON_NUTRITION_AMOUNT)
H.remove_status_effect(STATUS_EFFECT_BURNT_WINGS)
REMOVE_TRAIT(H, TRAIT_KNOCKEDOUT, COCOONED_TRAIT)
return ..()

Expand All @@ -246,9 +246,6 @@
owner.UpdateAppearance()
return ..()

/datum/status_effect/cocooned
id = "cocooned"
alert_type = null

#undef COCOON_WEAVE_DELAY
#undef COCOON_EMERGE_DELAY
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,8 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
if(belt.sprite_sheets?[dna.species.name])
standing.icon = belt.sprite_sheets[dna.species.name]

overlays_standing[BELT_LAYER] = standing

apply_overlay(BELT_LAYER)


Expand Down
16 changes: 9 additions & 7 deletions code/modules/reagents/chemistry/machinery/chem_dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,15 @@
. = ..()

if(!beaker)
return

if(!icon_beaker)
icon_beaker = mutable_appearance(icon, "disp_beaker")

icon_beaker.pixel_x = rand(-10, 5) // randomize beaker overlay position
. += icon_beaker
return .

var/static/list/beaker_cache = list()
var/random_pixel = rand(-10, 5) // randomize beaker overlay position
if(!beaker_cache["[random_pixel]"])
var/mutable_appearance/beaker_olay = mutable_appearance('icons/obj/chemical.dmi', "disp_beaker")
beaker_olay.pixel_w = random_pixel
beaker_cache["[random_pixel]"] = beaker_olay
. += beaker_cache["[random_pixel]"]


/obj/machinery/chem_dispenser/soda
Expand Down

0 comments on commit f3b983c

Please sign in to comment.