Computer dark visibility tweaks (#1829)

changes:

Holo-computers' displays now draw above the lighting layer, allowing them to be seen in the dark.
APCs' displays now draw above the lighting layer, allowing them to be seen in the dark.
This commit is contained in:
Lohikar
2017-03-05 22:28:11 +02:00
committed by skull132
parent f8e808f617
commit e2725ab4cb
17 changed files with 114 additions and 43 deletions
+5
View File
@@ -82,6 +82,11 @@
#define L_WALLMOUNT_RANGE 2
#define L_WALLMOUNT_HI_POWER 2 // For red/delta alert on fire alarms.
#define L_WALLMOUNT_HI_RANGE 4
// This controls by how much console sprites are dimmed before being overlayed.
#define HOLOSCREEN_ADDITION_FACTOR 1
#define HOLOSCREEN_MULTIPLICATION_FACTOR 0.5
#define HOLOSCREEN_ADDITION_OPACITY 0.8
#define HOLOSCREEN_MULTIPLICATION_OPACITY 1
// Just so we can avoid unneeded proc calls when profiling is disabled.
#define L_PROF(O,T) if (lighting_profiling) {lprof_write(O,T);}
+33
View File
@@ -0,0 +1,33 @@
// Factor/Opacity values are defined in __defines\lighting.dm
/proc/holographic_overlay(obj/target, icon, icon_state)
var/image/multiply = make_screen_overlay(icon, icon_state)
multiply.blend_mode = BLEND_MULTIPLY
multiply.color = list(
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
HOLOSCREEN_MULTIPLICATION_FACTOR, HOLOSCREEN_MULTIPLICATION_FACTOR, HOLOSCREEN_MULTIPLICATION_FACTOR, HOLOSCREEN_MULTIPLICATION_OPACITY
)
target.overlays += multiply
var/image/overlay = make_screen_overlay(icon, icon_state)
overlay.blend_mode = BLEND_ADD
overlay.color = list(
HOLOSCREEN_ADDITION_FACTOR, 0, 0, 0,
0, HOLOSCREEN_ADDITION_FACTOR, 0, 0,
0, 0, HOLOSCREEN_ADDITION_FACTOR, 0,
0, 0, 0, HOLOSCREEN_ADDITION_OPACITY
)
target.overlays += overlay
/proc/make_screen_overlay(icon, icon_state, brightness_factor = null)
var/image/overlay = image(icon, icon_state)
overlay.layer = LIGHTING_LAYER + 0.1
if (brightness_factor)
overlay.color = list(
brightness_factor, 0, 0, 0,
0, brightness_factor, 0, 0,
0, 0, brightness_factor, 0,
0, 0, 0, 1
)
return overlay
+1 -1
View File
@@ -40,4 +40,4 @@
/obj/machinery/computer/rcon/update_icon()
..()
if(is_operable())
overlays += image('icons/obj/computer.dmi', "ai-fixer-empty", overlay_layer)
holographic_overlay(src, src.icon, "ai-fixer-empty")
+2
View File
@@ -215,6 +215,7 @@
network = list(NETWORK_THUNDER)
density = 0
circuit = null
is_holographic = FALSE
/obj/machinery/computer/security/telescreen/entertainment
name = "entertainment monitor"
@@ -260,6 +261,7 @@
icon_screen = "syndicam"
network = list(NETWORK_MERCENARY)
circuit = null
is_holographic = FALSE // I mean, it is, but the holo effect looks terrible with the current merc shuttle floor.
/obj/machinery/computer/security/nuclear/New()
..()
+4 -1
View File
@@ -14,6 +14,7 @@
var/light_range_on = 2
var/light_power_on = 1
var/overlay_layer
var/is_holographic = TRUE
/obj/machinery/computer/New()
overlay_layer = layer
@@ -64,8 +65,10 @@
if(stat & BROKEN)
overlays += image(icon,"[icon_state]_broken", overlay_layer)
else if (is_holographic)
holographic_overlay(src, src.icon, icon_screen)
else
overlays += image(icon,icon_screen, overlay_layer)
overlays += image(icon, icon_screen, overlay_layer)
/obj/machinery/computer/power_change()
..()
@@ -47,6 +47,7 @@
light_color = LIGHT_COLOR_BLUE
icon_screen = "pass"
is_holographic = FALSE
density = 0
var/obj/item/weapon/card/id/giver
+1 -1
View File
@@ -16,7 +16,6 @@
var/datum/data/record/active2 = null
var/a_id = null
var/temp = null
//var/printing = null
/obj/machinery/computer/med_data/AltClick(var/mob/user)
eject_id()
@@ -562,3 +561,4 @@
icon_state = "laptop"
icon_screen = "medlaptop"
is_holographic = FALSE
+1
View File
@@ -2,6 +2,7 @@
name = "Shuttle"
desc = "For shuttle control."
is_holographic = FALSE
icon_screen = "shuttle"
light_color = "#00ffff"
var/auth_need = 3.0
+1 -1
View File
@@ -16,7 +16,7 @@
var/datum/data/record/active1 = null
var/a_id = null
var/temp = null
//var/printing = null
is_holographic = FALSE
var/can_change_id = 0
var/list/Perp
var/tempname = null
@@ -1,4 +1,5 @@
/obj/item/modular_computer/process()
handle_power() // Handles all computer power interaction
if(!enabled) // The computer is turned off
last_power_usage = 0
return 0
@@ -30,7 +31,7 @@
else
idle_threads.Remove(P)
handle_power() // Handles all computer power interaction
check_update_ui_need()
/obj/item/modular_computer/proc/get_preset_programs(var/app_preset_name)
@@ -75,7 +76,7 @@
return NO_EMAG_ACT
else
computer_emagged = 1
to_chat(user, "You emag \the [src]. It's screen briefly shows a \"OVERRIDE ACCEPTED: New software downloads available.\" message.")
to_chat(user, "You emag \the [src]. Its screen briefly displays a \"OVERRIDE ACCEPTED: New software downloads available.\" message.")
return 1
/obj/item/modular_computer/update_icon()
@@ -85,7 +86,10 @@
if(!enabled)
var/probably_working = hard_drive && processor_unit && damage < broken_damage && (apc_power(0) || battery_power(0))
if(icon_state_screensaver && probably_working)
overlays.Add(icon_state_screensaver)
if (is_holographic)
holographic_overlay(src, src.icon, icon_state_screensaver)
else
overlays += image(icon_state_screensaver)
if (screensaver_light_range && probably_working)
set_light(screensaver_light_range, 1, screensaver_light_color ? screensaver_light_color : "#FFFFFF")
@@ -93,10 +97,17 @@
set_light(0)
return
if(active_program)
overlays.Add(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu)
var/state = active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu
if (is_holographic)
holographic_overlay(src, src.icon, state)
else
overlays += image(state)
set_light(light_strength, l_color = active_program.color)
else
overlays.Add(icon_state_menu)
if (is_holographic)
holographic_overlay(src, src.icon, icon_state_menu)
else
overlays += image(icon_state_menu)
set_light(light_strength, l_color = menu_light_color)
/obj/item/modular_computer/proc/turn_on(var/mob/user)
@@ -7,6 +7,9 @@
PRG.event_powerfailure(1)
shutdown_computer(0)
power_has_failed = TRUE
update_icon()
// Tries to use power from battery. Passing 0 as parameter results in this proc returning whether battery is functional or not.
/obj/item/modular_computer/proc/battery_power(var/power_usage = 0)
apc_powered = FALSE
@@ -38,14 +41,21 @@
// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged
/obj/item/modular_computer/proc/handle_power()
var/power_usage = screen_on ? base_active_power_usage : base_idle_power_usage
for(var/obj/item/weapon/computer_hardware/H in get_all_components())
if(H.enabled)
power_usage += H.power_usage
last_power_usage = power_usage
if (enabled)
for(var/obj/item/weapon/computer_hardware/H in get_all_components())
if(H.enabled)
power_usage += H.power_usage
last_power_usage = power_usage
// First tries to charge from an APC, if APC is unavailable switches to battery power. If neither works the computer fails.
if(apc_power(power_usage))
if (power_has_failed)
power_has_failed = FALSE
update_icon()
return
if(battery_power(power_usage))
if (power_has_failed)
power_has_failed = FALSE
update_icon()
return
power_failure()
power_failure()
@@ -35,6 +35,8 @@
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
var/light_strength = 0 // Intensity of light this computer emits. Comparable to numbers light fixtures use.
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
var/power_has_failed = FALSE
var/is_holographic = FALSE
// Damage of the chassis. If the chassis takes too much damage it will break apart.
var/damage = 0 // Current damage level
@@ -19,3 +19,4 @@
broken_damage = 150
screensaver_light_range = 1.4
screensaver_light_color = "#0099ff"
is_holographic = TRUE
@@ -16,6 +16,7 @@
max_damage = 300
broken_damage = 150
w_class = 5
is_holographic = TRUE
/obj/item/modular_computer/telescreen/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/weapon/crowbar))
+17 -17
View File
@@ -276,27 +276,27 @@
status_overlays_lighting.len = 4
status_overlays_environ.len = 4
status_overlays_lock[1] = image(icon, "apcox-0") // 0=blue 1=red
status_overlays_lock[2] = image(icon, "apcox-1")
status_overlays_lock[1] = make_screen_overlay(icon, "apcox-0") // 0=blue 1=red
status_overlays_lock[2] = make_screen_overlay(icon, "apcox-1")
status_overlays_charging[1] = image(icon, "apco3-0")
status_overlays_charging[2] = image(icon, "apco3-1")
status_overlays_charging[3] = image(icon, "apco3-2")
status_overlays_charging[1] = make_screen_overlay(icon, "apco3-0")
status_overlays_charging[2] = make_screen_overlay(icon, "apco3-1")
status_overlays_charging[3] = make_screen_overlay(icon, "apco3-2")
status_overlays_equipment[1] = image(icon, "apco0-0")
status_overlays_equipment[2] = image(icon, "apco0-1")
status_overlays_equipment[3] = image(icon, "apco0-2")
status_overlays_equipment[4] = image(icon, "apco0-3")
status_overlays_equipment[1] = make_screen_overlay(icon, "apco0-0")
status_overlays_equipment[2] = make_screen_overlay(icon, "apco0-1")
status_overlays_equipment[3] = make_screen_overlay(icon, "apco0-2")
status_overlays_equipment[4] = make_screen_overlay(icon, "apco0-3")
status_overlays_lighting[1] = image(icon, "apco1-0")
status_overlays_lighting[2] = image(icon, "apco1-1")
status_overlays_lighting[3] = image(icon, "apco1-2")
status_overlays_lighting[4] = image(icon, "apco1-3")
status_overlays_lighting[1] = make_screen_overlay(icon, "apco1-0")
status_overlays_lighting[2] = make_screen_overlay(icon, "apco1-1")
status_overlays_lighting[3] = make_screen_overlay(icon, "apco1-2")
status_overlays_lighting[4] = make_screen_overlay(icon, "apco1-3")
status_overlays_environ[1] = image(icon, "apco2-0")
status_overlays_environ[2] = image(icon, "apco2-1")
status_overlays_environ[3] = image(icon, "apco2-2")
status_overlays_environ[4] = image(icon, "apco2-3")
status_overlays_environ[1] = make_screen_overlay(icon, "apco2-0")
status_overlays_environ[2] = make_screen_overlay(icon, "apco2-1")
status_overlays_environ[3] = make_screen_overlay(icon, "apco2-2")
status_overlays_environ[4] = make_screen_overlay(icon, "apco2-3")
var/update = check_updates() //returns 0 if no need to update icons.
// 1 if we need to update the icon_state