Removes hacky see in darkness invisibility bullshit, uses planes. (#25931)

* Removes hacky see in darkness invisibility bullshit, uses planes.

Also removed the use of invisibility for ghosts of others, instead using override images.

Per client lighting visibility now has 4 levels, all on, all off, and two midways, this allows for things to be able to see in the dark while still being able to see what is dark and what has light, ghosts and aliens and other shit can cycle between all 4, other things were given one of the 3 values depending.

* Remove qdel global var search.

* Cleans up code, makes changing lighting/NV level easier.
This commit is contained in:
Kyle Spier-Swenson
2017-04-11 02:01:24 -07:00
committed by oranges
parent 240b6ab14c
commit 11d504e93a
35 changed files with 142 additions and 144 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -339,4 +339,5 @@ SUBSYSTEM_DEF(garbage)
#else
CHECK_TICK
#endif
#endif

View File

@@ -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()

View File

@@ -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()

View File

@@ -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

View File

@@ -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 = "<B><font size=3 color='red'>You are an imp,</font> 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 \

View File

@@ -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"

View File

@@ -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, "<span class='deadsay'><font size=3><b>You are a revenant.</b></font></span>")
@@ -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, "<span class='revendanger'>NO! No... it's too late, you can feel your essence [pick("breaking apart", "drifting away")]...</span>")
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)

View File

@@ -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 = "<B><font size=3 color='red'>You are a slaughter demon,</font> 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. \

View File

@@ -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"

View File

@@ -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?

View File

@@ -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, "<span class='notice'>You toggle the goggles' scanning mode to \[Meson].</span>")
invis_update()

View File

@@ -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)

View File

@@ -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

View File

@@ -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, "<span class='notice'>You toggle your meson vision [(user.sight & SEE_TURFS) ? "on" : "off"].</span>")

View File

@@ -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

View File

@@ -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")

View File

@@ -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.

View File

@@ -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)

View File

@@ -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

View File

@@ -91,6 +91,7 @@
if(see_override)
see_invisible = see_override
sync_lighting_plane_alpha()
/mob/living/silicon/ai/proc/start_RestorePowerRoutine()

View File

@@ -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)

View File

@@ -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, "<span class='notice'>You deactivate your night vision.</span>")
see_invisible = SEE_INVISIBLE_LIVING
else
to_chat(src, "<span class='notice'>You activate your night vision.</span>")
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, "<span class='notice'>[msg]</span>")
/mob/living/simple_animal/hostile/guardian/ranged/verb/Snare()
set name = "Set Surveillance Snare"

View File

@@ -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'

View File

@@ -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)

View File

@@ -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()

View File

@@ -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)

View File

@@ -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"

View File

@@ -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

View File

@@ -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()

View File

@@ -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()

View File

@@ -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