Skip to content

Commit

Permalink
Fix player emissives and emissive filter compatibility (#10735)
Browse files Browse the repository at this point in the history
* initial

* Revert "initial"

This reverts commit fa87a2a.

* initial - 13 3 24

* Fix drunk mistake - 13 3 24

Canadian Club goes so fucking hard

* Wrong ref - 13 3 24

* Update _glasses.dm

* Update _glasses.dm

* Update _glasses.dm
  • Loading branch information
DrDuckedGoose authored May 8, 2024
1 parent 84bb779 commit 16d5a1d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion code/datums/mutable_appearance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@

/// Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the [EMISSIVE_COLOR].
/// Setting the layer is highly important
/proc/emissive_appearance(icon, icon_state = "", layer = FLOAT_LAYER, alpha = 255, appearance_flags = NONE)
/proc/emissive_appearance(icon, icon_state = "", layer = FLOAT_LAYER, alpha = 255, appearance_flags = NONE, filters)
// We actually increase the layer ever so slightly so that emissives overpower blockers.
// We do this because emissives and blockers can be applied to the same item and in that case
// we do not want the item to block its own emissive overlay.
var/mutable_appearance/appearance = mutable_appearance(icon, icon_state, layer + 0.01, EMISSIVE_PLANE, alpha, appearance_flags | EMISSIVE_APPEARANCE_FLAGS)
appearance.filters = filters
var/list/found = GLOB.emissive_color[alpha+1]
if (!found)
found = GLOB.emissive_color[alpha+1] = list(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,alpha/255, 1,1,1,0)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/cult/cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
new /obj/effect/temp_visual/cult/sparks(get_turf(H), H.dir)
var/istate = pick("halo1","halo2","halo3","halo4","halo5","halo6")
var/mutable_appearance/new_halo_overlay = mutable_appearance('icons/effects/32x64.dmi', istate, CALCULATE_MOB_OVERLAY_LAYER(HALO_LAYER))
new_halo_overlay.overlays.Add(emissive_appearance('icons/effects/32x64.dmi', istate, CALCULATE_MOB_OVERLAY_LAYER(HALO_LAYER), 160))
new_halo_overlay.overlays.Add(emissive_appearance('icons/effects/32x64.dmi', istate, CALCULATE_MOB_OVERLAY_LAYER(HALO_LAYER), 160, filters = H.filters))
ADD_LUM_SOURCE(H, LUM_SOURCE_HOLY)
H.overlays_standing[HALO_LAYER] = new_halo_overlay
H.apply_overlay(HALO_LAYER)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
. = ..()
// If we have an emissive state, add it to the worn icon too
if (!isinhands && emissive_state)
. += emissive_appearance(icon_file, emissive_state, item_layer, 100)
. += emissive_appearance(icon_file, emissive_state, item_layer, 100, filters = origin.filters)
ADD_LUM_SOURCE(origin, LUM_SOURCE_GLASSES)

/obj/item/clothing/glasses/visor_toggling()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
/mob/living/carbon/fakefire(var/fire_icon = "Generic_mob_burning")
var/mutable_appearance/new_fire_overlay = mutable_appearance('icons/mob/OnFire.dmi', fire_icon, CALCULATE_MOB_OVERLAY_LAYER(FIRE_LAYER))
new_fire_overlay.appearance_flags = RESET_COLOR
new_fire_overlay.overlays.Add(emissive_appearance('icons/mob/OnFire.dmi', fire_icon, CALCULATE_MOB_OVERLAY_LAYER(FIRE_LAYER)))
new_fire_overlay.overlays.Add(emissive_appearance('icons/mob/OnFire.dmi', fire_icon, CALCULATE_MOB_OVERLAY_LAYER(FIRE_LAYER), filters = src.filters))
overlays_standing[FIRE_LAYER] = new_fire_overlay
apply_overlay(FIRE_LAYER)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ GLOBAL_LIST_EMPTY(features_by_species)

// Add on emissives, if they have one
if (S.emissive_state)
accessory_overlay.overlays.Add(emissive_appearance(S.icon, S.emissive_state, CALCULATE_MOB_OVERLAY_LAYER(layer), S.emissive_alpha))
accessory_overlay.overlays.Add(emissive_appearance(S.icon, S.emissive_state, CALCULATE_MOB_OVERLAY_LAYER(layer), S.emissive_alpha, filters = H.filters))
ADD_LUM_SOURCE(H, LUM_SOURCE_MUTANT_BODYPART)

//A little rename so we don't have to use tail_lizard or tail_human when naming the sprites.
Expand Down

0 comments on commit 16d5a1d

Please sign in to comment.