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

Load faults / fault_fixes with generic_factory #73816

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/core/sentinels.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
"legacy_enum_id": 0,
"intensity_levels": [ { "name": "nothing" } ]
},
{
"id": "null",
"type": "fault",
"name": { "str": "This is a bug" },
"description": "This fault id is a reserved sentinel."
},
{
"type": "SPELL",
"id": "null",
Expand Down
4 changes: 2 additions & 2 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,10 +1136,10 @@ void avatar_action::use_item( avatar &you, item_location &loc, std::string const
if( loc->wetness && loc->has_flag( flag_WATER_BREAK_ACTIVE ) ) {
if( query_yn( _( "This item is still wet and it will break if you turn it on. Proceed?" ) ) ) {
loc->deactivate();
loc.get_item()->set_fault( random_entry( fault::get_by_type( std::string( "wet" ) ) ) );
loc.get_item()->set_fault( faults::random_of_type( "wet" ) );
// An electronic item in water is also shorted.
if( loc->has_flag( flag_ELECTRONIC ) ) {
loc.get_item()->set_fault( random_entry( fault::get_by_type( std::string( "shorted" ) ) ) );
loc.get_item()->set_fault( faults::random_of_type( "shorted" ) );
}
} else {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6736,7 +6736,7 @@ void Character::mend_item( item_location &&obj, bool interactive )
const fault_fix &fix = opt.fix;
assign_activity( ACT_MEND_ITEM, to_moves<int>( opt.time_to_fix ) );
activity.name = opt.fault.str();
activity.str_values.emplace_back( fix.id_ );
activity.str_values.emplace_back( fix.id.str() );
activity.targets.push_back( std::move( obj ) );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/explosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ void emp_blast( const tripoint &p )
!player_character.has_flag( json_flag_EMP_IMMUNE ) ) {
add_msg( m_bad, _( "The EMP blast fries your %s!" ), it->tname() );
it->deactivate();
it->faults.insert( random_entry( fault::get_by_type( "shorted" ) ) );
it->faults.insert( faults::random_of_type( "shorted" ) );
}
}
}
Expand All @@ -795,7 +795,7 @@ void emp_blast( const tripoint &p )
add_msg( _( "The EMP blast fries the %s!" ), it.tname() );
}
it.deactivate();
it.set_fault( random_entry( fault::get_by_type( "shorted" ) ) );
it.set_fault( faults::random_of_type( "shorted" ) );
}
}
// TODO: Drain NPC energy reserves
Expand Down
Loading
Loading