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

Food irradiator #28669

Merged
merged 46 commits into from Apr 20, 2019
Merged

Food irradiator #28669

merged 46 commits into from Apr 20, 2019

Conversation

nexusmrsep
Copy link
Contributor

@nexusmrsep nexusmrsep commented Mar 12, 2019

Summary

SUMMARY: Features "Adds food irradiator computer console and location"

Purpose of change

This feature dates back to #24145
Generally we have irradiated food (food preserved by applying radiation until bacteria die), but we don't have any actual way to irradiate food.

Describe the solution

This adds infrastructure to code-in a computer console in new map locations with option to irradiate items, especially food. It's based around real life radiation processing plants/factories. Conveyor belts move food to the radiation platform where radiation source irradiated the food, and then it is moved back into unloading bay. I tried to simulate this process (with some twists for !!fun!!) by adding subsequent functions to the computer console.

[EDIT] Also per request I've built a fully functional facility overmap location with many fun features.

Features:

  • converts food to it's irradiated version (if such exists)
  • spews radiation in the process
  • added sub-feature: Geiger counter option to measure radiation on radiation platform and at player's tile
  • added sub-feature: conveyor belt's loading and unloading bay item cycling via console options, to operate loading/unloading items on the platform without getting close to the radiation source
  • added sub-feature: toggle reinforced glass shutters - beside visual effect of allowing to inspect the radiation chamber, closed shutters block line of sight during radiation cycle, and protect user from direct exposure to radiation
  • added some !!fun!! for those who would want to irradiate some certain radioactive items available in game
  • added sub-feature: ability to remove radiation source from irradiator
  • [EDIT] added sub-feature: power management computer (shock vent disabler)
  • [EDIT] added sub-feature: industrial ID card & industrial card reader

SIDE-QUESTS [extras I did that enhance the overall effect]:

  • updated translate_radius() function/method to have toggle_between option that switches between two types of terrain (before it only went 1->2, now it optionally does both: 1->2 & 2->1 simultaneously) useful in shutters functions where it toggle between both states (open/closed) via a single computer option
  • fixed mininuke timer to say exactly that your input is in turns (no more guessing) - also the confirmation comes textified for ex. "You set the timer to 5 minutes" Much more convenient feedback.
  • in Geiger counters I named the number provided using real world unit miliSieverts/hour = mSv/h for ground radiation and mSv for body dose taken. For example radiation badge turns black at 500 mSv. I was wondering if this unit corresponds well to what happens in the game, but according to my little research, it would suffice.

Reference via Wikipedia:

  • 500 | mSv: | the U.S. 10 C.F.R. § 20.1201(a)(2)(ii) occupational dose limit, shallow-dose equivalent to skin, per annum
  • 670 | mSv: | highest dose received by a worker responding to the Fukushima emergency
  • 1 | Sv: | maximum allowed radiation exposure for NASA astronauts over their career
  • 4–5 | Sv: | dose required to kill a human with a 50% risk within 30 days (LD50/30), if the dose is received over a very short duration

All above can be used and manipulated in various ways withing the limitations and constrains depending how you build a map around it. For example leave less space between user and platform and the radiation will break through, etc.

