From 9e9d72d2ae380e195cc00acda4ab769fa258f57f Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Wed, 24 Apr 2019 00:47:55 +0200 Subject: [PATCH] Darkness fixes --- code/_onclick/hud/fullscreen.dm | 2 +- .../mining/lavaland/loot/tendril_loot.dm | 31 +++++++++++-------- code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/living/carbon/alien/alien.dm | 20 +++++++----- code/modules/mob/living/carbon/carbon.dm | 4 ++- code/modules/mob/living/carbon/human/human.dm | 1 + .../living/carbon/human/species/_species.dm | 3 -- code/modules/mob/living/living.dm | 2 ++ code/modules/mob/living/silicon/ai/ai.dm | 1 + .../modules/mob/living/silicon/robot/robot.dm | 4 ++- code/modules/mob/mob.dm | 1 + 11 files changed, 44 insertions(+), 27 deletions(-) diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index 0a9d0f6b4f0..9d00f216eac 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -48,7 +48,7 @@ var/list/screens = mymob.screens for(var/category in screens) screen = screens[category] - if(screen.should_show_to(src)) + if(screen.should_show_to(mymob)) screen.update_for_view(mymob.client.view) mymob.client.screen |= screen else diff --git a/code/modules/mining/lavaland/loot/tendril_loot.dm b/code/modules/mining/lavaland/loot/tendril_loot.dm index 5a39264e668..bf42a4af0b1 100644 --- a/code/modules/mining/lavaland/loot/tendril_loot.dm +++ b/code/modules/mining/lavaland/loot/tendril_loot.dm @@ -192,6 +192,8 @@ icon_state = "lantern-blue" item_state = "lantern" var/obj/effect/wisp/wisp + var/sight_flags = SEE_MOBS + var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE /obj/item/wisp_lantern/attack_self(mob/user) if(!wisp) @@ -203,26 +205,25 @@ to_chat(user, "You release the wisp. It begins to bob around your head.") icon_state = "lantern" wisp.orbit(user, 20) - user.update_sight() - feedback_add_details("wisp_lantern","F") // freed + RegisterSignal(user, COMSIG_MOB_UPDATE_SIGHT, .proc/update_user_sight) + user.update_sight() + to_chat(user, "The wisp enhances your vision.") + + feedback_add_details("wisp_lantern","F") // freed else to_chat(user, "You return the wisp to the lantern.") - - var/mob/target - if(wisp.orbiting) - target = wisp.orbiting wisp.stop_orbit() wisp.forceMove(src) - if (istype(target)) - target.update_sight() - to_chat(target, "Your vision returns to normal.") + UnregisterSignal(user, COMSIG_MOB_UPDATE_SIGHT) + user.update_sight() + to_chat(user, "Your vision returns to normal.") icon_state = "lantern-blue" feedback_add_details("wisp_lantern","R") // returned -/obj/item/wisp_lantern/Initialize() +/obj/item/wisp_lantern/Initialize(mapload) . = ..() wisp = new(src) @@ -232,7 +233,13 @@ qdel(wisp) else wisp.visible_message("[wisp] has a sad feeling for a moment, then it passes.") - ..() + return ..() + +/obj/item/wisp_lantern/proc/update_user_sight(mob/user) + user.sight |= sight_flags + if(!isnull(lighting_alpha)) + user.lighting_alpha = min(user.lighting_alpha, lighting_alpha) + user.sync_lighting_plane_alpha() /obj/effect/wisp name = "friendly wisp" @@ -241,8 +248,6 @@ icon_state = "orb" light_range = 7 layer = ABOVE_ALL_MOB_LAYER - var/sight_flags = SEE_MOBS - var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE //Red/Blue Cubes /obj/item/warp_cube diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index aaad280cc0d..8d7285ceb4f 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -691,7 +691,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp see_invisible = SEE_INVISIBLE_OBSERVER updateghostimages() - ..() + . = ..() /mob/dead/observer/proc/updateghostsight() if(!seedarkness) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 4d1d91696eb..84bb5af399d 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -5,18 +5,21 @@ icon = 'icons/mob/alien.dmi' gender = NEUTER dna = null - alien_talk_understand = 1 - var/nightvision = 1 + alien_talk_understand = TRUE + + var/nightvision = FALSE + see_in_dark = 4 + var/obj/item/card/id/wear_id = null // Fix for station bounced radios -- Skie - var/has_fine_manipulation = 0 - var/move_delay_add = 0 // movement delay to add + var/has_fine_manipulation = FALSE + var/move_delay_add = FALSE // movement delay to add status_flags = CANPARALYSE|CANPUSH var/heal_rate = 5 - var/large = 0 + var/large = FALSE var/heat_protection = 0.5 - var/leaping = 0 + var/leaping = FALSE ventcrawler = 2 var/list/alien_organs = list() var/death_message = "lets out a waning guttural screech, green blood bubbling from its maw..." @@ -153,7 +156,7 @@ nightvision = TRUE usr.hud_used.nightvisionicon.icon_state = "nightvision1" else if(nightvision) - see_in_dark = 4 + see_in_dark = initial(see_in_dark) lighting_alpha = initial(lighting_alpha) nightvision = FALSE usr.hud_used.nightvisionicon.icon_state = "nightvision0" @@ -298,3 +301,6 @@ Des: Removes all infected images from the alien. if(see_override) see_invisible = see_override + + sync_lighting_plane_alpha() + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index c1941c39a6e..7feebe30766 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1162,4 +1162,6 @@ so that different stomachs can handle things in different ways VB*/ lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE if(see_override) - see_invisible = see_override \ No newline at end of file + see_invisible = see_override + + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index b20776419d2..f094f5611a6 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -551,6 +551,7 @@ return dna.species.update_sight(src) + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) //Added a safety check in case you want to shock a human mob directly through electrocute_act. /mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE) diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index 0b597c17a6f..c24a066f073 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -641,9 +641,6 @@ It'll return null if the organ doesn't correspond, so include null checks when u H.see_invisible = initial(H.see_invisible) H.lighting_alpha = initial(H.lighting_alpha) - if(H.see_in_dark > 2) //Preliminary see_invisible handling as per set_species() in code\modules\mob\living\carbon\human\human.dm. - H.lighting_alpha = min(H.lighting_alpha, LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - if(H.client && H.client.eye != H) var/atom/A = H.client.eye if(A.update_remote_sight(H)) //returns 1 if we override all other sight updates. diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 10fc68d7363..28089468d8c 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1026,3 +1026,5 @@ if(stat == DEAD) grant_death_vision() return + + . = ..() \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 4d4bff42ae7..d339ae12dc6 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1316,3 +1316,4 @@ var/list/ai_verbs_default = list( see_invisible = see_override sync_lighting_plane_alpha() + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index de66b7b737a..8084b358d96 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1424,4 +1424,6 @@ var/list/robot_verbs_default = list( if(see_override) see_invisible = see_override - sync_lighting_plane_alpha() \ No newline at end of file + sync_lighting_plane_alpha() + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) + \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 9fe0e54f800..68cb8703820 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1343,6 +1343,7 @@ var/list/slot_equipment_priority = list( \ return FALSE /mob/proc/update_sight() + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) sync_lighting_plane_alpha() /mob/proc/sync_lighting_plane_alpha()