Merge pull request #4498 from CHOMPStation2/upstream-merge-13267

[MIRROR] That nice glow
This commit is contained in:
Razgriz
2022-07-04 21:24:50 -07:00
committed by GitHub
3 changed files with 48 additions and 41 deletions

View File

@@ -75,7 +75,7 @@ var/global/list/light_type_cache = list()
/obj/machinery/light_construct/attack_hand(mob/user)
. = ..()
if(.)
if(.)
return . // obj/machinery/attack_hand returns 1 if user can't use the machine
if(cell)
user.visible_message("[user] removes [cell] from [src]!","<span class='notice'>You remove [cell].</span>")
@@ -251,6 +251,9 @@ var/global/list/light_type_cache = list()
var/brightness_power_ns
var/brightness_color_ns
var/overlay_color = LIGHT_COLOR_INCANDESCENT_TUBE
/obj/machinery/light/flicker
auto_flicker = TRUE
@@ -266,6 +269,7 @@ var/global/list/light_type_cache = list()
light_type = /obj/item/weapon/light/bulb
construct_type = /obj/machinery/light_construct/small
shows_alerts = FALSE //VOREStation Edit
overlay_color = LIGHT_COLOR_INCANDESCENT_BULB
/obj/machinery/light/small/flicker
auto_flicker = TRUE
@@ -287,6 +291,7 @@ var/global/list/light_type_cache = list()
construct_type = /obj/machinery/light_construct/flamp
shows_alerts = FALSE //VOREStation Edit
var/lamp_shade = 1
overlay_color = LIGHT_COLOR_INCANDESCENT_BULB
/obj/machinery/light/flamp/Initialize(mapload, obj/machinery/light_construct/construct = null)
. = ..()
@@ -294,10 +299,10 @@ var/global/list/light_type_cache = list()
start_with_cell = FALSE
lamp_shade = 0
update_icon()
else
else
if(start_with_cell && !no_emergency)
cell = new/obj/item/weapon/cell/emergency_light(src)
/obj/machinery/light/flamp/flicker
auto_flicker = TRUE
@@ -364,18 +369,26 @@ var/global/list/light_type_cache = list()
//VOREStation Edit Start
if(shows_alerts && current_alert && on)
icon_state = "[base_state]-alert-[current_alert]"
add_light_overlay(FALSE, icon_state)
else
icon_state = "[base_state][on]"
if(on)
add_light_overlay()
else
remove_light_overlay()
//VOREStation Edit End
if(LIGHT_EMPTY)
icon_state = "[base_state]-empty"
on = 0
remove_light_overlay() //VOREStation add
if(LIGHT_BURNED)
icon_state = "[base_state]-burned"
on = 0
remove_light_overlay() //VOREStation add
if(LIGHT_BROKEN)
icon_state = "[base_state]-broken"
on = 0
remove_light_overlay() //VOREStation add
return
/obj/machinery/light/flamp/update_icon()
@@ -384,15 +397,22 @@ var/global/list/light_type_cache = list()
switch(status) // set icon_states
if(LIGHT_OK)
icon_state = "[base_state][on]"
if(on) //VOREStation add
add_light_overlay() //VOREStation add
else //VOREStation add
remove_light_overlay() //VOREStation add
if(LIGHT_EMPTY)
on = 0
icon_state = "[base_state][on]"
remove_light_overlay() //VOREStation add
if(LIGHT_BURNED)
on = 0
icon_state = "[base_state][on]"
remove_light_overlay() //VOREStation add
if(LIGHT_BROKEN)
on = 0
icon_state = "[base_state][on]"
remove_light_overlay() //VOREStation add
return
else
base_state = "flamp"
@@ -418,12 +438,12 @@ var/global/list/light_type_cache = list()
current_alert = null
var/obj/item/weapon/light/L = get_light_type_instance(light_type)
if(L)
update_from_bulb(L)
else
brightness_color = nightshift_enabled ? initial(brightness_color_ns) : initial(brightness_color)
update()
//VOREstation Edit End
@@ -727,7 +747,7 @@ var/global/list/light_type_cache = list()
update(FALSE)
return
// ai alt click - Make light flicker. Very important for atmosphere.
// ai alt click - Make light flicker. Very important for atmosphere.
/obj/machinery/light/AIAltClick(mob/user)
flicker(1)
@@ -903,7 +923,7 @@ var/global/list/light_type_cache = list()
throwforce = 5
w_class = ITEMSIZE_TINY
matter = list(MAT_STEEL = 60)
///LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
var/status = LIGHT_OK
///Base icon_state name to append suffixes for status
@@ -929,7 +949,7 @@ var/global/list/light_type_cache = list()
var/nightshift_power = 0.45
///Replaces brightness_color during nightshifts.
var/nightshift_color = LIGHT_COLOR_NIGHTSHIFT
drop_sound = 'sound/items/drop/glass.ogg'
pickup_sound = 'sound/items/pickup/glass.ogg'
@@ -971,7 +991,7 @@ var/global/list/light_type_cache = list()
name = "large light bulb"
brightness_range = 7
brightness_power = 1.5
nightshift_range = 4
nightshift_power = 0.75

