Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas mask functionality update #72925

Closed

Conversation

BalthazarArgall
Copy link
Contributor

Summary

Features "Gas masks now allow you to not breathe through a filter at all times"

Purpose of change

  1. Currently, gas masks represent the difficulty of breathing through a filter by having high encumbrance on the mouth. The issue is that this encumbrance is permanent, regardless of the presence of a filter.
  2. The fact that you can activate the gas mask to start breathing through the filter seems to imply that there is a mechanism to force the air flow to come from the filter, which is a thing but then it should also be possible to switch the flow back to not use the filter.

Describe the solution

  1. Mouth encumbrance is a thing only when the character is actively using a mask and breathing through its filter. This doesn't mean there is no mouth encumbrance when this is not the case, you are still wearing an uncomfortable piece of gear in which you are breathing through a valve, but it is highly reduced.
  2. You can turn the masks on and off at will, for stuff like dust masks this could mean the character is pulling it off the mouth and over or under it, for gas masks and respirators this means unplugging a valve through some means.

Describe alternatives you've considered

There's still a few issues, some a bit more abstract than others.

  1. The description is very vague as to what you are actually doing to go from one mode to the other, this is to account for the different types of masks but I could see a complaint about it being so abstract it doesn't mean anything.
  2. I added even more hardcode, now you have to use a hardcoded function to both activate and deactivate them. This is sadly necessary due to the activation using get_base_env_resist() which does stuff like averaging environmental resist values that I'm not sure I should touch.

Testing

Spawned a gas mask and a half face gas mask in game, turned them on and off, tried breathing through a gas field with them on and off. Not super thorough but the changes are so basic I don't think anything could go super wrong, I also didn't touch actual values in the jsons, only functionality and use-actions.

Additional context

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Items: Armor / Clothing Armor and clothing <Enhancement / Feature> New features, or enhancements on existing json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Apr 9, 2024
@Hyperseeker
Copy link
Contributor

Could hardcoded actions be replaced by item transforms here? If I recall correctly, pockets are migrated per transform, so the filter should still be where it's supposed to be, intact and with the expected amount of charges left.

@BalthazarArgall
Copy link
Contributor Author

Could hardcoded actions be replaced by item transforms here? If I recall correctly, pockets are migrated per transform, so the filter should still be where it's supposed to be, intact and with the expected amount of charges left.

