Merge pull request #8565 from VOREStation/upstream-merge-7383

[MIRROR] Adds Area-Based Meson Obfuscation
This commit is contained in:
Novacat
2020-08-02 02:13:21 -04:00
committed by GitHub
7 changed files with 113 additions and 22 deletions

View File

@@ -1687,6 +1687,26 @@
T.add_blood(src)
. = ..()
// Tries to turn off item-based things that let you see through walls, like mesons.
// Certain stuff like genetic xray vision is allowed to be kept on.
/mob/living/carbon/human/disable_spoiler_vision()
// Glasses.
if(istype(glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/goggles = glasses
if(goggles.active && (goggles.vision_flags & (SEE_TURFS|SEE_OBJS)))
goggles.toggle_active(src)
to_chat(src, span("warning", "Your [goggles.name] have suddenly turned off!"))
// RIGs.
var/obj/item/weapon/rig/rig = get_rig()
if(istype(rig) && rig.visor?.active && rig.visor.vision?.glasses)
var/obj/item/clothing/glasses/rig_goggles = rig.visor.vision.glasses
if(rig_goggles.vision_flags & (SEE_TURFS|SEE_OBJS))
rig.visor.deactivate()
to_chat(src, span("warning", "\The [rig]'s visor has shuddenly deactivated!"))
..()
/mob/living/carbon/human/reduce_cuff_time()
if(istype(gloves, /obj/item/clothing/gloves/gauntlets/rig))
return 2

View File

@@ -1328,6 +1328,11 @@
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default
// Do this early so certain stuff gets turned off before vision is assigned.
var/area/A = get_area(src)
if(A?.no_spoilers)
disable_spoiler_vision()
if(XRAY in mutations)
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8

View File

@@ -1435,3 +1435,8 @@ default behaviour is:
clear_alert("weightless")
else
throw_alert("weightless", /obj/screen/alert/weightless)
// Tries to turn off things that let you see through walls, like mesons.
// Each mob does vision a bit differently so this is just for inheritence and also so overrided procs can make the vision apply instantly if they call `..()`.
/mob/living/proc/disable_spoiler_vision()
handle_vision()

View File

@@ -153,7 +153,13 @@
/mob/living/silicon/robot/handle_regular_hud_updates()
var/fullbright = FALSE
var/seemeson = FALSE
if (src.stat == 2 || (XRAY in mutations) || (src.sight_mode & BORGXRAY))
var/area/A = get_area(src)
if(A?.no_spoilers)
disable_spoiler_vision()
if (src.stat == DEAD || (XRAY in mutations) || (src.sight_mode & BORGXRAY))
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
@@ -187,13 +193,14 @@
src.sight &= ~SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_NOLIGHTING
else if (src.stat != 2)
else if (src.stat != DEAD)
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 8 // see_in_dark means you can FAINTLY see in the dark, humans have a range of 3 or so, tajaran have it at 8
src.see_invisible = SEE_INVISIBLE_LIVING // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness
// has a "invisible" value of 15
plane_holder.set_vis(VIS_FULLBRIGHT,fullbright)
plane_holder.set_vis(VIS_MESONS,seemeson)
..()

View File

@@ -1140,3 +1140,19 @@
if(module_active && istype(module_active,/obj/item/weapon/gripper))
var/obj/item/weapon/gripper/G = module_active
G.drop_item_nm()
/mob/living/silicon/robot/disable_spoiler_vision()
if(sight_mode & (BORGMESON|BORGMATERIAL|BORGXRAY)) // Whyyyyyyyy have seperate defines.
var/i = 0
// Borg inventory code is very . . interesting and as such, unequiping a specific item requires jumping through some (for) loops.
var/current_selection_index = get_selected_module() // Will be 0 if nothing is selected.
for(var/thing in list(module_state_1, module_state_2, module_state_3))
i++
if(istype(thing, /obj/item/borg/sight))
var/obj/item/borg/sight/S = thing
if(S.sight_mode & (BORGMESON|BORGMATERIAL|BORGXRAY))
select_module(i)
uneq_active()
if(current_selection_index) // Select what the player had before if possible.
select_module(current_selection_index)