diff --git a/code/__DEFINES/lighting.dm b/code/__DEFINES/lighting.dm index c3990cbfb4b..32b4e6059f2 100644 --- a/code/__DEFINES/lighting.dm +++ b/code/__DEFINES/lighting.dm @@ -67,3 +67,8 @@ #define LIGHT_COLOR_SLIME_LAMP "#AFC84B" //Weird color, between yellow and green, very slimy. rgb(175, 200, 75) #define LIGHT_COLOR_TUNGSTEN "#FAE1AF" //Extremely diluted yellow, close to skin color (for some reason). rgb(250, 225, 175) #define LIGHT_COLOR_HALOGEN "#F0FAFA" //Barely visible cyan-ish hue, as the doctor prescribed. rgb(240, 250, 250) + +#define LIGHTING_PLANE_ALPHA_VISIBLE 255 +#define LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE 192 +#define LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE 128 //For lighting alpha, small amounts lead to big changes. even at 128 its hard to figure out what is dark and what is light, at 64 you almost can't even tell. +#define LIGHTING_PLANE_ALPHA_INVISIBLE 0 \ No newline at end of file diff --git a/code/__DEFINES/sight.dm b/code/__DEFINES/sight.dm index 41601f949b0..f6c4d64d0a6 100644 --- a/code/__DEFINES/sight.dm +++ b/code/__DEFINES/sight.dm @@ -1,8 +1,5 @@ - #define SEE_INVISIBLE_MINIMUM 5 -#define SEE_INVISIBLE_NOLIGHTING 15 //to not see the lighting objects. Used for nightvision and observer with darkness toggled. - #define INVISIBILITY_LIGHTING 20 #define SEE_INVISIBLE_LIVING 25 diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index f30c9e05aab..eb6f0aca8a2 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -132,6 +132,7 @@ /mob/proc/create_mob_hud() if(client && !hud_used) hud_used = new /datum/hud(src) + update_sight() //Version denotes which style should be displayed. blank or 0 means "next version" /datum/hud/proc/show_hud(version = 0,mob/viewmob) diff --git a/code/_onclick/hud/plane_master.dm b/code/_onclick/hud/plane_master.dm index 1b510a4f76e..3db20f20996 100644 --- a/code/_onclick/hud/plane_master.dm +++ b/code/_onclick/hud/plane_master.dm @@ -5,10 +5,10 @@ blend_mode = BLEND_OVERLAY var/show_alpha = 255 var/hide_alpha = 0 - + /obj/screen/plane_master/proc/Show(override) alpha = override || show_alpha - + /obj/screen/plane_master/proc/Hide(override) alpha = override || hide_alpha @@ -27,11 +27,6 @@ blend_mode = BLEND_MULTIPLY mouse_opacity = 0 -/obj/screen/plane_master/lighting/proc/params2color(params) - color = params2list(params) -/obj/screen/plane_master/lighting/proc/basecolor() - color = LIGHTING_BASE_MATRIX - /obj/screen/plane_master/parallax name = "parallax plane master" plane = PLANE_SPACE_PARALLAX diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index b88c06cdb93..1fff5c64304 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -339,4 +339,5 @@ SUBSYSTEM_DEF(garbage) #else CHECK_TICK #endif + #endif diff --git a/code/game/gamemodes/blob/blobs/blob_mobs.dm b/code/game/gamemodes/blob/blobs/blob_mobs.dm index 75cb5125250..7a8bc7f517f 100644 --- a/code/game/gamemodes/blob/blobs/blob_mobs.dm +++ b/code/game/gamemodes/blob/blobs/blob_mobs.dm @@ -218,8 +218,8 @@ force_threshold = 10 pressure_resistance = 50 mob_size = MOB_SIZE_LARGE - see_invisible = SEE_INVISIBLE_MINIMUM see_in_dark = 8 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE var/independent = FALSE /mob/living/simple_animal/hostile/blob/blobbernaut/Initialize() diff --git a/code/game/gamemodes/blob/overmind.dm b/code/game/gamemodes/blob/overmind.dm index c36fdcedefd..42e990a9e6a 100644 --- a/code/game/gamemodes/blob/overmind.dm +++ b/code/game/gamemodes/blob/overmind.dm @@ -7,13 +7,12 @@ mouse_opacity = 1 move_on_shuttle = 1 see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM invisibility = INVISIBILITY_OBSERVER layer = FLY_LAYER pass_flags = PASSBLOB faction = list("blob") - + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE var/obj/structure/blob/core/blob_core = null // The blob overmind's core var/blob_points = 0 var/max_blob_points = 100 @@ -21,7 +20,6 @@ var/datum/reagent/blob/blob_reagent_datum = new/datum/reagent/blob() var/list/blob_mobs = list() var/list/resource_blobs = list() - var/ghostimage = null var/free_chem_rerolls = 1 //one free chemical reroll var/nodes_required = 1 //if the blob needs nodes to place resource and factory blobs var/placed = 0 @@ -52,9 +50,6 @@ if(blob_core) blob_core.update_icon() - ghostimage = image(src.icon,src,src.icon_state) - GLOB.ghost_darkness_images |= ghostimage //so ghosts can see the blob cursor when they disable darkness - updateallghostimages() ..() /mob/camera/blob/Life() @@ -82,11 +77,7 @@ BM.overmind = null BM.update_icons() GLOB.overminds -= src - if(ghostimage) - GLOB.ghost_darkness_images -= ghostimage - qdel(ghostimage) - ghostimage = null - updateallghostimages() + return ..() /mob/camera/blob/Login() diff --git a/code/game/gamemodes/clock_cult/clock_items/wraith_spectacles.dm b/code/game/gamemodes/clock_cult/clock_items/wraith_spectacles.dm index 33f536e9b5c..b8c195e3060 100644 --- a/code/game/gamemodes/clock_cult/clock_items/wraith_spectacles.dm +++ b/code/game/gamemodes/clock_cult/clock_items/wraith_spectacles.dm @@ -57,13 +57,13 @@ return TRUE /obj/item/clothing/glasses/wraith_spectacles/proc/set_vision_vars(update_vision) - invis_view = SEE_INVISIBLE_LIVING + lighting_alpha = null tint = 0 vision_flags = NONE darkness_view = 2 if(!up) if(is_servant_of_ratvar(loc)) - invis_view = SEE_INVISIBLE_NOLIGHTING + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE vision_flags = SEE_MOBS | SEE_TURFS | SEE_OBJS darkness_view = 3 else diff --git a/code/game/gamemodes/devil/imp/imp.dm b/code/game/gamemodes/devil/imp/imp.dm index 3698a391e14..602fbf765e9 100644 --- a/code/game/gamemodes/devil/imp/imp.dm +++ b/code/game/gamemodes/devil/imp/imp.dm @@ -30,9 +30,9 @@ melee_damage_lower = 10 melee_damage_upper = 15 see_in_dark = 8 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE var/boost = 0 bloodcrawl = BLOODCRAWL_EAT - see_invisible = SEE_INVISIBLE_MINIMUM var/list/consumed_mobs = list() var/playstyle_string = "You are an imp, a mischevious creature from hell. You are the lowest rank on the hellish totem pole \ Though you are not obligated to help, perhaps by aiding a higher ranking devil, you might just get a promotion. However, you are incapable \ diff --git a/code/game/gamemodes/miniantags/morph/morph.dm b/code/game/gamemodes/miniantags/morph/morph.dm index 26a823e7e50..a4e9d9482ee 100644 --- a/code/game/gamemodes/miniantags/morph/morph.dm +++ b/code/game/gamemodes/miniantags/morph/morph.dm @@ -25,7 +25,7 @@ melee_damage_lower = 20 melee_damage_upper = 20 see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE idle_vision_range = 1 // Only attack when target is close wander = 0 attacktext = "glomps" diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index 0622eb707df..7260d8221f0 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -21,8 +21,9 @@ layer = GHOST_LAYER healable = FALSE sight = SEE_SELF - see_invisible = SEE_INVISIBLE_NOLIGHTING + see_in_dark = 8 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE response_help = "passes through" response_disarm = "swings through" response_harm = "punches through" @@ -57,16 +58,8 @@ var/draining = FALSE //If the revenant is draining someone. var/list/drained_mobs = list() //Cannot harvest the same mob twice var/perfectsouls = 0 //How many perfect, regen-cap increasing souls the revenant has. //TODO, add objective for getting a perfect soul(s?) - var/image/ghostimage = null //Visible to ghost with darkness off var/generated_objectives_and_spells = FALSE -/mob/living/simple_animal/revenant/Initialize() - ..() - - ghostimage = image(src.icon,src,src.icon_state) - GLOB.ghost_darkness_images |= ghostimage - updateallghostimages() - /mob/living/simple_animal/revenant/Login() ..() to_chat(src, "You are a revenant.") @@ -210,8 +203,6 @@ if(!revealed || stat == DEAD) //Revenants cannot die if they aren't revealed //or are already dead return 0 ..(1) - GLOB.ghost_darkness_images -= ghostimage - updateallghostimages() to_chat(src, "NO! No... it's too late, you can feel your essence [pick("breaking apart", "drifting away")]...") notransform = TRUE revealed = TRUE @@ -274,9 +265,6 @@ icon_state = icon_reveal else icon_state = icon_idle - if(ghostimage) - ghostimage.icon_state = src.icon_state - updateallghostimages() /mob/living/simple_animal/revenant/proc/castcheck(essence_cost) if(!src) diff --git a/code/game/gamemodes/miniantags/slaughter/slaughter.dm b/code/game/gamemodes/miniantags/slaughter/slaughter.dm index 355936d9223..c3d06bfe2c5 100644 --- a/code/game/gamemodes/miniantags/slaughter/slaughter.dm +++ b/code/game/gamemodes/miniantags/slaughter/slaughter.dm @@ -32,9 +32,9 @@ melee_damage_lower = 30 melee_damage_upper = 30 see_in_dark = 8 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE var/boost = 0 bloodcrawl = BLOODCRAWL_EAT - see_invisible = SEE_INVISIBLE_MINIMUM var/playstyle_string = "You are a slaughter demon, a terrible creature from another realm. You have a single desire: To kill. \ You may use the \"Blood Crawl\" ability near blood pools to travel through them, appearing and disappearing from the station at will. \ Pulling a dead or unconscious mob while you enter a pool will pull them in with you, allowing you to feast and regain your health. \ diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index 24a4fdcee1a..03633412f01 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -298,7 +298,7 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS prefs.save_preferences() if(isobserver(mob)) var/mob/dead/observer/O = mob - O.updateghostsight() + O.update_sight() /client/verb/toggle_intent_style() set name = "Toggle Intent Selection Style" diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 9ce0d3d80c9..ede686f7661 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -148,7 +148,7 @@ if(pockets.priority) how_cool_are_your_threads += "Your [src]'s storage opens when clicked.\n" else - how_cool_are_your_threads += "Your [src]'s storage opens when dragged to yourself.\n" + how_cool_are_your_threads += "Your [src]'s storage opens when dragged to yourself.\n" how_cool_are_your_threads += "Your [src] can store [pockets.storage_slots] item[pockets.storage_slots > 1 ? "s" : ""].\n" how_cool_are_your_threads += "Your [src] can store items that are [weightclass2text(pockets.max_w_class)] or smaller.\n" if(pockets.quickdraw) @@ -213,6 +213,7 @@ var/darkness_view = 2//Base human is 2 var/invis_view = SEE_INVISIBLE_LIVING var/invis_override = 0 //Override to allow glasses to set higher than normal see_invis + var/lighting_alpha var/emagged = 0 var/list/icon/current = list() //the current hud icons var/vision_correction = 0 //does wearing these glasses correct some of our vision defects? diff --git a/code/modules/clothing/glasses/engine_goggles.dm b/code/modules/clothing/glasses/engine_goggles.dm index cd079db247a..9c6c960448e 100644 --- a/code/modules/clothing/glasses/engine_goggles.dm +++ b/code/modules/clothing/glasses/engine_goggles.dm @@ -24,7 +24,7 @@ STOP_PROCESSING(SSobj, src) vision_flags = SEE_TURFS darkness_view = 1 - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE to_chat(loc, "You toggle the goggles' scanning mode to \[Meson].") invis_update() diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 990949467ad..abe16c9fc25 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -37,7 +37,7 @@ origin_tech = "magnets=1;engineering=2" darkness_view = 2 vision_flags = SEE_TURFS - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE glass_colour_type = /datum/client_colour/glass_colour/lightgreen /obj/item/clothing/glasses/meson/night @@ -47,6 +47,7 @@ item_state = "nvgmeson" origin_tech = "magnets=4;engineering=5;plasmatech=4" darkness_view = 8 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/meson/gar @@ -84,7 +85,7 @@ item_state = "glasses" origin_tech = "materials=4;magnets=4;plasmatech=4;engineering=4" darkness_view = 8 - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/eyepatch @@ -322,7 +323,7 @@ darkness_view = 8 scan_reagents = 1 flags = NODROP - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE /obj/item/clothing/glasses/godeye/attackby(obj/item/weapon/W as obj, mob/user as mob, params) if(istype(W, src) && W != src && W.loc == user) diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 28839fc0291..3c28d1c88df 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -43,7 +43,7 @@ item_state = "glasses" origin_tech = "magnets=4;biotech=4;plasmatech=4;engineering=5" darkness_view = 8 - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/hud/health/sunglasses @@ -71,7 +71,7 @@ item_state = "glasses" origin_tech = "magnets=4;powerstorage=4;plasmatech=4;engineering=5" darkness_view = 8 - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/hud/security @@ -125,7 +125,7 @@ icon_state = "securityhudnight" origin_tech = "magnets=4;combat=4;plasmatech=4;engineering=5" darkness_view = 8 - invis_view = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/hud/security/sunglasses/gars diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 5e95e401ef9..cef87fc57d3 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -195,13 +195,14 @@ /datum/action/innate/minedrone/toggle_meson_vision/Activate() var/mob/living/simple_animal/hostile/mining_drone/user = owner - if(user.sight & SEE_TURFS) user.sight &= ~SEE_TURFS - user.see_invisible = SEE_INVISIBLE_LIVING + user.lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE else user.sight |= SEE_TURFS - user.see_invisible = SEE_INVISIBLE_MINIMUM + user.lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + + user.sync_lighting_plane_alpha() to_chat(user, "You toggle your meson vision [(user.sight & SEE_TURFS) ? "on" : "off"].") diff --git a/code/modules/mob/dead/observer/logout.dm b/code/modules/mob/dead/observer/logout.dm index 5d423d329a7..a941a4beaad 100644 --- a/code/modules/mob/dead/observer/logout.dm +++ b/code/modules/mob/dead/observer/logout.dm @@ -1,6 +1,7 @@ /mob/dead/observer/Logout() if (client) - client.images -= GLOB.ghost_darkness_images + client.images -= (GLOB.ghost_images_default+GLOB.ghost_images_simple) + if(observetarget) if(ismob(observetarget)) var/mob/target = observetarget diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index f3491d24d0d..b1a9e944cf9 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -1,5 +1,3 @@ -GLOBAL_LIST_EMPTY(ghost_darkness_images) //this is a list of images for things ghosts should still be able to see when they toggle darkness, BUT NOT THE GHOSTS THEMSELVES! -GLOBAL_LIST_EMPTY(ghost_images_full) //this is a list of full images of the ghosts themselves GLOBAL_LIST_EMPTY(ghost_images_default) //this is a list of the default (non-accessorized, non-dir) images of the ghosts themselves GLOBAL_LIST_EMPTY(ghost_images_simple) //this is a list of all ghost images as the simple white ghost @@ -27,11 +25,9 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) //Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot. var/atom/movable/following = null var/fun_verbs = 0 - var/image/ghostimage = null //this mobs ghost image, for deleting and stuff var/image/ghostimage_default = null //this mobs ghost image without accessories and dirs var/image/ghostimage_simple = null //this mob with the simple white ghost sprite var/ghostvision = 1 //is the ghost able to see things humans can't? - var/seedarkness = 1 var/mob/observetarget = null //The target mob that the ghost is observing. Used as a reference in logout() var/ghost_hud_enabled = 1 //did this ghost disable the on-screen HUD? var/data_huds_on = 0 //Are data HUDs currently enabled? @@ -65,15 +61,17 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) if(config.cross_allowed) verbs += /mob/dead/observer/proc/server_hop - ghostimage = image(src.icon,src,src.icon_state) if(icon_state in GLOB.ghost_forms_with_directions_list) ghostimage_default = image(src.icon,src,src.icon_state + "_nodir") else ghostimage_default = image(src.icon,src,src.icon_state) - ghostimage_simple = image(src.icon,src,"ghost_nodir") - GLOB.ghost_images_full |= ghostimage + ghostimage_default.override = TRUE GLOB.ghost_images_default |= ghostimage_default + + ghostimage_simple = image(src.icon,src,"ghost_nodir") + ghostimage_simple.override = TRUE GLOB.ghost_images_simple |= ghostimage_simple + updateallghostimages() var/turf/T @@ -137,11 +135,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) animate(src, color = old_color, time = 10) addtimer(CALLBACK(src, /atom/proc/update_atom_colour), 10) -/mob/dead/observer/Destroy() - GLOB.ghost_images_full -= ghostimage - qdel(ghostimage) - ghostimage = null - GLOB.ghost_images_default -= ghostimage_default qdel(ghostimage_default) ghostimage_default = null @@ -170,18 +163,15 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) if(hair_image) cut_overlay(hair_image) - ghostimage.add_overlay(hair_image) hair_image = null if(facial_hair_image) cut_overlay(facial_hair_image) - ghostimage.add_overlay(facial_hair_image) facial_hair_image = null if(new_form) icon_state = new_form - ghostimage.icon_state = new_form if(icon_state in GLOB.ghost_forms_with_directions_list) ghostimage_default.icon_state = new_form + "_nodir" //if this icon has dirs, the default ghostimage must use its nodir version or clients with the preference set to default sprites only will see the dirs else @@ -203,7 +193,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) facial_hair_image.color = "#" + facial_hair_color facial_hair_image.alpha = 200 add_overlay(facial_hair_image) - ghostimage.add_overlay(facial_hair_image) if(hair_style) S = GLOB.hair_styles_list[hair_style] if(S) @@ -212,7 +201,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) hair_image.color = "#" + hair_color hair_image.alpha = 200 add_overlay(hair_image) - ghostimage.add_overlay(hair_image) /* * Increase the brightness of a color by calculating the average distance between the R, G and B values, @@ -510,33 +498,40 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set desc = "Toggles your ability to see things only ghosts can see, like other ghosts" set category = "Ghost" ghostvision = !(ghostvision) - updateghostsight() + update_sight() to_chat(usr, "You [(ghostvision?"now":"no longer")] have ghost vision.") /mob/dead/observer/verb/toggle_darkness() set name = "Toggle Darkness" set category = "Ghost" - seedarkness = !(seedarkness) - updateghostsight() + switch(lighting_alpha) + if (LIGHTING_PLANE_ALPHA_VISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + else + lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE -/mob/dead/observer/proc/updateghostsight() + update_sight() + +/mob/dead/observer/update_sight() if(client) ghost_others = client.prefs.ghost_others //A quick update just in case this setting was changed right before calling the proc - if (seedarkness) - see_invisible = SEE_INVISIBLE_OBSERVER - if (!ghostvision || ghost_others <= GHOST_OTHERS_DEFAULT_SPRITE) - see_invisible = SEE_INVISIBLE_LIVING + if (!ghostvision) + see_invisible = SEE_INVISIBLE_LIVING else - see_invisible = SEE_INVISIBLE_NOLIGHTING + see_invisible = SEE_INVISIBLE_OBSERVER + updateghostimages() + ..() /proc/updateallghostimages() - listclearnulls(GLOB.ghost_images_full) listclearnulls(GLOB.ghost_images_default) listclearnulls(GLOB.ghost_images_simple) - listclearnulls(GLOB.ghost_darkness_images) for (var/mob/dead/observer/O in GLOB.player_list) O.updateghostimages() @@ -547,34 +542,19 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(lastsetting) switch(lastsetting) //checks the setting we last came from, for a little efficiency so we don't try to delete images from the client that it doesn't have anyway - if(GHOST_OTHERS_THEIR_SETTING) - client.images -= GLOB.ghost_images_full if(GHOST_OTHERS_DEFAULT_SPRITE) client.images -= GLOB.ghost_images_default if(GHOST_OTHERS_SIMPLE) client.images -= GLOB.ghost_images_simple - - if ((seedarkness || !ghostvision) && client.prefs.ghost_others == GHOST_OTHERS_THEIR_SETTING) - client.images -= GLOB.ghost_darkness_images - lastsetting = null - else if(ghostvision && (!seedarkness || client.prefs.ghost_others <= GHOST_OTHERS_DEFAULT_SPRITE)) - //add images for the 60inv things ghosts can normally see when darkness is enabled so they can see them now - if(!lastsetting) - client.images |= GLOB.ghost_darkness_images + lastsetting = client.prefs.ghost_others + if(!ghostvision) + return + if(client.prefs.ghost_others != GHOST_OTHERS_THEIR_SETTING) switch(client.prefs.ghost_others) - if(GHOST_OTHERS_THEIR_SETTING) - client.images |= GLOB.ghost_images_full - if (ghostimage) - client.images -= ghostimage //remove ourself if(GHOST_OTHERS_DEFAULT_SPRITE) - client.images |= GLOB.ghost_images_default - if(ghostimage_default) - client.images -= ghostimage_default + client.images |= (GLOB.ghost_images_default-ghostimage_default) if(GHOST_OTHERS_SIMPLE) - client.images |= GLOB.ghost_images_simple - if(ghostimage_simple) - client.images -= ghostimage_simple - lastsetting = client.prefs.ghost_others + client.images |= (GLOB.ghost_images_simple-ghostimage_simple) /mob/dead/observer/verb/possess() set category = "Ghost" @@ -754,11 +734,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp . = ..() switch(var_name) if("icon") - ghostimage.icon = icon ghostimage_default.icon = icon ghostimage_simple.icon = icon if("icon_state") - ghostimage.icon_state = icon_state ghostimage_default.icon_state = icon_state ghostimage_simple.icon_state = icon_state if("fun_verbs") diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index c6d7a103f26..0c2d4866822 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -522,6 +522,7 @@ return sight = initial(sight) + lighting_alpha = initial(lighting_alpha) var/obj/item/organ/eyes/E = getorganslot("eye_sight") if(!E) update_tint() @@ -529,6 +530,8 @@ see_invisible = E.see_invisible see_in_dark = E.see_in_dark sight |= E.sight_flags + if(!isnull(E.lighting_alpha)) + lighting_alpha = E.lighting_alpha if(client.eye != src) var/atom/A = client.eye @@ -543,6 +546,8 @@ see_invisible = G.invis_override else see_invisible = min(G.invis_view, see_invisible) + if(!isnull(G.lighting_alpha)) + lighting_alpha = min(lighting_alpha, G.lighting_alpha) if(dna) for(var/X in dna.mutations) var/datum/mutation/M = X @@ -552,6 +557,7 @@ if(see_override) see_invisible = see_override + . = ..() //to recalculate and update the mob's total tint from tinted equipment it's wearing. diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 889037f7bc8..091800d46a1 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -102,7 +102,7 @@ update_tint() if(G.vision_correction) clear_fullscreen("nearsighted") - if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view) + if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) update_sight() update_inv_glasses() if(slot_gloves) @@ -181,7 +181,7 @@ if(G.vision_correction) if(disabilities & NEARSIGHT) overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) - if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view) + if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) update_sight() update_inv_glasses() else if(I == ears) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 93de6c61c8a..7c26ab2cda0 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -804,9 +804,6 @@ setStaminaLoss(health - 2) update_health_hud() -/mob/proc/update_sight() - return - /mob/living/proc/owns_soul() if(mind) return mind.soulOwner == mind diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 26dca0e327d..8318f2459f9 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -91,6 +91,7 @@ if(see_override) see_invisible = see_override + sync_lighting_plane_alpha() /mob/living/silicon/ai/proc/start_RestorePowerRoutine() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 950cb7a3626..023ddd9719d 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -881,12 +881,12 @@ if(sight_mode & BORGMESON) sight |= SEE_TURFS - see_invisible = min(see_invisible, SEE_INVISIBLE_MINIMUM) + lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE see_in_dark = 1 if(sight_mode & BORGMATERIAL) sight |= SEE_OBJS - see_invisible = min(see_invisible, SEE_INVISIBLE_MINIMUM) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE see_in_dark = 1 if(sight_mode & BORGXRAY) @@ -901,6 +901,7 @@ if(see_override) see_invisible = see_override + sync_lighting_plane_alpha() /mob/living/silicon/robot/update_stat() if(status_flags & GODMODE) diff --git a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm index 56621cc34e3..f7c14f336ac 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm @@ -62,12 +62,23 @@ P.color = namedatum.colour /mob/living/simple_animal/hostile/guardian/ranged/ToggleLight() - if(see_invisible == SEE_INVISIBLE_MINIMUM) - to_chat(src, "You deactivate your night vision.") - see_invisible = SEE_INVISIBLE_LIVING - else - to_chat(src, "You activate your night vision.") - see_invisible = SEE_INVISIBLE_MINIMUM + var/msg + switch(lighting_alpha) + if (LIGHTING_PLANE_ALPHA_VISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + msg = "You activate your night vision." + if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + msg = "You increase your night vision." + if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + msg = "You maximize your night vision." + else + lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + msg = "You deactivate your night vision." + + to_chat(src, "[msg]") + /mob/living/simple_animal/hostile/guardian/ranged/verb/Snare() set name = "Set Surveillance Snare" diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index cfe08df89b8..b2cb16efa23 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -30,7 +30,7 @@ status_flags = CANPUSH minbodytemp = 0 see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE unique_name = 1 gold_core_spawnable = 0 death_sound = 'sound/voice/hiss6.ogg' diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 2d084fffd9a..f8340f016d5 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -47,8 +47,8 @@ attack_sound = 'sound/weapons/bite.ogg' unique_name = 1 gold_core_spawnable = 1 - see_invisible = SEE_INVISIBLE_MINIMUM see_in_dark = 4 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE var/playable_spider = FALSE /mob/living/simple_animal/hostile/poison/giant_spider/Topic(href, href_list) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm index daeb73cc2ab..0afd30e137f 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm @@ -15,7 +15,7 @@ var/throw_message = "bounces off of" var/icon_aggro = null // for swapping to when we get aggressive see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE mob_size = MOB_SIZE_LARGE /mob/living/simple_animal/hostile/asteroid/Aggro() diff --git a/code/modules/mob/living/simple_animal/hostile/skeleton.dm b/code/modules/mob/living/simple_animal/hostile/skeleton.dm index 1df25557ce1..a84f32b2859 100644 --- a/code/modules/mob/living/simple_animal/hostile/skeleton.dm +++ b/code/modules/mob/living/simple_animal/hostile/skeleton.dm @@ -27,8 +27,8 @@ stat_attack = 1 gold_core_spawnable = 1 faction = list("skeleton") - see_invisible = SEE_INVISIBLE_MINIMUM see_in_dark = 8 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE deathmessage = "collapses into a pile of bones!" del_on_death = 1 loot = list(/obj/effect/decal/remains/human) diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm index 9e0b304c63b..455f893a5c1 100644 --- a/code/modules/mob/living/simple_animal/hostile/statue.dm +++ b/code/modules/mob/living/simple_animal/hostile/statue.dm @@ -35,6 +35,7 @@ hud_possible = list(ANTAG_HUD) see_in_dark = 13 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE vision_range = 12 aggro_vision_range = 12 idle_vision_range = 12 @@ -44,9 +45,11 @@ sight = SEE_SELF|SEE_MOBS|SEE_OBJS|SEE_TURFS anchored = 1 + gold_core_spawnable = 1 + var/cannot_be_seen = 1 var/mob/living/creator = null - gold_core_spawnable = 1 + // No movement while seen code. @@ -58,9 +61,6 @@ mob_spell_list += new /obj/effect/proc_holder/spell/aoe_turf/blindness(src) mob_spell_list += new /obj/effect/proc_holder/spell/targeted/night_vision(src) - // Give nightvision - see_invisible = SEE_INVISIBLE_NOLIGHTING - // Set creator if(creator) src.creator = creator @@ -205,15 +205,22 @@ range = -1 include_user = 1 -/obj/effect/proc_holder/spell/targeted/night_vision/cast(list/targets,mob/user = usr) +/obj/effect/proc_holder/spell/targeted/night_vision/cast(list/targets, mob/user = usr) for(var/mob/living/target in targets) - if(!iscarbon(target)) //Carbons should be toggling their vision via organ, this spell is used as a power for simple mobs - if(target.see_invisible == SEE_INVISIBLE_LIVING) - target.see_invisible = SEE_INVISIBLE_NOLIGHTING - name = "Toggle Nightvision \[ON]" - else - target.see_invisible = SEE_INVISIBLE_LIVING + switch(target.lighting_alpha) + if (LIGHTING_PLANE_ALPHA_VISIBLE) + target.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + name = "Toggle Nightvision \[More]" + if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + target.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + name = "Toggle Nightvision \[Full]" + if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) + target.lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE name = "Toggle Nightvision \[OFF]" + else + target.lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + name = "Toggle Nightvision \[ON]" + target.update_sight() /mob/living/simple_animal/hostile/statue/sentience_act() faction -= "neutral" diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 43cd74b5541..8f108e6680f 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -449,6 +449,7 @@ var/atom/A = client.eye if(A.update_remote_sight(src)) //returns 1 if we override all other sight updates. return + sync_lighting_plane_alpha() /mob/living/simple_animal/get_idcard() return access_card diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 01be8584aee..8e2f9adb203 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -923,6 +923,15 @@ /mob/proc/update_health_hud() return +/mob/proc/update_sight() + sync_lighting_plane_alpha() + +/mob/proc/sync_lighting_plane_alpha() + if(hud_used) + var/obj/screen/plane_master/lighting/L = hud_used.plane_masters["[LIGHTING_PLANE]"] + if (L) + L.alpha = lighting_alpha + /mob/living/vv_edit_var(var_name, var_value) switch(var_name) if("stat") @@ -956,6 +965,8 @@ updatehealth() if("resize") update_transform() + if("lighting_alpha") + sync_lighting_plane_alpha() /mob/proc/is_literate() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index cce92825d72..193ea82948e 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -5,6 +5,7 @@ flags = HEAR hud_possible = list(ANTAG_HUD) pressure_resistance = 8 + var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE var/datum/mind/mind var/list/datum/action/actions = list() diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index abff3cf0310..227e72c91c0 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -784,6 +784,7 @@ var/old_eye_color = "fff" var/flash_protect = 0 var/see_invisible = SEE_INVISIBLE_LIVING + var/lighting_alpha /obj/item/organ/eyes/Insert(mob/living/carbon/M, special = 0) ..() @@ -811,26 +812,27 @@ name = "shadow eyes" desc = "A spooky set of eyes that can see in the dark." see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE actions_types = list(/datum/action/item_action/organ_action/use) var/night_vision = TRUE /obj/item/organ/eyes/night_vision/ui_action_click() - if(night_vision) - see_in_dark = 4 - see_invisible = SEE_INVISIBLE_LIVING - night_vision = FALSE - else - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM - night_vision = TRUE + switch(lighting_alpha) + if (LIGHTING_PLANE_ALPHA_VISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) + lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + else + lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE owner.update_sight() /obj/item/organ/eyes/night_vision/alien name = "alien eyes" desc = "It turned out they had them after all!" see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE sight_flags = SEE_MOBS @@ -864,7 +866,7 @@ eye_color = "FC0" origin_tech = "materials=5;programming=4;biotech=4;magnets=4;syndicate=1" sight_flags = SEE_MOBS - see_invisible = SEE_INVISIBLE_MINIMUM + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE flash_protect = -1 see_in_dark = 8