Skip to content

Commit

Permalink
NVO no longer can be used with binoculars/optics (#5983)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# 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
(#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
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->

<!-- !! If you are modifying sprites, you **must** include one or more
in-game screenshots or videos of the new sprites. !! -->

<details>
I did test it
</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl: ihatethisengine
balance: night vision optics no longer can be used with binoculars.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
ihatethisengine and Drulikar committed Apr 4, 2024
1 parent 0f92a49 commit f96f331
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
21 changes: 21 additions & 0 deletions code/game/objects/items/devices/helmet_visors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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"
Expand Down

0 comments on commit f96f331

Please sign in to comment.