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
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
73cbc6f
irradiator computer console
nexusmrsep Mar 12, 2019
bbf4b34
mininuke timer, miliSieverts/hour
nexusmrsep Mar 12, 2019
4b0726c
two-way toggleable translate_radius
nexusmrsep Mar 12, 2019
f94cdf6
mapdata updates for glass wall shutters
nexusmrsep Mar 12, 2019
0bd8bc4
astyle
nexusmrsep Mar 12, 2019
068138b
added radiation platform as separate terrain
nexusmrsep Mar 17, 2019
212438e
added cobalt-60 pellet item
nexusmrsep Mar 17, 2019
61382c9
updated computer.cpp to new approach
nexusmrsep Mar 17, 2019
cc2f35e
added option COMPACT_EXTRACT_RAD_SOURCE, fixes
nexusmrsep Mar 17, 2019
02763de
assorted fixes
nexusmrsep Mar 17, 2019
3af8407
astyle
nexusmrsep Mar 17, 2019
c571839
Update src/computer.cpp
Night-Pryanik Mar 17, 2019
23f7a05
Merge branch 'master' into irradiator_comp
kevingranade Mar 23, 2019
e524a1a
gates connect to strong concrete wall
nexusmrsep Apr 11, 2019
d4a5c13
irradiated food group and also pre-irradiated
nexusmrsep Apr 11, 2019
98cae21
irradiated potato naming convention change with migration
nexusmrsep Apr 11, 2019
41fb2eb
potato continued
nexusmrsep Apr 11, 2019
c135aca
vehicle group cleanup
nexusmrsep Apr 11, 2019
4c6a5a5
conveyor belt indoors
nexusmrsep Apr 11, 2019
08bb6c5
irradiation facility mapgen files
nexusmrsep Apr 11, 2019
a61337b
Merge branch 'master' into irradiator_comp
nexusmrsep Apr 12, 2019
f1b9ce2
industrial ID cards, card readers etc.
nexusmrsep Apr 13, 2019
ee0df88
some reworks
nexusmrsep Apr 13, 2019
2458d8a
Apply suggestions from code review
Night-Pryanik Apr 14, 2019
682738a
astyle
nexusmrsep Apr 14, 2019
041e728
Merge branch 'master' into irradiator_comp
nexusmrsep Apr 16, 2019
fba4b22
new computer: shock disabler
nexusmrsep Apr 17, 2019
e03c944
tweaks and fixes, monster placement
nexusmrsep Apr 17, 2019
d5e86bd
astyle
nexusmrsep Apr 17, 2019
73c214e
lint
nexusmrsep Apr 17, 2019
35120bb
Apply suggestions from code review
Night-Pryanik Apr 18, 2019
0159daa
moves consumption for new comp action
nexusmrsep Apr 18, 2019
b9387b0
Update data/json/mapgen/irradiator_1.json
Night-Pryanik Apr 18, 2019
2f50b39
Update data/json/mapgen/irradiator_1.json
Night-Pryanik Apr 18, 2019
41e305e
Update data/json/mapgen/irradiator_1.json
Night-Pryanik Apr 18, 2019
4ec4304
Update data/json/mapgen/irradiator_1.json
Night-Pryanik Apr 18, 2019
1b8694a
Update data/json/mapgen/irradiator_1.json
Night-Pryanik Apr 18, 2019
b9fc1ff
Merge branch 'master' into irradiator_comp
nexusmrsep Apr 18, 2019
d1475ac
Merge branch 'master' into irradiator_comp
kevingranade Apr 19, 2019
fcc4b32
lint
nexusmrsep Apr 19, 2019
c77aa6b
Merge branch 'master' into irradiator_comp
nexusmrsep Apr 19, 2019
2c35ed3
fix for crash
nexusmrsep Apr 19, 2019
611e8f2
few layout fixes
nexusmrsep Apr 19, 2019
4ec799f
second part of potato migration
nexusmrsep Apr 19, 2019
1367aad
lint
nexusmrsep Apr 19, 2019
64d8eb7
lint 2
nexusmrsep Apr 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
170 changes: 169 additions & 1 deletion src/computer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "field.h"
#include "game.h"
#include "input.h"
#include "item_factory.h"
#include "json.h"
#include "line.h"
#include "map.h"
Expand Down Expand Up @@ -1260,6 +1261,169 @@ SHORTLY. TO ENSURE YOUR SAFETY PLEASE FOLLOW THE BELOW STEPS. \n\
query_any( _( "Press any key..." ) );
break;

