Skip to content

Commit

Permalink
Helmet Optics Update (#4549)
Browse files Browse the repository at this point in the history
# About the pull request

This PR:

Adds NVG optics

Removes functional tube NVGs from gameplay

Adds a hotkey to cycle optics

Refactors a bunch of backend optic stuff to make it less redundant

Stops helmet destruction, or somehow visors in helmets destruction ???,
from forcing a HUD or effect to stay on

Adds special marine raider optic which gives night vision, medical
readouts, and USCM HUD.

Adds examine text for visors

Adds research publication to advanced medical optic

# Explain why it's good for the game

Optics are awesome!

Better code is good (at least I hope it's better)

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

:cl: Morrow
add: Added NVG optics
add: Added a hotkey to cycle optics
add: Added special marine raider optic
add: Added examine text for optics
add: Added research publication to advanced medical optic
del: Removed functional tube NVGs from gameplay
refactor: Moved some optics code around to make it less redundant
fix: Fixed a bug with duplicate optic actions
fix: Fixed a reported bug where HUDs would stay on forever with
destruction of a helmet
/:cl:
  • Loading branch information
morrowwolf authored Oct 4, 2023
1 parent 597337f commit 766b4ab
Show file tree
Hide file tree
Showing 13 changed files with 321 additions and 75 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@

#define COMSIG_KB_HUMAN_SHOW_HELD_ITEM "keybinding_human_show_held_item"

#define COMSIG_KB_HUMAN_CYCLE_HELMET_HUD "keybinding_human_cycle_helmet_hud"

// Human Inventory Navigation
#define COMSIG_KB_HUMAN_INTERACT_OTHER_HAND "keybinding_human_interact_other_hand"
#define COMSIG_KB_HUMAN_INTERACT_SLOT_BACK "keybinding_human_interact_slot_back"
Expand Down
21 changes: 21 additions & 0 deletions code/datums/keybinding/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,24 @@
if(shown_item && !(shown_item.flags_item & ITEM_ABSTRACT))
shown_item.showoff(human_user)
return TRUE

/datum/keybinding/human/cycle_helmet_hud
hotkey_keys = list("Unbound")
classic_keys = list("Unbound")
name = "cycle_helmet_hud"
full_name = "Cycle Helmet HUD"
keybind_signal = COMSIG_KB_HUMAN_CYCLE_HELMET_HUD

/datum/keybinding/human/cycle_helmet_hud/down(client/user)
. = ..()
if(.)
return

var/mob/living/carbon/human/human_user = user.mob
var/obj/item/clothing/head/helmet/marine/marine_helmet = human_user?.head
var/cycled_hud = marine_helmet?.cycle_huds(human_user)

var/datum/action/item_action/cycle_helmet_huds/cycle_action = locate() in marine_helmet.actions
cycle_action.set_action_overlay(cycled_hud)

return TRUE
12 changes: 0 additions & 12 deletions code/datums/supply_packs/gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,3 @@
containertype = /obj/structure/closet/crate/ammo
containername = "fulton recovery device crate"
group = "Gear"

/datum/supply_packs/nvg
name = "M2 Night Vision Goggles Crate (x3)"
contains = list(
/obj/item/prop/helmetgarb/helmet_nvg,
/obj/item/prop/helmetgarb/helmet_nvg,
/obj/item/prop/helmetgarb/helmet_nvg,
)
cost = 60
containertype = /obj/structure/closet/crate/supply
containername = "M2 Night Vission Goggles Crate"
group = "Gear"
17 changes: 16 additions & 1 deletion code/game/machinery/recharger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
black_market_value = 35
var/obj/item/charging = null
var/percent_charge_complete = 0
var/list/allowed_devices = list(/obj/item/weapon/baton, /obj/item/cell, /obj/item/weapon/gun/energy, /obj/item/device/defibrillator, /obj/item/tool/portadialysis, /obj/item/clothing/suit/auto_cpr, /obj/item/smartgun_battery)
var/list/allowed_devices = list(/obj/item/weapon/baton, /obj/item/cell, /obj/item/weapon/gun/energy, /obj/item/device/defibrillator, /obj/item/tool/portadialysis, /obj/item/clothing/suit/auto_cpr, /obj/item/smartgun_battery, /obj/item/device/helmet_visor/night_vision)

var/charge_amount = 1000

Expand Down Expand Up @@ -181,6 +181,21 @@
update_icon()
return

if(istype(charging, /obj/item/device/helmet_visor/night_vision))
var/obj/item/device/helmet_visor/night_vision/charging_night_vision_visor = charging
if(charging_night_vision_visor.power_cell)
if(!charging_night_vision_visor.power_cell.fully_charged())
charging_night_vision_visor.power_cell.give(charge_amount)
percent_charge_complete = charging_night_vision_visor.power_cell.percent()
update_use_power(USE_POWER_ACTIVE)
update_icon()
return

percent_charge_complete = 100
update_use_power(USE_POWER_IDLE)
update_icon()
return

/* Disable defib recharging
if(istype(charging, /obj/item/device/defibrillator))
var/obj/item/device/defibrillator/D = charging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GLOBAL_LIST_INIT(cm_vending_gear_intelligence_officer, list(
list("SUPPLIES", 0, null, null, null),
list("Power Control Module", 5, /obj/item/circuitboard/apc, null, VENDOR_ITEM_REGULAR),
list("Binoculars", 5, /obj/item/device/binoculars, null, VENDOR_ITEM_REGULAR),
list("M2 Night Vision Goggles", 25, /obj/item/prop/helmetgarb/helmet_nvg, null, VENDOR_ITEM_RECOMMENDED),
list("Night Vision Optic", 25, /obj/item/device/helmet_visor/night_vision, null, VENDOR_ITEM_RECOMMENDED),
list("Data Detector", 5, /obj/item/device/motiondetector/intel, null, VENDOR_ITEM_REGULAR),
list("Intel Radio Encryption Key", 5, /obj/item/device/encryptionkey/intel, null, VENDOR_ITEM_REGULAR),
list("Fire Extinguisher (Portable)", 5, /obj/item/tool/extinguisher/mini, null, VENDOR_ITEM_REGULAR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GLOBAL_LIST_INIT(cm_vending_gear_leader, list(
list("Machete Pouch (Full)", 4, /obj/item/storage/pouch/machete/full, null, VENDOR_ITEM_REGULAR),
list("USCM Radio Telephone Pack", 5, /obj/item/storage/backpack/marine/satchel/rto, null, VENDOR_ITEM_REGULAR),
list("M276 Pattern Combat Toolbelt Rig", 15, /obj/item/storage/belt/gun/utility, null, VENDOR_ITEM_REGULAR),
list("M2 Night Vision Goggles", 20, /obj/item/prop/helmetgarb/helmet_nvg, null, VENDOR_ITEM_RECOMMENDED),
list("Night Vision Optic", 20, /obj/item/device/helmet_visor/night_vision, null, VENDOR_ITEM_RECOMMENDED),

list("UTILITIES", 0, null, null, null),
list("Whistle", 3, /obj/item/device/whistle, null, VENDOR_ITEM_REGULAR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GLOBAL_LIST_INIT(cm_vending_gear_tl, list(
list("M276 Pattern Combat Toolbelt Rig", 15, /obj/item/storage/belt/gun/utility, null, VENDOR_ITEM_REGULAR),
list("Autoinjector Pouch (Full)", 15, /obj/item/storage/pouch/autoinjector/full, null, VENDOR_ITEM_REGULAR),
list("Insulated Gloves", 3, /obj/item/clothing/gloves/yellow, null, VENDOR_ITEM_REGULAR),
list("M2 Night Vision Goggles", 30, /obj/item/prop/helmetgarb/helmet_nvg, null, VENDOR_ITEM_RECOMMENDED),
list("Night Vision Optic", 30, /obj/item/device/helmet_visor/night_vision, null, VENDOR_ITEM_RECOMMENDED),

list("UTILITIES", 0, null, null, null),
list("Binoculars", 5, /obj/item/device/binoculars, null, VENDOR_ITEM_REGULAR),
Expand Down
Loading

0 comments on commit 766b4ab

Please sign in to comment.