Improve nightvision code (#66244)

* Add NIGHTVISION_FOV_RANGE define

* Change has_nightvision to use define

* Change see_in_dark to use NIGHTVISION define

* Change see_in_dark to use NIGHTVISION defines

* Change see_in_dark to use NIGHTVISION define

* Change see_in_dark to use NIGHTVISION define

* Change see_in_dark to use NIGHTVISION define

* Change see_in_dark to use NIGHTVISION define

* Change see_in_dark to use NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Change see_in_dark to NIGHTVISION define

* Move has_nightvision() proc location

* Fix spaccing indentation for code comment
This commit is contained in:
Tim
2022-04-18 09:33:32 -04:00
committed by GitHub
parent 794f1477a6
commit 49abc1b02c
19 changed files with 32 additions and 20 deletions
+3
View File
@@ -10,6 +10,9 @@
/// Range at which FOV effects treat nearsightness as blind and play
#define NEARSIGHTNESS_FOV_BLINDNESS 2
/// Range in tiles that a mob can see in the dark (used to determine if a mob has night_vision)
#define NIGHTVISION_FOV_RANGE 8
//Fullscreen overlay resolution in tiles for the clients view.
/// The fullscreen overlay in tiles for x axis
#define FULLSCREEN_OVERLAY_RESOLUTION_X 15
+1 -1
View File
@@ -15,7 +15,7 @@
maxbodytemp = INFINITY
unique_name = 1
combat_mode = TRUE
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
initial_language_holder = /datum/language_holder/empty
retreat_distance = null //! retreat doesn't obey pass_flags, so won't work on blob mobs.
+1 -1
View File
@@ -13,7 +13,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
icon_state = "marker"
mouse_opacity = MOUSE_OPACITY_ICON
move_on_shuttle = 1
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
invisibility = INVISIBILITY_OBSERVER
layer = FLY_LAYER
plane = ABOVE_GAME_PLANE
@@ -15,7 +15,7 @@ the new instance inside the host to be updated to the template's stats.
icon_state = "marker"
mouse_opacity = MOUSE_OPACITY_ICON
move_on_shuttle = FALSE
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
invisibility = INVISIBILITY_OBSERVER
see_invisible = SEE_INVISIBLE_LIVING
layer = BELOW_MOB_LAYER
+1 -1
View File
@@ -20,7 +20,7 @@
obj_damage = 50
melee_damage_lower = 20
melee_damage_upper = 20
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
vision_range = 1 // Only attack when target is close
wander = FALSE
@@ -26,7 +26,7 @@
sight = SEE_SELF
throwforce = 0
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
response_help_continuous = "passes through"
response_help_simple = "pass through"
@@ -35,7 +35,7 @@
obj_damage = 40
melee_damage_lower = 10
melee_damage_upper = 15
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
del_on_death = TRUE
deathmessage = "screams in agony as it sublimates into a sulfurous smoke."
+1 -1
View File
@@ -22,7 +22,7 @@
status_flags = CANSTUN|CANPUSH
combat_mode = TRUE //so we always get pushed instead of trying to swap
sight = SEE_TURFS | SEE_MOBS | SEE_OBJS
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
hud_type = /datum/hud/ai
med_hud = DATA_HUD_MEDICAL_BASIC
sec_hud = DATA_HUD_SECURITY_BASIC
+1 -1
View File
@@ -6,7 +6,7 @@
verb_exclaim = "declares"
verb_yell = "alarms"
initial_language_holder = /datum/language_holder/synthetic
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
bubble_icon = "machine"
mob_biotypes = MOB_ROBOTIC
deathsound = 'sound/voice/borg_deathsound.ogg'
@@ -24,7 +24,7 @@
carp_fluff_string = "<span class='holoparasite'>CARP CARP CARP! Caught one, it's a ranged carp. This fishy can watch people pee in the ocean.</span>"
miner_fluff_string = "<span class='holoparasite'>You encounter... Diamond, a powerful projectile thrower.</span>"
see_invisible = SEE_INVISIBLE_LIVING
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
toggle_button_type = /atom/movable/screen/guardian/toggle_mode
var/list/snares = list()
var/toggle = FALSE
@@ -28,7 +28,7 @@
status_flags = CANPUSH
minbodytemp = 0
unsuitable_heat_damage = 20
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
unique_name = 1
gold_core_spawnable = NO_SPAWN
@@ -44,7 +44,7 @@
unique_name = 1
gold_core_spawnable = HOSTILE_SPAWN
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
footstep_type = FOOTSTEP_MOB_CLAW
///How much of a reagent the mob injects on attack
var/poison_per_bite = 0
@@ -276,7 +276,7 @@
weather_immunities = list(TRAIT_LAVA_IMMUNE, TRAIT_ASHSTORM_IMMUNE)
obj_damage = 30
environment_smash = ENVIRONMENT_SMASH_STRUCTURES
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
@@ -29,7 +29,7 @@
robust_searching = 1
stat_attack = HARD_CRIT
faction = list("skeleton")
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
deathmessage = "collapses into a pile of bones!"
del_on_death = 1
@@ -25,7 +25,7 @@
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
robust_searching = 1
faction = list("hostile")
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
deathmessage = "falls to the ground, its shard dulling to a miserable grey!"
footstep_type = FOOTSTEP_MOB_CLAW
@@ -555,7 +555,7 @@
sight = initial(sight)
else
sight = (SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
see_invisible = SEE_INVISIBLE_OBSERVER
return
@@ -30,7 +30,7 @@
healable = 0
melee_damage_lower = 5
melee_damage_upper = 25
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
verb_say = "blorbles"
verb_ask = "inquisitively blorbles"
+10 -1
View File
@@ -1087,11 +1087,20 @@
if(client.mouse_override_icon)
client.mouse_pointer_icon = client.mouse_override_icon
/**
* Can this mob see in the dark
*
* This checks all traits, glasses, and robotic eyeball implants to see if the mob can see in the dark
* this does NOT check if the mob is missing it's eyeballs. Also see_in_dark is a BYOND mob var (that defaults to 2)
**/
/mob/proc/has_nightvision()
return see_in_dark >= NIGHTVISION_FOV_RANGE
///This mob is abile to read books
/mob/proc/is_literate()
return FALSE
///Can this mob read (is literate and not blind)
/// Can this mob read
/mob/proc/can_read(obj/O)
if(is_blind())
to_chat(src, span_warning("As you are trying to read [O], you suddenly feel very stupid!"))
+3 -3
View File
@@ -108,7 +108,7 @@
/obj/item/organ/eyes/night_vision
name = "shadow eyes"
desc = "A spooky set of eyes that can see in the dark."
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
actions_types = list(/datum/action/item_action/organ_action/use)
var/night_vision = TRUE
@@ -183,7 +183,7 @@
name = "\improper X-ray eyes"
desc = "These cybernetic eyes will give you X-ray vision. Blinking is futile."
eye_color = "000"
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
sight_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS
/obj/item/organ/eyes/robotic/thermals
@@ -193,7 +193,7 @@
sight_flags = SEE_MOBS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
flash_protect = FLASH_PROTECTION_SENSITIVE
see_in_dark = 8
see_in_dark = NIGHTVISION_FOV_RANGE
/obj/item/organ/eyes/robotic/flashlight
name = "flashlight eyes"