//irradiates food at t_floor_blue, adds radiation
case COMPACT_IRRADIATOR: {
g->u.moves -= 30;
bool error = false;
for( const tripoint &dest : g->m.points_in_radius( g->u.pos(), 10 ) ) {
if( g->m.ter( dest ) == t_floor_blue ) {
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
if( g->m.i_at( dest ).empty() ) {
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
print_error( _( "ERROR: Processing platform empty." ) );
} else {
g->u.moves -= 300;
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
for( auto it = g->m.i_at( dest ).begin(); it != g->m.i_at( dest ).end(); ++it ) {
// actual food processing
if( !it->rotten() && item_controller->has_template( "irradiated_" + it->typeId() ) ) {
it->convert( "irradiated_" + it->typeId() );
}
// critical failure #1 - let's cook a mininuke
if( it->typeId() == "mininuke" || it->typeId() == "mininuke_act" ) {
print_error( _( "WARNING [409]: Radiation spike detected!" ) );
print_error( _( " >> AUTO-RISK-ASSESMENT: Geiger profiling..." ) );
print_error( _( " >> [Self-sustaining] reaction in [critical mass] detected!\n" ) );
print_error( _( "WARNING [999]: Catastrofic meltdown imminent!\n" ) );
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
print_error( _( "EMERGENCY PROCEDURE [1]: EVACUATE! EVACUATE! EAVACUATE!" ) );
add_msg( m_warning, _( "Evacuate Immediately!" ) );
sounds::sound( g->u.pos(), 30, sounds::sound_t::alarm, _( "an alarm sound!" ) );
it->convert( "mininuke_act" );
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
g->m.add_field( dest, fd_nuke_gas, 3 );
g->m.translate_radius( t_water_pool, t_sewage, 8.0, dest, true );
for( const tripoint &area : g->m.points_in_radius( dest, 1 ) ) {
g->m.add_field( area, fd_nuke_gas, 3 );
}
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
it->charges = rng( 10, 100 ); // countdown in turns
it->active = true;
g->m.adjust_radiation( dest, rng( 50, 500 ) );
for( const tripoint &radorigin : g->m.points_in_radius( dest, 5 ) ) {
g->m.adjust_radiation( radorigin, rng( 50, 500 ) / ( rl_dist( radorigin,
dest ) > 0 ? rl_dist( radorigin, dest ) : 1 ) );
}
if( g->m.pl_sees( dest, 10 ) ) {
g->u.irradiate( rng( 50, 250 ) / rl_dist( g->u.pos(), dest ) );
} else {
g->u.irradiate( rng( 20, 100 ) / rl_dist( g->u.pos(), dest ) );
}
query_any( _( "EMERGENCY SHUTDOWN Press any key..." ) );
error = true;
options.clear(); // Disable the terminal.
activate_failure( COMPFAIL_SHUTDOWN );
break;
}
// critical failure #2 - radioactive slurry dessert
if( it->typeId() == "plut_cell" ) {
print_error( _( "WARNING [409]: Radiation spike detected!" ) );
print_error( _( " >> AUTO-RISK-ASSESMENT: Geiger profiling..." ) );
print_error( _( " >> [Non-self-sustaining] reaction in [non-critical mass] detected!\n" ) );
print_error( _( "WARNING [912]: Meltdown detected! Contamination! " ) );
print_error( _( "EMERGENCY PROCEDURE [5]: Contamination lockdown.\n" ) );
sounds::sound( g->u.pos(), 30, sounds::sound_t::alarm, _( "an alarm sound!" ) );
it->convert( "plut_slurry_dense" );
g->m.add_field( dest, fd_nuke_gas, 3 );
g->m.translate_radius( t_water_pool, t_sewage, 8.0, dest, true );
for( const tripoint &area : g->m.points_in_radius( dest, 1 ) ) {
g->m.add_field( area, fd_nuke_gas, 3 );
}
g->m.adjust_radiation( dest, rng( 50, 100 ) );
for( const tripoint &radorigin : g->m.points_in_radius( dest, 5 ) ) {
g->m.adjust_radiation( radorigin, rng( 50, 100 ) / ( rl_dist( radorigin,
dest ) > 0 ? rl_dist( radorigin, dest ) : 1 ) );
}
if( g->m.pl_sees( dest, 10 ) ) {
g->u.irradiate( rng( 20, 100 ) / rl_dist( g->u.pos(), dest ) );
} else {
g->u.irradiate( rng( 10, 50 ) / rl_dist( g->u.pos(), dest ) );
}
query_any( _( "PARTIAL SHUTDOWN & LOCKDOWN: Press any key..." ) );
remove_option( COMPACT_CONVEYOR );
remove_option( COMPACT_IRRADIATOR );
activate_function( COMPACT_LOCK );
add_option( "End Lockdown: open doors.", COMPACT_OPEN, 0 );
error = true;
break;
}
g->m.adjust_radiation( dest, rng( 20, 50 ) );
for( const tripoint &radorigin : g->m.points_in_radius( dest, 5 ) ) {
g->m.adjust_radiation( radorigin, rng( 20, 50 ) / ( rl_dist( radorigin,
dest ) > 0 ? rl_dist( radorigin, dest ) : 1 ) );
}
// if unshielded, rad source irradiates player directly, reduced by distance to source
if( g->m.pl_sees( dest, 10 ) ) {
g->u.irradiate( rng( 5, 25 ) / rl_dist( g->u.pos(), dest ) );
}
}
if( !error ) {
print_error( _( "PROCESSING... CYCLE COMPLETE." ) );
print_error( _( "GEIGER COUNTER @ PLATFORM: %s mSv/h." ), g->m.get_radiation( dest ) );
}

}
}
}
if( !error ) {
query_any( _( "Press any key..." ) );
}
break;
}

