mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-09 16:05:07 +00:00
Revert "[READY] Adds alpha masking helper, which cryo now uses (#44281)"
This reverts commit 8672a8010b.
This commit is contained in:
@@ -1200,32 +1200,3 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
|
||||
|
||||
var/icon/I = getFlatIcon(thing)
|
||||
return icon2html(I, target)
|
||||
|
||||
//If you are using icons, consider using /icon/UseAlphaMask instead
|
||||
/proc/apply_alpha_mask(image/target, image/mask)
|
||||
var/target_old_color = target.color
|
||||
var/target_old_blend_mode = target.blend_mode
|
||||
var/target_old_appearance_flags = target.appearance_flags
|
||||
var/mask_old_color = mask.color
|
||||
var/mask_old_appearance_flags = mask.appearance_flags
|
||||
|
||||
target.color = list(0,0,0,0, 0,0,0,0, 0,0,0,0, 1,0,0,0, 0,0,0,1)
|
||||
target.blend_mode = BLEND_MULTIPLY
|
||||
target.appearance_flags |= KEEP_TOGETHER
|
||||
mask.color = list(0,0,0,1, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,1,1,0)
|
||||
mask.appearance_flags |= KEEP_TOGETHER
|
||||
|
||||
var/image/together = new()
|
||||
together.appearance_flags |= KEEP_TOGETHER
|
||||
|
||||
mask.add_overlay(target)
|
||||
target.color = target_old_color
|
||||
together.overlays = list(mask, target)
|
||||
|
||||
target.blend_mode = target_old_blend_mode
|
||||
target.appearance_flags = target_old_appearance_flags
|
||||
mask.color = mask_old_color
|
||||
mask.appearance_flags = mask_old_appearance_flags
|
||||
mask.cut_overlay(target)
|
||||
|
||||
return together
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#define CRYOMOBS 'icons/obj/cryo_mobs.dmi'
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell
|
||||
name = "cryo cell"
|
||||
icon = 'icons/obj/cryogenics.dmi'
|
||||
@@ -35,19 +37,11 @@
|
||||
fair_market_price = 10
|
||||
payment_department = ACCOUNT_MED
|
||||
|
||||
// for alpha masking
|
||||
var/image/alpha_overlay
|
||||
var/image/alpha_overlay_32x32
|
||||
var/overlay_pixel_y = 0
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/Initialize()
|
||||
. = ..()
|
||||
initialize_directions = dir
|
||||
|
||||
alpha_overlay = image('icons/obj/cryogenics.dmi', "pod-alpha")
|
||||
alpha_overlay_32x32 = image('icons/obj/cryogenics32x32.dmi', "pod-alpha")
|
||||
|
||||
radio = new(src)
|
||||
radio.keyslot = new radio_key
|
||||
radio.subspace_transmission = TRUE
|
||||
@@ -112,21 +106,37 @@
|
||||
return
|
||||
|
||||
if(occupant)
|
||||
var/image/occupant_overlay = image(occupant.icon, occupant.icon_state, dir = SOUTH)
|
||||
occupant_overlay.appearance_flags |= KEEP_TOGETHER
|
||||
occupant_overlay.copy_overlays(occupant)
|
||||
occupant_overlay.pixel_x = occupant.pixel_x
|
||||
overlay_pixel_y = 0
|
||||
var/image/occupant_overlay
|
||||
|
||||
var/is_32x32 = icon(occupant.icon, occupant.icon_state).Height() < 64 // anything less than 64 should get the 32 overlay
|
||||
if(ismonkey(occupant)) // Monkey
|
||||
occupant_overlay = image(CRYOMOBS, "monkey")
|
||||
else if(isalienadult(occupant))
|
||||
if(isalienroyal(occupant)) // Queen and prae
|
||||
occupant_overlay = image(CRYOMOBS, "alienq")
|
||||
else if(isalienhunter(occupant)) // Hunter
|
||||
occupant_overlay = image(CRYOMOBS, "alienh")
|
||||
else if(isaliensentinel(occupant)) // Sentinel
|
||||
occupant_overlay = image(CRYOMOBS, "aliens")
|
||||
else // Drone or other
|
||||
occupant_overlay = image(CRYOMOBS, "aliend")
|
||||
|
||||
else if(ishuman(occupant) || islarva(occupant) || (isanimal(occupant) && !ismegafauna(occupant))) // Mobs that are smaller than cryotube
|
||||
occupant_overlay = image(occupant.icon, occupant.icon_state)
|
||||
occupant_overlay.copy_overlays(occupant)
|
||||
|
||||
else
|
||||
occupant_overlay = image(CRYOMOBS, "generic")
|
||||
|
||||
occupant_overlay.dir = SOUTH
|
||||
occupant_overlay.pixel_y = 22
|
||||
|
||||
if(on && !running_anim && is_operational())
|
||||
icon_state = "pod-on"
|
||||
running_anim = TRUE
|
||||
run_anim(is_32x32, occupant_overlay)
|
||||
run_anim(TRUE, occupant_overlay)
|
||||
else
|
||||
icon_state = "pod-off"
|
||||
add_masked_overlay(is_32x32, occupant_overlay)
|
||||
add_overlay(occupant_overlay)
|
||||
add_overlay("cover-off")
|
||||
|
||||
else if(on && is_operational())
|
||||
@@ -136,30 +146,20 @@
|
||||
icon_state = "pod-off"
|
||||
add_overlay("cover-off")
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/run_anim(is32x32, image/occupant_overlay, anim_up = TRUE)
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/run_anim(anim_up, image/occupant_overlay)
|
||||
if(!on || !occupant || !is_operational())
|
||||
running_anim = FALSE
|
||||
return
|
||||
cut_overlays()
|
||||
if(overlay_pixel_y != 1) // Same effect as overlay_pixel_y == 0 || occupant_overlay.pixel_y == 2
|
||||
anim_up = overlay_pixel_y == 0 // Same effect as if(overlay_pixel_y == 0) anim_up = TRUE ; if(overlay_pixel_y == 2) anim_up = FALSE
|
||||
if(occupant_overlay.pixel_y != 23) // Same effect as occupant_overlay.pixel_y == 22 || occupant_overlay.pixel_y == 24
|
||||
anim_up = occupant_overlay.pixel_y == 22 // Same effect as if(occupant_overlay.pixel_y == 22) anim_up = TRUE ; if(occupant_overlay.pixel_y == 24) anim_up = FALSE
|
||||
if(anim_up)
|
||||
overlay_pixel_y++
|
||||
occupant_overlay.pixel_y++
|
||||
else
|
||||
overlay_pixel_y--
|
||||
add_masked_overlay(is32x32, occupant_overlay)
|
||||
occupant_overlay.pixel_y--
|
||||
add_overlay(occupant_overlay)
|
||||
add_overlay("cover-on")
|
||||
addtimer(CALLBACK(src, .proc/run_anim, is32x32, occupant_overlay, anim_up), 7, TIMER_UNIQUE)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/add_masked_overlay(is32x32, image/overlay) // overlay blend mode needs to be multiply
|
||||
var/image/masked
|
||||
if(is32x32)
|
||||
masked = apply_alpha_mask(overlay, alpha_overlay_32x32)
|
||||
masked.pixel_y = 22 + overlay_pixel_y
|
||||
else
|
||||
overlay.pixel_y = overlay_pixel_y
|
||||
masked = apply_alpha_mask(overlay, alpha_overlay)
|
||||
add_overlay(masked)
|
||||
addtimer(CALLBACK(src, .proc/run_anim, anim_up, occupant_overlay), 7, TIMER_UNIQUE)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/nap_violation(mob/violator)
|
||||
open_machine()
|
||||
@@ -450,3 +450,5 @@
|
||||
node.atmosinit()
|
||||
node.addMember(src)
|
||||
build_network()
|
||||
|
||||
#undef CRYOMOBS
|
||||
|
||||
BIN
icons/obj/cryo_mobs.dmi
Normal file
BIN
icons/obj/cryo_mobs.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 225 B |
Reference in New Issue
Block a user