From f96f3311ee82467e75c7cef9325a1de19bb21889 Mon Sep 17 00:00:00 2001 From: ihatethisengine <115417687+ihatethisengine@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:27:02 +0300 Subject: [PATCH] NVO no longer can be used with binoculars/optics (#5983) # About the pull request Original NVG wouldn't allow you to use them with binos, but when Morrow introduced helmet optics, for some reason he didn't carry over the limitation. I don't know if it was intended or simply was an oversight. Sadly my revert to NVGs (https://github.com/cmss13-devs/cmss13/pull/4807) didn't go through, but I still believe that I was right about points I brought up in the PR, so I am going to address them bit by bit now. # Explain why it's good for the game Using nightvision with anything that increases your field of view gives an unreasonable advantage which should be limited only to specs and SGs. # Testing Photographs and Procedure
I did test it
# Changelog :cl: ihatethisengine balance: night vision optics no longer can be used with binoculars. /:cl: --------- Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- .../objects/items/devices/helmet_visors.dm | 21 +++++++++++++++++++ code/modules/clothing/head/helmet.dm | 12 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 4d1b38491791..7b61df3291ef 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -238,6 +238,7 @@ on_light = new(attached_helmet) on_light.set_light_on(TRUE) START_PROCESSING(SSobj, src) + RegisterSignal(user, COMSIG_MOB_CHANGE_VIEW, PROC_REF(change_view)) /obj/item/device/helmet_visor/night_vision/deactivate_visor(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user) user.remove_client_color_matrix("nvg_visor", 1 SECONDS) @@ -247,6 +248,7 @@ if(visor_glows) qdel(on_light) UnregisterSignal(user, COMSIG_HUMAN_POST_UPDATE_SIGHT) + UnregisterSignal(user, COMSIG_MOB_CHANGE_VIEW) user.update_sight() STOP_PROCESSING(SSobj, src) @@ -271,6 +273,10 @@ if(!.) return + if(user.client.view > 7) + to_chat(user, SPAN_WARNING("You cannot use [src] while using optics.")) + return FALSE + if(!NVG_VISOR_USAGE(FALSE)) to_chat(user, SPAN_NOTICE("Your [src] is out of power! You'll need to recharge it.")) return FALSE @@ -290,6 +296,21 @@ user.lighting_alpha = lighting_alpha user.sync_lighting_plane_alpha() +/obj/item/device/helmet_visor/night_vision/proc/change_view(mob/user, new_size) + SIGNAL_HANDLER + if(new_size > 7) // cannot use binos with NVO + var/obj/item/clothing/head/helmet/marine/attached_helmet = loc + if(!istype(attached_helmet)) + return + deactivate_visor(attached_helmet, user) + to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet].")) + playsound_client(user.client, toggle_off_sound, null, 75) + attached_helmet.active_visor = null + attached_helmet.update_icon() + var/datum/action/item_action/cycle_helmet_huds/cycle_action = locate() in attached_helmet.actions + if(cycle_action) + cycle_action.set_default_overlay() + #undef NVG_VISOR_USAGE /atom/movable/nvg_light diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 26c92f632ee2..aab882049df8 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -676,6 +676,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( var/list/total_visors = built_in_visors + inserted_visors if(!length(total_visors)) + to_chat(user, SPAN_WARNING("There are no visors to swap to.")) return FALSE if(active_visor) @@ -692,6 +693,11 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( skipped_hud = TRUE continue + if(!next_visor.can_toggle(user)) + iterator++ + skipped_hud = TRUE + continue + active_visor = next_visor toggle_visor(user, visor_to_deactivate, silent = TRUE) // disables the old visor toggle_visor(user) @@ -703,15 +709,19 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( iterator++ for(var/obj/item/device/helmet_visor/new_visor in total_visors) - if(!isnull(GLOB.huds[new_visor.hud_type]?.hudusers[user])) continue + if(!new_visor.can_toggle(user)) + continue + active_visor = new_visor toggle_visor(user) return active_visor + to_chat(user, SPAN_WARNING("There are no visors to swap to currently.")) return FALSE + /datum/action/item_action/cycle_helmet_huds/New(Target, obj/item/holder) . = ..() name = "Cycle helmet HUD"