// geiger counter for irradiator, primary measurement at t_floor_blue, secondary at player loacation
case COMPACT_GEIGER: {
g->u.moves -= 30;
bool source_exists = false;
print_error( _( "RADIATION MEASUREMENTS:" ) );
for( const tripoint &dest : g->m.points_in_radius( g->u.pos(), 10 ) ) {
if( g->m.ter( dest ) == t_floor_blue ) {
print_error( _( "GEIGER COUNTER @ PLATFORM: ... %s mSv/h." ), g->m.get_radiation( dest ) );
source_exists = true;
}
}
if( !source_exists ) {
print_error(
_( "GEIGER COUNTER @ PLATFORM: ... IRRESPONSIVE. COMPLY TO PROCEDURE GC_M_01_rev.03." ) );
}
print_error( _( "GEIGER COUNTER @ CONSOLE: .... %s mSv/h." ), g->m.get_radiation( g->u.pos() ) );
query_any( _( "Press any key..." ) );
break;
}

// imitates item movement through conveyor belt throgh 3 different loading/unloading bays
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
// ensure only bay of each type in range
case COMPACT_CONVEYOR: {
g->u.moves -= 300;
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
tripoint loading; // red tile = loading bay
tripoint unloading; // green tile = unloading bay
tripoint platform; // blue tile = intermediate platform
for( const tripoint &dest : g->m.points_in_radius( g->u.pos(), 10 ) ) {
if( g->m.ter( dest ) == t_floor_blue ) {
platform = dest;
} else if( g->m.ter( dest ) == t_floor_red ) {
loading = dest;
} else if( g->m.ter( dest ) == t_floor_green ) {
unloading = dest;
}
}
auto items = g->m.i_at( platform );
for( const auto &it : items ) {
g->m.add_item_or_charges( unloading, it );
g->m.i_clear( platform );
}
items = g->m.i_at( loading );
for( const auto &it : items ) {
if( !it.made_of_from_type( LIQUID ) ) {
g->m.add_item_or_charges( platform, it );
g->m.i_clear( loading );
}
}
query_any( _( "Conveyor belt cycle complete. Press any key..." ) );
break;
}
// toggles reinforced glass shutters open->closed and closedd->open depending on their current state
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
case COMPACT_SHUTTERS:
g->u.moves -= 300;
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
g->m.translate_radius( t_reinforced_glass_shutter, t_reinforced_glass_shutter_open, 8.0, g->u.pos(),
true, true );
query_any( _( "Toggling shutters. Press any key..." ) );
break;

} // switch (action)
}

Expand Down Expand Up @@ -1687,7 +1851,11 @@ computer_action computer_action_from_string( const std::string &str )
{ "srcf_3_mess", COMPACT_SRCF_3_MESS },
{ "srcf_seal_order", COMPACT_SRCF_SEAL_ORDER },
{ "srcf_seal", COMPACT_SRCF_SEAL },
{ "srcf_elevator", COMPACT_SRCF_ELEVATOR }
{ "srcf_elevator", COMPACT_SRCF_ELEVATOR },
{ "irradiator", COMPACT_IRRADIATOR },
{ "geiger", COMPACT_GEIGER },
{ "conveyor", COMPACT_CONVEYOR },
{ "shutters", COMPACT_SHUTTERS }
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/computer.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ enum computer_action {
COMPACT_OPEN_DISARM,
COMPACT_UNLOCK_DISARM,
COMPACT_RELEASE_DISARM,
COMPACT_IRRADIATOR,
COMPACT_GEIGER,
COMPACT_CONVEYOR,
COMPACT_SHUTTERS,
NUM_COMPUTER_ACTIONS
};

Expand Down
13 changes: 7 additions & 6 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2939,11 +2939,11 @@ int iuse::geiger( player *p, item *it, bool t, const tripoint &pos )
} );
switch( ch ) {
case 0:
p->add_msg_if_player( m_info, _( "Your radiation level: %d (%d from items)" ), p->radiation,
p->add_msg_if_player( m_info, _( "Your radiation level: %d mSv (%d mSv from items)" ), p->radiation,
p->leak_level( "RADIOACTIVE" ) );
break;
case 1:
p->add_msg_if_player( m_info, _( "The ground's radiation level: %d" ),
p->add_msg_if_player( m_info, _( "The ground's radiation level: %d mSv/h" ),
g->m.get_radiation( p->pos() ) );
break;
case 2:
Expand Down Expand Up @@ -3370,12 +3370,13 @@ int iuse::firecracker_act( player *, item *it, bool t, const tripoint &pos )
int iuse::mininuke( player *p, item *it, bool, const tripoint & )
{
int time;
bool got_value = query_int( time, _( "Set the timer to (0 to cancel)?" ) );
bool got_value = query_int( time, _( "Set the timer to ___ turns (0 to cancel)?" ) );
if( !got_value || time <= 0 ) {
p->add_msg_if_player( _( "Never mind." ) );
return 0;
}
p->add_msg_if_player( _( "You set the timer to %d." ), time );
p->add_msg_if_player( _( "You set the timer to %s." ),
to_string( time_duration::from_turns( time ) ) );
if( !p->is_npc() ) {
p->add_memorial_log( pgettext( "memorial_male", "Activated a mininuke." ),
pgettext( "memorial_female", "Activated a mininuke." ) );
Expand Down Expand Up @@ -5060,8 +5061,8 @@ int iuse::radglove( player *p, item *it, bool, const tripoint & )
if( p->radiation >= 1 ) {
p->add_msg_if_player( m_warning, _( "You are currently irradiated." ) );
p->add_msg_player_or_say( m_info,
_( "Your radiation level: %d" ),
_( "It says here that my radiation level is %d" ),
_( "Your radiation level: %d mSv" ),
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
_( "It says here that my radiation level is %d mSv" ),
nexusmrsep marked this conversation as resolved.
Show resolved Hide resolved
p->radiation );
} else {
p->add_msg_player_or_say( m_info,
Expand Down
9 changes: 7 additions & 2 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3764,7 +3764,7 @@ void map::translate( const ter_id &from, const ter_id &to )

//This function performs the translate function within a given radius of the player.
void map::translate_radius( const ter_id &from, const ter_id &to, float radi, const tripoint &p,
const bool same_submap )
const bool same_submap, const bool toggle_between )
{
if( from == to ) {
debugmsg( "map::translate %s => %s",
Expand All @@ -3780,13 +3780,18 @@ void map::translate_radius( const ter_id &from, const ter_id &to, float radi, co
int &y = t.y;
for( x = 0; x < SEEX * my_MAPSIZE; x++ ) {
for( y = 0; y < SEEY * my_MAPSIZE; y++ ) {
float radiX = sqrt( float( ( uX - x ) * ( uX - x ) + ( uY - y ) * ( uY - y ) ) );
if( ter( t ) == from ) {
float radiX = sqrt( float( ( uX - x ) * ( uX - x ) + ( uY - y ) * ( uY - y ) ) );
// within distance, and either no submap limitation or same overmap coords.
if( radiX <= radi && ( !same_submap ||
ms_to_omt_copy( getabs( x, y ) ) == ms_to_omt_copy( getabs( uX, uY ) ) ) ) {
ter_set( t, to );
}
} else if( toggle_between && ter( t ) == to ) {
if( radiX <= radi && ( !same_submap ||
ms_to_omt_copy( getabs( x, y ) ) == ms_to_omt_copy( getabs( uX, uY ) ) ) ) {
ter_set( t, from );
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,9 @@ class map
// Change all instances of $from->$to
void translate( const ter_id &from, const ter_id &to );
// Change all instances $from->$to within this radius, optionally limited to locations in the same submap.
// Optionally toggles instances $from->$to & $to->$from
void translate_radius( const ter_id &from, const ter_id &to, const float radi, const tripoint &p,
const bool same_submap = false );
const bool same_submap = false, const bool toggle_between = false );
bool close_door( const tripoint &p, const bool inside, const bool check_only );
bool open_door( const tripoint &p, const bool inside, const bool check_only = false );
// Destruction
Expand Down
2 changes: 1 addition & 1 deletion src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ ter_id t_null,
t_wall_metal,
t_wall_glass,
t_wall_glass_alarm,
t_reinforced_glass,
t_reinforced_glass, t_reinforced_glass_shutter, t_reinforced_glass_shutter_open,
t_reinforced_door_glass_o,
t_reinforced_door_glass_c,
t_bars,
Expand Down
2 changes: 1 addition & 1 deletion src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ extern ter_id t_null,
t_wall_metal,
t_wall_glass,
t_wall_glass_alarm,
t_reinforced_glass,
t_reinforced_glass, t_reinforced_glass_shutter, t_reinforced_glass_shutter_open,
t_reinforced_door_glass_o,
t_reinforced_door_glass_c,
t_bars,
Expand Down