Planes and Darkness (#33052)

* darkness

* darkness

* Update login.dm

* looks better

* vision fixes

* vamp vision fix

* Update grue.dm

* I don't know what I'm doing

* Update glasses.dm

* Update vampire.dm

* remove backdrop

* toggle darkness

* adjust human sight

* Update eyes.dm

* fixed shifty's mistakes

* grue drainlight is shit

* spider vision

* move to carbon level
This commit is contained in:
adacovsk
2022-10-14 20:04:24 -04:00
committed by GitHub
parent f1449b01ab
commit 251c973eb7
32 changed files with 413 additions and 149 deletions

View File

@@ -380,11 +380,6 @@
#define calculateticks(x) x * world.tick_lag // Converts your ticks to proper tenths.
#define tcheck(CPU,TOSLEEP) if(world.cpu > CPU) sleep(calculateticks(TOSLEEP)) //Shorthand of checking and then sleeping a process based on world CPU
#define FOR_DVIEW(type, range, center, invis_flags) \
dview_mob.loc = center; \
dview_mob.see_invisible = invis_flags; \
for(type in view(range, dview_mob))
//get_turf(): Returns the turf that contains the atom.
//Example: A fork inside a box inside a locker will return the turf the locker is standing on.
//Yes, this is the fastest known way to do it.

View File

@@ -13,7 +13,7 @@
#define LIGHTING_ICON 'icons/effects/lighting_overlay.dmi' // icon used for lighting shading effects
#define LIGHTING_SOFT_THRESHOLD 0.05 // If the max of the lighting lumcounts of each spectrum drops below this, disable luminosity on the lighting overlays.
#define LIGHTING_SOFT_THRESHOLD 0.005 // If the max of the lighting lumcounts of each spectrum drops below this, disable luminosity on the lighting overlays.
// If I were you I'd leave this alone.
#define LIGHTING_BASE_MATRIX \
@@ -73,3 +73,19 @@
#define LIGHT_EMPTY 1
#define LIGHT_BROKEN 2
#define LIGHT_BURNED 3
#define FOR_DVIEW(type, range, center, invis_flags) \
dview_mob.loc = center; \
dview_mob.see_invisible = invis_flags; \
for(type in view(range, dview_mob))
#define END_FOR_DVIEW dview_mob.loc = null
// Alpha levels
#define MINIMUM_ALPHA_DARK_PLANE 255
#define HUMAN_TARGET_ALPHA 20
#define SUNGLASSES_TARGET_ALPHA 5
#define LIGHTING_PLANEMASTER_COLOR list(null,null,null,"#0000","#000F")

View File

@@ -213,6 +213,7 @@ Why is FLOAT_PLANE added to a bunch of these?
#define FAKE_CAMERA_PLANE (13)
#define LIGHTING_PLANE (14) // Don't put anything other than lighting_overlays in there please
#define SELF_VISION_LAYER -1
#define LIGHTING_LAYER 0
#define ABOVE_LIGHTING_PLANE (15)
@@ -338,6 +339,17 @@ var/noir_master = list(new /obj/abstract/screen/plane_master/noir_master(),new /
ghost_planemaster_dummy = new /obj/abstract/screen/plane_master/ghost_planemaster_dummy
screen |= ghost_planemaster_dummy
// OVERDARKNESS PLANEMASTER
// Used to apply darkness over lights that the player isn't supposed to see when the lighting master is set to BLEND_ADD
/obj/abstract/screen/plane_master/overdark_planemaster
plane = 0
/obj/abstract/screen/plane_master/overdark_planemaster_target
appearance_flags = 0
plane = LIGHTING_PLANE
blend_mode = BLEND_ADD
mouse_opacity = 0
screen_loc = "CENTER,CENTER"
// DARKNESS PLANEMASTER
// One planemaster for each client, which they gain during mob/login()

View File

@@ -90,4 +90,4 @@
cost = 666
spellpath = /spell/targeted/equip_item/cape
granttext = "You can also spawn a rather nice cape."
store_in_memory = TRUE
store_in_memory = TRUE

View File

@@ -253,6 +253,9 @@
H.change_sight(adding = SEE_TURFS|SEE_OBJS)
H.update_perception()
/datum/role/vampire/update_perception()
return
/datum/role/vampire/proc/is_mature_or_has_vision()
return (locate(/datum/power/vampire/vision) in current_powers) || (locate(/datum/power/vampire/mature) in current_powers)

View File

@@ -297,6 +297,9 @@ the HUD updates properly! */
if(G.see_invisible)
see_invisible = G.see_invisible
seedarkness = G.seedarkness
update_darkness()
/* HUD shit goes here, as long as it doesn't modify sight flags
* The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl
*/
@@ -336,4 +339,5 @@ the HUD updates properly! */
holder.icon_state = "consthealth0"
else
holder.icon_state = "consthealth[10*round((construct.health/construct.maxHealth)*10)]"
holder.plane = ABOVE_LIGHTING_PLANE
C.images += holder

View File

@@ -7,6 +7,7 @@
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
invisibility = INVISIBILITY_OBSERVER
seedarkness = FALSE
pass_flags = PASSBLOB
faction = "blob"

View File

@@ -467,6 +467,7 @@ var/list/blob_candidates = list()
blob_candidate.perspective = EYE_PERSPECTIVE
blob_candidate.eye = src
blob_candidate.mob.see_invisible = SEE_INVISIBLE_MINIMUM
blob_candidate.mob.seedarkness = FALSE
if(isobserver(M))
var/mob/dead/observer/O = M
if(O.can_reenter_corpse)

View File

@@ -45,7 +45,11 @@ var/list/obj/machinery/camera/cyborg_cams = list(
cam_screen.screen_loc = "[map_name]:1,1"
cam_screen.del_on_map_removal = FALSE
cam_plane_masters = list()
for(var/plane in subtypesof(/obj/abstract/screen/plane_master))
var/static/list/darkness_plane_things = list(
/obj/abstract/screen/plane/master,
/obj/abstract/screen/plane/dark
)
for(var/plane in subtypesof(/obj/abstract/screen/plane_master) + darkness_plane_things)
var/obj/abstract/screen/instance = new plane()
instance.assigned_map = map_name
instance.screen_loc = "[map_name]:CENTER"

View File

@@ -43,7 +43,7 @@ var/global/list/reagents_to_log = list(FUEL, PLASMA, PACID, SACID, AMUTATIONTOXI
// Can we wrench/weld this to a turf with a dense /obj on it?
var/can_affix_to_dense_turf=0
var/list/alphas = list()
var/list/alphas_obj = list()
var/impactsound
var/current_glue_state = GLUE_STATE_NONE
@@ -683,7 +683,7 @@ a {
if(invisibility || alpha <= 1 || !source_define)
return
invisibility = invisibility_value
alphas[source_define] = alpha_value
alphas_obj[source_define] = alpha_value
handle_alpha()
if(ismob(loc))
var/mob/M = loc
@@ -695,20 +695,20 @@ a {
/obj/proc/make_visible(var/source_define)
if(!invisibility && alpha == 255 || !source_define)
return
if(src && alphas[source_define])
if(src && alphas_obj[source_define])
invisibility = 0
alphas.Remove(source_define)
alphas_obj.Remove(source_define)
handle_alpha()
if(ismob(loc))
var/mob/M = loc
M.regenerate_icons()
/obj/proc/handle_alpha() //uses the lowest alpha on the mob
if(alphas.len < 1)
if(alphas_obj.len < 1)
alpha = 255
else
sortTim(alphas, /proc/cmp_numeric_asc,1)
alpha = alphas[alphas[1]]
sortTim(alphas_obj, /proc/cmp_numeric_asc,1)
alpha = alphas_obj[alphas_obj[1]]
/obj/proc/gen_quality(var/modifier = 0, var/min_quality = 0, var/datum/material/mat)
var/material_mod = mat ? mat.quality_mod : material_type ? material_type.quality_mod : 1

View File

@@ -553,6 +553,12 @@ NOTE: You will only be polled about this role once per round. To change your ch
else
view = newView
if(mob.dark_plane)
mob.dark_plane.transform = null
var/matrix/M = matrix()
M.Scale(view*2.2)
mob.dark_plane.transform = M
if(mob && ishuman(mob))
var/mob/living/carbon/human/H = mob
var/obj/item/clothing/under/U = H.get_item_by_slot(slot_w_uniform)

View File

@@ -14,6 +14,7 @@
var/cover_hair = 0
var/see_invisible = 0
var/see_in_dark = 0
var/seedarkness = TRUE
var/prescription = 0
min_harm_label = 12
harm_label_examine = list("<span class='info'>A label is covering one lens, but doesn't reach the other.</span>","<span class='warning'>A label covers the lenses!</span>")
@@ -26,6 +27,9 @@
var/my_dark_plane_alpha_override
var/my_dark_plane_alpha_override_value
/obj/item/clothing/glasses/proc/update_perception(var/mob/living/carbon/human/M)
return
/*
SEE_SELF // can see self, no matter what
SEE_MOBS // can see all mobs, no matter what
@@ -35,7 +39,6 @@ SEE_PIXELS// if an object is located on an unlit area, but some of its pixels ar
// in a lit area (via pixel_x,y or smooth movement), can see those pixels
BLIND // can't see anything
*/
/obj/item/clothing/glasses/mob_can_equip(mob/living/carbon/human/user, slot, disable_warning = 0)
var/mob/living/carbon/human/H = user
if(!istype(H) || stored_glasses || !glasses_fit || slot == slot_l_store || slot == slot_r_store)
@@ -273,6 +276,16 @@ var/list/science_goggles_wearers = list()
eyeprot = 1
species_fit = list(VOX_SHAPED, GREY_SHAPED, INSECT_SHAPED)
/obj/item/clothing/glasses/sunglasses/equipped(mob/M, slot)
if (M.self_vision)
M.self_vision.target_alpha = SUNGLASSES_TARGET_ALPHA // You see almost nothing with those on!
return ..()
/obj/item/clothing/glasses/sunglasses/unequipped(mob/living/carbon/human/M, from_slot)
if (M.self_vision)
M.self_vision.target_alpha = initial(M.self_vision.target_alpha)
return ..()
/obj/item/clothing/glasses/sunglasses/virus
/obj/item/clothing/glasses/sunglasses/virus/dropped(mob/user)
@@ -545,10 +558,12 @@ var/list/science_goggles_wearers = list()
if(harm_labeled < min_harm_label)
vision_flags |= SEE_MOBS
see_invisible |= SEE_INVISIBLE_MINIMUM
seedarkness = FALSE
invisa_view = 2
else
vision_flags &= ~SEE_MOBS
see_invisible &= ~SEE_INVISIBLE_MINIMUM
seedarkness = TRUE
invisa_view = 0
/obj/item/clothing/glasses/thermal/eyepatch

View File

@@ -2,24 +2,12 @@
item_state = "glasses"
species_fit = list(GREY_SHAPED)
var/on = TRUE
var/list/color_matrix = null
/obj/item/clothing/glasses/scanner/attack_self()
toggle()
/obj/item/clothing/glasses/scanner/proc/apply_color(mob/living/carbon/user) //for altering the color of the wearer's vision while active
if(color_matrix)
if(user.client)
var/client/C = user.client
C.color = color_matrix
/obj/item/clothing/glasses/scanner/proc/remove_color(mob/living/carbon/user)
if(color_matrix)
if(user.client)
var/client/C = user.client
C.color = initial(C.color)
/obj/item/clothing/glasses/scanner/equipped(M as mob, glasses)
/obj/item/clothing/glasses/scanner/equipped(var/mob/living/carbon/M, glasses)
if(istype(M, /mob/living/carbon/monkey))
var/mob/living/carbon/monkey/O = M
if(O.glasses != src)
@@ -32,14 +20,14 @@
return
if(on)
if(iscarbon(M))
apply_color(M)
M.update_perception()
M.update_darkness()
..()
/obj/item/clothing/glasses/scanner/unequipped(mob/user, var/from_slot = null)
/obj/item/clothing/glasses/scanner/unequipped(mob/living/carbon/user, var/from_slot = null)
if(from_slot == slot_glasses)
if(on)
if(iscarbon(user))
remove_color(user)
user.seedarkness = TRUE
..()
/obj/item/clothing/glasses/scanner/update_icon()
@@ -60,38 +48,19 @@
if (on)
disable(C)
else
enable(C)
update_icon()
C.update_inv_glasses()
/obj/item/clothing/glasses/scanner/proc/enable(var/mob/C)
/obj/item/clothing/glasses/scanner/proc/enable(var/mob/living/carbon/C)
on = TRUE
to_chat(C, "You turn \the [src] on.")
if(iscarbon(loc))
if(istype(loc, /mob/living/carbon/monkey))
var/mob/living/carbon/monkey/M = C
if(M.glasses && (M.glasses == src))
apply_color(M)
else if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = C
if(H.glasses && (H.glasses == src))
apply_color(H)
/obj/item/clothing/glasses/scanner/proc/disable(var/mob/C)
/obj/item/clothing/glasses/scanner/proc/disable(var/mob/living/carbon/C)
on = FALSE
to_chat(C, "You turn \the [src] off.")
if(iscarbon(loc))
if(istype(loc, /mob/living/carbon/monkey))
var/mob/living/carbon/monkey/M = C
if(M.glasses && (M.glasses == src))
remove_color(M)
else if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = C
if(H.glasses && (H.glasses == src))
remove_color(H)
/obj/item/clothing/glasses/scanner/night
name = "night vision goggles"
@@ -99,28 +68,88 @@
icon_state = "night"
item_state = "glasses"
origin_tech = Tc_MAGNETS + "=2"
see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING
see_invisible = 0
seedarkness = TRUE
see_in_dark = 8
actions_types = list(/datum/action/item_action/toggle_goggles)
species_fit = list(VOX_SHAPED, GREY_SHAPED)
eyeprot = -1
color_matrix = list(0.8, 0, 0 ,\
0 , 1, 0 ,\
0 , 0, 0.8) //equivalent to #CCFFCC
my_dark_plane_alpha_override = "night_vision"
my_dark_plane_alpha_override_value = 255
var/obj/abstract/screen/plane_master/overdark_planemaster/overdark_planemaster
var/obj/abstract/screen/plane_master/overdark_planemaster_target/overdark_target
/obj/item/clothing/glasses/scanner/night/enable(var/mob/C)
see_invisible = initial(see_invisible)
/obj/item/clothing/glasses/scanner/night/New()
..()
overdark_planemaster = new
overdark_planemaster.render_target = "night vision goggles (\ref[src])"
overdark_target = new
overdark_target.render_source = "night vision goggles (\ref[src])"
/obj/item/clothing/glasses/scanner/night/enable(var/mob/living/carbon/C)
see_in_dark = initial(see_in_dark)
eyeprot = initial(eyeprot)
my_dark_plane_alpha_override = "night_vision"
if (ishuman(C))
var/mob/living/carbon/human/H = C
if (H.glasses == src)
C.update_perception()
add_overdark(C)
else if (ismonkey(C))
var/mob/living/carbon/monkey/M = C
if (M.glasses == src)
C.update_perception()
add_overdark(C)
return ..()
/obj/item/clothing/glasses/scanner/night/disable(var/mob/C)
/obj/item/clothing/glasses/scanner/night/disable(var/mob/living/carbon/C)
. = ..()
see_invisible = 0
see_in_dark = 0
my_dark_plane_alpha_override = null
eyeprot = 0
remove_overdark(C)
if (ishuman(C))
var/mob/living/carbon/human/H = C
if (H.glasses == src)
if (C.client)
C.client.color = null
C.update_perception()
else if (ismonkey(C))
var/mob/living/carbon/monkey/M = C
if (M.glasses == src)
if (C.client)
C.client.color = null
C.update_perception()
/obj/item/clothing/glasses/scanner/night/update_perception(var/mob/living/carbon/human/M)
if (on)
if (M.master_plane)
M.master_plane.blend_mode = BLEND_ADD
if (M.client)
M.client.color = "#33FF33"
remove_overdark(M)
add_overdark(M)
else
my_dark_plane_alpha_override = null
if (M.master_plane)
M.master_plane.blend_mode = BLEND_MULTIPLY
/obj/item/clothing/glasses/scanner/night/unequipped(mob/living/carbon/user, var/from_slot = null)
if(from_slot == slot_glasses)
if(on)
remove_overdark(user)
if (user.client)
user.client.color = null
user.update_perception()
..()
/obj/item/clothing/glasses/scanner/night/proc/add_overdark(var/mob/living/carbon/C)
if (istype(C) && C.client)
C.client.screen |= overdark_planemaster
C.client.screen |= overdark_target
/obj/item/clothing/glasses/scanner/night/proc/remove_overdark(var/mob/living/carbon/C)
if (istype(C) && C.client)
C.client.screen -= overdark_planemaster
C.client.screen -= overdark_target
var/list/meson_wearers = list()
@@ -132,6 +161,7 @@ var/list/meson_wearers = list()
vision_flags = SEE_TURFS
eyeprot = -1
see_invisible = SEE_INVISIBLE_MINIMUM
seedarkness = FALSE
actions_types = list(/datum/action/item_action/toggle_goggles)
species_fit = list(VOX_SHAPED, GREY_SHAPED, INSECT_SHAPED)
glasses_fit = TRUE
@@ -140,7 +170,9 @@ var/list/meson_wearers = list()
my_dark_plane_alpha_override = "mesons"
my_dark_plane_alpha_override_value = 255
/obj/item/clothing/glasses/scanner/meson/enable(var/mob/C)
/obj/item/clothing/glasses/scanner/meson/enable(var/mob/living/carbon/C)
on = 1
update_mob(viewing)
var/area/A = get_area(src)
if(A.flags & NO_MESONS)
to_chat(C, "<span class = 'warning'>\The [src] flickers, but refuses to come online!</span>")
@@ -148,16 +180,30 @@ var/list/meson_wearers = list()
eyeprot = initial(eyeprot)
vision_flags |= SEE_TURFS
see_invisible |= SEE_INVISIBLE_MINIMUM
seedarkness = FALSE
my_dark_plane_alpha_override_value = 255
// body_parts_covered |= EYES
..()
/obj/item/clothing/glasses/scanner/meson/disable(var/mob/C)
/obj/item/clothing/glasses/scanner/meson/disable(var/mob/living/carbon/C)
update_mob(viewing)
eyeprot = 0
on = 0
// body_parts_covered &= ~EYES
vision_flags &= ~SEE_TURFS
see_invisible &= ~SEE_INVISIBLE_MINIMUM
..()
my_dark_plane_alpha_override_value = 0
seedarkness = TRUE
C.update_perception()
/obj/item/clothing/glasses/scanner/meson/unequipped(mob/living/carbon/user, from_slot)
. = ..()
if (user)
user.dark_plane?.alphas -= "mesons"
user.update_darkness()
user.check_dark_vision()
user.update_perception()
/obj/item/clothing/glasses/scanner/meson/area_entered(area/A)
if(A.flags & NO_MESONS && on)
@@ -177,15 +223,15 @@ var/list/meson_wearers = list()
meson_wearers += viewing
viewing.client.images += false_wall_images
/obj/item/clothing/glasses/scanner/meson/unequipped(var/mob/M)
/obj/item/clothing/glasses/scanner/meson/unequipped(var/mob/living/carbon/M)
update_mob()
..()
/obj/item/clothing/glasses/scanner/meson/equipped(var/mob/M)
/obj/item/clothing/glasses/scanner/meson/equipped(var/mob/living/carbon/M)
update_mob(M)
..()
/obj/item/clothing/glasses/scanner/meson/proc/update_mob(var/mob/new_mob)
/obj/item/clothing/glasses/scanner/meson/proc/update_mob(var/mob/living/carbon/new_mob)
if (new_mob == viewing)
clear()
apply()
@@ -229,15 +275,15 @@ var/list/meson_wearers = list()
else
icon_state = initial(icon_state)
/obj/item/clothing/glasses/scanner/material/dropped(var/mob/M)
/obj/item/clothing/glasses/scanner/material/dropped(var/mob/living/carbon/M)
update_mob()
..()
/obj/item/clothing/glasses/scanner/material/unequipped(var/mob/M)
/obj/item/clothing/glasses/scanner/material/unequipped(var/mob/living/carbon/M)
update_mob()
..()
/obj/item/clothing/glasses/scanner/material/equipped(var/mob/M)
/obj/item/clothing/glasses/scanner/material/equipped(var/mob/living/carbon/M)
update_mob(M)
..()
@@ -261,7 +307,7 @@ var/list/meson_wearers = list()
viewing.client.images += showing
/obj/item/clothing/glasses/scanner/material/proc/update_mob(var/mob/new_mob)
/obj/item/clothing/glasses/scanner/material/proc/update_mob(var/mob/living/carbon/new_mob)
if (new_mob == viewing)
clear()
apply()
@@ -277,7 +323,7 @@ var/list/meson_wearers = list()
new_mob.register_event(/event/logout, src, .proc/mob_logout)
viewing = new_mob
/obj/item/clothing/glasses/scanner/material/proc/mob_logout(mob/user)
/obj/item/clothing/glasses/scanner/material/proc/mob_logout(mob/living/carbon/user)
if (user != viewing)
return
@@ -289,4 +335,4 @@ var/list/meson_wearers = list()
. = list()
for (var/turf/TT in trange(view, T))
if (TT.holomap_data)
. += TT.holomap_data
. += TT.holomap_data

View File

@@ -0,0 +1,35 @@
/mob
var/obj/abstract/screen/plane/master/master_plane
var/obj/abstract/screen/plane/self_vision/self_vision
var/obj/abstract/screen/plane/dark/dark_plane
var/seedarkness = 1
/mob/proc/create_lighting_planes()
if (dark_plane)
client.screen -= dark_plane
qdel(dark_plane)
dark_plane = null
if (master_plane)
client.screen -= master_plane
qdel(master_plane)
master_plane = null
if (self_vision)
client.screen -= self_vision
qdel(self_vision)
self_vision = null
dark_plane = new(client)
master_plane = new(client)
self_vision = new(client)
update_darkness()
register_event(/event/before_move, src, /mob/proc/check_dark_vision)
/mob/proc/update_darkness()
if(seedarkness)
master_plane?.color = LIGHTING_PLANEMASTER_COLOR
else
master_plane?.color = ""

View File

@@ -0,0 +1,46 @@
/obj/abstract/screen/plane
name = ""
screen_loc = "CENTER"
blend_mode = BLEND_MULTIPLY
layer = 1
/obj/abstract/screen/plane/New(var/client/C)
..()
if(istype(C))
C.screen += src
verbs.Cut()
/obj/abstract/screen/plane/master
icon = 'icons/mob/screen1.dmi'
appearance_flags = NO_CLIENT_COLOR | PLANE_MASTER | RESET_TRANSFORM | RESET_COLOR | RESET_ALPHA
color = LIGHTING_PLANEMASTER_COLOR // Completely black.
plane = LIGHTING_PLANE
mouse_opacity = 0
/obj/abstract/screen/plane/self_vision
blend_mode = BLEND_ADD
mouse_opacity = 0
plane = LIGHTING_PLANE
layer = SELF_VISION_LAYER
icon = 'icons/lighting/self_vision_default.dmi'
icon_state = "default"
alpha = 0
appearance_flags = RESET_TRANSFORM | RESET_COLOR | RESET_ALPHA
invisibility = INVISIBILITY_LIGHTING
var/target_alpha = HUMAN_TARGET_ALPHA
/obj/abstract/screen/plane/dark
blend_mode = BLEND_ADD
mouse_opacity = 0
plane = LIGHTING_PLANE // Just below the master plane.
icon = 'icons/lighting/over_dark.dmi'
alpha = 10
appearance_flags = RESET_TRANSFORM | RESET_COLOR | RESET_ALPHA
var/list/alphas = list()
var/colours = null // will animate() to that colour next check_dark_vision()
/obj/abstract/screen/plane/dark/New()
..()
var/matrix/M = matrix()
M.Scale(world.view*2.2)
transform = M

View File

@@ -247,15 +247,17 @@
set name = "Toggle Darkness"
set category = "Ghost"
if (client && client.darkness_planemaster)
switch(client.darkness_planemaster.alpha)
if(255)
client.darkness_planemaster.alpha = 180
if(180)
client.darkness_planemaster.alpha = 0
else
client.darkness_planemaster.alpha = 255
switch(dark_plane.alphas["toggle_darkness"])
if(255)
see_invisible = SEE_INVISIBLE_OBSERVER
dark_plane.alphas["toggle_darkness"] = 180
if(180)
see_invisible = SEE_INVISIBLE_OBSERVER
dark_plane.alphas -= "toggle_darkness"
else
see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING
dark_plane.alphas["toggle_darkness"] = 255
check_dark_vision()
/mob/dead/observer/verb/analyze_air()
set name = "Analyze Air"

View File

@@ -43,7 +43,6 @@
. = ..()
change_sight(adding = SEE_MOBS)
/*
/mob/living/carbon/alien/update_perception()
if(dark_plane)
dark_plane.alphas["alien"] = 200
@@ -56,7 +55,6 @@
0,0,0,0)
check_dark_vision()
*/
/mob/living/carbon/alien/AdjustPlasma(amount)
plasma = min(max(plasma + amount,0),max_plasma) //upper limit of max_plasma, lower limit of 0

View File

@@ -1376,7 +1376,15 @@
return id
/mob/living/carbon/human/update_perception()
if(client && client.darkness_planemaster)
if (dark_plane)
dark_plane.alphas = list()
dark_plane.colours = null
dark_plane.blend_mode = BLEND_ADD
if (master_plane)
master_plane.blend_mode = BLEND_MULTIPLY
if(client && dark_plane)
var/datum/organ/internal/eyes/E = src.internal_organs_by_name["eyes"]
if(E)
E.update_perception(src)
@@ -1384,10 +1392,22 @@
for(var/ID in virus2)
var/datum/disease2/disease/D = virus2[ID]
for (var/datum/disease2/effect/catvision/catvision in D.effects)
if (catvision.count)//if catulism has activated at least once, we can see much better in the dark.
client.darkness_planemaster.alpha = min(100, client.darkness_planemaster.alpha)
if (catvision.count)
dark_plane.alphas["cattulism"] = clamp(15 + (catvision.count * 20),15,155) // The more it activates, the better we see, until we see as well as a tajaran would.
break
if (istype(glasses))
glasses.update_perception(src)
if (dark_plane && glasses.my_dark_plane_alpha_override && glasses.my_dark_plane_alpha_override_value)
dark_plane.alphas["[glasses.my_dark_plane_alpha_override]"] = glasses.my_dark_plane_alpha_override_value
if (mind)
for (var/key in mind.antag_roles)
var/datum/role/R = mind.antag_roles[key]
R.update_perception()
check_dark_vision()
/mob/living/carbon/human/assess_threat(var/obj/machinery/bot/secbot/judgebot, var/lasercolor)
if(judgebot.emagged == 2)
return 10 //Everyone is a criminal!

View File

@@ -35,7 +35,7 @@
if (N)
if (i > V.cached_images.len)
var/image/I = image('icons/mob/mob.dmi', loc = C, icon_state = "vampnullrod")
I.plane = MISC_HUD_MARKERS_PLANE
I.plane = ABOVE_LIGHTING_PLANE
V.cached_images += I
src.client.images += I
else

View File

@@ -152,13 +152,28 @@
0,0,0,1,
-0.2,0,-0.2,0)
see_invisible = SEE_INVISIBLE_MINIMUM
dark_plane.alphas["robot_night_vision"] = 255
dark_plane.alphas -= "robot_mesons"
dark_plane.alphas -= "robot_thermal"
if(MESON_VISION)
change_sight(adding = SEE_TURFS)
see_invisible = SEE_INVISIBLE_MINIMUM
dark_plane.alphas["robot_mesons"] = 255
dark_plane.alphas -= "robot_night_vision"
dark_plane.alphas -= "robot_thermal"
if(THERMAL_VISION)
change_sight(adding = SEE_MOBS)
see_invisible = SEE_INVISIBLE_MINIMUM
dark_plane.alphas["robot_thermal"] = 255
dark_plane.alphas -= "robot_mesons"
dark_plane.alphas -= "robot_night_vision"
see_in_dark = 4
else // nothing
dark_plane.alphas -= "robot_night_vision"
dark_plane.alphas -= "robot_mesons"
dark_plane.alphas -= "robot_thermal"
check_dark_vision()
/mob/living/silicon/robot/proc/process_killswitch()
if(scrambledcodes)

View File

@@ -67,10 +67,8 @@
src.add_spell(new spell, "cult_spell_ready", /obj/abstract/screen/movable/spell_master/bloodcult)
/mob/living/simple_animal/construct/update_perception()
if(client)
if(client.darkness_planemaster)
client.darkness_planemaster.blend_mode = BLEND_MULTIPLY
client.darkness_planemaster.alpha = 180
if(dark_plane)
dark_plane.alphas["construct"] = 75
client.color = list(
1,0,0,0,
0,1.3,0,0,
@@ -78,6 +76,7 @@
0,-0.3,-0.3,1,
0,0,0,0)
check_dark_vision()
/mob/living/simple_animal/construct/Move(NewLoc,Dir=0,step_x=0,step_y=0,var/glide_size_override = 0)
. = ..()

View File

@@ -87,6 +87,23 @@
var/a_53 = 0
var/a_54 = 0
var/obj/abstract/screen/plane_master/overdark_planemaster/overdark_planemaster
var/obj/abstract/screen/plane_master/overdark_planemaster_target/overdark_target
/mob/living/simple_animal/hostile/giant_spider/New()
..()
overdark_planemaster = new
overdark_planemaster.render_target = "night vision goggles (\ref[src])"
overdark_target = new
overdark_target.render_source = "night vision goggles (\ref[src])"
/mob/living/simple_animal/hostile/giant_spider/Login()
..()
//client.images += light_source_images
client.screen |= overdark_planemaster
client.screen |= overdark_target
/mob/living/simple_animal/hostile/giant_spider/Cross(atom/movable/mover, turf/target, height=1.5, air_group = 0)
if(istype(mover, /obj/item/projectile/web))//Queen Spider webs pass through other spiders
return 1
@@ -167,23 +184,27 @@
standard_damage_overlay_updates()
/mob/living/simple_animal/hostile/giant_spider/update_perception()
if(client)
if(client.darkness_planemaster)
client.darkness_planemaster.blend_mode = BLEND_ADD
client.darkness_planemaster.alpha = 100
client.color = list(
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,-0.1,1,
0,0,0,0)
if(a_matrix_testing_override) // setting to 1 lets you use spiders as a perception-testing mob
client.color = list(a_11,a_12,a_13,a_14,
a_21,a_22,a_23,a_24,
a_31,a_32,a_33,a_34,
a_41,a_42,a_43,a_44,
a_51,a_52,a_53,a_54)
check_dark_vision()
return
if(a_matrix_testing_override)
client.color = list(a_11,a_12,a_13,a_14,
a_21,a_22,a_23,a_24,
a_31,a_32,a_33,a_34,
a_41,a_42,a_43,a_44,
a_51,a_52,a_53,a_54)
if(dark_plane)
if (master_plane)
master_plane.blend_mode = BLEND_ADD
dark_plane.alphas["spider"] = 15 // with the master_plane at BLEND_ADD, shadows appear well lit while actually well lit places appear blinding.
client.color = list(
1,0,0,0,
0,0.2,0,0,
0,0.2,0.2,0,
0,0,-0.1,1,
0,0,0,0)
check_dark_vision()
/mob/living/simple_animal/hostile/giant_spider/regular_hud_updates()
if (!client)

View File

@@ -58,6 +58,8 @@
stop_automated_movement = TRUE //has custom light-related wander movement
wander = FALSE
var/obj/abstract/screen/plane_master/overdark_planemaster/overdark_planemaster
var/obj/abstract/screen/plane_master/overdark_planemaster_target/overdark_target
/datum/grue_calc //used for light-related calculations
var/bright_limit_gain = 1 //maximum brightness on tile for health and power regen
@@ -268,6 +270,17 @@
init_language = default_language
lifestage_updates() //update the grue's sprite and stats according to the current lifestage
overdark_planemaster = new
overdark_planemaster.render_target = "night vision goggles (\ref[src])"
overdark_target = new
overdark_target.render_source = "night vision goggles (\ref[src])"
/mob/living/simple_animal/hostile/grue/Login()
..()
//client.images += light_source_images
client.screen |= overdark_planemaster
client.screen |= overdark_target
/mob/living/simple_animal/hostile/grue/UnarmedAttack(atom/A)
if(isturf(A))
var/turf/T = A
@@ -279,6 +292,7 @@
UnarmedAttack(B)
..()
/mob/living/simple_animal/hostile/grue/proc/get_ddl(var/turf/thisturf) //get the dark_dim_light status of a given turf
var/thisturf_brightness=10*thisturf.get_lumcount()
if(thisturf_brightness<=lightparams.bright_limit_gain)
@@ -368,24 +382,18 @@
//Grue vision
/mob/living/simple_animal/hostile/grue/update_perception()
if(client)
if(client.darkness_planemaster)
client.darkness_planemaster.blend_mode = BLEND_ADD
client.darkness_planemaster.alpha = 255
client.darkness_planemaster.color = list(
1,0,0,0.5,
0,1,0,0.5,
0,0,1,0.5,
0,0,0,1,
0,0,0,1)
if(dark_plane)
if (master_plane)
master_plane.blend_mode = BLEND_ADD
dark_plane.alphas["grue"] = 15 // with the master_plane at BLEND_ADD, shadows appear well lit while actually well lit places appear blinding.
client.color = list(
1,0,0,0,
-1,0.2,0.2,0,
-1,0.2,0.2,0,
0,0,0,1,
0,0,0,0)
1,0,0,0,
-1,0.2,0.2,0,
-1,0.2,0.2,0,
0,0,0,1,
0,0,0,0)
check_dark_vision()
/mob/living/simple_animal/hostile/grue/Stat()
..()
@@ -649,7 +657,7 @@
return FALSE
/mob/living/simple_animal/hostile/grue/proc/drainlight_set() //Set the strength of light drain.
set_light(7 + eatencount, -3 * eatencount, GRUE_BLOOD) //Eating sentients makes the drain more powerful.
set_light(7 + eatencount, -3 * eatencount - 3, GRUE_BLOOD) //Eating sentients makes the drain more powerful.
//Ventcrawling and hiding, only for gruespawn
/mob/living/simple_animal/hostile/grue/proc/ventcrawl()

View File

@@ -72,7 +72,7 @@
client.initialize_darkness_planemaster()
client.initialize_fakecamera_planemaster()
update_perception()
create_lighting_planes()
regular_hud_updates()
update_antag_huds()

View File

@@ -1611,6 +1611,23 @@ Use this proc preferably at the end of an equipment loadout
set hidden = 1
return directionface(SOUTH)
/mob/proc/check_dark_vision()
if (dark_plane && dark_plane.alphas.len)
var/max_alpha = 0
for (var/key in dark_plane.alphas)
max_alpha = max(dark_plane.alphas[key], max_alpha)
animate(dark_plane, alpha = max_alpha, color = dark_plane.colours, time = 10)
else if (dark_plane)
animate(dark_plane, alpha = initial(dark_plane.alpha), color = dark_plane.colours, time = 10)
if (self_vision)
if (isturf(loc))
var/turf/T = loc
if (T.get_lumcount() <= 0 && (dark_plane.alpha <= 15) && (master_plane.blend_mode == BLEND_MULTIPLY))
animate(self_vision, alpha = self_vision.target_alpha, time = 10)
else
animate(self_vision, alpha = 0, time = 10)
//Like forceMove(), but for dirs! used in atoms_movable.dm, mainly with chairs and vehicles
/mob/change_dir(new_dir, var/changer)
INVOKE_EVENT(src, /event/before_move)

View File

@@ -67,9 +67,7 @@
. = ..()
if(.)
return .
var/obj/item/clothing/glasses/scanner/S = is_wearing_item(/obj/item/clothing/glasses/scanner, slot_glasses)
if(S && S.on && S.color_matrix)
return S.color_matrix
var/datum/organ/internal/eyes/eyes = internal_organs_by_name["eyes"]
if(eyes && eyes.colourmatrix.len && !(eyes.robotic))
return eyes.colourmatrix

View File

@@ -1,4 +1,3 @@
/datum/organ/internal/eyes
name = "eyes"
parent_organ = LIMB_HEAD
@@ -10,11 +9,8 @@
var/see_in_dark=2
var/list/colourmatrix = list()
/datum/organ/internal/eyes/proc/init_perception(var/mob/living/carbon/human/M)
return
/datum/organ/internal/eyes/proc/update_perception(var/mob/living/carbon/human/M)
return
M.dark_plane.alphas["human"] = 5
/datum/organ/internal/eyes/process() //Eye damage replaces the old eye_stat var.
if(is_broken())
@@ -28,7 +24,7 @@
removed_type = /obj/item/organ/internal/eyes/tajaran
/datum/organ/internal/eyes/tajaran/update_perception(var/mob/living/carbon/human/M)
M.client.darkness_planemaster.alpha = 100
M.dark_plane.alphas["tajaran"] = 155
/datum/organ/internal/eyes/grey
name = "huge eyes"
@@ -55,7 +51,7 @@
removed_type = /obj/item/organ/internal/eyes/monstrous
/datum/organ/internal/eyes/monstrous/update_perception(var/mob/living/carbon/human/M)
M.client.darkness_planemaster.alpha = 100
M.dark_plane.alphas["monstrous_vision"] = 150
/datum/organ/internal/eyes/mushroom
name = "mushroom eyes"
@@ -65,9 +61,10 @@
/datum/organ/internal/eyes/mushroom/update_perception(var/mob/living/carbon/human/M)
if (dark_mode)
M.client.darkness_planemaster.blend_mode = BLEND_SUBTRACT
M.client.darkness_planemaster.alpha = 100
M.client.darkness_planemaster.color = "#FF0000"
M.master_plane.blend_mode = BLEND_SUBTRACT
M.dark_plane.alphas["mushroom_inverted"] = 100
M.dark_plane.blend_mode = BLEND_MULTIPLY
M.dark_plane.colours = "#FF0000"
M.client.color = list(
1,0,0,0,
0,1,0,0,
@@ -75,9 +72,9 @@
0,-0.1,0,1,
0,0,0,0)
else
M.client.darkness_planemaster.blend_mode = BLEND_MULTIPLY
M.client.darkness_planemaster.alpha = 150
M.client.darkness_planemaster.color = null
M.master_plane.blend_mode = BLEND_MULTIPLY
M.dark_plane.blend_mode = BLEND_ADD
M.dark_plane.colours = null
M.client.color = list(
1,0,0,0,
0,1,0,0,

View File

@@ -7000,10 +7000,10 @@ var/procizine_tolerance = 0
imageloc = M.current.loc
imagelocB = M.current.loc
var/image/I = image('icons/mob/HUD.dmi', loc = imageloc, icon_state = "metaclub")
I.plane = MISC_HUD_MARKERS_PLANE
I.plane = ANTAG_HUD_PLANE
M.current.client.images += I
var/image/J = image('icons/mob/HUD.dmi', loc = imagelocB, icon_state = "metaclub")
J.plane = MISC_HUD_MARKERS_PLANE
J.plane = ANTAG_HUD_PLANE
new_buddy.current.client.images += J
/datum/reagent/ethanol/waifu

View File

@@ -505,8 +505,11 @@
if (mob.see_in_dark_override < 9)
mob.see_in_dark_override = night_vision_strength + 1
if (count == 1)
if (count == 0)
to_chat(mob, "<span class = 'notice'>Your pupils dilate as they adjust for low-light environments.</span>")
else if (count == 6)
to_chat(mob, "<span class = 'notice'>Your pupils reach their maximum dilation.</span>")
mob.see_in_dark_override = 9
else
to_chat(mob, "<span class = 'notice'>Your pupils dilate further.</span>")

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

View File

@@ -1685,6 +1685,8 @@
#include "code\modules\library\computers\base.dm"
#include "code\modules\library\computers\checkout.dm"
#include "code\modules\library\computers\public.dm"
#include "code\modules\lighting\light_mob.dm"
#include "code\modules\lighting\light_planes.dm"
#include "code\modules\lighting\lighting_area.dm"
#include "code\modules\lighting\lighting_atom.dm"
#include "code\modules\lighting\lighting_corner.dm"