Describe alternatives you've considered

  • Vehicle part irradiator
  • actual irradiated food shelf life (killing bacteria slows decay, but does't stop it completely, chemical decomposition and oxidation is not affected)

Additional context

This is my crown jewel of my CDDA development participation, this sheer idea brought me initially to learning coding CDDA until I was able to do such a feat. Enjoy.

image
SOURCE

@ghost
Copy link

ghost commented Mar 13, 2019

Kevin might want you to mention the nuclear item improvements in the title.

@KorGgenT KorGgenT added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels Mar 13, 2019
@ZhilkinSerg ZhilkinSerg self-assigned this Mar 13, 2019
@Photoloss
Copy link
Contributor

As !FUN! as it would be I don't see how a food irradiator would cook off nukes. Food irradiation uses ionising radiation to smash chemical bonds which generally means bad times for anything trying to be alive but has no effect on atomic nuclei. Nukes and reactors meanwhile operate on nuclear fission which generally requires slow neutrons to sustain the chain reaction. Inverse beta decay and spallation via high-energy gamma rays are possible in theory but at the energies available for commercial machines there's absolutely no chance of macroscopic consequences.

Similar concerns apply to the plutonium cells, and other radioactive material you do not currently mess with. They might get damaged if exposed directly to the primary source for extended periods of time but the same goes for any semiconductor electronics and the sci-fi nanotechnology.

Copy link
Contributor

@Night-Pryanik Night-Pryanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of critical failures are very similar and differ mostly by the item placed and the text. Consider converting identical lines into a function.

src/computer.cpp Outdated Show resolved Hide resolved
src/computer.cpp Show resolved Hide resolved
src/computer.cpp Outdated Show resolved Hide resolved
src/computer.cpp Outdated Show resolved Hide resolved
src/computer.cpp Outdated Show resolved Hide resolved
@nexusmrsep
Copy link
Contributor Author

@Photoloss I agree that I might oversimplified radiation decay and it's effects for this purpose, and I'm willing to cut that part off, but Cataclysm wouldn't be Cataclysm without a possibility of some catastrophic events occurring due to players poking their noses where that shouldn't just for the sake of it. Therefore can you hint me on a scenario where such device would go haywire so I could keep the !FUN! part while being as close to RL constraints as possible? Cobalt-60 is quite radioactive, so some contamination events must be possible if we play it right.

I was thinking of adding a separate option to extract the radioactive core from the bunker, and option to place some utility bots or another computer option for radiation scrubbers to clean the secondary radiation added by the irradiation process. This itself can be rationalized by the manipulation of radioactive material, as I imagine for in-game purposes that the core is temporarily removed from the water tank to perform it's job and some particles have a chance to spread. Perhaps you can comment on this concept too?

@Photoloss
Copy link
Contributor

Therefore can you hint me on a scenario where such device would go haywire so I could keep the !FUN! part while being as close to RL constraints as possible? Cobalt-60 is quite radioactive, so some contamination events must be possible if we play it right.

If you want to explicitly make it run on cobalt the main concern is the primary radiation source. Gamma rays are highly penetrating and cobalt delivers high intensity so if you have less than a thick concrete wall with lead shielding between yourself and the cobalt you're in for a Really Bad Day. A commercial plant would have many safety locks and layers of shielding to prevent exactly that so you would need to hack the facility for overrides and then deliberately walk to the actual radiation source.

Structural damage to the machine could be terrible though. Cobalt "dirty nukes" have been proposed and a non-nuclear explosion near the cobalt storage could easily achieve a similar effect. Again you would have to plant C4 or otherwise deliberately sabotage the system to get a decent yield as a factory would have taken plenty of measures to pre-empt things like gas leaks or electrical faults from causing any issues.

I was thinking of adding a separate option to extract the radioactive core from the bunker, and option to place some utility bots or another computer option for radiation scrubbers to clean the secondary radiation added by the irradiation process. This itself can be rationalized by the manipulation of radioactive material, as I imagine for in-game purposes that the core is temporarily removed from the water tank to perform it's job and some particles have a chance to spread. Perhaps you can comment on this concept too?

Of course this being Cataclysm's dystopian near-future sci-fi you can implement the entire plant as a robot-operated facility with the manual-access consoles only intended for maintenance. When the entire thing needs to be hacked and reprogrammed for personal use to begin with it's easy to justify potential mistakes in managing the shielding, or you could "accidentally" trigger a cobalt core replacement with no such delivery present (with a half-life of 5 years commercial facilities would definitely need some way of replacing their stock). Don't let computers or robots idle near the cobalt itself though as radiation is quite damaging to semiconductor electronics as well, the shields should be opened and robots/staff allowed to enter only when actually necessary.

Since cobalt's activity stems from spontaneous beta decay and water is not particularly good at absorbing gamma rays any process where the source is significantly removed from underground storage during operation would only serve to reduce the overall radiation output by bringing it closer instead. It decays into stable nickel so there are no hazardous secondary products either, and unlike neutron-rich fission reactors beta and gamma radiation can't really turn other materials radioactive.

Unfortunately for you there really isn't much the player could mess up without intentionally sabotaging the facility, if you want !FUN! implement a nuclear power plant or something using cryogenic superconducting magnets.

@kevingranade
Copy link
Member

Short of triggering a full detonation, how about having the radiation trigger a misfire instead?
The mechanism would be that the ionizing radiation triggers some of the detonators. Since they would fire out of sequence, the bomb wouldn't go critical, but it would still explode the bomb and spray radioactive materials in all directions.

This could also be applied to other explosives with electrical detonators.

Alternately, if you really like the full detonation option, it can go in CrazyCataclysm no matter how unscientific it is since I think it's fun.

@Photoloss
Copy link
Contributor

Short of triggering a full detonation, how about having the radiation trigger a misfire instead?
The mechanism would be that the ionizing radiation triggers some of the detonators. Since they would fire out of sequence, the bomb wouldn't go critical, but it would still explode the bomb and spray radioactive materials in all directions.

Non-nuclear sure. I doubt it would happen frequently IRL as detonators should be designed to prevent such failures but sitting in a gamma ray beam isn't the standard test case by any stretch. Accidental triggers of any digital technology are possible, in fact semiconductor ionisation is even used to detect gamma rays and particles via principles similar to basic computer components.

I'm not sure what the effect on cartridges and explosives themselves would be. With enough beam intensity you could definitely cause them to combust but I don't know any quick references on how much local energy deposit you actually need.

Alternately, if you really like the full detonation option, it can go in CrazyCataclysm no matter how unscientific it is since I think it's fun.

In that context I'd think the first course of action would be to transform zombies into Hulks, no?

@nexusmrsep
Copy link
Contributor Author

Ok, I'll go for conventional explosion with the containment breach of the radiation source, a.k.a mini dirty bomb. For this I'll merge both catastrophic failures into one. I'll leave behind the idea of ionizing radiation destroying other potential electronic equipment placed on the platform.

For the protocol I'll only mention that overall radiation behavior in game already leans more towards fiction then fact - for example, irradiated player irradiates background? Unless s/he literally carries irradiated mud on the boots, wouldn't it be otherwise impossible?

There is however one more idea I'd like to discuss before implementing. I may code in an option to extract the radiation core, so that the player may interact with it, but I have no idea what would it be useful for. Unless it'd give a bunch of plutonium cells irreversibly shutting down the facility for it's main purpose perhaps?

SORUCE
The arrays are stored in a deep water pool, which prevents gamma radiation from escaping. The shielding water does not become radioactive.
Large-scale gamma irradiators come in two configurations. In one configuration, the Cobalt arrays are hoisted out of the water into a radiation chamber that typically has shields made out of massive concrete or steel. This is shown in Fig. 1.15. The concrete walls are typically 2-feet thick or more. When the irradiators are out of the protective storage pool, all workers are outside the thick walls. Hanging carriers, totes, or roller conveyors are typically employed to move the product through the chamber for irradiation. A typical product container can be 60 cm × 50 cm × 150 cm, and some irradiators are designed to irradiate entire pallets of product measuring 120 cm × 100 cm × 150 cm. Because Cobalt-60 photons have no mass, they can penetrate more than 24 inches (60 cm) of food product if irradiated on both sides.
In the second configuration, unlike a radiation chamber irradiator, an underwater irradiator stores the Cobalt-60 permanently at the bottom of a pool of water. Instead of raising the Cobalt-60 into a shielded chamber, the product, placed in water-free containers, is lowered to the bottom of the pool adjacent to the Cobalt-60 to receive a dose of radiation. No above-ground shielding or radiation chamber is present. Typically, the product is loaded into water-free containers and the containers are lowered/raised using a hoist mechanism.

Nothing better then sweet Cherenkov glow:
image

This is where I seek the !FUN! part. Many nasty things may happen when a a player messes with exposed core, but with clean suits, hazmat suits, power armor (as radiation protection) and with some iodine tablets this may be utilized as some kind of high risk - high reward game-play opportunity, that I'm reluctant to pass by. Ideas welcomed.

src/computer.cpp Outdated Show resolved Hide resolved
@Photoloss
Copy link
Contributor

For this I'll merge both catastrophic failures into one.

Plutonium will not explode from exposure to gamma radiation, only the mininuke has detonators which could misfire. C4 and player-crafted RC bombs can go off at full strength but without radiation.

For the protocol I'll only mention that overall radiation behavior in game already leans more towards fiction then fact - for example, irradiated player irradiates background? Unless s/he literally carries irradiated mud on the boots, wouldn't it be otherwise impossible?

First of all I'm not sure the player actually spreads radiation considering there's a mutation trait dedicated to doing so constantly. Secondly player irradiation is abstracted too much, proximity to reactor slurry or damaged nukes can indeed not only contaminate your clothing but also "activate" material in your body via neutron capture (basically the same mechanism as proposed in the actual cobalt dirty bomb)

There is however one more idea I'd like to discuss before implementing. I may code in an option to extract the radiation core, so that the player may interact with it, but I have no idea what would it be useful for. Unless it'd give a bunch of plutonium cells irreversibly shutting down the facility for it's main purpose perhaps?

Plutonium is very different from cobalt! An actual cobalt core can not be used as fission reactor fuel and outputs almost exclusively gamma radiation which has relatively few uses. The level of radiation we are talking about is not sufficient for an "energy beam" weapon and wouldn't even be combat-viable if you strapped a baddie to the core itself.

@nexusmrsep nexusmrsep changed the title CR Food irradiator [computer console variant] WIP CR Food irradiator [computer console variant] Mar 13, 2019
@nexusmrsep
Copy link
Contributor Author

nexusmrsep commented Mar 13, 2019

Plutonium will not explode from exposure to gamma radiation. (...)

That I know. You may misinterpret my intention. I meant to say I will drop the effects on plutonium cells, but use the contamination code from this effect and move it around, so there will be only one coded catastrophic event that would include conventional explosion and contamination.

First of all I'm not sure the player actually spreads radiation considering there's a mutation trait dedicated to doing so constantly.

I think you're right. It seems to come from mutation. There again, I could swear something like this has happen in one of Rycon YouTube playthroughs. Memory is a funny thing.

Plutonium is very different from cobalt!

I know. I'm brainstorming here. I wish to invent some feasible idea for use of the radioactive material in the irradiator core, assuming it will be obtainable by the player.
Option 1:
So if for example it was plutonium cells and not cobalt - the question would be: would an array of plutonium cells (include in-game leeway for the item itself, assuming its existence as axiom) be usable as a radiation source for the food irradiator? If yes, then it would be great, as they are in use, and are in demand. If no - bummer, this way would be closed.
Option 2:
make it cobalt-60, but then - you seem to say that it wouldn't have any use for the player - so in this option you'd propose, all in all, dropping the idea completely?

EDIT:
Or maybe if cobalt-60 would not have any effect, it might be a potential "death trap" !FUN! - player picks it up "for later use" but all s/he gets is an always radioactive item that should be ditched ASAP?

@Photoloss
Copy link
Contributor

So if for example it was plutonium cells and not cobalt - the question would be: would an array of plutonium cells (include in-game leeway for the item itself, assuming its existence as axiom) be usable as a radiation source for the food irradiator? If yes, then it would be great, as they are in use, and are in demand. If no - bummer, this way would be closed.

Using plutonium is a terrible idea, precisely for the reasons it is used in nuclear bombs. Plus it is expensive to produce and some isotopes turn into radon which is not good.

Or maybe if cobalt-60 would not have any effect, it might be a potential "death trap" !FUN! - player picks it up "for later use" but all s/he gets is an always radioactive item that should be ditched ASAP?

If you want to put in the work I see no harm in implementing it as a "deathtrap" for now. If nothing else we could use it for on-the-fly food irradiation if we can somehow handle it (technically a hazmat suit would be virtually useless against gamma radiation but in-game it completely protects you from everything). In the (far) future it might be used in improvised medical treatments or for the confirmed sci-fi effects.

@ZhilkinSerg ZhilkinSerg removed their assignment Mar 15, 2019
@nexusmrsep nexusmrsep changed the title WIP CR Food irradiator [computer console variant] Food irradiator [computer console variant] Mar 17, 2019
src/computer.cpp Show resolved Hide resolved
src/computer.cpp Show resolved Hide resolved
src/computer.cpp Outdated Show resolved Hide resolved
src/computer.cpp Show resolved Hide resolved
src/computer.cpp Show resolved Hide resolved
src/computer.cpp Show resolved Hide resolved
src/computer.cpp Outdated Show resolved Hide resolved
src/iuse.cpp Outdated Show resolved Hide resolved
src/iuse.cpp Outdated Show resolved Hide resolved
src/iexamine.cpp Show resolved Hide resolved
Night-Pryanik and others added 10 commits April 18, 2019 10:24
Co-Authored-By: nexusmrsep <39925111+nexusmrsep@users.noreply.github.com>
Co-Authored-By: nexusmrsep <39925111+nexusmrsep@users.noreply.github.com>
Co-Authored-By: nexusmrsep <39925111+nexusmrsep@users.noreply.github.com>
Co-Authored-By: nexusmrsep <39925111+nexusmrsep@users.noreply.github.com>
Co-Authored-By: nexusmrsep <39925111+nexusmrsep@users.noreply.github.com>
Co-Authored-By: nexusmrsep <39925111+nexusmrsep@users.noreply.github.com>
@kevingranade
Copy link
Member

Needs styling, but checking it out otherwise.

@kevingranade
Copy link
Member

Crashed when I cycled the conveyor belt

MESSAGE: SIGSEGV: Segmentation fault
STACK TRACE:

        ./cataclysm(_Z21debug_write_backtraceRSo+0x25) [0x7ac6eb]
        ./cataclysm() [0x79fb7c]
        ./cataclysm() [0x79fd7d]
        /lib64/libc.so.6(+0x347e0) [0x7f63771897e0]
        ./cataclysm(_ZN4itemC2ERKS_+0x18) [0x6cf054]
        ./cataclysm(_ZNSt7__cxx114listI4itemSaIS1_EE14_M_create_nodeIJRKS1_EEEPSt10_List_nodeIS1_EDpOT_+0x26) [0x6cf4de]
        ./cataclysm(_ZNSt7__cxx114listI4itemSaIS1_EEC1ERKS3_+0x2d) [0x6cf529]
        ./cataclysm(_ZN4itemC2ERKS_+0x30) [0x6cf06c]
        ./cataclysm(_ZN8computer17activate_functionE15computer_action+0x3fbe) [0x76c4dc]
        ./cataclysm(_ZN8computer3useEv+0x494) [0x76d36c]
        ./cataclysm(_ZN4game12use_computerERK8tripoint+0x273) [0x837395]
        ./cataclysm(_ZN4game7examineERK8tripoint+0x14a) [0x84ddd4]
        ./cataclysm(_ZN4game7examineEv+0xe5) [0x84e233]
        ./cataclysm(_ZN4game13handle_actionEv+0x169e) [0x87fbda]
        ./cataclysm(_ZN4game7do_turnEv+0x3e6) [0x849d54]
        ./cataclysm(main+0x1152) [0x68792f]
        /lib64/libc.so.6(__libc_start_main+0xea) [0x7f637717602a]
        ./cataclysm(_start+0x2a) [0x6b224a]

        Attempting to repeat stack trace using debug symbols...
        debug_write_backtrace(std::ostream&)
        .../src/debug.cpp:593
        std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const
        /usr/include/c++/7/sstream:638
        log_crash
        .../src/crash.cpp:258
        signal_handler
        .../src/crash.cpp:287
        ??
        ??:0
        item::item(item const&)
        .../src/item.h:175
        std::_List_node<item>* std::__cxx11::list<item, std::allocator<item> >::_M_create_node<item const&>(item const&)
        /usr/include/c++/7/bits/stl_list.h:579
        void std::__cxx11::list<item, std::allocator<item> >::_M_insert<item const&>(std::_List_iterator<item>, item const&)
        /usr/include/c++/7/bits/stl_list.h:1802
        void std::__cxx11::list<item, std::allocator<item> >::emplace_back<item const&>(item const&)
        /usr/include/c++/7/bits/stl_list.h:1133
        void std::__cxx11::list<item, std::allocator<item> >::_M_initialize_dispatch<std::_List_const_iterator<item> >(std::_List_const_iterator<item>, std::_List_const_iterator<item>, std::__false_type)
        /usr/include/c++/7/bits/stl_list.h:1730
        std::__cxx11::list<item, std::allocator<item> >::list(std::__cxx11::list<item, std::allocator<item> > const&)
        /usr/include/c++/7/bits/stl_list.h:655
        item::item(item const&)
        .../src/item.h:175
        computer::activate_function(computer_action)
        .../src/computer.cpp:1424
        computer::use()
        .../src/computer.cpp:227
        game::use_computer(tripoint const&)
        .../src/game.cpp:5069
        game::examine(tripoint const&)
        .../src/game.cpp:6151
        game::examine()
        .../src/game.cpp:6062
        game::handle_action()
        .../src/handle_action.cpp:1554
        game::do_turn()
        .../src/game.cpp:1401
        main
        .../src/main.cpp:682
        __libc_start_main
        ??:?
        _start
        ??:?

@nexusmrsep
Copy link
Contributor Author

nexusmrsep commented Apr 19, 2019 via email

@nexusmrsep
Copy link
Contributor Author

I seems that on some point I've changed the item removal in conveyor belt processing not noticing it's placed inside a loop and without retesting.
Fixed now.
Also noticed that potatoes weren't being irradiated properly because I've migrated only half of the naming scheme.
Also fixed.

@kevingranade kevingranade merged commit d2af6f3 into CleverRaven:master Apr 20, 2019
sum_rads += g->m.get_radiation( platform );
tiles_counted ++;
if( g->m.get_radiation( platform ) > peak_rad ) {
peak_rad = g->m.get_radiation( dest );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't platform be used here instead of dest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Fixing.

@nexusmrsep nexusmrsep deleted the irradiator_comp branch May 6, 2019 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Fields / Furniture / Terrain / Traps Objects that are part of the map or its features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants