mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Make Darksight Great Again (#4626)
* Polaris port of darksight adjusting * I really need to stop doing this, don't I?
This commit is contained in:
@@ -231,27 +231,28 @@
|
||||
|
||||
//Vision flags, for dealing with plane visibility
|
||||
#define VIS_FULLBRIGHT 1
|
||||
#define VIS_GHOSTS 2
|
||||
#define VIS_AI_EYE 3
|
||||
#define VIS_LIGHTING 2
|
||||
#define VIS_GHOSTS 3
|
||||
#define VIS_AI_EYE 4
|
||||
|
||||
#define VIS_CH_STATUS 4
|
||||
#define VIS_CH_HEALTH 5
|
||||
#define VIS_CH_LIFE 6
|
||||
#define VIS_CH_ID 7
|
||||
#define VIS_CH_WANTED 8
|
||||
#define VIS_CH_IMPLOYAL 9
|
||||
#define VIS_CH_IMPTRACK 10
|
||||
#define VIS_CH_IMPCHEM 11
|
||||
#define VIS_CH_SPECIAL 12
|
||||
#define VIS_CH_STATUS_OOC 13
|
||||
#define VIS_CH_STATUS 5
|
||||
#define VIS_CH_HEALTH 6
|
||||
#define VIS_CH_LIFE 7
|
||||
#define VIS_CH_ID 8
|
||||
#define VIS_CH_WANTED 9
|
||||
#define VIS_CH_IMPLOYAL 10
|
||||
#define VIS_CH_IMPTRACK 11
|
||||
#define VIS_CH_IMPCHEM 12
|
||||
#define VIS_CH_SPECIAL 13
|
||||
#define VIS_CH_STATUS_OOC 14
|
||||
|
||||
#define VIS_D_COLORBLIND 14
|
||||
#define VIS_D_COLORBLINDI 15
|
||||
#define VIS_D_COLORBLIND 15
|
||||
#define VIS_D_COLORBLINDI 16
|
||||
|
||||
#define VIS_ADMIN1 16
|
||||
#define VIS_ADMIN2 17
|
||||
#define VIS_ADMIN3 18
|
||||
#define VIS_ADMIN1 17
|
||||
#define VIS_ADMIN2 18
|
||||
#define VIS_ADMIN3 19
|
||||
|
||||
#define VIS_MESONS 19
|
||||
#define VIS_MESONS 20
|
||||
|
||||
#define VIS_COUNT 19 //Must be highest number from above.
|
||||
#define VIS_COUNT 20 //Must be highest number from above.
|
||||
@@ -27,6 +27,7 @@ var/list/global_huds = list(
|
||||
var/obj/screen/whitense
|
||||
var/list/vimpaired
|
||||
var/list/darkMask
|
||||
var/obj/screen/darksight
|
||||
var/obj/screen/nvg
|
||||
var/obj/screen/thermal
|
||||
var/obj/screen/meson
|
||||
@@ -64,6 +65,13 @@ var/list/global_huds = list(
|
||||
whitense.icon = 'icons/effects/static.dmi'
|
||||
whitense.icon_state = "1 light"
|
||||
|
||||
//darksight 'hanger' for attached icons
|
||||
darksight = new /obj/screen()
|
||||
darksight.icon = null
|
||||
darksight.screen_loc = "1,1"
|
||||
darksight.plane = PLANE_LIGHTING
|
||||
darksight.plane = LIGHTING_LAYER + 0.1
|
||||
|
||||
nvg = setup_overlay("nvg_hud")
|
||||
thermal = setup_overlay("thermal_hud")
|
||||
meson = setup_overlay("meson_hud")
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
color = LIGHTING_BASE_MATRIX
|
||||
icon_state = "light1"
|
||||
auto_init = 0 // doesn't need special init
|
||||
blend_mode = BLEND_MULTIPLY
|
||||
blend_mode = BLEND_OVERLAY
|
||||
|
||||
var/lum_r = 0
|
||||
var/lum_g = 0
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
..()
|
||||
|
||||
handle_vision()
|
||||
handle_darksight()
|
||||
handle_hud_icons()
|
||||
|
||||
return 1
|
||||
@@ -212,3 +213,27 @@
|
||||
set_light(0)
|
||||
return FALSE
|
||||
|
||||
/mob/living/proc/handle_darksight()
|
||||
var/darksightedness = min(see_in_dark/world.view,1.0) //A ratio of how good your darksight is, from 'nada' to 'really darn good'
|
||||
var/current = dsoverlay.alpha/255 //Our current adjustedness
|
||||
|
||||
var/brightness = 0.0 //We'll assume it's superdark if we can't find something else.
|
||||
|
||||
if(isturf(loc))
|
||||
var/turf/T = loc //Will be true 99% of the time, thus avoiding the whole elif chain
|
||||
brightness = T.get_lumcount()
|
||||
|
||||
//Snowflake treatment of potential locations
|
||||
else if(istype(loc,/obj/mecha)) //I imagine there's like displays and junk in there. Use the lights!
|
||||
brightness = 1
|
||||
else if(istype(loc,/obj/item/weapon/holder)) //Poor carried teshari and whatnot should adjust appropriately
|
||||
var/turf/T = get_turf(src)
|
||||
brightness = T.get_lumcount()
|
||||
|
||||
var/darkness = 1-brightness //Silly, I know, but 'alpha' and 'darkness' go the same direction on a number line
|
||||
var/adjust_to = min(darkness,darksightedness)//Capped by how darksighted they are
|
||||
var/distance = abs(current-adjust_to) //Used for how long to animate for
|
||||
if(distance < 0.01) return //We're already all set
|
||||
|
||||
//world << "[src] in B:[round(brightness,0.1)] C:[round(current,0.1)] A2:[round(adjust_to,0.1)] D:[round(distance,0.01)] T:[round(distance*10 SECONDS,0.1)]"
|
||||
animate(dsoverlay, alpha = (adjust_to*255), time = (distance*10 SECONDS))
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/mob/living/New()
|
||||
..()
|
||||
|
||||
//I'll just hang my coat up over here
|
||||
dsoverlay = image('icons/mob/darksight.dmi',global_hud.darksight) //This is a secret overlay! Go look at the file, you'll see.
|
||||
var/mutable_appearance/dsma = new(dsoverlay) //Changing like ten things, might as well.
|
||||
dsma.alpha = 0
|
||||
dsma.plane = PLANE_LIGHTING
|
||||
dsma.layer = LIGHTING_LAYER + 0.1
|
||||
dsma.blend_mode = BLEND_ADD
|
||||
dsoverlay.appearance = dsma
|
||||
|
||||
/mob/living/Destroy()
|
||||
dsoverlay.loc = null //I'll take my coat with me
|
||||
dsoverlay = null
|
||||
return ..()
|
||||
|
||||
//mob verbs are faster than object verbs. See mob/verb/examine.
|
||||
/mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1))
|
||||
set name = "Pull"
|
||||
|
||||
@@ -48,5 +48,7 @@
|
||||
var/evasion = 0 // Makes attacks harder to land. Each number equals 15% more likely to miss. Negative numbers increase hit chance.
|
||||
var/force_max_speed = 0 // If 1, the mob runs extremely fast and cannot be slowed.
|
||||
|
||||
var/image/dsoverlay = null //Overlay used for darksight eye adjustments
|
||||
|
||||
var/glow_toggle = 0 // If they're glowing!
|
||||
var/glow_color = "#FFFFFF" // The color they're glowing!
|
||||
|
||||
@@ -6,4 +6,6 @@
|
||||
mind.active = 1 //indicates that the mind is currently synced with a client
|
||||
//If they're SSD, remove it so they can wake back up.
|
||||
update_antag_icons(mind)
|
||||
client.screen |= global_hud.darksight
|
||||
client.images |= dsoverlay
|
||||
return .
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
//It'd be nice to lazy init these but some of them are important to just EXIST. Like without ghost planemaster, you can see ghosts. Go figure.
|
||||
plane_masters[VIS_FULLBRIGHT] = new /obj/screen/plane_master/fullbright //Lighting system (lighting_overlay objects)
|
||||
plane_masters[VIS_LIGHTING] = new /obj/screen/plane_master/lighting //Lighting system (but different!)
|
||||
plane_masters[VIS_GHOSTS] = new /obj/screen/plane_master/ghosts //Ghosts!
|
||||
plane_masters[VIS_AI_EYE] = new /obj/screen/plane_master{plane = PLANE_AI_EYE} //AI Eye!
|
||||
|
||||
@@ -131,12 +132,17 @@
|
||||
//Lighting is weird and has matrix shenanigans. Think of this as turning on/off darkness.
|
||||
/obj/screen/plane_master/fullbright
|
||||
plane = PLANE_LIGHTING
|
||||
layer = LIGHTING_LAYER
|
||||
layer = LIGHTING_LAYER+1
|
||||
color = null //To break lighting when visible (this is sorta backwards)
|
||||
alpha = 255 //Starts full opaque
|
||||
invisibility = 101 //But invisible
|
||||
alpha = 0 //Starts full opaque
|
||||
invisibility = 101
|
||||
invis_toggle = TRUE
|
||||
|
||||
/obj/screen/plane_master/lighting
|
||||
plane = PLANE_LIGHTING
|
||||
blend_mode = BLEND_MULTIPLY
|
||||
alpha = 255
|
||||
|
||||
/////////////////
|
||||
//Ghosts has a special alpha level
|
||||
/obj/screen/plane_master/ghosts
|
||||
|
||||
BIN
icons/mob/darksight.dmi
Normal file
BIN
icons/mob/darksight.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
Reference in New Issue
Block a user