Skip to content

Commit

Permalink
feat: Military ID cards can deactivate plutonium generator security f…
Browse files Browse the repository at this point in the history
…or retrieval (cataclysmbnteam#5790)

* Allow using a military ID card to disengage a plutonium generator, for retrieval.

* Changed description for t_plut_generator to reflect alternative means of retrieval.

* Modified 'no keycard' message to be more concise.

* style(autofix.ci): automated formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
karxi and autofix-ci[bot] authored Dec 5, 2024
1 parent 8bdd237 commit ab1cda7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
5 changes: 3 additions & 2 deletions data/json/furniture_and_terrain/terrain-manufactured.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"type": "terrain",
"id": "t_plut_generator",
"name": "plutonium generator",
"description": "This imposing apparatus harnesses the power of the atom, configured to provide nearly limitless backup power from the nuclear fuel installed in it. It's not doing much good here though. It has a complicated security system that is dangerous and difficult to bypass without the code.",
"description": "This imposing apparatus harnesses the power of the atom, configured to provide nearly limitless backup power from the nuclear fuel installed in it. It's not doing much good here though. It has a complicated security system that is dangerous and difficult to bypass without authorization; a small slot suggests that it can accept some form of ID card.",
"symbol": "0",
"color": "light_green",
"looks_like": "t_machinery_electronic",
Expand All @@ -729,7 +729,8 @@
],
"//": "Variable reduction, destroy_threshold equal to str_min instead of str_max due to delicate electronics",
"ranged": { "reduction": [ 25, 50 ], "destroy_threshold": 50, "block_unaimed_chance": "50%" }
}
},
"examine_action": "cardreader_plutgen"
},
{
"type": "terrain",
Expand Down
20 changes: 20 additions & 0 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ static const itype_id itype_marloss_seed( "marloss_seed" );
static const itype_id itype_mycus_fruit( "mycus_fruit" );
static const itype_id itype_nail( "nail" );
static const itype_id itype_petrified_eye( "petrified_eye" );
static const itype_id itype_plut_generator_item( "plut_generator_item" );
static const itype_id itype_sheet( "sheet" );
static const itype_id itype_stick( "stick" );
static const itype_id itype_string_36( "string_36" );
Expand Down Expand Up @@ -6319,6 +6320,24 @@ void iexamine::migo_nerve_cluster( player &p, const tripoint &examp )
}
}

void iexamine::cardreader_plutgen( player &p, const tripoint &examp )
{
map &here = get_map();
itype_id card_type = itype_id_military;
if( p.has_amount( card_type, 1 ) && query_yn( _( "Swipe your ID card?" ) ) ) {
// The duration taken may need modification.
p.mod_moves( -100 );
p.use_amount( card_type, 1 );
add_msg( _( "You insert your ID card." ) );
add_msg( m_good,
_( "The plutonium generator beeps twice, then disengages from the surrounding conduits with a series of mechanical clunks." ) );
here.ter_set( examp, t_concrete );
here.add_item_or_charges( examp, item::spawn( itype_plut_generator_item, calendar::turn ) );
} else {
add_msg( _( "The plutonium generator has significant security measures in place. Without the necessary ID, you'll have to remove it by hand." ) );
}
}

/**
* Given then name of one of the above functions, returns the matching function
* pointer. If no match is found, defaults to iexamine::none but prints out a
Expand Down Expand Up @@ -6413,6 +6432,7 @@ iexamine_function iexamine_function_from_string( const std::string &function_nam
{ "dimensional_portal", &iexamine::dimensional_portal },
{ "check_power", &iexamine::check_power },
{ "migo_nerve_cluster", &iexamine::migo_nerve_cluster },
{ "cardreader_plutgen", &iexamine::cardreader_plutgen },
}
};

Expand Down
1 change: 1 addition & 0 deletions src/iexamine.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void workbench( player &p, const tripoint &examp );
void dimensional_portal( player &p, const tripoint &examp );
void check_power( player &p, const tripoint &examp );
void migo_nerve_cluster( player &p, const tripoint &examp );
void cardreader_plutgen( player &p, const tripoint &examp );

detached_ptr<item> pour_into_keg( const tripoint &pos, detached_ptr<item> &&liquid );
std::optional<tripoint> getGasPumpByNumber( const tripoint &p, int number );
Expand Down

0 comments on commit ab1cda7

Please sign in to comment.