Issue is not that the item transforms, it's that while it does indeed transforms at the end of the GASMASK_ACTIVATE before that it does some calculations on the average environmental resistance of other items you're wearing. I may unhardcode this in a later PR (or in this one if there's a demand) but for now we may want to keep this behavior.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 9, 2024
@worm-girl
Copy link
Contributor

I could be wrong, but I don't think this is how gas masks actually work.

IRL I've never had to use one, but my understanding is that a gas mask has a filter cartridge which is sealed. To prepare it, you permanently unseal the filter. You cannot re-seal it, and the filter continually degrades from the time it is open, and should be thrown out after a while regardless of whether you encountered any hazardous gas or particulates because the chemical filters degrade and the mechanical ones get clogged by tiny dust particles.

I don't think standard gas masks have valves to allow for normal, unfiltered breathing. Neither can you just nudge them aside, they're designed to fit very securely to the face and have to be taken off. You could possibly hang it from your neck, but this would take about as long as actually removing it.

A better implementation of gas masks would be to make them simply tick down slowly at all times while activated, and more quickly when they filter harmful gases. There shouldn't be an easy way to simply toggle the breathing pipe.

Gas masks could also use a PAPR system, which is a battery-powered air pump that creates positive pressure and makes breathing through a gas or PBA mask almost as easy as breathing without one. These are standard for firefighters and soldiers, and really should be included in the game.

@DoctorBoomstick
Copy link
Contributor

DoctorBoomstick commented Apr 9, 2024

I could be wrong, but I don't think this is how gas masks actually work.

IRL I've never had to use one, but my understanding is that a gas mask has a filter cartridge which is sealed. To prepare it, you permanently unseal the filter. You cannot re-seal it, and the filter continually degrades from the time it is open, and should be thrown out after a while regardless of whether you encountered any hazardous gas or particulates because the chemical filters degrade and the mechanical ones get clogged by tiny dust particles.

I don't think standard gas masks have valves to allow for normal, unfiltered breathing. Neither can you just nudge them aside, they're designed to fit very securely to the face and have to be taken off. You could possibly hang it from your neck, but this would take about as long as actually removing it.

A better implementation of gas masks would be to make them simply tick down slowly at all times while activated, and more quickly when they filter harmful gases. There shouldn't be an easy way to simply toggle the breathing pipe.

Gas masks could also use a PAPR system, which is a battery-powered air pump that creates positive pressure and makes breathing through a gas or PBA mask almost as easy as breathing without one. These are standard for firefighters and soldiers, and really should be included in the game.

Speaking as somebody who has a hand in collecting and researching this type of equipment, I agree with everything said here.

To my knowledge, no gas mask has the option to switch breathing from a valve with a filter attached to one with nothing screwed in. Indeed, some masks, like the US M50, actively seal off the valves when you take the filters off so you don’t’ accidentally breathe in contaminants while doing a filter swap. The capability to turn off your gas mask is a feature that has no utility within respirators, as the very same effect can be achieved by simply removing the face mask. The closest you could come to stopping breathing through the filter is breaking the seal around the face. I often do this when I’m reenacting chemical warfare troops in full NBC kit and want some easier airflow.

This being said, as Ferry Armadillo points out, once a filter is removed from either its airtight packaging or its blanking plugs, it will start expiring as it filters regular air and whatever is in it. Depending on the air quality and the type of filter, it may take a long time to fully deplete your canister.
The only reason why you need to activate a mask is because we don’t have a way of simulating your carbon layer bonding with random vapours in the air while the filter is unsealed, or your particulate layer becoming clogged. There should still be some level of mouth encumbrance even when a filter isn’t attached. You have a big piece of rubber hanging from your head that gets a nice, terrarium-like biome building within it. It should be much less when you remove the filter, but not gone completely.
I took a shot at reworking our CBRN equipment in #66424, but halted it as we do not have the needed framework to satisfactorily simulate NBC/ CBRN equipment to any acceptable, to me, standards. If it’s helpful, you might take some thoughts/ inspiration from what I sketched out before abandoning the PR.

@BalthazarArgall
Copy link
Contributor Author

BalthazarArgall commented Apr 9, 2024

That's excellent feedback. This leaves me with a few questions as to what the implementation should be though:

  1. While some, although visibly too shallow, research led me to believe you could breathe through a gas mask without filters, since it turns out you can't then maybe the 25-35 mouth encumbrance most gas masks give currently is not enough to represent that, maybe it should be bumped to 60 or more?
  2. My main gripe with current gas masks is that reloading (aka screwing or connecting) the filters to them does nothing on its own meanwhile, from my understanding, this is how you "activate" a gas mask irl. I just have no idea what "activating" a gas mask in CDDA is supposed to represent.
  3. The other big issue is that it's not possible to have gas masks "activate" automatically from my understanding of the technical side, if gas masks are using filters as "ammo" in any way, consuming the ammo will put them in an active: false state and there is no way to automatically put them in an active state from simply reloading. Gas masks, as it stands will always have to be manually activated. I can mess around a bit in c++ but I don't think I'm qualified to make big changes to how reloading itself works. Is there an alternative or something I'm missing here?

@worm-girl
Copy link
Contributor

worm-girl commented Apr 9, 2024

I doubt there's a simple alternative - the current implementation is sort of nonsensical and someone probably would have brought it up to date if it wasn't a big project. As we've seen with duct tape, making stuff into ammo makes it kind of obnoxious to mess with.

It might be possible to change gas masks to have a pocket for a filter. You'd then insert a filter into the pocket and activate the filter to unseal it. It might also be possible to give the activated filter a timer akin to what food uses. Then you'd just have to change the code for smoke/gas absorption to advance that timer. None of that is simple but that would be where I'd begin if I were working on it.

A PAPR system would then be a separate item that could maybe reduce encumbrance from a worn and flagged mask while the PAPR was worn and active. I'm a little murky on how that would work, or if it's possible to apply negative encumbrance in a way that would work with a variety of masks.

One big issue with masks in the game is that taking them off or putting them on takes several seconds, which you obviously can't do in combat, and it would make interacting with the constant gas/smoke stuff really annoying. Given that the enemies that produce these threats often die within seconds of appearing on the screen, I feel like more realistic masks would highlight that there's a mismatch between how the enemies are treated by the game as common throwaways and the amount of faff required to realistically prep and don a mask. That's not directly relevant to updating masks, but it would become an issue once that project was done, I think.

@BalthazarArgall
Copy link
Contributor Author

BalthazarArgall commented Apr 9, 2024

Noted, that's also a direction I was considering for gas masks. As for PAPRs I coincidentally am also working on it but I wanted to update gas masks themselves before fully committing to another item which is just an elaborate version of what I'm working on here.

@BalthazarArgall BalthazarArgall marked this pull request as draft April 9, 2024 22:02
@worm-girl
Copy link
Contributor

Noted, that's also a direction I was considering for gas masks. As for PAPRs I coincidentally am also working on it but I wanted to update gas masks themselves before fully committing to another item which is just an elaborate version of what I'm working on here.

I think encumbrance values should not be changed until PAPRs are implemented, as that could make masks extremely punishing with no way to get around their negative effects despite such a method being common irl. Plus if something stalls out the PAPR implementation, they could be stuck in an unusable state for quite a while.

@DoctorBoomstick
Copy link
Contributor

DoctorBoomstick commented Apr 10, 2024

That's excellent feedback. This leaves me with a few questions as to what the implementation should be though:

  1. While some, although visibly too shallow, research led me to believe you could breathe through a gas mask without filters, since it turns out you can't then maybe the 25-35 mouth encumbrance most gas masks give currently is not enough to represent that, maybe it should be bumped to 60 or more?
  2. My main gripe with current gas masks is that reloading (aka screwing or connecting) the filters to them does nothing on its own meanwhile, from my understanding, this is how you "activate" a gas mask irl. I just have no idea what "activating" a gas mask in CDDA is supposed to represent.
  3. The other big issue is that it's not possible to have gas masks "activate" automatically from my understanding of the technical side, if gas masks are using filters as "ammo" in any way, consuming the ammo will put them in an active: false state and there is no way to automatically put them in an active state from simply reloading. Gas masks, as it stands will always have to be manually activated. I can mess around a bit in c++ but I don't think I'm qualified to make big changes to how reloading itself works. Is there an alternative or something I'm missing here?

I agree with the sentiment that encumbrance numbers shouldn’t be touched until the more fundamental issues are hammered out, not least of which for the issue that we have no metric for calculating that x amount of encumbrance means y in the real world. Some gas masks are better to breathe through than others, and without a filter screwed in, you have an unobstructed passage leading to the outside world, though it’s still quite encumbering. I was wearing a respirator for a span of a few minutes while partaking in elevated physical activity: running, lugging around heavy objects, climbing and dismounting stares, etc., and while not completely debilitated, I was a mess with a filter connected; the inside of the mask was basically completely fogged over, and unscrewing said filter helped to dull the experience considerably, but not too much. For reference, though, this was a roughly 30-degree day, so take that as you will.
As for what activating a gasmask represents in CDDA, I think we’ve established that it’s a quirk of the code in the same vein that airguns not requiring Co2 cartridges or some other power medium are. However, if we had to link it to something, I would assume the character was performing a pressure check on the mask. Essentially, because when you strap on a respirator, it’s still not properly sealed to your skin, the standard procedure is to start by pulling away any loose hair from across your face that could possibly interfere with the mask forming an airtight seal. From there, one should tighten the straps on the respirator (unless you’re using one of those old Soviet ones or western ones that are just a giant hood with a filter canister attached), place your palm tightly over either the empty screw for a filter or the intake section of the filter itself, and take a deep breath while the airway is blocked by your hand. This causes the mask to seal around your face and not leave any gaps through which air not filtered through the canister can enter. On this note, I think it would be quite fun or interesting if facial hair or reasonably long regular hair interfered with using a gasmask. Because hairs will continually remain between the rubber of the facepiece and your skin, it can and will compromise the seal a mask can make. For reference, I’ve got a rather short beard, stubble more than anything, and it still makes getting any positive seal with a gas mask a practically unattainable mission unless I shave.
On to the point made by firry armadillo about possibly having filters need to be unsealed by the player after you put them into a pocket that represents you screwing them into the mask. While it's a somewhat better implementation, it’s still rather abnormal. When sealed in a bag or other packaging, you cannot screw in a filter into your mask. Some filters, indeed quite a few, have a removable rubber plug at the filter intake (where air flows through when you’re using the filter) and a screw-on cap covering the threads that screw into the facepiece. When these items are attached, you'll still not be able to screw in a filter. The best and most realistic way to include or fix filters and respirators is to have filters come in sealed packaging, with the filters themselves having a stockpile of carbon/ filter media. This filter media would start ticking down, like draining car batteries, when you remove the canister from the packaging or rid it of its sealing items. It should drain faster in an area with a large amount of contaminants versus none, but it should tick down regardless. For reference, if I unseal a filter in a clean room, it’s going to expire at a slower rate than if I unseal it while standing behind the exhaust pipe of a running truck. However, whether the filter is on or off the mask makes no difference to how fast it expires.
Obviously, we’re coming now right back around to the inflexibility of the reloading code that prevents this from already being how masks work, but to be honest, that’s how they should be represented if we’re aiming for realism. Also, on the subject of masks becoming a bother to wear or remove when facing cannon fodder enemies, I, personally, don’t see this as a large issue.
In the real world, properly dawning a gasmask is a time-consuming process that, if you’re practiced, can take only a few seconds; however, it will inevitably take time. Having this in the game just represents how impractical it is to take your mask, put it on, take it off again, put it on again, rinse, and repeat. It’s the same for NBC suits; they’re a bitch to put on, and there isn’t much of a way to go around it if you want to make sure that your PPE is going to function as PPE. Indeed, during the Gulf War, when fear of a chemical attack was high, soldiers deployed to the east wore their NBC suits around the clock precisely because it’s impractical to expect to have enough time to dawn equipment while a chemical hazard is rushing and screaming at your face. At that point, it becomes an act of time budgeting from the player’s side to see if removing their equipment is worth the time investment, but there’s something to be said about not encouraging people to take off protective equipment while bumbling through a giant dungeon filled with toxic vomiting monsters or in an area where they suspect such monsters could be.

@worm-girl
Copy link
Contributor

worm-girl commented Apr 10, 2024

Having this in the game just represents how impractical it is to take your mask, put it on, take it off again, put it on again, rinse, and repeat.

I agree but you can't be successful without a mask from the mid to late game unless you're poison immune or a cyborg, and wearing a mask all the time is pretty painful when it comes to stamina recovery. My suggestion for addressing this would be to sharply decrease the spawn rate/random evolution of poison/gas enemies in the general population and make them more concentrated in specific types of areas. This is already how the collapsed tower, fungal fields, and mines work, and it feels pretty reasonable there.

Suggestions off the top of my head would include mass graves and fire-damaged areas for smokers (burnt and partially variants of existing buildings could be added to suggest that something cataclysm-y had happened there prior to the player's arrival), and sewers, graveyards, morgues, subway tunnels, and hospitals for bloated zombies. Because some of these places occur in cities, you'd still occasionally get the gas-emitting zombies joining regular packs in the vicinity, but there would be some give and take, and players who were diligent about scouting could have a chance to realize they'd want to prep for a hazardous environment.

This could also allow gas to be buffed to be more dangerous without feeling constant and oppressive, as if you're not using the tools at your disposal to notice that there's a hospital across the street and you get ambushed by a bloater, that's at least partially your own fault.

On to the point made by firry armadillo about possibly having filters need to be unsealed by the player after you put them into a pocket that represents you screwing them into the mask. While it's a somewhat better implementation, it’s still rather abnormal. When sealed in a bag or other packaging, you cannot screw in a filter into your mask.

Pockets in this game aren't always literally pockets. A magazine well in a gun is a pocket, for instance. The "pocket" would just be the threaded part that the filter screws into, and would not be able to hold anything else.

@DoctorBoomstick
Copy link
Contributor

I agree but you can't be successful without a mask from the mid to late game unless you're poison immune or a cyborg, and wearing a mask all the time is pretty painful when it comes to stamina recovery. My suggestion for addressing this would be to sharply decrease the spawn rate/random evolution of poison/gas enemies in the general population and make them more concentrated in specific types of areas. This is already how the collapsed tower, fungal fields, and mines work, and it feels pretty reasonable there.

I agree that the solution would be to limit toxic or contaminant-producing enemies to certain locations. It would make it more interesting to create locations where wearing NBC equipment would be of utility but would then naturally inhibit how much other, useful equipment you could pack along. Currently, this sort of equipment has no utility in the base game, outside of the collapsed tower and the radioactive NPP (if it’s still a hot zone, I forget), as you can never tell when you might encounter such enemies and have no time to prep.

Pockets in this game aren't always literally pockets. A magazine well in a gun is a pocket, for instance. The "pocket" would just be the threaded part that the filter screws into, and would not be able to hold anything else.

Perhaps I was a dunce, but I interpreted your proposal as taking a sealed filter, screwing it into a mask, and only then unsealing it to activate the filter. This would be somewhat similar to somebody putting on a pair of glasses before they take the glasses out of their case. Please correct me if I’m misinterpreting your meaning.

@IdleSol
Copy link
Contributor

IdleSol commented Apr 10, 2024

Theoretically. If that were my goal. I would make two air inlet channels. The first channel with filter protection, the second without protection. And I would install a mechanical or electronic switch. The use of which would block one of the channels. Mechanics are more reliable, and if you use electronics, you can add automatic switching conditions. (If you go into fiction, automatic detection of hazardous substances).

Also I doubt this would be found in finished products. That's why we are talking about survivalist equipment and, perhaps, experimental or high-tech samples of military equipment.

As a player, I'd rather be able to craft a normal quality item before going looking for something really rare.

And if we talk about implementation in code. We need something like power_draw, but for normal charges. With the ability to specify a condition. And the ability to change this parameter from field parameters.

It could be useful to add new conditions to the enchantment. Works when:

  • something is placed in the pocket of an item with enchantment (+ possibility of condition and restrictions)
  • something with enchantment is placed in a pocket
  • something with enchantment is attached to an item

An enchantment cartridge is placed in a gas mask. It adds gas protection and encumbrance.

@BalthazarArgall
It's probably not relevant anymore:
data/json/items/tool_armor.json 1974

"description": "A full gas mask that covers the face and eyes. Provides excellent protection from smoke, tear gas, and other contaminants. It must be prepared before use. It ",

It???

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 12, 2024
@BalthazarArgall
Copy link
Contributor Author

Tried a few things:

  1. Making cartridges use charges_per_turn: 864 with 100 charges to simulate them going bad over a day but cartridges are magazines and as such don't support this field.
  2. Making cartridges use countdown_interval doesn't produce the result I want as it uses a completely different system to charges and making both interact with each other is a bad idea I think on top of it being hacky af.
  3. Making cartridges consumables...yeah no.

As for gas masks until there is a way to tie activity state with reloading somehow, there is not really any way to improve their behavior. Since their values are also fine, there's nothing to be done atm, I'm closing this.

@BalthazarArgall BalthazarArgall deleted the GasMaskUpdate branch April 15, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Items: Armor / Clothing Armor and clothing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants