From b769ffa1ab915b1f2f1ba232efdd2bbb647cd726 Mon Sep 17 00:00:00 2001 From: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com> Date: Mon, 29 Aug 2022 21:57:36 +0200 Subject: [PATCH] Adds Virtual Mobs (#14718) --- aurorastation.dme | 4 + code/__defines/misc.dm | 32 ++++---- .../gamemodes/cult/runes/see_invisible.dm | 8 +- code/game/machinery/wishgranter.dm | 5 +- code/modules/mob/abstract/new_player/login.dm | 2 +- .../modules/mob/abstract/observer/observer.dm | 20 +++-- .../mob/abstract/virtual/_constants.dm | 4 + code/modules/mob/abstract/virtual/base.dm | 69 ++++++++++++++++++ code/modules/mob/abstract/virtual/helpers.dm | 13 ++++ code/modules/mob/abstract/virtual/mob.dm | 22 ++++++ code/modules/mob/death.dm | 6 +- code/modules/mob/living/carbon/alien/life.dm | 24 +++--- code/modules/mob/living/carbon/brain/life.dm | 41 +++++------ code/modules/mob/living/carbon/human/life.dm | 4 +- .../living/carbon/human/species/species.dm | 10 +-- code/modules/mob/living/life.dm | 2 +- code/modules/mob/living/silicon/ai/life.dm | 12 +-- code/modules/mob/living/silicon/robot/life.dm | 38 +++++----- code/modules/mob/login.dm | 2 +- html/changelogs/sound_player.yml | 7 ++ icons/mob/abstract/virtual.dmi | Bin 0 -> 455 bytes 21 files changed, 218 insertions(+), 107 deletions(-) create mode 100644 code/modules/mob/abstract/virtual/_constants.dm create mode 100644 code/modules/mob/abstract/virtual/base.dm create mode 100644 code/modules/mob/abstract/virtual/helpers.dm create mode 100644 code/modules/mob/abstract/virtual/mob.dm create mode 100644 html/changelogs/sound_player.yml create mode 100644 icons/mob/abstract/virtual.dmi diff --git a/aurorastation.dme b/aurorastation.dme index a1bafba9925..ce07676ff1e 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -2138,6 +2138,10 @@ #include "code\modules\mob\abstract\observer\observer.dm" #include "code\modules\mob\abstract\observer\say.dm" #include "code\modules\mob\abstract\unauthed\login.dm" +#include "code\modules\mob\abstract\virtual\_constants.dm" +#include "code\modules\mob\abstract\virtual\base.dm" +#include "code\modules\mob\abstract\virtual\helpers.dm" +#include "code\modules\mob\abstract\virtual\mob.dm" #include "code\modules\mob\language\generic.dm" #include "code\modules\mob\language\language.dm" #include "code\modules\mob\language\monkey.dm" diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index b9da1b915f9..cb8d90597b7 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -11,22 +11,26 @@ #define RUIN_MAP_EDGE_PAD 15 // Invisibility constants. -#define INVISIBILITY_LIGHTING 20 -#define INVISIBILITY_LEVEL_ONE 35 -#define INVISIBILITY_LEVEL_TWO 45 -#define INVISIBILITY_OBSERVER 60 -#define INVISIBILITY_EYE 61 +#define INVISIBILITY_LIGHTING 20 +#define INVISIBILITY_LEVEL_ONE 35 +#define INVISIBILITY_LEVEL_TWO 45 +#define INVISIBILITY_OBSERVER 60 +#define INVISIBILITY_EYE 61 +#define INVISIBILITY_SYSTEM 99 -#define SEE_INVISIBLE_LIVING 25 -#define SEE_INVISIBLE_NOLIGHTING 15 -#define SEE_INVISIBLE_LEVEL_ONE 35 -#define SEE_INVISIBLE_LEVEL_TWO 45 -#define SEE_INVISIBLE_CULT 60 -#define SEE_INVISIBLE_OBSERVER 61 +#define SEE_INVISIBLE_LIVING 25 +#define SEE_INVISIBLE_NOLIGHTING 15 +#define SEE_INVISIBLE_LEVEL_ONE 35 +#define SEE_INVISIBLE_LEVEL_TWO 45 +#define SEE_INVISIBLE_CULT 60 +#define SEE_INVISIBLE_OBSERVER 61 +#define SEE_INVISIBLE_SYSTEM 99 -#define SEE_INVISIBLE_MINIMUM 5 -#define INVISIBILITY_MAXIMUM 100 -#define INVISIBILITY_ABSTRACT 101 // Special invis value that can never be seen by see_invisible. +#define SEE_IN_DARK_DEFAULT 2 + +#define SEE_INVISIBLE_MINIMUM 5 +#define INVISIBILITY_MAXIMUM 100 +#define INVISIBILITY_ABSTRACT 101 // Special invis value that can never be seen by see_invisible. // Some arbitrary defines to be used by self-pruning global lists. (see master_controller) #define PROCESS_KILL 26 // Used to trigger removal from a processing list. diff --git a/code/game/gamemodes/cult/runes/see_invisible.dm b/code/game/gamemodes/cult/runes/see_invisible.dm index 49b2beeb5fe..ef9bfaaa0cb 100644 --- a/code/game/gamemodes/cult/runes/see_invisible.dm +++ b/code/game/gamemodes/cult/runes/see_invisible.dm @@ -7,15 +7,15 @@ if(user.seer == TRUE) user.say("Rash'tla sektath mal'zua! Zasan therium viortia!") to_chat(user, SPAN_WARNING("The world beyond fades from your vision.")) - user.see_invisible = SEE_INVISIBLE_LIVING + user.set_see_invisible(SEE_INVISIBLE_LIVING) user.seer = FALSE - else if(user.see_invisible!=SEE_INVISIBLE_LIVING) + else if(user.see_invisible != SEE_INVISIBLE_LIVING) to_chat(user, SPAN_WARNING("The world beyond flashes your eyes but disappears quickly, as if something is disrupting your vision.")) - user.see_invisible = SEE_INVISIBLE_CULT + user.set_see_invisible(SEE_INVISIBLE_CULT) user.seer = FALSE else user.say("Rash'tla sektath mal'zua! Zasan therium vivira! Itonis al'ra matum!") to_chat(user, SPAN_WARNING("The world beyond opens to your eyes.")) - user.see_invisible = SEE_INVISIBLE_CULT + user.set_see_invisible(SEE_INVISIBLE_CULT) user.seer = TRUE return fizzle(user, A) diff --git a/code/game/machinery/wishgranter.dm b/code/game/machinery/wishgranter.dm index 843ebd89ac7..d90f17becbc 100644 --- a/code/game/machinery/wishgranter.dm +++ b/code/game/machinery/wishgranter.dm @@ -55,8 +55,9 @@ user.mutations.Add(HEAL) if (!(XRAY in user.mutations)) user.mutations.Add(XRAY) - user.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS) - user.see_invisible = SEE_INVISIBLE_LEVEL_TWO + user.set_sight(user.sight|SEE_MOBS|SEE_OBJS|SEE_TURFS) + user.set_see_in_dark(8) + user.set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) to_chat(user, "The walls suddenly disappear.") user.set_species(SPECIES_REVENANT) user.mind.special_role = "Avatar of the Wish Granter" diff --git a/code/modules/mob/abstract/new_player/login.dm b/code/modules/mob/abstract/new_player/login.dm index e68316ac69b..65bcb16f036 100644 --- a/code/modules/mob/abstract/new_player/login.dm +++ b/code/modules/mob/abstract/new_player/login.dm @@ -16,7 +16,7 @@ loc = null my_client = client - sight |= SEE_TURFS + set_sight(sight|SEE_TURFS) player_list |= src client.playtitlemusic() diff --git a/code/modules/mob/abstract/observer/observer.dm b/code/modules/mob/abstract/observer/observer.dm index 7b050c3aed3..09b81bc407e 100644 --- a/code/modules/mob/abstract/observer/observer.dm +++ b/code/modules/mob/abstract/observer/observer.dm @@ -860,7 +860,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set category = "Ghost" ghostvision = !(ghostvision) updateghostsight() - to_chat(usr, "You [(ghostvision?"now":"no longer")] have ghost vision.") + to_chat(usr, "You [(ghostvision ? "now" : "no longer")] have ghost vision.") /mob/abstract/observer/verb/toggle_darkness() set name = "Toggle Darkness" @@ -872,21 +872,19 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp //if they are on a restricted level, then set the ghost vision for them. if(on_restricted_level()) //On the restricted level they have the same sight as the mob - sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS) - see_in_dark = 2 - see_invisible = SEE_INVISIBLE_OBSERVER + set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS)) + set_see_in_dark(2) + set_see_invisible(SEE_INVISIBLE_OBSERVER) else //Outside of the restrcited level, they have enhanced vision - sight |= (SEE_TURFS | SEE_MOBS | SEE_OBJS) - see_in_dark = 100 - see_invisible = SEE_INVISIBLE_LEVEL_TWO + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(100) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) if (!seedarkness) - see_invisible = SEE_INVISIBLE_NOLIGHTING + set_see_invisible(SEE_INVISIBLE_NOLIGHTING) else - see_invisible = SEE_INVISIBLE_OBSERVER - if (!ghostvision) - see_invisible = SEE_INVISIBLE_LIVING + set_see_invisible(ghostvision ? SEE_INVISIBLE_OBSERVER : SEE_INVISIBLE_LIVING) updateghostimages() diff --git a/code/modules/mob/abstract/virtual/_constants.dm b/code/modules/mob/abstract/virtual/_constants.dm new file mode 100644 index 00000000000..e999193fb34 --- /dev/null +++ b/code/modules/mob/abstract/virtual/_constants.dm @@ -0,0 +1,4 @@ +var/global/const/VIRTUAL_ABILITY_NONE = 0 +var/global/const/VIRTUAL_ABILITY_HEAR = 1 +var/global/const/VIRTUAL_ABILITY_SEE = 2 +var/global/const/VIRTUAL_ABILITY_ALL = (~VIRTUAL_ABILITY_NONE) \ No newline at end of file diff --git a/code/modules/mob/abstract/virtual/base.dm b/code/modules/mob/abstract/virtual/base.dm new file mode 100644 index 00000000000..03f5d3ef518 --- /dev/null +++ b/code/modules/mob/abstract/virtual/base.dm @@ -0,0 +1,69 @@ +// +// Virtual Mob +// + +var/global/list/all_virtual_listeners = list() + +/mob/abstract/observer/virtual + icon = 'icons/mob/abstract/virtual.dmi' + invisibility = INVISIBILITY_SYSTEM + see_in_dark = SEE_IN_DARK_DEFAULT + see_invisible = SEE_INVISIBLE_LIVING + sight = SEE_SELF + + virtual_mob = null + no_z_overlay = TRUE + + var/atom/movable/host + var/host_type = /atom/movable + var/abilities = VIRTUAL_ABILITY_HEAR|VIRTUAL_ABILITY_SEE + var/list/broadcast_methods + + var/static/list/overlay_icons + +/mob/abstract/observer/virtual/New(var/location, var/atom/movable/host) + ..() + if(!istype(host, host_type)) + CRASH("Received an unexpected host type. Expected [host_type], was [log_info_line(host)].") + src.host = host + moved_event.register(host, src, /atom/movable/proc/move_to_turf_or_null) + + all_virtual_listeners += src + + update_icon() + +/mob/abstract/observer/virtual/Initialize() + . = ..() + STOP_PROCESSING(SSmob, src) + +/mob/abstract/observer/virtual/Destroy() + moved_event.unregister(host, src, /atom/movable/proc/move_to_turf_or_null) + all_virtual_listeners -= src + host = null + return ..() + +/mob/abstract/observer/virtual/update_icon() + if(!overlay_icons) + overlay_icons = list() + for(var/i_state in icon_states(icon)) + overlay_icons[i_state] = image(icon = icon, icon_state = i_state) + overlays.Cut() + + if(abilities & VIRTUAL_ABILITY_HEAR) + overlays += overlay_icons["hear"] + if(abilities & VIRTUAL_ABILITY_SEE) + overlays += overlay_icons["see"] + +// +// Virtual Mob Creation +// +/atom/movable + var/mob/abstract/observer/virtual/virtual_mob + +/atom/movable/Initialize() + . = ..() + if(shall_have_virtual_mob()) + virtual_mob = new virtual_mob(get_turf(src), src) + +/atom/movable/proc/shall_have_virtual_mob() + return ispath(initial(virtual_mob)) \ No newline at end of file diff --git a/code/modules/mob/abstract/virtual/helpers.dm b/code/modules/mob/abstract/virtual/helpers.dm new file mode 100644 index 00000000000..a0c1bea0858 --- /dev/null +++ b/code/modules/mob/abstract/virtual/helpers.dm @@ -0,0 +1,13 @@ +/proc/mobs_in_range(var/atom/movable/AM) + . = list() + for(var/mob/abstract/observer/virtual/v_mob in range(world.view, get_turf(AM))) + if(ismob(v_mob.host)) + . += v_mob.host + +/proc/clients_in_range(var/atom/movable/AM) + . = list() + for(var/mob/abstract/observer/virtual/v_mob in range(world.view, get_turf(AM))) + if(ismob(v_mob.host)) + var/mob/M = v_mob.host + if(M.client) + . |= M.client \ No newline at end of file diff --git a/code/modules/mob/abstract/virtual/mob.dm b/code/modules/mob/abstract/virtual/mob.dm new file mode 100644 index 00000000000..6d1702750bf --- /dev/null +++ b/code/modules/mob/abstract/virtual/mob.dm @@ -0,0 +1,22 @@ +/mob/abstract/observer/virtual/mob + host_type = /mob + +/mob/abstract/observer/virtual/mob/New(var/location, var/mob/host) + ..() + + sight_set_event.register(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight) + see_invisible_set_event.register(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight) + see_in_dark_set_event.register(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight) + + sync_sight(host) + +/mob/abstract/observer/virtual/mob/Destroy() + sight_set_event.unregister(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight) + see_invisible_set_event.unregister(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight) + see_in_dark_set_event.unregister(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight) + . = ..() + +/mob/abstract/observer/virtual/mob/proc/sync_sight(var/mob/mob_host) + sight = mob_host.sight + see_invisible = mob_host.see_invisible + see_in_dark = mob_host.see_in_dark \ No newline at end of file diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index 50711f142d3..715b2cc9fa6 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -72,9 +72,9 @@ layer = MOB_LAYER - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) drop_r_hand() drop_l_hand() diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index d9afbf40821..b88ce19503d 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -91,24 +91,24 @@ return 1 /mob/living/carbon/alien/handle_regular_hud_updates() - if (!..()) - return//Returns if no client + if(!..()) + return // Returns if no client. - if (stat == 2 || (XRAY in src.mutations)) - sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS) - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO - else if (stat != 2 && is_ventcrawling == 0) - if (species && species.vision_flags) + if(stat == DEAD || (XRAY in src.mutations)) + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) + else if(stat != DEAD && is_ventcrawling == FALSE) + if(species && species.vision_flags) sight = species.vision_flags else - sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS) - see_in_dark = 2 - see_invisible = SEE_INVISIBLE_LIVING + set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS)) + set_see_in_dark(2) + set_see_invisible(SEE_INVISIBLE_LIVING) if (healths) if (stat != DEAD) - switch((health - getHalLoss()) / maxHealth * 100)//Halloss should be factored in here for displaying + switch((health - getHalLoss()) / maxHealth * 100) // Halloss should be factored in here for displaying if(100 to INFINITY) healths.icon_state = "health0" if(80 to 100) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 02016ea63a9..a34a307bee9 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -165,18 +165,14 @@ return 1 /mob/living/carbon/brain/handle_regular_hud_updates() - if (stat == 2 || (XRAY in src.mutations)) - sight |= SEE_TURFS - sight |= SEE_MOBS - sight |= SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO - else if (stat != 2) - sight &= ~SEE_TURFS - sight &= ~SEE_MOBS - sight &= ~SEE_OBJS - see_in_dark = 2 - see_invisible = SEE_INVISIBLE_LIVING + if(stat == DEAD || (XRAY in src.mutations)) + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) + else if(stat != DEAD) + set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS)) + set_see_in_dark(2) + set_see_invisible(SEE_INVISIBLE_LIVING) if (healths) if (stat != 2) @@ -198,18 +194,15 @@ else healths.icon_state = "health7" - if (stat == 2 || (XRAY in src.mutations)) - sight |= SEE_TURFS - sight |= SEE_MOBS - sight |= SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO - else if (stat != 2) - sight &= ~SEE_TURFS - sight &= ~SEE_MOBS - sight &= ~SEE_OBJS - see_in_dark = 2 - see_invisible = SEE_INVISIBLE_LIVING + if(stat == DEAD || (XRAY in src.mutations)) + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) + else if(stat != DEAD) + set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS)) + set_see_in_dark(2) + set_see_invisible(SEE_INVISIBLE_LIVING) + if (client) client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 3279b3300ea..4512031835e 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1352,7 +1352,7 @@ if(viewflags < 0) reset_view(null, 0) else if(viewflags) - sight |= viewflags + set_sight(sight, viewflags) else if(eyeobj) if(eyeobj.owner != src) reset_view(null) @@ -1389,7 +1389,7 @@ if(stat == DEAD) return if(XRAY in mutations) - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) /mob/living/carbon/human/proc/handle_stamina() if (species.stamina == -1) //If species stamina is -1, it has special mechanics which will be handled elsewhere diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index d7f4262caf4..92e7858f8ce 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -510,21 +510,19 @@ H.sight &= ~(H.equipment_vision_flags) H.sight &= ~(vision[1]) else - H.sight |= get_vision_flags(H) - H.sight |= H.equipment_vision_flags - H.sight |= vision[1] + H.set_sight(H.sight|get_vision_flags(H)|H.equipment_vision_flags|vision[1]) if(H.stat == DEAD) return 1 if(!H.druggy) - H.see_in_dark = (H.sight == (SEE_TURFS|SEE_MOBS|SEE_OBJS)) ? 8 : min(darksight + H.equipment_darkness_modifier, 8) + H.set_see_in_dark((H.sight == (SEE_TURFS|SEE_MOBS|SEE_OBJS)) ? 8 : min(darksight + H.equipment_darkness_modifier, 8)) if(H.seer) var/obj/effect/rune/R = locate(/obj/effect/rune) in get_turf(H) if(R && R.type == /datum/rune/see_invisible) - H.see_invisible = SEE_INVISIBLE_CULT + H.set_see_invisible(SEE_INVISIBLE_CULT) if(H.see_invisible != SEE_INVISIBLE_CULT && H.equipment_see_invis) - H.see_invisible = min(H.see_invisible, H.equipment_see_invis) + H.set_see_invisible(min(H.see_invisible, H.equipment_see_invis)) if(H.equipment_tint_total >= TINT_BLIND) H.eye_blind = max(H.eye_blind, 1) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 8be026e8ceb..063c086db5d 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -146,7 +146,7 @@ if(viewflags < 0) reset_view(null, 0) else if(viewflags) - sight |= viewflags + set_sight(viewflags) else if(eyeobj) if(eyeobj.owner != src) reset_view(null) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 772fcc770f6..7d7008940f0 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -147,15 +147,15 @@ if(is_blinded()) update_icon() overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS) - see_in_dark = 0 - see_invisible = SEE_INVISIBLE_LIVING + set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS)) + set_see_in_dark(0) + set_see_invisible(SEE_INVISIBLE_LIVING) else if(stat == DEAD) update_dead_sight() else - sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS) - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LIVING + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LIVING) /mob/living/silicon/ai/proc/is_blinded() var/area/A = get_area(src) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 4d810a3b114..9861d1a5a4e 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -150,30 +150,28 @@ /mob/living/silicon/robot/handle_regular_hud_updates() ..() if(stat == DEAD || (XRAY in mutations) || (sight_mode & BORGXRAY)) - sight |= (SEE_TURFS | SEE_MOBS | SEE_OBJS) - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) else if((sight_mode & BORGMESON) && (sight_mode & BORGTHERM)) - sight |= (SEE_TURFS | SEE_MOBS) - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + set_sight(sight|SEE_TURFS|SEE_MOBS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_NOLIGHTING) else if(sight_mode & BORGMESON) - sight |= SEE_TURFS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + set_sight(sight|SEE_TURFS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_NOLIGHTING) else if(sight_mode & BORGMATERIAL) - sight |= SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_MINIMUM + set_sight(sight|SEE_OBJS) + set_see_in_dark(8) else if(sight_mode & BORGTHERM) - sight |= SEE_MOBS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO - else if(stat != 2) - sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS) - 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 - 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 + set_sight(sight|SEE_MOBS) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LEVEL_TWO) + else if(stat != DEAD) + set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS)) + set_see_in_dark(8) + set_see_invisible(SEE_INVISIBLE_LIVING) switch(sensor_mode) if(SEC_HUD) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 0a17432d35e..bc4b642e745 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -66,7 +66,7 @@ disconnect_time = null next_move = 1 - sight |= SEE_SELF + set_sight(sight|SEE_SELF) disconnect_time = null player_age = client.player_age diff --git a/html/changelogs/sound_player.yml b/html/changelogs/sound_player.yml new file mode 100644 index 00000000000..31880d26bcc --- /dev/null +++ b/html/changelogs/sound_player.yml @@ -0,0 +1,7 @@ +author: SleepyGemmy + +delete-after: True + +changes: + - rscadd: "Adds virtual mobs." + - tweak: "Cleans up sight code to use procs where applicable." \ No newline at end of file diff --git a/icons/mob/abstract/virtual.dmi b/icons/mob/abstract/virtual.dmi new file mode 100644 index 0000000000000000000000000000000000000000..13813bb512eb833c1c5e8b0796ee64f0e89a94e8 GIT binary patch literal 455 zcmV;&0XY7NP)ucQ`&KCc+AzCZIv{M7TlvlPMxx zAejWJ5H!4z8UiZVawb$@N7%9+0TJjBF9CE7@yu14X1;*Pd x08`klf)zk!AQft3DptU`G0J2NB(DlX)*oUD2$-zAgLVJ_002ovPDHLkV1nQ+!CwFX literal 0 HcmV?d00001