View File

@@ -60,6 +60,7 @@
plane = TURF_PLANE
layer = ABOVE_TURF_LAYER
construct_type = /obj/machinery/light_construct/floortube
overlay_above_everything = FALSE
/obj/machinery/light/floortube/flicker
auto_flicker = TRUE
@@ -106,6 +107,7 @@
plane = MOB_PLANE
layer = ABOVE_MOB_LAYER
construct_type = /obj/machinery/light_construct/bigfloorlamp
overlay_above_everything = TRUE
/obj/machinery/light/bigfloorlamp/flicker
auto_flicker = TRUE
@@ -151,6 +153,7 @@
layer = ABOVE_MOB_LAYER
construct_type = null
overlay_color = LIGHT_COLOR_INCANDESCENT_BULB
overlay_above_everything = TRUE
color = "#3e5064"
/obj/machinery/light/small/fairylights/broken()
@@ -159,47 +162,31 @@
/obj/machinery/light/small/fairylights/flicker
auto_flicker = TRUE
/obj/machinery/light/small/fairylights/update_icon()
switch(status)
if(LIGHT_OK)
if(shows_alerts && current_alert && on)
icon_state = "[base_state]-alert-[current_alert]"
add_light_overlay(FALSE)
else
icon_state = "[base_state][on]"
add_light_overlay()
if(LIGHT_EMPTY)
icon_state = "[base_state]-empty"
on = 0
remove_light_overlay()
if(LIGHT_BURNED)
icon_state = "[base_state]-burned"
on = 0
remove_light_overlay()
if(LIGHT_BROKEN)
icon_state = "[base_state]-broken"
on = 0
remove_light_overlay()
return
/obj/machinery/light
var/image/overlay_layer = null
var/overlay_color = null
var/overlay_above_everything = TRUE
/obj/machinery/light/proc/add_light_overlay(do_color = TRUE)
/obj/machinery/light/proc/add_light_overlay(do_color = TRUE, provided_state = null)
remove_light_overlay()
overlay_layer = image(icon, "[base_state]-overlay")
if(provided_state)
overlay_layer = image(icon, "[provided_state]-overlay")
else
overlay_layer = image(icon, "[base_state]-overlay")
overlay_layer.appearance_flags = RESET_COLOR|KEEP_APART
if(overlay_color && do_color)
overlay_layer.color = overlay_color
overlay_layer.plane = PLANE_LIGHTING_ABOVE
if(overlay_above_everything)
overlay_layer.plane = PLANE_LIGHTING_ABOVE
else
overlay_layer.plane = PLANE_EMISSIVE
add_overlay(overlay_layer)
/obj/machinery/light/proc/remove_light_overlay()
cut_overlay(overlay_layer)
qdel(overlay_layer)
overlay_layer = null
if(overlay_layer)
cut_overlay(overlay_layer)
qdel(overlay_layer)
overlay_layer = null
/*
@@ -221,4 +208,4 @@
icon_state = "big_flamp-construct-stage2"
if(3)
icon_state = "big_flamp-empty"
*/
*/