mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Formatting and the ability to dismiss adjustment scaling
Adds no_adjustment_scaling argument so if someone wants to override that part of the proc it's just an argument away. This means that see_in_dark won't affect how transparent the darkness overlay becomes.
This commit is contained in:
@@ -207,26 +207,24 @@
|
||||
if(!remote_view && !client.adminobs)
|
||||
reset_perspective(null)
|
||||
|
||||
/mob/living/proc/handle_darksight()
|
||||
/mob/living/proc/handle_darksight(var/no_adjustment_scaling = FALSE)
|
||||
var/obj/screen/fullscreen/see_through_darkness/S = screens["see_through_darkness"]
|
||||
if(!S)
|
||||
return
|
||||
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 = S.alpha / 255 //Our current adjustedness
|
||||
|
||||
var/brightness = 0.0 //We'll assume it's superdark if we can't find something else.
|
||||
|
||||
var/current = S.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
|
||||
var/turf/T = loc //Will be true 99% of the time, thus avoiding the whole elif chain.
|
||||
brightness = T.get_lumcount()
|
||||
var/darkness = 1 - brightness //Silly, I know, but 'alpha' and 'darkness' go the same direction on a number line.
|
||||
|
||||
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
|
||||
var/adjust_to = no_adjustment_scaling ? darkness : min(darkness, min(see_in_dark / world.view, 1.0)) /*Capped by how darksighted they are if this proc is allowed to go all out.
|
||||
The right-side argument of min() is a ratio of how good your darksight is, from 'nada' to 'really darn good'.*/
|
||||
var/distance = abs(current - adjust_to) //Used for how long to animate for.
|
||||
if(distance < 0.01) //We're already all set.
|
||||
return
|
||||
|
||||
//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(S, alpha = (adjust_to*255), time = (distance*10 SECONDS))
|
||||
animate(S, alpha = (adjust_to * 255), time = (distance * 10 SECONDS)) //Vite in umbra.
|
||||
|
||||
// Gives a mob the vision of being dead
|
||||
/mob/living/proc/grant_death_vision()
|
||||
|
||||
Reference in New Issue
Block a user