From 8f71a052a409b00dab725b508d91aca2bd64e211 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sat, 13 Jan 2018 23:25:19 -0500 Subject: [PATCH] VS: Planes shenanigans. Begins 'plane' work, for VS specific things. --- code/__defines/_planes+layers_vr.dm | 5 ++ code/__defines/mobs_vr.dm | 8 +++ code/defines/procs/hud_vr.dm | 60 ------------------- code/modules/alarm/atmosphere_alarm.dm | 4 +- code/modules/alarm/fire_alarm.dm | 4 +- code/modules/clothing/glasses/glasses_vr.dm | 3 +- code/modules/clothing/glasses/hud_vr.dm | 28 ++------- code/modules/mob/living/bot/secbot.dm | 2 +- .../living/carbon/human/human_helpers_vr.dm | 9 +++ .../mob/living/simple_animal/vore/otie.dm | 2 +- code/modules/mob/mob_planes_vr.dm | 6 ++ code/modules/nifsoft/nif.dm | 59 ++++++++---------- code/modules/resleeving/infomorph.dm | 3 - code/modules/resleeving/infomorph_software.dm | 3 + code/modules/vore/resizing/resize_vr.dm | 2 +- vorestation.dme | 4 +- 16 files changed, 74 insertions(+), 128 deletions(-) create mode 100644 code/__defines/_planes+layers_vr.dm create mode 100644 code/__defines/mobs_vr.dm delete mode 100644 code/defines/procs/hud_vr.dm create mode 100644 code/modules/mob/living/carbon/human/human_helpers_vr.dm create mode 100644 code/modules/mob/mob_planes_vr.dm diff --git a/code/__defines/_planes+layers_vr.dm b/code/__defines/_planes+layers_vr.dm new file mode 100644 index 0000000000..93e08f7f13 --- /dev/null +++ b/code/__defines/_planes+layers_vr.dm @@ -0,0 +1,5 @@ +// "Character HUDs", aka HUDs, but not the game's UI. Things like medhuds. +#define PLANE_CH_HEALTH_VR 27 //Hidden healthbar when at full health +#define PLANE_CH_STATUS_R 28 //Right-side status icon +#define PLANE_CH_BACKUP 29 //Backup implant +#define PLANE_CH_VANTAG 30 //Vore Antag hud \ No newline at end of file diff --git a/code/__defines/mobs_vr.dm b/code/__defines/mobs_vr.dm new file mode 100644 index 0000000000..eddf12fd45 --- /dev/null +++ b/code/__defines/mobs_vr.dm @@ -0,0 +1,8 @@ +#undef VIS_COUNT + +#define VIS_CH_STATUS_R 18 +#define VIS_CH_HEALTH_VR 19 +#define VIS_CH_BACKUP 20 +#define VIS_CH_VANTAG 21 + +#define VIS_COUNT 21 \ No newline at end of file diff --git a/code/defines/procs/hud_vr.dm b/code/defines/procs/hud_vr.dm deleted file mode 100644 index 248c862173..0000000000 --- a/code/defines/procs/hud_vr.dm +++ /dev/null @@ -1,60 +0,0 @@ -var/global/list/gen_hud_users = list() // List of all entities using a generic AR shades. -var/global/list/eng_hud_users = list() // List of all entities using a engineer HUD. -var/global/list/sci_hud_users = list() // List of all entities using a science HUD. - -var/global/list/vantag_hud_users = list() // List of all mobs with the VANTAG hud on. - -/proc/broadcast_engineering_hud_message(var/message, var/broadcast_source) - broadcast_hud_message(message, broadcast_source, eng_hud_users, /obj/item/clothing/glasses/omnihud/eng) - -/proc/broadcast_science_hud_message(var/message, var/broadcast_source) - broadcast_hud_message(message, broadcast_source, sci_hud_users, /obj/item/clothing/glasses/omnihud/rnd) - -proc/process_omni_hud(var/mob/M, var/mode, var/mob/Alt) - if(!can_process_hud(M)) - return - - var/datum/arranged_hud_process/P - switch(mode) - if("med") - P = arrange_hud_process(M, Alt, med_hud_users) - if("sec") - P = arrange_hud_process(M, Alt, sec_hud_users) - if("eng") - P = arrange_hud_process(M, Alt, eng_hud_users) - if("sci") - P = arrange_hud_process(M, Alt, sci_hud_users) - if("best") - P = arrange_hud_process(M, Alt, sec_hud_users) - else - P = arrange_hud_process(M, Alt, gen_hud_users) - - for(var/mob/living/carbon/human/guy in P.Mob.in_view(P.Turf)) - if(P.Mob.see_invisible < guy.invisibility) - continue - - P.Client.images += guy.hud_list[ID_HUD] - P.Client.images += guy.hud_list[HEALTH_VR_HUD] - - if(mode == "med") //Medical advanced version - P.Client.images += guy.hud_list[STATUS_R_HUD] - P.Client.images += guy.hud_list[BACKUP_HUD] - if(mode == "sec") //Security advanced version - P.Client.images += guy.hud_list[WANTED_HUD] - if(mode == "best") //Command/omni advanced version - P.Client.images += guy.hud_list[WANTED_HUD] - P.Client.images += guy.hud_list[STATUS_R_HUD] - P.Client.images += guy.hud_list[BACKUP_HUD] - - -proc/process_vantag_hud(var/mob/M) - if(!M.vantag_hud || !can_process_hud(M)) - return - - var/datum/arranged_hud_process/P = arrange_hud_process(M, null, vantag_hud_users) - - for(var/mob/living/carbon/human/guy in P.Mob.in_view(P.Turf)) - if(P.Mob.see_invisible < guy.invisibility) - continue - - P.Client.images += guy.hud_list[VANTAG_HUD] diff --git a/code/modules/alarm/atmosphere_alarm.dm b/code/modules/alarm/atmosphere_alarm.dm index 334429e164..04403ab4a7 100644 --- a/code/modules/alarm/atmosphere_alarm.dm +++ b/code/modules/alarm/atmosphere_alarm.dm @@ -19,8 +19,8 @@ return minor_alarms //VOREStation Add - Alarm for AR glasses -/datum/alarm_handler/atmosphere/on_alarm_change(var/datum/alarm/alarm, var/was_raised) +/*/datum/alarm_handler/atmosphere/on_alarm_change(var/datum/alarm/alarm, var/was_raised) ..() var/atom/source = length(alarm.sources_assoc) ? alarm.sources_assoc[1] : alarm.alarm_area() - broadcast_engineering_hud_message("Alarm in [alarm.origin] [was_raised ? "raised!" : "cleared."]", source) + broadcast_engineering_hud_message("Alarm in [alarm.origin] [was_raised ? "raised!" : "cleared."]", source)*/ //VOREStation Add End \ No newline at end of file diff --git a/code/modules/alarm/fire_alarm.dm b/code/modules/alarm/fire_alarm.dm index 0d2e9767f0..4794d62b5a 100644 --- a/code/modules/alarm/fire_alarm.dm +++ b/code/modules/alarm/fire_alarm.dm @@ -9,7 +9,7 @@ else A.fire_reset() //VOREStation Add - Alarm for AR glasses uses - var/atom/source = length(alarm.sources_assoc) ? alarm.sources_assoc[1] : alarm.alarm_area() - broadcast_engineering_hud_message("Alarm in [alarm.origin] [was_raised ? "raised!" : "cleared."]", source) + /*var/atom/source = length(alarm.sources_assoc) ? alarm.sources_assoc[1] : alarm.alarm_area() + broadcast_engineering_hud_message("Alarm in [alarm.origin] [was_raised ? "raised!" : "cleared."]", source)*/ //VOREStation Add End ..() diff --git a/code/modules/clothing/glasses/glasses_vr.dm b/code/modules/clothing/glasses/glasses_vr.dm index 015310e7f5..e85b40633a 100644 --- a/code/modules/clothing/glasses/glasses_vr.dm +++ b/code/modules/clothing/glasses/glasses_vr.dm @@ -58,4 +58,5 @@ ..() /obj/item/clothing/glasses/sunglasses/sechud/tactical - item_flags = AIRTIGHT \ No newline at end of file + item_flags = AIRTIGHT + body_parts_covered = EYES diff --git a/code/modules/clothing/glasses/hud_vr.dm b/code/modules/clothing/glasses/hud_vr.dm index 680bce4907..0f569e5ab7 100644 --- a/code/modules/clothing/glasses/hud_vr.dm +++ b/code/modules/clothing/glasses/hud_vr.dm @@ -9,15 +9,15 @@ var/datum/nano_module/arscreen var/arscreen_path var/flash_prot = 0 //0 for none, 1 for flash weapon protection, 2 for welder protection + enables_planes = list(VIS_CH_ID,VIS_CH_HEALTH_VR) + plane_slots = list(slot_glasses) /obj/item/clothing/glasses/omnihud/New() ..() - src.hud = new/obj/item/clothing/glasses/hud/omni(src) if(arscreen_path) arscreen = new arscreen_path(src) /obj/item/clothing/glasses/omnihud/Destroy() - qdel_null(hud) qdel_null(arscreen) . = ..() @@ -27,12 +27,9 @@ ..() /obj/item/clothing/glasses/omnihud/emp_act(var/severity) - var/disconnect_hud = hud var/disconnect_ar = arscreen - hud = null arscreen = null spawn(20 SECONDS) - hud = disconnect_hud arscreen = disconnect_ar ..() @@ -75,6 +72,7 @@ mode = "med" action_button_name = "AR Console (Crew Monitor)" arscreen_path = /datum/nano_module/crew_monitor + enables_planes = list(VIS_CH_ID,VIS_CH_HEALTH_VR,VIS_CH_STATUS_R,VIS_CH_BACKUP) ar_interact(var/mob/living/carbon/human/user) if(arscreen) @@ -89,6 +87,7 @@ flash_protection = FLASH_PROTECTION_MAJOR action_button_name = "AR Console (Security Alerts)" arscreen_path = /datum/nano_module/alarm_monitor/security + enables_planes = list(VIS_CH_ID,VIS_CH_HEALTH_VR,VIS_CH_WANTED) ar_interact(var/mob/living/carbon/human/user) if(arscreen) @@ -161,21 +160,4 @@ These have been upgraded with every feature the lesser models have. Now we're talkin'." mode = "best" flash_protection = FLASH_PROTECTION_MAJOR - -/obj/item/clothing/glasses/hud/omni - name = "internal omni hud" - desc = "You shouldn't see this. This is an internal item for glasses." - var/obj/item/clothing/glasses/omnihud/shades = null - - vision_flags = SEE_MOBS - see_invisible = SEE_INVISIBLE_NOLIGHTING - - New() - ..() - if(istype(loc,/obj/item/clothing/glasses/omnihud)) - shades = loc - else - qdel(src) - -/obj/item/clothing/glasses/hud/omni/process_hud(var/mob/M) - process_omni_hud(M,shades.mode) + enables_planes = list(VIS_CH_ID,VIS_CH_HEALTH_VR,VIS_CH_STATUS_R,VIS_CH_BACKUP,VIS_CH_WANTED) diff --git a/code/modules/mob/living/bot/secbot.dm b/code/modules/mob/living/bot/secbot.dm index 843e83d9c0..cb3f784a77 100644 --- a/code/modules/mob/living/bot/secbot.dm +++ b/code/modules/mob/living/bot/secbot.dm @@ -39,7 +39,7 @@ var/mob/living/L = pulledby UnarmedAttack(L) say("Do not interfere with active law enforcement routines!") - broadcast_security_hud_message("[src] was interfered with in [get_area(src)], activating defense routines.", src) + global_announcer.autosay("[src] was interfered with in [get_area(src)], activating defense routines.", "[src]", "Security") //VOREStation Add End /mob/living/bot/secbot/beepsky name = "Officer Beepsky" diff --git a/code/modules/mob/living/carbon/human/human_helpers_vr.dm b/code/modules/mob/living/carbon/human/human_helpers_vr.dm new file mode 100644 index 0000000000..b8e9d75b30 --- /dev/null +++ b/code/modules/mob/living/carbon/human/human_helpers_vr.dm @@ -0,0 +1,9 @@ +var/static/icon/ingame_hud_vr = icon('icons/mob/hud_vr.dmi') +var/static/icon/ingame_hud_med_vr = icon('icons/mob/hud_med_vr.dmi') + +/mob/living/carbon/human/make_hud_overlays() + . = ..() + hud_list[HEALTH_VR_HUD] = gen_hud_image(ingame_hud_med_vr, src, "100", plane = PLANE_CH_HEALTH_VR) + hud_list[STATUS_R_HUD] = gen_hud_image(ingame_hud_vr, src, plane = PLANE_CH_STATUS_R) + hud_list[BACKUP_HUD] = gen_hud_image(ingame_hud_vr, src, plane = PLANE_CH_BACKUP) + hud_list[VANTAG_HUD] = gen_hud_image(ingame_hud_vr, src, plane = PLANE_CH_VANTAG) diff --git a/code/modules/mob/living/simple_animal/vore/otie.dm b/code/modules/mob/living/simple_animal/vore/otie.dm index b309e57211..36ed6bdbc9 100644 --- a/code/modules/mob/living/simple_animal/vore/otie.dm +++ b/code/modules/mob/living/simple_animal/vore/otie.dm @@ -213,7 +213,7 @@ last_target_time = world.time return M if(check_threat(M) >= 4) - broadcast_security_hud_message("[src] is attempting to 'detain' suspect [target_name(M)] in [get_area(src)].", src) + global_announcer.autosay("[src] is attempting to 'detain' suspect [target_name(M)] in [get_area(src)].", "[src]", "Security") else if(investigates) spawn(1) WanderTowards(seen) diff --git a/code/modules/mob/mob_planes_vr.dm b/code/modules/mob/mob_planes_vr.dm new file mode 100644 index 0000000000..04517b4eb3 --- /dev/null +++ b/code/modules/mob/mob_planes_vr.dm @@ -0,0 +1,6 @@ +/datum/plane_holder/New(mob/this_guy) + ..() + plane_masters[VIS_CH_STATUS_R] = new /obj/screen/plane_master{plane = PLANE_CH_STATUS_R} //Right-side status icon + plane_masters[VIS_CH_HEALTH_VR] = new /obj/screen/plane_master{plane = PLANE_CH_HEALTH_VR} //Health bar but transparent at 100 + plane_masters[VIS_CH_BACKUP] = new /obj/screen/plane_master{plane = PLANE_CH_BACKUP} //Backup implant status + plane_masters[VIS_CH_VANTAG] = new /obj/screen/plane_master{plane = PLANE_CH_VANTAG} //Vore Antags \ No newline at end of file diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm index 8d4c320c8f..be23fac4fb 100644 --- a/code/modules/nifsoft/nif.dm +++ b/code/modules/nifsoft/nif.dm @@ -42,7 +42,6 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable var/tmp/install_done // Time when install will finish var/tmp/open = FALSE // If it's open for maintenance (1-3) - var/obj/item/clothing/glasses/hud/nif_hud/nif_hud // The AR ones require this var/obj/item/device/communicator/commlink/comm // The commlink requires this var/global/icon/big_icon @@ -58,6 +57,8 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable var/list/save_data + var/list/planes_visible = list() + //Constructor comes with a free AR HUD /obj/item/device/nif/New(var/newloc,var/wear,var/list/load_data) ..(newloc) @@ -66,9 +67,6 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable if(!big_icon) big_icon = new(icon,icon_state = "nif_full") - //Required for AR stuff. - nif_hud = new(src) - //Put loaded data here if we loaded any save_data = islist(load_data) ? load_data.Copy() : list() @@ -101,7 +99,6 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable human.nif = null human = null qdel_null_list(nifsofts) - qdel_null(nif_hud) qdel_null(comm) nifsofts_life.Cut() return ..() @@ -294,11 +291,12 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable //Perform our passive drain if(!use_charge(power_usage)) stat = NIF_POWFAIL + update_vision() notify("Insufficient energy!",TRUE) return FALSE //HUD update! - nif_hud.process_hud(human,1) + //nif_hud.process_hud(human,1) //TODO VIS //Process all the ones that want that for(var/S in nifsofts_life) @@ -310,6 +308,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable return FALSE else stat = NIF_WORKING + update_vision() notify("System Reboot Complete.") if(NIF_TEMPFAIL) @@ -466,6 +465,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable switch(hint) if(NIF_FLAGS_VISION) vision_flags |= flag + update_vision() if(NIF_FLAGS_HEALTH) health_flags |= flag if(NIF_FLAGS_COMBAT) @@ -482,6 +482,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable switch(hint) if(NIF_FLAGS_VISION) vision_flags &= ~flag + update_vision() if(NIF_FLAGS_HEALTH) health_flags &= ~flag if(NIF_FLAGS_COMBAT) @@ -524,35 +525,27 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable return result -/////////////////////////////////////////////////////////////////////////////////////// -//NIF HUD object becasue HUD handling is trash and should be rewritten -/obj/item/clothing/glasses/hud/nif_hud/var/obj/item/device/nif/nif +/obj/item/device/nif/proc/update_vision() + if(stat != NIF_WORKING) + planes_visible.Cut() -/obj/item/clothing/glasses/hud/nif_hud/New(var/newloc) - ..(newloc) - nif = newloc + else if(NIF_V_AR_OMNI & vision_flags) + planes_visible = list(VIS_CH_ID,VIS_CH_HEALTH_VR,VIS_CH_STATUS_R,VIS_CH_BACKUP,VIS_CH_WANTED) + else if(NIF_V_AR_SECURITY & vision_flags) + planes_visible = list(VIS_CH_ID,VIS_CH_HEALTH_VR,VIS_CH_WANTED) + else if(NIF_V_AR_MEDICAL & vision_flags) + planes_visible = list(VIS_CH_ID,VIS_CH_HEALTH_VR,VIS_CH_STATUS_R,VIS_CH_BACKUP) + else if(NIF_V_AR_ENGINE & vision_flags) + planes_visible = list(VIS_CH_ID,VIS_CH_HEALTH_VR) + else if(NIF_V_AR_SCIENCE & vision_flags) + planes_visible = list(VIS_CH_ID,VIS_CH_HEALTH_VR) + else if(NIF_V_AR_CIVILIAN & vision_flags) + planes_visible = list(VIS_CH_ID,VIS_CH_HEALTH_VR) + else + planes_visible = list() -/obj/item/clothing/glasses/hud/nif_hud/Destroy() - if(nif) - nif.nif_hud = null - nif = null - return ..() - -/obj/item/clothing/glasses/hud/nif_hud/process_hud(M,var/thing) - //Faster checking with local var, and this is called often so I want fast. - var/visflags = nif.vision_flags - if(NIF_V_AR_OMNI & visflags) - process_omni_hud(nif.human, "best") - else if(NIF_V_AR_SECURITY & visflags) - process_omni_hud(nif.human, "sec") - else if(NIF_V_AR_MEDICAL & visflags) - process_omni_hud(nif.human, "med") - else if(NIF_V_AR_ENGINE & visflags) - process_omni_hud(nif.human, "eng") - else if(NIF_V_AR_SCIENCE & visflags) - process_omni_hud(nif.human, "sci") - else if(NIF_V_AR_CIVILIAN & visflags) - process_omni_hud(nif.human, "civ") + if(human) + human.recalculate_vis() // Alternate NIFs /obj/item/device/nif/bad diff --git a/code/modules/resleeving/infomorph.dm b/code/modules/resleeving/infomorph.dm index 182e05768f..89f3a7e41e 100644 --- a/code/modules/resleeving/infomorph.dm +++ b/code/modules/resleeving/infomorph.dm @@ -590,9 +590,6 @@ var/global/list/default_infomorph_software = list() //Wipe all the huds, then readd them (of course...) handle_regular_hud_updates() - if(src.arHUD == 1) - process_omni_hud(src, "civ") - //In response to EMPs, we can be silenced if(silence_time) if(world.timeofday >= silence_time) diff --git a/code/modules/resleeving/infomorph_software.dm b/code/modules/resleeving/infomorph_software.dm index 7143a24e33..e978b0729d 100644 --- a/code/modules/resleeving/infomorph_software.dm +++ b/code/modules/resleeving/infomorph_software.dm @@ -284,6 +284,9 @@ toggle(mob/living/silicon/infomorph/user) user.arHUD = !user.arHUD + if(user.plane_holder) + user.plane_holder.set_vis(VIS_CH_ID,user.arHUD) + user.plane_holder.set_vis(VIS_CH_HEALTH_VR,user.arHUD) is_active(mob/living/silicon/infomorph/user) return user.arHUD diff --git a/code/modules/vore/resizing/resize_vr.dm b/code/modules/vore/resizing/resize_vr.dm index 199ce8c7bf..d7f312ce09 100644 --- a/code/modules/vore/resizing/resize_vr.dm +++ b/code/modules/vore/resizing/resize_vr.dm @@ -76,7 +76,7 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2 if(..()) return 1 var/new_y_offset = 32 * (size_multiplier - 1) for(var/I in hud_list) - var/image/hud_overlay/HI = I + var/image/HI = I HI.pixel_y = new_y_offset // Optimize mannequins - never a point to animating or doing HUDs on these. diff --git a/vorestation.dme b/vorestation.dme index c44622a70c..1fc2490eaa 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -45,6 +45,7 @@ #include "code\__defines\misc.dm" #include "code\__defines\misc_vr.dm" #include "code\__defines\mobs.dm" +#include "code\__defines\mobs_vr.dm" #include "code\__defines\nifsoft.dm" #include "code\__defines\planets.dm" #include "code\__defines\process_scheduler.dm" @@ -354,7 +355,6 @@ #include "code\defines\procs\announce.dm" #include "code\defines\procs\AStar.dm" #include "code\defines\procs\dbcore.dm" -#include "code\defines\procs\hud_vr.dm" #include "code\defines\procs\radio.dm" #include "code\defines\procs\sd_Alert.dm" #include "code\defines\procs\statistics.dm" @@ -1797,6 +1797,7 @@ #include "code\modules\mob\mob_helpers.dm" #include "code\modules\mob\mob_movement.dm" #include "code\modules\mob\mob_planes.dm" +#include "code\modules\mob\mob_planes_vr.dm" #include "code\modules\mob\mob_transformation_simple.dm" #include "code\modules\mob\say.dm" #include "code\modules\mob\say_vr.dm" @@ -1907,6 +1908,7 @@ #include "code\modules\mob\living\carbon\human\human_defines.dm" #include "code\modules\mob\living\carbon\human\human_defines_vr.dm" #include "code\modules\mob\living\carbon\human\human_helpers.dm" +#include "code\modules\mob\living\carbon\human\human_helpers_vr.dm" #include "code\modules\mob\living\carbon\human\human_movement.dm" #include "code\modules\mob\living\carbon\human\human_organs.dm" #include "code\modules\mob\living\carbon\human\human_powers.dm"